/* ==========================================================================
   CS331 · Network Labs — site styles (design system shared with the CS330 site, network accent)
   Dark-first, with a light theme toggled via [data-theme="light"].
   ========================================================================== */

:root {
  --bg: #050508;
  --bg-2: #090a10;
  --panel: rgba(12, 16, 24, 0.72);
  --panel-solid: #0c1018;
  --panel-2: #111623;
  --line: #19202e;
  --line-2: #263043;
  --text: #e8edf5;
  --muted: #97a3b6;
  --dim: #5f6b7e;
  --accent: #22d3ee;
  --accent-2: #a5f3fc;
  --accent-soft: rgba(34, 211, 238, 0.1);
  --accent-line: rgba(34, 211, 238, 0.34);
  --accent-ink: #021016;
  --hot: #fbbf24;
  --hot-soft: rgba(251, 191, 36, 0.1);
  --hot-line: rgba(251, 191, 36, 0.32);
  --good: #34d399;
  --bad: #fb7185;
  --grid: rgba(34, 211, 238, 0.04);
  --glow: 0 0 0 1px rgba(34, 211, 238, 0.2), 0 20px 60px -20px rgba(34, 211, 238, 0.3);

  /* Configuration palette, shared by every chart */
  --t1: #8b98ad;
  --t2: #fb7185;
  --t4: #fbbf24;
  --t6: #34d399;
  --t8: #22d3ee;
  --p1: #a78bfa;
  --p4: #f472b6;

  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.85);
  --radius: 16px;
  --radius-sm: 10px;
  --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: #f6f7fb;
  --bg-2: #eef1f7;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-solid: #ffffff;
  --panel-2: #f3f5fa;
  --line: #dfe4ee;
  --line-2: #cad2e0;
  --text: #0b1220;
  --muted: #4a566b;
  --dim: #7b879b;
  --accent: #0e7490;
  --accent-2: #155e75;
  --accent-soft: rgba(14, 116, 144, 0.08);
  --accent-line: rgba(14, 116, 144, 0.3);
  --accent-ink: #ffffff;
  --hot: #b45309;
  --hot-soft: rgba(180, 83, 9, 0.08);
  --hot-line: rgba(180, 83, 9, 0.3);
  --good: #047857;
  --bad: #be123c;
  --grid: rgba(14, 116, 144, 0.05);
  --glow: 0 0 0 1px rgba(14, 116, 144, 0.18), 0 20px 50px -24px rgba(14, 116, 144, 0.3);

  --t1: #64748b;
  --t2: #e11d48;
  --t4: #d97706;
  --t6: #059669;
  --t8: #0e7490;
  --p1: #7c3aed;
  --p4: #db2777;

  --shadow: 0 24px 60px -30px rgba(15, 30, 60, 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 toward the bottom */
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%);
  -webkit-mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 30%, transparent 85%);
}

/* Soft aurora 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(34, 211, 238, 0.16), transparent),
    radial-gradient(closest-side at 70% 45%, rgba(251, 191, 36, 0.07), transparent);
  filter: blur(20px);
  animation: aurora 18s ease-in-out infinite alternate;
}
:root[data-theme="light"] body::after { opacity: 0.55; }

@keyframes aurora {
  0% { transform: translateX(-50%) translateY(0) scale(1); }
  100% { transform: translateX(-46%) translateY(4vh) scale(1.08); }
}

main { flex: 1; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }

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

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

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  height: 2px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--accent), var(--hot));
}

.grad-text {
  background: linear-gradient(100deg, var(--accent-2) 0%, var(--accent) 45%, var(--hot) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradShift 8s ease-in-out infinite alternate;
}
@keyframes gradShift { to { background-position: 100% 0; } }

.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   Buttons, chips, kicker
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font: 500 14.5px/1 var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  transition: transform 0.25s var(--ease), border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent-line); box-shadow: var(--glow); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: 0 10px 30px -12px var(--accent);
}
.btn-primary:hover { background: var(--accent-2); border-color: transparent; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 10px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  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(--line-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font: 500 12.5px/1.5 var(--font-mono);
}
.chip .icon { width: 14px; height: 14px; }
.chip b { color: var(--text); font-weight: 600; }

.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--accent);
  font: 500 12.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 500 12.5px/1.4 var(--font-mono);
  letter-spacing: 0.04em;
}

.pulse-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
}
.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--good);
  animation: ping 2s var(--ease) infinite;
}
@keyframes ping {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2); opacity: 0; }
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
  font: 500 11px/1 var(--font-mono);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-color: var(--line);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font: 500 15px/1 var(--font-mono);
  color: var(--text);
  white-space: nowrap;
}
.brand-text > span { color: var(--dim); }
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), #2f6fe0 60%, #1e3fae);
  color: #fff;
  box-shadow: 0 8px 24px -10px var(--accent);
}
.brand-mark::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 10px #fbbf24;
}
.brand-mark .icon { width: 19px; height: 19px; }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}
.nav-item { position: relative; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: 500 14px/1 var(--font-sans);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.nav-link .chev { width: 14px; height: 14px; transition: transform 0.25s var(--ease); }
.nav-item:hover .nav-link,
.nav-item.open .nav-link { color: var(--text); background: var(--panel-2); }
.nav-item:hover .chev, .nav-item.open .chev { transform: rotate(180deg); }
.nav-item.is-active .nav-link { color: var(--text); }
.nav-item.is-active .nav-link::after {
  content: "";
  width: 5px;
  height: 5px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--accent);
}

.dropdown {
  position: absolute;
  top: 100%;
  left: -10px;
  padding-top: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.25s var(--ease), visibility 0.2s;
}
.nav-item:hover .dropdown,
.nav-item.open .dropdown,
.nav-item:focus-within .dropdown { opacity: 1; visibility: visible; transform: none; }
.dropdown-inner {
  width: 330px;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}
.dropdown-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 10px;
  color: var(--dim);
  font: 500 11.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dropdown-label .icon { width: 14px; height: 14px; color: var(--accent); }
.dd-link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  transition: background 0.2s;
}
.dd-link:hover, .dd-link.is-current { background: var(--panel-2); }
.dd-link b { display: block; font-size: 14px; font-weight: 500; line-height: 1.35; }
.dd-link small { display: block; margin-top: 2px; color: var(--dim); font-size: 12.5px; line-height: 1.45; }
.dd-link.is-current b { color: var(--accent); }
.dd-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-2);
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
}
.dd-icon .icon { width: 16px; height: 16px; }
.dd-link:hover .dd-icon { color: var(--accent); border-color: var(--accent-line); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--dim);
  font: 400 13.5px/1 var(--font-sans);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.search-trigger:hover { border-color: var(--line-2); color: var(--muted); }
.search-trigger span { min-width: 90px; text-align: left; }
.search-trigger .icon { width: 16px; height: 16px; }

.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; }
.theme-toggle:active .icon { transform: rotate(-30deg); }
.theme-toggle .icon { transition: transform 0.3s var(--ease); }

.menu-btn { display: none; }
.menu-btn .bars,
.menu-btn .bars::before,
.menu-btn .bars::after {
  display: block;
  width: 16px;
  height: 1.8px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.menu-btn .bars { position: relative; }
.menu-btn .bars::before, .menu-btn .bars::after { content: ""; position: absolute; left: 0; }
.menu-btn .bars::before { top: -5px; }
.menu-btn .bars::after { top: 5px; }
.menu-open .menu-btn .bars { background: transparent; }
.menu-open .menu-btn .bars::before { transform: translateY(5px) rotate(45deg); }
.menu-open .menu-btn .bars::after { transform: translateY(-5px) rotate(-45deg); }

.mobile-nav {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 99;
  padding: 12px 20px 40px;
  overflow-y: auto;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.3s var(--ease), visibility 0.25s;
}
.menu-open .mobile-nav { opacity: 1; visibility: visible; transform: none; }
.menu-open { overflow: hidden; }
.m-group { padding: 14px 0; border-bottom: 1px solid var(--line); }
.m-label {
  margin-bottom: 6px;
  color: var(--dim);
  font: 500 11.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mobile-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  color: var(--muted);
  font-size: 15.5px;
}
.mobile-nav a[aria-current="page"] { color: var(--accent); }

@media (max-width: 1080px) {
  .hide-md { display: none; }
  .search-trigger { padding: 0; width: 38px; justify-content: center; }
}
@media (max-width: 920px) {
  .nav { display: none; }
  .menu-btn { display: inline-grid; }
}
@media (max-width: 560px) {
  .hide-sm { display: none !important; }
  .brand-text > span { display: none; }
}

/* --------------------------------------------------------------------------
   Reveal animations
   -------------------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.js .reveal.in { opacity: 1; transform: none; }

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

/* --------------------------------------------------------------------------
   Home hero
   -------------------------------------------------------------------------- */
.hero { padding: 72px 0 56px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  gap: 56px;
  align-items: center;
}
.hero h1 {
  margin: 0 0 24px;
  font: 600 clamp(40px, 6.2vw, 74px)/1.02 var(--font-display);
  letter-spacing: -0.035em;
}
.hero h1 .line { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero h1 .line > span {
  display: inline-block;
  transform: translateY(105%);
  animation: lineUp 1s var(--ease) forwards;
  animation-delay: calc(var(--i) * 110ms + 120ms);
}
@keyframes lineUp { to { transform: none; } }

.lead {
  max-width: 560px;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 17.5px;
  line-height: 1.7;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

.byline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 36px;
  color: var(--dim);
  font-size: 13.5px;
}
.byline b { color: var(--muted); font-weight: 500; }
.avatars { display: flex; }
.avatars span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-left: -8px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: linear-gradient(140deg, var(--c, var(--accent)), color-mix(in srgb, var(--c, var(--accent)) 45%, #000));
  color: #fff;
  font: 600 11px/1 var(--font-mono);
}
.avatars span:first-child { margin-left: 0; }

/* Terminal "machine" in the hero */
.hero-visual { position: relative; }
.machine {
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--panel-solid);
  box-shadow: var(--shadow), var(--glow);
  overflow: hidden;
}
.machine::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(600px 200px at 80% 0%, var(--accent-soft), transparent 70%);
}
.machine-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  font: 500 12.5px/1 var(--font-mono);
  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: 1px solid var(--accent-line);
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  text-transform: lowercase;
}
.term {
  height: 260px;
  margin: 0;
  padding: 18px 20px;
  overflow: hidden;
  font: 400 13px/1.7 var(--font-mono);
  color: var(--muted);
  white-space: pre;
}
.term .p { color: var(--good); }
.term .c { color: var(--text); }
.term .o { color: var(--muted); }
.term .h { color: var(--hot); }
.term .a { color: var(--accent); }
.term .b { color: var(--bad); }
.term .cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.cores {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.core { display: grid; gap: 6px; }
.core-bar {
  position: relative;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  overflow: hidden;
}
.core-bar i {
  position: absolute;
  inset: auto 0 0 0;
  height: calc(var(--load, 0.04) * 100%);
  background: linear-gradient(to top, var(--cc, var(--accent)), color-mix(in srgb, var(--cc, var(--accent)) 40%, transparent));
  transition: height 0.45s var(--ease);
}
.core-label {
  color: var(--dim);
  font: 500 10px/1 var(--font-mono);
  text-align: center;
}
.core.e .core-label { color: color-mix(in srgb, var(--dim) 70%, transparent); }

.float-tag {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  font: 500 12.5px/1 var(--font-mono);
  color: var(--text);
  animation: float 6s ease-in-out infinite;
}
.float-tag .icon { width: 15px; height: 15px; color: var(--hot); }
.float-tag.t1 { top: -18px; right: 28px; }
.float-tag.t2 { bottom: 70px; left: -34px; animation-delay: -3s; }
.float-tag.t2 .icon { color: var(--good); }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero { padding-top: 48px; }
  .float-tag.t2 { left: 12px; }
}
@media (max-width: 560px) {
  .term { font-size: 11.5px; height: 240px; padding: 14px; }
  .cores { gap: 5px; padding: 12px 14px 14px; }
  .float-tag { display: none; }
}

/* --------------------------------------------------------------------------
   Stats, marquee
   -------------------------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.stat { padding: 26px 26px 24px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; }
.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font: 600 clamp(30px, 3.6vw, 42px)/1 var(--font-display);
  letter-spacing: -0.03em;
}
.stat-value small { color: var(--accent); font-size: 0.5em; font-weight: 500; }
.stat-label { margin-top: 10px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
@media (max-width: 820px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

.marquee {
  position: relative;
  overflow: hidden;
  padding: 22px 0;
  border-block: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  gap: 48px;
  width: max-content;
  animation: marquee 42s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  display: inline-flex;
  align-items: center;
  gap: 48px;
  color: var(--dim);
  font: 500 15px/1 var(--font-mono);
  white-space: nowrap;
}
.marquee-track span::after { content: "◆"; font-size: 8px; color: var(--accent); opacity: 0.7; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* --------------------------------------------------------------------------
   Sections & cards
   -------------------------------------------------------------------------- */
.section { padding: 96px 0; }
.section-tight { padding: 40px 0; }
@media (max-width: 640px) { .section { padding: 64px 0; } }

.section-head { max-width: 720px; margin-bottom: 44px; }
.section-head h2 {
  margin: 0 0 16px;
  font: 600 clamp(28px, 3.6vw, 44px)/1.12 var(--font-display);
  letter-spacing: -0.03em;
}
.section-head p { margin: 0; color: var(--muted); font-size: 16.5px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center .kicker { justify-content: center; }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.gap-lg { gap: 48px; }
@media (max-width: 980px) { .g-4 { grid-template-columns: repeat(2, 1fr); } .g-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .g-2, .g-3, .g-4 { grid-template-columns: 1fr; } .gap-lg { gap: 32px; } }

.card {
  position: relative;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  transition: border-color 0.3s, transform 0.35s var(--ease), box-shadow 0.35s;
  overflow: hidden;
}
.card::before {
  /* Pointer-following spotlight, driven by --mx / --my from site.js */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 60%);
  transition: opacity 0.3s;
}
.card:hover::before { opacity: 1; }
.card h3 { margin: 0 0 8px; font: 600 18px/1.3 var(--font-display); letter-spacing: -0.01em; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.65; }
.card-link:hover { transform: translateY(-4px); border-color: var(--accent-line); box-shadow: var(--glow); }
.card-link .go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--accent);
  font: 500 13px/1 var(--font-mono);
}
.card-link .go .icon { width: 14px; height: 14px; transition: transform 0.3s var(--ease); }
.card-link:hover .go .icon { transform: translateX(4px); }
.card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.card-icon.hot { border-color: var(--hot-line); background: var(--hot-soft); color: var(--hot); }
.card-index {
  position: absolute;
  top: 22px;
  right: 24px;
  color: var(--dim);
  font: 500 12px/1 var(--font-mono);
}

/* Phase cards on the home page */
.phase-card { padding: 34px; display: flex; flex-direction: column; }
.phase-card h3 { font-size: 26px; margin-bottom: 12px; }
.phase-card .tagline { color: var(--muted); margin-bottom: 26px; }
.phase-card .kv {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0 0 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
  overflow: hidden;
}
.phase-card .kv div { padding: 14px; background: var(--panel-solid); }
.phase-card .kv dt { color: var(--dim); font: 500 11px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.phase-card .kv dd { margin: 6px 0 0; font: 600 20px/1.1 var(--font-display); }
.phase-card .kv dd.bad { color: var(--bad); }
.phase-card .kv dd.good { color: var(--good); }
.phase-card .links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }
.phase-card .verdict {
  display: flex;
  gap: 10px;
  margin-bottom: 26px;
  padding: 14px 16px;
  border-left: 2px solid var(--c, var(--accent));
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--c, var(--accent)) 8%, transparent);
  font-size: 14.5px;
  color: var(--text);
}
@media (max-width: 560px) { .phase-card { padding: 24px; } .phase-card .kv dd { font-size: 17px; } }

/* --------------------------------------------------------------------------
   Panels & charts
   -------------------------------------------------------------------------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.panel-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font: 500 12.5px/1 var(--font-mono);
}
.panel-title .icon { width: 15px; height: 15px; color: var(--accent); }
.panel-body { padding: 24px; }
@media (max-width: 560px) { .panel-body { padding: 18px 14px; } }

.legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--dim); font: 500 12px/1 var(--font-mono); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.legend i.dash { height: 0; border-top: 2px dashed var(--c); border-radius: 0; background: none; }

.bars { display: grid; gap: 14px; }
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 14px;
}
.bar-label { color: var(--muted); font: 500 13px/1.3 var(--font-mono); }
.bar-label b { color: var(--text); font-weight: 600; }
.bar-track {
  position: relative;
  height: 30px;
  border-radius: 8px;
  background: var(--panel-2);
}
.bar-fill {
  height: 100%;
  width: calc(var(--v) * 1%);
  border-radius: 8px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, transparent), var(--c));
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 1.2s var(--ease);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.bar-value {
  position: absolute;
  top: 50%;
  left: calc(var(--v) * 1% + 10px);
  transform: translateY(-50%);
  color: var(--text);
  font: 600 12.5px/1 var(--font-mono);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.6s 0.8s;
}
.bar-value small { color: var(--dim); font-weight: 500; }
.in .bar-fill, .bars.in .bar-fill { transform: scaleX(1); }
.in .bar-value { opacity: 1; }
.no-js .bar-fill { transform: none; }
.no-js .bar-value { opacity: 1; }
@media (max-width: 560px) { .bar-row { grid-template-columns: 78px 1fr; gap: 10px; } }

/* SVG charts built by viz.js */
.chart { position: relative; width: 100%; }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart .axis line, .chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis text, .chart .tick { fill: var(--dim); font: 500 13px var(--font-mono); }
.chart .axis-title { fill: var(--muted); font: 500 13px var(--font-mono); }
.chart .ideal { fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-dasharray: 5 6; }
.chart .baseline { stroke: var(--dim); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .series {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .area { fill: url(#areaGrad); opacity: 0.9; }
.chart .dot { stroke: var(--panel-solid); stroke-width: 3; transition: r 0.2s; }
.chart .dot:hover { r: 8; }
.chart .dot-label { fill: var(--text); font: 600 14px var(--font-mono); }
.chart .draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); transition: stroke-dashoffset 1.8s var(--ease); }
.chart.in .draw { stroke-dashoffset: 0; }
.chart .pop { opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.4); transition: opacity 0.4s, transform 0.5s var(--ease); transition-delay: calc(0.4s + var(--i) * 0.18s); }
.chart.in .pop { opacity: 1; transform: none; }
.chart-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  padding: 8px 11px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  font: 500 12px/1.55 var(--font-mono);
  color: var(--muted);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity 0.15s;
  white-space: nowrap;
}
.chart-tip b { color: var(--text); }
.chart-tip.show { opacity: 1; }

/* Phase I dumbbell comparison */
.dumbbell { display: grid; gap: 22px; }
.db-row { display: grid; grid-template-columns: 90px 1fr 74px; gap: 14px; align-items: center; }
.db-label { font: 600 13px/1.3 var(--font-mono); }
.db-label small { display: block; color: var(--dim); font-weight: 500; }
.db-track { position: relative; height: 34px; }
.db-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-2); }
.db-line {
  position: absolute;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
  left: calc(var(--a) * 1%);
  width: calc((var(--b) - var(--a)) * 1%);
  border-radius: 2px;
  background: linear-gradient(90deg, var(--p1), var(--p4));
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 1s var(--ease) 0.3s;
}
.db-dot {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 3px solid var(--panel-solid);
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 1px var(--c);
  left: calc(var(--x) * 1%);
  opacity: 0;
  transition: opacity 0.4s, left 1s var(--ease);
}
.db-dot span {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font: 500 11px/1 var(--font-mono);
  white-space: nowrap;
}
.in .db-line { transform: scaleX(1); }
.in .db-dot { opacity: 1; }
.no-js .db-line { transform: none; }
.no-js .db-dot { opacity: 1; }
.db-verdict { font: 600 13px/1 var(--font-mono); text-align: right; }
.db-verdict.bad { color: var(--bad); }
.db-verdict.even { color: var(--muted); }
@media (max-width: 560px) { .db-row { grid-template-columns: 64px 1fr 52px; gap: 8px; } }

/* --------------------------------------------------------------------------
   Thread lab (interactive)
   -------------------------------------------------------------------------- */
.lab { display: grid; grid-template-columns: 1.35fr 1fr; }
.lab-main { padding: 24px; border-right: 1px solid var(--line); }
.lab-side { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 900px) { .lab { grid-template-columns: 1fr; } .lab-main { border-right: 0; border-bottom: 1px solid var(--line); } }
@media (max-width: 560px) { .lab-main, .lab-side { padding: 18px 14px; } }

.seg {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
}
.seg button {
  position: relative;
  min-width: 44px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: 600 13px/1 var(--font-mono);
  cursor: pointer;
  transition: color 0.2s, background 0.25s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--panel-solid); color: var(--text); box-shadow: 0 0 0 1px var(--line-2), 0 6px 16px -8px rgba(0,0,0,.5); }
.seg button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 14px;
  height: 2px;
  margin-left: -7px;
  border-radius: 2px;
  background: var(--c);
}

.lab-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.lab-label { color: var(--dim); font: 500 12px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }

.array-strip {
  display: grid;
  grid-template-columns: repeat(48, 1fr);
  gap: 3px;
  margin-bottom: 8px;
}
.array-strip i {
  height: 26px;
  border-radius: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: background 0.35s, border-color 0.35s;
}
.array-strip i.on { background: color-mix(in srgb, var(--c) 70%, transparent); border-color: transparent; }
.array-caption { display: flex; justify-content: space-between; color: var(--dim); font: 500 11px/1 var(--font-mono); margin-bottom: 22px; }
@media (max-width: 560px) { .array-strip { gap: 2px; } .array-strip i { height: 20px; } }

.lanes { display: grid; gap: 8px; }
.lane { display: grid; grid-template-columns: 74px 1fr 64px; gap: 12px; align-items: center; animation: laneIn 0.45s var(--ease) both; animation-delay: calc(var(--i) * 50ms); }
@keyframes laneIn { from { opacity: 0; transform: translateX(-8px); } }
.lane-name { color: var(--muted); font: 500 12px/1 var(--font-mono); }
.lane-track { position: relative; height: 12px; border-radius: 6px; background: var(--panel-2); overflow: hidden; }
.lane-track i { position: absolute; inset: 0; border-radius: 6px; background: var(--c); transform-origin: 0 50%; transform: scaleX(var(--w, 0)); }
.lane-core { color: var(--dim); font: 500 11px/1 var(--font-mono); text-align: right; }
.lane-core b { color: var(--text); font-weight: 600; }

.readout { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line); border-radius: 12px; background: var(--line); overflow: hidden; }
.readout div { padding: 14px; background: var(--panel-solid); }
.readout dt { color: var(--dim); font: 500 10.5px/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.readout dd { margin: 8px 0 0; font: 600 22px/1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.readout dd small { font-size: 0.55em; color: var(--dim); font-weight: 500; margin-left: 2px; }
.lab-note {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--c, var(--accent));
  border-radius: 10px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  min-height: 96px;
}
.lab-note b { color: var(--text); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.race-btn { align-self: flex-start; }

/* CPU map in the lab */
.cpu-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cpu-map .c {
  position: relative;
  padding: 10px 10px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-2);
  font: 500 11px/1 var(--font-mono);
  color: var(--dim);
  transition: border-color 0.3s, background 0.3s, color 0.3s, box-shadow 0.3s;
}
.cpu-map .c small { display: block; margin-top: 5px; font-size: 10px; opacity: 0.8; }
.cpu-map .c.busy { color: var(--text); border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 12%, var(--bg-2)); box-shadow: 0 0 20px -8px var(--c); }
.cpu-map .c.busy::after { content: ""; position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); animation: blink 0.8s steps(1) infinite; }

/* --------------------------------------------------------------------------
   Process vs thread explainer
   -------------------------------------------------------------------------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .compare { grid-template-columns: 1fr; } }
.diagram { margin: 20px 0 6px; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram .box { fill: var(--panel-2); stroke: var(--line-2); }
.diagram .box.hl { stroke: var(--c); fill: color-mix(in srgb, var(--c) 10%, var(--panel-2)); }
.diagram text { fill: var(--muted); font: 500 11px var(--font-mono); }
.diagram text.t { fill: var(--text); font-weight: 600; }
.diagram .wire { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.diagram .flow { fill: none; stroke: var(--c); stroke-width: 1.8; stroke-dasharray: 4 6; animation: dash 1.4s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -20; } }

/* --------------------------------------------------------------------------
   Team strip (home) + team page
   -------------------------------------------------------------------------- */
.team-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
@media (max-width: 1000px) { .team-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .team-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px) { .team-grid { grid-template-columns: 1fr; } }
.member {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 22px 20px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  width: 100%;
}
.avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 40%, #000));
  color: #fff;
  font: 600 16px/1 var(--font-display);
  box-shadow: 0 10px 28px -12px var(--c);
  transition: transform 0.4s var(--ease), border-radius 0.4s var(--ease);
}
.member:hover .avatar { transform: rotate(-6deg) scale(1.05); border-radius: 50%; }
.member b { font: 600 15.5px/1.3 var(--font-display); }
.member .role { color: var(--muted); font-size: 13px; line-height: 1.45; }
.member .sid { margin-top: 10px; color: var(--dim); font: 500 11.5px/1 var(--font-mono); }
.member .more { margin-top: 14px; color: var(--accent); font: 500 12px/1 var(--font-mono); display: inline-flex; gap: 6px; align-items: center; }
.member .more .icon { width: 13px; height: 13px; transition: transform 0.3s var(--ease); }
.member:hover .more .icon { transform: translateX(3px); }

.drawer {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  visibility: hidden;
}
.drawer.open { visibility: visible; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(2, 5, 10, 0.6); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s; }
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: relative;
  width: min(480px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 28px;
  border-left: 1px solid var(--line-2);
  background: var(--panel-solid);
  transform: translateX(100%);
  transition: transform 0.45s var(--ease);
}
.drawer.open .drawer-panel { transform: none; }
.drawer-close { position: absolute; top: 20px; right: 20px; }
.drawer .avatar { width: 64px; height: 64px; font-size: 20px; margin-bottom: 18px; border-radius: 18px; }
.drawer h3 { margin: 0; font: 600 26px/1.2 var(--font-display); letter-spacing: -0.02em; }
.drawer .dept { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.drawer h4 { margin: 28px 0 12px; color: var(--dim); font: 500 11.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.drawer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.drawer li { position: relative; padding: 12px 14px 12px 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); color: var(--muted); font-size: 14px; line-height: 1.55; }
.drawer li::before { content: ""; position: absolute; left: 14px; top: 19px; width: 7px; height: 7px; border-radius: 2px; background: var(--c, var(--accent)); transform: rotate(45deg); }
.drawer li b { color: var(--text); font-weight: 600; }
.drawer .links { display: flex; flex-wrap: wrap; gap: 8px; }

/* --------------------------------------------------------------------------
   CTA
   -------------------------------------------------------------------------- */
.cta {
  position: relative;
  padding: 72px 32px;
  border: 1px solid var(--line-2);
  border-radius: 24px;
  background:
    radial-gradient(600px 240px at 50% 0%, var(--accent-soft), transparent 70%),
    var(--panel);
  text-align: center;
  overflow: hidden;
}
.cta::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(closest-side, #000, transparent);
  -webkit-mask-image: radial-gradient(closest-side, #000, transparent);
}
.cta > * { position: relative; z-index: 1; }
.cta .kicker { justify-content: center; }
.cta h2 { margin: 0 auto 16px; max-width: 700px; font: 600 clamp(28px, 4vw, 46px)/1.1 var(--font-display); letter-spacing: -0.03em; }
.cta p { max-width: 560px; margin: 0 auto 30px; color: var(--muted); }
.cta .hero-actions { justify-content: center; }
@media (max-width: 560px) { .cta { padding: 52px 20px; } }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  position: relative;
  margin-top: 40px;
  padding: 64px 0 0;
  border-top: 1px solid var(--line);
  background: linear-gradient(to bottom, transparent, var(--bg-2));
  overflow: hidden;
}
.footer-grid { display: grid; grid-template-columns: 1fr 2.2fr; gap: 56px; }
.footer-brand p { max-width: 320px; margin: 18px 0; color: var(--muted); font-size: 14px; }
.footer-mail { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font: 500 13px/1 var(--font-mono); }
.footer-mail .icon { width: 15px; height: 15px; }
.footer-cols { display: grid; grid-template-columns: repeat(5, 1fr); gap: 24px; }
.footer-col h4 { margin: 0 0 14px; color: var(--dim); font: 500 11.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.footer-col a { display: block; padding: 5px 0; color: var(--muted); font-size: 14px; transition: color 0.2s, transform 0.2s; }
.footer-col a:hover { color: var(--text); transform: translateX(3px); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 56px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font: 500 12.5px/1.5 var(--font-mono);
}
.footer-bottom a:hover { color: var(--text); }
.footer-bottom .status { display: inline-flex; align-items: center; gap: 10px; }
.footer-word {
  margin: 0 0 -0.26em;
  padding: 0 16px;
  text-align: center;
  font: 700 clamp(56px, 13vw, 190px)/1 var(--font-display);
  letter-spacing: -0.05em;
  white-space: nowrap;
  background: linear-gradient(to bottom, var(--line-2), transparent 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: none;
}
@media (max-width: 1000px) {
  .footer-grid { grid-template-columns: 1fr; gap: 40px; }
  .footer-cols { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) { .footer-cols { grid-template-columns: repeat(2, 1fr); } }

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

/* --------------------------------------------------------------------------
   Inner pages
   -------------------------------------------------------------------------- */
.page-hero { padding: 64px 0 40px; }
.page-hero h1 {
  max-width: 900px;
  margin: 0 0 20px;
  font: 600 clamp(34px, 5vw, 60px)/1.06 var(--font-display);
  letter-spacing: -0.035em;
}
.page-hero .lead { max-width: 720px; margin-bottom: 26px; }
.page-hero .kicker { margin-top: 26px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; }
.page-hero .hero-actions { margin-top: 28px; }
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font: 500 13px/1 var(--font-mono);
}
.crumbs a { color: var(--accent); }
.crumbs .here { color: var(--text); }

.page-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 64px;
  align-items: start;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.page-body.no-toc { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1080px) { .page-body { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }

.toc { position: sticky; top: calc(var(--header-h) + 28px); padding-top: 28px; }
.toc-title { margin-bottom: 14px; color: var(--dim); font: 500 11.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.toc nav { display: grid; border-left: 1px solid var(--line); }
.toc nav a {
  position: relative;
  padding: 7px 0 7px 16px;
  color: var(--dim);
  font-size: 13.5px;
  line-height: 1.4;
  transition: color 0.2s;
}
.toc nav a:hover { color: var(--text); }
.toc nav a.active { color: var(--text); }
.toc nav a.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.toc-top { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; color: var(--dim); font: 500 12px/1 var(--font-mono); }
.toc-top .icon { width: 13px; height: 13px; }
.toc-top:hover { color: var(--accent); }

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 72px;
  margin-bottom: 40px;
}
.pager a {
  display: grid;
  gap: 8px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.25s, transform 0.3s var(--ease), box-shadow 0.3s;
}
.pager a:hover { border-color: var(--accent-line); transform: translateY(-3px); box-shadow: var(--glow); }
.pager .next { text-align: right; grid-column: 2; }
.pager .dir { display: inline-flex; align-items: center; gap: 6px; color: var(--dim); font: 500 12px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.pager .next .dir { justify-content: flex-end; }
.pager .dir .icon { width: 14px; height: 14px; }
.pager b { font: 600 18px/1.3 var(--font-display); }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; } }

/* --------------------------------------------------------------------------
   Prose (Markdown content)
   -------------------------------------------------------------------------- */
.prose { counter-reset: sec; padding-top: 12px; min-width: 0; }
.prose > * { max-width: 100%; }
.prose p, .prose li { color: var(--muted); font-size: 16px; line-height: 1.8; }
.prose p { margin: 0 0 18px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a:not(.btn):not(.card):not(.headerlink) {
  color: var(--accent);
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.3s var(--ease);
}
.prose a:not(.btn):not(.card):not(.headerlink):hover { background-size: 100% 1px; }

.prose h2 {
  counter-increment: sec;
  margin: 72px 0 22px;
  font: 600 clamp(24px, 2.8vw, 32px)/1.2 var(--font-display);
  letter-spacing: -0.025em;
  color: var(--text);
}
.prose h2::before {
  content: counter(sec, decimal-leading-zero) " /";
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font: 500 12.5px/1 var(--font-mono);
  letter-spacing: 0.08em;
}
.prose > h2:first-child, .prose > .toc-anchor + h2 { margin-top: 36px; }
.prose h3 { margin: 40px 0 14px; font: 600 19px/1.35 var(--font-display); color: var(--text); letter-spacing: -0.01em; }
.prose h4 { margin: 28px 0 10px; font: 600 16px/1.4 var(--font-sans); color: var(--text); }
.prose .headerlink {
  margin-left: 10px;
  color: var(--dim);
  opacity: 0;
  font-family: var(--font-mono);
  font-size: 0.8em;
  transition: opacity 0.2s, color 0.2s;
}
.prose :is(h2, h3, h4):hover .headerlink { opacity: 1; }
.prose .headerlink:hover { color: var(--accent); }

.prose ul, .prose ol { margin: 0 0 22px; padding-left: 0; list-style: none; }
.prose li { position: relative; padding-left: 26px; margin-bottom: 8px; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0.78em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
  opacity: 0.8;
}
.prose ol { counter-reset: li; }
.prose ol > li { counter-increment: li; padding-left: 34px; }
.prose ol > li::before {
  content: counter(li, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.2em;
  color: var(--accent);
  font: 600 12.5px/1.8 var(--font-mono);
}
.prose li > ul, .prose li > ol { margin: 8px 0 0; }

.prose hr { margin: 56px 0; border: 0; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); }
.prose blockquote {
  margin: 0 0 24px;
  padding: 16px 20px;
  border-left: 2px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
}
.prose blockquote p:last-child { margin: 0; }
.prose img { border-radius: 12px; border: 1px solid var(--line); }

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

/* Tables */
.table-wrap {
  margin: 0 0 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.prose thead th {
  position: sticky;
  top: 0;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--dim);
  font: 500 11.5px/1.3 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.prose td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--muted); vertical-align: top; }
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr { transition: background 0.2s; }
.prose tbody tr:hover { background: var(--accent-soft); }
.prose td:first-child { color: var(--text); font-weight: 500; }
.prose td[align="right"], .prose th[align="right"] { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13.5px; }
.prose table.dense th, .prose table.dense td { padding: 10px 9px; font-size: 12.5px; }
.prose tr.best td { background: color-mix(in srgb, var(--good) 8%, transparent); }
.status-done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--good) 12%, transparent);
  color: var(--good);
  font: 500 12px/1.6 var(--font-mono);
  white-space: nowrap;
}
.status-done::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.neg { color: var(--bad) !important; }
.pos { color: var(--good) !important; }

/* Cards inside prose */
.prose .grid { margin: 0 0 28px; }
.prose .card p { font-size: 14.5px; line-height: 1.65; margin: 0; }
.prose .card p + p { margin-top: 10px; }
.prose .card h3 { margin: 0 0 8px; }
.prose .card ul { margin: 10px 0 0; }
.prose .card li { font-size: 14px; margin-bottom: 4px; }
.prose .card .highlight { margin: 12px 0 0; }
.prose .card .card-icon { margin-bottom: 16px; }
.prose .card > :last-child { margin-bottom: 0; }

/* Big figure numbers inside prose */
.prose .stats { margin: 8px 0 32px; }
.prose .stat-label { font-size: 13px; }

/* Admonitions → callouts */
.admonition, details {
  --c: var(--accent);
  position: relative;
  margin: 0 0 24px;
  padding: 18px 20px 18px 54px;
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--c) 6%, var(--panel));
}
.admonition::before, details > summary::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 20px;
  width: 20px;
  height: 20px;
  background: var(--c);
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
.admonition { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E"); }
.admonition.tip, .admonition.success { --c: var(--good); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpath d='M22 4 12 14.01l-3-3'/%3E%3C/svg%3E"); }
.admonition.warning, .admonition.danger { --c: var(--hot); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.admonition.danger { --c: var(--bad); }
.admonition.quote, .admonition.abstract { --c: var(--p1); --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 13.9 8.1 19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9z'/%3E%3C/svg%3E"); }
.admonition-title {
  margin: 0 0 6px !important;
  color: var(--text) !important;
  font: 600 15px/1.5 var(--font-sans) !important;
}
.admonition p { font-size: 15px; line-height: 1.7; }
.admonition > :last-child { margin-bottom: 0; }

details { padding: 0; --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m16 18 6-6-6-6'/%3E%3Cpath d='m8 6-6 6 6 6'/%3E%3C/svg%3E"); }
details > summary {
  position: relative;
  padding: 16px 52px 16px 54px;
  color: var(--text);
  font: 600 15px/1.5 var(--font-sans);
  list-style: none;
  cursor: pointer;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before { top: 17px; }
details > summary::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 1.8px solid var(--dim);
  border-bottom: 1.8px solid var(--dim);
  transform: rotate(45deg);
  transition: transform 0.3s var(--ease);
}
details[open] > summary::after { transform: rotate(225deg); margin-top: -2px; }
details > :not(summary) { margin: 0 20px 20px !important; }
details .highlight { margin-left: 20px; margin-right: 20px; }

/* Code blocks */
.highlight {
  position: relative;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-2);
  overflow: hidden;
}
:root[data-theme="light"] .highlight { background: #0d1320; border-color: #1c2536; }
.highlight .filename, .code-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font: 500 12px/1.4 var(--font-mono);
}
:root[data-theme="light"] .highlight .filename,
:root[data-theme="light"] .code-head { background: #121a2a; border-color: #1c2536; color: #a8b3c6; }
.code-head .lang { margin-left: auto; color: var(--dim); text-transform: lowercase; }
.code-head .dots i { width: 9px; height: 9px; }
.highlight pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font: 400 13.5px/1.7 var(--font-mono);
  color: #d7deea;
  tab-size: 4;
}
.highlight code { font: inherit; }
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid #263043;
  border-radius: 7px;
  background: transparent;
  color: #8a96aa;
  font: 500 11.5px/1 var(--font-mono);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover { color: #e8edf5; border-color: #3a4760; }
.copy-btn.done { color: #34d399; border-color: rgba(52, 211, 153, 0.4); }
.copy-btn .icon { width: 13px; height: 13px; }

/* Pygments tokens (one palette for both themes; code panels stay dark) */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .ch, .highlight .cs { color: #647088; font-style: italic; }
.highlight .cp, .highlight .cpf { color: #f472b6; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kc { color: #c792ea; }
.highlight .kt { color: #82aaff; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .sh { color: #a5e3a0; }
.highlight .se, .highlight .si { color: #fbbf24; }
.highlight .mi, .highlight .mf, .highlight .m, .highlight .il, .highlight .mh { color: #fbbf24; }
.highlight .nf, .highlight .fm { color: #7dd3fc; }
.highlight .nc, .highlight .nn { color: #fcd34d; }
.highlight .nb, .highlight .bp { color: #7dd3fc; }
.highlight .na, .highlight .nd { color: #fda4af; }
.highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: #e8edf5; }
.highlight .o, .highlight .ow { color: #89ddff; }
.highlight .p { color: #9aa6ba; }
.highlight .gp { color: #34d399; user-select: none; }
.highlight .go { color: #8a96aa; }
.highlight .err { color: inherit; background: none; }

/* Screenshot gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 0 0 28px;
}
.gallery p { margin: 0; }
.gallery figure, .shot {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  cursor: zoom-in;
  transition: transform 0.35s var(--ease), border-color 0.25s, box-shadow 0.35s;
}
.gallery figure:hover, .shot:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--glow); }
.gallery img, .shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 0; border-radius: 0; transition: transform 0.6s var(--ease); }
.gallery figure:hover img { transform: scale(1.04); }
.gallery figcaption, .shot figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 500 12.5px/1.4 var(--font-mono);
}
.gallery figcaption::after, .shot figcaption::after { content: "⤢"; color: var(--dim); }
.gallery.wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.gallery.contain img { object-fit: contain; background: #fff; }
.gallery.single { grid-template-columns: minmax(0, 560px); }
.gallery.single img { aspect-ratio: auto; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 64px 24px 32px;
  background: rgba(2, 5, 10, 0.88);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.25s;
}
.lightbox[hidden] { display: none; }
.lightbox.open { opacity: 1; }
.lightbox img { max-width: min(1200px, 100%); max-height: calc(100vh - 120px); border-radius: 12px; box-shadow: var(--shadow); transform: scale(0.96); transition: transform 0.35s var(--ease); }
.lightbox.open img { transform: none; }
.lightbox-close { position: absolute; top: 16px; right: 16px; }
.lightbox-cap { position: absolute; top: 24px; left: 24px; right: 72px; color: #c9d2e0; font: 500 13px/1.4 var(--font-mono); }

/* Embedded report frame */
.embed {
  margin: 0 0 28px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.embed .machine-bar a { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
.embed .machine-bar a .icon { width: 13px; height: 13px; }
.embed iframe { display: block; width: 100%; height: min(1100px, 80vh); border: 0; background: #fff; }

/* Filter box (commands, glossary) */
.filter {
  position: sticky;
  top: calc(var(--header-h) + 10px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 28px;
  padding: 0 14px;
  height: 48px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-solid) 88%, transparent);
  backdrop-filter: blur(12px);
  color: var(--dim);
}
.filter input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--text); font: 400 15px/1 var(--font-sans); outline: none; }
.filter .count { font: 500 12px/1 var(--font-mono); white-space: nowrap; }
.filter-empty { display: none; padding: 32px; border: 1px dashed var(--line-2); border-radius: 14px; color: var(--dim); text-align: center; font-family: var(--font-mono); font-size: 13px; }
.filter-empty.show { display: block; }
.is-filtered-out { display: none !important; }

.cmd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 820px) { .cmd-grid { grid-template-columns: 1fr; } }
.cmd { display: flex; flex-direction: column; padding: 20px; }
.cmd h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px !important; font-size: 16px !important; }
.cmd h3::before { counter-increment: none; }
.cmd > p { font-size: 14px !important; margin-bottom: 14px !important; }
.cmd .highlight { margin: auto 0 0; }
.cmd .highlight pre { font-size: 12.5px; padding: 14px 16px; }

/* Glossary */
.prose dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 0 0 28px; }
@media (max-width: 720px) { .prose dl { grid-template-columns: 1fr; } }
.prose .gloss {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  transition: border-color 0.25s;
}
.prose .gloss:hover { border-color: var(--accent-line); }
.prose dt { margin-bottom: 6px; color: var(--text); font: 600 16px/1.35 var(--font-display); }
.prose dd { margin: 0; }
.prose dd p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.65; }
.prose dd p:last-child { margin: 0; }

/* Timeline / steps */
.steps { display: grid; gap: 0; margin: 0 0 28px; counter-reset: step; }
.step { position: relative; display: grid; grid-template-columns: 44px 1fr; gap: 18px; padding-bottom: 26px; }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--accent-line);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 13px/1 var(--font-mono);
}
.step::after { content: ""; position: absolute; left: 22px; top: 50px; bottom: 4px; width: 1px; background: linear-gradient(var(--line-2), transparent); }
.step:last-child::after { display: none; }
.step h4 { margin: 10px 0 4px !important; }
.step p { margin: 0 !important; font-size: 15px !important; }
.step .highlight { margin: 12px 0 0; }

/* Owner chain on work log */
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 28px; }
.chain span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); font: 500 13px/1 var(--font-mono); color: var(--text); }
.chain span i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chain em { color: var(--dim); font-style: normal; }

/* 404 */
.nf { padding: 120px 0 40px; text-align: center; }
.nf .code { font: 700 clamp(96px, 20vw, 200px)/1 var(--font-display); letter-spacing: -0.06em; }
.nf p { color: var(--muted); max-width: 460px; margin: 16px auto 32px; }
.nf .hero-actions { justify-content: center; }

/* --------------------------------------------------------------------------
   Search palette
   -------------------------------------------------------------------------- */
.palette { position: fixed; inset: 0; z-index: 190; display: flex; justify-content: center; padding: 12vh 16px 16px; }
.palette[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(2, 5, 10, 0.6); backdrop-filter: blur(6px); animation: fadeIn 0.2s; }
.palette-box {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(640px, 100%);
  max-height: 70vh;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--panel-solid);
  box-shadow: var(--shadow), var(--glow);
  overflow: hidden;
  animation: popIn 0.3s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); color: var(--dim); }
.palette-input input { flex: 1; height: 58px; border: 0; background: none; color: var(--text); font: 400 16px/1 var(--font-sans); outline: none; }
.palette-input input::-webkit-search-cancel-button { display: none; }
.palette-results { overflow-y: auto; padding: 8px; }
.palette-results a { display: block; padding: 12px 14px; border-radius: 10px; }
.palette-results a b { display: block; color: var(--text); font-weight: 500; font-size: 14.5px; }
.palette-results a small { display: block; margin-top: 3px; color: var(--dim); font: 500 11.5px/1.4 var(--font-mono); }
.palette-results a span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.palette-results a mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 2px; }
.palette-results a.sel { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.palette-empty { padding: 28px; color: var(--dim); text-align: center; font: 500 13px/1.5 var(--font-mono); }
.palette-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
.palette-foot kbd { margin-right: 4px; }
