/* ==========================================================================
   Foodstories Journal: homepage only (home.hbs + partials/home-*.hbs).
   Builds on the tokens and components in screen.css.
   ========================================================================== */

.home-template .site-main { counter-reset: home-sec; }

/* ---------- Shared: numbered section heads ---------- */
.home-sec { counter-increment: home-sec; }
.home-num { display: inline-flex; align-items: center; }
.home-num::before { content: counter(home-sec, decimal-leading-zero); margin-right: 14px; padding-right: 46px; background: linear-gradient(currentColor, currentColor) right 50% / 32px 1px no-repeat; }
.section--night .home-num { color: #f0b8ae; }

.home-head { flex-wrap: wrap; row-gap: 16px; }
.home-head .section-head__title { text-wrap: balance; }
.home-head__actions { display: flex; align-items: center; gap: 28px; min-height: 48px; }
.home-head__actions .link-arrow { min-height: 44px; }
.home-sec .carousel__progress { max-width: 240px; margin-inline: auto; }

/* Tighter rhythm when two light sections meet */
.home-cooking + .home-tales, .home-people + .home-latest { padding-top: 0; }
.home-people + .home-latest .container::before { content: ""; display: block; height: 1px; margin-bottom: clamp(56px, 6vw, 88px); background: var(--line); }

/* Images: keep the top of tall portrait artwork (names are set at the top), never crop sideways oddly */
.home-sec .card__media img { object-position: 50% 0; }

/* ---------- 1. Masthead ---------- */
.home-hero { padding-top: clamp(20px, 3vw, 40px); }
.home-hero__folio { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--ink); }
.home-hero__folio .kicker { color: var(--ink); }
.home-hero__date { font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.home-hero__head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block: clamp(28px, 4vw, 56px) clamp(24px, 3vw, 40px); }
.home-hero__title { font: 400 var(--t-hero)/.98 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.home-hero__lede { max-width: 36ch; }
.home-hero__chips { margin: 0 calc(-1 * var(--gutter)) clamp(24px, 3vw, 36px); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
.home-hero__chips .chip { display: inline-flex; align-items: center; min-height: 44px; background: var(--white); }
.home-hero__chips .chip:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.home-hero__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--r-lg); background: #1e3b2e; }
.home-hero__media img { width: 100%; height: 100%; object-fit: cover; object-position: 54% 50%; }
@media (min-width: 640px) { .home-hero__media { aspect-ratio: 2 / 1; } }
@media (min-width: 1024px) {
    .home-hero__head { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); align-items: end; gap: 64px; }
    .home-hero__lede { padding-bottom: 12px; }
    .home-hero__chips { flex-wrap: wrap; margin-inline: 0; padding-inline: 0; }
    .home-hero__media { aspect-ratio: 2400 / 820; }
}

/* ---------- In this issue ---------- */
.home-cover { padding-block: clamp(48px, 6vw, 96px) var(--section); }
.home-cover__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 56px; }
.home-lead { position: relative; }
.home-lead__media { position: relative; display: block; aspect-ratio: 16 / 11; overflow: hidden; border-radius: var(--r-lg); isolation: isolate; }
.home-lead__media:not(.card__media--empty) { background: var(--paper-2); }
.home-lead__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.home-lead:hover .home-lead__media img { transform: scale(1.03); }
.home-lead__body { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; max-width: 680px; padding-top: 28px; }
.home-lead__title { font: 400 var(--t-h2)/1.06 var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.home-lead__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.home-lead__title a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .4s var(--ease); }
.home-lead:hover .home-lead__title a { background-size: 100% 1px; }
.home-lead__excerpt { font-size: var(--t-lede); line-height: 1.55; color: var(--ink-2); }

.home-toc { padding-top: 16px; border-top: 1px solid var(--ink); }
.home-toc__title { font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.home-toc__list { counter-reset: toc; margin-top: 4px; }
.home-toc__item { counter-increment: toc; position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 76px; gap: 16px; align-items: start; padding-block: 22px; border-bottom: 1px solid var(--line); }
.home-toc__item::before { content: counter(toc, decimal-leading-zero); font: 400 1.75rem/1 var(--font-display); color: var(--fig); }
.home-toc__body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.home-toc__h { font: 600 1.1875rem/1.28 var(--font-display); text-wrap: balance; }
.home-toc__h a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.home-toc__h a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .4s var(--ease); }
.home-toc__item:hover .home-toc__h a { background-size: 100% 1px; }
.home-toc__meta { font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); }
.home-toc__thumb { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-sm); }
.home-toc__thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; transition: transform .8s var(--ease); }
.home-toc__item:hover .home-toc__thumb img { transform: scale(1.06); }
.home-toc__thumb.card__media--empty::after { width: 30px; height: 30px; }
.home-toc__all { margin-top: 24px; min-height: 44px; }
@media (min-width: 1024px) {
    .home-cover__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(40px, 4.5vw, 72px); align-items: start; }
    .home-toc__item { grid-template-columns: 44px minmax(0, 1fr) 88px; }
}

/* ---------- 2. Stories On Our Shelves (dark) ---------- */
.home-shelves .carousel__track { --per: 1.3; }
@media (min-width: 640px) { .home-shelves .carousel__track { --per: 2.4; } }
@media (min-width: 1024px) { .home-shelves .carousel__track { --per: 3; --gap: 24px; } }
@media (min-width: 1200px) { .home-shelves .carousel__track { --per: 4; } }
.home-shelves .card--overlay .card__media { --ratio: 4 / 5; }
.home-shelves .card--overlay .card__kicker { display: none; }
.home-shelves .card--overlay .card__media::before { background: linear-gradient(180deg, transparent 40%, rgba(20, 18, 17, .86)); }

/* ---------- 3. What's Cooking this Week? ---------- */
.home-cooking__card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; border-radius: var(--r-lg); background: var(--paper-2); }
.home-cooking__media { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; }
.home-cooking__media:not(.card__media--empty) { background: var(--night); }
.home-cooking__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transition: transform .9s var(--ease); }
.home-cooking__card:hover .home-cooking__media img { transform: scale(1.03); }
.home-cooking__body { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 16px; padding: clamp(28px, 5vw, 80px); }
.home-cooking__title { font: 400 var(--t-h1)/1.04 var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.home-cooking__title a:hover { color: var(--fig); }
.home-cooking__excerpt { max-width: 52ch; font-size: var(--t-lede); line-height: 1.55; color: var(--ink-2); }
.home-cooking__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 12px; }
.home-cooking__actions .link-arrow { min-height: 44px; }
@media (min-width: 720px) {
    .home-cooking__card { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
    .home-cooking__media { align-self: stretch; aspect-ratio: auto; width: 100%; min-height: 100%; } /* 4:5 sets the minimum; a taller body only reveals more of the portrait */
}

/* ---------- 4. Table Tales ---------- */
.home-tales .card__media { --ratio: 4 / 5; }
.home-tales .card__kicker { display: none; }
@media (min-width: 1024px) { .home-tales .carousel__track { --per: 3; --gap: 32px; } }

/* ---------- 5. Recipes Handpicked (dark, split: heading left, rail right) ---------- */
.home-recipes .card__media { --ratio: 2 / 3; border: 1px solid var(--line-night); }
.home-recipes .card__kicker { display: none; }
.home-recipes .carousel__track { --per: 1.45; }
@media (min-width: 640px) { .home-recipes .carousel__track { --per: 2.4; } }
@media (min-width: 1024px) {
    .home-split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(40px, 5vw, 80px); align-items: stretch; }
    .home-split > .home-head { flex-direction: column; align-items: flex-start; justify-content: space-between; margin-bottom: 0; padding-block: 8px 8px; }
    .home-split .home-head__actions { flex-direction: row-reverse; justify-content: flex-end; }
    .home-split .carousel__track { --per: 2.2; --gap: 24px; }
    .home-split .carousel__progress { margin-inline: 0; }
}
@media (min-width: 1200px) { .home-split .carousel__track { --per: 2.5; } }

/* ---------- 6. Meet Our Growers (olive) ---------- */
.home-farms { background: var(--olive-tint); }
.home-farms .home-num, .home-farms .link-arrow { color: var(--olive); }
.home-farms .carousel__btn { border-color: rgba(79, 97, 49, .3); color: var(--olive-dark); }
.home-farms .carousel__btn:hover:not(:disabled) { background: var(--olive-dark); border-color: var(--olive-dark); color: #fff; }
.home-farms .carousel__progress { background: rgba(79, 97, 49, .18); }
.home-farms .carousel__progress span { background: var(--olive); }
.home-farms .carousel__track { counter-reset: farm; }
@media (min-width: 1024px) { .home-farms .carousel__track { --per: 3; --gap: 24px; } }

.home-farm { counter-increment: farm; position: relative; display: flex; flex-direction: column; align-items: flex-start; min-height: clamp(360px, 30vw, 440px); padding: clamp(28px, 2.6vw, 40px); overflow: hidden; isolation: isolate; border-radius: var(--r-lg); background: var(--paper); box-shadow: inset 0 0 0 1px rgba(79, 97, 49, .14); transition: box-shadow .35s var(--ease), transform .35s var(--ease); }
/* Botanical watermark: the same leaf mark as empty card media, drawn large */
.home-farm::before { content: ""; position: absolute; top: -28px; right: -36px; z-index: -1; width: 220px; height: 220px; opacity: .1; transform: rotate(-12deg); transition: transform .8s var(--ease), opacity .4s; 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='%234f6131' stroke-width='.7' 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"); }
.home-farm:hover { box-shadow: inset 0 0 0 1px var(--olive), var(--shadow); transform: translateY(-3px); }
.home-farm:hover::before { opacity: .16; transform: rotate(0deg) scale(1.06); }
.home-farm__no { display: inline-flex; align-items: center; gap: 10px; font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--olive); }
.home-farm__no::before { content: ""; width: 26px; height: 26px; border-radius: 50%; background: var(--olive) center / 16px 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.6' 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"); }
.home-farm__no::after { content: "Grower No. " counter(farm, decimal-leading-zero); }
.home-farm__title { margin-top: auto; padding-top: 40px; font: 400 clamp(1.75rem, 1.4rem + 1.2vw, 2.375rem)/1.08 var(--font-display); letter-spacing: -.01em; color: var(--olive-dark); text-wrap: balance; }
.home-farm__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.home-farm__excerpt { margin-top: 16px; color: var(--ink-2); font-size: var(--t-sm); line-height: 1.55; max-width: 32ch; }
.home-farm__excerpt::before { content: ""; display: block; width: 40px; height: 1px; margin-bottom: 16px; background: var(--olive); opacity: .5; }
.home-farm__more { margin-top: 22px; font-size: var(--t-sm); font-weight: 700; color: var(--olive); }
.home-farm__more::after { content: "\2002\2192"; display: inline-block; transition: transform .25s var(--ease); }
.home-farm:hover .home-farm__more::after { transform: translateX(4px); }
/* With a photo: image behind, olive wash, light type */
.home-farm--photo { background: var(--olive-dark); color: #fff; }
.home-farm__img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.home-farm--photo::before { display: none; }
.home-farm--photo .home-farm__title, .home-farm--photo .home-farm__no, .home-farm--photo .home-farm__more { color: #fff; }
.home-farm--photo .home-farm__excerpt { color: rgba(255, 255, 255, .85); }
.home-farm--photo .home-farm__excerpt::before { background: #fff; }

/* ---------- 7. Bring Your Stories of Food to Life ---------- */
.home-cta { padding-block: 0 var(--section); }
.home-cta__panel { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; isolation: isolate; border-radius: var(--r-lg); background: #1d1c1b; color: #fff; }
.home-cta__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 30%; -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent); mask-image: linear-gradient(180deg, #000 55%, transparent); }
.home-cta__body { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 0 clamp(24px, 5vw, 72px) clamp(36px, 5vw, 72px); margin-top: -32px; }
.home-cta__title { font: 400 var(--t-h2)/1.04 var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.home-cta__text { max-width: 44ch; color: var(--on-night-2); }
.home-cta .btn { margin-top: 8px; }
@media (min-width: 900px) {
    .home-cta__panel { min-height: 440px; align-items: center; }
    .home-cta__img { position: absolute; inset: 0 0 0 auto; z-index: -1; width: 64%; height: 100%; aspect-ratio: auto; object-position: 50% 50%; -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%); mask-image: linear-gradient(90deg, transparent, #000 45%); }
    .home-cta__body { max-width: 560px; margin: 0; padding: clamp(48px, 5vw, 80px); }
}

/* ---------- 8. Stories Of People ---------- */
.home-people .carousel__track { --per: 1.25; }
@media (min-width: 640px) { .home-people .carousel__track { --per: 2.2; } }
@media (min-width: 1024px) { .home-people .carousel__track { --per: 3; --gap: 28px; } }
@media (min-width: 1200px) { .home-people .carousel__track { --per: 4; } }
.home-person { position: relative; display: flex; flex-direction: column; min-width: 0; padding-bottom: 2px; }
.home-person__media { position: relative; aspect-ratio: 9 / 16; overflow: hidden; border-radius: var(--r); }
.home-person__media:not(.card__media--empty) { background: var(--night); }
.home-person__media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transition: filter .6s var(--ease), transform .9s var(--ease); }
@media (hover: hover) {
    .home-person__media img { filter: grayscale(1) contrast(1.04); }
    .home-person:hover .home-person__media img, .home-person:focus-within .home-person__media img { filter: none; transform: scale(1.03); }
}
.home-person__body { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; margin: -72px 16px 0; padding: 24px 20px 26px; border-radius: var(--r); background: var(--white); box-shadow: var(--shadow); text-align: center; flex: 1; }
.home-person__title { font: 600 var(--t-card)/1.25 var(--font-display); text-wrap: balance; }
.home-person__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.home-person__excerpt { color: var(--ink-2); font-size: var(--t-sm); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.home-person__more { margin-top: auto; padding-top: 4px; font-size: var(--t-sm); font-weight: 700; color: var(--fig); }
.home-person__more::after { content: "\2002\2192"; display: inline-block; transition: transform .25s var(--ease); }
.home-person:hover .home-person__more::after { transform: translateX(4px); }

/* ---------- 9. Latest Stories ---------- */
.home-latest .card-grid { row-gap: clamp(28px, 3.5vw, 48px); }
.home-latest .card__media { --ratio: 4 / 5; }
@media (min-width: 1200px) { .home-latest .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Phones: a compact list instead of twelve full-width cards */
@media (max-width: 639px) {
    .home-latest .card-grid { gap: 0; }
    .home-latest .card { flex-direction: row; align-items: center; gap: 16px; padding-block: 16px; border-bottom: 1px solid var(--line); }
    .home-latest .card:first-child { padding-top: 0; }
    .home-latest .card:last-child { border-bottom: 0; }
    .home-latest .card__media { --ratio: 1; flex: 0 0 104px; border-radius: var(--r-sm); }
    .home-latest .card__media img { object-position: 50% 45%; }
    .home-latest .card__media--empty::after { width: 28px; height: 28px; }
    .home-latest .card__body { padding-top: 0; gap: 6px; }
    .home-latest .card__title { font-size: 1.125rem; }
}

/* Hint that category chips scroll on small screens */
@media (max-width: 767px) { .home .chips { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); } }

/* Hide navigation that has nothing to choose between: a single category chip, a number on the only section */
.home-hero__chips:not(:has(.chip + .chip)) { display: none; }
.home-template .site-main:not(:has(.home-sec ~ .home-sec)) .home-num::before { display: none; }

/* From Field to Kitchen */
.home-path { padding-block: var(--section); }
.home-path__head { max-width: 640px; margin-bottom: clamp(32px, 4vw, 56px); }
.home-path__title { margin-top: 12px; font: 400 var(--t-h2)/1.1 var(--font-display); }
.home-path__steps { counter-reset: step; display: grid; gap: 0; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.home-path__steps li { counter-increment: step; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.home-path__steps li::before { content: counter(step, decimal-leading-zero); font: 400 2.25rem/1 var(--font-display); color: var(--olive); }
.home-path__steps h3 { margin: 6px 0 0; font: 600 1.125rem/1.3 var(--font-sans); }
.home-path__steps p { margin: 0; max-width: 34ch; color: var(--ink-2); }
.home-path__steps .link-arrow { margin-top: 6px; }
@media (min-width: 768px) {
    .home-path__steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .home-path__steps li { padding: 32px 32px 8px 0; border-bottom: 0; }
    .home-path__steps li + li { padding-left: 32px; border-left: 1px solid var(--line); }
}

/* Space between the hero image and a coloured band when "In this issue" is absent */
.home-hero + .section { margin-top: clamp(48px, 6vw, 96px); }

/* Grower cards with photos: darken the lower half so the white title stays legible on any photo */
.home-farm--photo::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(28, 34, 18, .45) 0%, rgba(28, 34, 18, .3) 30%, rgba(28, 34, 18, .75) 58%, rgba(28, 34, 18, .92) 100%); }
.home-farm--photo .home-farm__img { opacity: .9; }
.home-farm--photo .home-farm__title { text-shadow: 0 1px 12px rgba(0, 0, 0, .35); }
