/* The Laing Label — CZ Grain case study (work/cz-grain.html)
   Structure: Laing Label bookends (paper, Epilogue, mono, one red) around
   CZ Grain's own story: a willow cutting that roots in water, goes into soil
   and grows a canopy. The willow in the rail grows as you read.
   Motion law: nothing animates on its own; scroll is the only clock.
   Every class is prefixed cz- so nothing lands in the kit's namespace. */

.cz-page {
  --cz-ink: #12200e;
  --cz-ink-soft: #4a5646;
  --cz-leaf: #6cae55;         /* the 2023 store's green: a ground, never small text */
  --cz-deep: #24501d;         /* green when it carries white text */
  --cz-mist: #f2f6ef;         /* section ground */
  --cz-line: #dde5d7;
  --cz-bark: #6b4f3a;
  --cz-sans: 'Montserrat', system-ui, sans-serif;
  --cz-navh: 64px;
  --cz-railw: 240px;
}
html, body { overflow-x: clip; }

/* ---------- LL bookend bits (shared vocabulary with nwa-fresh) ---------- */
.cz-chip { background: var(--red); color: var(--white); padding: 5px 8px; font-weight: 600; letter-spacing: 0.14em; }
.cz-folio { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- bookend: open ---------- */
.cz-open { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); background: var(--paper); border-bottom: var(--hairline-paper); }
.cz-open__page { padding: var(--space-9) var(--page-pad-x); display: flex; flex-direction: column; justify-content: center; gap: var(--space-5); }
.cz-open__title { font-size: var(--fs-hero); line-height: 0.88; letter-spacing: -0.045em; font-weight: 900; }
.cz-open__dek { font-family: var(--font-display); font-weight: 700; font-size: clamp(24px, 2.4vw, 34px); line-height: 1.12; letter-spacing: -0.02em; max-width: 19ch; text-wrap: balance; }
.cz-open__body { max-width: 52ch; }
.cz-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-6); margin: var(--space-3) 0 0; padding-top: var(--space-5); border-top: var(--hairline-paper); }
.cz-meta dt { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase; color: #6b6b6b; }
.cz-meta dd { margin: 2px 0 0; font-size: 13px; line-height: 1.5; }

/* the plate: one photograph, three pieces of the work laid on it */
.cz-plate { position: relative; overflow: hidden; min-height: 620px; background: var(--cz-ink); }
.cz-plate__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cz-plate::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18, 32, 14, 0) 45%, rgba(18, 32, 14, 0.72)); pointer-events: none; }
.cz-piece { position: absolute; z-index: 2; margin: 0; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.25); }
.cz-piece img { display: block; width: 100%; height: auto; }
.cz-piece--tile1 { width: 27%; left: 4%; bottom: 30%; }
.cz-piece--tile2 { width: 25%; right: 4%; bottom: 40%; }
.cz-piece--ad { width: 36%; left: 34%; bottom: 9%; }
.cz-plate__cap { position: absolute; z-index: 3; left: var(--space-5); bottom: var(--space-4); margin: 0; color: var(--white); font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.12em; text-transform: uppercase; }

/* drift: pristine when centred, apart as you scroll away (reach ≤ 68px, rot ≤ 4.6°) */
[data-scene] [data-v] {
  translate: calc(var(--ox, 0px) * var(--a, 0)) calc(var(--oy, 0px) * var(--a, 0));
  rotate: calc(var(--rot, 0deg) * var(--a, 0));
}

/* ---------- the middle: CZ Grain's own system ---------- */
.cz-grow { position: relative; display: grid; grid-template-columns: var(--cz-railw) minmax(0, 1fr); background: var(--white); color: var(--cz-ink); font-family: var(--cz-sans); }
.cz-grow h2, .cz-grow h3 { font-family: var(--cz-sans); color: var(--cz-ink); }

/* the rail: a willow that grows with the reader (--g: 0 → 1) */
.cz-rail { position: relative; border-right: 1px solid var(--cz-line); background: var(--cz-mist); }
.cz-rail__in { position: sticky; top: var(--cz-navh); height: calc(100vh - var(--cz-navh)); display: flex; flex-direction: column; justify-content: center; gap: var(--space-5); padding: var(--space-6) var(--space-5); }
.cz-rail__label { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cz-ink-soft); }
.cz-willow { width: 100%; max-width: 170px; height: auto; margin: 0 auto; overflow: visible; }
.cz-stops { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cz-stops a { display: grid; grid-template-columns: 26px 1fr; align-items: baseline; gap: 6px; text-decoration: none; color: var(--cz-ink-soft); font-size: 13px; padding: 4px 0; }
.cz-stops b { font-weight: 800; font-size: 11px; letter-spacing: 0.08em; }
.cz-stops span { font-weight: 600; }
.cz-stops a[aria-current='true'] { color: var(--cz-ink); }
.cz-stops a[aria-current='true'] b { color: var(--cz-deep); }
.cz-stops a:hover span, .cz-stops a:focus-visible span { text-decoration: underline; text-underline-offset: 3px; }

/* willow parts: each draws between its own start and end on the shared clock */
.cz-willow .draw { fill: none; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: calc(1 - clamp(0, (var(--g, 0) - var(--s)) / (var(--e) - var(--s)), 1)); }
.cz-willow .fade { opacity: clamp(0, (var(--g, 0) - var(--s)) / (var(--e) - var(--s)), 1); }
.cz-willow .unfade { opacity: calc(1 - clamp(0, (var(--g, 0) - var(--s)) / (var(--e) - var(--s)), 1)); }
.cz-willow .stem { stroke: var(--cz-bark); stroke-width: 5; }
.cz-willow .root { stroke: #8a6a4c; stroke-width: 2.4; }
.cz-willow .branch { stroke: var(--cz-bark); stroke-width: 2.2; }
.cz-willow .strand { stroke: var(--cz-leaf); stroke-width: 2; }
.cz-willow .glass { fill: none; stroke: #9fb3a0; stroke-width: 1.5; }
.cz-willow .water { fill: #cfe3ee; }
.cz-willow .soil { fill: #6b4f3a; }
.cz-willow .bud { fill: var(--cz-leaf); }

/* chapters */
.cz-chapters { min-width: 0; }
.cz-ch { padding: calc(var(--cz-navh) + clamp(48px, 6vw, 96px)) clamp(24px, 5vw, 80px) clamp(64px, 8vw, 120px); border-bottom: 1px solid var(--cz-line); }
.cz-ch--mist { background: var(--cz-mist); }
.cz-ch--deep { background: var(--cz-deep); color: var(--white); }
.cz-ch--deep h2, .cz-ch--deep h3 { color: var(--white); }
.cz-wrap { max-width: 1040px; }
.cz-kicker { display: flex; gap: 10px; align-items: baseline; margin: 0 0 var(--space-4); font-size: 12px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--cz-deep); }
.cz-kicker i { font-style: normal; color: var(--cz-ink-soft); font-weight: 600; letter-spacing: 0.12em; }
.cz-ch--deep .cz-kicker, .cz-ch--deep .cz-kicker i { color: #cde8c1; }
.cz-ch h2 { font-size: clamp(30px, 3.6vw, 52px); line-height: 1.02; font-weight: 800; letter-spacing: -0.02em; text-transform: uppercase; max-width: 17ch; margin: 0 0 var(--space-5); text-wrap: balance; }
.cz-lede { font-size: 17px; line-height: 1.65; max-width: 58ch; color: var(--cz-ink); font-weight: 400; }
.cz-ch p { max-width: 62ch; }
.cz-ch--deep .cz-lede, .cz-ch--deep p { color: #eef5ea; }
.cz-mini { margin: 0 0 var(--space-3); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cz-ink-soft); }
.cz-ch--deep .cz-mini { color: #cde8c1; }
.cz-note { font-size: 13px; color: var(--cz-ink-soft); }

/* 01 · numbers + three photographs */
.cz-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: var(--space-7) 0; border-top: 2px solid var(--cz-ink); }
.cz-stats div { padding: var(--space-4) var(--space-4) 0 0; }
.cz-stats b { display: block; font-size: clamp(34px, 4vw, 56px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.cz-stats span { display: block; margin-top: 6px; font-size: 13px; color: var(--cz-ink-soft); }
.cz-trio { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: var(--space-4); align-items: end; }
.cz-trio figure { margin: 0; }
.cz-trio img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; display: block; }
.cz-trio figure:first-child img { aspect-ratio: 4 / 4.6; }
.cz-trio figcaption, .cz-cap { margin-top: 8px; font-size: 12px; color: var(--cz-ink-soft); }

/* 02 · the store */
.cz-store { margin-top: var(--space-7); background: var(--white); border: 1px solid var(--cz-line); box-shadow: 0 30px 60px -30px rgba(18, 32, 14, 0.35); }
.cz-store__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); padding: 14px 20px; border-bottom: 1px solid var(--cz-line); }
.cz-store__brand { font-weight: 800; letter-spacing: 0.08em; font-size: 15px; text-transform: uppercase; }
.cz-store__tabs { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: 12px; font-weight: 600; color: var(--cz-ink-soft); }
.cz-store__tabs li:first-child { color: var(--cz-ink); box-shadow: inset 0 -2px 0 var(--cz-leaf); }
.cz-store__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 18px; }
.cz-store__grid figure { margin: 0; }
.cz-store__grid img { display: block; width: 100%; height: auto; }
.cz-sorted { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: var(--space-6) 0 0; padding: 0; list-style: none; }
.cz-sorted li { padding: 12px 14px; background: var(--cz-mist); border-left: 3px solid var(--cz-leaf); font-size: 13px; font-weight: 600; }
.cz-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 64px); align-items: start; }

/* 03 · the ads: a sticky stage, the video scrubs with the scroll */
.cz-scrub { position: relative; height: 260vh; margin-top: var(--space-6); }
.cz-scrub__stage { position: sticky; top: calc(var(--cz-navh) + 12vh); display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 48px); align-items: center; }
.cz-ad { margin: 0; background: var(--cz-ink); padding: 10px; box-shadow: 0 30px 60px -28px rgba(18, 32, 14, 0.55); }
.cz-ad__tag { display: flex; justify-content: space-between; padding: 0 2px 8px; color: #d7e3d2; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.cz-ad video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #000; }
.cz-ad__bar { height: 3px; background: rgba(255, 255, 255, 0.15); margin-top: 8px; }
.cz-ad__bar i { display: block; height: 100%; width: calc(var(--t, 0) * 100%); background: var(--cz-leaf); }
.cz-beats { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.cz-beats li { color: color-mix(in srgb, var(--cz-ink) calc(var(--on, 0) * 100%), var(--cz-ink-soft)); border-left: 3px solid rgba(36, 80, 29, calc(0.15 + 0.85 * var(--on, 0))); padding-left: 14px; }
.cz-beats b { display: block; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; color: var(--cz-deep); }
.cz-beats span { display: block; font-size: 15px; line-height: 1.5; margin-top: 2px; }
.cz-review { margin-top: var(--space-7); padding: var(--space-5) var(--space-6); background: var(--cz-mist); border-left: 4px solid var(--cz-deep); }
.cz-review p { margin: 0; }
.cz-shelf { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: var(--space-6); }

/* click-to-play cards (user starts them; nothing autoplays) */
.cz-play { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--cz-ink); cursor: pointer; text-align: left; color: var(--white); }
.cz-play img, .cz-play video { display: block; width: 100%; height: auto; }
.cz-play__btn { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px; background: rgba(18, 32, 14, 0.82); font-family: var(--cz-sans); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.cz-play__btn::before { content: ''; width: 0; height: 0; border-left: 8px solid var(--cz-leaf); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.cz-play:hover .cz-play__btn, .cz-play:focus-visible .cz-play__btn { background: var(--cz-deep); }
.cz-play:focus-visible { outline: 3px solid var(--cz-leaf); outline-offset: 3px; }
.cz-shelf figcaption { margin-top: 8px; font-size: 12px; font-weight: 600; }

/* 04 · the TV spot: script on the left, the frame on the right follows the line you're on */
.cz-script { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(24px, 4vw, 64px); margin-top: var(--space-7); }
.cz-script__lines { list-style: none; margin: 0; padding: 18vh 0; display: grid; gap: 22vh; }
.cz-script__lines q { color: color-mix(in srgb, #ffffff calc(var(--on, 0) * 100%), #b5cdb0); }
.cz-script__lines q { display: block; font-size: clamp(22px, 2.2vw, 30px); font-weight: 700; line-height: 1.2; quotes: '“' '”'; }
.cz-script__lines small { display: block; margin-top: 8px; font-size: 12px; letter-spacing: 0.06em; color: #cde8c1; text-transform: uppercase; }
.cz-screen { position: sticky; top: calc(var(--cz-navh) + 15vh); align-self: start; margin: 0; }
.cz-screen__frames { position: relative; aspect-ratio: 16 / 9; background: #000; box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.7); }
.cz-screen__frames img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: var(--on, 0); }
.cz-screen__frames img:first-child { opacity: 1; }
.cz-screen__frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 3; }
.cz-screen .cz-play { position: absolute; inset: 0; z-index: 2; background: transparent; }
.cz-screen .cz-play__btn { left: 14px; bottom: 14px; font-size: 12px; padding: 9px 14px 9px 12px; }
.cz-screen figcaption { margin-top: 10px; font-size: 12px; color: #cde8c1; }

/* 05 · the series */
.cz-phones { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); gap: clamp(16px, 3vw, 40px); margin-top: var(--space-7); }
.cz-phone { margin: 0; border-radius: 28px; padding: 8px; background: var(--cz-ink); box-shadow: 0 30px 60px -26px rgba(18, 32, 14, 0.55); }
.cz-phone .cz-play { border-radius: 21px; overflow: hidden; aspect-ratio: 9 / 16; }
.cz-phone .cz-play img, .cz-phone .cz-play video { height: 100%; object-fit: cover; }
.cz-phones figcaption { margin-top: 10px; font-size: 12px; font-weight: 600; text-align: center; }
.cz-band { margin-top: var(--space-8); position: relative; }
.cz-band img { display: block; width: 100%; height: auto; aspect-ratio: 21 / 9; object-fit: cover; }

/* 05 · in development: five series looks, silent loops that play while on screen */
.cz-next { margin-top: var(--space-8); padding-top: var(--space-7); border-top: 2px solid var(--cz-ink); }
.cz-next__title { margin: 0; font-size: clamp(26px, 3vw, 38px); font-weight: 800; line-height: 1.08; text-wrap: balance; max-width: 18ch; }
.cz-loops { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(10px, 1.6vw, 20px); margin-top: var(--space-7); }
.cz-loop { margin: 0; min-width: 0; }
.cz-loop__screen { position: relative; aspect-ratio: 9 / 16; max-width: 100%; overflow: hidden; border-radius: 18px; background: var(--cz-ink); border: 5px solid var(--cz-ink); box-shadow: 0 24px 48px -24px rgba(18, 32, 14, 0.55); }
.cz-loop__screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cz-loop figcaption { display: grid; gap: 2px; margin-top: 10px; }
.cz-loop figcaption b { font-size: 14px; font-weight: 800; color: var(--cz-ink); }
.cz-loop figcaption span { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cz-ink-soft); }

/* ---------- bookend: close ---------- */
.cz-close { padding: var(--section-pad-y) var(--page-pad-x); background: var(--paper); }
.cz-close__in { max-width: var(--max-w); margin: 0 auto; display: grid; gap: var(--space-6); }
.cz-close__title { font-size: var(--fs-h2); max-width: 20ch; }
.cz-credits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5) var(--space-6); margin: 0; }
.cz-credits div { border-top: var(--hairline-paper); padding-top: var(--space-3); }
.cz-credits dt { font-family: var(--font-mono); font-size: var(--fs-label); letter-spacing: 0.14em; text-transform: uppercase; color: #6b6b6b; }
.cz-credits dd { margin: 6px 0 0; font-size: 14px; line-height: 1.55; }
.cz-close__sign { color: var(--red); }

/* ---------- arrivals: translate only, only for things not yet on screen ---------- */
.cz-armed .cz-rise:not(.is-in) { translate: 0 28px; opacity: 0; }
.cz-armed .cz-rise { transition: translate 0.6s cubic-bezier(.2, .7, .2, 1), opacity 0.6s; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .cz-open { grid-template-columns: 1fr; }
  .cz-plate { min-height: 520px; }
  .cz-credits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .cz-grow { grid-template-columns: minmax(0, 1fr); }
  .cz-rail, .cz-rail__in, .cz-stops { min-width: 0; }
  .cz-beats li { color: var(--cz-ink); border-left-color: var(--cz-deep); }
  .cz-rail { position: sticky; top: var(--cz-navh); z-index: 20; border-right: 0; border-bottom: 1px solid var(--cz-line); }
  .cz-rail__in { position: static; height: auto; flex-direction: row; align-items: center; justify-content: flex-start; gap: var(--space-4); padding: 8px var(--page-pad-x); }
  .cz-rail__label { display: none; }
  .cz-willow { width: 34px; flex: 0 0 34px; margin: 0; }
  .cz-stops { grid-auto-flow: column; gap: 14px; overflow-x: auto; scrollbar-width: none; }
  .cz-stops a { grid-template-columns: auto auto; white-space: nowrap; font-size: 12px; }
  .cz-ch { padding-top: clamp(48px, 8vw, 80px); }
  .cz-split, .cz-script { grid-template-columns: 1fr; }
  .cz-scrub { height: auto; }
  .cz-scrub__stage { position: static; grid-template-columns: 1fr; }
  .cz-screen { position: relative; top: auto; order: -1; }
  .cz-script__lines { padding: 0; gap: var(--space-6); }
  .cz-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cz-sorted { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cz-loops { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(170px, 30%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; scrollbar-width: thin; }
  .cz-loop { scroll-snap-align: start; }
}
@media (max-width: 640px) {
  .cz-meta { grid-template-columns: 1fr; }
  .cz-plate { min-height: 420px; }
  .cz-piece--tile1 { width: 40%; bottom: 34%; } .cz-piece--tile2 { width: 38%; bottom: 44%; } .cz-piece--ad { width: 54%; left: 24%; bottom: 11%; }
  .cz-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-5); }
  .cz-trio { grid-template-columns: 1fr 1fr; }
  .cz-trio figure:first-child { grid-column: 1 / -1; }
  .cz-store__grid { grid-template-columns: 1fr; }
  .cz-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cz-phones { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .cz-phone { border-radius: 18px; padding: 5px; } .cz-phone .cz-play { border-radius: 14px; }
  .cz-loops { grid-auto-columns: 58%; }
  .cz-loop__screen { border-radius: 14px; border-width: 4px; }
  .cz-credits { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  [data-scene] [data-v] { translate: none; rotate: none; }
  .cz-armed .cz-rise:not(.is-in) { translate: none; opacity: 1; }
}
