/* ==========================================================================
   The guided flow and the answer page.

   One idea carries the whole look: the fork. Two futures separating. It runs
   behind every screen as a live backdrop, it is the progress bar, it is the
   accent gradient, and on the answer page it becomes the hero itself.
   ========================================================================== */

.view { display: none; }
body[data-mode='wizard'] #wizard,
body[data-mode='story']  #story,
body[data-mode='detail'] #detail { display: block; }

body[data-mode='wizard'] .only-answer { display: none; }

/* ───────────────────────────── the living backdrop ───────────────────────── */

.bd {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Anchored bottom-right and masked into the corner, so the curves read as a
   watermark of your own data rather than a diagonal slash across the page. */
.bd__svg {
  position: absolute;
  right: -5%;
  bottom: -9%;
  width: 76%;
  height: 78%;
  opacity: 0;
  transition: opacity 1.1s var(--ease);
  -webkit-mask-image: radial-gradient(125% 125% at 100% 100%, #000 30%, transparent 76%);
  mask-image: radial-gradient(125% 125% at 100% 100%, #000 30%, transparent 76%);
}

@media (max-width: 760px) {
  .bd__svg { width: 118%; height: 58%; right: -9%; }
}
.bd__svg.is-drawn { opacity: 1; }

.bd__glow { opacity: 0.34; }

/* Quiet behind the questions, present behind the answer, gone behind the data. */
body[data-mode='wizard'] .bd { opacity: 0.5; }
body[data-mode='story']  .bd { opacity: 0.8; }
body[data-mode='detail'] .bd { opacity: 0; }
.bd { transition: opacity 0.7s var(--ease); }

/* Tooth on the paper. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: var(--grain);
  opacity: var(--grain-opacity);
  mix-blend-mode: multiply;
}
:root[data-theme='dark'] .grain { mix-blend-mode: overlay; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme='light'])) .grain { mix-blend-mode: overlay; }
}

.app { position: relative; z-index: 2; }

/* ─────────────────────────────── shared bits ─────────────────────────────── */

.btn--lg {
  height: 48px;
  padding: 0 22px;
  font-size: 14.5px;
  font-weight: 600;
  border-radius: 12px;
  letter-spacing: -0.01em;
}

.btn--primary {
  box-shadow: var(--lift-1), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn--primary:hover { box-shadow: var(--lift-2), inset 0 1px 0 rgba(255, 255, 255, 0.22); }

.control--bare { height: 34px; width: 82px; border-radius: var(--r-sm); }
.control--bare .control__input { font-size: 13px; padding: 0 8px; }
.control--bare select.control__input { background-position: calc(100% - 13px) 15px, calc(100% - 8px) 15px; }

/* ─────────────────────────────── the wizard ─────────────────────────────── */

.wizard {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(26px, 5vw, 56px) 20px 80px;
}

/* The progress bar is the fork: a single gradient track that fills left to right. */
.wizard__progress {
  position: relative;
  display: flex;
  gap: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  margin-bottom: clamp(30px, 5vw, 46px);
}

.wizard__tick {
  flex: 1;
  height: 100%;
  padding: 0;
  background: transparent;
  border: none;
  position: relative;
  z-index: 1;
}
.wizard__tick:disabled { cursor: default; }

.wizard__progress::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress, 25%);
  background: var(--fork);
  background-size: 400% 100%;
  background-position: left center;
  border-radius: 2px;
  transition: width 0.5s var(--spring);
}

/* A huge ghost numeral anchors each step without shouting. */
.wizard__step {
  position: relative;
  animation: step-in 0.5s var(--ease) both;
}

.wizard__ghost {
  position: absolute;
  top: -0.14em;
  right: -0.03em;
  font-size: clamp(110px, 19vw, 180px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--text-primary);
  opacity: 0.05;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.wizard__step > *:not(.wizard__ghost) { position: relative; z-index: 1; }

@keyframes step-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.wizard__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.wizard__eyebrow::before {
  content: '';
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: var(--fork);
}

.wizard__title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 640;
  letter-spacing: -0.035em;
  line-height: 1.06;
  margin-bottom: 14px;
  text-wrap: balance;
}

.wizard__lede {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 48ch;
}

.wizard__body { margin-top: clamp(24px, 3.5vw, 34px); }
.wizard__fields { display: flex; flex-direction: column; gap: 24px; }

.wizard__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-3);
  margin-top: 34px;
}

.wizard__skip {
  display: block;
  margin: 26px auto 0;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 1px;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.wizard__skip:hover { color: var(--text-primary); border-color: var(--text-primary); }

.wizard__preview {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  border: 1px solid var(--border);
  box-shadow: var(--lift-1), var(--edge);
}

/* ── large field variant ─────────────────────────────────────────────────── */

.field--lg .field__head { margin-bottom: 9px; }
.field--lg .field__label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text-primary);
}
.field--lg .field__derived { font-size: 12.5px; }

.field--lg .control {
  height: 56px;
  border-radius: 14px;
  background: var(--surface-1);
  box-shadow: var(--lift-1), var(--edge);
  border-color: transparent;
}
.field--lg .control:focus-within {
  background: var(--surface-raised);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), var(--lift-2);
}
.field--lg .control__input {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding: 0 14px;
}
.field--lg .control__prefix,
.field--lg .control__suffix {
  font-size: 16px;
  padding: 0 16px;
  color: var(--text-muted);
}
.field--lg .control__prefix { padding-right: 0; }
.field--lg .control__suffix { padding-left: 0; }
.field--lg select.control__input { background-position: calc(100% - 18px) 26px, calc(100% - 12px) 26px; }

.slider-wrap { margin-top: 10px; }
.slider-wrap .slider { margin: 0; }

.slider-scale {
  position: relative;
  display: flex;
  justify-content: space-between;
  height: 17px;
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.slider-scale__typical {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  color: var(--text-secondary);
  white-space: nowrap;
}
.slider-scale__typical::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -7px;
  width: 1px;
  height: 5px;
  background: var(--border-strong);
}

/* ── choice cards ────────────────────────────────────────────────────────── */

.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-3);
  margin-bottom: 28px;
}
@media (max-width: 520px) { .choice { grid-template-columns: 1fr; } }

.choice__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 20px 18px;
  text-align: left;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  background: var(--surface-1);
  box-shadow: var(--lift-1), var(--edge);
  overflow: hidden;
  transition: transform 0.2s var(--spring), box-shadow 0.2s var(--ease);
}
.choice__card::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--fork);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.32s var(--ease);
}
.choice__card:hover { transform: translateY(-2px); box-shadow: var(--lift-2), var(--edge); }
.choice__card[aria-checked='true'] {
  border-color: var(--accent);
  box-shadow: var(--lift-2), 0 0 0 3px var(--accent-ring);
}
.choice__card[aria-checked='true']::after { transform: scaleX(1); }

.choice__icon { font-size: 24px; line-height: 1.2; margin-bottom: 6px; }
.choice__title { font-size: 15px; font-weight: 650; letter-spacing: -0.015em; }
.choice__sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }

/* ── the live feedback card ──────────────────────────────────────────────── */

.hint {
  position: relative;
  margin-top: 24px;
  padding: 20px 22px 20px 26px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: var(--lift-1), var(--edge);
  overflow: hidden;
}
.hint::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--fork-v);
}
.hint[data-tone='warn']::before { background: var(--warning); }
.hint[data-tone='good']::before { background: var(--good); }

.hint__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 38px;
  margin-bottom: 13px;
}

.hint__stat { display: flex; flex-direction: column; gap: 2px; }

.hint__value {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.hint__label {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.hint__text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ─────────────────────────────── the answer ─────────────────────────────── */

.story {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(26px, 5vw, 56px) 20px 100px;
}

/* No card. The verdict sits directly on the canvas, on top of its own data. */
.answer {
  position: relative;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
  padding-bottom: clamp(28px, 4vw, 40px);
  animation: step-in 0.55s var(--ease) both;
}
.answer[data-verdict='buy']   { --verdict-accent: var(--series-1); }
.answer[data-verdict='rent']  { --verdict-accent: var(--series-2); }
.answer[data-verdict='close'] { --verdict-accent: var(--text-secondary); }

.answer__eyebrow {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.answer__headline {
  margin-bottom: 4px;
  text-wrap: balance;
  color: var(--text-primary);
}

/* The hero figure. The winner's hue, optical tracking, tabular off so the
   proportional digits sit tight at display size. */
.answer__figure {
  font-size: clamp(58px, 14vw, 128px);
  font-weight: 680;
  letter-spacing: -0.055em;
  line-height: 0.92;
  margin: 4px 0 20px;
  color: var(--verdict-accent);
  font-variant-numeric: proportional-nums;
}

.answer__sub {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 56ch;
}

/* Two futures, as ledger columns divided by hairline rules — no boxes. */
.answer__scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 34px;
  border-top: 1px solid var(--rule);
}

.answer__scores .score {
  display: block;
  padding: 20px 22px 20px 0;
  border-left: 1px solid var(--rule);
  padding-left: 22px;
}
.answer__scores .score:first-child { border-left: none; padding-left: 0; }
.answer__scores .score__key { display: none; }
.answer__scores .score__label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.answer__scores .score__label::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--score-color, var(--chart-axis));
  flex: none;
}
.answer__scores .score__value {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 640;
  letter-spacing: -0.03em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.answer__scores .score--win .score__value { color: var(--text-primary); }

.story .notices { margin-top: var(--gap-5); }

/* ── the reading blocks ──────────────────────────────────────────────────── */

.block {
  margin-top: clamp(48px, 7vw, 76px);
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}

.block__title {
  font-size: clamp(21px, 2.8vw, 26px);
  font-weight: 640;
  letter-spacing: -0.028em;
  margin-bottom: 7px;
}

.block__sub {
  font-size: 14.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 22px;
  max-width: 56ch;
}

.block__caption {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 16px;
  padding-left: 14px;
  border-left: 2px solid var(--verdict-accent, var(--border-strong));
}

/* The chart on the answer page is the evidence — it sits flat, framed only by
   a hairline, like a plate in a report. */
.block--chart .chart {
  padding: 24px 22px 18px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: var(--edge);
}

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .wizard__step, .answer { animation: none; }
  .bd__svg { transition: none; }
}

/* ── why: the ranked reasons, as a ruled ledger list ─────────────────────── */

.reasons { border-top: 1px solid var(--rule); }

.reason {
  position: relative;
  display: grid;
  grid-template-columns: 2.4ch 1fr;
  gap: 4px 22px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--rule);
}

.reason__rank {
  grid-row: span 2;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 400;
  line-height: 0.9;
  color: var(--text-primary);
  opacity: 0.28;
  font-variant-numeric: lining-nums;
}

.reason__label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.014em;
  flex-wrap: wrap;
}

.reason__key {
  align-self: center;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: none;
}

.reason__side {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.reason__text {
  grid-column: 2;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 64ch;
}

/* ── what would flip it — the same ruled list, quieter ───────────────────── */

.flips { border-top: 1px solid var(--rule); }

.flip {
  display: grid;
  grid-template-columns: 2.4ch 1fr;
  gap: 22px;
  align-items: baseline;
  padding: 18px 4px;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.flip__index {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-primary);
  opacity: 0.28;
}

.flip__body { display: block; }

.flip__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: 1px;
}

/* ── the assumption chips ────────────────────────────────────────────────── */

.assumption-chips { display: flex; flex-wrap: wrap; gap: var(--gap-2); }

.assumption-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  transition: transform 0.18s var(--spring), border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.assumption-chip:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }

.assumption-chip__label { font-size: 11.5px; color: var(--text-muted); }
.assumption-chip__value {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}

/* ── the way out ─────────────────────────────────────────────────────────── */

.answer-cta {
  position: relative;
  margin-top: clamp(48px, 7vw, 80px);
  padding: 40px 30px 8px;
  border-top: 1px solid var(--rule);
  text-align: center;
}

.answer-cta__note {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 14px;
}

.story .caveat { margin-top: 44px; }

/* ─────────────────────────────── detail view ─────────────────────────────── */

.detail-bar {
  display: flex;
  align-items: center;
  gap: var(--gap-3);
  padding: var(--gap-3) var(--gap-5) 0;
  max-width: 1680px;
  margin: 0 auto;
}

.detail-bar__note { font-size: 12.5px; color: var(--text-muted); }
@media (max-width: 620px) { .detail-bar__note { display: none; } }
