/* ============================================================
   survey.css — homepage "The Survey" (index.html)
   Spec: docs/superpowers/specs/2026-11-18-homepage-survey-design.md
   Brand tokens come from styles.css. Every "not reached yet" dim state
   lives under .sv-js and prefers-reduced-motion: no-preference, so
   no-JS and reduced-motion visitors always get the finished state.
   ============================================================ */

/* The rail sits 32px left of the site column (centered --max-w + --pad-x),
   never closer than 12px to the screen edge. Percentages resolve against
   .sv, so anything using --rail-x must have .sv as its containing block. */
.sv {
  position: relative;
  --rail-x: max(12px, calc((100% - min(100%, var(--max-w))) / 2 + var(--pad-x) - 32px));
}

.sv__rail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--rail-x);
  width: 0.5px;
  background: var(--gray-mid);
  z-index: 2;
  pointer-events: none;
}
.sv__rail-fill {
  position: absolute;
  inset: 0;
  left: -0.25px;
  width: 1px;
  background: var(--blaze-orange);
  transform-origin: top;
}

/* Stations sit in the site column. Not positioned on purpose: markers
   inside them are placed against .sv (see --rail-x). */
.sv-sec {
  max-width: var(--max-w);
  margin-inline: auto;
  padding: var(--sec-pad) var(--pad-x);
}

.sv-station {
  display: flex;
  font-family: var(--font-body);
  line-height: 1.4;
  margin: 0;
  align-items: center;
  gap: 14px;
  margin-bottom: 40px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.sv-station__num { color: var(--text-muted); }
.sv-station__name { color: var(--warm-white); }

/* Survey cross on the rail */
.sv-mark {
  position: absolute;
  left: var(--rail-x);
  width: 15px;
  height: 15px;
  transform: translateX(-50%);
  background: var(--pitch-black);
  z-index: 3;
}
.sv-mark::before,
.sv-mark::after {
  content: '';
  position: absolute;
  background: var(--gray-light);
  transition: background 0.4s var(--ease);
}
.sv-mark::before { left: 7px; top: 0; bottom: 0; width: 1px; }
.sv-mark::after  { top: 7px; left: 0; right: 0; height: 1px; }
.is-reached .sv-mark::before,
.is-reached .sv-mark::after { background: var(--blaze-orange); }

.sv-h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(42px, 6vw, 80px);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--warm-white);
  margin: 0;
}
.sv-h2 em { font-style: normal; color: var(--blaze-orange); }

/* ---------- Station 01 — The Problem ---------- */
.sv-problem__text {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(36px, 4.6vw, 64px);
  line-height: 1.04;
  letter-spacing: 0.02em;
  color: var(--warm-white);
  max-width: 1060px;
  margin: 0;
}
.sv-problem__text em { font-style: normal; color: var(--blaze-orange); }

/* ---------- Station 02 — The Proof ---------- */
.sv-proof__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}
.sv-stat__num {
  font-family: var(--font-display);
  font-size: clamp(64px, 8vw, 120px);
  line-height: 0.9;
  color: var(--warm-white);
  font-variant-numeric: tabular-nums;
}
.sv-stat__plus {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 72px);
  color: var(--blaze-orange);
  vertical-align: top;
}
.sv-stat p {
  margin: 16px 0 0;
  max-width: 220px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-muted);
}
.sv-proof__line {
  display: block;
  height: 1px;
  margin-top: 48px;
  background: var(--warm-white);
  transform-origin: left;
}

/* ---------- Station 03 — The Work ----------
   Default (no JS, phones, reduced motion): a horizontal swipe row.
   Pinned sideways reel only under .sv-js on wider screens (see Motion). */
.sv-work { position: relative; }
.sv-work__pin {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: var(--sec-pad) 0;
  /* content edge of the site column, measured against the full-width section */
  padding-left: calc((100% - min(100%, var(--max-w))) / 2 + var(--pad-x));
}
.sv-work__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 40px;
  padding-right: var(--pad-x);
  max-width: calc(var(--max-w) - 2 * var(--pad-x));
}
.sv-work__head .sv-station { width: 100%; margin-bottom: 0; }
.sv-work__nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
/* Arrows only once JS can drive them; without JS the row has a scrollbar. */
.sv-work__btn { display: none; }
.sv-js .sv-work__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  background: transparent;
  border: 0.5px solid var(--gray-mid);
  border-radius: 0;
  color: var(--warm-white);
  font: 400 20px/1 var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.sv-js .sv-work__btn span { transition: transform 0.2s var(--ease); }
.sv-js .sv-work__btn:hover:not(:disabled),
.sv-js .sv-work__btn:focus-visible { border-color: var(--blaze-orange); color: var(--blaze-orange); }
.sv-js .sv-work__btn--prev:hover:not(:disabled) span { transform: translateX(-3px); }
.sv-js .sv-work__btn--next:hover:not(:disabled) span { transform: translateX(3px); }
.sv-js .sv-work__btn:focus-visible { outline: 2px solid var(--blaze-orange); outline-offset: 3px; }
.sv-js .sv-work__btn:disabled { opacity: 0.3; cursor: default; }
.sv-work__count {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.sv-work__count b { color: var(--warm-white); font-weight: 500; }
.sv-work__viewport {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.sv-work__track {
  list-style: none;
  margin: 0;
  padding: 0 var(--pad-x) 4px 0;
  display: flex;
  gap: 24px;
  width: max-content;
}
.sv-card { width: min(520px, 78vw); flex: none; scroll-snap-align: start; }
.sv-card a {
  position: relative;
  display: block;
  height: 100%;
  overflow: hidden;
  padding: 16px 16px 24px;
  background: var(--surface-dark);
  border: 0.5px solid var(--gray-mid);
  color: inherit;
  text-decoration: none;
}
.sv-card a::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--blaze-orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.sv-card a:hover::before,
.sv-card a:focus-visible::before { transform: scaleX(1); }
.sv-card__img { aspect-ratio: 16 / 10; overflow: hidden; margin-bottom: 20px; background: var(--surface-darker); }
.sv-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--ease); }
.sv-card a:hover .sv-card__img img { transform: scale(1.03); }
.sv-card__type { font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--blaze-orange); }
.sv-card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--warm-white);
  margin: 8px 0 12px;
}
.sv-card__out { margin: 0; font-size: 15px; line-height: 1.6; color: rgba(245,243,238,0.72); }
.sv-card--more a {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  padding: 32px;
  background: transparent;
}
.sv-card__more { font-family: var(--font-display); font-size: clamp(56px, 6vw, 96px); line-height: 0.92; color: var(--warm-white); }
.sv-card__arrow { font-size: 48px; color: var(--text-muted); transition: color 0.2s var(--ease), transform 0.2s var(--ease); }
.sv-card--more a:hover .sv-card__arrow { color: var(--blaze-orange); transform: translate(6px, -6px); }
.sv-work__progress { display: none; height: 0.5px; margin-right: var(--pad-x); background: var(--gray-mid); }
.sv-work__progress span { display: block; height: 1px; background: var(--warm-white); transform-origin: left; transform: scaleX(var(--p, 0)); }

/* ---------- Station 04 — Pick Your Problem ----------
   Without JS the tabs are hidden and all three panels show, each under its
   own track heading. With JS it becomes an ARIA tabs widget. */
.sv-pick__grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 64px;
  align-items: start;
}
.sv-pick__tabs { display: none; flex-direction: column; }
.sv-js .sv-pick__tabs { display: flex; }
.sv-pick__tabs button {
  all: unset;
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 18px 0 18px 20px;
  border-bottom: 0.5px solid var(--gray-mid);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: clamp(36px, 4.4vw, 64px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--graphite);
  transition: color 0.3s var(--ease);
}
.sv-pick__tabs button:first-child { border-top: 0.5px solid var(--gray-mid); }
.sv-pick__tabs button span { font-family: var(--font-body); font-size: 12px; letter-spacing: 0.2em; color: inherit; }
.sv-pick__tabs button::before {
  content: '';
  position: absolute;
  left: 0; top: 18px; bottom: 18px;
  width: 2px;
  background: var(--blaze-orange);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.5s var(--ease);
}
.sv-pick__tabs button:hover { color: var(--gray-light); }
.sv-pick__tabs button[aria-selected="true"] { color: var(--warm-white); }
.sv-pick__tabs button[aria-selected="true"]::before { transform: scaleY(1); }
.sv-pick__tabs button:focus-visible { outline: 2px solid var(--blaze-orange); outline-offset: 4px; }

.sv-pick__panels { display: flex; flex-direction: column; gap: 56px; }
.sv-js .sv-pick__panels { gap: 0; }
.sv-panel__track {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--warm-white);
  margin: 0 0 16px;
}
.sv-js .sv-panel__track { display: none; }
.sv-panel__lede {
  font-family: var(--font-display);
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
  letter-spacing: 0.03em;
  color: var(--warm-white);
  margin: 0 0 28px;
}
.sv-panel__list { list-style: none; margin: 0 0 32px; padding: 0; }
.sv-panel__list li {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 18px 0;
  border-top: 0.5px solid var(--gray-mid);
}
.sv-panel__list b { font-weight: 500; color: var(--warm-white); }
.sv-panel__list span { font-size: 15px; line-height: 1.6; color: var(--text-muted); }
.sv-panel__proof {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--surface-darker);
  border: 0.5px solid var(--gray-mid);
  color: var(--warm-white);
  text-decoration: none;
  transition: border-color 0.2s var(--ease);
}
.sv-panel__proof:hover { border-color: var(--graphite); }
.sv-panel__proof img { width: 96px; height: auto; aspect-ratio: 16 / 10; object-fit: cover; }
.sv-panel__proof small {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sv-panel__proof span::after { content: ' →'; }

/* ---------- Station 05 — The Route ---------- */
.sv-route .sv-h2 { margin-bottom: 64px; }
.sv-route__line { display: block; width: 100%; height: 120px; overflow: visible; }
.sv-route__line path {
  fill: none;
  stroke: var(--blaze-orange);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.sv-route__stops {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}
.sv-route__when {
  display: block;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blaze-orange);
}
.sv-route__stops b {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  letter-spacing: 0.04em;
  color: var(--warm-white);
}
.sv-route__stops p { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: var(--text-muted); }

/* ---------- Motion (only with JS, only when motion is welcome) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .sv-js .sv__rail-fill { transform: scaleY(var(--rail, 0)); }
  .sv-js .is-reached .sv-mark { animation: svMark 0.8s var(--ease); }
  .sv-js .sv-problem__text .w { color: var(--gray-mid); transition: color 0.5s var(--ease); }
  .sv-js .sv-problem__text .w.on { color: var(--warm-white); }
  .sv-js .sv-problem__text em .w.on { color: var(--blaze-orange); }
  .sv-js .sv-proof__line { transform: scaleX(var(--p, 0)); }
  .sv-js .sv-panel { animation: svPanel 0.6s var(--ease); }
  .sv-js .sv-route__line path { stroke-dashoffset: calc(1 - var(--p, 0)); }
  .sv-js .sv-route__stops li { opacity: 0.25; transform: translateY(8px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
  .sv-js .sv-route__stops li.on { opacity: 1; transform: none; }
}
@keyframes svPanel {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
@keyframes svMark {
  from { transform: translateX(-50%) rotate(-90deg) scale(0.4); }
  to   { transform: translateX(-50%) rotate(0) scale(1); }
}

/* Pinned sideways reel: JS on, motion welcome, wider than a phone and tall
   enough (720px) that the card outcome lines fit. Must match survey.js. */
@media (prefers-reduced-motion: no-preference) and (min-width: 861px) and (min-height: 720px) {
  .sv-js .sv-work { height: calc(var(--n) * 55vh + 100vh); }
  .sv-js .sv-work__pin {
    position: sticky;
    top: var(--nav-h);
    height: calc(100vh - var(--nav-h));
    justify-content: center;
    padding-block: 0;
    overflow: hidden;
  }
  .sv-js .sv-work__viewport { overflow: hidden; scroll-snap-type: none; }
  .sv-js .sv-work__track { transform: translateX(calc(var(--x, 0) * -1px)); will-change: transform; }
  .sv-js .sv-work__progress { display: block; }
}

/* ---------- Phones ---------- */
@media (max-width: 860px) {
  .sv-sec { padding-left: calc(var(--pad-x) + 16px); }
  .sv-work__pin { padding-left: calc(var(--pad-x) + 16px); }
  .sv-proof__grid { grid-template-columns: 1fr 1fr; }
  .sv-pick__grid { grid-template-columns: 1fr; gap: 32px; }
  .sv-panel__list li { grid-template-columns: 1fr; gap: 4px; }
  .sv-route__stops { grid-template-columns: 1fr 1fr; }
}
