/* ============================================================
   home.css — the homepage: hero + lemniscate point-field, eight
   Trace articles (the case-study index), the "handoff tax"
   interlude, briefs (elsewhere), and the closing contact panel.
   Loads after tokens.css + site.css. Paired with home.js.
   Rebuilt 2026-08-05 for THE RECORD (broadsheet redesign).
   ============================================================ */

@layer page {
  /* homepage-only: same-page nav links (Work/About/etc.) benefit from a
     smooth scroll. Case pages deliberately don't set this (it's global to
     <html> otherwise) — Chromium animates even the INITIAL hash-navigation
     scroll when scroll-behavior:smooth is set, which broke deep-linking
     straight to a case chapter within the test suite's settle window. */
  html { scroll-behavior: smooth; }
  body.home { position: relative; }
  #bg { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; opacity: 0; transition: opacity 1.4s ease; }
  #bg.on { opacity: 1; }
  .mast, main { position: relative; }

  /* ---- hero ---- */
  .hero { position: relative; min-height: calc(100svh - 4.6rem); display: flex; align-items: center; padding-block: clamp(3rem, 8vh, 5rem) clamp(4.5rem, 10vh, 6.5rem); }
  .hero .wrap { width: 100%; }
  .hero h1 { margin: 0; font-family: var(--fd); font-weight: 500; font-size: clamp(2rem, 5.6vw, 5.6rem); line-height: 1.04; letter-spacing: -.04em; }
  .hero h1 em { font-style: normal; color: var(--verm); }
  .hero .stand { margin-top: clamp(1.8rem, 4.5vh, 2.8rem); }
  .hero .stand p { margin: 0; font-size: clamp(1.35rem, 1.1rem + .8vw, 1.7rem); line-height: 1.5; max-width: 50ch; }
  .hero .stand .lede2 { margin-top: 1.4rem; font-style: italic; color: var(--ink-soft); }
  .hero .cue { position: absolute; right: max(var(--edge), calc(50% - (var(--w-page) / 2) + var(--edge))); bottom: clamp(1.4rem, 4vh, 2.6rem); display: flex; align-items: center; gap: .9rem; font-family: var(--fm); font-size: var(--t-micro); text-transform: uppercase; letter-spacing: .24em; color: var(--mut); }
  .hero .cue .bar { width: 1px; height: 2.1rem; background: var(--mut); animation: cuebar 2.8s cubic-bezier(.16,1,.3,1) infinite; }
  @keyframes cuebar { 0% { transform: scaleY(0); transform-origin: top; } 45% { transform: scaleY(1); transform-origin: top; } 55% { transform: scaleY(1); transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
  @media (prefers-reduced-motion: reduce) { .hero .cue .bar { animation: none; } }

  /* ---- trace — one article per case, the homepage's index ---- */
  .trace { padding-block: clamp(3.5rem, 9vh, 6rem); border-bottom: 1px solid var(--rule); }
  .trace:first-of-type { border-top: 2px solid var(--ink); }
  .t-head { margin-bottom: clamp(1.8rem, 4.5vh, 2.8rem); }
  /* owner carve-out from the accent rule (2026-08-05): the trace eyebrows
     keep verm at Adam's call */
  .t-head .no { display: block; font-family: var(--fm); font-size: 1rem; font-weight: 500; color: var(--verm); letter-spacing: .06em; margin-bottom: 1rem; }
  .t-head .hrow { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .6rem 2rem; }
  .t-head .pj { margin: 0; font-family: var(--fd); font-weight: 700; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); letter-spacing: -.02em; line-height: 1; }
  .t-meta { display: flex; flex-wrap: wrap; gap: .4rem 2rem; font-family: var(--fm); font-size: var(--t-label); text-transform: uppercase; letter-spacing: .14em; color: var(--mut); }
  .hook { margin: 0; font-family: var(--fd); font-weight: 500; font-size: clamp(2.1rem, 1rem + 4vw, 4.4rem); line-height: 1; letter-spacing: -.035em; max-width: 24ch; text-wrap: balance; color: var(--ink-soft); }
  .hook em { font-style: normal; color: var(--verm); background: linear-gradient(var(--verm), var(--verm)) 0 96% / 0% 2px no-repeat; transition: background-size 1s cubic-bezier(.16,1,.3,1) .55s; padding-bottom: .04em; }
  .hook.in em { background-size: 100% 2px; }

  /* ---- spine — the four-beat structure (handed/call/what changed/the outcome, or on t04-08, the problem/call/what changed/the outcome) ---- */
  .spine { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 2rem clamp(1.6rem, 3vw, 3rem); margin: clamp(2.2rem, 5vh, 3.4rem) 0 0; padding-top: 1.8rem; }
  .spine::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: var(--rule); transform: scaleX(0); transform-origin: left; transition: transform 1.2s cubic-bezier(.16,1,.3,1); }
  .spine.in::before { transform: scaleX(1); }
  .js .spine .beat { opacity: 0; transform: translateY(20px); }
  .js .spine.in .beat { opacity: 1; transform: none; transition: opacity .7s ease, transform .8s cubic-bezier(.16,1,.3,1); }
  .js .spine.in .beat:nth-child(2) { transition-delay: .12s; }
  .js .spine.in .beat:nth-child(3) { transition-delay: .24s; }
  .js .spine.in .beat:nth-child(4) { transition-delay: .36s; }
  .beat dt { font-family: var(--fd); font-weight: 700; font-size: 1.3rem; letter-spacing: -.02em; line-height: 1.2; color: var(--ink); }
  .beat dd { margin: .5rem 0 0; font-size: 1.1rem; line-height: 1.55; color: var(--ink-soft); }
  @media (max-width: 1080px) { .spine { grid-template-columns: repeat(2, minmax(0,1fr)); } }
  @media (max-width: 620px) { .spine { grid-template-columns: 1fr; gap: 1.6rem; } }

  .t-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1.5rem 3rem; margin-top: clamp(2rem, 4.5vh, 3rem); }
  .t-foot .t-go:only-child { margin-left: auto; }
  .t-stat { display: flex; align-items: baseline; gap: 1rem; }
  .t-stat .n { font-family: var(--fd); font-weight: 600; font-size: clamp(3rem, 5.5vw, 5rem); line-height: 1; color: var(--ink); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
  .t-stat .n .u { font-size: .42em; vertical-align: .55em; margin-left: .04em; color: var(--verm); }
  .t-stat .lab { font-family: var(--fm); font-size: var(--t-label); text-transform: uppercase; letter-spacing: .14em; color: var(--mut); max-width: 16ch; line-height: 1.6; }
  .t-go { font-family: var(--fs); font-style: italic; font-size: 1.5rem; border-bottom: 1px solid var(--rule); padding-bottom: .15em; transition: border-color .25s, color .25s; }
  .t-go:hover { border-color: var(--verm); }
  .t-go .ar { font-style: normal; font-family: var(--fm); font-size: .85em; display: inline-block; transition: transform .25s; }
  .t-go:hover .ar { transform: translate(2px,-2px); }

  /* ---- photo evidence inside a trace article ---- */
  .t-photo { margin: clamp(2.2rem, 5vh, 3.4rem) 0 0; }
  .t-photos { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1.2rem; margin: clamp(2.2rem, 5vh, 3.4rem) 0 0; }
  .t-photos .t-photo { margin: 0; }
  .t-photos img { aspect-ratio: 3 / 2; object-fit: cover; }
  @media (max-width: 620px) { .t-photos { grid-template-columns: 1fr; } }
  .t-photo img { display: block; width: 100%; height: auto; max-height: 34rem; object-fit: cover; filter: saturate(.88) contrast(1.02); }
  .js .t-photo img { clip-path: inset(0 100% 0 0); transition: clip-path 1.4s cubic-bezier(.16,1,.3,1); }
  .js .t-photo.in img { clip-path: inset(0 0 0 0); }
  .t-photo figcaption { display: flex; justify-content: space-between; gap: 2rem; border-top: 1px solid var(--ink); margin-top: .7rem; padding-top: .6rem; font-family: var(--fm); font-size: var(--t-micro); text-transform: uppercase; letter-spacing: .14em; color: var(--mut); }

  /* ---- interlude — "the handoff tax" scroll-wipe. Recovers the v4 pinned
     two-panel mechanism (tag pre-record-redesign) that the v5 canvas
     transposition dropped without a ratified call. Panel A keeps the old
     .inter trick, deliberately inverted so it always shows the opposite of
     the page's current mode; its accent hex is hand-swapped for the same
     reason, it has to read against its own locally-inverted background, not
     the page's current --verm. Panel B is the page's own normal paper/ink
     pairing, not inverted, with --verm spent on the word only: a full-panel
     verm fill would blow the accent-rationing rule (698e7b8, "one brand
     emphasis per view"), and the ink-on-paper pairing is the site's most
     tested contrast, no separate AA check needed. Static-first: no-JS and
     reduced-motion both fall back to the two panels stacked in document
     order, and the coda below the pinned stage. ---- */
  .wipe { position: relative; }
  .wipe-stage { position: relative; }
  .wipe-panel { position: relative; min-height: 72vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: clamp(2rem, 6vw, 4rem); }
  .wipe-k { font-family: var(--fm); font-size: var(--t-label); text-transform: uppercase; letter-spacing: .3em; }
  .wipe-word { margin: 1.8rem 0 0; font-family: var(--fd); font-weight: 600; font-size: clamp(2.6rem, 1rem + 8vw, 7.5rem); line-height: .94; letter-spacing: -.04em; max-width: 15ch; }
  .wipe-sub { margin: 1.6rem auto 0; font-size: var(--t-body); line-height: 1.6; max-width: 42ch; }
  .wipe-a { background: var(--ink); color: var(--paper); }
  .wipe-a .wipe-k { color: color-mix(in srgb, var(--paper) 60%, transparent); }
  .wipe-a .wipe-word { color: #E8501F; }
  html.dark .wipe-a .wipe-word { color: #C33A14; }
  .wipe-a .wipe-sub { color: color-mix(in srgb, var(--paper) 78%, transparent); }
  .wipe-b { background: var(--paper); color: var(--ink); }
  .wipe-b .wipe-k { color: var(--mut); }
  .wipe-b .wipe-word { color: var(--verm); }
  .wipe-b .wipe-sub { color: var(--ink-soft); }

  /* pin runway: 170vh keeps the hold-wipe-hold ratio tighter than v4's
     200vh, and the wipe itself now spans the middle 50% of the pinned
     scroll (was 16%) so less of the gesture is spent on dead scroll before
     anything moves. First-pass tuning; wants a real-device look (open Core
     gate) before it's called final. */
  .js .wipe { height: 170vh; }
  .js .wipe-stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
  .js .wipe-panel { position: absolute; inset: 0; min-height: 0; }
  .js .wipe-b { z-index: 1; }
  .js .wipe-a { z-index: 2; clip-path: inset(0 0 0 0); will-change: clip-path; }
  @supports (animation-timeline: view()) {
    .js .wipe { view-timeline: --wipe block; }
    .js .wipe-a { animation: wipe-a linear both; animation-timeline: --wipe; animation-range: contain 25% contain 75%; }
  }
  @keyframes wipe-a { from { clip-path: inset(0 0 0 0); } to { clip-path: inset(0 100% 0 0); } }
  @media (prefers-reduced-motion: reduce) {
    .js .wipe { height: auto; }
    .js .wipe-stage { position: static; height: auto; }
    .js .wipe-panel { position: relative; inset: auto; min-height: 72vh; }
    .js .wipe-a { clip-path: none !important; animation: none !important; }
  }

  /* ---- coda — the medium-is-proof line, riding under the wipe ---- */
  .wipe-coda { padding-block: clamp(2.5rem, 6vh, 4rem); text-align: center; }
  .wipe-coda p { margin: 0 auto; max-width: 44ch; font-size: var(--t-body); line-height: 1.6; color: var(--ink-soft); }

  /* ---- briefs — elsewhere on the record ---- */
  .briefs { padding-block: clamp(3.5rem, 9vh, 6rem) clamp(2.5rem, 6vh, 4rem); }
  .b-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; border-top: 2px solid var(--ink); padding-top: .9rem; margin-bottom: clamp(2rem, 5vh, 3rem); font-family: var(--fm); font-size: .9rem; text-transform: uppercase; letter-spacing: .18em; }
  .b-head .r { color: var(--mut); }
  .b-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 2rem clamp(1.6rem, 3vw, 3rem); }
  a.brief { display: block; border-top: 1px solid var(--rule); padding-top: 1.2rem; }
  .brief .bk { font-family: var(--fm); font-size: var(--t-micro); font-weight: 500; text-transform: uppercase; letter-spacing: .16em; color: var(--mut); }
  .brief h3 { margin: .7rem 0 .5rem; font-family: var(--fd); font-weight: 700; font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); letter-spacing: -.02em; line-height: 1.05; transition: color .25s; }
  a.brief:hover h3 { color: var(--verm); }
  .brief p { margin: 0; font-size: 1.05rem; line-height: 1.5; color: var(--ink-soft); }
  .brief .go { display: inline-block; margin-top: .9rem; font-family: var(--fs); font-style: italic; font-size: 1.15rem; border-bottom: 1px solid var(--rule); }
  @media (max-width: 1080px) { .b-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
  @media (max-width: 620px) { .b-grid { grid-template-columns: 1fr; } }

  /* ---- closer — the contact panel ---- */
  .closer { padding-block: clamp(5rem, 14vh, 9rem) 2rem; }
  .closer h2 { margin: 0; font-family: var(--fd); font-weight: 500; font-size: clamp(2.6rem, 7vw, 6.4rem); line-height: .98; letter-spacing: -.04em; max-width: 20ch; text-wrap: balance; }
  .closer h2 em { font-style: normal; color: var(--verm); }
  .closer .p { margin: 1.8rem 0 0; font-size: clamp(1.3rem, 1.1rem + .6vw, 1.6rem); max-width: 44ch; }
  .closer .email { display: inline-block; margin-top: clamp(2rem, 5vh, 3rem); font-family: var(--fs); font-style: italic; font-size: clamp(2.4rem, 6.5vw, 6rem); line-height: 1; border-bottom: 2px solid var(--ink); padding-bottom: .08em; word-break: break-word; transition: color .25s, border-color .25s; }
  .closer .email:hover { border-color: var(--verm); }
  .closer .else { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin-top: clamp(2.5rem, 6vh, 4rem); font-family: var(--fm); font-size: .9rem; text-transform: uppercase; letter-spacing: .14em; }
  .closer .else a { color: var(--mut); }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    #bg { display: none; }
    .js .t-photo img { clip-path: none !important; transition: none !important; }
    .hook em { background-size: 100% 2px !important; transition: none !important; }
  }
}
