/* ============================================================
   ThreeDoors — deck.css  (ENGINE — rarely edit)
   Scroll-deck presentation engine. Slide CONTENT lives in
   index.html; this file is layout, type, motion, chrome.

   Brand tokens below are copied from the canonical design system
   (threedoors-wiki/marketing/brand/design-system/tokens.css,
   mirrored at public/brand/design-system/). Internal tools are
   self-contained folders, so the values are inlined here — if the
   palette ever changes, re-sync this block.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&family=Inter:wght@400;500;600;700&family=Special+Elite&display=swap");

:root {
  /* Locked palette */
  --cream:   #F1E7D2;
  --teal:    #0E5C63;
  --crimson: #B5132A;
  --ink:     #0A2326;
  --ink-1:   #0F2A2E;
  --ink-2:   #14383C;
  --sage:    color-mix(in oklab, var(--teal) 55%, var(--cream));
  --crimson-lift: color-mix(in oklab, var(--crimson) 55%, var(--cream));

  --text:       var(--cream);
  --text-body:  rgba(241, 231, 210, 0.92);
  --text-muted: rgba(241, 231, 210, 0.68);
  --text-soft:  rgba(241, 231, 210, 0.50);
  --border:        var(--ink-2);
  --border-strong: rgba(241, 231, 210, 0.30);

  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans:  "Inter", "Helvetica Neue", Arial, sans-serif;
  --artefact: "Special Elite", "Courier Prime", "Courier New", monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --reveal-dur: 900ms;
  --reveal-stagger: 110ms;

  --pad-x: clamp(28px, 7vw, 110px);
}

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

body {
  background: var(--ink);
  color: var(--text-body);
  font-family: var(--sans);
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--crimson); color: var(--cream); }

/* ------------------------------------------------------------
   Slide scaffold — sticky-dwell model.
   Each .slide is TALLER than the viewport (--dwell, ~115svh); the
   .pin inside is position:sticky at 100svh, so the slide "holds"
   for the extra ~15% of scroll before releasing. Pure CSS dwell —
   no scroll-jacking. Markup: section.slide > div.pin > div.slide-inner.
   ------------------------------------------------------------ */
:root { --dwell: 118svh; }

.deck { scroll-snap-type: y proximity; }

.slide {
  position: relative;
  min-height: var(--dwell);
  scroll-snap-align: start;
}
.slide:last-child { min-height: 100svh; } /* no dwell after the close */

.pin {
  position: sticky; top: 0;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: clamp(56px, 9vh, 110px) var(--pad-x);
}
.slide-inner { position: relative; width: 100%; max-width: 1240px; margin-inline: auto; }

/* Alternate ground for rhythm */
.slide--lift .pin { background: var(--ink-1); }

/* Full-bleed image slides (cover / close) */
.slide--bleed .pin { padding: 0; }
.slide--bleed .bleed-img {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transform: scale(1.08);
  transition: transform 12s var(--ease);
}
.slide--bleed.in .bleed-img { transform: scale(1.0); }
.slide--bleed .scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,35,38,0.55) 0%, rgba(10,35,38,0.28) 42%, rgba(10,35,38,0.82) 100%);
}
.slide--bleed .slide-inner { padding: clamp(56px, 9vh, 110px) var(--pad-x); }

/* ------------------------------------------------------------
   Detail panel — a slide opts in with <aside class="detail">.
   Opens with → / the "More" button; closes with ← / Esc / slide
   change. deck.js injects the button and wires the keys.
   ------------------------------------------------------------ */
.detail {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(1560px, 82%);   /* panels are content, not sidebars (deck-wide default since v6) */
  background: var(--ink-1);
  border-left: 1px solid var(--border-strong);
  box-shadow: -30px 0 60px rgba(0, 0, 0, 0.45);
  padding: clamp(28px, 4vh, 48px) clamp(24px, 2.6vw, 44px);
  overflow-y: auto;
  transform: translateX(108%);
  transition: transform 420ms var(--ease);
  z-index: 6;
}
.slide--lift .detail { background: var(--ink); }
.slide.open .detail { transform: none; }
@media (max-width: 820px) { .detail { width: 100%; } }

/* legacy alias — 82% is now the deck-wide default */
.detail--wide { width: min(1560px, 82%); }
.detail iframe { width: 100%; height: calc(100svh - clamp(120px, 16vh, 180px)); border: 0; border-radius: 4px; display: block; }

.detail h3 {
  font-family: var(--serif); font-weight: 600; color: var(--text);
  font-size: clamp(18px, 1.6vw, 24px); margin: 0 0 16px;
}
.detail p, .detail li { font-size: clamp(13px, 1vw, 15px); color: var(--text-muted); max-width: 78ch; }
.detail .beats li::before { top: 0.55em; }
.detail .ph { color: var(--crimson-lift); font-family: var(--artefact); font-size: 12px; }

/* ------------------------------------------------------------
   Face diagrams — Venn, multiplier cube, curtain, metric chips
   ------------------------------------------------------------ */
.venn text, .cube text, .curtain text { font-family: var(--sans); fill: var(--text-body); font-size: 16px; }
.venn .big, .cube .big { font-family: var(--serif); fill: var(--cream); font-weight: 600; font-size: 21px; }
.venn .ing-label { fill: var(--cream); font-weight: 600; font-size: 15px; }
.venn .centre { fill: var(--crimson-lift); font-weight: 700; }

/* tessellating value-chain chevrons (title-only in shape; support text below) */
.chevrons { display: flex; flex-wrap: wrap; gap: 3px; }
.chev {
  flex: 1 1 128px; min-width: 118px;
  background: var(--ink-2);
  clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%, 15px 50%);
  padding: 18px 14px 18px 26px; text-align: center;
  font-family: var(--serif); font-weight: 600; color: var(--cream);
  font-size: clamp(13px, 1.1vw, 16px); line-height: 1.2;
}
.chev:first-child { clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 50%, calc(100% - 15px) 100%, 0 100%); padding-left: 16px; }
.chev--gap { background: rgba(181, 19, 42, 0.22); }
.chev .tick { color: var(--sage); margin-right: 6px; }
.chev--gap .tick { color: var(--crimson-lift); }
.chev-notes { margin-top: 18px; display: grid; gap: 6px 28px; font-size: clamp(12px, 0.95vw, 14px); color: var(--text-muted); }
@media (min-width: 900px) { .chev-notes { grid-template-columns: 1fr 1fr; } }
.chev-notes b { color: var(--text-body); font-weight: 600; }
.metric-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.metric-chips span {
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 8px 14px;
  font-size: clamp(12px, 0.95vw, 14px); color: var(--text-body);
}
.metric-chips b { color: var(--cream); font-weight: 600; }

/* dark scrim over the face while the panel is open (click to close) */
.dscrim {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(10, 35, 38, 0.55);
  opacity: 0; pointer-events: none;
  transition: opacity 320ms var(--ease);
}
.slide.open .dscrim { opacity: 1; pointer-events: auto; }

/* the injected "More →" affordance */
.more {
  position: absolute; right: clamp(20px, 3vw, 44px); bottom: clamp(18px, 3.4vh, 34px);
  z-index: 4;
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: 4px;
  padding: 8px 16px; cursor: pointer;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  transition: color 240ms var(--ease), border-color 240ms var(--ease);
}
.more:hover { color: var(--text); border-color: var(--cream); }
.detail .more { position: static; margin-top: 22px; } /* close button inside panel */

/* dot-rail marker for detail-bearing slides */
#rail a.has-detail { background: transparent; border: 1.5px solid rgba(241, 231, 210, 0.4); }
#rail a.has-detail:hover { border-color: rgba(241, 231, 210, 0.8); }
#rail a.has-detail.on { background: var(--cream); border-color: var(--cream); }

/* ------------------------------------------------------------
   Deck diagrams — chart + value-chain + platform building blocks.
   Charts: single series (sage), one accent (crimson-lift), all
   values direct-labelled in text tokens. No hue-only identity.
   ------------------------------------------------------------ */
.chart { width: 100%; }
.chart text { font-family: var(--sans); fill: var(--text-muted); font-size: 13px; }
.chart .val { fill: var(--cream); font-weight: 600; font-size: 15px; }
.chart .accent-label { fill: var(--crimson-lift); font-weight: 600; }
.chart .line { stroke: var(--sage); stroke-width: 2; fill: none; stroke-linecap: round; }
.chart .dot { fill: var(--sage); }
.chart .dot--accent { fill: var(--crimson-lift); }
.chart .grid { stroke: var(--ink-2); stroke-width: 1; }
.chart .band { fill: rgba(181, 19, 42, 0.16); stroke: var(--crimson); stroke-dasharray: 4 5; stroke-width: 1; }

/* value chain */
.chain { display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.chain .node {
  flex: 1 1 120px; min-width: 118px;
  border: 1px solid var(--border-strong); border-radius: 4px;
  padding: 14px 12px; text-align: center;
  background: var(--ink-1); position: relative;
}
.slide--lift .chain .node { background: var(--ink); }
.chain .node .t { font-family: var(--serif); font-weight: 600; color: var(--text); font-size: clamp(14px, 1.15vw, 17px); }
.chain .node .p { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.chain .node .tick { color: var(--sage); font-weight: 700; margin-right: 5px; }
.chain .node--gap { border-style: dashed; }
.chain .node--gap .tick { color: var(--crimson-lift); }
.chain-note { margin-top: 14px; font-size: 13px; color: var(--text-muted); }
.chain-note b { color: var(--crimson-lift); font-weight: 600; }

/* platform diagram */
.platform { display: grid; gap: 10px; }
.platform .base {
  border: 1px solid var(--border-strong); border-radius: 4px;
  padding: 12px 16px; text-align: center;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--sage);
}
.platform .eps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.platform .ep {
  border: 1px solid var(--border); border-radius: 4px;
  padding: 16px 10px; text-align: center; color: var(--text-soft);
  font-size: 12px; letter-spacing: 0.06em;
}
.platform .ep--live {
  border-color: var(--crimson); color: var(--text);
  background: rgba(181, 19, 42, 0.10);
  font-family: var(--serif); font-weight: 600; font-size: clamp(14px, 1.1vw, 17px); letter-spacing: 0;
}

/* ------------------------------------------------------------
   Typography roles
   ------------------------------------------------------------ */
.eyebrow {
  font-family: var(--sans); font-size: clamp(11px, 0.85vw, 13px);
  font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--sage); margin: 0 0 clamp(14px, 2.4vh, 26px);
}
.eyebrow .no { color: var(--text-soft); margin-right: 14px; }

h1, h2 {
  font-family: var(--serif); font-optical-sizing: auto;
  font-weight: 600; color: var(--text); margin: 0; text-wrap: balance;
}
h1 { font-size: clamp(46px, 7.4vw, 112px); line-height: 1.02; letter-spacing: -0.022em; }
h2 { font-size: clamp(30px, 3.6vw, 54px); line-height: 1.08; letter-spacing: -0.015em; max-width: 22ch; }
h2 em { font-style: italic; font-weight: 500; color: var(--crimson-lift); }

.sub {
  font-family: var(--serif); font-weight: 400; font-style: italic;
  font-size: clamp(18px, 1.7vw, 26px); line-height: 1.35;
  color: var(--text-body); max-width: 34ch;
}

.lead { font-size: clamp(16px, 1.3vw, 20px); max-width: 58ch; color: var(--text-body); }
.muted { color: var(--text-muted); }
.crimson { color: var(--crimson-lift); }
.artefact { font-family: var(--artefact); font-size: 13px; letter-spacing: 0.02em; }

/* ------------------------------------------------------------
   Layout helpers
   ------------------------------------------------------------ */
.cols { display: grid; gap: clamp(28px, 4vw, 72px); align-items: center; }
@media (min-width: 900px) {
  .cols--2 { grid-template-columns: 1fr 1fr; }
  .cols--headline { grid-template-columns: 5fr 6fr; align-items: start; }
}

.rule { border: 0; border-top: 1px solid var(--border-strong); margin: clamp(20px, 3.4vh, 36px) 0; }

/* Beat list — the storytelling list (slide 2 etc.) */
.beats { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(12px, 2vh, 20px); }
.beats li {
  padding-left: 26px; position: relative;
  font-size: clamp(15px, 1.25vw, 19px); max-width: 56ch;
}
.beats li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 12px; height: 2px; background: var(--crimson);
}
.beats strong { color: var(--text); }

/* Proof rows (slide 3) */
.proof { list-style: none; margin: 0; padding: 0; }
.proof li {
  display: grid; grid-template-columns: minmax(150px, 240px) 1fr;
  gap: 18px; padding: clamp(9px, 1.3vh, 14px) 0;
  border-bottom: 1px solid var(--border);
  font-size: clamp(14px, 1.1vw, 17px);
}
.proof li:first-child { border-top: 1px solid var(--border); }
.proof .who { font-family: var(--serif); font-weight: 600; color: var(--text); }

/* Stat blocks (slide 8 etc.) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: clamp(18px, 3vw, 44px); }
.stat .n {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(38px, 4.6vw, 72px); line-height: 1; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat .l { margin-top: 8px; font-size: clamp(12px, 0.95vw, 14px); color: var(--text-muted); max-width: 22ch; }

/* Compare table (slide 6) */
.compare { width: 100%; border-collapse: collapse; font-size: clamp(13px, 1.05vw, 16px); }
.compare th, .compare td { text-align: left; padding: clamp(10px, 1.5vh, 16px) 18px; vertical-align: top; }
.compare thead th {
  font-family: var(--sans); font-size: clamp(11px, 0.85vw, 13px); font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
}
.compare tbody tr { border-bottom: 1px solid var(--border); }
.compare td:first-child { color: var(--text-muted); width: 18%; }
.compare td:nth-child(2) { color: var(--text-soft); }
.compare td:nth-child(3) { color: var(--text); }
.compare td strong { color: var(--crimson-lift); }

/* Cards (slide 7 moat) */
.cards { display: grid; gap: clamp(14px, 2vw, 24px); }
@media (min-width: 900px) { .cards--3 { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--ink-1); border: 1px solid var(--border);
  border-radius: 4px; padding: clamp(20px, 2.6vw, 32px);
}
.slide--lift .card { background: var(--ink); }
.card h3 {
  font-family: var(--serif); font-weight: 600; margin: 0 0 10px;
  font-size: clamp(18px, 1.6vw, 24px); color: var(--text);
}
.card p { margin: 0; font-size: clamp(13px, 1.05vw, 16px); color: var(--text-muted); }

/* Checklist (18-month proof, deliverables) */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checks li { padding-left: 28px; position: relative; font-size: clamp(13px, 1.1vw, 16px); }
.checks li::before { content: "✓"; position: absolute; left: 0; color: var(--sage); font-weight: 700; }

/* FRINGE letter chips */
.fringe-row { display: flex; gap: clamp(8px, 1vw, 14px); flex-wrap: wrap; }
.chip {
  display: grid; place-items: center;
  width: clamp(44px, 4.4vw, 64px); height: clamp(44px, 4.4vw, 64px);
  border: 1px solid var(--border-strong); border-radius: 4px;
  font-family: var(--serif); font-weight: 600; font-size: clamp(20px, 2.2vw, 32px);
  color: var(--cream); background: var(--ink-1);
}
.chip small { display: none; }

/* Framed image */
.frame { border: 1px solid var(--border); border-radius: 4px; overflow: hidden; background: var(--ink-1); }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Storyboard strip */
.strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(8px, 1vw, 16px); margin-top: clamp(24px, 4vh, 44px); }
.strip .frame { aspect-ratio: 4 / 3; }

/* Phase rail (slide 11) */
.rail { display: grid; gap: 14px; }
@media (min-width: 900px) { .rail { grid-template-columns: 1fr 1fr; } }
.phase {
  border: 1px solid var(--border-strong); border-radius: 4px;
  padding: clamp(20px, 2.4vw, 30px); position: relative;
}
.phase--now { border-color: var(--crimson); }
.phase .tag {
  position: absolute; top: -11px; left: 18px; padding: 2px 10px;
  background: var(--ink); font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--sage);
}
.phase--now .tag { color: var(--crimson-lift); }

/* ------------------------------------------------------------
   Reveal animation — children of .slide-inner marked .rv appear
   staggered when the slide enters. --i sets the stagger index
   (deck.js auto-assigns document order if not set).
   ------------------------------------------------------------ */
.rv { opacity: 0; transform: translateY(26px); }
.in .rv {
  opacity: 1; transform: none;
  transition:
    opacity var(--reveal-dur) var(--ease) calc(var(--i, 0) * var(--reveal-stagger)),
    transform var(--reveal-dur) var(--ease) calc(var(--i, 0) * var(--reveal-stagger));
}

/* ------------------------------------------------------------
   Chrome — progress bar, dot rail, counter, hint, notes
   ------------------------------------------------------------ */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--crimson); z-index: 60;
}

#rail {
  position: fixed; right: clamp(14px, 2vw, 30px); top: 50%; transform: translateY(-50%);
  display: grid; gap: 12px; z-index: 60;
}
#rail a {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(241, 231, 210, 0.25); display: block;
  transition: background 240ms var(--ease), transform 240ms var(--ease);
}
#rail a:hover { background: rgba(241, 231, 210, 0.6); }
#rail a.on { background: var(--cream); transform: scale(1.3); }
@media (max-width: 700px) { #rail { display: none; } }

/* fullscreen toggle (top-right; hidden by deck.js where unsupported, e.g. iPhone) */
#fs {
  position: fixed; top: clamp(12px, 2vh, 22px); right: clamp(14px, 2vw, 30px); z-index: 60;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: rgba(15, 42, 46, 0.6); color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: 4px;
  font-size: 18px; line-height: 1; cursor: pointer;
  transition: color 240ms var(--ease), border-color 240ms var(--ease);
}
#fs:hover { color: var(--text); border-color: var(--cream); }

#counter {
  position: fixed; left: clamp(14px, 2vw, 30px); bottom: clamp(14px, 2.4vh, 26px);
  font-family: var(--sans); font-size: 12px; letter-spacing: 0.14em;
  color: var(--text-soft); z-index: 60; font-variant-numeric: tabular-nums;
}
#counter .t { color: var(--text-muted); margin-left: 10px; letter-spacing: 0.1em; text-transform: uppercase; }

.hint {
  position: absolute; left: 50%; bottom: clamp(18px, 3.5vh, 36px); transform: translateX(-50%);
  color: var(--text-soft); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  display: grid; justify-items: center; gap: 8px;
}
.hint::after {
  content: ""; width: 1px; height: 34px;
  background: linear-gradient(var(--text-soft), transparent);
  animation: drip 2.2s var(--ease) infinite;
}
@keyframes drip { 0% { transform: scaleY(0); transform-origin: top; } 55% { transform: scaleY(1); transform-origin: top; } 100% { opacity: 0; } }

/* Speaker notes — press N */
.notes {
  display: none;
  margin-top: clamp(18px, 3vh, 28px); padding: 14px 18px;
  border-left: 2px solid var(--crimson);
  background: rgba(15, 42, 46, 0.75);
  font-size: 14px; color: var(--text-muted); max-width: 62ch;
  border-radius: 0 4px 4px 0;
}
.notes::before {
  content: "Speaker"; display: block;
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--crimson-lift); margin-bottom: 6px;
}
body.show-notes .notes { display: block; }

/* Brand lockup (footer of cover / close) */
.lockup { font-family: var(--serif); font-size: clamp(16px, 1.3vw, 20px); color: var(--text); }
.lockup .b { font-weight: 700; }

/* ------------------------------------------------------------
   Reduced motion + print
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; }
  .slide--bleed .bleed-img { transform: none; transition: none; }
  .hint::after { animation: none; }
}

@media print {
  #progress, #rail, #counter, .hint, .more, .dscrim { display: none; }
  .slide { min-height: auto; page-break-after: always; }
  .pin { position: static; min-height: auto; padding: 40px; overflow: visible; display: block; }
  /* the printed PDF IS the send-ahead: face, then its detail as the next block */
  .detail {
    position: static; transform: none; width: auto;
    box-shadow: none; border: 1px solid #999; border-radius: 4px;
    margin-top: 24px; padding: 24px; page-break-inside: avoid;
  }
  .rv { opacity: 1; transform: none; }
  body { background: #fff; color: #111; }
}
