/* AlgoCompass website. Tokens follow the app's DESIGN.md (v1.2 Light and Dark): the same ground,
   ink and one restrained indigo accent. Motion only moves transform and opacity. */

@font-face {
  font-family: "Geist";
  src: url("fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("fonts/chakra-petch-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
/* Metric-matched fallbacks keep the swap from shifting the layout. */
@font-face {
  font-family: "Geist Fallback";
  src: local("Segoe UI"), local("Arial");
  size-adjust: 104%;
  ascent-override: 92%;
  descent-override: 24%;
}
@font-face {
  font-family: "Chakra Fallback";
  src: local("Segoe UI Semibold"), local("Arial");
  size-adjust: 97%;
  ascent-override: 98%;
  descent-override: 26%;
}

:root,
[data-theme="dark"] {
  --bg: #0a0a0c;
  --bg-raised: #131316;
  --bg-sunken: #060607;
  --card: rgba(23, 23, 27, 0.62);
  --card-solid: #131316;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #8b8b94;
  --accent: #8b9bff;
  --accent-2: #b4beff;
  --accent-ink: #0a0a0c;
  --accent-soft: color-mix(in oklab, var(--accent) 14%, transparent);
  --accent-line: color-mix(in oklab, var(--accent) 45%, transparent);
  --accent-glow: color-mix(in oklab, var(--accent) 50%, transparent);
  --success: #6ee7a8;
  --lc: #ffa116;
  --ember: #ff8a3d;
  --nebula: #1d2350;
  --rank-newbie: #a4acbd;
  --rank-pupil: #4cdb84;
  --rank-specialist: #27d5c7;
  --rank-expert: #6b95ff;
  --rank-cm: #bc7dff;
  --rank-master: #ff9b3d;
  --rank-gm: #ff5f6d;
  --shot-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 40px 120px -40px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --slab: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 12px 32px -16px rgba(0, 0, 0, 0.8);
  --glow-a: 0.34;
  --glow-b: 0.22;
  --glow-c: 0.5;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f6f6f7; --bg-raised: #ffffff; --bg-sunken: #ececef; --card: rgba(255, 255, 255, 0.78); --card-solid: #ffffff;
    --line: rgba(17, 17, 20, 0.09); --line-strong: rgba(17, 17, 20, 0.17);
    --ink: #111114; --muted: #4f4f58; --faint: #63636c;
    --accent: #3a4bd0; --accent-2: #4654cc; --accent-ink: #ffffff;
    --accent-soft: color-mix(in oklab, var(--accent) 10%, transparent);
    --accent-line: color-mix(in oklab, var(--accent) 38%, transparent);
    --accent-glow: color-mix(in oklab, var(--accent) 28%, transparent);
    --success: #13703a; --lc: #a34a07; --ember: #e2560b; --nebula: #c7ccf5;
    --rank-newbie: #5f6675; --rank-pupil: #127a3a; --rank-specialist: #0b7268; --rank-expert: #2a55cf; --rank-cm: #8336d0; --rank-master: #a64a00; --rank-gm: #c41f30;
    --shot-shadow: 0 0 0 1px rgba(17, 17, 26, 0.1), 0 2px 4px rgba(17, 17, 26, 0.04), 0 40px 100px -40px rgba(30, 36, 90, 0.35);
    --slab: 0 1px 2px rgba(17, 17, 26, 0.05), 0 10px 28px -16px rgba(17, 17, 26, 0.16);
    --glow-a: 0.2; --glow-b: 0.14; --glow-c: 0.7;
    color-scheme: light;
  }
}
[data-theme="light"] {
  --bg: #f6f6f7; --bg-raised: #ffffff; --bg-sunken: #ececef; --card: rgba(255, 255, 255, 0.78); --card-solid: #ffffff;
  --line: rgba(17, 17, 20, 0.09); --line-strong: rgba(17, 17, 20, 0.17);
  --ink: #111114; --muted: #4f4f58; --faint: #63636c;
  --accent: #3a4bd0; --accent-2: #4654cc; --accent-ink: #ffffff;
  --accent-soft: color-mix(in oklab, var(--accent) 10%, transparent);
  --accent-line: color-mix(in oklab, var(--accent) 38%, transparent);
  --accent-glow: color-mix(in oklab, var(--accent) 28%, transparent);
  --success: #13703a; --lc: #a34a07; --ember: #e2560b; --nebula: #c7ccf5;
  --rank-newbie: #5f6675; --rank-pupil: #127a3a; --rank-specialist: #0b7268; --rank-expert: #2a55cf; --rank-cm: #8336d0; --rank-master: #a64a00; --rank-gm: #c41f30;
  --shot-shadow: 0 0 0 1px rgba(17, 17, 26, 0.1), 0 2px 4px rgba(17, 17, 26, 0.04), 0 40px 100px -40px rgba(30, 36, 90, 0.35);
  --slab: 0 1px 2px rgba(17, 17, 26, 0.05), 0 10px 28px -16px rgba(17, 17, 26, 0.16);
  --glow-a: 0.2; --glow-b: 0.14; --glow-c: 0.7;
  color-scheme: light;
}

:root {
  --font-body: "Geist", "Geist Fallback", system-ui, sans-serif;
  --font-display: "Chakra Petch", "Chakra Fallback", "Geist", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-move: cubic-bezier(0.65, 0, 0.35, 1);
  --nav-h: 64px;
  --gutter: clamp(20px, 4vw, 40px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
b { font-weight: 600; color: var(--ink); }
::selection { background: color-mix(in oklab, var(--accent) 35%, transparent); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* Type */
.h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 1.35rem + 2.6vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  max-width: 18ch;
  text-wrap: balance;
}
.h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.15;
  letter-spacing: -0.005em;
}
.lead {
  margin-top: 16px;
  max-width: 56ch;
  color: var(--muted);
  font-size: 1.125rem;
  line-height: 1.6;
}
.fine { color: var(--faint); font-size: 0.875rem; line-height: 1.5; }

/* Buttons */
.btn {
  --bx: 0px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 0.9375rem/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
.btn:hover { box-shadow: 0 0 0 1px var(--accent-line), 0 8px 28px -8px var(--accent-glow); }
.btn:active { transform: scale(0.97); transition-duration: 90ms; }
.btn svg { fill: currentColor; flex: none; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.875rem; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 1rem; }
.btn-xl { height: 56px; padding: 0 28px; font-size: 1.0625rem; border-radius: 12px; }
.btn-ghost {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-ghost:hover { box-shadow: none; background: var(--bg-raised); }

/* The shine sweep: a soft band that crosses the button on hover (and once on load). */
.btn-shine::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.38) 48%, rgba(255, 255, 255, 0.38) 52%, transparent 70%);
  transform: translateX(-110%);
  pointer-events: none;
}
.btn-shine:hover::after { transform: translateX(110%); transition: transform 760ms var(--ease-move); }

.magnet { display: inline-block; transition: transform 260ms var(--ease); will-change: transform; }

/* Nav */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--nav-h);
}
.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transition: opacity 240ms var(--ease);
}
.scrolled .nav::before { opacity: 1; }
.nav-in {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.nav-links { display: flex; gap: 4px; margin-left: 12px; }
.nav-links a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.nav-links a:hover { color: var(--ink); background: var(--accent-soft); }
.nav-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms var(--ease), border-color 160ms var(--ease);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
.theme-toggle svg { grid-area: 1 / 1; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; transition: transform 420ms var(--ease), opacity 240ms var(--ease); }
[data-theme="dark"] .i-sun, :root:not([data-theme]) .i-sun { opacity: 0; transform: rotate(-90deg) scale(0.6); }
[data-theme="light"] .i-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }
.i-moon { fill: none; }

/* Ascent bar: the app's rank-progress bar, here filling as you scroll. */
.ascent {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: 0 50%;
  transform: scaleX(0);
  opacity: 0;
}
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .ascent { opacity: 1; animation: ascent linear both; animation-timeline: scroll(root); }
  }
}
@keyframes ascent { to { transform: scaleX(1); } }

/* Hero */
.hero {
  position: relative;
  padding-top: calc(var(--nav-h) + clamp(40px, 8vh, 88px));
  overflow: clip;
}
.hero-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 48px;
  align-items: end;
}
.hero-shot { grid-column: 1 / -1; }
.hero-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.75rem, 1.2rem + 6.4vw, 6.25rem);
  line-height: 0.96;
  letter-spacing: -0.025em;
  grid-column: 1 / -1;
}
.hero-title .ln { display: block; overflow: clip; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.hero-title .ln > span { display: inline-block; }
.hero-sub {
  margin-top: 28px;
  max-width: 54ch;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.55;
}
.cta { margin-top: 28px; }
.cta-meta {
  margin-top: 14px;
  min-height: 1.5em;
  color: var(--faint);
  font-size: 0.875rem;
}
.cta-meta a { margin-left: 12px; color: var(--muted); text-underline-offset: 3px; }
.cta-meta a:hover { color: var(--ink); }
.cta-note { display: none; margin-top: 6px; color: var(--faint); font-size: 0.875rem; }
.not-windows .cta-note { display: block; }
.cta-phone { display: none; }
.is-phone .cta-desktop { display: none; }
.is-phone .cta-phone { display: block; }
.is-phone .nav-dl { display: none; }
.cta-phone-text { max-width: 40ch; color: var(--ink); font-weight: 500; }
.cta-phone-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.hero-shot {
  position: relative;
  margin-top: clamp(48px, 7vh, 72px);
  perspective: 1600px;
}
.shot-rise { transform-origin: 50% 0; }
.shot-tilt {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 600ms var(--ease);
  will-change: transform;
}
.shot {
  width: 100%;
  border-radius: 16px;
  box-shadow: var(--shot-shadow);
  background: var(--bg-raised);
}
.hero-shot::after {
  /* the screenshot fades into the page below */
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -2px;
  height: 28%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}

/* Ambient glow behind the screenshot: three blurred blobs on slow transform loops. */
.glow {
  position: absolute;
  inset: 34% 0 0;
  pointer-events: none;
}
.glow span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
}
.glow span:nth-child(1) { left: 12%; top: 6%; width: 46%; height: 52%; background: var(--accent); opacity: var(--glow-a); animation: drift-a 26s var(--ease-move) infinite; }
.glow span:nth-child(2) { right: 8%; top: 16%; width: 40%; height: 46%; background: var(--accent-2); opacity: var(--glow-b); animation: drift-b 33s var(--ease-move) infinite; }
.glow span:nth-child(3) { left: 30%; top: 30%; width: 44%; height: 50%; background: var(--nebula); opacity: var(--glow-c); animation: drift-c 41s var(--ease-move) infinite; }
@keyframes drift-a { 50% { transform: translate3d(8%, 6%, 0) scale(1.12); } }
@keyframes drift-b { 50% { transform: translate3d(-10%, 4%, 0) scale(0.92); } }
@keyframes drift-c { 50% { transform: translate3d(-4%, -8%, 0) scale(1.08); } }
.paused .glow span, .glow.paused span { animation-play-state: paused; }

/* Load sequence (only with JS; without it everything is simply there). */
@media (prefers-reduced-motion: no-preference) {
  .js .hero-title .ln > span { animation: line-in 900ms var(--ease) both; }
  .js .hero-title .ln:nth-child(2) > span { animation-delay: 110ms; }
  .js .rise { animation: rise-in 800ms var(--ease) both; }
  .js .rise.d3 { animation-delay: 270ms; }
  .js .rise.d4 { animation-delay: 360ms; }
  .js .shot-rise { animation: shot-in 1300ms var(--ease) 380ms both; }
  .js .btn-shine::after { animation: shine 1100ms var(--ease-move) 1300ms 1 both; }
  .js .btn-shine:hover::after { animation: none; }
}
@media (prefers-reduced-motion: reduce) {
  .js .rise, .js .shot-rise, .js .hero-title .ln > span { animation: fade-in 500ms ease both; }
  .glow span { animation: none; }
}
@keyframes line-in { from { transform: translateY(105%); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } }
@keyframes shot-in { from { opacity: 0; transform: translateY(80px) rotateX(18deg) scale(0.96); } }
@keyframes shine { from { transform: translateX(-110%); } to { transform: translateX(110%); } }
@keyframes fade-in { from { opacity: 0; } }

/* Scroll reveals */
.js [data-reveal] { opacity: 0; transition: opacity 700ms var(--ease), transform 700ms var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { transform: translateY(24px); }
}
.js [data-reveal].in { opacity: 1; transform: none; }

/* Stats and the marquee */
.stats { position: relative; padding: clamp(40px, 6vw, 72px) 0 0; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}
.stat {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
  padding: 28px 24px 8px 0;
}
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat dd { margin: 0; }
.stat dt { color: var(--muted); font-size: 0.9375rem; max-width: 22ch; }
.num {
  display: inline-block;
  min-width: 3ch;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.5rem, 1.8rem + 2.4vw, 4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.marquee {
  display: flex;
  margin-top: clamp(40px, 6vw, 64px);
  padding: 18px 0;
  border-block: 1px solid var(--line);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: flex;
  flex: none;
  gap: 56px;
  padding-right: 56px;
  animation: marquee 38s linear infinite;
}
.marquee-track li {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.5rem);
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 56px;
}
.marquee-track li::after { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); opacity: 0.8; }
.marquee:hover .marquee-track, .marquee.paused .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
  .marquee { -webkit-mask-image: none; mask-image: none; justify-content: center; }
  .marquee-track { animation: none; flex-wrap: wrap; justify-content: center; row-gap: 8px; padding: 0 var(--gutter); }
  .marquee-track[aria-hidden] { display: none; }
}

/* Sections */
.paths, .features, .how, .install, .faq { padding-top: clamp(96px, 12vw, 160px); }

/* Two paths */
.path-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 48px;
}
.path {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: clamp(24px, 3vw, 40px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--slab);
}
.path > p { color: var(--muted); max-width: 48ch; }
.path-new { background: radial-gradient(120% 80% at 0% 0%, var(--accent-soft), transparent 60%), var(--card); }

.steps-mini { display: grid; gap: 2px; margin-top: 4px; }
.steps-mini li {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 12px;
  padding: 8px 0;
  font-weight: 600;
}
.steps-mini small { grid-column: 2; color: var(--faint); font-weight: 400; font-size: 0.875rem; }
.steps-mini .dot {
  grid-row: span 2;
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--bg);
}
.steps-mini li:not(.more)::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 29px;
  bottom: -11px;
  width: 2px;
  background: var(--line);
}
.steps-mini li:nth-last-child(2)::before { display: none; }
.steps-mini .done .dot { border-color: var(--success); background: var(--success); }
.steps-mini .now .dot { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
.steps-mini .now { color: var(--ink); }
.steps-mini .more { display: block; padding-left: 34px; color: var(--faint); font-weight: 400; font-size: 0.875rem; }

.langs { color: var(--muted); font-size: 0.9375rem; margin-top: auto; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  margin-right: 6px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
}

.checks { display: grid; gap: 14px; }
.checks li { position: relative; padding-left: 30px; color: var(--muted); }
.checks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9bff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat;
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
[data-theme="light"] .checks li::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233a4bd0' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }

.ladder {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: auto;
  padding-top: 8px;
}
.ladder li:nth-child(1) { --c: var(--rank-newbie); }
.ladder li:nth-child(2) { --c: var(--rank-pupil); }
.ladder li:nth-child(3) { --c: var(--rank-specialist); }
.ladder li:nth-child(4) { --c: var(--rank-expert); }
.ladder li:nth-child(5) { --c: var(--rank-cm); }
.ladder li:nth-child(6) { --c: var(--rank-master); }
.ladder li:nth-child(7) { --c: var(--rank-gm); }
.ladder li {
  position: relative;
  padding-top: 14px;
  color: var(--c);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.ladder li::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  border-radius: 3px;
  background: var(--c);
}
.path-pro .fine { margin-top: -6px; }

/* Feature showcase: a sticky screenshot that cross-fades as the list scrolls past. */
.show {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(32px, 4vw, 56px);
  margin-top: 40px;
}
.show-list { counter-reset: f; }
.show-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 52vh;
  padding: 24px 0;
  color: var(--faint);
  transition: color 400ms var(--ease);
}
.show-item p { max-width: 38ch; font-size: 1.0625rem; }
.show-item .h3 { color: var(--faint); transition: color 300ms var(--ease); }
.show-item.on { color: var(--muted); }
.show-item.on .h3 { color: var(--ink); }
.show-inline { display: none; }
.show-stage {
  position: sticky;
  top: calc(50vh - min(22vw, 250px));
  align-self: start;
  margin-top: 12vh;
}
.show-frame {
  position: relative;
  aspect-ratio: 1100 / 700;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shot-shadow);
  background: var(--bg-raised);
}
.show-frame picture {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.015);
  transition: opacity 520ms var(--ease), transform 700ms var(--ease);
}
.show-frame picture.on { opacity: 1; transform: none; }
.show-frame img { width: 100%; height: 100%; }
.show-dots { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.show-dots li { width: 18px; height: 3px; border-radius: 2px; background: var(--line-strong); transform-origin: 50% 50%; transition: transform 300ms var(--ease), background-color 300ms var(--ease); }
.show-dots li.on { background: var(--accent); transform: scaleX(1.8); }

/* How it works */
.how-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}
.how-steps { display: grid; gap: 8px; margin-top: 40px; counter-reset: s; }
.how-steps li {
  position: relative;
  padding: 18px 20px 18px 64px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background-color 400ms var(--ease), border-color 400ms var(--ease);
}
.how-steps li::before {
  counter-increment: s;
  content: counter(s);
  position: absolute;
  left: 18px;
  top: 18px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--muted);
  transition: color 400ms var(--ease), border-color 400ms var(--ease), background-color 400ms var(--ease);
}
.how-steps h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
.how-steps p { margin-top: 4px; color: var(--muted); max-width: 46ch; }
.how-steps li.on { background: var(--card); border-color: var(--line); }
.how-steps li.on::before { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.demo-wrap { margin: 0; }
.demo-wrap figcaption { margin-top: 14px; text-align: center; }
.demo {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card-solid);
  box-shadow: var(--shot-shadow);
  overflow: hidden;
  font-size: 0.875rem;
}
.demo-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.demo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.demo-title { margin-left: 10px; font-family: var(--font-display); font-weight: 600; font-size: 0.9375rem; }
.demo-streak { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--muted); font-size: 0.8125rem; }
.demo-streak svg { fill: var(--ember); }
.odo { display: inline-block; height: 1.25em; overflow: hidden; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.25; }
.odo-col { display: flex; flex-direction: column; transition: transform 600ms var(--ease); }
.demo-card {
  margin: 16px 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.demo-label { color: var(--accent); font-size: 0.75rem; font-weight: 600; }
.demo-name { margin-top: 4px; font-family: var(--font-display); font-weight: 600; font-size: 1.375rem; line-height: 1.2; }
.demo-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 0.8125rem; }
.pdot { width: 6px; height: 6px; border-radius: 50%; background: var(--lc); }
.demo-video {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  column-gap: 10px;
  row-gap: 8px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
}
.demo-play { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); grid-row: span 2; }
.demo-play svg { fill: var(--accent); }
.demo-vtext { color: var(--muted); font-size: 0.8125rem; }
.demo-track { display: block; height: 4px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.demo-fill { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.demo-actions { position: relative; margin-top: 14px; height: 36px; }
.demo-btn, .demo-solved {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.8125rem;
}
.demo-btn { background: var(--accent); color: var(--accent-ink); transition: transform 160ms var(--ease), opacity 160ms var(--ease); }
.demo-solved { color: var(--success); background: color-mix(in oklab, var(--success) 14%, transparent); opacity: 0; transform: translateY(6px); transition: opacity 300ms var(--ease) 140ms, transform 400ms var(--ease) 140ms; }
.demo-solved svg, .demo-box svg { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.demo-sheet { margin: 12px 16px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.demo-row { display: flex; align-items: center; gap: 10px; }
.demo-box {
  position: relative;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  color: var(--accent-ink);
}
.demo-box::before { content: ""; position: absolute; inset: -1.5px; border-radius: 6px; background: var(--success); opacity: 0; transform: scale(0.6); transition: opacity 250ms var(--ease), transform 350ms var(--ease); }
.demo-box svg { position: relative; opacity: 0; transform: scale(0.4); transition: opacity 250ms var(--ease) 80ms, transform 350ms var(--ease) 80ms; }
.demo-rname { font-weight: 500; }
.demo-tag { margin-left: auto; color: var(--faint); font-size: 0.75rem; }
.demo-prog { margin-top: 10px; height: 4px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.demo-pfill { display: block; height: 100%; width: 100%; background: var(--success); transform-origin: 0 50%; transform: scaleX(0.27); transition: transform 700ms var(--ease); }

/* Demo phases: 0 the card, 1 watching, 2 solved, 3 ticked. */
.demo[data-phase="1"] .demo-fill, .demo[data-phase="2"] .demo-fill, .demo[data-phase="3"] .demo-fill { transform: scaleX(1); transition: transform 1500ms linear; }
.demo[data-phase="2"] .demo-btn, .demo[data-phase="3"] .demo-btn { opacity: 0; transform: scale(0.94); }
.demo[data-phase="2"] .demo-solved, .demo[data-phase="3"] .demo-solved { opacity: 1; transform: none; }
.demo[data-phase="3"] .demo-box::before { opacity: 1; transform: none; }
.demo[data-phase="3"] .demo-box svg { opacity: 1; transform: none; }
.demo[data-phase="3"] .demo-pfill { transform: scaleX(0.29); }
.demo[data-phase="3"] .odo-col { transform: translateY(-50%); }
.demo.resetting * { transition: none !important; }

/* Install help */
.install-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 48px;
  counter-reset: i;
}
.install-steps > li {
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--slab);
}
.install-steps h3 { margin-top: 24px; font-size: 1.125rem; font-weight: 600; }
.install-steps h3::before { counter-increment: i; content: counter(i) ". "; color: var(--accent); font-family: var(--font-display); }
.install-steps > li > p { margin-top: 6px; color: var(--muted); }
.install-req { margin-top: 24px; }

/* A simplified SmartScreen dialog (always its own blue, like the real one, in both themes). */
.ss {
  position: relative;
  min-height: 230px;
  padding: 22px 22px 18px;
  border-radius: 6px;
  background: #0f5ba7;
  color: #fff;
  font-family: "Segoe UI", var(--font-body);
  box-shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}
.ss-title { font-size: 1.25rem; font-weight: 300; line-height: 1.25; }
.ss-text { margin-top: 12px; font-size: 0.8125rem; line-height: 1.5; opacity: 0.95; }
.ss-link { position: relative; align-self: flex-start; margin-top: 10px; font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 2px; }
.ss-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; padding-top: 18px; }
.ss-btn { position: relative; padding: 6px 18px; border: 2px solid rgba(255, 255, 255, 0.85); font-size: 0.8125rem; }
.ss-target { outline: 2px solid #ffd27a; outline-offset: 4px; border-radius: 2px; }
.ss-cursor {
  position: absolute;
  right: -18px;
  bottom: -20px;
  width: 20px;
  height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 22'%3E%3Cpath d='M2 1v17l4.5-4 3 6.5 3-1.4-3-6.4H16Z' fill='%23fff' stroke='%23000' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat;
}

/* FAQ */
.faq-in { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 5vw, 80px); align-items: start; }
.faq-list { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  position: relative;
  padding: 22px 48px 22px 0;
  font-size: 1.125rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 240ms var(--ease);
}
.faq details[open] summary::after { transform: translateY(5px) rotate(225deg); }
.faq summary:hover { color: var(--accent); }
.faq details p { padding: 0 48px 24px 0; color: var(--muted); max-width: 62ch; }
@media (prefers-reduced-motion: no-preference) {
  .faq details[open] p { animation: rise-in 360ms var(--ease) both; }
}

/* Final call */
.final { padding: clamp(112px, 14vw, 180px) 0 clamp(80px, 10vw, 128px); }
.final-in { display: flex; flex-direction: column; align-items: flex-start; gap: 32px; }
.final .h2 { max-width: 20ch; }

/* Footer */
.foot { padding: 56px 0 48px; border-top: 1px solid var(--line); background: var(--bg-sunken); }
.foot-in { display: grid; grid-template-columns: 1.3fr 1fr 1.4fr; gap: 40px; }
.foot-brand .fine { margin-top: 12px; max-width: 34ch; }
.foot-col { display: flex; flex-direction: column; gap: 10px; }
.foot-h { font-size: 0.875rem; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.foot-col a { color: var(--muted); text-decoration: none; font-size: 0.9375rem; }
.foot-col a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.foot-legal { grid-column: 1 / -1; display: grid; gap: 6px; padding-top: 28px; border-top: 1px solid var(--line); }
.foot-legal a { color: var(--muted); }

/* Theme change cross-fade (View Transitions, else a short colour transition). */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 420ms; animation-timing-function: var(--ease); }
.theme-fade, .theme-fade * { transition: background-color 400ms var(--ease), color 400ms var(--ease), border-color 400ms var(--ease) !important; }

/* Tablet */
@media (max-width: 980px) {
  .hero-in { display: block; }
  .cta { margin-top: 32px; }
  .nav-links { display: none; }
  .show { display: block; }
  .show-stage { display: none; }
  .show-item { min-height: 0; padding: 0; color: var(--muted); margin-top: 56px; }
  .show-item .h3 { color: var(--ink); }
  .show-inline { display: block; margin-top: 14px; }
  .show-inline img { border-radius: 12px; box-shadow: var(--shot-shadow); }
  .how-in { grid-template-columns: 1fr; }
  .faq-in { grid-template-columns: 1fr; }
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

/* Phone */
@media (max-width: 640px) {
  :root { --nav-h: 58px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .stat { padding: 22px 12px 14px 0; }
  .stat + .stat { padding-left: 16px; }
  .stat:nth-child(3) { padding-left: 0; }
  .path-grid, .install-steps { grid-template-columns: 1fr; }
  .ladder { grid-template-columns: repeat(4, 1fr); row-gap: 12px; }
  .btn-xl { width: 100%; }
  .magnet { display: block; }
  .hero-shot { margin-top: 48px; }
  .shot { border-radius: 8px; }
  .foot-in { grid-template-columns: 1fr; }
  .faq summary { font-size: 1.0625rem; }
  .demo { font-size: 0.8125rem; }
}

/* 404 */
.notfound { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; min-height: 100vh; justify-content: center; }
