/* ==========================================================================
   CS210 · Runtime Lab — shared styles
   Dark-first, with a light theme toggled via [data-theme="light"].
   ========================================================================== */

:root {
  --bg: #05070a;
  --bg-2: #090c10;
  --panel: rgba(11, 15, 19, 0.72);
  --panel-solid: #0b0f13;
  --panel-2: #10151b;
  --line: #182028;
  --line-2: #243039;
  --text: #e9eef2;
  --muted: #95a3ae;
  --dim: #5d6b76;
  --accent: #3ee6a0;
  --accent-2: #8ff5cb;
  --accent-soft: rgba(62, 230, 160, 0.1);
  --accent-line: rgba(62, 230, 160, 0.32);
  --accent-ink: #02140c;
  --grid: rgba(62, 230, 160, 0.035);
  --glow: 0 0 0 1px rgba(62, 230, 160, 0.18), 0 20px 60px -20px rgba(62, 230, 160, 0.25);

  /* Algorithm / complexity palette — shared by every chart */
  --c-select: #fb7185;
  --c-insert: #f5b54a;
  --c-merge: #3ee6a0;
  --c-quick: #60a5fa;
  --c-linear: #a78bfa;

  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8);
  --radius: 14px;
  --radius-sm: 8px;
  --max: 1200px;
  --header-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f7f6;
  --bg-2: #eef2f0;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --panel-2: #f3f6f5;
  --line: #dfe5e2;
  --line-2: #cbd4d0;
  --text: #0a1210;
  --muted: #4a5853;
  --dim: #7d8a85;
  --accent: #04935f;
  --accent-2: #047a50;
  --accent-soft: rgba(4, 147, 95, 0.08);
  --accent-line: rgba(4, 147, 95, 0.3);
  --accent-ink: #ffffff;
  --grid: rgba(4, 120, 80, 0.05);
  --glow: 0 0 0 1px rgba(4, 147, 95, 0.18), 0 20px 50px -24px rgba(4, 147, 95, 0.3);

  --c-select: #e11d48;
  --c-insert: #d97706;
  --c-merge: #059669;
  --c-quick: #2563eb;
  --c-linear: #7c3aed;

  --shadow: 0 24px 60px -30px rgba(10, 30, 20, 0.25);
  color-scheme: light;
}

@media (min-width: 1600px) {
  :root { --max: 1320px; }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Fine grid behind everything, fading out toward the bottom of the viewport */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 30%, transparent 85%);
}

/* Soft aurora glow at the top of the page */
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  top: -40vh;
  left: 50%;
  width: 120vw;
  height: 80vh;
  transform: translateX(-50%);
  background:
    radial-gradient(closest-side at 35% 55%, rgba(62, 230, 160, 0.13), transparent),
    radial-gradient(closest-side at 70% 45%, rgba(96, 165, 250, 0.09), transparent);
  filter: blur(20px);
  animation: aurora 18s ease-in-out infinite alternate;
}
:root[data-theme="light"] body::after { opacity: 0.6; }

@keyframes aurora {
  0% { transform: translateX(-52%) scale(1); }
  100% { transform: translateX(-46%) scale(1.08); }
}

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

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
}
code, kbd, pre, .mono { font-family: var(--font-mono); }
strong { color: var(--text); font-weight: 600; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  font-weight: 600;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 640px) { .container { padding: 0 28px; } }

main { flex: 1; padding-top: var(--header-h); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.icon { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------------------
   Scroll progress + header
   -------------------------------------------------------------------------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 120;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--c-quick), var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--accent);
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s, border-color 0.3s, backdrop-filter 0.3s;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: transform 0.4s var(--ease), box-shadow 0.4s;
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.05); box-shadow: var(--glow); }
.brand-mark svg { width: 20px; height: 20px; }
.brand b { color: var(--text); font-weight: 600; }
.brand span { color: var(--dim); }

.nav {
  display: none;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
@media (min-width: 1024px) { .nav { display: flex; } }

.nav-item { position: relative; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  background: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.nav-link:hover,
.nav-item:focus-within > .nav-link { color: var(--text); background: var(--panel-2); }
.nav-link[aria-current="true"] { color: var(--text); }
.nav-link[aria-current="true"]::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.nav-link .chev { width: 12px; height: 12px; transition: transform 0.25s; }
.nav-item:hover .chev,
.nav-item:focus-within .chev { transform: rotate(180deg); }

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  min-width: 290px;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel-solid) 94%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 6px);
  transition: opacity 0.2s, transform 0.25s var(--ease), visibility 0.2s;
}
.dropdown::before {
  /* hover bridge between trigger and panel */
  content: "";
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}
.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.dropdown a {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  transition: background-color 0.2s;
}
.dropdown a:hover,
.dropdown a[aria-current="page"] { background: var(--panel-2); }
.dropdown .d-icon {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  color: var(--accent);
}
.dropdown a[aria-current="page"] .d-icon { border-color: var(--accent-line); background: var(--accent-soft); }
.dropdown .d-title { display: block; font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.3; }
.dropdown .d-desc { display: block; font-size: 12.5px; color: var(--dim); line-height: 1.4; margin-top: 2px; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
@media (min-width: 1024px) { .header-actions { margin-left: 8px; } }

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent-line); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn .icon { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: none; }

.menu-btn { display: inline-flex; }
@media (min-width: 1024px) { .menu-btn { display: none; } }
.menu-btn .bars { position: relative; width: 16px; height: 10px; }
.menu-btn .bars::before,
.menu-btn .bars::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease), top 0.3s var(--ease);
}
.menu-btn .bars::before { top: 1px; }
.menu-btn .bars::after { top: 7.5px; }
.menu-open .menu-btn .bars::before { top: 4.5px; transform: rotate(45deg); }
.menu-open .menu-btn .bars::after { top: 4.5px; transform: rotate(-45deg); }

.hide-sm { display: none !important; }
@media (min-width: 640px) { .hide-sm { display: inline-flex !important; } }

/* Mobile drawer */
.mobile-nav {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 99;
  padding: 16px 16px 40px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.35s var(--ease), visibility 0.25s;
}
.menu-open .mobile-nav { opacity: 1; visibility: visible; transform: none; }
.menu-open { overflow: hidden; }
.mobile-nav .m-group { padding: 14px 0; border-bottom: 1px solid var(--line); }
.mobile-nav .m-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 6px;
}
.mobile-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
}
.mobile-nav a[aria-current="page"] { color: var(--text); background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.mobile-nav .icon { color: var(--accent); }
@media (min-width: 1024px) { .mobile-nav { display: none; } }

/* --------------------------------------------------------------------------
   Buttons, chips, labels
   -------------------------------------------------------------------------- */
.btn {
  --b: var(--line-2);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 11px;
  border: 1px solid var(--b);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s, background-color 0.25s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn .icon { width: 17px; height: 17px; }
.btn .arrow { transition: transform 0.3s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.btn-primary {
  --b: transparent;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 10px 30px -10px var(--accent);
}
.btn-primary::before {
  /* sheen sweep */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn-primary:hover { box-shadow: 0 16px 40px -12px var(--accent); }
.btn-primary:hover::before { transform: translateX(120%); }
.btn-sm { padding: 8px 14px; font-size: 12.5px; border-radius: 9px; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.pulse-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.chip .icon { width: 13px; height: 13px; color: var(--accent); }

.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.kicker::after {
  content: "";
  flex: 0 0 48px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-line), transparent);
}

/* Big-O badges, colored by growth class */
.bigo {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 30%, transparent);
}
.bigo.n { --c: var(--c-linear); }
.bigo.nlogn { --c: var(--c-merge); }
.bigo.n2 { --c: var(--c-select); }

/* --------------------------------------------------------------------------
   Sections & typography
   -------------------------------------------------------------------------- */
.section { padding: 72px 0; position: relative; }
@media (min-width: 900px) { .section { padding: 112px 0; } }
.section-tight { padding: 48px 0; }
.section + .section { border-top: 1px solid var(--line); }

.section-head { max-width: 720px; margin-bottom: 44px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head.center .kicker { justify-content: center; }
.section-head.center .kicker::before {
  content: "";
  flex: 0 0 48px;
  height: 1px;
  background: linear-gradient(270deg, var(--accent-line), transparent);
}
.section-head h2 { font-size: clamp(30px, 4.2vw, 48px); }
.section-head p { margin-top: 16px; font-size: 17px; color: var(--muted); }

.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--muted); line-height: 1.6; font-weight: 300; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.accent { color: var(--accent); }

.grad-text {
  background: linear-gradient(100deg, var(--text) 10%, var(--accent) 55%, var(--c-quick) 95%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 8s ease-in-out infinite alternate;
}
@keyframes shimmer { to { background-position: 100% 0; } }

/* Prose for long-form copy inside content pages */
.prose { max-width: 72ch; color: var(--muted); }
.prose h2 { font-size: clamp(26px, 3vw, 34px); color: var(--text); margin: 0 0 16px; }
.prose h3 { font-size: 20px; color: var(--text); margin: 28px 0 10px; }
.prose ul { padding-left: 0; list-style: none; margin: 0 0 1.2em; }
.prose li { position: relative; padding-left: 22px; margin: 8px 0; }
.prose li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 8px;
  height: 1.5px;
  background: var(--accent);
}
.prose a, .link {
  color: var(--accent);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.35s var(--ease);
}
.prose a:hover, .link:hover { background-size: 100% 1px; }

:not(pre) > code {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-size: 0.86em;
  color: var(--text);
  white-space: nowrap;
}

.quote {
  position: relative;
  margin: 32px 0;
  padding: 28px 28px 28px 32px;
  border-radius: var(--radius);
  border: 1px solid var(--accent-line);
  background: linear-gradient(120deg, var(--accent-soft), transparent 70%);
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1.3;
  color: var(--text);
}
.quote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 22px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.callout {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--muted);
  font-size: 15px;
}
.callout .icon { color: var(--accent); width: 20px; height: 20px; margin-top: 2px; }
.callout strong { display: block; margin-bottom: 2px; }
.callout p { margin: 0; }

/* --------------------------------------------------------------------------
   Grids & cards
   -------------------------------------------------------------------------- */
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) {
  .g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3, .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.grid.gap-lg { gap: 22px; }

.card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.35s, transform 0.45s var(--ease), box-shadow 0.35s;
}
/* spotlight that follows the pointer (set by JS) */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  background: radial-gradient(420px circle at var(--mx) var(--my), var(--accent-soft), transparent 45%);
  transition: opacity 0.4s;
}
/* bracket corners, echoing the SE322 blueprint panels */
.card::after {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  background:
    linear-gradient(var(--accent), var(--accent)) top left / 14px 1px,
    linear-gradient(var(--accent), var(--accent)) top left / 1px 14px,
    linear-gradient(var(--accent), var(--accent)) bottom right / 14px 1px,
    linear-gradient(var(--accent), var(--accent)) bottom right / 1px 14px;
  background-repeat: no-repeat;
  transition: opacity 0.35s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.card:hover::before,
.card:hover::after { opacity: 1; }
.card.static:hover { transform: none; }

.card h3 { font-size: 19px; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 15px; margin: 0; }
.card p + p { margin-top: 10px; }
.card .prose { font-size: 15px; }
.card ul { margin-bottom: 0; }

.card-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 11px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  transition: transform 0.5s var(--ease);
}
.card-icon .icon { width: 21px; height: 21px; }
.card:hover .card-icon { transform: rotate(-6deg) scale(1.06); }

.card-index {
  position: absolute;
  top: 22px;
  right: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
}

.card-link { display: block; }
.card-link .go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--accent);
}
.card-link .go .icon { transition: transform 0.3s var(--ease); }
.card-link:hover .go .icon { transform: translateX(4px); }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* --------------------------------------------------------------------------
   Home hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding: 56px 0 72px;
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
}
@media (min-width: 1000px) { .hero { padding: 40px 0 88px; } }
.hero-grid {
  display: grid;
  gap: 56px;
  align-items: center;
}
@media (min-width: 1000px) { .hero-grid { grid-template-columns: 1.05fr 1fr; gap: 48px; } }

.hero h1 {
  margin: 22px 0 22px;
  font-size: clamp(40px, 5.4vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.hero h1 .line { display: block; overflow: hidden; }
.hero h1 .line > span { display: inline-block; animation: rise 1s var(--ease) both; animation-delay: calc(var(--i, 0) * 0.08s + 0.1s); }
@keyframes rise { from { transform: translateY(105%); opacity: 0; } to { transform: none; opacity: 1; } }

.hero .lead { max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.byline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  font-size: 14px;
  color: var(--dim);
}
.avatars { display: flex; }
.avatars span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin-left: -8px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--c-quick));
}
.avatars span:first-child { margin-left: 0; }
.avatars span:nth-child(2) { background: linear-gradient(135deg, var(--c-insert), var(--c-select)); }
.byline b { color: var(--muted); font-weight: 500; }

/* Linked list machine (hero visual) */
.machine {
  position: relative;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  box-shadow: var(--shadow), var(--glow);
  overflow: hidden;
  animation: floaty 7s ease-in-out infinite;
}
@keyframes floaty { 50% { transform: translateY(-8px); } }
.machine-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.dots i:nth-child(1) { background: #ff5f57; }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.machine-bar .file { color: var(--muted); }
.machine-bar .phase {
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 6px;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  transition: color 0.3s;
}
.machine-body { padding: 18px 16px 8px; }
@media (min-width: 640px) { .machine-body { padding: 22px 22px 10px; } }

.ll-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
}
.ll-head .ptr { color: var(--accent); }

.ll { position: relative; }
.ll-node {
  position: absolute;
  left: 0;
  right: 0;
  height: 48px;
  display: grid;
  grid-template-columns: 28px 1fr auto 44px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-family: var(--font-mono);
  font-size: 12.5px;
  transition: transform 0.9s var(--ease), border-color 0.35s, box-shadow 0.35s, background-color 0.35s;
}
@media (max-width: 420px) {
  .ll-node { grid-template-columns: 22px 1fr auto 30px; gap: 8px; padding: 0 10px; font-size: 11.5px; }
}
.ll-node .idx { color: var(--dim); }
.ll-node .rec { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ll-node .rec b { color: var(--text); font-weight: 500; }
.ll-node .score {
  min-width: 42px;
  text-align: right;
  color: var(--dim);
  transition: color 0.3s;
}
.ll-node .next {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--dim);
}
.ll-node .next i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}
.ll-node.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 24px -4px var(--accent);
}
.ll-node.is-scored .score { color: var(--accent); }
.ll-node.is-scored .next { color: var(--accent); }
.ll-node.is-array { border-style: dashed; }
.ll-link {
  position: absolute;
  left: 50%;
  width: 1.5px;
  height: 12px;
  background: repeating-linear-gradient(to bottom, var(--line-2) 0 3px, transparent 3px 6px);
  transition: opacity 0.4s;
}
.ll-link.lit { background: repeating-linear-gradient(to bottom, var(--accent) 0 3px, transparent 3px 6px); animation: flowdown 0.6s linear infinite; }
@keyframes flowdown { to { background-position: 0 6px; } }
.ll-null {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--dim);
  transition: opacity 0.4s;
}
.machine-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--dim);
}
.machine-foot b { color: var(--text); font-weight: 500; }
.machine-log { color: var(--accent); min-height: 1.4em; }

/* Floating tags around the hero visual */
.hero-visual { position: relative; }
.float-tag {
  position: absolute;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--panel-solid) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  animation: floaty 6s ease-in-out infinite;
}
@media (min-width: 1180px) { .float-tag { display: inline-flex; } }
.float-tag.t1 { top: -46px; right: 18px; animation-delay: -2s; }
.float-tag.t2 { bottom: -46px; left: 18px; animation-delay: -4s; }

/* Stats strip */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: 26px 22px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat:nth-child(2n) { border-right: 0; }
.stat:nth-child(n + 3) { border-bottom: 0; }
@media (min-width: 900px) {
  .stat { border-bottom: 0; }
  .stat:nth-child(2n) { border-right: 1px solid var(--line); }
  .stat:last-child { border-right: 0; }
}
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
}
.stat-value small { font-size: 0.5em; color: var(--dim); margin-left: 4px; font-weight: 500; }
.stat-label { margin-top: 10px; font-size: 13.5px; color: var(--dim); }

/* Marquee of class names */
.marquee {
  position: relative;
  overflow: hidden;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  gap: 40px;
  width: max-content;
  animation: marquee 40s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--dim);
  white-space: nowrap;
}
.marquee-track span::before { content: "▸"; color: var(--accent); font-size: 10px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* --------------------------------------------------------------------------
   Pipeline (4 phases)
   -------------------------------------------------------------------------- */
.pipeline { position: relative; display: grid; gap: 16px; }
@media (min-width: 1000px) {
  .pipeline { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .pipeline::before {
    content: "";
    position: absolute;
    top: 49px;
    left: 8%;
    right: 8%;
    height: 1px;
    background: repeating-linear-gradient(90deg, var(--accent-line) 0 6px, transparent 6px 12px);
    animation: dashx 1.2s linear infinite;
  }
}
@keyframes dashx { to { background-position: 12px 0; } }
@media (min-width: 1000px) { .pipeline.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.phase-card { padding-top: 22px; }
.phase-num {
  position: relative;
  z-index: 1;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 14px;
  border: 1px solid var(--accent-line);
  background: var(--panel-solid);
  color: var(--accent);
  box-shadow: 0 0 0 6px var(--bg);
}
.phase-num .icon { width: 22px; height: 22px; }
.phase-card .files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }

/* --------------------------------------------------------------------------
   Inner page hero + layout
   -------------------------------------------------------------------------- */
.page-hero {
  position: relative;
  padding: 56px 0 44px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
@media (min-width: 900px) { .page-hero { padding: 88px 0 64px; } }
.page-hero::after {
  /* dotted halo on the right */
  content: "";
  position: absolute;
  right: -120px;
  top: -60px;
  width: 520px;
  height: 520px;
  pointer-events: none;
  background-image: radial-gradient(var(--accent-line) 1.2px, transparent 1.4px);
  background-size: 18px 18px;
  mask-image: radial-gradient(circle, #000 0%, transparent 65%);
  opacity: 0.55;
  animation: spin 120s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--dim);
}
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--accent); }
.page-hero h1 {
  max-width: 900px;
  font-size: clamp(36px, 5.4vw, 64px);
  letter-spacing: -0.035em;
  line-height: 1.04;
}
.page-hero .lead { max-width: 720px; margin-top: 20px; }
.page-hero .meta-row { margin-top: 26px; }

.page-body { display: grid; gap: 48px; padding: 56px 0 96px; }
.page-body > .content { min-width: 0; }
.content > section { scroll-margin-top: calc(var(--header-h) + 24px); }
.content > section + section { margin-top: 88px; }
.content .section-head { margin-bottom: 30px; }
.content .section-head h2 { font-size: clamp(26px, 3.2vw, 38px); }

/* Prev / next */
.pager { display: grid; gap: 16px; margin-top: 96px; }
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a {
  display: block;
  padding: 20px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.3s, transform 0.35s var(--ease);
}
.pager a:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.pager .dir { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.pager .ttl { display: block; margin-top: 6px; font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.pager .next { text-align: right; }
.pager .next .dir { justify-content: flex-end; }
.pager a:hover .ttl { color: var(--accent); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  background: var(--panel-2);
  white-space: nowrap;
}
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 0.2s; }
tbody tr:hover { background: var(--accent-soft); }
td { color: var(--muted); }
td.name { color: var(--text); font-weight: 500; white-space: nowrap; }
td.num { font-family: var(--font-mono); color: var(--text); text-align: right; white-space: nowrap; }
th.num { text-align: right; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 10px; background: var(--c); vertical-align: 1px; }

/* --------------------------------------------------------------------------
   Charts & interactive widgets
   -------------------------------------------------------------------------- */
.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.panel-title .icon { color: var(--accent); }
.panel-body { padding: 22px 20px; }
@media (min-width: 640px) { .panel-body { padding: 26px 26px; } }

.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* Horizontal bar chart */
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 640px) { .bar-row { grid-template-columns: 200px 1fr; gap: 18px; align-items: center; } }
.bar-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--text); }
.bar-label .bigo { font-size: 11px; padding: 1px 7px; }
.bar-track {
  position: relative;
  height: 30px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--v) * 1%);
  border-radius: 7px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 35%, transparent), var(--c));
  box-shadow: 0 0 18px -4px var(--c);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1.3s var(--ease);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.is-visible .bar-fill, .bars.is-visible .bar-fill { transform: scaleX(1); }
.bar-value {
  position: absolute;
  top: 50%;
  left: calc(var(--v) * 1% + 10px);
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.5s 0.9s;
}
.bar-value.inside { left: auto; right: calc(100% - var(--v) * 1% + 10px); color: var(--accent-ink); font-weight: 600; }
.is-visible .bar-value { opacity: 1; }

/* Sorting race */
.race { display: grid; gap: 14px; }
@media (min-width: 900px) { .race { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lane {
  position: relative;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  transition: border-color 0.4s, box-shadow 0.4s;
}
.lane.done { border-color: color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 10%, transparent); }
.lane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.lane-name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.lane-name i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); box-shadow: 0 0 10px var(--c); }
.lane-stat { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.lane-stat b { color: var(--text); font-weight: 500; }
.lane-place {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--c);
  transform: scale(0);
  transition: transform 0.4s var(--ease);
}
.lane.done .lane-place { transform: scale(1); }
.lane-bars {
  height: 92px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.lane-bars span {
  flex: 1;
  min-width: 0;
  border-radius: 2px 2px 0 0;
  background: color-mix(in srgb, var(--c) 30%, var(--line-2));
  transition: height 0.12s linear, background-color 0.15s;
}
.lane-bars span.hot { background: var(--text); }
.lane.done .lane-bars span { background: var(--c); }
.lane-progress { height: 2px; margin-top: 10px; border-radius: 2px; background: var(--line); overflow: hidden; }
.lane-progress i { display: block; height: 100%; width: 0; background: var(--c); transition: width 0.15s linear; }

/* Complexity growth chart */
.growth { display: grid; gap: 24px; }
@media (min-width: 1000px) { .growth { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; } }
.growth svg { width: 100%; height: auto; display: block; overflow: visible; }
.growth .axis { stroke: var(--line-2); stroke-width: 1; }
.growth .gridline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 5; }
.growth .tick { fill: var(--dim); font-family: var(--font-mono); font-size: 11px; }
.growth .curve { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.growth .area { opacity: 0.1; }
.growth .marker { stroke: var(--accent); stroke-dasharray: 4 4; stroke-width: 1; }
.readout { display: grid; gap: 10px; }
.readout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-family: var(--font-mono);
  font-size: 13px;
}
.readout-row .k { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.readout-row .k i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.readout-row .v { color: var(--text); font-variant-numeric: tabular-nums; }
.readout-big {
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
}
.readout-big .v {
  display: block;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.readout-big .k { display: block; margin-top: 8px; font-size: 13.5px; color: var(--muted); }

/* Range input */
.range { display: grid; gap: 10px; }
.range-top { display: flex; align-items: baseline; justify-content: space-between; font-family: var(--font-mono); font-size: 12.5px; color: var(--dim); }
.range-top output { font-size: 15px; color: var(--text); }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--line-2) var(--fill, 50%));
  outline-offset: 6px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--panel-solid);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
  transition: transform 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel-solid);
  border: 2px solid var(--accent);
}

/* Demand score calculator */
.calc { display: grid; gap: 24px; }
@media (min-width: 900px) { .calc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.field { display: grid; gap: 8px; }
.field + .field { margin-top: 22px; }
.field-label { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.seg button {
  padding: 10px 4px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
  transition: all 0.2s;
}
.seg button small { display: block; color: var(--dim); font-size: 10.5px; }
.seg button:hover { border-color: var(--accent-line); color: var(--text); }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg button[aria-pressed="true"] small { color: var(--accent); }
.text-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  text-transform: uppercase;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.text-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.score-dial { position: relative; width: 190px; height: 190px; margin: 4px auto 20px; }
.score-dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-dial .track { stroke: var(--line-2); }
.score-dial .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.8s var(--ease); filter: drop-shadow(0 0 6px var(--accent)); }
.score-dial .num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
}
.score-dial .num b { font-family: var(--font-display); font-size: 54px; font-weight: 600; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.score-dial .num span { font-family: var(--font-mono); font-size: 11px; color: var(--dim); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 6px; }
.steps { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: 13px; }
.steps li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-2);
  color: var(--muted);
}
.steps li:last-child { border-bottom: 0; color: var(--text); }
.steps .d { color: var(--text); white-space: nowrap; }
.steps .d.up { color: var(--c-merge); }
.steps .d.down { color: var(--c-select); }

/* --------------------------------------------------------------------------
   Timeline (flowchart / phases)
   -------------------------------------------------------------------------- */
.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: linear-gradient(var(--accent-line), var(--line) 80%, transparent);
}
.timeline li { position: relative; padding: 0 0 30px 64px; }
.timeline li:last-child { padding-bottom: 0; }
.t-dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--accent-line);
  background: var(--panel-solid);
  color: var(--accent);
  box-shadow: 0 0 0 6px var(--bg);
}
.t-dot .icon { width: 19px; height: 19px; }
.timeline h3 { font-size: 18px; margin: 9px 0 6px; }
.timeline p { color: var(--muted); font-size: 15px; margin: 0; }
.timeline .t-step { font-family: var(--font-mono); font-size: 11.5px; color: var(--dim); margin-left: 8px; font-weight: 400; letter-spacing: 0; }
.timeline .meta-row { margin-top: 10px; }

/* --------------------------------------------------------------------------
   Figures, gallery, lightbox
   -------------------------------------------------------------------------- */
.figure {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-solid);
  overflow: hidden;
}
.figure-media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--bg-2);
  cursor: zoom-in;
  overflow: hidden;
}
.figure-media img { width: 100%; height: 100%; object-fit: contain; transition: transform 0.7s var(--ease); }
.figure-media:hover img { transform: scale(1.03); }
.figure-media .zoom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--panel-solid) 85%, transparent);
  color: var(--text);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
.figure-media:hover .zoom, .figure-media:focus-visible .zoom { opacity: 1; transform: none; }
.figure figcaption { padding: 16px 18px; border-top: 1px solid var(--line); }
.figure figcaption b { display: block; font-size: 15px; font-weight: 600; font-family: var(--font-display); }
.figure figcaption span { display: block; margin-top: 4px; font-size: 13.5px; color: var(--dim); }
.figure .tag { font-family: var(--font-mono); font-size: 11px; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; }
.gallery .figure-media { aspect-ratio: 16 / 10; }
.gallery .figure-media img { object-fit: cover; object-position: top center; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 64px 16px 24px;
  background: rgba(3, 5, 7, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  cursor: zoom-out;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: min(1400px, 100%);
  max-height: calc(100vh - 110px);
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid #243039;
  background: #0b0f13;
  transform: scale(0.96);
  transition: transform 0.4s var(--ease);
}
.lightbox.open img { transform: none; }
.lightbox-cap { position: absolute; top: 20px; left: 16px; right: 70px; color: #e9eef2; font-family: var(--font-mono); font-size: 13px; }
.lightbox-close { position: absolute; top: 14px; right: 16px; }

/* --------------------------------------------------------------------------
   Code viewer
   -------------------------------------------------------------------------- */
.code-layout { display: grid; gap: 28px; }
@media (min-width: 1000px) { .code-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 36px; } }
.code-layout > div { min-width: 0; }
.file-tree { display: none; }
@media (min-width: 1000px) {
  .file-tree {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 28px);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 56px);
    overflow-y: auto;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel);
  }
}
.file-tree .grp { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); padding: 12px 8px 6px; }
.file-tree .grp:first-child { padding-top: 2px; }
.file-tree a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  transition: background-color 0.2s, color 0.2s;
}
.file-tree a:hover { background: var(--panel-2); color: var(--text); }
.file-tree a.active { background: var(--accent-soft); color: var(--accent); }
.file-tree a .icon { width: 14px; height: 14px; color: var(--c-insert); }
.file-tree a .loc { margin-left: auto; font-size: 10.5px; color: var(--dim); }

.code-group + .code-group { margin-top: 56px; }
.code-group > h2 { font-size: 24px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; }
.code-group > h2 .n { font-family: var(--font-mono); font-size: 13px; color: var(--accent); font-weight: 400; }
.codeblock {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #070a0d;
  overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.codeblock + .codeblock { margin-top: 18px; }
.codeblock-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid #182028;
  background: #0b0f13;
  color: #95a3ae;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.codeblock-head .fname { color: #e9eef2; display: flex; align-items: center; gap: 8px; }
.codeblock-head .fname .icon { color: #f5b54a; width: 15px; height: 15px; }
.codeblock-head .desc { color: #5d6b76; display: none; }
@media (min-width: 640px) { .codeblock-head .desc { display: inline; } }
.codeblock-head .actions { margin-left: auto; display: flex; gap: 6px; }
.codeblock-head button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid #243039;
  background: transparent;
  color: #95a3ae;
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.codeblock-head button:hover { color: #e9eef2; border-color: rgba(62, 230, 160, 0.4); }
.codeblock-head button.ok { color: #3ee6a0; border-color: rgba(62, 230, 160, 0.4); }
.codeblock-head button .icon { width: 13px; height: 13px; }
.codeblock pre {
  margin: 0;
  padding: 16px 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
  color: #cfd8df;
  tab-size: 4;
}
.codeblock.collapsed pre { max-height: 360px; overflow-y: hidden; mask-image: linear-gradient(#000 70%, transparent); }
.codeblock code { display: block; min-width: max-content; counter-reset: ln; }
.codeblock .ln { display: block; padding: 0 20px 0 0; }
.codeblock .ln::before {
  counter-increment: ln;
  content: counter(ln);
  display: inline-block;
  width: 3.4em;
  padding-right: 1.4em;
  margin-right: 0.2em;
  text-align: right;
  color: #3a4750;
  user-select: none;
}
.codeblock .ln:hover { background: rgba(62, 230, 160, 0.05); }
.tok-k { color: #ff7ab2; }
.tok-t { color: #7dd3fc; }
.tok-s { color: #fcd34d; }
.tok-n { color: #c4b5fd; }
.tok-c { color: #5d6b76; font-style: italic; }
.tok-a { color: #f5b54a; }
.tok-f { color: #3ee6a0; }

/* Small snippet blocks */
.snippet { border-radius: 12px; border: 1px solid var(--line); background: #070a0d; overflow-x: auto; }
.snippet pre { margin: 0; padding: 16px 18px; font-size: 13px; line-height: 1.7; color: #cfd8df; }

/* --------------------------------------------------------------------------
   Team
   -------------------------------------------------------------------------- */
.member { padding: 0; }
.member-top { position: relative; padding: 28px 26px 24px; border-bottom: 1px solid var(--line); }
.member-top::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 90px;
  z-index: -1;
  background: linear-gradient(120deg, color-mix(in srgb, var(--c1) 22%, transparent), color-mix(in srgb, var(--c2) 12%, transparent) 60%, transparent);
  mask-image: linear-gradient(#000, transparent);
}
.member-avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: #04110b;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 12px 30px -10px var(--c1);
}
.member h3 { font-size: 24px; margin: 18px 0 4px; }
.member .role { color: var(--accent); font-family: var(--font-mono); font-size: 13px; }
.member .dept { color: var(--dim); font-size: 14px; margin-top: 6px; }
.member-body { padding: 22px 26px 26px; }
.member-body h4 { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); font-weight: 500; margin: 0 0 12px; }
.member-body h4:not(:first-child) { margin-top: 22px; }
.member-body .files { display: flex; flex-wrap: wrap; gap: 6px; }
.member-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* --------------------------------------------------------------------------
   References
   -------------------------------------------------------------------------- */
.refs { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: ref; }
.ref { counter-increment: ref; }
.ref > div { position: relative; padding-left: 48px; }
.ref > div::before {
  content: "[" counter(ref) "]";
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.ref .who { color: var(--text); font-weight: 500; }
.ref .title { font-style: italic; color: var(--text); }
.ref .note { display: block; margin-top: 6px; font-size: 14px; color: var(--dim); }
.ref .url { display: inline-block; margin-top: 8px; font-family: var(--font-mono); font-size: 12.5px; word-break: break-all; }

/* --------------------------------------------------------------------------
   Report viewer
   -------------------------------------------------------------------------- */
.doc-frame { border-radius: 16px; border: 1px solid var(--line-2); overflow: hidden; box-shadow: var(--shadow); background: var(--panel-solid); }
.doc-frame iframe { display: block; width: 100%; height: 82vh; border: 0; background: #fff; }

/* --------------------------------------------------------------------------
   CTA + footer
   -------------------------------------------------------------------------- */
.cta {
  position: relative;
  padding: 48px 24px;
  border-radius: 22px;
  border: 1px solid var(--accent-line);
  background:
    radial-gradient(600px circle at 0% 0%, var(--accent-soft), transparent 60%),
    radial-gradient(500px circle at 100% 100%, color-mix(in srgb, var(--c-quick) 12%, transparent), transparent 60%),
    var(--panel);
  overflow: hidden;
  text-align: center;
}
@media (min-width: 900px) { .cta { padding: 72px 48px; } }
.cta h2 { font-size: clamp(28px, 4vw, 46px); max-width: 760px; margin: 0 auto; }
.cta p { max-width: 560px; margin: 16px auto 0; color: var(--muted); font-size: 17px; }
.cta .hero-actions { justify-content: center; }
.cta::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--accent-line) 1px, transparent 1.2px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse at center, transparent 40%, #000 100%);
  opacity: 0.35;
}

.site-footer { position: relative; margin-top: auto; border-top: 1px solid var(--line); background: var(--bg-2); }
.footer-grid { display: grid; gap: 40px; padding: 64px 0 48px; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1.4fr repeat(4, minmax(0, 1fr)); gap: 32px; } }
.footer-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
@media (min-width: 900px) { .footer-cols { display: contents; } }
.footer-brand p { margin-top: 16px; max-width: 320px; color: var(--dim); font-size: 14px; }
.footer-col h4 { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); font-weight: 500; margin-bottom: 14px; }
.footer-col a { display: block; padding: 5px 0; font-size: 14px; color: var(--muted); transition: color 0.2s, transform 0.25s var(--ease); }
.footer-col a:hover { color: var(--accent); transform: translateX(3px); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0 28px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
}
.footer-bottom a:hover { color: var(--accent); }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status .pulse-dot { width: 6px; height: 6px; }
.footer-word {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(64px, 16vw, 220px);
  line-height: 0.8;
  letter-spacing: -0.06em;
  text-align: center;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-2);
  user-select: none;
  overflow: hidden;
  padding-top: 8px;
  mask-image: linear-gradient(#000 40%, transparent);
}

.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s var(--ease), visibility 0.3s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  filter: blur(4px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease), filter 0.8s var(--ease);
  transition-delay: calc(var(--d, 0) * 80ms);
}
.js .reveal.is-visible { opacity: 1; transform: none; filter: none; }

/* 404 */
.notfound { min-height: calc(100vh - var(--header-h) - 200px); display: grid; place-items: center; text-align: center; padding: 80px 0; }
.notfound .code { font-family: var(--font-display); font-size: clamp(90px, 20vw, 200px); font-weight: 600; letter-spacing: -0.06em; line-height: 0.9; }
.notfound .code span { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; filter: none; }
}

@media print {
  .site-header, .site-footer, .progress, .to-top, .mobile-nav { display: none !important; }
  body::before, body::after { display: none; }
  main { padding-top: 0; }
}
