/* =====================================================
   STEPHANIE WISNER — "Building Backwards"
   The page runs backwards in time, from the market to
   the bench. One gold line (the intro's trend line)
   keeps drawing down the page: a falling chart that
   coils back into a helix in the lab.
   Palette from the book cover.
   ===================================================== */
@property --bg   { syntax: "<color>"; inherits: true; initial-value: #faf7f0; }
@property --fg   { syntax: "<color>"; inherits: true; initial-value: #141412; }
@property --fg-2 { syntax: "<color>"; inherits: true; initial-value: #6b675c; }
@property --rule { syntax: "<color>"; inherits: true; initial-value: rgba(20,20,18,0.12); }
@property --tint { syntax: "<color>"; inherits: true; initial-value: #7a6629; }
@property --surface { syntax: "<color>"; inherits: true; initial-value: #fffdf8; }

:root {
  --paper:      #faf7f0;
  --paper-2:    #f3eee2;
  --card:       #fffdf8;
  --ink:        #141412;
  --ink-3:      #6b675c;
  --gold:       #ccb76e;
  --gold-deep:  #9c863d;
  --gold-text:  #7a6629;
  --green:      #1f5e33;
  --green-hover:#174a28;
  --red:        #b1262e;
  --rule:       rgba(20,20,18,0.12);
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --ease:       cubic-bezier(0.16, 1, 0.3, 1);
  --gutter:     clamp(1.25rem, 5vw, 4.5rem);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { overflow-x: clip; }

body {
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-2: var(--ink-3);
  --tint: var(--gold-text);
  --surface: var(--card);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: --bg 0.9s var(--ease), --fg 0.9s var(--ease), --fg-2 0.9s var(--ease),
              --rule 0.9s var(--ease), --tint 0.9s var(--ease), --surface 0.9s var(--ease);
}

a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 3px; }

/* ── Header: name, chapter countdown, contact ───── */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.bar-mark { font-family: var(--font-serif); font-weight: 700; font-size: 1.05rem; text-decoration: none; justify-self: start; }
.bar-cta {
  justify-self: end;
  font-size: 0.85rem; font-weight: 600; text-decoration: none;
  padding: 0.55rem 1.1rem; border-radius: 999px;
  background: var(--green); color: var(--paper);
  transition: background 0.25s var(--ease);
}
.bar-cta:hover { background: var(--green-hover); }

/* ── The story + the line ────────────────────────── */
.story { position: relative; }
.line {
  position: absolute; top: 0; left: 0;
  pointer-events: none; overflow: visible;
  z-index: 0;
}
.line-main { fill: none; stroke: var(--gold-deep); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.line-strand { fill: none; stroke: var(--green); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* candles and rungs are revealed by the same mask as the strands */
.line-candles line { stroke: #aaa28d; stroke-width: 1.2; }
.line-candles .up { fill: #246e2f; }
.line-candles .down { fill: var(--red); }
.line-rungs line { stroke: #b3a98f; stroke-width: 1.4; stroke-linecap: round; }

/* ── Chapters & blocks ───────────────────────────── */
.chapter {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  gap: 26vh;
  padding: 18vh var(--gutter);
}
.chapter:first-of-type { padding-top: 0; }
.block { position: relative; width: min(500px, 40vw); }
.block[data-side="left"] { align-self: flex-start; margin-left: 2vw; }
.block[data-side="right"] { align-self: flex-end; margin-right: 2vw; }
.block--wide { width: min(780px, 56vw); }

.node {
  /* invisible anchor the line bends through */
  position: absolute; top: 0.55rem;
  width: 1px; height: 1px;
  pointer-events: none;
}
.block[data-side="left"] .node { right: -64px; }
.block[data-side="right"] .node { left: -64px; }

.kicker {
  display: block; margin-bottom: 0.6rem;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--tint);
}
.block-title {
  font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(2rem, 1.2rem + 2.6vw, 3.4rem); line-height: 1.04; letter-spacing: -0.01em;
  margin-bottom: 0.8rem;
}
.block p { color: var(--fg-2); max-width: 44ch; }


/* ── 04 · Market: hero, book, figures ────────────── */
.block--hero {
  width: min(900px, 70vw);
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding-top: 5rem;
}
.block--hero .node { top: auto; bottom: 22vh; right: auto; left: 76%; }
.eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--tint); margin-bottom: 1.4rem; }
.hero-name {
  font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(3.6rem, 1.5rem + 9vw, 10rem); line-height: 0.92; letter-spacing: -0.02em;
  display: flex; flex-direction: column;
}
.hero-name .w { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-name .w > span { display: inline-block; }
.hero-name .w--gold { color: var(--gold-deep); }
.hero-role { margin-top: 1.6rem; font-size: clamp(1.1rem, 0.9rem + 0.7vw, 1.4rem); line-height: 1.45; max-width: 30ch; color: var(--fg-2); }

.block--book { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 2rem; align-items: start; width: min(640px, 50vw); }
.book img { border-radius: 4px; box-shadow: 0 26px 50px rgba(20,20,18,0.22), 0 8px 18px rgba(20,20,18,0.12); transition: transform 0.6s var(--ease); }
.book:hover img { transform: translateY(-6px) rotate(-1.5deg); }
.book-title { font-family: var(--font-serif); font-weight: 700; font-size: 1.9rem; line-height: 1.1; margin-bottom: 0.6rem; }
.book-text p { margin-bottom: 1.2rem; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1.4rem; border-radius: 999px;
  background: var(--green); color: var(--paper);
  font-size: 0.9rem; font-weight: 600; text-decoration: none;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn:hover { background: var(--green-hover); transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--fg); border: 1.5px solid var(--rule); }
.btn--ghost:hover { background: transparent; border-color: var(--green); color: var(--green); }

.figures { display: flex; gap: clamp(1.5rem, 4vw, 3.5rem); }
.figures div { display: flex; flex-direction: column-reverse; }
.figures dd { font-family: var(--font-serif); font-weight: 700; font-size: clamp(3rem, 2rem + 3vw, 5rem); line-height: 1; color: var(--tint); }
.figures dt { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-2); margin-top: 0.5rem; max-width: 12ch; }

/* ── Rewind interstitials ────────────────────────── */
.rewind {
  position: relative; z-index: 1;
  min-height: 80vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 var(--gutter);
}
.rewind-big {
  font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(2.6rem, 1.2rem + 5vw, 6rem); line-height: 1.02; letter-spacing: -0.015em;
  max-width: 15ch;
  text-shadow: 0 0 14px var(--bg), 0 0 28px var(--bg), 0 0 40px var(--bg);
}
.rewind-small { margin-top: 1.4rem; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--tint); }

/* ── Speaking: the run of venue names ─────────────── */
.venues {
  font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(1.7rem, 1rem + 2.4vw, 3rem); line-height: 1.2;
  color: var(--fg) !important; max-width: none !important;
  margin: 0.4rem 0 1.8rem;
}

/* ── Cards (one shape everywhere) ────────────────── */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; margin-top: 0.4rem; }
.card {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1.25rem 1.3rem 1.4rem;
  min-height: 150px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 16px;
  text-decoration: none;
  transition: background 0.35s var(--ease), color 0.35s var(--ease), transform 0.35s var(--ease), border-color 0.35s var(--ease);
}
.card-venue { font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; line-height: 1.2; color: var(--tint); }
.card-title { font-size: 0.92rem; line-height: 1.45; color: var(--fg); }
.card:hover { background: var(--green); border-color: var(--green); transform: translateY(-4px); }
.card:hover .card-venue, .card:hover .card-title { color: var(--paper); }

/* ── Finale ──────────────────────────────────────── */
.finale {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 22vh var(--gutter) 2rem;
}
.finale-kicker { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--tint); margin-bottom: 1.2rem; }
.finale-title { text-shadow: 0 0 14px var(--bg), 0 0 28px var(--bg); font-family: var(--font-serif); font-weight: 700; font-size: clamp(2.8rem, 1.2rem + 6vw, 7rem); line-height: 0.98; letter-spacing: -0.02em; max-width: 13ch; }
.finale-copy { margin: 1.6rem auto 2.4rem; max-width: 46ch; color: var(--fg-2); }
.email {
  display: inline-flex; align-items: center; gap: 1rem; flex-wrap: wrap; justify-content: center;
  background: none; border: 0; border-bottom: 1.5px solid var(--rule);
  padding: 0 0 0.6rem; cursor: pointer;
  font: 500 clamp(1.1rem, 0.8rem + 1.4vw, 1.9rem)/1.3 var(--font-sans); color: var(--fg);
  transition: border-color 0.3s var(--ease);
}
.email:hover { border-color: var(--green); }
.email span:first-child { overflow-wrap: anywhere; }
.email-hint { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; padding: 0.35rem 0.75rem; border-radius: 999px; background: rgba(31,94,51,0.1); color: var(--green); }
.email.is-copied .email-hint { background: var(--green); color: var(--paper); }
.finale-links { display: flex; gap: 1.6rem; margin-top: 1.6rem; font-weight: 500; }
.finale-links a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.finale-links a:hover { border-color: var(--green); color: var(--green); }
.foot { margin-top: auto; padding-top: 6rem; font-size: 0.8rem; color: var(--fg-2); }

/* ── Mobile: the line runs down the left edge ────── */
@media (max-width: 760px) {
  .chapter { gap: 16vh; padding-left: 3.4rem; padding-right: 1.25rem; }
  .block, .block--wide, .block--book, .block--hero { width: 100%; margin: 0 !important; align-self: stretch !important; }
  .block[data-side] .node { left: -2.55rem; right: auto; }
  .block--hero .node { left: -2.55rem; bottom: 18vh; }
  .block--hero { padding-top: 4rem; }
  .block--book { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .book img { width: 150px; }
  .book-title { font-size: 1.5rem; }
  .figures { gap: 1.2rem; flex-wrap: wrap; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .rewind { padding-left: 3.4rem; text-align: left; align-items: flex-start; }
  .finale { padding-left: 3.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body { transition: none; }
}

/* ── Chapter markers: a big numeral counting down ── */
.chapter-mark {
  display: flex; flex-direction: column; gap: 0.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
  width: min(420px, 30vw);
  text-shadow: 0 0 12px var(--bg), 0 0 24px var(--bg);
}
.chapter-mark[data-side="right"] { align-self: flex-end; margin-right: 2vw; }
.chapter-years {
  font-family: var(--font-serif); font-weight: 700;
  font-size: clamp(1.9rem, 1.2rem + 2vw, 3rem); line-height: 1;
  color: var(--tint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chapter-title { font-family: var(--font-serif); font-weight: 700; font-size: clamp(1.6rem, 1rem + 1.6vw, 2.4rem); line-height: 1.05; }

.chapter--open { padding-bottom: 6vh; }

/* ── The book carries its own figures ─────────────── */
.block--book { width: min(700px, 54vw); }
.figures--book { gap: clamp(1.2rem, 2.5vw, 2.2rem); margin: 0.4rem 0 1.6rem; padding-top: 1.1rem; border-top: 1px solid var(--rule); }
.figures--book dd { font-size: clamp(2rem, 1.4rem + 1.6vw, 2.8rem); }
.figures--book dt { font-size: 0.66rem; }

@media (max-width: 760px) {
  .chapter-mark { width: 100%; align-self: stretch !important; margin: 0 !important; }
}


/* figures: numbers share one top line, labels hang beneath */
.figures--book { display: grid; grid-template-columns: repeat(3, max-content); column-gap: clamp(1.4rem, 3vw, 2.6rem); }
.figures--book div { flex-direction: column; justify-content: flex-start; }
.figures--book dd { order: -1; }
.figures--book dt { margin-top: 0.4rem; }
.block--book .book { margin-top: 0.3rem; }

/* =====================================================
   ONE TYPE SCALE FOR THE WHOLE TIMELINE
   years > chapter name > entry title > body > sub-card
   ===================================================== */
:root {
  --t-years: clamp(1.4rem, 1.1rem + 0.8vw, 1.85rem);
  --t-chapter: var(--t-entry);
  --t-entry: clamp(1.8rem, 1.2rem + 1.4vw, 2.5rem);
  --t-list: clamp(1.4rem, 1rem + 1vw, 1.8rem);
  --t-figure: clamp(1.8rem, 1.3rem + 1.1vw, 2.3rem);
  --t-body: 1.0625rem;
  --t-sub-head: 1.15rem;
  --t-sub-body: 0.92rem;
  --t-label: 0.72rem;
}
.chapter-years { font-size: var(--t-years); }
.chapter-title { font-size: var(--t-chapter); }
.block-title, .book-title { font-size: var(--t-entry); line-height: 1.08; margin-bottom: 0.7rem; }
.block p, .book-text p { font-size: var(--t-body); }
.venues { font-size: var(--t-list) !important; line-height: 1.3; }
.figures--book dd { font-size: var(--t-figure); }
.card-venue, .talk-venue { font-size: var(--t-sub-head); line-height: 1.2; }
.card-title, .talk-title { font-size: var(--t-sub-body); line-height: 1.45; }
.kicker, .talk-kind, .figures dt, .figures--book dt { font-size: var(--t-label); letter-spacing: 0.14em; }

/* =====================================================
   MOBILE: tight, even rhythm; nothing past the edge
   ===================================================== */
@media (max-width: 760px) {
  :root { --m-gap: 3.5rem; }
  .chapter { gap: var(--m-gap); padding-top: var(--m-gap); padding-bottom: var(--m-gap); }
  .chapter--open { padding-top: 0; padding-bottom: 1rem; }
  .block--hero { min-height: 0; padding-top: 6.5rem; padding-bottom: 1rem; justify-content: flex-start; }
  .hero-role { margin-top: 1.1rem; }
  .rewind { min-height: 0; padding-top: var(--m-gap); padding-bottom: var(--m-gap); }
  .finale { min-height: 0; padding-top: 4.5rem; padding-bottom: 1.5rem; }
  .finale-copy { margin: 1.2rem 0 1.8rem; }
  .foot { padding-top: 3.5rem; }
  .chapter-mark { padding-bottom: 0.8rem; }

  /* book figures: three equal columns that always fit */
  .figures--book { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 0.9rem; }
  .figures--book dt { letter-spacing: 0.08em; overflow-wrap: anywhere; }
  .figures--book dd { font-size: clamp(1.6rem, 7vw, 2.1rem); }

  .venues { margin-bottom: 1.4rem; }
}
@media (max-width: 760px) {
  .block--book { width: 100%; }
  .figures--book dt { overflow-wrap: normal; word-break: normal; hyphens: none; letter-spacing: 0.06em; font-size: 0.66rem; }
}

/* Mobile polish: line set in from the edge, calmer labels */
@media (max-width: 760px) {
  .chapter, .rewind, .finale { padding-left: 3.9rem; }
  .block[data-side] .node, .block--hero .node { left: -2.35rem; }
  .eyebrow { font-size: 0.7rem; letter-spacing: 0.12em; }
  .kicker { letter-spacing: 0.1em; }
}

/* The opening's eyebrow and tagline keep their own sizes (they are <p>s inside a block) */
.block .eyebrow { font-size: 0.78rem; letter-spacing: 0.18em; color: var(--tint); }
.block .hero-role { font-size: clamp(1.1rem, 0.9rem + 0.7vw, 1.4rem); line-height: 1.45; }
@media (max-width: 760px) {
  .block .eyebrow { font-size: 0.7rem; letter-spacing: 0.12em; }
  .block .hero-role { font-size: 1.05rem; }
}

/* Playfair defaults to old-style figures (small, descending digits) that look like a
   different font next to its capitals. Use full-height lining figures everywhere. */
html { font-variant-numeric: lining-nums; }
.chapter-years, .figures dd, .figures--book dd { font-variant-numeric: lining-nums tabular-nums; }

/* =====================================================
   DESKTOP: a clear center lane for the line
   Columns stop short of the middle, so the chart and
   helix never run across text or cards.
   ===================================================== */
@media (min-width: 761px) {
  :root { --lane: 120px; }
  .block[data-side="left"], .block[data-side="right"] {
    width: min(520px, calc(50% - var(--lane) / 2 - 2vw));
  }
  .block--hero[data-side="left"] { width: min(900px, 70vw); }
  .block--book { grid-template-columns: 140px minmax(0, 1fr); gap: 1.5rem; }
  .figures--book { column-gap: 1.2rem; }
}
@media (min-width: 761px) {
  .figures--book { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 1rem; }
  .figures--book dt { overflow-wrap: normal; word-break: normal; letter-spacing: 0.08em; line-height: 1.35; }
}

/* =====================================================
   TALKS: a clean list (replaces the cards)
   ===================================================== */
.talks { display: block; list-style: none; margin: 0.4rem 0 1.8rem; padding: 0; border-bottom: 1px solid var(--rule); }
.talk-row { border-top: 1px solid var(--rule); }
.talk-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%; padding: 1rem 0;
  background: none; border: 0; text-align: left; cursor: pointer;
  font: inherit; color: var(--ink); text-decoration: none;
}
.talk-text { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.talk-meta { font-size: var(--t-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tint); }
.talk-title { font-family: var(--font-serif); font-weight: 700; font-size: var(--t-sub-head); line-height: 1.25; color: var(--ink); transition: color 0.25s var(--ease); }
.talk-action {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.95rem; border-radius: 999px;
  border: 1.5px solid var(--green); color: var(--green);
  font-size: 0.78rem; font-weight: 600; white-space: nowrap;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.talk-btn:hover .talk-title, .talk-btn:focus-visible .talk-title { color: var(--green); }
.talk-btn:hover .talk-action, .talk-btn:focus-visible .talk-action,
.talk-row.is-playing .talk-action { background: var(--green); color: var(--paper); }
.talk-player { width: 100%; aspect-ratio: 16 / 9; margin: 0 0 1.1rem; border-radius: 12px; overflow: hidden; background: var(--paper-2); }
.talk-player iframe { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 760px) {
  .talk-btn { padding: 0.9rem 0; gap: 0.8rem; }
  .talk-action { padding: 0.4rem 0.8rem; }
}
