/* fast-vollib showcase -- dark, high-contrast, portrait-first.
   No external fonts or stylesheets: the folder is self-contained. */

:root {
  --bg: #070b11;
  --bg-raised: #0d141d;
  --bg-card: #101922;
  --line: #1d2938;
  --line-soft: #16202c;
  --ink: #e8eef7;
  --ink-dim: #9db0c7;
  --ink-faint: #6b7f97;
  --accent: #4ec9c0;
  --accent-warm: #ebbd4a;
  --danger: #e84a4a;
  --ok: #63c98b;
  --svi: #5c8fe0;
  --ssvi: #4ec9c0;
  --spline: #ebbd4a;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
:root { --heston: #c77dd8; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

/* Ambient wash. Purely decorative, so it is hidden from assistive tech. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 520px at 78% -8%, rgba(78, 201, 192, 0.10), transparent 62%),
    radial-gradient(760px 480px at 8% 4%, rgba(92, 143, 224, 0.10), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
main, .site-header, footer { position: relative; z-index: 1; }

a { color: var(--accent); }
h1, h2, h3 { line-height: 1.18; letter-spacing: -0.018em; margin: 0 0 0.5rem; }
h1 { font-size: clamp(2rem, 6.2vw, 3.7rem); font-weight: 650; }
h2 { font-size: clamp(1.45rem, 3.6vw, 2.15rem); font-weight: 620; }
h3 { font-size: 1.08rem; font-weight: 600; }
p { margin: 0 0 1rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0; padding: 0.7rem 1rem;
  background: var(--accent); color: #04120f; font-weight: 600; z-index: 99;
}
.skip-link:focus { left: 0; }

:where(a, button, [tabindex], summary, input, canvas[tabindex], svg[tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* --- header ------------------------------------------------------------- */
.site-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0;
  background: rgba(7, 11, 17, 0.86);
  backdrop-filter: blur(10px);
  z-index: 40;
  flex-wrap: wrap;
}
.brand { font-family: var(--mono); font-weight: 600; color: var(--ink); text-decoration: none; letter-spacing: 0.02em; }
.brand span { color: var(--ink-faint); }
.site-header nav { display: flex; gap: 0.35rem; margin-left: auto; flex-wrap: wrap; }
.site-header nav a {
  color: var(--ink-dim); text-decoration: none; font-size: 0.83rem;
  padding: 0.32rem 0.62rem; border-radius: 7px;
}
.site-header nav a:hover { color: var(--ink); background: var(--bg-raised); }

/* --- buttons ------------------------------------------------------------ */
.button, .ghost {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.6rem 1.05rem; border-radius: 9px; font-size: 0.9rem; font-weight: 560;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  font-family: inherit;
}
.button { background: var(--accent); color: #04120f; }
.button:hover { filter: brightness(1.08); }
.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.ghost:hover { border-color: var(--accent); color: var(--accent); }
.button-small { padding: 0.42rem 0.8rem; font-size: 0.82rem; }

/* --- layout ------------------------------------------------------------- */
main { max-width: 1180px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 3rem) 4rem; }
.chapter { margin: clamp(3rem, 8vw, 5.5rem) 0; scroll-margin-top: 5rem; }
.eyebrow {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 0.5rem;
}
.lede { font-size: clamp(1rem, 2.3vw, 1.16rem); color: var(--ink-dim); max-width: 62ch; }
.chapter-intro { max-width: 66ch; margin-bottom: 1.5rem; }

/* --- hero --------------------------------------------------------------- */
.hero { padding: clamp(2rem, 6vw, 4rem) 0 1rem; }
.hero-top { display: grid; gap: 2rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .hero-top { grid-template-columns: 1.05fr 0.95fr; } }
.install {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.92rem;
  background: var(--bg-card); border: 1px solid var(--line);
  padding: 0.6rem 0.9rem; border-radius: 10px; margin: 1.1rem 0;
  max-width: max-content;
}
.install code { color: var(--accent); }
.install button {
  background: none; border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: 6px; padding: 0.15rem 0.5rem; font-size: 0.75rem; cursor: pointer;
  font-family: var(--mono);
}
.hero-links { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.hero-links a {
  font-size: 0.82rem; color: var(--ink-dim); text-decoration: none;
  border: 1px solid var(--line); padding: 0.34rem 0.7rem; border-radius: 999px;
}
.hero-links a:hover { border-color: var(--accent); color: var(--accent); }

/* --- reel-style Greeks panel -------------------------------------------- */
.greeks-reel {
  background: linear-gradient(180deg, #0a1017, #070b11);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; overflow: hidden;
}
.reel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem;
}
.reel-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; font-family: var(--mono); font-size: 0.75rem; }
.reel-chips span { background: var(--bg-raised); border: 1px solid var(--line); padding: 0.2rem 0.5rem; border-radius: 6px; color: var(--ink-dim); }
.reel-readout {
  font-family: var(--mono); font-size: clamp(1.5rem, 5vw, 2.3rem);
  font-weight: 600; color: var(--accent-warm); font-variant-numeric: tabular-nums;
  line-height: 1;
}
.reel-readout small { display: block; font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); font-weight: 500; }
.reel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
@media (max-width: 560px) { .reel-grid { grid-template-columns: 1fr; } }
.reel-panel { background: var(--bg-card); border: 1px solid var(--line-soft); border-radius: 10px; padding: 0.5rem 0.55rem 0.2rem; min-width: 0; }
.reel-panel h4 { margin: 0; font-size: 0.82rem; font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; white-space: nowrap; }
.reel-panel h4 > span:first-child { flex: 0 0 auto; }
.reel-panel .formula { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reel-panel svg { width: 100%; height: auto; display: block; }
.reel-controls { display: flex; gap: 0.6rem; align-items: center; margin-top: 0.7rem; flex-wrap: wrap; }

/* --- cards / viz -------------------------------------------------------- */
.viz-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem clamp(0.8rem, 2vw, 1.3rem) 1.1rem;
}
.viz-toolbar {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  margin-bottom: 0.8rem; font-size: 0.82rem; color: var(--ink-dim);
}
.viz-toolbar .spacer { margin-left: auto; }
canvas.surface { width: 100%; height: clamp(320px, 40vw, 430px); display: block; touch-action: none; cursor: grab; }
canvas.surface:active { cursor: grabbing; }
svg.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .zero-line { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.65; }
.chart .tick { fill: var(--ink-faint); font-size: 11px; font-family: var(--mono); }
.chart .axis-label { fill: var(--ink-dim); font-size: 12px; }
.chart .cell-mark { fill: #fff; font-size: 11px; font-family: var(--mono); pointer-events: none; }

.legend { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: 0.6rem; font-size: 0.79rem; color: var(--ink-dim); }
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-item em { color: var(--ink-faint); font-style: normal; font-size: 0.72rem; }

/* --- controls ----------------------------------------------------------- */
.segmented { display: inline-flex; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  background: none; border: none; color: var(--ink-dim); font-family: inherit;
  font-size: 0.8rem; padding: 0.34rem 0.72rem; border-radius: 7px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--accent); color: #04120f; font-weight: 600; }

.scrubber { display: flex; align-items: center; gap: 0.7rem; margin-top: 0.9rem; flex-wrap: wrap; }
.scrubber input[type="range"] { flex: 1 1 220px; accent-color: var(--accent); min-width: 160px; }
.date-readout { font-family: var(--mono); font-size: 0.9rem; color: var(--accent-warm); font-variant-numeric: tabular-nums; min-width: 9.5ch; }

.sliders { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.slider-row label { display: block; font-size: 0.78rem; color: var(--ink-dim); margin-bottom: 0.2rem; font-family: var(--mono); }
.slider-row input { width: 100%; accent-color: var(--accent); }
.slider-row output { float: right; color: var(--accent-warm); font-variant-numeric: tabular-nums; }

/* --- tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin-top: 0.9rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.84rem; min-width: 480px; }
th, td { text-align: right; padding: 0.44rem 0.6rem; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; font-variant-numeric: normal; }
thead th { color: var(--ink-faint); font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; }
tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
td.good { color: var(--ok); }
td.bad { color: var(--danger); }
.pill { display: inline-block; padding: 0.08rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-family: var(--mono); }
.pill.ok { background: rgba(99, 201, 139, 0.16); color: var(--ok); }
.pill.bad { background: rgba(232, 74, 74, 0.16); color: var(--danger); }

/* --- notes -------------------------------------------------------------- */
.note, .caption {
  font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.7rem; line-height: 1.5;
}
.caption { font-style: normal; border-left: 2px solid var(--line); padding-left: 0.7rem; }
.data-notice {
  background: var(--bg-raised); border: 1px solid var(--line); border-left: 3px solid var(--accent-warm);
  border-radius: 10px; padding: 0.8rem 1rem; font-size: 0.85rem; color: var(--ink-dim); margin: 1.5rem 0;
}
details { margin-top: 0.8rem; border-top: 1px solid var(--line-soft); padding-top: 0.6rem; }
summary { cursor: pointer; font-size: 0.82rem; color: var(--ink-dim); }
details p { font-size: 0.82rem; color: var(--ink-faint); margin-top: 0.6rem; }

.grid-2 { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 860px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat-row { display: flex; gap: 1.4rem; flex-wrap: wrap; margin: 1rem 0; }
.stat { min-width: 120px; }
.stat b { display: block; font-family: var(--mono); font-size: 1.35rem; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.stat span { font-size: 0.74rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.07em; }

/* --- signup ------------------------------------------------------------- */
.signup-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; }
.signup-card[hidden] { display: none; }
#clerk-mount { margin-top: 1rem; min-height: 40px; }
.consent { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 0.85rem; color: var(--ink-dim); margin: 0.9rem 0; }
.consent input { margin-top: 0.28rem; accent-color: var(--accent); }
.fallback-note { font-size: 0.85rem; color: var(--ink-dim); }

/* --- footer ------------------------------------------------------------- */
footer {
  border-top: 1px solid var(--line-soft); margin-top: 3rem;
  padding: 1.6rem clamp(1rem, 4vw, 3rem) 2.5rem;
  font-size: 0.79rem; color: var(--ink-faint);
}
footer .repro { font-family: var(--mono); font-size: 0.74rem; line-height: 1.8; word-break: break-word; }
footer a { color: var(--ink-dim); }

/* --- motion ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
