/* ==========================================================================
   Community feed.

   Requires css/design-tokens.css.

   Mirrors the app's Community tab. A single column, because the feed is a
   reading experience and a grid of cards makes people scan rather than read.
   ========================================================================== */

body.community-page {
    background-color: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    -webkit-font-smoothing: antialiased;
}

.community-header {
    padding: 44px 0 28px;
    background: linear-gradient(180deg, var(--tile-green) 0%, var(--paper) 100%);
    border-bottom: 1px solid var(--divider);
}

.community-header__inner,
.community-shell {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px;
}

.community-shell {
    padding-bottom: 72px;
}

.community-header__kicker {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1rem;
    color: var(--turmeric-text);
}

.community-header__title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem);
    line-height: 1.14;
    color: var(--ink);
}

.community-header__lead {
    margin: 10px 0 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--dark-grey);
}

/* --------------------------------------------------------------------------
   Composer
   -------------------------------------------------------------------------- */

.composer {
    margin: 28px 0 32px;
    padding: 18px;
    border: 1px solid var(--divider);
    border-radius: var(--r-lg);
    background: #fff;
    box-shadow: var(--shadow-card);
}

.composer__row {
    display: flex;
    gap: 12px;
}

.composer__input {
    flex: 1 1 auto;
    min-height: 74px;
    padding: 11px 14px;
    border: 1px solid var(--divider);
    border-radius: var(--r-sm);
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 0.98rem;
    line-height: 1.55;
    resize: vertical;
}

.composer__input:focus {
    border-color: var(--cardamom);
    outline: 2px solid rgba(11, 68, 51, 0.22);
    outline-offset: 1px;
}

.composer__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    padding-left: 56px;
}

.composer__preview {
    position: relative;
    display: inline-block;
    margin-top: 12px;
    margin-left: 56px;
}

.composer__preview img {
    max-height: 160px;
    border-radius: var(--r-md);
    display: block;
}

.composer__drop {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(20, 32, 25, 0.72);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

/* The real file input is unstylable across browsers, so the label is the
   control and the input itself is hidden from sight but not from the
   accessibility tree. */
.composer__file { display: none; }

.composer__attach {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    color: var(--cardamom);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.composer__attach:hover { background: var(--tile-green); }

.composer__signin {
    margin: 0;
    padding: 16px 18px;
    border-radius: var(--r-md);
    background: var(--tile-green);
    color: var(--cardamom-strong);
    font-size: 0.95rem;
    text-align: center;
}

.composer__signin a {
    color: var(--cardamom);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Posts
   -------------------------------------------------------------------------- */

.feed { margin: 0; padding: 0; list-style: none; }

.post {
    margin-bottom: 20px;
    border: 1px solid var(--divider);
    border-radius: var(--r-lg);
    background: #fff;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.post__head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
}

.avatar {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    background: var(--tile-green);
}

.avatar--sm { width: 34px; height: 34px; }

.post__who { min-width: 0; flex: 1 1 auto; }

.post__name {
    display: block;
    font-weight: 600;
    font-size: 0.98rem;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--cement-grey);
}

.post__body {
    padding: 0 18px 14px;
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--dark-grey);
    overflow-wrap: break-word;
}

.post__image {
    display: block;
    width: 100%;
    max-height: 520px;
    object-fit: cover;
    background: var(--tile-green);
}

.post__recipe {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 14px 18px 0;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--tile-green);
    color: var(--cardamom);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
}

.post__recipe:hover { background: var(--light-green); text-decoration: none; }

.post__actions {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
    border-top: 1px solid var(--divider);
    margin-top: 14px;
}

.act {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--cement-grey);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.act:hover { background: var(--tile-green); color: var(--cardamom); }

.act:focus-visible,
.composer__attach:focus-visible {
    outline: 3px solid var(--turmeric);
    outline-offset: 2px;
}

/* Liked is a filled heart in chili, so the state reads at a glance rather
   than only from the count next to it. */
.act--liked { color: var(--chili); }
.act--liked svg { fill: currentColor; }

.act__count { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Comments
   -------------------------------------------------------------------------- */

.comments {
    padding: 4px 18px 16px;
    border-top: 1px solid var(--divider);
}

.comments[hidden] { display: none; }

.comment {
    display: flex;
    gap: 10px;
    padding: 12px 0;
}

.comment__body {
    min-width: 0;
    font-size: 0.93rem;
    line-height: 1.55;
    color: var(--dark-grey);
    overflow-wrap: break-word;
}

.comment__name {
    display: block;
    font-weight: 600;
    color: var(--ink);
}

.comment__time {
    margin-left: 6px;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--cement-grey);
}

.comment-form {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding-top: 12px;
    border-top: 1px solid var(--divider);
}

.comment-form__input {
    flex: 1 1 auto;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--divider);
    border-radius: var(--r-sm);
    background: var(--paper);
    font-family: var(--font-ui);
    font-size: 0.93rem;
    resize: vertical;
}

.comment-form__input:focus {
    border-color: var(--cardamom);
    outline: 2px solid rgba(11, 68, 51, 0.2);
    outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   Buttons, states
   -------------------------------------------------------------------------- */

.btn-community {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--r-sm);
    background: var(--cardamom);
    color: var(--paper);
    font-family: var(--font-ui);
    font-size: 0.94rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.btn-community:hover { background: var(--cardamom-strong); color: var(--paper); }
.btn-community:disabled { opacity: 0.55; cursor: default; }
.btn-community:focus-visible { outline: 3px solid var(--turmeric); outline-offset: 2px; }

.btn-more {
    display: block;
    width: 100%;
    min-height: 48px;
    margin-top: 8px;
    border: 0;
    border-radius: var(--r-md);
    background: transparent;
    box-shadow: inset 0 0 0 1.4px rgba(11, 68, 51, 0.35);
    color: var(--cardamom-strong);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-more:hover { background: rgba(11, 68, 51, 0.06); }

.feed-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--cement-grey);
}

.feed-state__title {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--ink);
}

.skeleton-post {
    height: 190px;
    margin-bottom: 20px;
    border-radius: var(--r-lg);
    background: linear-gradient(90deg, var(--tile-green) 25%, #eef3ef 37%, var(--tile-green) 63%);
    background-size: 400% 100%;
    animation: community-shimmer 1.4s ease infinite;
}

@keyframes community-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton-post { animation: none; }
}

.is-hidden { display: none !important; }

@media (max-width: 640px) {
    .community-header { padding: 30px 0 22px; }
    .community-header__inner, .community-shell { padding-left: 16px; padding-right: 16px; }
    .composer__foot, .composer__preview { padding-left: 0; margin-left: 0; }
    .composer__row { flex-direction: column; }
    .composer__row .avatar { display: none; }
}
