/* Track2Mix marketing site — tokens mirror ../tailwind.config.ts so the site
   and the app read as one product. Hand-written CSS: no build step, no CDN,
   deployable as static files to any host. */

:root {
  --iris-100: #dedff7;
  --iris-200: #bec0ef;
  --iris-300: #9ea0e7;
  --iris-400: #7c7ee5;
  --iris-500: #575ad0;
  --iris-700: #33357a;
  --deep-500: #304d6d;
  --gold-200: #ffd156;
  --gold-300: #f5b71c;

  --bg: #01020f;
  --bg-deep: #00010a;
  --bg-card: #06071a;
  --bg-elevated: #0d0f28;

  --fg: #e1e1e3;
  --fg-muted: #9ea4b2;
  --fg-faint: #6b7280;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-soft: rgba(255, 255, 255, 0.05);

  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --font-sans: "DM Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --maxw: 1120px;
  --gutter: 16px;

  /* Deliberately single-theme: this is a dark product surface, not a
     light page inverted. Tell the UA so controls and scrollbars follow. */
  color-scheme: dark;
}

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

/* Any element given an explicit display overrides the UA's
   [hidden] { display: none }, so restate it with priority. Without this,
   .download-ready { display: grid } renders while still marked hidden. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--fg);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(87, 90, 208, 0.18), transparent 60%),
    radial-gradient(ellipse 50% 40% at 95% 100%, rgba(48, 77, 109, 0.22), transparent 60%),
    linear-gradient(180deg, #01020f 0%, #00010a 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection {
  background: rgba(87, 90, 208, 0.35);
  color: #fff;
}

img,
svg {
  max-width: 100%;
  display: block;
}

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

a:hover {
  color: var(--iris-200);
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(87, 90, 208, 0.7);
  border-radius: var(--radius-sm);
}

/* ---------- layout primitives ---------- */

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section {
  padding-block: clamp(56px, 9vw, 104px);
  position: relative;
}

.rule {
  border: 0;
  border-top: 1px solid var(--hairline-soft);
  margin: 0;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--iris-300);
  margin: 0 0 14px;
}

h1,
h2,
h3 {
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 4.4vw, 3.15rem);
  font-weight: 700;
}

h2 {
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 700;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

.lede {
  font-size: clamp(1rem, 1.8vw, 1.1875rem);
  color: var(--fg-muted);
  max-width: 62ch;
}

.section-head {
  margin-bottom: clamp(32px, 5vw, 52px);
  max-width: 68ch;
}

.section-head p {
  margin-top: 14px;
  color: var(--fg-muted);
}

/* ---------- glass + pills ---------- */

.glass {
  background: rgba(13, 15, 40, 0.6);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-lg);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.pill-iris {
  background: linear-gradient(135deg, rgba(87, 90, 208, 0.22), rgba(87, 90, 208, 0.08));
  border: 1px solid rgba(87, 90, 208, 0.35);
  color: #c9cafc;
}

.pill-gold {
  background: linear-gradient(135deg, rgba(245, 183, 28, 0.22), rgba(245, 183, 28, 0.08));
  border: 1px solid rgba(245, 183, 28, 0.4);
  color: var(--gold-200);
}

.pill-muted {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  color: var(--fg-muted);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--gold-300);
  box-shadow: 0 0 8px rgba(245, 183, 28, 0.8);
  flex: none;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease,
    transform 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--iris-500);
  color: #fff;
  box-shadow: 0 0 20px rgba(87, 90, 208, 0.4);
}

.btn-primary:hover {
  background: #6467dc;
  color: #fff;
  box-shadow: 0 0 30px rgba(87, 90, 208, 0.6);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--hairline);
  color: var(--fg);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  background: rgba(1, 2, 15, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline-soft);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.0625rem;
}

.brand:hover {
  color: #fff;
}

.brand svg {
  width: 26px;
  height: 26px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-inline-start: auto;
  font-size: 0.875rem;
}

.nav-links a {
  color: var(--fg-muted);
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-cta {
  margin-inline-start: auto;
}

.nav-links + .nav-cta {
  margin-inline-start: 4px;
}

@media (max-width: 720px) {
  .nav-links {
    display: none;
  }
}

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

.hero {
  padding-block: clamp(48px, 8vw, 88px) clamp(40px, 6vw, 72px);
}

.hero-grid {
  display: grid;
  gap: clamp(36px, 5vw, 56px);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

@media (min-width: 980px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  }
}

.hero h1 {
  margin-bottom: 20px;
}

.hero h1 .accent {
  background: linear-gradient(135deg, var(--iris-300) 0%, var(--gold-300) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

/* ---------- app preview ---------- */

.preview {
  padding: 0;
  overflow: hidden;
  font-size: 13px;
}

.preview-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, 0.015);
}

.tl {
  display: flex;
  gap: 6px;
}

.tl i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.preview-title {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
  margin-inline: auto;
}

.tbl {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.5fr) 54px 46px 92px;
  gap: 10px;
  padding: 9px 14px;
  align-items: center;
}

.tbl-head {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  border-bottom: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, 0.015);
}

.tbl-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
}

.tbl-row.anchor {
  background: rgba(87, 90, 208, 0.12);
  box-shadow: inset 2px 0 0 var(--iris-400);
}

.cell-title {
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-bpm {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  color: var(--fg);
}

.keychip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: rgba(87, 90, 208, 0.18);
  border: 1px solid rgba(87, 90, 208, 0.3);
  color: var(--iris-200);
}

.keychip.match {
  background: rgba(245, 183, 28, 0.18);
  border-color: rgba(245, 183, 28, 0.38);
  color: var(--gold-200);
}

.meter {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(48, 77, 109, 0.85) 0%,
    rgba(87, 90, 208, 0.9) 55%,
    rgba(245, 183, 28, 0.95) 100%
  );
}

.col-energy {
  display: block;
}

.preview-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--hairline-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-faint);
  background: rgba(255, 255, 255, 0.015);
  flex-wrap: wrap;
}

.preview-note {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-faint);
  text-align: center;
}

@media (max-width: 560px) {
  .tbl {
    grid-template-columns: minmax(0, 2fr) 48px 44px;
  }
  .tbl .cell-sub,
  .tbl .col-energy {
    display: none;
  }
}

/* ---------- cards ---------- */

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.card {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: rgba(6, 7, 26, 0.55);
  border: 1px solid var(--hairline-soft);
  transition: border-color 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
}

.card:hover {
  border-color: rgba(87, 90, 208, 0.34);
  background: rgba(13, 15, 40, 0.6);
  transform: translateY(-2px);
}

.card h3 {
  margin-bottom: 9px;
}

.card p {
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

.icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(87, 90, 208, 0.22), rgba(48, 77, 109, 0.14));
  border: 1px solid rgba(87, 90, 208, 0.3);
  color: var(--iris-200);
}

.icon svg {
  width: 17px;
  height: 17px;
}

/* ---------- steps ---------- */

.steps {
  display: grid;
  gap: 18px;
  counter-reset: step;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.step {
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline-soft);
  background: rgba(6, 7, 26, 0.45);
}

.step::before {
  counter-increment: step;
  content: "0" counter(step);
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--gold-300);
  margin-bottom: 14px;
}

.step h3 {
  margin-bottom: 9px;
}

.step p {
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

/* ---------- code block ---------- */

.code {
  margin: 0;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-deep);
  border: 1px solid var(--hairline-soft);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--iris-100);
  overflow-x: auto;
}

.code .c {
  color: var(--fg-faint);
}

.code .p {
  color: var(--gold-300);
}

/* ---------- honest / spec list ---------- */

.speclist {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.speclist li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline-soft);
  font-size: 0.9375rem;
  color: var(--fg-muted);
}

.speclist li:last-child {
  border-bottom: 0;
}

.speclist b {
  color: var(--fg);
  font-weight: 600;
}

.speclist svg {
  width: 17px;
  height: 17px;
  margin-top: 3px;
}

.yes {
  color: var(--iris-300);
}

.no {
  color: var(--fg-faint);
}

.two-col {
  display: grid;
  gap: clamp(28px, 4vw, 48px);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 900px) {
  .two-col {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ---------- signup ---------- */

.signup {
  padding: clamp(28px, 4vw, 44px);
  text-align: center;
}

.signup h2 {
  margin-bottom: 14px;
}

.signup .lede {
  margin-inline: auto;
}

.form {
  display: flex;
  gap: 10px;
  margin: 26px auto 0;
  max-width: 440px;
  flex-wrap: wrap;
}

.form input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: rgba(0, 1, 10, 0.6);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
}

.form input::placeholder {
  color: var(--fg-faint);
}

.form input:focus {
  border-color: rgba(87, 90, 208, 0.6);
}

.form .btn {
  flex: 0 0 auto;
}

.form-msg {
  margin-top: 14px;
  font-size: 0.875rem;
  min-height: 1.4em;
}

.form-msg[data-state="error"] {
  color: #ff9d9d;
}

.form-msg[data-state="ok"] {
  color: var(--gold-200);
}

.fineprint {
  margin-top: 12px;
  font-size: 0.8125rem;
  color: var(--fg-faint);
}

/* ---------- faq ---------- */

.faq {
  display: grid;
  gap: 10px;
  max-width: 820px;
}

details {
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  background: rgba(6, 7, 26, 0.45);
  overflow: hidden;
}

details[open] {
  border-color: rgba(87, 90, 208, 0.28);
}

summary {
  cursor: pointer;
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: -0.01em;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  margin-inline-start: auto;
  font-family: var(--font-mono);
  color: var(--iris-300);
  font-size: 1.125rem;
  line-height: 1;
  flex: none;
}

details[open] summary::after {
  content: "\2212";
}

details p {
  padding: 0 20px 18px;
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

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

footer {
  border-top: 1px solid var(--hairline-soft);
  padding-block: 36px;
  color: var(--fg-faint);
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--fg-muted);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- pay-what-you-want tiers ---------- */

.tiers {
  display: grid;
  gap: 10px;
}

.tier {
  display: grid;
  gap: 4px;
  padding: 15px 17px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: rgba(0, 1, 10, 0.4);
  color: var(--fg);
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.tier:hover {
  border-color: rgba(87, 90, 208, 0.5);
  background: rgba(87, 90, 208, 0.1);
  color: var(--fg);
  transform: translateY(-1px);
}

.tier-featured {
  border-color: rgba(245, 183, 28, 0.35);
  background: rgba(245, 183, 28, 0.06);
}

.tier-featured:hover {
  border-color: rgba(245, 183, 28, 0.6);
  background: rgba(245, 183, 28, 0.12);
}

.tier-amt {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.tier-label {
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.tier[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Download and tip cards sit side by side — match their heights. */
#get .two-col {
  align-items: stretch;
}

/* ---------- gated download form ---------- */

.stack-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
  letter-spacing: -0.005em;
}

.field input {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline);
  background: rgba(0, 1, 10, 0.6);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
}

.field input::placeholder {
  color: var(--fg-faint);
}

.field input:focus {
  border-color: rgba(87, 90, 208, 0.6);
}

.stack-form .btn {
  width: 100%;
  margin-top: 2px;
}

.download-ready {
  display: grid;
  gap: 12px;
  padding: 18px;
  margin-top: 4px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 183, 28, 0.35);
  background: rgba(245, 183, 28, 0.07);
}

.download-ready-head {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gold-200);
}

/* ---------- alternative payment methods ---------- */

.alt-pay {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 14px;
  font-size: 0.875rem;
}

.alt-pay-label {
  color: var(--fg-faint);
}

.alt-pay-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--iris-300);
}

.alt-pay-link:hover {
  color: var(--iris-200);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- analysis section ---------- */

.analysis-note {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline-soft);
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

.signal-card {
  padding: clamp(22px, 3vw, 30px);
}

.signal-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 20px;
}

.signal-rows {
  display: grid;
  gap: 15px;
}

.signal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.signal-label {
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.signal-out {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline-soft);
}

.signal-out-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-200);
}

.signal-out-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--gold-200);
  font-variant-numeric: tabular-nums;
}

.signal-foot {
  margin-top: 14px;
  font-size: 0.8125rem;
  color: var(--fg-faint);
  line-height: 1.55;
}

/* ==========================================================================
   Animated figures
   --------------------------------------------------------------------------
   Every animation here runs FROM a start state TO the element's natural
   resting state, and only once .in-view is set by main.js. With JS disabled,
   or with prefers-reduced-motion, nothing is left mid-flight: the page renders
   in its finished state, which is what a thumbnail or a screen reader gets.
   ========================================================================== */

.fig {
  margin: 28px 0 0;
}

.fig svg {
  width: 100%;
  height: auto;
  color: var(--fg-muted);
}

.fig figcaption {
  margin-top: 14px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--fg-faint);
  max-width: 62ch;
}

.fig figcaption b {
  color: var(--iris-200);
  font-weight: 600;
}

/* ---------- narrowing funnel ---------- */

.fbar {
  fill: rgba(87, 90, 208, 0.55);
  transform-origin: left center;
}

.fbar-hot {
  fill: var(--gold-300);
}

.fig-cap,
.fig-step {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  fill: var(--fg-faint);
}

.fig-step {
  letter-spacing: 0.04em;
  text-transform: none;
  font-size: 11px;
}

.fig-n {
  font-family: var(--font-mono);
  font-size: 15px;
  fill: var(--fg);
  /* Sits to the RIGHT of each bar. Anchoring at the end pulls the number back
     over the bar it is labelling. */
  text-anchor: start;
}

.fig-n-hot {
  fill: var(--gold-200);
}

.fig-sub {
  font-size: 12.5px;
  fill: var(--fg-muted);
}

.fline {
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1.5;
}

[data-animate="funnel"].in-view .fbar {
  animation: funnel-narrow 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-animate="funnel"].in-view .fbar:nth-of-type(1) { animation-delay: 0ms; }
[data-animate="funnel"].in-view .fbar:nth-of-type(2) { animation-delay: 260ms; }
[data-animate="funnel"].in-view .fbar:nth-of-type(3) { animation-delay: 520ms; }
[data-animate="funnel"].in-view .fbar:nth-of-type(4) { animation-delay: 780ms; }

@keyframes funnel-narrow {
  from { transform: scaleX(var(--from)); opacity: 0.35; }
  to   { transform: scaleX(1);           opacity: 1; }
}

/* ---------- Camelot wheel ---------- */

.fig-wheel {
  margin-top: 22px;
}

.fig-wheel svg {
  max-width: 300px;
  margin-inline: auto;
}

.seg {
  fill: rgba(255, 255, 255, 0.045);
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1;
}

.seg-ok {
  fill: rgba(87, 90, 208, 0.45);
  stroke: rgba(126, 128, 229, 0.7);
}

.seg-anchor {
  fill: rgba(245, 183, 28, 0.5);
  stroke: rgba(245, 183, 28, 0.85);
}

.wl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--fg-faint);
  text-anchor: middle;
}

.wl-hot {
  fill: #fff;
}

/* The anchor lands first, then the three keys it opens up. */
[data-animate="wheel"].in-view .seg-anchor {
  animation: seg-land 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-animate="wheel"].in-view .seg-ok {
  animation: seg-land 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* nth-of-type counts paths, not .seg-ok paths, so the stagger is carried
   per-element as --d instead. */
[data-animate="wheel"].in-view .seg-ok { animation-delay: var(--d, 0ms); }

@keyframes seg-land {
  from { fill: rgba(255, 255, 255, 0.045); stroke: rgba(255, 255, 255, 0.07); }
}

/* ---------- energy ranking demo ---------- */

.ranking-demo {
  display: grid;
  gap: clamp(24px, 4vw, 44px);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  margin-bottom: clamp(32px, 5vw, 52px);
  padding: clamp(24px, 3.5vw, 34px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline-soft);
  background: rgba(6, 7, 26, 0.45);
}

@media (min-width: 900px) {
  .ranking-demo {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  }
}

.ranking-head h3 {
  font-size: clamp(1.125rem, 2vw, 1.4rem);
  margin: 12px 0 10px;
}

.ranking-head p {
  color: var(--fg-muted);
  font-size: 0.9375rem;
}

.rank-replay {
  margin-top: 18px;
  padding: 9px 15px;
  font-size: 0.875rem;
}

.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  --row-h: 44px;
}

.rank-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 90px 26px;
  align-items: center;
  gap: 12px;
  height: 38px;
  padding-inline: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.045);
}

.rank-pos {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
}

.rank-name {
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-val {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.rank-row:first-child .rank-val {
  color: var(--gold-200);
}

/* Each row flies in from where alphabetical order would have put it.
   Driven by a transition rather than a filled animation: JS sets .rank-from,
   forces a reflow, then removes it, so the rows travel TO their resting
   state. If transitions never run the rows simply appear finished — they can
   never be left stranded off-screen or at zero opacity, which is the failure
   mode a filled animation would have. */
.rank-row {
  transform: translateY(0);
  opacity: 1;
  transition: transform 780ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 420ms ease-out;
}

.ranking-demo.rank-from .rank-row {
  transform: translateY(calc(var(--shift) * var(--row-h)));
  opacity: 0;
  transition: none;
}

.rank-meter > span {
  transform: scaleX(1);
  transition: transform 700ms 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ranking-demo.rank-from .rank-meter > span {
  transform: scaleX(0);
  transition: none;
}

@keyframes meter-fill {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.meter > span {
  transform-origin: left center;
}

/* ---------- signal card ---------- */

[data-animate="signals"].in-view .meter > span {
  animation: meter-fill 800ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-animate="signals"].in-view .signal-row:nth-child(1) .meter > span { animation-delay: 0ms; }
[data-animate="signals"].in-view .signal-row:nth-child(2) .meter > span { animation-delay: 110ms; }
[data-animate="signals"].in-view .signal-row:nth-child(3) .meter > span { animation-delay: 220ms; }
[data-animate="signals"].in-view .signal-row:nth-child(4) .meter > span { animation-delay: 330ms; }

@media (prefers-reduced-motion: reduce) {
  /* Snap straight to the finished state rather than racing through it. */
  .rank-row,
  .rank-meter > span {
    transition: none !important;
  }

  [data-animate].in-view .fbar,
  [data-animate].in-view .seg,
  [data-animate].in-view .meter > span {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
