/* ═══════════════════════════════════════════════════════════════════════
   Motrix Next — Website
   Direction: deep-space precision + restrained speed-light accents.
   Typography: Inter Variable (display) + system stack (body).
   Zero dependencies. Scroll-driven animations as progressive enhancement.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Font ──────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Inter Var';
  src: url('../fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

/* ── Design tokens ─────────────────────────────────────────────────── */
:root {
  /* Deep-space dark (default) */
  --bg: #08080a;
  --bg-soft: #0d0d10;
  --surface: #111114;
  --surface-2: #16161b;
  --line: rgba(255, 255, 255, 0.07);
  --line-soft: rgba(255, 255, 255, 0.045);
  --text: #ededf0;
  --text-dim: #9b9ba6;
  --text-muted: #5d5d68;

  --gold: #f0b429;
  --gold-hi: #ffd166;
  --gold-deep: #de8f2d;
  --gold-soft: rgba(240, 180, 41, 0.09);
  --gold-line: rgba(240, 180, 41, 0.25);
  --gold-glow: rgba(240, 180, 41, 0.18);

  --rose: #e85d75;
  --rose-soft: rgba(232, 93, 117, 0.1);
  --rose-line: rgba(232, 93, 117, 0.25);

  --grid-dot: rgba(255, 255, 255, 0.055);
  --overlay: rgba(4, 4, 6, 0.86);
  --nav-bg: rgba(8, 8, 10, 0.72);
  --code-bg: rgba(240, 180, 41, 0.08);
  --chip-bg: rgba(255, 255, 255, 0.04);
  --shadow-app:
    0 40px 120px -24px rgba(0, 0, 0, 0.7),
    0 0 140px -40px rgba(240, 180, 41, 0.14);
  --shadow-menu: 0 12px 40px -8px rgba(0, 0, 0, 0.6);

  /* Type */
  --font-display:
    'Inter Var', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;

  /* Motion (mirrors the app's M3 tokens) */
  --ease-enter: cubic-bezier(0.2, 0, 0, 1);
  --ease-exit: cubic-bezier(0.3, 0, 0.8, 0.15);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Gold CTA — identical in both themes (never muddied by light mode) */
  --cta-grad: linear-gradient(180deg, #ffd166, #f0b429 55%, #e09422);
  --cta-text: #1a1206;
  --cta-glow: rgba(240, 180, 41, 0.35);

  /* Layout */
  --col: min(720px, 92vw);
  --col-wide: min(1120px, 94vw);
  --radius: 14px;
  --radius-lg: 20px;
}

:root[data-theme='light'] {
  --bg: #f1ede5;
  --bg-soft: #eae5db;
  --surface: #f9f7f2;
  --surface-2: #f0ece3;
  --line: rgba(28, 25, 20, 0.12);
  --line-soft: rgba(28, 25, 20, 0.07);
  --text: #1b1917;
  --text-dim: #57534c;
  --text-muted: #a39e94;

  --gold: #b07f0a;
  --gold-hi: #8f6708;
  --gold-deep: #b0620a;
  --gold-soft: rgba(176, 127, 10, 0.08);
  --gold-line: rgba(176, 127, 10, 0.3);
  --gold-glow: rgba(196, 148, 30, 0.3);

  --rose: #d14e66;
  --rose-soft: rgba(209, 78, 102, 0.09);
  --rose-line: rgba(209, 78, 102, 0.25);

  --grid-dot: rgba(28, 25, 20, 0.13);
  --overlay: rgba(241, 237, 229, 0.92);
  --nav-bg: rgba(241, 237, 229, 0.75);
  --code-bg: rgba(176, 127, 10, 0.09);
  --chip-bg: rgba(28, 25, 20, 0.04);
  --shadow-app:
    0 40px 120px -24px rgba(30, 25, 15, 0.25),
    0 0 140px -40px rgba(196, 148, 30, 0.12);
  --shadow-menu: 0 12px 40px -8px rgba(30, 25, 15, 0.18);
}

/* ── View transition (theme circular reveal) ───────────────────────── */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) {
  z-index: 1;
}
::view-transition-new(root) {
  z-index: 9999;
}

/* ── Base ──────────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Page-wide ambience — identical structure in both themes:
   soft corner glows + an ultra-faint dot grid over the whole page. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 52% 40% at 10% 18%, var(--gold-glow), transparent 70%),
    radial-gradient(ellipse 40% 32% at 92% 50%, var(--gold-glow), transparent 70%),
    radial-gradient(ellipse 48% 36% at 30% 92%, var(--gold-glow), transparent 70%);
  opacity: 0.5;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.4;
  mask-image: linear-gradient(180deg, black, transparent 55%, black);
  -webkit-mask-image: linear-gradient(180deg, black, transparent 55%, black);
}

a {
  color: var(--gold);
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.9rem, 4.2vw, 2.75rem);
  font-weight: 700;
}

h3 {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--code-bg);
  color: var(--gold);
  padding: 0.2em 0.5em;
  border-radius: 5px;
}

.ic {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.ic-fill {
  fill: currentColor;
  stroke: none;
}

/* Gradient gold text */
.grad-gold {
  background: linear-gradient(115deg, var(--gold-hi) 10%, var(--gold) 45%, var(--gold-deep) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.grad-gold-soft {
  color: var(--gold);
  font-weight: 550;
}

/* ── i18n cross-fade ───────────────────────────────────────────────── */
@keyframes i18nOut {
  to {
    opacity: 0.25;
    filter: blur(3px);
  }
}
@keyframes i18nIn {
  from {
    opacity: 0.25;
    filter: blur(3px);
  }
}
main.i18n-fade-out,
footer.i18n-fade-out {
  animation: i18nOut 150ms ease forwards;
}
main.i18n-fade-in,
footer.i18n-fade-in {
  animation: i18nIn 200ms ease forwards;
}

/* ═══ Navigation ═══════════════════════════════════════════════════ */
#nav {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding-inline: clamp(1rem, 4vw, 2.75rem);
  background: var(--nav-bg);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border-bottom: 1px solid var(--line-soft);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.nav-logo img {
  border-radius: 6px;
}

.nav-logo em {
  font-style: normal;
  color: var(--gold);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-gh {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: color 180ms;
}

.nav-gh:hover {
  color: var(--text);
}

.nav-cta {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--cta-text);
  background: var(--cta-grad);
  padding: 0.42rem 1.1rem;
  border-radius: 99px;
  transition:
    transform 200ms var(--ease-enter),
    box-shadow 200ms var(--ease-enter);
}

.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--cta-glow);
}

/* ── Pickers (lang / theme) ────────────────────────────────────────── */
.picker {
  position: relative;
}

.picker-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 550;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--line);
  padding: 0.32rem 0.7rem;
  border-radius: 99px;
  cursor: pointer;
  transition:
    color 200ms,
    border-color 200ms;
}

.picker-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.picker-toggle .ic {
  width: 14px;
  height: 14px;
}

.picker-toggle .icon-sun {
  display: none;
}
[data-theme='light'] .picker-toggle .icon-sun {
  display: block;
}
[data-theme='light'] .picker-toggle .icon-moon {
  display: none;
}

.picker-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  inset-inline-end: 0;
  min-width: 160px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.375rem;
  box-shadow: var(--shadow-menu);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top;
  transition:
    opacity 180ms var(--ease-enter),
    transform 180ms var(--ease-enter);
  z-index: 110;
}

.picker-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.picker-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: start;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  padding: 0.42rem 0.7rem;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition:
    background 150ms,
    color 150ms;
}

.picker-option .ic {
  width: 14px;
  height: 14px;
  opacity: 0.55;
}

.picker-option:hover {
  background: var(--gold-soft);
  color: var(--text);
}

.picker-option.active {
  color: var(--gold);
  font-weight: 600;
}

.picker-sep {
  height: 1px;
  background: var(--line);
  margin: 0.25rem 0.4rem;
}

/* ═══ Hero ═════════════════════════════════════════════════════════ */
#hero {
  position: relative;
  padding: 7.5rem 1.5rem 4rem;
  text-align: center;
  overflow: clip;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* Launch beam — a glowing horizon line right under the nav */
.hero-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 82vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.55;
}

.hero-bg::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 66vw);
  height: 90px;
  background: radial-gradient(ellipse 50% 100% at 50% 0%, var(--gold-glow), transparent 70%);
  opacity: 0.8;
}

/* Precision dot grid, faded at edges */
.hero-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 75% 62% at 50% 36%, black 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 75% 62% at 50% 36%, black 25%, transparent 78%);
}

/* Aurora glow */
.hero-aurora {
  position: absolute;
  top: -22%;
  left: 50%;
  width: min(1100px, 130vw);
  height: 640px;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse 46% 56% at 42% 40%, var(--gold-glow), transparent 65%),
    radial-gradient(ellipse 44% 52% at 60% 45%, var(--gold-glow), transparent 68%);
  filter: blur(10px);
}

/* Speed streaks — the download metaphor, restrained */
.hero-streaks {
  position: absolute;
  inset: 0;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, black 30%, transparent 75%);
}

.hero-streaks i {
  position: absolute;
  height: 1px;
  width: 220px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0;
  animation: streak var(--d, 5s) linear var(--t, 0s) infinite;
}

.hero-streaks i:nth-child(1) { top: 18%; --d: 4.6s; --t: 0.2s; }
.hero-streaks i:nth-child(2) { top: 30%; --d: 6.2s; --t: 2.1s; width: 150px; }
.hero-streaks i:nth-child(3) { top: 44%; --d: 5.4s; --t: 1.2s; }
.hero-streaks i:nth-child(4) { top: 58%; --d: 7s;   --t: 3.4s; width: 130px; }
.hero-streaks i:nth-child(5) { top: 70%; --d: 5.8s; --t: 0.8s; width: 180px; }
.hero-streaks i:nth-child(6) { top: 84%; --d: 6.6s; --t: 2.8s; }

@keyframes streak {
  0% {
    transform: translateX(-30vw);
    opacity: 0;
  }
  12% {
    opacity: 0.4;
  }
  88% {
    opacity: 0.4;
  }
  100% {
    transform: translateX(130vw);
    opacity: 0;
  }
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-logo {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 80px -12px var(--gold-glow);
  animation: rise 700ms var(--ease-enter) both;
}

#hero h1 {
  font-size: clamp(3rem, 8vw, 5.25rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  margin-bottom: 0.85rem;
  background: linear-gradient(180deg, var(--text) 30%, var(--text-dim));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rise 700ms 60ms var(--ease-enter) both;
}

#hero h1 .grad-gold {
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: clamp(1.05rem, 2.3vw, 1.25rem);
  color: var(--text-dim);
  max-width: 46ch;
  animation: rise 700ms 120ms var(--ease-enter) both;
}

/* Stats strip */
.hero-stats {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 1.6rem 0 2rem;
  animation: rise 700ms 180ms var(--ease-enter) both;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.84rem;
  color: var(--text-dim);
  transition: color 200ms;
}

.stat:hover {
  color: var(--text);
}

.stat .ic {
  width: 14px;
  height: 14px;
  opacity: 0.55;
}

.stat-value {
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.stat-value.loading {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.stat-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.5;
}

/* Actions */
.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  animation: rise 700ms 240ms var(--ease-enter) both;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.72rem 1.7rem;
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 220ms var(--ease-enter),
    box-shadow 220ms var(--ease-enter),
    background 220ms,
    border-color 220ms,
    color 220ms;
}

.btn .ic {
  width: 17px;
  height: 17px;
}

.btn-gold {
  color: var(--cta-text);
  background: var(--cta-grad);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.25);
}

.btn-gold:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 10px 32px var(--cta-glow);
}

.btn-ghost {
  color: var(--text-dim);
  background: var(--chip-bg);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

.btn-ghost .ic-fill {
  fill: currentColor;
}

.btn-sponsor {
  color: var(--rose);
  background: var(--rose-soft);
  border: 1px solid var(--rose-line);
}

.btn-sponsor:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(232, 93, 117, 0.18);
}

.btn-lg {
  font-size: 1rem;
  padding: 0.9rem 2.4rem;
}

.hero-meta {
  margin-top: 1.1rem;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  animation: rise 700ms 300ms var(--ease-enter) both;
}

.meta-sep {
  margin: 0 0.5rem;
  opacity: 0.4;
}

/* ── Hero duo — both themes shown together, staggered ─────────────── */
.hero-duo {
  position: relative;
  z-index: 1;
  max-width: min(1020px, 94vw);
  margin: 3.5rem auto 0;
  padding-bottom: clamp(3rem, 9vw, 6.5rem);
  perspective: 1400px;
  animation: rise 800ms 380ms var(--ease-enter) both;
}

.hero-duo-glow {
  position: absolute;
  inset: 10% -6% 0;
  background: radial-gradient(ellipse 60% 55% at 50% 55%, var(--gold-glow), transparent 70%);
  filter: blur(20px);
  z-index: -1;
}

.duo-shot {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-app);
  cursor: zoom-in;
  transition:
    transform 300ms var(--ease-enter),
    box-shadow 300ms var(--ease-enter),
    border-color 300ms;
}

.duo-shot img {
  display: block;
  width: 100%;
}

.duo-shot figcaption {
  position: absolute;
  top: 0.8rem;
  inset-inline-start: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0.3rem 0.75rem;
  pointer-events: none;
}

.duo-shot figcaption .ic {
  width: 12px;
  height: 12px;
  color: var(--gold);
  opacity: 0.85;
}

.duo-dark {
  width: 82%;
}

.duo-light {
  position: absolute;
  width: 62%;
  inset-inline-end: 0;
  bottom: 0;
  z-index: 2;
}

.duo-shot:hover {
  transform: translateY(-5px);
  border-color: var(--gold-line);
}

/* Hovering the back (dark) shot: the front one gracefully yields —
   slides aside and fades so the full dark screenshot is readable.
   No z-index jumps, everything transitions. */
.hero-duo:has(.duo-dark:hover) .duo-light {
  transform: translate(5%, 7%) scale(0.965);
  opacity: 0.3;
}

[dir='rtl'] .hero-duo:has(.duo-dark:hover) .duo-light {
  transform: translate(-5%, 7%) scale(0.965);
}

.duo-light {
  transition:
    transform 380ms var(--ease-enter),
    opacity 380ms var(--ease-enter),
    border-color 300ms,
    box-shadow 300ms var(--ease-enter);
}

/* Scroll-driven un-tilt (progressive enhancement) */
@supports (animation-timeline: view()) {
  .hero-duo {
    animation:
      rise 800ms 380ms var(--ease-enter) both,
      untilt linear both;
    animation-timeline: auto, view();
    animation-range: normal, entry 0% cover 42%;
    transform-style: preserve-3d;
  }
  @keyframes untilt {
    from {
      transform: rotateX(6deg) scale(0.985);
    }
    to {
      transform: rotateX(0deg) scale(1);
    }
  }
}

/* Tech pills below the screenshots */
.hero-pills {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2.2rem;
  animation: rise 700ms 460ms var(--ease-enter) both;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 550;
  padding: 0.38rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--text-dim);
  background: var(--chip-bg);
  transition:
    border-color 200ms,
    color 200ms;
}

.pill:hover {
  border-color: var(--gold-line);
  color: var(--text);
}

.pill .ic {
  width: 13px;
  height: 13px;
  opacity: 0.55;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ═══ Sections ═════════════════════════════════════════════════════ */
.section {
  max-width: var(--col);
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
}

.section-wide {
  max-width: var(--col-wide);
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
}

.section-head {
  text-align: center;
  margin-bottom: 2.75rem;
}

.lead {
  color: var(--text-dim);
  margin-top: 0.75rem;
  font-size: 1.05rem;
}

.kicker {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.prose p {
  color: var(--text-dim);
  margin-bottom: 0.9rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose a {
  border-bottom: 1px solid transparent;
  transition: border-color 200ms;
}

.prose a:hover {
  border-color: var(--gold);
}

.prose-center {
  max-width: 62ch;
  margin: 0 auto 2.5rem;
  text-align: center;
}

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 700ms var(--ease-enter),
    transform 700ms var(--ease-enter);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ═══ Story ════════════════════════════════════════════════════════ */
#story {
  max-width: var(--col-wide);
}

.story-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.story-head {
  position: sticky;
  top: 6.5rem;
}

.story-body {
  display: grid;
  gap: 1.5rem;
}

.engine-note {
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--gold-soft), transparent 65%);
}

.engine-note p {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.65;
}

.engine-note a:hover {
  border-bottom: 1px solid var(--gold);
}

/* ═══ Rewrite ledger ═══════════════════════════════════════════════ */
.ledger {
  max-width: 880px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  overflow: hidden;
}

.ledger-cols,
.ledger-row {
  display: grid;
  grid-template-columns: 1fr 1.1fr 34px 1.4fr;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 1.5rem;
}

.ledger-cols {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.ledger-col-next {
  color: var(--gold);
}

.ledger-row {
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.875rem;
  transition: background 180ms;
}

.ledger-row:last-child {
  border-bottom: none;
}

.ledger-row:hover {
  background: var(--surface);
}

.ledger-layer {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
}

.ledger-old {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.ledger-arrow {
  width: 15px;
  height: 15px;
  color: var(--gold);
  opacity: 0.6;
  justify-self: center;
  transition:
    transform 220ms var(--ease-enter),
    opacity 220ms;
}

.ledger-row:hover .ledger-arrow {
  transform: translateX(3px);
  opacity: 1;
}

[dir='rtl'] .ledger-arrow {
  transform: scaleX(-1);
}

[dir='rtl'] .ledger-row:hover .ledger-arrow {
  transform: scaleX(-1) translateX(3px);
}

.ledger-new {
  color: var(--text);
  font-weight: 550;
}

.ledger-row-hot .ledger-new {
  color: var(--gold);
  font-weight: 700;
}

/* ═══ Motion cards ═════════════════════════════════════════════════ */
.motion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.mcard {
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  transition:
    border-color 250ms,
    background 250ms;
}

.mcard:hover {
  border-color: var(--gold-line);
  background: var(--surface);
}

.mcard h3 {
  margin-bottom: 0.35rem;
}

.mcard p {
  color: var(--text-dim);
  font-size: 0.875rem;
  line-height: 1.6;
}

.mcard-demo {
  height: 56px;
  margin-bottom: 1.1rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
}

/* demo 1 — asymmetric timing: two dots, slow in / fast out */
.demo-timing i {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  translate: 0 -50%;
}

.demo-timing i:nth-child(1) {
  left: 12%;
  animation: dEnter 2.6s var(--ease-enter) infinite;
}

.demo-timing i:nth-child(2) {
  left: 12%;
  opacity: 0.35;
  animation: dExit 2.6s var(--ease-exit) infinite;
}

@keyframes dEnter {
  0%, 12% { transform: translateX(0); }
  50%, 100% { transform: translateX(240%); }
}
@keyframes dExit {
  0%, 40% { transform: translateX(0) translateY(180%); }
  62%, 100% { transform: translateX(240%) translateY(180%); }
}

/* demo 2 — easing curve trace */
.demo-easing svg {
  position: absolute;
  inset: 8px 12px;
  width: calc(100% - 24px);
  height: calc(100% - 16px);
}

.demo-easing path {
  stroke: var(--gold);
  stroke-width: 2;
  stroke-dasharray: 160;
  stroke-dashoffset: 160;
  animation: trace 2.8s var(--ease-enter) infinite;
}

@keyframes trace {
  25%, 70% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -160; }
}

/* demo 3 — spring pop */
.demo-spring i {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--gold-soft);
  border: 1.5px solid var(--gold);
  animation: springPop 2.4s var(--ease-spring) infinite;
}

@keyframes springPop {
  0%, 10% { transform: scale(0.4); opacity: 0; }
  35%, 75% { transform: scale(1); opacity: 1; }
  92%, 100% { transform: scale(0.4); opacity: 0; }
}

/* demo 4 — token chips */
.demo-tokens {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.demo-tokens code {
  font-size: 0.62rem;
}

.curves {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.7rem;
}

/* ═══ Features bento ═══════════════════════════════════════════════ */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
}

.bcard {
  position: relative;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
  transition:
    border-color 250ms,
    background 250ms,
    transform 250ms var(--ease-enter);
}

.bcard:hover {
  border-color: var(--gold-line);
  background: var(--surface);
  transform: translateY(-3px);
}

/* spotlight follow (set via JS custom props) */
.bcard::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), var(--gold-soft), transparent 65%);
  opacity: 0;
  transition: opacity 300ms;
  pointer-events: none;
}

.bcard:hover::before {
  opacity: 1;
}

.bcard > * {
  position: relative;
}

.bcard-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  margin-bottom: 0.85rem;
}

.bcard-icon .ic {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.bcard h3 {
  margin-bottom: 0.3rem;
}

.bcard p {
  color: var(--text-dim);
  font-size: 0.855rem;
  line-height: 1.6;
}

/* Big protocol card */
.b-protocol {
  grid-column: span 2;
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 2.1rem;
}

.b-protocol h3 {
  font-size: 1.3rem;
}

.b-protocol p {
  font-size: 0.95rem;
}

.proto-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.3rem;
}

.proto-chips span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  padding: 0.28rem 0.7rem;
  border-radius: 99px;
}

.b-protocol:hover .proto-chips span {
  animation: chipPop 500ms var(--ease-spring) both;
}

.b-protocol:hover .proto-chips span:nth-child(2) { animation-delay: 50ms; }
.b-protocol:hover .proto-chips span:nth-child(3) { animation-delay: 100ms; }
.b-protocol:hover .proto-chips span:nth-child(4) { animation-delay: 150ms; }
.b-protocol:hover .proto-chips span:nth-child(5) { animation-delay: 200ms; }

@keyframes chipPop {
  40% {
    transform: translateY(-4px);
  }
}

/* Wide BT card with animated transfer bars */
.b-bt {
  grid-column: span 2;
}

.bt-bars {
  display: grid;
  gap: 5px;
  margin-top: 1rem;
}

.bt-bars i {
  height: 4px;
  border-radius: 99px;
  background:
    linear-gradient(90deg, var(--gold), var(--gold-deep)) no-repeat,
    var(--line-soft);
  background-size: 0% 100%;
}

.bcard.b-bt:hover .bt-bars i,
.bento.visible .bt-bars i {
  animation: fill var(--d, 2.2s) var(--ease-enter) var(--t, 0s) infinite;
}

.bt-bars i:nth-child(1) { --d: 2.4s; --t: 0s; }
.bt-bars i:nth-child(2) { --d: 3.1s; --t: 0.4s; }
.bt-bars i:nth-child(3) { --d: 2.7s; --t: 0.9s; }

@keyframes fill {
  0% { background-size: 0% 100%; }
  70%, 100% { background-size: 100% 100%; }
}

/* Wide task card */
.b-task {
  grid-column: span 2;
}

/* Full-width lightweight strip */
.b-light {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-block: 1.25rem;
}

.b-light .bcard-icon {
  margin-bottom: 0;
}

.b-light-badge {
  margin-inline-start: auto;
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  font-weight: 750;
  white-space: nowrap;
}

/* ═══ Download ═════════════════════════════════════════════════════ */
#download {
  max-width: var(--col-wide);
}

.dl-panel {
  position: relative;
  text-align: center;
  padding: 3.5rem clamp(1.25rem, 5vw, 4rem) 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 60% 70% at 50% 0%, var(--gold-soft), transparent 70%),
    var(--bg-soft);
  overflow: hidden;
}

.dl-panel h2 {
  margin-bottom: 0.4rem;
}

.dl-detected {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.6rem;
  min-height: 1.4em;
}

.dl-meta {
  animation: none;
}

.dl-toggle {
  display: inline-block;
  margin-top: 1.75rem;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 550;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--line);
  padding: 0.5rem 1.3rem;
  border-radius: 99px;
  cursor: pointer;
  transition:
    color 200ms,
    border-color 200ms;
}

.dl-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.dl-toggle.active {
  color: var(--gold);
  border-color: var(--gold-line);
}

.dl-all {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 400ms var(--ease-enter),
    opacity 300ms;
}

.dl-all.open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.dl-grid {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: start;
}

.dl-all.open .dl-grid {
  margin-top: 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.dl-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.95rem 1.4rem;
}

.dl-row + .dl-row,
.dl-divider + .dl-row {
  border-top: 1px solid var(--line-soft);
}

.dl-divider {
  height: 0;
}

.dl-row-label {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  min-width: 118px;
}

.dl-row-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 1;
  justify-content: flex-end;
}

.dl-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 550;
  font-size: 0.8rem;
  transition:
    border-color 200ms,
    background 200ms,
    transform 200ms var(--ease-enter);
}

.dl-pill:hover {
  border-color: var(--gold-line);
  background: var(--gold-soft);
  transform: translateY(-1px);
}

.dl-pill .ic {
  width: 13px;
  height: 13px;
  color: var(--gold);
}

.dl-pill-fmt {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* ═══ Overlays (lightbox + modal) ══════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--ease-enter);
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.overlay-close {
  position: absolute;
  top: 1.1rem;
  inset-inline-end: 1.25rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-dim);
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition:
    color 200ms,
    transform 200ms var(--ease-enter);
}

.overlay-close:hover {
  color: var(--text);
  transform: scale(1.08);
}

#lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: var(--shadow-app);
  transform: scale(0.94);
  transition: transform 320ms var(--ease-enter);
}

#lightbox.open img {
  transform: scale(1);
}

.modal-card {
  position: relative;
  width: min(430px, 92vw);
  padding: 2.25rem 2rem 1.75rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transform: scale(0.94) translateY(8px);
  transition: transform 320ms var(--ease-spring);
}

.overlay.open .modal-card {
  transform: none;
}

.modal-close {
  top: 0.9rem;
  inset-inline-end: 1rem;
  width: 34px;
  height: 34px;
}

.modal-title {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
}

.modal-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.modal-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1.2rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  transition:
    border-color 220ms,
    background 220ms,
    transform 220ms var(--ease-enter),
    box-shadow 220ms var(--ease-enter);
}

.modal-opt:hover {
  border-color: var(--gold-line);
  background: var(--gold-soft);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--gold-glow);
}

.modal-opt-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

.modal-opt-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.modal-opt-action {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
}

.modal-opt-action .ic {
  width: 13px;
  height: 13px;
}

.modal-opt--ghost {
  border-color: var(--line-soft);
  background: transparent;
}

.modal-opt--ghost:hover {
  border-color: var(--text-muted);
  background: var(--bg-soft);
  box-shadow: none;
}

.modal-opt--ghost .modal-opt-action {
  color: var(--text-muted);
}

.modal-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.overlay.open .modal-opt:nth-child(1) {
  animation: rise 400ms 50ms var(--ease-enter) both;
}

.overlay.open .modal-opt:nth-child(2) {
  animation: rise 400ms 120ms var(--ease-enter) both;
}

/* ═══ Star history ═════════════════════════════════════════════════ */
.star-history-frame {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 3 / 2;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  overflow: hidden;
}

.star-history-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--line-soft) 40%, transparent 80%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  pointer-events: none;
  transition: opacity 400ms;
}

.star-history-frame.loaded::after {
  opacity: 0;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.star-history-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 500ms var(--ease-enter);
}

.star-history-frame.loaded img {
  opacity: 1;
}

/* ═══ Footer ═══════════════════════════════════════════════════════ */
#footer {
  max-width: var(--col);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  border-top: 1px solid var(--line-soft);
}

.footer-built {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.footer-tech {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-dim);
  font-weight: 500;
  transition: color 180ms;
}

.footer-tech:hover {
  color: var(--text);
}

.footer-sep {
  opacity: 0.4;
}

.footer-ack {
  margin-bottom: 1.1rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  justify-content: center;
  margin-bottom: 0.9rem;
}

.footer-links a {
  color: var(--text-dim);
  transition: color 180ms;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-license {
  font-size: 0.74rem;
  opacity: 0.6;
}

/* ═══ Responsive ═══════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .bento {
    grid-template-columns: repeat(2, 1fr);
  }
  .b-protocol {
    grid-row: auto;
  }
  .story-grid {
    grid-template-columns: 1fr;
  }
  .story-head {
    position: static;
  }
}

@media (max-width: 768px) {
  #hero {
    padding-top: 6rem;
  }
  .motion-grid {
    grid-template-columns: 1fr;
  }
  .hero-duo {
    padding-bottom: 0;
  }
  .duo-dark {
    width: 100%;
  }
  .duo-light {
    position: relative;
    width: 100%;
    margin-top: 1rem;
  }
  .hero-actions {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
  }
  .hero-actions .btn {
    width: 100%;
  }
  .hero-stats {
    gap: 0.8rem;
  }
  .ledger-cols {
    display: none;
  }
  .ledger-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
    padding-block: 0.9rem;
  }
  .ledger-arrow {
    display: none;
  }
  .ledger-old {
    order: 2;
  }
  .ledger-old::before {
    content: '— ';
  }
  .ledger-new {
    order: 3;
  }
  .b-light {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .b-light-badge {
    margin-inline-start: 0;
  }
}

@media (max-width: 560px) {
  .bento {
    grid-template-columns: 1fr;
  }
  .b-protocol,
  .b-bt,
  .b-task {
    grid-column: auto;
  }
  .section,
  .section-wide {
    padding-block: 3.5rem;
  }
  .dl-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
  .modal-options {
    grid-template-columns: 1fr;
  }
  .picker-toggle span {
    display: none;
  }
}

/* ═══ Reduced motion ═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-streaks {
    display: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .hero-duo {
    transform: none;
  }
}
