/* ==========================================================================
   ABCOM Education — site stylesheet (base shared with abcom.com)
   Dark-first, follows the OS theme, overridable with [data-theme].
   ========================================================================== */

:root {
  --bg: #0a0e13;
  --bg-2: #0d1218;
  --surface: #111821;
  --surface-2: #16202b;
  --line: #1f2b38;
  --line-2: #2a3949;
  --text: #e6edf3;
  --text-2: #b4c0cc;
  --muted: #7d8da0;
  --accent: #3ddc97;
  --accent-ink: #062014;
  --accent-soft: rgba(61, 220, 151, 0.12);
  --amber: #ffb547;
  --blue: #6ea8fe;
  --pink: #ff7ab6;
  --grid: rgba(125, 141, 160, 0.07);
  --glow: rgba(61, 220, 151, 0.16);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.7);
  --face-top: #5bf0b0;
  --face-left: #2fc488;
  --face-right: #178a5c;
  --face-ink: #0a0e13;

  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 10px;
  --radius-lg: 16px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7f4;
    --bg-2: #eef1ec;
    --surface: #ffffff;
    --surface-2: #f3f5f2;
    --line: #dde3dc;
    --line-2: #c9d2c8;
    --text: #0d1410;
    --text-2: #344038;
    --muted: #5f6b63;
    --accent: #0c8a55;
    --accent-ink: #ffffff;
    --accent-soft: rgba(12, 138, 85, 0.1);
    --amber: #a85f00;
    --blue: #1f5fcf;
    --pink: #c02670;
    --grid: rgba(13, 20, 16, 0.05);
    --glow: rgba(12, 138, 85, 0.1);
    --shadow: 0 1px 2px rgba(13, 20, 16, 0.04), 0 18px 36px -24px rgba(13, 20, 16, 0.25);
    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f6f7f4;
  --bg-2: #eef1ec;
  --surface: #ffffff;
  --surface-2: #f3f5f2;
  --line: #dde3dc;
  --line-2: #c9d2c8;
  --text: #0d1410;
  --text-2: #344038;
  --muted: #5f6b63;
  --accent: #0c8a55;
  --accent-ink: #ffffff;
  --accent-soft: rgba(12, 138, 85, 0.1);
  --amber: #a85f00;
  --blue: #1f5fcf;
  --pink: #c02670;
  --grid: rgba(13, 20, 16, 0.05);
  --glow: rgba(12, 138, 85, 0.1);
  --shadow: 0 1px 2px rgba(13, 20, 16, 0.04), 0 18px 36px -24px rgba(13, 20, 16, 0.25);
  color-scheme: light;
}

:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body::before {
  /* blueprint grid */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 80%);
  pointer-events: none;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4 {
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); font-weight: 800; letter-spacing: -0.04em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
code, kbd, .mono { font-family: var(--font-mono); }
code {
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.1em 0.4em;
  border-radius: 5px;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 14px;
}
.skip:focus { left: 8px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 34px; }
.brand-word { font-family: var(--font-mono); font-weight: 800; font-size: 20px; letter-spacing: 0.02em; line-height: 1; }
.brand-word .cursor { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
.brand-sub { display: block; font-size: 10px; letter-spacing: 0.18em; color: var(--muted); font-weight: 500; margin-top: 4px; text-transform: uppercase; }

.face-top { fill: var(--face-top); }
.face-left { fill: var(--face-left); }
.face-right { fill: var(--face-right); }
.face-ink { stroke: var(--face-ink); }

.nav-links { display: flex; align-items: center; gap: 4px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.nav-links a {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 14px; font-weight: 500;
  color: var(--text-2); padding: 8px 12px; border-radius: 8px;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent); }
.nav-links a[aria-current="page"]::before { content: "./"; color: var(--muted); }
.ext::after { content: "↗"; font-size: 0.85em; color: var(--muted); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: block; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .moon { display: none; }
}
.menu-toggle { display: none; }

@media (max-width: 900px) {
  .menu-toggle { display: inline-grid; }
  .nav { gap: 10px; }
  .nav .theme-toggle { margin-left: auto; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 8px; font-size: 16px; border-bottom: 1px dashed var(--line); border-radius: 0; }
}

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 15px; font-weight: 600;
  padding: 12px 18px; border-radius: 9px; border: 1px solid transparent;
  cursor: pointer; transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { box-shadow: 0 8px 24px -8px var(--accent); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-sm { padding: 8px 12px; font-size: 13px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 13px; color: var(--accent);
  letter-spacing: 0.02em; margin-bottom: 18px;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-2);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px;
  background: var(--surface);
}

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 9vw, 112px) 0; border-top: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: 44px; }
.section-num { font-family: var(--font-mono); color: var(--muted); font-size: 14px; margin-bottom: 10px; display: block; }
.section-num b { color: var(--accent); font-weight: 600; }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.22rem); color: var(--text-2); max-width: 64ch; }
.muted { color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: clamp(56px, 9vw, 110px) 0 clamp(56px, 8vw, 96px); position: relative; }
.hero::after {
  content: ""; position: absolute; z-index: -1; inset: -120px 0 auto 0; height: 600px;
  background: radial-gradient(ellipse 50% 60% at 75% 30%, var(--glow), transparent 70%);
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
.hero h1 .hl { color: var(--accent); }
.hero .lead { margin-bottom: 30px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 44px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.stat { padding: 16px 18px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font-family: var(--font-mono); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat > span { display: block; line-height: 1.4; margin-top: 4px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
@media (max-width: 960px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

/* ---------- Terminal ---------- */
.terminal {
  background: #0b1016;
  border: 1px solid #223040;
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.02) inset;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: #c9d4df;
  min-width: 0;
}
.term-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: #0f161e; border-bottom: 1px solid #1c2733; }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.term-bar i:nth-child(1) { background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 10px; font-size: 12px; color: #6f8090; }
.term-body { padding: 18px 20px 22px; overflow-x: auto; }
.term-body pre { margin: 0; font: inherit; white-space: pre; }
.t-prompt { color: #3ddc97; }
.t-cmd { color: #e6edf3; }
.t-key { color: #6ea8fe; }
.t-str { color: #ffb547; }
.t-num { color: #ff7ab6; }
.t-com { color: #5c6d7e; }
.t-ok { color: #3ddc97; }
.t-caret { display: inline-block; width: 8px; height: 1.1em; vertical-align: -0.2em; background: #3ddc97; animation: blink 1.1s steps(1) infinite; }
.term-line { opacity: 0; animation: line-in 0.01s forwards; }
.term-body .term-line:nth-child(1) { animation-delay: 0.2s; }
.term-body .term-line:nth-child(2) { animation-delay: 0.9s; }
.term-body .term-line:nth-child(3) { animation-delay: 1.0s; }
.term-body .term-line:nth-child(4) { animation-delay: 1.1s; }
.term-body .term-line:nth-child(5) { animation-delay: 1.2s; }
.term-body .term-line:nth-child(6) { animation-delay: 1.3s; }
.term-body .term-line:nth-child(7) { animation-delay: 1.4s; }
.term-body .term-line:nth-child(8) { animation-delay: 1.5s; }
.term-body .term-line:nth-child(9) { animation-delay: 1.6s; }
.term-body .term-line:nth-child(10) { animation-delay: 1.7s; }
.term-body .term-line:nth-child(11) { animation-delay: 1.8s; }
.term-body .term-line:nth-child(12) { animation-delay: 2.3s; }
.term-body .term-line:nth-child(13) { animation-delay: 2.5s; }
.term-body .term-line:nth-child(14) { animation-delay: 2.7s; }

@keyframes line-in { to { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .term-line { opacity: 1; animation: none; }
  .t-caret, .brand-word .cursor { animation: none; }
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
}

/* ---------- Cards ---------- */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-4, .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  min-width: 0;
}
.card h3 { margin-top: 14px; }
.card p { color: var(--text-2); font-size: 15.5px; margin: 0; }
.card .tag { position: absolute; top: 20px; right: 20px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.card-icon {
  width: 44px; height: 44px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.card-icon svg { width: 22px; height: 22px; }
.card-icon.amber { background: color-mix(in srgb, var(--amber) 12%, transparent); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.card-icon.blue { background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.card-icon.pink { background: color-mix(in srgb, var(--pink) 12%, transparent); color: var(--pink); border-color: color-mix(in srgb, var(--pink) 30%, transparent); }
a.card { color: inherit; transition: border-color 0.2s ease, transform 0.2s ease; }
a.card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }

/* Platform cards */
.platform { display: grid; grid-template-rows: auto 1fr; padding: 0; overflow: hidden; }
.platform-visual { height: 220px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; background: var(--bg-2); }
.platform-body { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.platform-body h3 { margin: 0; font-size: 1.35rem; }
.platform-body .url { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.platform-body .go { margin-top: auto; padding-top: 10px; font-family: var(--font-mono); font-size: 14px; color: var(--text); }
.platform:hover .go { color: var(--accent); }
.vis-code { padding: 22px 24px; font-family: var(--font-mono); font-size: 13px; line-height: 1.75; color: var(--text-2); white-space: pre; }
.vis-code .k { color: var(--blue); } .vis-code .s { color: var(--amber); } .vis-code .c { color: var(--muted); } .vis-code .f { color: var(--accent); } .vis-code .n { color: var(--pink); }
.vis-zodiac { display: grid; place-items: center; height: 100%; }
.vis-zodiac svg { width: 190px; height: 190px; color: var(--amber); }
.vis-zodiac .spin { transform-origin: 50% 50%; animation: spin 90s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .vis-zodiac .spin { animation: none; } }

/* ---------- Founder ---------- */
.founder { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 4vw, 48px); align-items: start; }
.avatar {
  width: 148px; height: 180px; border-radius: 14px; overflow: hidden; position: relative;
  border: 1px solid var(--line-2); background: var(--surface-2);
  box-shadow: 0 0 0 6px var(--surface), 0 0 0 7px var(--line);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.07) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.founder-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 18px; }
.founder h3 { font-size: 1.6rem; margin: 0; }
.founder .role { font-family: var(--font-mono); color: var(--accent); font-size: 14px; margin-bottom: 10px; }
@media (max-width: 640px) { .founder { grid-template-columns: 1fr; } }

/* Shelf (home) */
.shelf { display: flex; gap: 14px; margin-top: 26px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: thin; }
.shelf a { flex: 0 0 auto; }
.shelf img {
  width: 92px; height: 132px; object-fit: cover; border-radius: 4px 6px 6px 4px;
  box-shadow: inset 4px 0 0 rgba(0,0,0,0.2), 0 10px 20px -10px rgba(0,0,0,0.6);
  border: 1px solid var(--line);
  transition: transform 0.2s ease;
}
.shelf a:hover img { transform: translateY(-4px) rotate(-1deg); }

/* ---------- Git log / changelog ---------- */
.gitlog { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: 14.5px; }
.gitlog li { display: grid; grid-template-columns: 28px auto 1fr; gap: 14px; align-items: start; position: relative; padding: 0 0 22px; }
.gitlog li::before { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 2px; background: var(--line-2); }
.gitlog li:last-child::before { display: none; }
.gitlog .node { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); margin-top: 2px; }
.gitlog li:first-child .node { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.gitlog .sha { color: var(--amber); }
.gitlog .msg { color: var(--text); }
.gitlog .msg small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; font-family: var(--font-sans); }
.gitlog .ref { color: var(--blue); }
.gitlog .ref-head { color: var(--accent); }

/* ---------- CTA band ---------- */
.cta-band {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  padding: clamp(28px, 4vw, 44px);
  border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 60% 120% at 100% 0%, var(--glow), transparent 60%),
    var(--surface);
}
.cta-band h2 { margin: 0 0 6px; font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
.cta-band p { margin: 0; color: var(--text-2); }

/* ---------- Page header (inner pages) ---------- */
.page-head { padding: clamp(48px, 7vw, 88px) 0 clamp(32px, 5vw, 56px); }
.crumbs { font-family: var(--font-mono); font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

/* ---------- Key/value (company.json) ---------- */
.kv { margin: 0; display: grid; grid-template-columns: max-content 1fr; font-family: var(--font-mono); font-size: 14px; }
.kv dt, .kv dd { padding: 12px 0; border-bottom: 1px dashed var(--line); margin: 0; }
.kv dt { color: var(--blue); padding-right: 24px; }
.kv dd { color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv dd .muted { font-size: 12.5px; }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }
@media (max-width: 560px) {
  .kv { grid-template-columns: 1fr; }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
}
.copy {
  margin-left: 8px; font-family: var(--font-mono); font-size: 11px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2);
  border-radius: 6px; padding: 2px 8px; cursor: pointer; vertical-align: 1px;
}
.copy:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Bookshelf (about) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filters button {
  font-family: var(--font-mono); font-size: 13px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 6px 14px;
}
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.book {
  display: grid; grid-template-columns: 92px 1fr; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px; min-width: 0;
}
.book[hidden] { display: none; }
.book-cover { width: 92px; height: 132px; border-radius: 3px 6px 6px 3px; overflow: hidden; border: 1px solid var(--line); box-shadow: inset 4px 0 0 rgba(0,0,0,0.2), 0 10px 20px -12px rgba(0,0,0,0.6); background: var(--surface-2); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-info { display: flex; flex-direction: column; min-width: 0; }
.book h3 { font-size: 15px; margin: 0 0 6px; line-height: 1.3; letter-spacing: -0.01em; }
.book .pub { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.book .co { font-size: 13px; color: var(--text-2); margin: 0 0 10px; }
.book .links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.book .links a {
  font-family: var(--font-mono); font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line-2); color: var(--text);
}
.book .links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.book .links .na { font-family: var(--font-mono); font-size: 12px; color: var(--muted); padding: 5px 0; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: minmax(0, 1fr); } }
.contact-list { display: grid; gap: 16px; }
.contact-item { display: grid; grid-template-columns: 44px 1fr; gap: 16px; }
.contact-item h3 { margin: 0 0 4px; font-size: 1rem; }
.contact-item p, .contact-item address { margin: 0; color: var(--text-2); font-style: normal; font-size: 15.5px; }
.form { display: grid; gap: 16px; margin-top: 20px; }
.field { display: grid; gap: 6px; }
.field label { font-family: var(--font-mono); font-size: 13px; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 9px; padding: 11px 13px;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-note { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- Policy / prose ---------- */
.doc { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
@media (max-width: 960px) { .doc { grid-template-columns: minmax(0, 1fr); } }
.toc { position: sticky; top: 92px; font-family: var(--font-mono); font-size: 13px; max-height: calc(100vh - 110px); overflow: auto; }
.toc p { color: var(--muted); margin: 0 0 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 5px 0 5px 14px; color: var(--text-2); margin-left: -1px; border-left: 1px solid transparent; line-height: 1.4; }
.toc a:hover { color: var(--accent); border-left-color: var(--accent); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }
@media (max-width: 960px) {
  .toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
}
.prose { max-width: 76ch; }
.prose h2 {
  font-size: 1.35rem; margin: 2.4em 0 0.7em; padding-top: 1.2em; border-top: 1px solid var(--line);
  display: flex; gap: 12px; align-items: baseline;
}
.prose h2 .n { color: var(--accent); font-size: 0.9em; font-weight: 600; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.02rem; margin: 1.8em 0 0.5em; color: var(--text); }
.prose p, .prose li { color: var(--text-2); }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.45em; }
.prose li::marker { color: var(--accent); }
.prose a { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; margin: 1.2em 0 1.6em; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table { border-collapse: collapse; width: 100%; font-size: 14.5px; min-width: 620px; }
.prose th, .prose td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.prose th { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--surface-2); }
.prose tr:last-child td { border-bottom: 0; }
.callout {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: var(--radius); padding: 16px 18px; margin: 1.4em 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout.amber { border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); border-left-color: var(--amber); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.tldr { margin-bottom: 40px; }
.tldr .term-body { font-size: 13.5px; white-space: normal; }
.tldr ul { list-style: none; padding: 0; margin: 8px 0 0; }
.tldr li { padding-left: 22px; position: relative; margin-bottom: 6px; color: #c9d4df; }
.tldr li::before { content: "✓"; position: absolute; left: 0; color: #3ddc97; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); padding: 56px 0 28px; margin-top: 0; font-size: 15px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand p { color: var(--muted); font-size: 14px; max-width: 42ch; margin-top: 14px; }
.footer-brand address { font-style: normal; color: var(--text-2); font-size: 14px; }
.site-footer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer ul a { color: var(--text-2); font-family: var(--font-mono); font-size: 14px; }
.site-footer ul a:hover { color: var(--accent); }
.legal {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.cookie-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; max-width: 90ch; }

/* ---------- 404 ---------- */
.notfound { min-height: 60vh; display: grid; place-items: center; padding: 64px 0; }
.notfound .terminal { width: min(640px, 100%); }

/* Text inside terminals stays light in both themes */
.terminal strong, .terminal b { color: #ffffff; }
.terminal a { color: #3ddc97; }

/* ==========================================================================
   Education additions
   ========================================================================== */

:root { --code-bg: #0b1016; --code-bar: #0f161e; --code-line: #1c2733; --code-text: #d3dde7; }
.mono.small, .small { font-size: 12.5px; }
.section.flush { border-top: 0; padding-top: 0; }
.row-head { max-width: none; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; }
.row-head > div { max-width: 720px; }
.terminal pre a { color: #e6edf3; text-decoration: none; border-bottom: 1px dashed #3a4a5b; }
.terminal pre a:hover { color: #3ddc97; border-bottom-color: #3ddc97; }

/* Reading progress bar (article pages) */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* Topic chips & colours */
.topic-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 9px; border-radius: 6px; 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);
}
a.topic-chip:hover { text-decoration: none; border-color: var(--c, var(--accent)); }
.t-ml { --c: var(--accent); }
.t-cv { --c: var(--blue); }
.t-nlp { --c: var(--amber); }
.t-dl { --c: var(--pink); }
.t-graphs { --c: #a78bfa; }
.t-data-science { --c: #2dd4bf; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .t-graphs { --c: #6d28d9; } :root:not([data-theme="dark"]) .t-data-science { --c: #0f766e; } }
:root[data-theme="light"] .t-graphs { --c: #6d28d9; }
:root[data-theme="light"] .t-data-science { --c: #0f766e; }

/* Article cards */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.post { padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: border-color 0.2s ease, transform 0.2s ease; }
.post[hidden] { display: none; }
.post:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); transform: translateY(-2px); }
.post-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.post:hover .post-thumb img { transform: scale(1.03); }
.post-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 12.5px; }
.post-meta .mono { display: inline-flex; align-items: center; gap: 5px; }
.post-meta svg { width: 14px; height: 14px; }
.post-title { font-size: 1.08rem; margin: 0; line-height: 1.3; letter-spacing: -0.01em; }
.post-title a { color: var(--text); }
.post-title a::after { content: ""; position: absolute; inset: 0; }
.post-title a:hover { text-decoration: none; color: var(--accent); }
.post .post-body p { font-size: 14.5px; line-height: 1.55; }
.post-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.avatars { display: inline-flex; flex-shrink: 0; }
.avatars img { border-radius: 50%; object-fit: cover; border: 2px solid var(--surface); background: var(--surface-2); }
.avatars img + img { margin-left: -10px; }

/* Topic cards */
.topic-card { color: inherit; }
.topic-card .card-icon { color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border-color: color-mix(in srgb, var(--c) 30%, transparent); }
.topic-card:hover { border-color: var(--c); }
.topic-card h3 { color: var(--text); }

/* Series */
.series h3 { margin: 0 0 6px; font-size: 1.2rem; }
.series > p { margin-bottom: 22px; }
.series .gitlog { font-size: 14px; }
.series .gitlog li { padding-bottom: 18px; }
.series .gitlog .msg a { color: var(--text); }
.series .gitlog .msg a:hover { color: var(--accent); }

/* Author strip (home) */
.author-strip { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.author-strip a {
  display: grid; justify-items: center; text-align: center; gap: 4px; padding: 18px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  font-size: 14px; line-height: 1.3; height: 100%;
}
.author-strip a:hover { border-color: var(--accent); text-decoration: none; }
.author-strip img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; margin-bottom: 6px; border: 1px solid var(--line-2); }
.author-strip small { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }

/* Authors page */
.authors { display: grid; gap: 16px; }
.author { display: grid; grid-template-columns: 88px 1fr; gap: 22px; align-items: start; scroll-margin-top: 90px; }
.author:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.author-photo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line-2); }
.author h2 { font-size: 1.25rem; margin: 4px 0 8px; }
.author-posts { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.author-posts li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 15px; }
.author-posts a { color: var(--text); }
.author-posts a:hover { color: var(--accent); }
@media (max-width: 560px) { .author { grid-template-columns: 1fr; } }

/* Listing toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.toolbar .filters { margin: 0; }
.filters small { opacity: 0.65; margin-left: 2px; }
.filters button:hover { border-color: var(--accent); }
.search {
  display: flex; align-items: center; gap: 10px; flex: 1 1 280px; max-width: 420px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 0 12px;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search .mono { color: var(--accent); font-size: 13px; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; padding: 11px 0; outline: none; }
.empty { padding: 40px 0; text-align: center; }
.more-topics { margin-top: 48px; display: grid; gap: 12px; }
.more-topics .filters { margin: 0; }

/* ---------- Article page ---------- */
.article-head { padding: clamp(40px, 6vw, 72px) 0 28px; }
.article-head h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); max-width: 22ch; margin-top: 18px; }
.article-head .lead { max-width: 70ch; }
.byline { display: flex; align-items: center; gap: 14px; margin-top: 24px; font-size: 15px; line-height: 1.4; }
.byline .mono { font-size: 12px; }
.byline a { color: var(--text); font-weight: 600; }
.byline a:hover { color: var(--accent); }
.cover { margin: 0 0 clamp(36px, 5vw, 56px); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); aspect-ratio: 21 / 9; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 640px) { .cover { aspect-ratio: 16 / 10; } }
.post-page .doc { padding-bottom: 24px; }
.toc .n { color: var(--muted); margin-right: 4px; }
.toc a.active .n, .toc a:hover .n { color: var(--accent); }
@media (max-width: 960px) {
  .toc ol { max-height: 260px; overflow: auto; }
}

.article-body { max-width: 78ch; min-width: 0; }
.article-body section { scroll-margin-top: 90px; }
.article-body section:first-child h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.article-body h2 a.anchor { color: var(--text); }
.article-body h2 a.anchor:hover { color: var(--accent); text-decoration: none; }
.article-body h2 a.anchor:hover::after { content: " #"; color: var(--muted); }
.article-body p { font-size: 17px; }
.figure { margin: 1.6em 0; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.figure img { margin: 0 auto; max-height: 640px; width: auto; }
ul.bullets { list-style: none; padding: 0; margin: 0 0 1.4em; display: grid; gap: 6px; }
ul.bullets li { position: relative; padding-left: 26px; margin: 0; }
ul.bullets li::before { content: "→"; position: absolute; left: 2px; color: var(--accent); font-family: var(--font-mono); }
blockquote.pull { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--amber); }
blockquote.pull p { font-size: 1.15rem; font-style: italic; color: var(--text); margin: 0 0 6px; }
blockquote.pull cite { font-family: var(--font-mono); font-size: 13px; color: var(--muted); font-style: normal; }
.callout-title { color: var(--accent); font-size: 13px; margin: 0 0 6px; }
.prereq ol { margin: 0; padding-left: 1.2em; }
.prereq li { margin: 0; }

/* Code blocks */
.codeblock {
  margin: 1.4em 0 1.6em; border-radius: var(--radius); overflow: hidden;
  background: var(--code-bg); border: 1px solid #223040;
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.6);
}
.code-bar { display: flex; align-items: center; gap: 7px; padding: 8px 8px 8px 14px; background: var(--code-bar); border-bottom: 1px solid var(--code-line); }
.code-bar i { width: 10px; height: 10px; border-radius: 50%; display: block; background: #2a3949; }
.code-bar span { margin-left: 8px; font-family: var(--font-mono); font-size: 12px; color: #6f8090; }
.copy-code {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; color: #9fb0c0; cursor: pointer;
  background: #16202b; border: 1px solid #2a3949; border-radius: 7px; padding: 5px 10px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.copy-code svg { width: 14px; height: 14px; }
.copy-code .i-check { display: none; }
.copy-code:hover { color: #e6edf3; border-color: #3ddc97; }
.copy-code.done { color: #3ddc97; border-color: #3ddc97; background: rgba(61, 220, 151, 0.1); }
.copy-code.done .i-copy { display: none; }
.copy-code.done .i-check { display: block; }
.codeblock pre {
  margin: 0; padding: 16px 18px; overflow-x: auto;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 1.65; tab-size: 4;
  color: var(--code-text); white-space: pre;
}
.codeblock pre:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0; }
.codeblock code { font: inherit; background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.codeblock .k { color: #c792ea; }
.codeblock .s { color: #ffcb6b; }
.codeblock .c { color: #61758a; font-style: italic; }
.codeblock .n { color: #ff8b8b; }
.codeblock .f { color: #6ea8fe; }
.codeblock .b { color: #3ddc97; }
.codeblock[data-lang="text"] pre { color: #aebdcc; }
.codeblock[data-lang="shell"] pre { color: #e6edf3; }

/* Author card & pager */
.author-card {
  display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start;
  margin: 56px 0 24px; padding: 24px; border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background: radial-gradient(ellipse 60% 120% at 100% 0%, var(--glow), transparent 60%), var(--surface);
}
.author-card h3 { margin: 6px 0 4px; font-size: 1.15rem; }
.author-card h3 a { color: var(--text); }
.author-card p { margin: 0 0 6px; font-size: 15px; }
.author-card .mono.small { color: var(--muted); }
@media (max-width: 560px) { .author-card { grid-template-columns: 1fr; } }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pager .card { display: grid; gap: 6px; padding: 18px 20px; color: var(--text); }
.pager .card b { font-family: var(--font-mono); font-size: 14.5px; line-height: 1.35; }
.pager .card .mono { font-size: 12px; }
.pager .next { text-align: right; }
@media (max-width: 640px) { .pager { grid-template-columns: 1fr; } .pager .next { text-align: left; } }

.footer-by { margin-top: 6px !important; }
.footer-by a { color: var(--text-2); }
.footer-by a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .post:hover, .post:hover .post-thumb img { transform: none; }
}
@media print {
  .site-header, .site-footer, .toc, .progress, .pager, .copy-code, .section:not(.post-page) { display: none !important; }
  .doc { display: block; }
  .codeblock pre { white-space: pre-wrap; }
}

/* Authors page: lead author + mentorship note */
.author.lead-author { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.author.lead-author .author-photo { width: 104px; height: 104px; border-color: var(--accent); }
.author.lead-author { grid-template-columns: 104px 1fr; }
.author .eyebrow { margin: 0; }
.guidance-note { margin: 12px 0 4px; padding: 14px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; font-size: 15.5px; }
.guidance-note .mono { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
@media (max-width: 560px) { .author.lead-author { grid-template-columns: 1fr; } }
