/* Food Health Lab — news listing + article + composition directives.
   Consistency comes from this frame; freedom lives in the article body (index.md).
   The :::carousel / :::gallery directives render as <div class="carousel|gallery">
   via Markdig advanced extensions — styled here, made swipeable by news.js. */

:root {
    --news-max: 760px;
    --news-radius: 12px;
    --news-ink: var(--ink, #1c2b23);
    --news-muted: var(--muted, #5b6b62);
    --news-accent: var(--accent, #2f7d5b);
    --news-line: var(--line, #e4ebe6);
    --news-card-bg: var(--card, #fff);
}

/* ---------- Listing ---------- */
.news-index { max-width: 1080px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.news-index__head { margin-bottom: 2rem; }
.news-index__head h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 .4rem; }
.news-index__intro { color: var(--news-muted); max-width: 60ch; font-size: 1.05rem; }
.news-empty { color: var(--news-muted); }
.news-section + .news-section { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--news-line); }
.news-section h2 { font-size: 1.35rem; margin: 0 0 1rem; }
.news-section__intro { color: var(--news-muted); max-width: 62ch; margin: -.35rem 0 1.2rem; }

.news-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.news-card { display: flex; }
.news-card__link {
    display: flex; flex-direction: column; text-decoration: none; color: inherit;
    background: var(--news-card-bg); border: 1px solid var(--news-line);
    border-radius: var(--news-radius); overflow: hidden; width: 100%;
    transition: box-shadow .18s ease, transform .18s ease;
}
.news-card__link:hover { box-shadow: 0 10px 30px rgba(20, 40, 30, .12); transform: translateY(-2px); }
.news-card__media {
    display: block;
    aspect-ratio: 16 / 9;
    background: #eef2ef;
    overflow: hidden;
    flex: 0 0 auto;
}
.news-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* biased upward: faces sit in the top half of most portraits */
    object-position: center 32%;
    display: block;
}
.news-card__body { display: flex; flex-direction: column; gap: .45rem; padding: 1rem 1.1rem 1.2rem; }
.news-card__cat {
    font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
    color: var(--news-accent); font-weight: 600;
}
.news-card__title { font-size: 1.2rem; font-weight: 650; line-height: 1.25; }
.news-card__teaser { color: var(--news-muted); font-size: .95rem; line-height: 1.45; }
.news-card__date { color: var(--news-muted); font-size: .8rem; margin-top: .15rem; }
.news-podcast { margin-top: 3rem; padding: 2rem; border: 1px solid var(--news-line); border-radius: var(--news-radius); background: #f2f8f4; display: flex; gap: 1.5rem; justify-content: space-between; align-items: center; }
.news-podcast__eyebrow { margin: 0 0 .35rem; color: var(--news-accent); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.news-podcast h2 { margin: 0 0 .5rem; font-size: 1.4rem; }
.news-podcast p:not(.news-podcast__eyebrow) { margin: 0; max-width: 62ch; color: var(--news-muted); line-height: 1.5; }
.news-podcast__link { flex: 0 0 auto; color: #fff; background: var(--news-accent); border-radius: 999px; padding: .7rem 1rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.news-podcast__link:hover { background: #246747; }
@media (max-width: 620px) { .news-podcast { padding: 1.4rem; align-items: flex-start; flex-direction: column; } }

/* ---------- Article ---------- */
.news-preview-banner {
    background: #fff4d6; border-bottom: 1px solid #f0d98a; color: #6b5417;
    text-align: center; padding: .6rem 1rem; font-size: .9rem; font-weight: 600;
}
.news-article { max-width: var(--news-max); margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.news-article__head { margin-bottom: 1.5rem; }
.news-article__cat {
    font-size: .75rem; letter-spacing: .06em; text-transform: uppercase;
    color: var(--news-accent); font-weight: 600;
}
.news-article__head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.15; margin: .3rem 0 .5rem; }
.news-article__meta { color: var(--news-muted); font-size: .9rem; }
.news-article__hero { margin: 0 0 2rem; }
.news-article__hero img { width: 100%; border-radius: var(--news-radius); display: block; }

.news-article__body { font-size: 1.08rem; line-height: 1.72; color: var(--news-ink); }
.news-article__body > * + * { margin-top: 1.15rem; }
.news-article__body h2 { font-size: 1.5rem; margin-top: 2.2rem; line-height: 1.25; }
.news-article__body h3 { font-size: 1.2rem; margin-top: 1.8rem; }
.news-article__body img { max-width: 100%; border-radius: 10px; display: block; }
.news-article__body figure { margin: 1.6rem 0; }
.news-article__body figure img { width: 100%; }
.news-article__body figcaption { color: var(--news-muted); font-size: .85rem; margin-top: .5rem; text-align: center; }
.news-article__body blockquote {
    border-left: 3px solid var(--news-accent); padding-left: 1rem;
    color: var(--news-muted); font-style: italic;
}
.news-article__body video { width: 100%; border-radius: 10px; display: block; }

/* Markdig wraps each directive image in a <p>; collapse that wrapper so the
   images become direct flex/grid items of .carousel / .gallery. */
.news-article__body .carousel > p,
.news-article__body .gallery > p { display: contents; }

/* ---------- :::gallery — responsive grid ---------- */
.news-article__body .gallery {
    display: grid; gap: .75rem; margin: 1.6rem 0;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.news-article__body .gallery img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }

/* ---------- :::carousel — swipeable strip (news.js adds arrows) ---------- */
.news-article__body .carousel {
    position: relative; margin: 1.8rem 0;
    display: flex; gap: .75rem; overflow-x: auto; scroll-snap-type: x mandatory;
    scroll-behavior: smooth; -webkit-overflow-scrolling: touch; padding-bottom: .4rem;
}
.news-article__body .carousel::-webkit-scrollbar { height: 6px; }
.news-article__body .carousel::-webkit-scrollbar-thumb { background: var(--news-line); border-radius: 3px; }
.news-article__body .carousel img {
    flex: 0 0 88%; max-width: 88%; scroll-snap-align: center; object-fit: cover; aspect-ratio: 3 / 2;
}
@media (min-width: 720px) {
    .news-article__body .carousel img { flex-basis: 60%; max-width: 60%; }
}
.news-carousel__btn {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.9); box-shadow: 0 2px 8px rgba(0,0,0,.2);
    font-size: 1.2rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.news-carousel__btn--prev { left: .5rem; }
.news-carousel__btn--next { right: .5rem; }

/* ---------- Sources ---------- */
.news-sources { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--news-line); }
.news-sources h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.news-sources ul { margin: 0; padding-left: 1.1rem; color: var(--news-muted); font-size: .92rem; }
.news-sources li + li { margin-top: .4rem; }
.news-sources a { color: var(--news-accent); }
.news-sources__pub { color: var(--news-muted); }
