/* Story page. Warm ash background, basalt ink, one accent per step.
   Palette documented in tokens.css. */

html { scroll-behavior: smooth; }

body {
  background: #efe9df;
  background-image: radial-gradient(circle at 78% 10%, #f7f3ec 0%, #efe9df 48%, #e6dfd2 100%);
  background-attachment: fixed;
}

.rail {
  position: fixed;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 400;
}
.rail button {
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: #cdc4b4;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}
.rail button.active { background: #2b2621; transform: scale(1.45); }

main { scroll-snap-type: y proximity; }

.step {
  min-height: 100vh;
  min-height: 100svh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  padding: 88px 24px 70px 56px;
  position: relative;
}
.step .inner { width: 100%; max-width: 780px; margin: 0 auto; }

.label { font-size: 14px; color: #8a8175; margin: 0 0 12px; font-weight: 500; }

.big {
  font-size: clamp(60px, 13vw, 156px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin: 0 0 16px;
  color: #2b2621;
}
.big .unit { font-size: 0.33em; font-weight: 500; color: #8a8175; letter-spacing: -0.01em; margin-left: 0.18em; }
.step.has-chart .big { font-size: clamp(52px, 9vw, 104px); }
.step.has-chart { padding-top: 74px; }

.line { font-size: clamp(17px, 2.2vw, 23px); max-width: 34em; margin: 0; color: #574f47; }
.line b { font-weight: 700; color: #2b2621; }
.line .neg { color: #b25a50; font-weight: 600; }
.line .pos { color: #4e8d80; font-weight: 600; }

/* The sentence carries the legend: each series is named in its own colour,
   so the chart needs no end labels. Tones match the lines exactly. */
.line .s-wear { color: #b8544a; }
.line .s-clean { color: #7c7369; }
.line .s-price { color: #8f6f8a; }
.caption .neg { color: #b25a50; }
.caption .pos { color: #4e8d80; }

h1.title {
  font-size: clamp(36px, 6.6vw, 80px);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1.02; margin: 0 0 20px;
}
h1.title em { font-style: italic; font-weight: 400; }
h2.twist {
  font-size: clamp(31px, 5.2vw, 64px);
  font-weight: 700; letter-spacing: -0.035em; line-height: 1.04; margin: 0 0 18px;
}

.chart { margin-top: 26px; width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: inherit; font-size: 13px; }
/* No fill here: a class rule would override the per-label colours set on each
   text element. The default is set once on the svg and inherited instead. */
.chart .muted { fill: #8a8175; }

.caption { margin: 10px 0 0; font-size: 13px; color: #8a8175; max-width: 42em; }

.cue { position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; font-size: 13px; color: #8a8175; }
.cue a { text-decoration: none; }
.cue a:hover { text-decoration: underline; }

.hero { padding-top: 76px; }
.hero .kicker { color: #8a8175; font-size: 15px; margin: 0 0 10px; }
.hero .sub { font-size: clamp(17px, 2.2vw, 21px); color: #574f47; max-width: 31em; margin: 0; }

.outro .cols { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 20px; }
.outro .cols p { margin: 0; color: #574f47; font-size: 16px; max-width: 34em; }
.outro .cols p b { color: #2b2621; display: block; margin-bottom: 3px; }
.outro .ctas { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.outro .cta {
  display: inline-block; padding: 11px 17px; border: 1px solid #2b2621;
  border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 15px;
}
.outro .cta.primary { background: #2b2621; color: #efe9df; }
.outro .cta:hover { background: #2b2621; color: #efe9df; }
.outro .method { margin-top: 30px; font-size: 14px; color: #8a8175; max-width: 46em; }
.outro .method summary { cursor: pointer; color: #574f47; font-weight: 600; }
.outro .method p { margin: 10px 0 0; }
.outro .credits { margin-top: 26px; font-size: 13px; color: #8a8175; }

@media (min-width: 720px) { .outro .cols { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) {
  .step { padding: 78px 20px 62px 32px; }
  .rail { left: 9px; }
}

/* One orchestrated reveal per step: label, number, sentence, chart, in that order. */
.step .inner > * { opacity: 0; transform: translateY(16px); transition: opacity 0.55s ease, transform 0.55s ease; }
.step.in .inner > * { opacity: 1; transform: none; }
.step.in .inner > :nth-child(2) { transition-delay: 0.08s; }
.step.in .inner > :nth-child(3) { transition-delay: 0.2s; }
.step.in .inner > :nth-child(4) { transition-delay: 0.32s; }
.step.in .inner > :nth-child(5) { transition-delay: 0.4s; }
.step.in .inner > :nth-child(n+6) { transition-delay: 0.46s; }

/* The two payoff steps: a warm band and a marked label */
.step.key { background: linear-gradient(90deg, rgba(194, 105, 95, 0.09), rgba(194, 105, 95, 0) 70%); }
.step.key .label { color: #b25a50; font-weight: 600; }
.step.key .label::before { content: ""; display: inline-block; width: 22px; height: 2px; background: #b25a50; vertical-align: middle; margin-right: 8px; }
.rail button.key { background: #d9a7a0; }
.rail button.key.active { background: #b25a50; }

@media (prefers-reduced-motion: reduce) {
  .step .inner > * { opacity: 1; transform: none; transition: none; }
}

/* Island and ranking side by side on wide screens */
.duo { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 26px; }
.duo .chart { margin-top: 0; }
@media (min-width: 760px) { .duo { grid-template-columns: 1.15fr 1fr; align-items: center; } }

/* One tooltip shared by every chart on the page */
.tip {
  position: fixed;
  z-index: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  max-width: 260px;
  padding: 8px 11px;
  border-radius: 8px;
  background: rgba(43, 38, 33, 0.95);
  color: #f4efe6;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 6px 20px rgba(43, 38, 33, 0.25);
}
.tip.on { opacity: 1; }
.tip b { color: #fff; }
.tip .v { display: block; font-size: 17px; font-weight: 700; color: #fff; margin-bottom: 2px; }
.tip .x { display: block; color: #cdc4b4; margin-top: 3px; }
.chart .hit { cursor: default; }
