/*
  Home: one continuous cross-section of the earth.
  Surface (layered village + tin) > soil > underground kitchen > pantry > kitchen table > bulk tunnel > cellar > bedrock.
  Every scene sits on a 16:9 "stage" that covers its box, so cut-outs can be placed in % of the painting.
*/

/* ---------- Surface ---------- */
.hero { position: relative; isolation: isolate; height: max(100svh, 660px); background: var(--sky); overflow: hidden; }
.scene { --sh: max(56.25vw, 74svh); --sw: max(100vw, calc(var(--sh) * 16 / 9)); position: absolute; left: 0; right: 0; bottom: 0; height: var(--sh); }
.stage { position: absolute; bottom: calc(var(--drop, 0px) * -1); left: 50%; width: var(--sw); height: calc(var(--sw) * 9 / 16); margin-left: calc(var(--sw) / -2); }
/* every plane is the full painting size and a touch oversized, so no edge can ever show when it moves */
.layer { position: absolute; inset: 0; will-change: transform; pointer-events: none; scale: 1.05; transform-origin: 50% 100%; }
.layer img { width: 100%; height: 100%; object-fit: fill; }
.l-sky { z-index: 1; }
.l-mid { z-index: 4; }
.l-ledge { z-index: 5; pointer-events: none; }
.l-ledge .hero-tin { position: absolute; z-index: 6; left: 45.2%; bottom: 19%; width: 16%; aspect-ratio: 800 / 1159; }
.l-neem { z-index: 8; inset: -14% auto auto -11%; width: 58%; height: 58%; transform-origin: 0 0; scale: 1; }

.hero-tin { position: absolute; z-index: 6; left: 45.5%; bottom: 19%; width: 13.5%; aspect-ratio: 640 / 930; }
.tin-btn { position: absolute; inset: 0; z-index: 2; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 18px; -webkit-tap-highlight-color: transparent; }
.tin-btn .tin { width: 100%; height: 100%; object-fit: contain; transition: transform 700ms var(--ease-out); transform-origin: 50% 100%; }
.tin-btn:hover .tin, .tin-btn:focus-visible .tin { transform: translateY(-2%) rotate(-1.5deg); }
.tin-btn .lid { position: absolute; left: 13.5%; top: 26.5%; width: 43%; height: auto; transform-origin: 50% 100%; }
.tin-btn:focus-visible { outline: 3px solid var(--red); outline-offset: 6px; }
.tap-hint { position: absolute; z-index: 3; left: 35%; top: 13%; transform: translateX(-50%); white-space: nowrap; padding: 6px 14px; border-radius: 999px; background: var(--cream); color: var(--ink); font-size: clamp(12px, .9vw, 15px); font-weight: 600; box-shadow: 0 0 0 1.5px var(--ink); pointer-events: none; }
.tap-hint::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1.5px; height: 14px; background: var(--ink); }

.hero-copy { position: relative; z-index: 9; padding: calc(var(--nav-h) + clamp(18px, 4.5vh, 56px)) var(--gutter) 0; text-align: center; }
.hero h1 .w { display: inline-block; will-change: transform; }
.hero h1 { position: relative; z-index: 9; font-size: clamp(2.6rem, 5.4vw, 6.4rem); color: var(--ink); }
.hero-row { position: relative; z-index: 9; display: grid; justify-items: center; gap: 20px; margin-top: clamp(12px, 2vh, 22px); }
.hero-row p { margin: 0; max-width: 42ch; font-size: clamp(1.05rem, 1.3vw, 1.28rem); line-height: 1.45; color: var(--ink-2); }
.hero-row .ctas { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.js .hero [data-hide] { visibility: hidden; }
@media (max-width: 640px) {
  .scene { --sh: 62svh; }
  .hero-row .ctas .ghost { display: none; }
}

/* Dive: a gold disc grows out of the tin's mouth and lands you in the kitchen */
.dive { position: fixed; inset: 0; z-index: 80; background: var(--gold); clip-path: circle(0px at 50% 50%); pointer-events: none; visibility: hidden; }

/* ---------- Soil ---------- */
.soil { position: relative; z-index: 2; isolation: isolate; padding: clamp(120px, 14vw, 220px) 0 clamp(150px, 18vw, 260px); overflow: hidden; }
.soil::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url(/assets/v2/bg-soil.jpg) center 9% / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 82%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 82%, transparent 100%); }
.drops { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.drop { position: absolute; width: clamp(10px, 1vw, 16px); }
.drop path { fill: var(--gold); stroke: #9C6B12; stroke-width: 1.4; }
.soil-copy { position: relative; z-index: 1; text-align: center; }
.soil-copy .plate { max-width: 1060px; margin: 0 auto; padding: clamp(60px, 8vw, 120px) clamp(40px, 9vw, 150px); background: rgba(255, 240, 214, .9);
  -webkit-mask-image: radial-gradient(closest-side, #000 74%, transparent 100%); mask-image: radial-gradient(closest-side, #000 74%, transparent 100%); }
.soil h2 { font-size: clamp(2.4rem, 5.4vw, 5.2rem); }
.soil .say { margin: 22px auto 0; max-width: 30ch; font-family: var(--serif); font-size: clamp(1.4rem, 2.4vw, 2.2rem); line-height: 1.22; color: var(--ink); }
.facts { list-style: none; margin: clamp(70px, 9vw, 130px) auto 0; padding: 0; max-width: 1100px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--cream); border-radius: var(--r-lg); position: relative; z-index: 1; }
.facts li { padding: clamp(24px, 3vw, 40px); display: grid; gap: 8px; align-content: start; }
.facts li + li { border-left: 1px solid var(--rule); }
.facts .n { font-family: var(--serif); font-size: clamp(3.4rem, 6.4vw, 6.4rem); line-height: .9; color: var(--red); font-variant-numeric: tabular-nums; }
.facts .n small { font-size: .34em; margin-left: .1em; color: var(--ink); }
.facts .what { color: var(--ink-2); }
@media (max-width: 760px) {
  .soil-copy .plate { border-radius: 40px; }
  .facts { grid-template-columns: 1fr; margin-inline: var(--gutter); }
  .facts li + li { border-left: 0; border-top: 1px solid var(--rule); }
}

/* ---------- Underground kitchen (pinned) ---------- */
.kitchen { position: relative; }
.cook-pin { position: relative; height: 100svh; min-height: 640px; overflow: hidden; }
.kstage { --kw: max(100vw, calc(100svh * 16 / 9)); position: absolute; top: 50%; left: 50%; width: var(--kw); height: calc(var(--kw) * 9 / 16); margin: calc(var(--kw) * -9 / 32) 0 0 calc(var(--kw) / -2); }
.kstage > img.kbg { position: absolute; inset: 0; width: 100%; height: 100%; }
.kstage > img.kbg + img.kbg { opacity: 0; }

.kfg { position: absolute; inset: -4% -3%; width: 106%; height: 108%; max-width: none; z-index: 3; pointer-events: none; }
.sniff { z-index: 2; }
.sniff { position: absolute; left: 40.5%; bottom: 5.5%; width: 13%; height: auto; }
.cook-copy { position: absolute; z-index: 2; left: max(var(--gutter), calc(50% - 680px)); top: 41%; transform: translateY(-50%); width: min(35vw, 500px); }
.cook h2 { font-size: clamp(2.4rem, 4.2vw, 4.4rem); }
.steps { list-style: none; margin: clamp(24px, 3.5vh, 40px) 0 0; padding: 0; display: grid; gap: 22px; }
.step .num { font-weight: 600; font-size: 14px; letter-spacing: .12em; color: var(--red); }
.step h3 { margin: 6px 0; font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 2.3vw, 2.2rem); line-height: 1.1; }
.step p { margin: 0; color: var(--ink-2); max-width: 36ch; }
.rail { margin-top: clamp(24px, 3.5vh, 40px); max-width: 480px; }
.rail-track { position: relative; height: 4px; border-radius: 4px; background: rgba(58, 26, 16, .18); overflow: hidden; }
.rail-fill { position: absolute; inset: 0; background: var(--red); transform: scaleX(.25); transform-origin: 0 50%; }
.rail-ticks { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.rail-ticks span.on { color: var(--red); }
.cook-more { margin-top: 26px; }
.cook.is-stacked .steps { position: relative; display: block; min-height: 170px; }
.cook.is-stacked .step { position: absolute; inset: 0 0 auto 0; }
@media (max-width: 899px) {
  .cook-pin { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .kstage { --kw: calc(56svh * 16 / 9); position: relative; top: auto; left: calc(50% - var(--kw) * .62); margin: 0; flex: none; }
  .cook-pin { overflow: hidden; }
  .cook-copy { position: relative; left: auto; top: auto; transform: none; width: auto; padding: 28px var(--gutter) 40px; background: var(--cream); }
  .cook h2 { font-size: 2.3rem; }
  .cook.is-stacked .steps { min-height: 150px; }
  .cook.is-pinned-mobile .cook-pin { height: 100svh; }
}

/* ---------- Pantry: the range on shelves ---------- */
.pantry { position: relative; }
.pstage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: url(/assets/v2/bg-pantry.jpg) center / 100% 100% no-repeat; }
.p-head { position: absolute; left: 0; right: 0; top: 7%; text-align: center; }
.p-head h2 { font-size: clamp(2.2rem, 4.6vw, 4.6rem); }
.p-head p { margin: 10px auto 0; max-width: 46ch; color: var(--ink-2); font-size: clamp(1rem, 1.2vw, 1.15rem); }
.shelf-tin { position: absolute; left: var(--x); bottom: var(--b); width: var(--w); text-decoration: none; display: block; }
.shelf-tin img { width: 100%; height: auto; transition: transform 700ms var(--ease-out); transform-origin: 50% 100%; }
.shelf-tin:hover img, .shelf-tin:focus-visible img { transform: translateY(-5%) rotate(-2deg); }
.shelf-tin .tag { position: absolute; left: 105%; bottom: 8%; white-space: nowrap; padding: 8px 14px; border-radius: 12px; background: var(--cream); box-shadow: 0 0 0 1.5px var(--ink); font-size: clamp(12px, .95vw, 15px); line-height: 1.3; }
.shelf-tin .tag b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.5em; color: var(--ink); }
.shelf-tin .tag span { color: var(--red); font-weight: 600; }
.pantry-peek { position: absolute; right: 7%; bottom: 24%; width: 9%; transform: scaleX(-1); pointer-events: none; }
@media (max-width: 760px) {
  .pstage { aspect-ratio: auto; background-size: cover; padding: 96px 20px 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 26px 16px; }
  .p-head { position: relative; top: auto; grid-column: 1 / -1; }
  .shelf-tin { position: relative; left: auto; bottom: auto; width: auto; display: grid; justify-items: center; gap: 10px; }
  .shelf-tin img { width: 72%; }
  .shelf-tin .tag { position: static; text-align: center; }
  .pantry-peek { display: none; }
}

/* ---------- Bulk tunnel ---------- */
.tunnel { position: relative; overflow: hidden; }
.tunnel-pin { position: relative; height: 100svh; min-height: 620px; overflow: hidden; }
.tstage2 { position: absolute; inset: 0; overflow: hidden; }
.tbg { position: absolute; inset: -3% -4%; width: 108%; height: 106%; max-width: none; object-fit: cover; object-position: 50% 60%; }
.cart { position: absolute; z-index: 2; bottom: 13%; left: 0; width: clamp(240px, 24vw, 460px); height: auto; }
.tfg { position: absolute; z-index: 3; inset: -6% -6%; width: 112%; height: 112%; max-width: none; object-fit: cover; pointer-events: none; }
.tunnel-card { position: absolute; z-index: 2; left: max(var(--gutter), calc(50% - 680px)); top: calc(var(--nav-h) + 6vh); width: min(520px, 86vw); padding: clamp(26px, 3vw, 40px); background: var(--cream); border-radius: var(--r-lg); }
.tunnel-card h2 { font-size: clamp(2.2rem, 4vw, 3.8rem); }
.tunnel-card ul { list-style: none; margin: 18px 0 26px; padding: 0; display: grid; gap: 10px; color: var(--ink-2); }
.tunnel-card li b { color: var(--ink); }
@media (max-width: 899px) {
  .tunnel-pin { height: auto; min-height: 0; padding: 0 0 40px; }
  .tstage2 { position: relative; height: 56svh; }
  .tunnel-card { position: relative; left: auto; top: auto; margin: -60px auto 0; }
}

/* ---------- Cellar (payoff, page turns red) ---------- */
.cellar { position: relative; overflow: hidden; }
.cstage-box { position: relative; height: max(100svh, 760px); overflow: hidden; }
.cstage { --cw: max(100vw, calc(max(100svh, 760px) * 16 / 9)); position: absolute; top: 50%; left: 50%; width: var(--cw); height: calc(var(--cw) * 9 / 16); margin: calc(var(--cw) * -9 / 32) 0 0 calc(var(--cw) / -2); }
.cstage > img.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wave-cow { position: absolute; left: 24%; bottom: 14%; width: 12.5%; height: auto; transform-origin: 50% 100%; }
.order-panel { position: absolute; z-index: 2; right: max(var(--gutter), calc(50% - 680px)); top: 50%; transform: translateY(-48%); width: min(560px, 46vw); color: var(--white); }
.order-panel h2 { font-size: clamp(2.8rem, 5.6vw, 5.6rem); }
.order-panel .lead { margin: 16px 0 26px; color: #FFE3E5; font-size: 1.15rem; max-width: 40ch; }
.builder { display: grid; gap: 18px; }
.qty { display: inline-flex; align-items: center; border: 1.5px solid currentColor; border-radius: 999px; height: 50px; width: max-content; }
.qty button { width: 50px; height: 100%; border: 0; background: none; color: inherit; font: 600 22px/1 var(--sans); cursor: pointer; border-radius: 999px; }
.qty button:active { transform: scale(.9); }
.qty output { min-width: 44px; text-align: center; font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.builder .chip label { border-color: var(--white); }
.builder .chip input:checked + label { background: var(--white); color: var(--red); }
.builder .field input { border-color: var(--white); }
.builder .field > span, .builder legend { color: #FFE3E5; }
.builder .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bubble { position: relative; padding: 14px 16px 24px; border-radius: 16px 16px 16px 4px; background: var(--white); color: var(--ink); font-size: 15px; line-height: 1.45; white-space: pre-line; }
.bubble::after { content: "Preview"; position: absolute; right: 12px; bottom: 5px; font-size: 12px; color: var(--ink-2); }
.send { justify-self: start; background: var(--white); color: var(--red); border-color: var(--white); height: 58px; }
.send:hover, .send:focus-visible { color: var(--white); }
.direct { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 1rem; }
.direct a { color: var(--white); }
@media (max-width: 899px) {
  .cstage-box { height: 62svh; }
  .cstage { --cw: calc(62svh * 16 / 9); left: calc(50% - var(--cw) * .32); }
  .order-panel { position: relative; right: auto; top: auto; transform: none; width: auto; padding: 36px var(--gutter) 70px; background: var(--red); }
  .builder .grid2 { grid-template-columns: 1fr; }
}


/* ---------- One column of earth from the grass to the bedrock ---------- */
body.home { background: #5A2F18 url(/assets/v2/soil-tile.jpg) 0 0 / 560px repeat; }
html.is-red body.home { background-color: #5A2F18; }
.hero { z-index: 1; }
/* every chamber is a cave dug into the column: its painting fades into the soil above and below */
.cave-fade, .kstage, .pstage, .tstage, .tstage2, .cstage-box {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 11%, #000 89%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 11%, #000 89%, transparent 100%); }
.kitchen, .pantry, .table, .tunnel, .cellar { margin-top: -6vh; }
.pantry, .table, .tunnel, .cellar { padding-top: 0; }
.home .bedrock { margin-top: -8vh; background-color: transparent; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18vh); mask-image: linear-gradient(to bottom, transparent 0, #000 18vh); }

/* ---------- Dining room: the dishes sit in the wall niches ---------- */
.table { position: relative; }
.tstage { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.tstage > img.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.t-head { position: absolute; left: 0; right: 0; top: 9%; text-align: center; }
.t-head h2 { font-size: clamp(2.2rem, 4.6vw, 4.6rem); }
.t-head p { margin: 10px auto 0; color: var(--ink-2); font-size: clamp(1rem, 1.2vw, 1.15rem); }
.niche { position: absolute; left: var(--x); top: 26.8%; width: 21%; height: 40.2%; text-decoration: none; display: block; }
.nimg { position: absolute; inset: 0; overflow: hidden; border-radius: 50% 50% 2% 2% / 30% 30% 1% 1%; background: #FBEBC9; }
.nimg img { width: 100%; height: 100%; object-fit: cover; transition: transform 900ms var(--ease-out); }
.niche:hover .nimg img, .niche:focus-visible .nimg img { transform: scale(1.05); }
.ncap { position: absolute; left: 0; right: 0; top: calc(100% + 6%); text-align: center; font-size: clamp(12px, 1vw, 15px); color: var(--ink-2); line-height: 1.3; }
.ncap b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.55em; color: var(--ink); }
@media (max-width: 760px) {
  .tstage { aspect-ratio: auto; display: grid; gap: 34px; padding: 110px 20px 90px; background: url(/assets/v2/bg-table.jpg) center / cover; }
  .tstage > img.bg { display: none; }
  .t-head { position: relative; top: auto; }
  .niche { position: relative; left: auto; top: auto; width: 74%; height: auto; aspect-ratio: 4 / 5; justify-self: center; margin-bottom: 64px; }
  .ncap { top: calc(100% + 10px); }
}

/* ---------- Depth gauge: shows how deep you are ---------- */
.depth { position: fixed; z-index: 40; right: 22px; top: 50%; transform: translateY(-50%); height: 44vh; display: flex; align-items: flex-start; gap: 10px; opacity: 0; visibility: hidden; pointer-events: none; }
.depth-track { position: relative; width: 3px; height: 100%; border-radius: 3px; background: rgba(255, 240, 214, .35); }
.depth-fill { position: absolute; left: 0; right: 0; top: 0; height: 100%; border-radius: 3px; background: var(--gold); transform-origin: 50% 0; transform: scaleY(var(--p, 0)); }
.depth-dot { position: absolute; left: 50%; top: calc(var(--p, 0) * 100%); width: 13px; height: 17px; margin: -8px 0 0 -6.5px; background: var(--gold); border: 1.5px solid #8A5A12; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.depth-label { position: absolute; right: 16px; top: calc(var(--p, 0) * 100%); padding: 5px 11px; border-radius: 999px; background: rgba(42, 22, 12, .78); color: #FFF0D6; font-size: 13px; font-weight: 600; letter-spacing: .04em; white-space: nowrap; transform: translateY(-50%); }
@media (max-width: 899px) { .depth { display: none; } }

/* CSS-only fallback before JS measures: on wide, short screens lower the painting so the tin clears the text */
@media (min-aspect-ratio: 16/9) { .stage { bottom: calc(var(--sw) * 9 / 16 * -.15); } }
@media (min-aspect-ratio: 2/1) { .stage { bottom: calc(var(--sw) * 9 / 16 * -.2); } }

/* ---------- The ground: rises from below and swallows the village as you scroll down ---------- */
.ground { position: absolute; z-index: 8; left: 0; right: 0; top: 100%; pointer-events: none; will-change: transform; }
.ground img { display: block; width: 100%; min-width: 1100px; height: auto; margin-left: 50%; translate: -50% 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%); mask-image: linear-gradient(to bottom, #000 78%, transparent 100%); }
.ground-fill { height: 140vh; margin-top: -12%; background: #5A2F18 url(/assets/v2/soil-tile.jpg) 0 0 / 560px repeat; }

/* pinned scenes carry their own soil so nothing behind them scrolls while they are held */
.cook-pin, .tunnel-pin { background: #5A2F18 url(/assets/v2/soil-tile.jpg) 0 var(--tile-y, 0px) / 560px repeat; }
