/* ============================================================
   Cascade Hydro — marketing site (static)
   Hydro Cyan brand, light + dark. Palette aligns with the
   desktop app (plot_theme.py) and the account portal.
   Theme is variable-driven: dark is the default, light applies
   via prefers-color-scheme and via [data-theme] (explicit toggle).
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #0a121b;
  --surface: #0f1923;
  --panel: #16263a;
  --panel-2: #1c3148;
  --hair: rgba(208, 220, 232, 0.08);
  --hair-2: rgba(208, 220, 232, 0.15);
  --text: #e7eef5;
  --text-2: #9fb2c4;
  --text-3: #5d748d;
  --accent: #22d3ee;
  --accent-hi: #5ce0f2;
  --accent-deep: #0e7490;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --accent-ink: #06222b;
  --green: #5fd6a0;
  --glow: radial-gradient(900px 500px at 80% -8%, rgba(34, 211, 238, 0.10), transparent 70%);
  --nav-bg: rgba(10, 18, 27, 0.65);
  --btn-shadow: 0 8px 24px rgba(14, 116, 144, 0.30);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  --card-shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.38);
  --frame-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);

  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1120px;
  --font-sans: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

/* Light palette — warm cream + deep teal (matches the app's light mode). */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) { color-scheme: light; }
}
:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f1ebe1;
    --surface: #f7f3ec;
    --panel: #ffffff;
    --panel-2: #fbf8f2;
    --hair: rgba(20, 40, 50, 0.10);
    --hair-2: rgba(20, 40, 50, 0.18);
    --text: #16282f;
    --text-2: #4f6470;
    --text-3: #7d8f99;
    --accent: #0b6076;
    --accent-hi: #0d7488;
    --accent-deep: #084d5e;
    --accent-soft: rgba(11, 96, 118, 0.10);
    --accent-ink: #ffffff;
    --green: #2f8f63;
    --glow: radial-gradient(900px 500px at 80% -8%, rgba(11, 96, 118, 0.08), transparent 70%);
    --nav-bg: rgba(247, 243, 236, 0.72);
    --btn-shadow: 0 8px 24px rgba(11, 96, 118, 0.18);
    --card-shadow: 0 1px 2px rgba(30, 50, 60, 0.06);
    --card-shadow-hover: 0 14px 30px rgba(30, 50, 60, 0.14);
    --frame-shadow: 0 26px 60px rgba(30, 50, 60, 0.18);
  }
}
:root[data-theme="light"] {
  --bg: #f1ebe1;
  --surface: #f7f3ec;
  --panel: #ffffff;
  --panel-2: #fbf8f2;
  --hair: rgba(20, 40, 50, 0.10);
  --hair-2: rgba(20, 40, 50, 0.18);
  --text: #16282f;
  --text-2: #4f6470;
  --text-3: #7d8f99;
  --accent: #0b6076;
  --accent-hi: #0d7488;
  --accent-deep: #084d5e;
  --accent-soft: rgba(11, 96, 118, 0.10);
  --accent-ink: #ffffff;
  --green: #2f8f63;
  --glow: radial-gradient(900px 500px at 80% -8%, rgba(11, 96, 118, 0.08), transparent 70%);
  --nav-bg: rgba(247, 243, 236, 0.72);
  --btn-shadow: 0 8px 24px rgba(11, 96, 118, 0.18);
  --card-shadow: 0 1px 2px rgba(30, 50, 60, 0.06);
  --card-shadow-hover: 0 14px 30px rgba(30, 50, 60, 0.14);
  --frame-shadow: 0 26px 60px rgba(30, 50, 60, 0.18);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image: var(--glow);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a { color: var(--text); text-decoration: none; transition: color .18s ease; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

::selection { background: var(--accent-soft); color: var(--text); }

/* ---- Nav ---------------------------------------------------- */
header.nav {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--hair);
  background: var(--nav-bg);
  backdrop-filter: blur(16px) saturate(140%);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { height: 22px; width: auto; display: block; }
.brand-mark .p1 { fill: var(--accent); }
.brand-mark .p2 { fill: var(--accent-deep); }
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--text); }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a:not(.btn) { color: var(--text-2); font-size: 0.93rem; font-weight: 500; }
.nav-links a:not(.btn):hover { color: var(--text); }

.theme-toggle {
  background: transparent; color: var(--text-2);
  border: 1px solid var(--hair-2); border-radius: 8px;
  width: 34px; height: 34px; cursor: pointer; font-size: 15px; line-height: 1;
  display: grid; place-items: center;
  transition: color .16s ease, border-color .16s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

/* ---- Buttons ------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600;
  padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
  letter-spacing: -0.01em;
}
.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(150deg, var(--accent), var(--accent-deep));
  box-shadow: var(--btn-shadow);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-ghost {
  color: var(--text); background: transparent; border-color: var(--hair-2);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

/* ---- Eyebrow / section scaffolding -------------------------- */
.eyebrow {
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 22px;
}
.section { padding: 104px 0; }
.section h2 {
  font-size: clamp(1.9rem, 3.4vw, 2.5rem); font-weight: 600;
  letter-spacing: -0.025em; line-height: 1.12;
}
.section .sub { color: var(--text-2); font-size: 1.08rem; margin-top: 12px; max-width: 560px; }

/* ---- Hero --------------------------------------------------- */
.hero { position: relative; padding: 128px 0 96px; overflow: hidden; }
.hero .curve-motif {
  position: absolute; top: -40px; right: -80px; width: 720px; max-width: 70vw;
  opacity: 0.6; pointer-events: none; z-index: 0;
  mask-image: linear-gradient(to left, #000 30%, transparent 92%);
}
.hero .curve-motif .curves path { stroke: var(--accent); fill: none; }
.hero .curve-motif .axes line { stroke: var(--hair-2); }
.hero .container { position: relative; z-index: 1; }
.hero h1 {
  font-weight: 700; font-size: clamp(2.6rem, 5.6vw, 4.4rem);
  line-height: 1.04; letter-spacing: -0.035em; max-width: 16ch;
}
.hero h1 .accent {
  background: linear-gradient(100deg, var(--accent), var(--accent-hi));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead {
  color: var(--text-2); font-size: 1.22rem; max-width: 540px;
  margin: 26px 0 38px; line-height: 1.55;
}
.hero .actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero .actions .note { color: var(--text-3); font-size: 0.86rem; margin-left: 6px; }

/* ---- Hero product shot -------------------------------------- */
.shot-band { padding: 16px 0 0; }
.app-frame {
  max-width: 940px; margin: 0 auto;
  border: 1px solid var(--hair-2); border-radius: 14px; overflow: hidden;
  background: var(--panel); box-shadow: var(--frame-shadow);
}
.app-frame-bar {
  height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--hair);
}
.app-frame-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--hair-2); }
/* NB: no `display` here — the visibility toggles below own it (avoids a
   specificity clash that would force both screenshots visible). */
.app-frame .shot { width: 100%; height: auto; }
/* Theme-swap the screenshot to match the active palette. Explicit [data-theme]
   rules override the OS-based defaults. */
.shot-light { display: none; }
.shot-dark { display: block; }
@media (prefers-color-scheme: light) {
  .shot-light { display: block; }
  .shot-dark { display: none; }
}
:root[data-theme="dark"] .shot-light { display: none; }
:root[data-theme="dark"] .shot-dark { display: block; }
:root[data-theme="light"] .shot-light { display: block; }
:root[data-theme="light"] .shot-dark { display: none; }

/* ---- How it works (steps) ----------------------------------- */
.steps { display: flex; align-items: stretch; margin-top: 44px; }
.step {
  flex: 1; display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--hair-2); border-radius: 14px;
  overflow: hidden; box-shadow: var(--card-shadow);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.step:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }

.step-art {
  background: var(--panel-2); border-bottom: 1px solid var(--hair);
  padding: 10px 14px;
}
.step-art svg { display: block; width: 100%; height: auto; }
.step-art .ax { stroke: var(--hair-2); stroke-width: 1; }
.step-art .bars rect { fill: var(--accent); opacity: 0.85; }
.step-art .fit { fill: none; stroke: var(--accent); stroke-width: 2; }
.step-art .pts circle { fill: var(--accent); }
.step-art .flag circle { fill: #ef6b5e; }
.step-art .flag .ring { fill: none; stroke: #ef6b5e; stroke-width: 1.6; }
.step-art .idf path { fill: none; stroke: var(--accent); stroke-width: 2; }

.step-body { padding: 22px 24px 26px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft);
  font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600;
}
.step-head h3 { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.01em; }
.step-body p { color: var(--text-2); font-size: 0.97rem; line-height: 1.6; }

.step-arrow { flex: none; display: flex; align-items: center; padding: 0 16px; }
.step-arrow .chev { width: 22px; height: 22px; }
.step-arrow .chev path { fill: none; stroke: var(--text-3); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Validation charts ------------------------------------- */
.vchart-wrap {
  background: var(--panel); border: 1px solid var(--hair-2); border-radius: 14px;
  padding: 22px 22px 14px; box-shadow: var(--card-shadow);
}
.vchart { width: 100%; height: auto; display: block; }
.vchart .axis { stroke: var(--hair-2); stroke-width: 1; }
.vchart .oneone { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 5 4; }
.vchart .pt { fill: var(--accent); }
.vchart .tick { fill: var(--text-2); font-family: var(--font-mono); font-size: 10px; }
.vchart .axis-title { fill: var(--text-3); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; }
.vchart-wrap figcaption { color: var(--text-3); font-size: 0.82rem; margin-top: 12px; text-align: center; }

/* ---- King map + alternating validation rows ---------------- */
.vchart-wrap, .mapfig { position: relative; }
.mapfig {
  background: var(--panel); border: 1px solid var(--hair-2); border-radius: 16px;
  padding: 26px 26px 18px; box-shadow: var(--card-shadow); margin: 40px 0 80px;
}
.mapfig-title { font-size: 1.45rem; margin: 0 0 6px; }
.mapfig-sub { color: var(--text-2); margin: 0 0 14px; max-width: 660px; }
.mapfig figcaption { color: var(--text-3); font-size: 0.82rem; margin-top: 10px; }
.vstack { display: flex; flex-direction: column; gap: 84px; }
.vrow { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.vrow.flip .vrow-fig { order: -1; }
.vrow-copy h3 { font-size: 1.45rem; line-height: 1.18; margin: 6px 0 0; }
.vrow-copy .sub { margin-top: 12px; }
.vrow-copy .btn { margin-top: 22px; }
.vchart .ref { stroke: var(--text-3); stroke-width: 1; opacity: .4; stroke-dasharray: 3 3; }
.vchart .bar { fill: var(--accent); fill-opacity: .30; transition: fill-opacity .1s ease; }
.vchart .bar.mid { fill-opacity: .85; }
.vchart .bar:hover { fill-opacity: 1; }
.vchart .zbar { fill: var(--accent); fill-opacity: .8; cursor: pointer; transition: fill-opacity .1s ease; }
.vchart .zbar:hover { fill-opacity: 1; }
.vchart .zlabel { fill: var(--text); font-family: var(--font-mono); font-size: 8.5px; }
.vchart .zval { fill: var(--text-3); font-family: var(--font-mono); font-size: 8.5px; }
.vchart .land { fill: var(--text-3); fill-opacity: .10; stroke: none; }
.vchart .ezpoly { fill: var(--text-3); fill-opacity: .07; stroke: var(--text-3); stroke-opacity: .18; stroke-width: .4; }
.vchart .coast { fill: none; stroke: var(--text); stroke-opacity: .5; stroke-width: 1; stroke-linejoin: round; stroke-linecap: round; }
.vchart .mpt { stroke: var(--panel); stroke-width: .5; cursor: pointer; pointer-events: all; transition: r .1s ease; }
.vchart .mpt:hover { r: 5; stroke: var(--text); }
.vchart .mpt.none { fill: none; stroke: var(--text-3); stroke-width: .8; }
.tip {
  position: absolute; pointer-events: none; opacity: 0; transform: translate(-50%, -115%);
  background: var(--panel); border: 1px solid var(--accent); border-radius: 9px;
  padding: 8px 11px; font-size: 12px; line-height: 1.5; white-space: nowrap;
  box-shadow: var(--card-shadow); transition: opacity .1s ease; z-index: 5; color: var(--text);
}
.tip b { color: var(--accent-hi); }
.tip .d { color: var(--text-3); }
.mlegend { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.mlegend .grad { width: 84px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #22d3ee, #fde047, #fb7185); }
.mlegend .no { margin-left: auto; }
:root[data-theme="light"] .mlegend .grad { background: linear-gradient(90deg, #0369a1, #ca8a04, #be123c); }
@media (prefers-color-scheme: light) { :root:not([data-theme]) .mlegend .grad { background: linear-gradient(90deg, #0369a1, #ca8a04, #be123c); } }

/* ---- Stats strip -------------------------------------------- */
.stats-section { padding: 64px 0 0; }
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--panel); border: 1px solid var(--hair-2);
  border-radius: var(--radius); overflow: hidden;
}
.stat {
  padding: 28px 24px; text-align: center; border-left: 1px solid var(--hair);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.stat:first-child { border-left: none; }
.stat .num {
  font-size: clamp(1.8rem, 3vw, 2.2rem); font-weight: 700; letter-spacing: -0.02em;
  color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1;
}
.stat .lbl { color: var(--text-2); font-size: 0.9rem; margin-top: 10px; line-height: 1.45; }

/* ---- Feature cards (spaced, raised — echoes the docs grid) --- */
.cards-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px; margin-top: 48px;
}
.feature-card {
  background: var(--panel); border: 1px solid var(--hair-2);
  border-radius: 14px; padding: 28px 26px; box-shadow: var(--card-shadow);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.feature-card:hover {
  border-color: var(--accent); transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}
.feature-card .ic {
  width: 42px; height: 42px; border-radius: 11px; margin-bottom: 18px;
  background: var(--accent-soft); border: 1px solid var(--hair-2);
  display: grid; place-items: center; color: var(--accent);
  font-family: var(--font-mono); font-size: 0.9rem; font-weight: 500;
}
.feature-card h3 { font-size: 1.08rem; font-weight: 600; margin-bottom: 10px; letter-spacing: -0.01em; }
.feature-card p { color: var(--text-2); font-size: 0.95rem; line-height: 1.6; }
.feature-card code { font-family: var(--font-mono); font-size: 0.85em; color: var(--accent);
  background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }

/* ---- Licensing benefits ------------------------------------- */
.license-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 44px;
}
.license-card {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--hair-2); border-radius: 14px;
  padding: 22px 24px; box-shadow: var(--card-shadow);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.license-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }
.license-ic { flex: none; width: 30px; height: 30px; margin-top: 1px; }
.license-ic svg { width: 100%; height: 100%; display: block; }
.license-ic .disc { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1; }
.license-ic .tick { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.license-card h3 { font-size: 1.04rem; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.01em; }
.license-card p { color: var(--text-2); font-size: 0.95rem; line-height: 1.55; }
.license-note { margin-top: 26px; color: var(--text-3); font-size: 0.9rem; line-height: 1.55; max-width: 660px; }

/* ---- CTA band ----------------------------------------------- */
.cta-band { padding: 88px 0; border-top: 1px solid var(--hair); }
.cta-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--hair-2); border-radius: var(--radius);
  padding: 40px 44px;
}
.cta-inner h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.cta-inner .sub { margin-top: 10px; }
.cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Footer ------------------------------------------------- */
footer { border-top: 1px solid var(--hair); margin-top: 0; padding: 40px 0; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  color: var(--text-3); font-size: 0.88rem; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--text-2); }
.footer-links a:hover { color: var(--accent); }

/* ---- Motion ------------------------------------------------- */
.fade-up { opacity: 0; transform: translateY(18px);
  animation: fadeUp .7s cubic-bezier(.21,.6,.35,1) forwards; }
.fade-up.d1 { animation-delay: .06s; }
.fade-up.d2 { animation-delay: .14s; }
.fade-up.d3 { animation-delay: .22s; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .fade-up { animation: none; opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ---- Responsive --------------------------------------------- */
@media (max-width: 860px) {
  .nav-links a:not(.btn) { display: none; }
  .hero { padding: 88px 0 64px; }
  .section { padding: 72px 0; }
  .cta-inner { padding: 32px 28px; }
  .steps { flex-direction: column; }
  .step-arrow { padding: 14px 0; justify-content: center; }
  .step-arrow .chev { transform: rotate(90deg); }
  .vstack { gap: 56px; }
  .vrow { grid-template-columns: 1fr; gap: 28px; }
  .vrow.flip .vrow-fig { order: 0; }
  .license-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr; }
  .stat { border-left: none; border-top: 1px solid var(--hair); }
  .stat:first-child { border-top: none; }
}


/* ============================================================
   Rain -> underground scroll background (canvas layer)
   ============================================================ */
    /* Full-viewport background canvas: behind all content, never interactive. */
    #rainfx {
      position: fixed; inset: 0; width: 100%; height: 100%;
      z-index: 0; pointer-events: none; display: block;
    }
    /* Lift real content above the canvas (body bg + glow stay underneath it). */
    main, footer { position: relative; z-index: 1; }
    /* Sentinel marks the end of the rain zone; the loop pauses once it's above the fold. */
    #rain-sentinel {
      position: absolute; top: 175vh; left: 0; width: 1px; height: 1px;
      pointer-events: none; opacity: 0;
    }

/* ============================================================
   Capabilities carousel (labels rail + screenshot stage)
   ============================================================ */
    .capx {
      display: grid; grid-template-columns: minmax(210px, 270px) 1fr;
      gap: 40px; margin-top: 44px; align-items: start;
    }
    /* Labels rail (acts as the tablist) */
    .capx-rail { display: flex; flex-direction: column; border-left: 1px solid var(--hair); }
    .capx-tab {
      display: flex; align-items: baseline; gap: 12px; width: 100%;
      padding: 13px 18px; margin-left: -1px; cursor: pointer; text-align: left;
      background: none; border: 0; border-left: 2px solid transparent;
      color: var(--text-2); font-family: inherit; font-size: 0.98rem; line-height: 1.35;
      transition: color .15s ease, border-color .15s ease;
    }
    .capx-tab:hover { color: var(--text); }
    .capx-tab.is-active { color: var(--text); border-left-color: var(--accent); }
    .capx-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
    .capx-idx {
      font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em;
      color: var(--text-3); flex: 0 0 auto;
    }
    .capx-tab.is-active .capx-idx { color: var(--accent); }
    .capx-label { font-weight: 600; }

    /* Stage: framed screenshot + blurb */
    .capx-stage { min-width: 0; }
    .capx-frame { max-width: none; margin: 0; }
    .capx-screens { display: grid; }               /* stack slides in one cell */
    .capx-screen {
      grid-area: 1 / 1; position: relative; aspect-ratio: 1500 / 950;
      opacity: 0; transition: opacity .4s ease;
    }
    .capx-screen.is-active { opacity: 1; }
    /* Uniform slide box: any screenshot/figure is fit inside it; odd aspects are
       centred and letterboxed against the frame panel (figure bg = --panel, so
       the bands are seamless). */
    .capx-screen .shot {
      position: absolute; inset: 0; width: 100%; height: 100%;
      object-fit: contain; object-position: center;
    }
    /* Only the active slide shows; its dark/light pick is driven by the global
       .shot-dark/.shot-light theme rules in styles.css. Hide the rest outright
       (beats those theme rules, which would otherwise leak every slide in). */
    .capx-screen:not(.is-active) .shot { display: none !important; }
    .capx-copy { display: grid; margin-top: 20px; }
    .capx-text {
      grid-area: 1 / 1; opacity: 0; pointer-events: none; transition: opacity .3s ease;
    }
    .capx-text.is-active { opacity: 1; pointer-events: auto; }
    .capx-text h3 { font-size: 1.18rem; margin-bottom: 6px; letter-spacing: -0.01em; }
    .capx-text p { color: var(--text-2); max-width: 62ch; }

    /* Table slide (sub-daily ratios) — a data view instead of a screenshot */
    .capx-screen:not(.is-active) { pointer-events: none; }
    .capx-screen-table { background: var(--panel); }
    .capx-tablewrap {
      position: absolute; inset: 0; display: flex; flex-direction: column;
      justify-content: center; gap: 14px; padding: 22px clamp(16px, 3vw, 40px);
    }
    .capx-table-cap {
      font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em;
      color: var(--text-3);
    }
    .capx-ratios { width: 100%; border-collapse: collapse; }
    .capx-ratios th, .capx-ratios td {
      padding: 9px 8px; text-align: right; font-variant-numeric: tabular-nums;
      border-bottom: 1px solid var(--hair);
    }
    .capx-ratios thead th {
      font-family: var(--font-mono); font-size: 0.74rem; font-weight: 500;
      color: var(--text-2); border-bottom: 1px solid var(--hair-2);
    }
    .capx-ratios td { font-family: var(--font-mono); font-size: 0.92rem; color: var(--text); }
    .capx-ratios th.loc, .capx-ratios td.loc { text-align: left; }
    .capx-ratios td.loc { font-family: var(--font-sans); font-weight: 600; }
    .capx-ratios th.basis, .capx-ratios td.basis { text-align: left; }
    .capx-ratios td.basis { font-family: var(--font-sans); color: var(--text-3); font-size: 0.84rem; }
    .capx-ratios td.base { color: var(--text-3); }
    .capx-ratios tbody tr:last-child td { border-bottom: 0; }
    .capx-ratios tbody tr:hover td { background: var(--accent-soft); }
    .capx-table-note { color: var(--text-2); font-size: 0.86rem; line-height: 1.5; max-width: 72ch; }

    @media (max-width: 860px) {
      .capx { grid-template-columns: 1fr; gap: 18px; }
      .capx-rail {
        flex-direction: row; border-left: 0; border-bottom: 1px solid var(--hair);
        overflow-x: auto; -webkit-overflow-scrolling: touch;
      }
      .capx-tab {
        margin-left: 0; border-left: 0; border-bottom: 2px solid transparent;
        white-space: nowrap; padding: 11px 14px;
      }
      .capx-tab.is-active { border-left-color: transparent; border-bottom-color: var(--accent); }
      .capx-ratios th.basis, .capx-ratios td.basis { display: none; }
      .capx-ratios th, .capx-ratios td { padding: 6px 4px; font-size: 0.78rem; }
      .capx-tablewrap { padding: 12px 12px; gap: 9px; }
      .capx-table-cap, .capx-table-note { font-size: 0.74rem; }
    }
    @media (prefers-reduced-motion: reduce) {
      .capx-screen, .capx-text { transition: none; }
    }
