/* ============================================================
   girvi explained — same family as girvi: off-black + electric
   violet, the hallmark-punched 85/80/75 LTV staircase as THE
   motif. All animation is CSS-only, triggered by a .inview
   class from an IntersectionObserver; every element's DEFAULT
   state is its final, legible state — so no-JS and
   prefers-reduced-motion both read perfectly.
   ============================================================ */

:root {
  --bg:        #0E0D12;
  --card:      #17151F;
  --card2:     #1E1B2A;
  --line:      #2E2A3F;
  --text:      #EFEDF6;
  --muted:     #ABA5C3;
  --accent:    #9B82FF;   /* AA on --bg (≈6.3:1) */
  --accent-ink:#0E0D12;
  --warn:      #FFB65C;
  --warn-ink:  #2A1D05;
  --ok:        #7FD8A5;
  --danger:    #FF8FA3;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 14px;
  --radius-sm: 8px;
  --wrap: 1040px;
  --shadow: 0 20px 48px -28px rgba(0, 0, 0, 0.75);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="light"] {
  --bg:     #EFEDF6;
  --card:   #FFFFFF;
  --card2:  #F5F3FB;
  --line:   #D6D2E6;
  --text:   #17151F;
  --muted:  #514B66;
  --accent: #5936D9;      /* AA on light paper (≈6.1:1) */
  --accent-ink: #FFFFFF;
  --warn:   #8A5A00;
  --warn-ink: #FFFFFF;
  --ok:     #1B6E43;
  --danger: #B4243F;
  --shadow: 0 20px 44px -30px rgba(35, 25, 80, 0.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 750; letter-spacing: -0.02em; line-height: 1.12; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--card2); padding: 2px 6px; border-radius: 5px; }
output { font-variant-numeric: tabular-nums; }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 14px; top: -64px; z-index: 60;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 10px;
  font-weight: 700; text-decoration: none;
  transition: top 0.15s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: 15px;
  padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card); color: var(--text);
  cursor: pointer; text-decoration: none;
  transition: transform 0.12s var(--ease), background 0.12s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; }
.btn--big { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-size: 18px; padding: 14px 28px; border-radius: 12px; }

/* ---------- hero ---------- */

.hero {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    var(--bg);
}
.topbar {
  max-width: var(--wrap); margin: 0 auto;
  padding: 18px 20px 0;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.topbar__actions { display: inline-flex; gap: 10px; align-items: center; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 20px; letter-spacing: -0.02em;
}
.brand__mark { width: 26px; height: 26px; color: var(--accent); }
.brand__x { font-weight: 550; color: var(--muted); }

.hero__inner {
  max-width: var(--wrap); margin: 0 auto;
  padding: 48px 20px 56px;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 44px; align-items: center;
}
.eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
.hero h1 { margin-top: 12px; font-size: clamp(26px, 4.2vw, 40px); max-width: 24ch; }
.lede { margin-top: 18px; color: var(--muted); font-size: 17px; max-width: 56ch; }
.lede strong, .lede em { color: var(--text); font-style: normal; }
.hero__cta { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero__fig { margin: 0; }

/* the staircase SVG */
.stairsvg { width: 100%; height: auto; display: block; }
.stair__block { fill: var(--accent); }
.punch { fill: var(--bg); opacity: 0.85; }
.stair__pct {
  fill: var(--accent-ink); font-family: var(--sans); font-weight: 800;
  font-size: 34px; text-anchor: middle; font-variant-numeric: tabular-nums;
}
.stair__band {
  fill: var(--accent-ink); font-family: var(--sans); font-weight: 650;
  font-size: 16px; text-anchor: middle; opacity: 0.85;
}
.stair__caption { fill: var(--muted); font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: 0.04em; }

/* staircase entrance: steps rise from the floor */
.stair { transform-origin: center 280px; }
.scene.inview .stair { animation: stairRise 0.7s var(--ease) both; }
.scene.inview .stair--2 { animation-delay: 0.18s; }
.scene.inview .stair--3 { animation-delay: 0.36s; }
@keyframes stairRise {
  from { transform: translateY(40px) scaleY(0.02); opacity: 0; }
  60%  { opacity: 1; }
  to   { transform: none; opacity: 1; }
}

/* ---------- chapters ---------- */

main { display: block; }
.chapter {
  max-width: var(--wrap); margin: 0 auto;
  padding: 64px 20px 8px;
}
.chapnum {
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  letter-spacing: 0.22em; color: var(--accent);
}
.chapter h2 { margin-top: 8px; font-size: clamp(22px, 3.2vw, 32px); max-width: 30ch; }
.chapter__lede { margin-top: 14px; color: var(--muted); max-width: 68ch; font-size: 16.5px; }
.chapter__lede strong, .chapter__lede em { color: var(--text); font-style: normal; }
.chapter__note {
  margin-top: 18px; padding: 14px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--muted); max-width: 74ch; font-size: 15px;
}
.chapter__note strong { color: var(--text); }

/* generic entrance animations (defaults are the FINAL state) */
.scene.inview .anim-slide-l { animation: slideL 0.6s var(--ease) both; }
.scene.inview .anim-slide-r { animation: slideR 0.6s var(--ease) 0.15s both; }
.scene.inview .anim-pop { animation: pop 0.55s var(--ease) both; }
.scene.inview .anim-pop:nth-child(2) { animation-delay: 0.12s; }
.scene.inview .anim-pop:nth-child(3) { animation-delay: 0.24s; }
.scene.inview .anim-pop:nth-child(4) { animation-delay: 0.36s; }
.scene.inview .anim-pop:nth-child(5) { animation-delay: 0.48s; }
.scene.inview .anim-pop:nth-child(6) { animation-delay: 0.6s; }
@keyframes slideL { from { transform: translateX(-28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideR { from { transform: translateX(28px);  opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop    { from { transform: translateY(18px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 01 versus ---------- */

.versus {
  margin-top: 26px;
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 18px; align-items: stretch;
}
.versus__card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.versus__card--law { border-color: var(--accent); }
.versus__tag {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
}
.versus__card--law .versus__tag { color: var(--accent); }
.versus__big { margin-top: 10px; font-size: clamp(20px, 2.6vw, 27px); font-weight: 800; letter-spacing: -0.02em; }
.versus__big span { display: block; font-size: 14px; font-weight: 650; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.versus__note { margin-top: 12px; color: var(--muted); font-size: 15px; }
.versus__note strong { color: var(--text); }
.versus__vs {
  align-self: center; font-weight: 800; color: var(--muted);
  font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase;
}

/* ---------- 02 tier list ---------- */

.tierlist { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 12px; max-width: 660px; }
.tierlist__item {
  display: flex; gap: 16px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 14px 18px;
}
.tierlist__item span:last-child { color: var(--muted); }
.tierlist__item strong { color: var(--text); }
.tierchip {
  flex: none; display: inline-grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-variant-numeric: tabular-nums;
  border-radius: 8px; padding: 8px 0; text-align: center;
}
.tierchip--1 { width: 84px; }
.tierchip--2 { width: 72px; }
.tierchip--3 { width: 60px; }

/* ---------- 03 curve + demo ---------- */

.curvefig {
  margin: 30px 0 0; padding: 22px 18px 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-x: auto;
}
.curvesvg { width: 100%; min-width: 480px; height: auto; display: block; }
.curve__axis { stroke: var(--line); stroke-width: 2; }
.curve__band { fill: var(--warn); opacity: 0.28; }
.curve__line {
  fill: none; stroke: var(--accent); stroke-width: 4;
  stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 0; /* default: fully drawn */
}
.scene.inview .curve__line { animation: drawline 1.6s var(--ease) both; }
@keyframes drawline { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
.curve__lab { fill: var(--muted); font-family: var(--sans); font-size: 14px; font-weight: 600; }
.curve__lab--p { fill: var(--warn); font-weight: 750; }
[data-theme="light"] .curve__lab--p { fill: var(--warn); }
.curve__lab--y { font-size: 13px; }
.curve__marker circle { fill: var(--accent); stroke: var(--bg); stroke-width: 3; }
.curve__marker line { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 4; }
.curvefig__cap { margin-top: 10px; color: var(--muted); font-size: 14px; }

.demo {
  margin-top: 22px; padding: 22px;
  background: var(--card2); border: 1px solid var(--line);
  border-radius: var(--radius);
}
.demo h3 { font-size: 18px; }
.demo__row { margin-top: 16px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.demo__label { font-weight: 700; font-size: 15px; }
#demoValue { flex: 1 1 260px; accent-color: var(--accent); height: 28px; }
.demo__out { margin-top: 10px; }
.demo__figure { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; font-size: 16px; }
.demo__k { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.demo__figure output { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
#demoC { color: var(--accent); }
.demo__arrow { color: var(--muted); }
.demo__tier {
  align-self: center; background: var(--accent); color: var(--accent-ink);
  font-weight: 750; font-size: 13px; border-radius: 999px; padding: 3px 12px;
}
.demo__plateau {
  margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--warn); color: var(--warn-ink); font-weight: 650; font-size: 14.5px;
  max-width: 66ch;
}
.demo__note { margin-top: 14px; color: var(--muted); font-size: 14px; max-width: 74ch; }

/* ---------- 04 bars ---------- */

.bars {
  margin-top: 30px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px; max-width: 720px;
}
.bars__col { display: flex; flex-direction: column; }
.bar {
  display: flex; flex-direction: column; justify-content: flex-end;
  height: 250px; border-radius: 10px 10px 4px 4px; overflow: hidden;
  border: 1px solid var(--line); background: var(--card);
}
.bar--emi { height: 238px; margin-top: 12px; } /* 213237.12 / 224000 × 250 */
.bar__seg { display: grid; place-items: center; }
.bar__seg span {
  font-size: 13.5px; font-weight: 750; padding: 2px 8px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.bar__seg--prin { background: var(--accent); color: var(--accent-ink); }
.bar__seg--int {
  background: repeating-linear-gradient(-45deg, var(--warn) 0 8px, transparent 8px 14px), var(--card2);
  color: var(--text);
  border-bottom: 2px solid var(--warn);
}
.bar__seg--bprin { height: 223px; }
.bar__seg--bint  { height: 27px; }  /* 24000 / 224000 × 250 */
.bar__seg--eprin { height: 223px; }
.bar__seg--eint  { height: 15px; }  /* 13237 / 224000 × 250 */
.bar__seg--eint span { font-size: 11.5px; }
.scene.inview .bar__seg { animation: barGrow 0.9s var(--ease) both; transform-origin: bottom; }
.scene.inview .bar--emi .bar__seg { animation-delay: 0.25s; }
@keyframes barGrow { from { transform: scaleY(0); } to { transform: none; } }
.bar__total { margin-top: 10px; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.bar__name { margin-top: 4px; font-weight: 700; font-size: 15px; }
.bar__name span { font-weight: 500; color: var(--muted); font-size: 13.5px; }

/* ---------- 05 meter ---------- */

.meterfig {
  margin: 30px 0 0; padding: 22px 18px 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow-x: auto;
}
.metersvg { width: 100%; min-width: 480px; height: auto; display: block; }
.meter__track { fill: var(--card2); stroke: var(--line); }
.meter__fill { fill: var(--accent); transform-origin: 12px 46px; }
.scene.inview .meter__fill { animation: meterFill 1.2s var(--ease) 0.2s both; }
@keyframes meterFill { from { transform: scaleX(0); } to { transform: none; } }
.meter__mark line { stroke: var(--danger); stroke-width: 3; }
.meter__mark text { fill: var(--danger); font-family: var(--sans); font-size: 15px; font-weight: 750; }
[data-theme="light"] .meter__mark line { stroke: var(--danger); }
.meter__lab { fill: var(--muted); font-family: var(--sans); font-size: 13px; font-weight: 600; }
.meter__lab--end { text-anchor: end; }
.meterfig__cap { margin-top: 12px; color: var(--muted); font-size: 14.5px; max-width: 78ch; }

/* ---------- 06 privacy ---------- */

.chapter--priv .chapter__lede code { color: var(--text); }
.privline {
  margin-top: 30px;
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 0;
  align-items: center; max-width: 860px;
}
.priv__node {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 18px; font-weight: 750; font-size: 15px; text-align: center;
}
.priv__node span { display: block; font-weight: 500; color: var(--muted); font-size: 13px; margin-top: 2px; }
.priv__node--dim { opacity: 0.55; border-style: dashed; margin-left: 18px; }
.priv__wire {
  position: relative; height: 4px; margin: 0 6px;
  background: repeating-linear-gradient(90deg, var(--line) 0 10px, transparent 10px 18px);
  border-radius: 2px; min-width: 90px;
}
.priv__packet {
  position: absolute; right: -4px; top: 50%;
  transform: translateY(-50%);
  background: var(--accent); color: var(--accent-ink);
  font-size: 12.5px; font-weight: 750; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
}
.scene.inview .priv__packet { animation: packet 3.2s var(--ease) infinite; }
@keyframes packet {
  0%   { right: 96%; opacity: 0; }
  12%  { opacity: 1; }
  55%  { right: -4px; opacity: 1; }
  63%  { right: -4px; transform: translateY(-50%) translateX(6px); }
  70%  { right: -4px; transform: translateY(-50%); }
  86%  { right: -4px; opacity: 1; }
  100% { right: -4px; opacity: 1; }
}
.priv__shield {
  position: relative;
  background: var(--card2); border: 2px solid var(--accent);
  border-radius: var(--radius-sm); padding: 14px 18px;
  font-weight: 800; font-size: 15px; text-align: center;
  font-family: var(--mono);
}
.priv__shield span:last-child { display: block; font-weight: 700; color: var(--accent); font-size: 12.5px; margin-top: 2px; }
.priv__x {
  position: absolute; left: -13px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--danger); color: var(--bg);
  font-size: 15px; font-weight: 900; font-family: var(--sans);
}
[data-theme="light"] .priv__x { color: #FFFFFF; }
.scene.inview .priv__x { animation: xflash 3.2s var(--ease) infinite; }
@keyframes xflash {
  0%, 50% { transform: translateY(-50%) scale(1); }
  60%     { transform: translateY(-50%) scale(1.35); }
  72%, 100% { transform: translateY(-50%) scale(1); }
}
.privlist { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; max-width: 74ch; }
.privlist li {
  padding: 14px 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--muted); font-size: 15px;
}
.privlist strong { color: var(--text); }

/* ---------- 07 tour ---------- */

.tour {
  margin-top: 28px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.tour__card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.tour__n {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.tour__card h3 { margin-top: 12px; font-size: 17px; }
.tour__card p:last-child { margin-top: 8px; color: var(--muted); font-size: 14.5px; }
.tour__card em { font-style: normal; font-weight: 700; color: var(--text); }

/* ---------- CTA band ---------- */

.ctaband {
  max-width: var(--wrap); margin: 72px auto 0; padding: 48px 24px 52px;
  text-align: center;
  background:
    radial-gradient(600px 300px at 50% -20%, rgba(124, 92, 255, 0.2), transparent 65%),
    var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ctaband__mark { width: 58px; height: 58px; }
.ctaband__steps rect { fill: var(--accent); }
.ctaband h2 { margin-top: 14px; font-size: clamp(22px, 3vw, 30px); }
.ctaband > p { margin-top: 10px; color: var(--muted); }
.ctaband__btnrow { margin-top: 24px; }
.scene.inview .ctaband__steps rect { animation: stairRise 0.6s var(--ease) both; transform-origin: center 60px; }
.scene.inview .ctaband__steps rect:nth-child(2) { animation-delay: 0.14s; }
.scene.inview .ctaband__steps rect:nth-child(3) { animation-delay: 0.28s; }

/* ---------- footer ---------- */

.foot { margin-top: 72px; border-top: 1px solid var(--line); background: var(--card); }
.foot__inner { max-width: var(--wrap); margin: 0 auto; padding: 40px 20px 48px; }
.foot__h { font-size: 18px; }
.foot__sources { margin: 16px 0 0; padding: 0 0 0 18px; display: grid; gap: 10px; color: var(--muted); font-size: 14.5px; max-width: 90ch; }
.foot__sources strong { color: var(--text); }
.foot__disclaimer {
  margin-top: 18px; padding: 14px 18px;
  background: var(--card2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; max-width: 90ch;
}
.foot__disclaimer strong { color: var(--text); }
.foot__meta {
  margin-top: 22px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--muted); font-size: 14px;
}

/* ---------- responsive ---------- */

@media (max-width: 880px) {
  .hero__inner { grid-template-columns: 1fr; gap: 30px; }
  .tour { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .versus { grid-template-columns: 1fr; }
  .versus__vs { justify-self: center; }
  .bars { grid-template-columns: 1fr; }
  .tour { grid-template-columns: 1fr; }
  .privline { grid-template-columns: 1fr; gap: 14px; justify-items: center; }
  .priv__wire { width: 4px; min-width: 0; height: 70px; margin: 0;
    background: repeating-linear-gradient(180deg, var(--line) 0 10px, transparent 10px 18px); }
  .priv__packet { right: auto; left: 50%; top: auto; bottom: -4px; transform: translateX(-50%); }
  .scene.inview .priv__packet { animation: packetV 3.2s var(--ease) infinite; }
  .priv__node--dim { margin-left: 0; }
}
@keyframes packetV {
  0%   { bottom: 92%; opacity: 0; }
  12%  { opacity: 1; }
  55%  { bottom: -4px; opacity: 1; }
  100% { bottom: -4px; opacity: 1; }
}

/* ---------- print ---------- */

@media print {
  .topbar__actions, .skip-link { display: none; }
  body { background: #FFFFFF; color: #000000; }
  .chapter, .ctaband, .foot__inner { padding-top: 18px; }
  .ctaband, .versus__card, .curvefig, .meterfig, .tour__card, .demo { box-shadow: none; }
  a { color: #000000; }
}
