/* vstg site styles. Zero build step, zero dependencies, same as the package it documents. */

:root {
  color-scheme: light;

  /* pure grayscale, no hue mixed in on purpose */
  --page: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #ededed;
  --surface-3: #e2e2e2;
  --text: #0d0d0d;
  --text-2: #494949;
  --text-3: #7a7a7a;
  --border: rgba(0, 0, 0, 0.10);
  --border-strong: rgba(0, 0, 0, 0.22);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 24px rgba(0, 0, 0, 0.07);

  /* the logo's exact five spectrum colors, each used on its own, never blended together */
  --spec-red: #ff1744;
  --spec-orange: #ff6d00;
  --spec-yellow: #ffd600;
  --spec-green: #00e676;
  --spec-blue: #2979ff;
  --spec-red-wash: rgba(255, 23, 68, 0.10);
  --spec-orange-wash: rgba(255, 109, 0, 0.10);
  --spec-yellow-wash: rgba(255, 214, 0, 0.14);
  --spec-green-wash: rgba(0, 230, 118, 0.12);
  --spec-blue-wash: rgba(41, 121, 255, 0.10);

  /* content on a solid spectrum fill: white on the darker hues (red, orange,
     blue), near-black on the lighter ones (yellow, green) */
  --on-fill-dark: #0d0d0d;
  --on-fill-light: #ffffff;

  --btn-bg: #0d0d0d;
  --btn-fg: #f7f7f7;

  --warn: var(--spec-red);
  --warn-wash: var(--spec-red-wash);

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --max: 1180px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --scrollbar-thumb: rgba(0, 0, 0, 0.28);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.42);
  --scrollbar-track: transparent;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0a0a0a;
    --surface: #161616;
    --surface-2: #202020;
    --surface-3: #2b2b2b;
    --text: #f5f5f5;
    --text-2: #aaaaaa;
    --text-3: #7c7c7c;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.20);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.45);
    --btn-bg: #f5f5f5;
    --btn-fg: #0a0a0a;
    --scrollbar-thumb: rgba(255, 255, 255, 0.22);
    --scrollbar-thumb-hover: rgba(255, 255, 255, 0.36);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0a0a0a;
  --surface: #161616;
  --surface-2: #202020;
  --surface-3: #2b2b2b;
  --text: #f5f5f5;
  --text-2: #aaaaaa;
  --text-3: #7c7c7c;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.20);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.45);
  --btn-bg: #f5f5f5;
  --btn-fg: #0a0a0a;
  --scrollbar-thumb: rgba(255, 255, 255, 0.22);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.36);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- scrollbar, site-wide ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 3px solid var(--page);
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}
*::-webkit-scrollbar-corner { background: transparent; }

.data-table-wrap::-webkit-scrollbar-thumb,
.chart-track::-webkit-scrollbar-thumb {
  border-color: var(--surface);
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

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

a { color: inherit; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }

p { margin: 0; }

code, pre, .mono { font-family: var(--mono); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
}

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

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 68px;
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 17px;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand img {
  width: 21px;
  height: 21px;
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 30px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
  transition: color 0.15s var(--ease);
}

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

.nav-links a.current {
  color: var(--text);
  position: relative;
}
.nav-links a.current::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -22px;
  height: 2px;
  border-radius: 2px;
}
/* each nav destination keeps one fixed color for its own underline, never blended */
.nav-links li:nth-child(1) a.current::after { background: var(--spec-blue); }
.nav-links li:nth-child(2) a.current::after { background: var(--spec-green); }
.nav-links li:nth-child(3) a.current::after { background: var(--spec-orange); }
.nav-links li:nth-child(4) a.current::after { background: var(--spec-red); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-s);
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s var(--ease), transform 0.1s var(--ease);
}

.icon-btn:hover { color: var(--text); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn svg { width: 19px; height: 19px; }

.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

.nav-burger { display: none; }

@media (max-width: 780px) {
  .nav-links { display: none; }
  .nav-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-s);
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }
  .mobile-menu {
    display: none;
    position: fixed;
    inset: 68px 0 0 0;
    background: var(--page);
    z-index: 39;
    padding: 8px 18px 24px;
    overflow-y: auto;
  }
  .mobile-menu.open { display: block; }
  .mobile-menu a {
    display: block;
    padding: 16px 4px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    font-size: 17px;
    font-weight: 500;
  }
}

@media (min-width: 781px) {
  .mobile-menu { display: none !important; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-s);
  font-size: 15px;
  font-weight: 560;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s var(--ease), background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.2s var(--ease);
  white-space: nowrap;
  position: relative;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.btn-primary:hover { box-shadow: 0 0 0 3px var(--spec-blue-wash), 0 0 0 1px var(--spec-blue) inset; }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { border-color: var(--text); }

.btn svg { width: 16px; height: 16px; }

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

.hero { padding: 56px 0 72px; }

.hero-stack {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-stack .hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}

.hero-stack .demo-card {
  width: 100%;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--spec-blue);
}

.hero h1 {
  font-size: clamp(34px, 4.6vw, 52px);
  max-width: 15ch;
  margin-bottom: 20px;
}

.hero .lede {
  font-size: 17.5px;
  color: var(--text-2);
  max-width: 46ch;
  margin-bottom: 30px;
}

.hero-ctas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.install-line {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 8px 0 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  font-family: var(--mono);
  font-size: 14.5px;
}

.install-line .prompt { color: var(--text-3); }
.install-line .cmd { color: var(--text); }

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-s);
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  flex: none;
}
.copy-btn:hover { color: var(--spec-blue); background: var(--spec-blue-wash); }
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn.copied { background: var(--spec-green); }
.copy-btn.copied svg { color: var(--on-fill-dark); }

/* ---------- demo panel (bloom filter visual) ---------- */

.demo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  text-align: left;
}

.demo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 420px) {
  .demo-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .demo-head .title { font-size: 12.5px; }
  .demo-head .stat { font-size: 11.5px; }
}

.demo-head .title {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-2);
}

.demo-head .stat {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-3);
}

.demo-body { padding: 20px; }

.demo-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 860px) {
  .demo-main { flex-direction: row; align-items: flex-start; }
  .demo-controls { flex: 0 0 300px; display: flex; flex-direction: column; min-width: 0; }
  .demo-visual { flex: 1; min-width: 0; }
}

.demo-explainer {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}
.demo-explainer .icon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--spec-blue-wash);
  color: var(--spec-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}
.demo-explainer .icon svg { width: 12px; height: 12px; }
.demo-explainer b { color: var(--text); font-weight: 650; }

.word-rack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
  margin-bottom: 14px;
  position: relative;
  z-index: 5;
  isolation: isolate;
}

.word-rack .placeholder {
  color: var(--text-3);
  font-size: 13px;
  padding: 8px 0;
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 650;
  animation: chip-pop 0.4s var(--ease);
  position: relative;
  cursor: pointer;
  transition: opacity 0.25s var(--ease);
}

@keyframes chip-pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}


.demo-grid-wrap {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

.bit-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
  position: relative;
  z-index: 2;
}

.connector-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}

.connector-svg path { transition: opacity 0.25s var(--ease); }

.badge-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
}

.bit {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), opacity 0.25s var(--ease);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 3px 4px;
  position: relative;
  cursor: pointer;
}

.bit .idx {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  opacity: 0.7;
}

.bit.on .idx { color: rgba(255, 255, 255, 0.85); opacity: 0.9; }
.bit.on.on-light-fill .idx { color: rgba(0, 0, 0, 0.6); }

.bit.flash { transform: scale(1.22); }

.dimmed { opacity: 0.14 !important; }

.share-badge {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  color: var(--page);
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.25s var(--ease);
  font-family: var(--mono);
  transform: translate(-50%, -50%);
}

.bit.check-ping { z-index: 3; overflow: hidden; }
.bit.check-ping::before,
.bit.check-ping::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--spec-yellow);
  opacity: 0;
  animation: check-pulse 1.6s ease-out infinite;
  pointer-events: none;
}
.bit.check-ping::after { animation-delay: 0.8s; }
@keyframes check-pulse {
  0% { opacity: 0.85; transform: scale(0.3); }
  55% { opacity: 0.35; }
  100% { opacity: 0; transform: scale(1.35); }
}

.demo-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.demo-form input {
  width: 100%;
  height: 42px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--page);
  color: var(--text);
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 14px;
}

.demo-form input:focus {
  outline: none;
  border-color: var(--spec-blue);
}

.demo-form input:disabled { opacity: 0.5; }

.demo-form-buttons {
  display: flex;
  gap: 8px;
}

.demo-form-buttons button {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.demo-form-buttons button svg { width: 15px; height: 15px; flex: none; }
.demo-form-buttons button[data-demo-add] { font-size: 20px; font-weight: 600; }

.demo-form-buttons button:disabled { opacity: 0.45; cursor: not-allowed; }
.demo-form-buttons button.check { border-color: var(--spec-blue); color: var(--spec-blue); }
.demo-form-buttons button.random {
  border-color: transparent;
  background: var(--spec-orange);
  color: var(--on-fill-light);
}
.demo-form-buttons button:active:not(:disabled) { transform: scale(0.96); }

.demo-status {
  border-radius: var(--radius-s);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13.5px;
  display: none;
  align-items: flex-start;
  gap: 10px;
}
.demo-status.show { display: flex; }
.demo-status svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.demo-status.status-absent { background: var(--surface-2); color: var(--text-2); }
.demo-status.status-added { background: var(--spec-green-wash); color: var(--text); }
.demo-status.status-maybe { background: var(--spec-yellow-wash); color: var(--text); }
.demo-status.status-full { background: var(--spec-orange-wash); color: var(--text); }

.bit-index-legend {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}
@media (max-width: 859.98px) {
  .bit-index-legend { max-height: 260px; }
}
.bit-index-legend .row {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.bit-index-legend .row:last-child { border-bottom: none; padding-bottom: 0; }
.bit-index-legend .row .w {
  font-weight: 700;
  flex: 0 1 220px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.idx-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(28px, auto);
  gap: 4px;
  flex: none;
}
.idx-cell {
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 4px;
  padding: 2px 7px;
  text-align: center;
}
.idx-cell.claimed {
  background: var(--spec-red-wash);
  color: var(--spec-red);
  font-weight: 700;
}
.bit-index-legend .row.skipped .w {
  color: var(--text-3);
  text-decoration: line-through;
}
.bit-index-legend .row .tag {
  flex: none;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: 4px;
  padding: 2px 6px;
}
.bit-index-legend .empty { color: var(--text-3); font-size: 12.5px; font-family: var(--mono); }

.demo-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-3);
}

.demo-foot button {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
}
.demo-foot button:hover { color: var(--text); }

/* ---------- sections ---------- */

section { padding: 88px 0; }

@media (max-width: 640px) {
  section { padding: 56px 0; }
}

.section-head { max-width: 640px; margin-bottom: 44px; }
.section-head h2 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 14px; }
.section-head p { color: var(--text-2); font-size: 16.5px; max-width: 56ch; }

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- problem/solution code compare ---------- */

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

@media (max-width: 820px) {
  .compare { grid-template-columns: 1fr; }
}

.code-card {
  background: #282c34;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-card .code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #abb2bf;
}

.code-card.before .code-head .label { color: #9aa1ab; }
.code-card.after .code-head .label { color: var(--spec-green); }

.code-card .code-head .hint {
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: #6b7280;
  white-space: nowrap;
}

.code-card pre {
  margin: 0;
  padding: 18px 18px 20px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
  flex: 1;
  display: flex;
  align-items: center;
}

.code-card pre code { width: 100%; }
.code-card code { color: #abb2bf; }

/* One Dark Pro palette, with Pylance's semantic highlighting on top:
   parameters and self/cls read in Pylance's soft red, not the plain
   foreground color a syntax-only theme would give them. */
.tok-kw { color: #c678dd; }
.tok-str { color: #98c379; }
.tok-com { color: #5c6370; font-style: italic; }
.tok-fn { color: #61afef; }
.tok-num { color: #d19a66; }
.tok-cls { color: #e5c07b; }
.tok-op { color: #56b6c2; }
.tok-param { color: #e06c75; font-style: italic; }
.tok-self { color: #e06c75; font-style: italic; }

.compare-note { margin-top: 18px; color: var(--text-2); font-size: 15px; max-width: none; }

/* ---------- math / how it works ---------- */

.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }

@media (max-width: 900px) {
  .how-grid { grid-template-columns: 1fr; gap: 36px; }
}

.how-step { display: flex; gap: 16px; margin-bottom: 28px; }
.how-step:last-child { margin-bottom: 0; }

.how-num {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--on-fill-light);
}
.how-step:nth-child(1) .how-num { background: var(--spec-red); }
.how-step:nth-child(2) .how-num { background: var(--spec-orange); }
.how-step:nth-child(3) .how-num { background: var(--spec-green); color: var(--on-fill-dark); }
.how-step:nth-child(4) .how-num { background: var(--spec-blue); }

.how-step h3 { font-size: 16.5px; margin-bottom: 6px; }
.how-step p { color: var(--text-2); font-size: 15px; }

.formula-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 26px;
  position: relative;
  overflow: hidden;
}
.formula-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--spec-blue);
}

.formula { padding: 16px 0; border-bottom: 1px solid var(--border); color: var(--text); }
.formula:last-child { border-bottom: none; }
.formula .label { display: block; color: var(--text-3); font-size: 12px; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--sans); }
.formula .katex { font-size: 1.15em; }
.formula .katex-fallback { font-family: var(--mono); font-size: 15px; }

/* ---------- bento api grid ---------- */

.api-bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(150px, auto);
  gap: 14px;
}

.api-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 24px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
  position: relative;
}

.api-cell:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.api-cell.big { grid-column: span 3; }
.api-cell.med { grid-column: span 3; }
.api-cell.wide { grid-column: span 6; }

@media (max-width: 900px) {
  .api-bento { grid-template-columns: repeat(2, 1fr); }
  .api-cell.big, .api-cell.med, .api-cell.wide { grid-column: span 2; }
}

.api-cell .api-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--on-fill-light);
}
.api-cell .api-icon svg { width: 18px; height: 18px; }

.api-cell h3 { font-family: var(--mono); font-size: 16px; margin-bottom: 8px; }
.api-cell p { color: var(--text-2); font-size: 14px; margin-bottom: 12px; }

.api-cell .api-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.api-meta-pill {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.api-cell ul.api-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.api-cell ul.api-list li {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-2);
  padding-left: 14px;
  position: relative;
}
.api-cell ul.api-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.api-cell pre {
  margin: auto 0 0;
  font-size: 12.5px;
  background: #282c34;
  border-radius: var(--radius-s);
  padding: 12px 14px;
  overflow-x: auto;
  line-height: 1.6;
}
.api-cell pre code { color: #abb2bf; }

/* ---------- stat tiles ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
}

@media (max-width: 780px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

.stat-tile { background: var(--surface); padding: 26px 22px; }
.stat-tile .value { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; color: var(--text); margin-bottom: 6px; }
.stat-tile .value .unit { font-size: 16px; font-weight: 550; color: var(--text-2); margin-left: 2px; }
.stat-tile .label { font-size: 13.5px; color: var(--text-2); }
.stat-tile .sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; font-family: var(--mono); }

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

footer { border-top: 1px solid var(--border); padding: 56px 0 32px; }

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 40px;
  padding-bottom: 40px;
}

.footer-brand { max-width: 30ch; }
.footer-brand .brand { margin-bottom: 12px; }
.footer-brand p { color: var(--text-3); font-size: 13.5px; }

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

.footer-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 14px;
  font-weight: 650;
}

.footer-col a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14.5px;
  margin-bottom: 11px;
  transition: color 0.15s var(--ease);
}
.footer-col a:hover { color: var(--text); }
.footer-col a svg { width: 14px; height: 14px; opacity: 0.6; }

.footer-rights {
  border-top: 1px solid var(--border);
  padding-top: 26px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}
.footer-rights a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}
.footer-rights a:hover { color: var(--text); }

.footer-license {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.footer-license a { color: var(--text-3); font-weight: 500; }
.footer-license a:hover { color: var(--text-2); }

/* ---------- callout ---------- */

.callout {
  border: 1px solid rgba(255, 23, 68, 0.3);
  border-radius: var(--radius-l);
  padding: 0;
  background: var(--surface);
  overflow: hidden;
}
.callout .callout-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  background: var(--spec-red-wash);
}
.callout .callout-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--spec-red);
  color: var(--on-fill-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.callout .callout-icon svg { width: 21px; height: 21px; }
.callout h3 { font-size: 17px; color: var(--text); }
.callout .callout-kicker {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--spec-red);
  font-weight: 700;
  margin-bottom: 3px;
}
.callout .callout-body { padding: 20px 22px; }
.callout .callout-body pre {
  background: #282c34;
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 13px;
  overflow-x: auto;
  margin-bottom: 14px;
}
.callout .callout-body pre code { color: #e06c75; }
.callout p { font-size: 14.5px; color: var(--text-2); max-width: 68ch; }
.callout p + p { margin-top: 10px; }

/* ---------- page header (benchmarks) ---------- */

.page-head { padding: 48px 0 32px; border-bottom: 1px solid var(--border); }
.page-head h1 { font-size: clamp(30px, 4vw, 42px); margin-bottom: 14px; }
.page-head p { color: var(--text-2); font-size: 16.5px; max-width: 60ch; }

.env-strip {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
}

.env-item { flex: 1; min-width: 140px; padding: 14px 18px; border-right: 1px solid var(--border); }
.env-item:last-child { border-right: none; }
.env-item .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); margin-bottom: 4px; }
.env-item .v { font-family: var(--mono); font-size: 13.5px; color: var(--text); }

/* ---------- big-o ---------- */

.bigo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.bigo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 18px 20px;
  background: var(--surface);
}
.bigo-card .op { font-family: var(--mono); font-size: 14px; color: var(--text); margin-bottom: 8px; font-weight: 600; }
.bigo-card .notation {
  display: inline-flex;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-s);
  margin-bottom: 10px;
  color: var(--on-fill-light);
}
.bigo-card .note { font-size: 13px; color: var(--text-2); }

/* ---------- chart card ---------- */

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: 24px 24px 16px;
  display: flex;
  flex-direction: column;
}

.chart-card .chart-title { font-size: 15.5px; font-weight: 600; margin-bottom: 2px; }
.chart-card .chart-sub { font-size: 13px; color: var(--text-3); margin-bottom: 18px; }
.chart-card .chart-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }

.chart-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: stretch; }

@media (max-width: 860px) {
  .chart-grid-2 { grid-template-columns: 1fr; }
}

.viz-root text { fill: var(--text-2); font-family: var(--sans); }
.viz-root .bar-track { fill: var(--surface-2); }
.viz-root .axis-line { stroke: var(--border-strong); }
.viz-root .grid-line { stroke: var(--border); }
.viz-root .value-label { fill: var(--text); font-weight: 600; }
.viz-root .cat-label { fill: var(--text-2); }
.viz-root .axis-title { fill: var(--text-3); font-weight: 600; letter-spacing: 0.02em; }
.viz-root .dot { stroke: var(--surface); }

.chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; color: var(--text-2); }
.chart-legend .item { display: flex; align-items: center; gap: 7px; }
.chart-legend .swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.chart-legend .swatch.line { width: 16px; height: 3px; border-radius: 2px; }

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text);
  color: var(--page);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  transform: translate(-50%, -100%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s var(--ease);
  z-index: 5;
}
.chart-tooltip.show { opacity: 1; }

/* ---------- capacity planner ---------- */

.planner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 28px;
}

.planner-controls { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 12.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }

.field select {
  height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--page);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14.5px;
  min-width: 160px;
}

.planner-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
}

@media (max-width: 780px) {
  .planner-results { grid-template-columns: repeat(2, 1fr); }
}

.planner-results .stat-tile { padding: 20px; }
.planner-note { margin-top: 18px; font-size: 13px; color: var(--text-3); }

/* ---------- tables ---------- */

.table-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }

.table-tools input[type="search"] {
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  min-width: 220px;
  flex: 1;
}
.table-tools input[type="search"]:focus { outline: none; border-color: var(--spec-blue); }

.table-tools select {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-s);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.table-hint {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 10px;
}

.data-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  overflow: auto;
  max-height: 560px;
}

table.data-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 13.5px;
  user-select: none;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border-strong);
  cursor: pointer;
  white-space: nowrap;
  z-index: 2;
  transition: background-color 0.12s var(--ease), color 0.12s var(--ease);
}

.data-table thead th:hover { color: var(--text); }
.data-table thead th.sorted::after { content: " \2193"; color: var(--spec-blue); }
.data-table thead th.sorted.asc::after { content: " \2191"; color: var(--spec-blue); }
.data-table thead th.col-selected {
  /* the wash is semi-transparent; without an opaque base layer beneath it,
     rows scrolling past underneath the sticky header would show through */
  background-color: var(--surface-2);
  background-image: linear-gradient(var(--spec-blue-wash), var(--spec-blue-wash));
  color: var(--text);
}

.data-table tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  cursor: cell;
}

.data-table tbody td:first-child { font-family: var(--sans); color: var(--text); font-weight: 500; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr.row-selected td { background: var(--spec-blue-wash); }
.data-table tbody td.col-selected { background: var(--spec-blue-wash); }
.data-table tbody td.cell-selected {
  background: var(--spec-blue) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 2px var(--spec-blue);
}
.data-table tbody td.cell-selected:first-child { color: #fff !important; }

.unit-hint {
  color: var(--text-3);
  font-size: 11px;
  margin-left: 5px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
}
.tag-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
  background: var(--text-3);
}
.tag-pill.measured::before { background: var(--spec-green); }
.tag-pill.extrapolated::before { background: var(--spec-orange); }

details.group {
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  margin-bottom: 12px;
  overflow: hidden;
}

details.group summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
}
details.group summary::-webkit-details-marker { display: none; }
details.group summary .count { font-family: var(--mono); font-weight: 500; color: var(--text-3); font-size: 13px; }
details.group[open] summary { border-bottom: 1px solid var(--border); }

/* utility */
.mt-48 { margin-top: 48px; }
.center-note { text-align: center; color: var(--text-3); font-size: 13.5px; margin-top: 16px; }
