/* =====================================================================
   dennis@home:~$ — design system
   Single stylesheet for the whole site. No inline styles anywhere, so
   the CSP can stay at style-src 'self'.
   ===================================================================== */

/* ---------- Fonts (self-hosted, no third-party requests) ---------- */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f6f8fa;
  --bg-elev: #ffffff;
  --surface-2: #eef2f6;
  --border: #dde3ea;
  --border-strong: #c5cfda;
  --text: #0d1117;
  --text-2: #2f3a46;
  --muted: #5b6878;
  --accent: #00ff88;          /* brand neon – decorative only on light */
  --accent-ink: #007a4d;      /* accessible green for text/links on light */
  --accent-2: #0369a1;        /* cyan counterpart */
  --on-accent: #04140c;
  --glow: rgba(0, 190, 105, 0.16);
  --grid-line: rgba(13, 17, 23, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 48px rgba(16, 24, 40, 0.12);
  --code-bg: #0d1117;
  --code-text: #e6edf3;
  --header-bg: rgba(246, 248, 250, 0.78);

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --container: 1180px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Dark: explicit choice, or system preference when no choice stored */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-elev: #10161d;
  --surface-2: #161d26;
  --border: rgba(230, 237, 243, 0.08);
  --border-strong: rgba(230, 237, 243, 0.16);
  --text: #e6edf3;
  --text-2: #c2ccd6;
  --muted: #8b98a5;
  --accent: #00ff88;
  --accent-ink: #00ff88;
  --accent-2: #00e5ff;
  --on-accent: #04140c;
  --glow: rgba(0, 255, 136, 0.18);
  --grid-line: rgba(230, 237, 243, 0.035);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --code-bg: #070a0e;
  --header-bg: rgba(11, 15, 20, 0.72);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f14;
    --bg-elev: #10161d;
    --surface-2: #161d26;
    --border: rgba(230, 237, 243, 0.08);
    --border-strong: rgba(230, 237, 243, 0.16);
    --text: #e6edf3;
    --text-2: #c2ccd6;
    --muted: #8b98a5;
    --accent-ink: #00ff88;
    --accent-2: #00e5ff;
    --glow: rgba(0, 255, 136, 0.18);
    --grid-line: rgba(230, 237, 243, 0.035);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
    --code-bg: #070a0e;
    --header-bg: rgba(11, 15, 20, 0.72);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--on-accent); }
.mono { font-family: var(--font-mono); }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.icon { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: -0.2em; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 1000;
  background: var(--accent); color: var(--on-accent); padding: 8px 14px;
  border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--bg-elev);
  font-weight: 600; font-size: 15px; color: var(--text); cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.btn:hover { text-decoration: none; border-color: var(--accent-ink); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { box-shadow: 0 0 0 6px var(--glow); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 14px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 10px; border: 1px solid var(--border); background: transparent;
  color: var(--text-2); cursor: pointer; transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.icon-btn:hover { color: var(--accent-ink); border-color: var(--border-strong); background: var(--surface-2); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
a.chip:hover, button.chip:hover { text-decoration: none; border-color: var(--accent-ink); color: var(--accent-ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip .count { font-family: var(--font-mono); font-size: 11px; opacity: 0.7; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 13px; color: var(--accent-ink);
  letter-spacing: 0.02em;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.header-inner { display: flex; align-items: center; gap: 20px; height: 68px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--font-mono); font-weight: 700; font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--code-bg); color: var(--accent);
  font-size: 14px; letter-spacing: -0.05em;
  box-shadow: inset 0 0 0 1px rgba(0, 255, 136, 0.35), 0 0 18px var(--glow);
}
.brand-text .prompt { color: var(--accent-ink); }
.cursor { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 2px; background: var(--accent); vertical-align: -0.15em; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.main-nav { display: flex; gap: 4px; margin-left: auto; }
.main-nav a {
  position: relative; padding: 8px 12px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; font-size: 15px;
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.main-nav a[aria-current="page"] { color: var(--text); }
.main-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  border-radius: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.search-trigger {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px 0 12px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--muted); font-size: 14px; cursor: pointer; transition: border-color 0.15s;
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.kbd {
  font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.menu-toggle { display: none; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 96px; border-top: 1px solid var(--border); background: var(--bg-elev); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; padding: 56px 0 32px; }
.footer-blurb { color: var(--muted); max-width: 380px; margin: 14px 0 18px; }
.footer-col h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 6px 0 14px; font-weight: 600; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a { color: var(--text-2); }
.footer-col a:hover { color: var(--accent-ink); }
.social-row { display: flex; gap: 8px; }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 20px 0 32px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px;
}
.footer-bottom a { color: var(--muted); }

/* ---------- Section scaffolding ---------- */
.section { padding-top: 72px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.section-title { font-size: clamp(22px, 2.6vw, 28px); line-height: 1.2; margin: 6px 0 0; letter-spacing: -0.02em; }
.section-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.section-link .icon { transition: transform 0.15s var(--ease); }
.section-link:hover .icon { transform: translateX(3px); }
.page-head { padding-top: 56px; padding-bottom: 8px; }
.page-title { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; letter-spacing: -0.03em; margin: 10px 0 12px; }
.page-lede { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 24px; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; width: 640px; height: 640px; right: -120px; top: -220px;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero-title { font-size: clamp(36px, 5.4vw, 60px); line-height: 1.05; letter-spacing: -0.035em; margin: 16px 0 18px; font-weight: 800; }
.hero-title .hl {
  background: linear-gradient(90deg, var(--accent-ink), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lede { font-size: 18px; color: var(--muted); max-width: 540px; margin: 0 0 28px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.stats { display: flex; gap: 32px; margin-top: 36px; padding-top: 24px; border-top: 1px dashed var(--border-strong); }
.stat-num { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Terminal window */
.terminal {
  border-radius: var(--radius); overflow: hidden;
  background: var(--code-bg); color: #c9d4de;
  border: 1px solid rgba(0, 255, 136, 0.18);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 60px var(--glow);
  font-family: var(--font-mono); font-size: 14px;
}
.terminal-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: rgba(255, 255, 255, 0.03); border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.terminal-bar .dot { width: 11px; height: 11px; border-radius: 50%; background: #3a434e; }
.terminal-bar .dot:nth-child(1) { background: #ff5f57; }
.terminal-bar .dot:nth-child(2) { background: #febc2e; }
.terminal-bar .dot:nth-child(3) { background: #28c840; }
.terminal-bar .title { margin-left: auto; margin-right: auto; font-size: 12px; color: #7d8994; transform: translateX(-24px); }
.terminal-body { padding: 18px 20px 22px; min-height: 300px; line-height: 1.75; }
.terminal-body .line { white-space: pre-wrap; word-break: break-word; }
.terminal-body .ps1 { color: #00ff88; }
.terminal-body .path { color: #00e5ff; }
.terminal-body .out { color: #9aa7b3; }
.terminal-body .out-strong { color: #e6edf3; }
.terminal-body a { color: #e6edf3; text-decoration: underline; text-decoration-color: rgba(0, 255, 136, 0.4); text-underline-offset: 3px; }
.terminal-body a:hover { color: #00ff88; }
.terminal-body .cursor { background: #00ff88; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 24px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
}
.card:hover, .card:focus-within { transform: translateY(-4px); box-shadow: var(--shadow-md), 0 0 0 1px var(--glow); border-color: color-mix(in srgb, var(--accent-ink) 45%, var(--border)); }
.card-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.card:hover .card-media img { transform: scale(1.04); }
.card-badge {
  position: absolute; left: 12px; top: 12px; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(7, 10, 14, 0.78); color: #e6edf3; backdrop-filter: blur(6px);
}
.card-badge .icon { color: #00ff88; }
.card-badge.new { left: auto; right: 12px; background: var(--accent); color: var(--on-accent); }
.play-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.play-overlay span {
  display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%;
  background: rgba(7, 10, 14, 0.7); color: #00ff88; backdrop-filter: blur(4px);
  box-shadow: 0 0 0 1px rgba(0, 255, 136, 0.35), 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s var(--ease);
}
.play-overlay .icon { width: 24px; height: 24px; margin-left: 3px; }
.card:hover .play-overlay span { transform: scale(1.1); }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); font-family: var(--font-mono); }
.card-title { margin: 0; font-size: 18px; line-height: 1.35; letter-spacing: -0.01em; font-weight: 700; }
.card-title a { color: var(--text); }
.card-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* stretched link */
.card-title a:hover { text-decoration: none; }
.card:hover .card-title a { color: var(--accent-ink); }
.card-desc {
  margin: 0; color: var(--muted); font-size: 15px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.card-tags .chip { position: relative; z-index: 2; font-size: 12px; padding: 3px 9px; }

/* Featured card (home) */
.card-featured { display: grid; grid-template-columns: 1.25fr 1fr; }
.card-featured .card-media { aspect-ratio: auto; min-height: 340px; }
.card-featured .card-body { padding: 36px; justify-content: center; gap: 14px; }
.card-featured .card-title { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; letter-spacing: -0.02em; }
.card-featured .card-desc { -webkit-line-clamp: 4; font-size: 16px; }
.card-featured .card-tags { margin-top: 4px; }

/* Topics cloud */
.topics { display: flex; flex-wrap: wrap; gap: 10px; }
.topics .chip { font-size: 14px; padding: 8px 14px; }

/* CTA band */
.cta-band {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 44px;
  background: var(--code-bg); color: #e6edf3;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  border: 1px solid rgba(0, 255, 136, 0.2);
}
.cta-band::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 240px at 90% 0%, rgba(0, 255, 136, 0.18), transparent 70%),
              radial-gradient(500px 240px at 0% 100%, rgba(0, 229, 255, 0.12), transparent 70%);
  pointer-events: none;
}
.cta-band > * { position: relative; }
.cta-band h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.cta-band p { margin: 0; color: #9aa7b3; max-width: 520px; }

/* ---------- Explore (archive) ---------- */
.toolbar { position: sticky; top: 68px; z-index: 50; padding: 16px 0; background: var(--bg); border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.toolbar-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-field { position: relative; flex: 1 1 280px; }
.search-field .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input {
  width: 100%; height: 44px; padding: 0 14px 0 42px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  font: inherit; font-size: 15px;
}
.search-field input:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 4px var(--glow); }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; padding: 7px 14px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }
.tag-scroller { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.result-count { color: var(--muted); font-size: 14px; font-family: var(--font-mono); margin: 0 0 18px; }
.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 64px 24px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius); color: var(--muted); font-family: var(--font-mono);
}
.empty-state strong { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; font-family: var(--font-sans); }

/* ---------- Videos ---------- */
.player-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.player {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: #000; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-facade { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; cursor: pointer; background: #000; }
.player-facade img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: opacity 0.2s; }
.player-facade:hover img { opacity: 1; }
.player-facade .play-overlay span { width: 76px; height: 76px; }
.player-facade .play-overlay .icon { width: 30px; height: 30px; }
.player-facade:hover .play-overlay span, .player-facade:focus-visible .play-overlay span { transform: scale(1.08); }
.player-note { font-size: 13px; color: var(--muted); margin: 10px 2px 0; display: flex; align-items: center; gap: 6px; }
.now-playing h2 { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.25; letter-spacing: -0.02em; margin: 8px 0 10px; }
.now-playing p { color: var(--muted); margin: 0 0 16px; }
.now-playing .card-tags { margin-bottom: 20px; }
.now-playing .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.card.is-playing { border-color: var(--accent-ink); box-shadow: 0 0 0 1px var(--accent-ink), var(--shadow-md); }
.card.is-playing .card-badge:not(.new) { background: var(--accent); color: var(--on-accent); }
.card.is-playing .card-badge:not(.new) .icon { color: var(--on-accent); }

/* ---------- Post page ---------- */
.progress { position: fixed; left: 0; top: 0; z-index: 200; height: 3px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px var(--accent); }
.post-hero { padding: 48px 0 32px; }
.post-hero-inner { max-width: 820px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.back-link:hover { color: var(--accent-ink); text-decoration: none; }
.post-title { font-size: clamp(30px, 4.6vw, 48px); line-height: 1.12; letter-spacing: -0.03em; margin: 18px 0 16px; }
.post-desc { font-size: 19px; color: var(--muted); margin: 0 0 22px; }
.byline { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.byline .avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent); }
.byline .author { color: var(--text); font-weight: 600; }
.byline .sep { width: 4px; height: 4px; border-radius: 50%; background: var(--border-strong); }
.byline .meta-item { display: inline-flex; align-items: center; gap: 6px; }

.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 64px; align-items: start; }
.toc { position: sticky; top: 100px; font-size: 14px; max-height: calc(100vh - 140px); overflow: auto; }
.toc h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); line-height: 1.4; }
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }
.toc .share-block { margin-top: 28px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Prose */
.prose { font-size: 17.5px; line-height: 1.8; color: var(--text-2); max-width: 760px; min-width: 0; }
.prose > :first-child { margin-top: 0; }
.prose h2, .prose h3, .prose h4 { color: var(--text); line-height: 1.3; letter-spacing: -0.02em; scroll-margin-top: 96px; position: relative; }
.prose h2 { font-size: 28px; margin: 2.2em 0 0.7em; }
.prose h3 { font-size: 21px; margin: 1.8em 0 0.6em; }
.prose h4 { font-size: 18px; margin: 1.6em 0 0.5em; }
.prose .anchor { position: absolute; left: -1.1em; padding-right: 0.3em; color: var(--muted); opacity: 0; font-weight: 400; transition: opacity 0.15s; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus { opacity: 1; text-decoration: none; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose pre { margin: 0 0 1.3em; }
.prose a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); text-underline-offset: 3px; overflow-wrap: anywhere; }
.prose a:hover { text-decoration-color: currentColor; }
.prose a .icon { width: 0.8em; height: 0.8em; margin-left: 2px; vertical-align: 0; opacity: 0.7; }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.35em 0; }
.prose li::marker { color: var(--accent-ink); }
.prose hr { border: 0; height: 1px; background: var(--border); margin: 2.6em 0; }
.prose blockquote { border-left: 3px solid var(--accent); background: var(--surface-2); padding: 14px 20px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose img { border-radius: var(--radius); border: 1px solid var(--border); margin: 1.8em auto; cursor: zoom-in; }
.prose code { font-family: var(--font-mono); font-size: 0.86em; padding: 0.15em 0.4em; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.prose pre { position: relative; background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); padding: 18px 20px; overflow-x: auto; border: 1px solid var(--border); font-size: 14px; line-height: 1.65; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.copy-btn {
  position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 8px; font-size: 12px; font-family: var(--font-sans); font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.06); color: #c9d4de; cursor: pointer;
  opacity: 0; transition: opacity 0.15s;
}
.prose pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn.copied { color: #00ff88; border-color: rgba(0, 255, 136, 0.4); }
.table-wrap { overflow-x: auto; margin: 0 0 1.5em; border: 1px solid var(--border); border-radius: var(--radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; margin: 0; }
.prose th, .prose td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose th { background: var(--surface-2); color: var(--text); font-weight: 600; }
.prose th u, .prose th ins { text-decoration: none; }
.prose tr:last-child td { border-bottom: 0; }

.post-footer { max-width: 760px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border); }
.post-footer .card-tags { margin-bottom: 24px; }
.author-card { display: flex; gap: 18px; align-items: center; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.author-card img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; }
.author-card h2 { font-size: 16px; margin: 0 0 4px; }
.author-card p { margin: 0; color: var(--muted); font-size: 14px; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.post-nav a { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); color: var(--text); transition: border-color 0.15s; }
.post-nav a:hover { border-color: var(--accent-ink); text-decoration: none; }
.post-nav small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.post-nav .next { text-align: right; grid-column: 2; }
.post-nav .next small { justify-content: flex-end; }
.post-state { padding: 80px 0; text-align: center; color: var(--muted); font-family: var(--font-mono); }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
.skeleton-line { height: 16px; margin: 14px 0; }
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- About ---------- */
.about-hero { display: grid; grid-template-columns: 300px 1fr; gap: 56px; align-items: center; padding-top: 56px; padding-bottom: 8px; }
.about-photo { position: relative; }
.about-photo img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.about-photo::after { content: ""; position: absolute; inset: -10px; z-index: -1; border-radius: 26px; background: conic-gradient(from 140deg, var(--accent), var(--accent-2), transparent 60%); opacity: 0.35; filter: blur(18px); }
.about-hero .prose { max-width: 680px; }
.fact-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.focus-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.focus-card { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); }
.focus-card .icon-wrap { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--surface-2); color: var(--accent-ink); margin-bottom: 14px; }
.focus-card h3 { margin: 0 0 6px; font-size: 16px; }
.focus-card p { margin: 0; color: var(--muted); font-size: 14px; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.cert {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev); text-align: center;
  transition: border-color 0.15s, transform 0.2s var(--ease);
}
.cert:hover { border-color: var(--accent-ink); transform: translateY(-2px); }
.cert iframe { width: 150px; height: 270px; border: 0; border-radius: 8px; background: #fff; }
.cert a { font-size: 13px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }

/* ---------- Command palette ---------- */
.palette {
  width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px));
  margin: 12vh auto auto; padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.palette[open] { display: flex; flex-direction: column; animation: pop 0.18s var(--ease); }
.palette::backdrop { background: rgba(5, 8, 12, 0.55); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input .prompt { font-family: var(--font-mono); color: var(--accent-ink); font-weight: 700; }
.palette-input input { flex: 1; height: 56px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; }
.palette-input input:focus { outline: none; }
.palette-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.palette-group { padding: 10px 10px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.palette-item a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); }
.palette-item a:hover { text-decoration: none; }
.palette-item[aria-selected="true"] a { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.palette-item .icon { color: var(--muted); }
.palette-item[aria-selected="true"] .icon { color: var(--accent-ink); }
.palette-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .hint { font-size: 12px; color: var(--muted); font-family: var(--font-mono); }
.palette-empty { padding: 28px; text-align: center; color: var(--muted); font-family: var(--font-mono); font-size: 14px; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* ---------- Lightbox ---------- */
.lightbox { max-width: 96vw; max-height: 96vh; padding: 0; border: 0; background: transparent; overflow: visible; }
.lightbox::backdrop { background: rgba(5, 8, 12, 0.9); }
.lightbox img { max-width: 94vw; max-height: 88vh; border-radius: var(--radius-sm); cursor: zoom-out; margin: 0 auto; }
.lightbox figcaption { color: #c9d4de; text-align: center; font-size: 14px; margin-top: 10px; }
.lightbox .icon-btn { position: fixed; top: 16px; right: 16px; color: #fff; border-color: rgba(255, 255, 255, 0.2); background: rgba(0, 0, 0, 0.4); }

/* ---------- Toast & back-to-top ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 300; transform: translate(-50%, 20px); opacity: 0;
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  transition: opacity 0.2s, transform 0.2s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .icon { color: var(--accent); }
.to-top { position: fixed; right: 24px; bottom: 24px; z-index: 90; background: var(--bg-elev); box-shadow: var(--shadow-md); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- 404 ---------- */
.notfound { max-width: 640px; margin: 80px auto 0; }
.notfound .terminal-body { min-height: 0; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .post-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .player-wrap { grid-template-columns: 1fr; }
  .focus-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-featured { grid-template-columns: 1fr; }
  .card-featured .card-media { min-height: 0; aspect-ratio: 16 / 9; }
  .card-featured .card-body { padding: 24px; }
}
@media (max-width: 820px) {
  .main-nav {
    position: fixed; inset: 68px 0 auto 0; flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: var(--bg-elev); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: all 0.2s var(--ease);
  }
  .main-nav.open { transform: none; opacity: 1; visibility: visible; }
  .main-nav a { padding: 12px; font-size: 16px; }
  .main-nav a[aria-current="page"]::after { left: 0; right: auto; top: 12px; bottom: 12px; width: 3px; height: auto; }
  .header-actions { margin-left: auto; }
  .menu-toggle { display: inline-grid; }
  .search-trigger .label, .search-trigger .kbd { display: none; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .about-hero { grid-template-columns: 1fr; gap: 32px; }
  .about-photo { max-width: 220px; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .grid { grid-template-columns: 1fr; }
  .brand-text { font-size: 15px; }
  .hero { padding-top: 40px; }
  .stats { gap: 24px; }
  .terminal { font-size: 12.5px; }
  .terminal-body { min-height: 260px; padding: 14px 16px 18px; }
  .section { padding-top: 56px; }
  .section-head { flex-direction: column; align-items: start; }
  .cta-band { padding: 28px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { grid-column: auto; }
  .prose { font-size: 16.5px; }
  .prose .anchor { display: none; }
  .focus-grid { grid-template-columns: 1fr; }
  .toolbar { top: 68px; }
  .to-top { right: 16px; bottom: 16px; }
}

@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; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header, .site-footer, .toc, .progress, .to-top, .post-nav, .share-row, .copy-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .post-layout { display: block; }
}

/* ---------- Small additions ---------- */
.stats { margin-bottom: 0; }
.stats > div { display: flex; flex-direction: column-reverse; }
.stats dd { margin: 0; }
span.chip { cursor: default; }
.author-card .share-row { margin-left: auto; }
@media (max-width: 820px) {
  .toolbar { position: static; }
}
@media (max-width: 640px) {
  .author-card { flex-wrap: wrap; }
  .author-card .share-row { margin-left: 0; }
}
