/* ============================================================
   Editorial vertical case study — Medium-style scroll, not slides.
   Inter throughout — display headlines, reading body copy, and
   labels/meta all share one font. Reuses the site's token names so
   theme.css's dark-mode overrides apply automatically.
   ============================================================ */

:root {
  --bg: #FFFFFF;
  --panel: #FFFFFF;
  --panel-2: #F2F2F0;
  --ink: #242424;
  --muted: #6B6B66;
  --faint: #A3A39C;
  --line: rgba(20, 20, 15, 0.10);
  --line-strong: rgba(20, 20, 15, 0.18);
  --accent: #14140F;
  --accent-ink: #F5F5F2;

  --serif-display: "Inter", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans: "Inter", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "Inter", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --measure: 900px;
  --pad: clamp(1.5rem, 6vw, 4rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
  animation: none;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) { background: var(--bg); animation: none; }
}

html[data-theme="dark"] { background: var(--bg); animation: none; }

body {
  font-family: var(--sans);
  background: transparent;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ink); color: var(--bg); }

a { color: inherit; }

/* ---------- Reading progress ---------- */

.progress-rail {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--line);
  z-index: 60;
}

.progress-rail span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3E6398 0%, #B8503F 45%, #C96A12 100%);
  transition: width 0.1s linear;
}

/* ---------- Top chrome ---------- */

.story-top {
  position: fixed;
  top: 2px; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem var(--pad);
  z-index: 55;
  font-family: var(--mono);
  pointer-events: none;
}

.story-top a, .story-top button { pointer-events: auto; }

.story-home {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.45rem 0.85rem 0.45rem 0.65rem;
  border-radius: 99px;
  box-shadow: 0 4px 16px -6px rgba(0, 0, 0, 0.18);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.story-home:hover { color: var(--ink); border-color: var(--line-strong); }
.story-home svg { width: 13px; height: 13px; }

.story-top-right { display: flex; align-items: center; gap: 0.6rem; }

.theme-btn--story {
  position: static;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 4px 16px -6px rgba(0, 0, 0, 0.18);
}

/* ---------- Article shell (paper on the ambient gradient) ---------- */

.story {
  width: 100%;
  background: transparent;
  padding-bottom: clamp(4rem, 8vh, 6rem);
}

.story-col {
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

.story-wide {
  width: 94%;
  max-width: 1300px;
  margin: 3.5rem auto 3rem;
}

/* ---------- Hero ---------- */

.story-hero {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(6rem, 14vh, 8rem) var(--pad) 0;
}

.kicker {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.story-hero h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 2.25rem;
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin-top: 0.9rem;
  max-width: 16ch;
}

.dek {
  font-family: var(--sans);
  font-style: normal;
  font-weight: 400;
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--muted);
  max-width: 42ch;
  margin-top: 1rem;
}

.byline {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--faint);
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0;
  max-width: 46ch;
}

.byline strong { color: var(--ink); font-weight: 600; }
.byline .dot { margin: 0 0.55rem; opacity: 0.5; }

.read-time { font-family: var(--sans); font-size: 0.8rem; color: var(--faint); margin-top: 0.6rem; }

.story-hero-img {
  margin: clamp(2.5rem, 6vh, 4rem) auto 0;
  width: 92%;
  max-width: 1200px;
}

.story-hero-img img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Article typography ---------- */

.story-col > p, .story-col > ul, .story-col > .role-list {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75rem;
  color: var(--ink);
  max-width: 74ch;
}

.story-col > p { margin-top: 1.2rem; }

.story-col > p.lede {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.75rem;
  color: var(--ink);
  max-width: 74ch;
}

@media (max-width: 480px) {
  .story-col > p, .story-col > ul, .story-col > .role-list { font-size: 1rem; line-height: 1.6rem; }
}
.story-col > p strong { font-weight: 600; }
.story-col > p em { font-style: italic; }

h2.sec {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
  margin-top: 3rem;
  max-width: 30ch;
}

.story-col > h2.sec + p { margin-top: 1.1rem; }

.sec-k {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: clamp(3.5rem, 8vh, 5.5rem);
}

.sec-k + h2.sec { margin-top: 0.6rem; }

/* ---------- Numbered constraint list ---------- */

.story-col > ul.constraints { list-style: none; margin-top: 1.75rem; }

.constraints li {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.5rem 1rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}

.constraints li:last-child { border-bottom: 1px solid var(--line); }

.constraints .n {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--accent);
}

.constraints .t {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.constraints .t strong { font-weight: 600; }

/* ---------- Role list ---------- */

.role-list { margin-top: 1.75rem; list-style: none; }

.role-list li {
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.4rem 1.5rem;
}

.role-list li:last-child { border-bottom: 1px solid var(--line); }

.role-list .rl-k {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.2rem;
}

.role-list .rl-v {
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

@media (max-width: 560px) {
  .role-list li { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* ---------- Pull quote ---------- */

.pull-quote {
  margin: clamp(3.5rem, 8vh, 5.5rem) auto;
  max-width: 720px;
  padding-left: clamp(1.5rem, 6vw, 4rem);
  padding-right: clamp(1.5rem, 6vw, 4rem);
}

.pull-quote blockquote {
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.7rem, 4.2vw, 2.5rem);
  line-height: 1.28;
  letter-spacing: -0.005em;
  border-left: 3px solid var(--accent);
  padding-left: clamp(1.25rem, 3vw, 2rem);
}

.pull-quote .attrib {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 1.25rem;
  padding-left: clamp(1.25rem, 3vw, 2rem);
  max-width: 44ch;
}

/* ---------- Images ---------- */

.story-wide figure { margin: 0; }

.story-wide img {
  display: block;
  width: 100%;
  height: auto;
}

.duo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line);
}

.duo img { border: none; border-radius: 0; }
.duo figcaption { padding: 0.75rem var(--pad) 0; }

figcaption {
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--muted);
  text-align: center;
  padding: 0.625rem var(--pad) 0;
  max-width: var(--measure);
  margin: 0 auto;
}

.duo figcaption { max-width: none; margin: 0; padding-top: 0.625rem; }

/* ---------- Stats ---------- */

.stat-row {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  max-width: 74ch;
}

.stat-row .v {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(2rem, 3.8vw, 2.75rem);
  letter-spacing: -0.005em;
  line-height: 1;
}

.stat-row .k {
  font-family: var(--sans);
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 0.6rem;
  line-height: 1.4;
}

@media (max-width: 620px) {
  .stat-row { grid-template-columns: 1fr; gap: 1.25rem; }
}

.stat-row.is-compact {
  margin-top: 0;
  padding-top: 1.25rem;
}

.stat-row.is-compact .v { font-size: clamp(1.4rem, 2.4vw, 1.7rem); }
.stat-row.is-compact .k { font-size: 0.8rem; margin-top: 0.4rem; }

/* ---------- Closing ---------- */

.story-end {
  margin-top: clamp(3.5rem, 8vh, 5.5rem);
  padding-top: clamp(2.5rem, 6vh, 3.5rem);
  border-top: 1px solid var(--line);
}

.story-end h2 {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(2rem, 4.2vw, 2.75rem);
  line-height: 1.2;
  letter-spacing: -0.005em;
}

.story-end h2 .thin { color: var(--muted); font-style: italic; }

.end-links {
  margin-top: 2rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.end-links a { text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 3px; }
.end-links a:hover { text-decoration-color: var(--ink); }

/* ---------- Prototype / video placeholder ---------- */

.proto-frame {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--faint);
  overflow: hidden;
}

.proto-frame svg { width: 34px; height: 34px; opacity: 0.6; }
.proto-frame p { font-family: var(--sans); font-size: 0.85rem; }
.proto-frame iframe, .proto-frame video { width: 100%; height: 100%; display: block; }

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 0.7, 0.25, 1);
}

.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */

@media (max-width: 780px) {
  .story-hero { padding-top: clamp(5.5rem, 14vh, 7rem); }
  .stat-row { max-width: none; }
}
