/* ==========================================================================
   Foodstories Journal: base design system (all pages)
   Page-specific styles live in home.css (homepage) and post.css (posts/pages).
   ========================================================================== */

@font-face { font-family: gilroy; src: url(../fonts/Gilroy-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: gilroy; src: url(../fonts/Gilroy-SemiBold.woff) format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: gilroy; src: url(../fonts/Gilroy-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }
/* One extra-light cut. Weights below 600 render the true cut (elegant at display sizes);
   600+ gets the same synthetic bold the storefront uses (legible at card sizes). */
@font-face { font-family: russolo; src: url(../fonts/Russolo.woff2) format("woff2"); font-display: swap; }

/* ---------- Tokens ---------- */
:root {
    /* Colour */
    --ink: #38383a;            /* brand ink: text, dark bands */
    --ink-2: #5f5c59;          /* secondary text, AA on paper */
    --paper: #fbf8f4;          /* page background, warm cream */
    --paper-2: #f3ede5;        /* panels, image placeholders */
    --line: #e6dfd5;           /* hairlines */
    --white: #fff;
    --fig: #a0383f;            /* brand primary */
    --fig-dark: #7a2930;
    --fig-tint: #f7e9e6;
    --olive: #4f6131;          /* farm accent */
    --olive-dark: #2f3b1f;
    --olive-tint: #eceee2;
    --night: #38383a;          /* dark sections (brand ink) */
    --on-night-2: rgba(255, 255, 255, .72);
    --line-night: rgba(255, 255, 255, .16);

    /* Type */
    --font-sans: var(--gh-font-body, gilroy), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: var(--gh-font-heading, russolo), "Times New Roman", Georgia, serif;
    --t-hero: clamp(2.75rem, 1.6rem + 5vw, 6rem);     /* 44 -> 96 */
    --t-h1: clamp(2.25rem, 1.5rem + 3.4vw, 4.25rem);  /* 36 -> 68 */
    --t-h2: clamp(1.875rem, 1.4rem + 2vw, 3.25rem);   /* 30 -> 52 */
    --t-h3: clamp(1.375rem, 1.2rem + .7vw, 1.75rem);  /* 22 -> 28 */
    --t-card: clamp(1.25rem, 1.15rem + .4vw, 1.5rem); /* 20 -> 24 */
    --t-lede: clamp(1.0625rem, 1rem + .3vw, 1.25rem);
    --t-body: 1.0625rem;                              /* 17 */
    --t-sm: .9375rem;                                 /* 15 */
    --t-xs: .8125rem;                                 /* 13 */

    /* Space & shape */
    --gutter: clamp(16px, 3.5vw, 40px);
    --max: 1320px;
    --narrow: 720px;
    --section: clamp(56px, 4rem + 4vw, 128px);
    --r-sm: 10px;
    --r: 18px;
    --r-lg: 28px;
    --shadow: 0 1px 2px rgba(56, 56, 58, .05), 0 10px 30px -8px rgba(56, 56, 58, .14);
    --ease: cubic-bezier(.2, .7, .2, 1);
    --header-h: 72px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--t-body)/1.6 var(--font-sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--fig); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--fig); color: #fff; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; padding: 10px 16px; border-radius: var(--r-sm); background: var(--ink); color: #fff; }
.skip-link:focus { top: 12px; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--max) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }
.site-main { overflow-x: clip; min-height: 60vh; }
.section { padding-block: var(--section); }
.section--night { background: var(--night); color: #fff; }
.section--night :focus-visible, .site-footer :focus-visible { outline-color: #fff; }

/* ---------- Typography ---------- */
.display { font-family: var(--font-display); font-weight: 400; line-height: 1.02; letter-spacing: -.01em; }
.kicker { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--fig); }
.kicker--light { color: rgba(255, 255, 255, .8); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--t-sm); color: var(--ink-2); }
.lede { font-size: var(--t-lede); line-height: 1.55; color: var(--ink-2); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 48px; margin-bottom: clamp(28px, 3vw, 48px); }
.section-head__text { max-width: 640px; }
.section-head .kicker { margin-bottom: 12px; }
.section-head__title { font: 400 var(--t-h2)/1.04 var(--font-display); letter-spacing: -.01em; }
.section-head__desc { margin-top: 12px; color: var(--ink-2); font-size: var(--t-body); }
.section--night .section-head__desc { color: var(--on-night-2); }
.section-head--center { flex-direction: column; align-items: center; text-align: center; }
.section-head--center .section-head__text { margin-inline: auto; }

/* ---------- Buttons & links ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 26px; border: 1px solid transparent; border-radius: 999px; background: var(--fig); color: #fff; font-size: var(--t-sm); font-weight: 600; line-height: 1.2; cursor: pointer; transition: background .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease); }
.btn:hover { background: var(--fig-dark); }
.btn:active { transform: translateY(1px); }
.btn--sm { min-height: 40px; padding: 8px 20px; }
.btn--ghost { background: transparent; border-color: currentColor; color: var(--ink); }
.btn--ghost:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--light { background: #fff; color: var(--ink); }
.btn--light:hover { background: var(--paper-2); }
.btn--ghost-light { background: transparent; border-color: rgba(255, 255, 255, .5); color: #fff; }
.btn--ghost-light:hover { background: #fff; color: var(--ink); }

.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: var(--t-sm); color: var(--fig); }
.link-arrow::after { content: "\2192"; transition: transform .25s var(--ease); }
.link-arrow:hover::after { transform: translateX(4px); }
.link-arrow--light { color: #fff; }

.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; transition: background .2s; }
.icon-btn:hover { background: var(--paper-2); }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; padding: 9px 18px; border: 1px solid var(--line); border-radius: 999px; font-size: var(--t-sm); font-weight: 600; transition: all .2s var(--ease); }
.chip:hover { border-color: var(--ink); }
.chip[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(251, 248, 244, .86); -webkit-backdrop-filter: saturate(1.5) blur(16px); backdrop-filter: saturate(1.5) blur(16px); border-bottom: 1px solid transparent; transition: border-color .3s; }
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header__inner { display: flex; align-items: center; gap: 16px; height: var(--header-h); }
.site-logo { flex: none; }
.site-logo img { width: 132px; height: auto; }
.site-header__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-header__menu { margin-left: -10px; }
.site-header__menu .icon-close, .site-header.is-open .site-header__menu .icon-open { display: none; }
.site-header.is-open .site-header__menu .icon-close { display: block; }

.site-nav__list a { position: relative; display: block; font-size: .8125rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; transition: color .2s; }
.site-nav__list a:hover, .site-nav__list a[aria-current] { color: var(--fig); }

/* Mobile/tablet: drawer */
@media (max-width: 1199px) {
    .site-nav { position: fixed; inset: var(--header-h) 0 0 0; z-index: 49; display: flex; flex-direction: column; gap: 32px; padding: 32px var(--gutter) 48px; overflow-y: auto; background: var(--paper); visibility: hidden; opacity: 0; transform: translateY(-8px); transition: opacity .3s var(--ease), transform .3s var(--ease), visibility 0s .3s; }
    .site-header.is-open .site-nav { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
    .site-nav__list { display: grid; }
    .site-nav__list li + li { border-top: 1px solid var(--line); }
    .site-nav__list a { padding: 16px 0; font: 400 1.875rem/1.1 var(--font-display); letter-spacing: 0; text-transform: none; }
    .site-nav__shop { align-self: flex-start; }
    /* backdrop-filter makes the header the containing block of the fixed drawer: drop it while open */
    .site-header.is-open { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; }
    body.menu-open { overflow: hidden; }
}
@media (max-width: 479px) { .site-header__shop { display: none; } }
/* Desktop: inline nav */
@media (min-width: 1200px) {
    .site-header__menu, .site-nav__shop { display: none; }
    .site-logo img { width: 156px; }
    .site-nav { margin-inline: auto; }
    .site-nav__list { display: flex; gap: 28px; }
    .site-nav__list a { padding: 8px 0; }
    .site-nav__list a::after { content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1.5px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease); }
    .site-nav__list a:hover::after, .site-nav__list a[aria-current]::after { transform: scaleX(1); }
    .site-header__actions { margin-left: 0; }
}

/* ---------- Cards ---------- */
.card { position: relative; display: flex; flex-direction: column; min-width: 0; }
.card__media { position: relative; aspect-ratio: var(--ratio, 4 / 3); overflow: hidden; border-radius: var(--r); background: var(--paper-2); isolation: isolate; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card__media img { transform: scale(1.045); }
.card__media--empty { background: radial-gradient(120% 90% at 85% 0%, #7d8f4e 0, transparent 55%), linear-gradient(160deg, var(--olive), var(--olive-dark)); }
.card__media--empty::after { content: ""; position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; opacity: .35; background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21v-9'/%3E%3Cpath d='M12 12c0-4 3-7 8-7 0 5-3 8-8 7Z'/%3E%3Cpath d='M12 14c0-3-2.5-5.5-7-5.5 0 4 2.5 6 7 5.5Z'/%3E%3C/svg%3E"); }
.card__body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 18px; }
.card__kicker { position: relative; z-index: 2; padding-block: 12px; margin-block: -12px; }
.card__title { font: 600 var(--t-card)/1.25 var(--font-display); text-wrap: balance; }
.card__title a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .4s var(--ease), color .2s; }
.card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card:hover .card__title a { background-size: 100% 1px; }
.card__excerpt { color: var(--ink-2); font-size: var(--t-sm); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__meta { font-size: var(--t-xs); font-weight: 600; letter-spacing: .02em; }

/* Large: featured story in a grid */
.card--lg .card__title { font-size: var(--t-h3); }
.card--lg .card__media { --ratio: 16 / 11; }
/* Row: compact list item, thumbnail left */
.card--row { flex-direction: row; align-items: center; gap: 16px; }
.card--row .card__media { --ratio: 1; flex: 0 0 clamp(88px, 24%, 128px); border-radius: var(--r-sm); }
.card--row .card__body { padding-top: 0; gap: 6px; }
.card--row .card__title { font-size: 1.1875rem; }
/* Overlay: text on image (tall) */
.card--overlay { color: #fff; }
.card--overlay .card__media { --ratio: 3 / 4; border-radius: var(--r-lg); }
.card--overlay .card__media::before { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, transparent 35%, rgba(20, 18, 17, .82)); }
.card--overlay .card__body { position: absolute; inset: auto 0 0 0; z-index: 2; padding: clamp(20px, 2vw, 28px); }
.card--overlay .card__kicker, .card--overlay .card__meta { color: rgba(255, 255, 255, .85); }
.card--overlay .card__title { font-size: clamp(1.5rem, 1.3rem + .6vw, 1.875rem); }
/* Cards on dark sections */
.section--night .card__excerpt, .section--night .card__meta { color: var(--on-night-2); }
.section--night .card__kicker { color: #f0b8ae; }
.section--night .card__media { background: rgba(255, 255, 255, .06); }

.card-grid { display: grid; gap: clamp(36px, 4vw, 56px) clamp(20px, 2.5vw, 32px); }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Carousel (scroll-snap; main.js wires arrows + progress) ---------- */
.carousel__track { --per: 1.15; --gap: 16px; display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - (var(--per) - 1) * var(--gap)) / var(--per)); gap: var(--gap); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 4px; }
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__track > * { scroll-snap-align: start; }
@media (min-width: 640px) { .carousel__track { --per: 2.2; --gap: 20px; } }
@media (min-width: 1024px) { .carousel__track { --per: 3; --gap: 28px; } }
.carousel__nav { display: none; gap: 10px; flex: none; }
@media (min-width: 768px) { .carousel__nav { display: flex; } }
.carousel__btn { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; transition: all .25s var(--ease); }
.carousel__btn .icon { width: 20px; height: 20px; }
.carousel__btn:hover:not(:disabled) { background: var(--ink); border-color: var(--ink); color: #fff; }
.carousel__btn:disabled { opacity: .3; cursor: default; }
.section--night .carousel__btn { border-color: var(--line-night); color: #fff; }
.section--night .carousel__btn:hover:not(:disabled) { background: #fff; border-color: #fff; color: var(--ink); }
.carousel__progress { position: relative; height: 2px; margin-top: 28px; background: var(--line); border-radius: 2px; overflow: hidden; }
.carousel__progress span { position: absolute; inset: 0 auto 0 0; width: 20%; background: var(--fig); border-radius: 2px; transition: width .2s linear; }
.section--night .carousel__progress { background: var(--line-night); }
.section--night .carousel__progress span { background: #fff; }
.carousel.is-static .carousel__nav, .carousel.is-static .carousel__progress { display: none; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: clamp(48px, 6vw, 80px); padding-top: 24px; border-top: 1px solid var(--line); font-size: var(--t-sm); color: var(--ink-2); }
.pagination a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--ink); }
.pagination a:hover { color: var(--fig); }
.pagination .page-number { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.pagination { position: relative; }
.pagination .older-posts { margin-left: auto; }
.pagination a .arrow, .pagination a span { margin-inline: 6px; }
@media (max-width: 639px) { .pagination .page-number { position: static; transform: none; order: -1; flex-basis: 100%; text-align: center; } .pagination { flex-wrap: wrap; } }

/* ---------- Newsletter ---------- */
.newsletter { background: var(--fig); color: #fff; background-image: radial-gradient(60% 120% at 100% 0%, rgba(255, 255, 255, .12), transparent 60%), radial-gradient(50% 100% at 0% 100%, rgba(0, 0, 0, .18), transparent 60%); }
.newsletter__inner { display: grid; gap: 28px; align-items: center; padding-block: clamp(56px, 7vw, 96px); }
.newsletter__copy .kicker { margin-bottom: 12px; }
.newsletter__title { margin-bottom: 10px; font: 400 var(--t-h2)/1.04 var(--font-display); }
.newsletter__copy p:last-child { color: rgba(255, 255, 255, .82); max-width: 460px; }
.newsletter__form { position: relative; display: flex; flex-wrap: wrap; gap: 10px; }
.newsletter__form input { flex: 1 1 240px; min-height: 52px; padding: 0 22px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; background: rgba(255, 255, 255, .1); color: #fff; }
.newsletter__form input::placeholder { color: rgba(255, 255, 255, .7); }
.newsletter__form input:focus { outline: none; border-color: #fff; background: rgba(255, 255, 255, .16); }
.newsletter__form .btn { min-height: 52px; background: #fff; color: var(--fig); }
.newsletter__form .btn:hover { background: var(--paper-2); }
.newsletter__msg { display: none; flex-basis: 100%; font-size: var(--t-sm); }
.newsletter__form.success .newsletter__msg--ok, .newsletter__form.error .newsletter__msg--err { display: block; }
.newsletter__form.loading .btn { opacity: .6; pointer-events: none; }
@media (min-width: 900px) { .newsletter__inner { grid-template-columns: 1.1fr 1fr; gap: 64px; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--night); color: #fff; padding-top: clamp(56px, 7vw, 96px); }
.site-footer__top { display: grid; gap: 40px 32px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.site-footer__brand { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; max-width: 360px; }
.site-footer__brand img { width: 180px; }
.site-footer__brand p { color: var(--on-night-2); }
.site-footer__col h2 { margin-bottom: 16px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .55); }
.site-footer__col ul { list-style: none; padding: 0; }
.site-footer__col li + li { margin-top: 2px; }
.site-footer__col a { display: inline-block; padding-block: 8px; }
.social { margin-left: -10px; }
.site-footer__col a, .site-footer__bottom a { transition: color .2s; }
.site-footer__col a:hover, .site-footer__bottom p a:hover { color: #f0b8ae; }
.site-footer__bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: clamp(48px, 6vw, 72px); padding-block: 24px; border-top: 1px solid var(--line-night); font-size: var(--t-xs); color: var(--on-night-2); }
.social { display: flex; gap: 4px; }
.social a { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; transition: background .2s; }
.social a:hover { background: rgba(255, 255, 255, .1); }
.social .icon { width: 20px; height: 20px; }
@media (min-width: 900px) {
    .site-footer__top { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
    .site-footer__brand { grid-column: auto; }
    .site-footer__brand img { width: 220px; }
}

/* ---------- Motion ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .js .reveal { opacity: 1; transform: none; }
}

/* Toast (copy link) */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 200; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
    display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px; background: var(--ink); color: #fff;
    font: 500 15px/1.3 var(--font-sans); box-shadow: 0 8px 24px rgba(0,0,0,.18); transition: opacity .2s, transform .2s; }
.toast::before { content: "✓"; color: #b9cf8f; font-weight: 700; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
