/* self-hosted fonts (bundled in assets/ — no external CDN, offline-capable) */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/jetbrains-mono-700.woff2") format("woff2"); }
@font-face { font-family: "VT323"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/vt323-400.woff2") format("woff2"); }
@font-face { font-family: "Space Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/space-mono-700.woff2") format("woff2"); }

:root {
  /* Matrix theme: phosphor green on near-black — cascades to the whole site */
  --bg: #010601;
  --panel: #04140a;
  --fg: #48f56e;          /* readable matrix-green body text */
  --muted: #2b8f4d;       /* dim green for secondary text */
  --cyan: #00ffb0;        /* accent (links / active tab / prompts) — brighter terminal green */
  --green: #00ff41;       /* classic Matrix green for highlights */
  --line: #0d3c22;        /* green-tinted borders */
  --glow: 0 0 8px rgba(0, 255, 65, .5);
  color-scheme: dark;
  accent-color: var(--cyan);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* amber theme — applied via [data-theme="amber"], hydrated from localStorage "df-theme" */
:root[data-theme="amber"] {
  --cyan: #f59e0b;
  --green: #fbbf24;
  --glow: 0 0 8px rgba(245, 158, 11, .45);
  --fg: #f5b942;
  --muted: #b3771a;
  --line: #4a3410;
  --panel: #140c04;
}
/* honor OS high-contrast requests by lifting the two lowest-contrast tokens (dim-green secondary text + faint borders); default look untouched */
@media (prefers-contrast: more) {
  :root { --muted: #4ee06e; --line: #1f7a44; }
  :root[data-theme="amber"] { --muted: #e0952a; --line: #7a5410; }
  #crtfx { display: none; }
  #matrix, #sky { display: none; }
  header .logo { text-shadow: 0 0 2px currentColor; }
  header .logo .cursor { text-shadow: none; }
  body::before { display: none; }
}
/* Windows High-Contrast: OS remaps CSS colors but not canvas pixels, so drop the
   decorative layers and let forced-colors keep real text/HUDs legible. */
@media (forced-colors: active) {
  #crtfx, #matrix, #sky { display: none; }
  body::before, body::after { display: none; }
}
/* reduced-motion: the matrix rain and drifting sky are pure decorative animation with no
   informational content, so hide them; the body's phosphor gradient keeps the look intact. */
@media (prefers-reduced-motion: reduce) { #matrix, #sky { display: none; } }
/* honor Save-Data / metered connections: the matrix rain + drifting sky are pure decoration,
   so drop them to spare bandwidth and battery; the phosphor gradient keeps the look intact */
@media (prefers-reduced-data: reduce) { #matrix, #sky { display: none; } }
* { box-sizing: border-box; }

/* smooth in-page scrolling (skip-link + console-tab jumps glide instead of teleport) */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* give every glide a gutter above the landing target so headings never sit flush to the top edge */
:target, #content, .console, .kg3d, .brain-gl { scroll-margin-top: 1.25rem; }
#content :target { background: rgba(0,255,65,.07); border-radius: 4px; }

/* keyboard focus indicators (mouse users unaffected) */
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }

/* phosphor "warm-up" on interactive links — glow + brighten on hover/focus, underline stays put */
#content a { transition: color .15s ease, text-shadow .15s ease; text-underline-offset: 0.18em; text-decoration-thickness: 1px; text-decoration-skip-ink: auto; -webkit-tap-highlight-color: transparent; }
/* balance multi-line headings so the last line isn't a lone orphaned word — inert where unsupported */
#content h1, #content h2, #content h3 { text-wrap: balance; }
/* pretty-wrap essay body text so the last line isn't a lone orphan — inert where unsupported */
#content p { text-wrap: pretty; }
#content li { text-wrap: pretty; }
#content li + li { margin-top: .3rem; }
#content li > ul, #content li > ol { margin-top: .3rem; }
/* hang leading quotes and list markers into the margin so text optically aligns — inert where unsupported */
#content { hanging-punctuation: first last; }
/* break otherwise-unbreakable tokens (long URLs, model/GPU IDs) so narrow screens don't scroll sideways */
#content { overflow-wrap: break-word; }
/* keep embedded figures/diagrams fluid so a wide image can't force horizontal scroll either */
#content img { max-width: 100%; height: auto; }
#content figure img { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
#content svg, #content video { max-width: 100%; height: auto; }
#content audio { max-width: 100%; }
#content figcaption { margin-top: .4rem; text-align: center; font-size: .85rem; font-style: italic; color: var(--muted); text-wrap: balance; }
#content figure { margin: 1.4rem 0; }
#content pre { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .75rem .9rem; line-height: 1.5; }
#content pre, #content code { -moz-tab-size: 4; tab-size: 4; }
#content pre, #content code, #content samp, #content kbd { font-variant-ligatures: none; }
#content :not(pre) > code { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: .05em .4em; font-size: .92em; color: var(--cyan); }
#content a code { color: inherit; }
#content :is(h1, h2, h3, h4) code { font-size: 1em; padding: 0; border: 0; background: none; }
#content a strong, #content a b, #content a em, #content a i { color: inherit; }
#content mark a { color: inherit; }
#content table { display: block; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
#content pre, #content table { scrollbar-width: thin; scrollbar-color: var(--cyan) var(--panel); }
#content th, #content td { border: 1px solid var(--line); padding: .4rem .6rem; text-align: left; vertical-align: top; }
#content td, #content th { font-variant-numeric: tabular-nums; }
#content caption { caption-side: bottom; margin-top: .5rem; font-size: .85rem; font-style: italic; color: var(--muted); text-align: left; text-wrap: pretty; }
#content th { color: var(--green); }
#content th[scope="col"] { text-wrap: balance; }
#content td { text-wrap: pretty; }
#content th[scope="row"] { font-weight: 400; color: var(--fg); position: sticky; left: 0; background: var(--bg); }
#content tbody tr:nth-child(even) { background: rgba(0,255,65,.025); }
#content tbody tr { transition: background .15s ease; }
#content tbody tr:hover { background: rgba(0,255,65,.05); }
#content tfoot td, #content tfoot th { border-top: 2px solid var(--cyan); color: var(--muted); font-variant-numeric: tabular-nums; }
#content thead th { border-bottom: 2px solid var(--cyan); }
#content hr { border: 0; height: 1px; margin: 2rem 0; background: linear-gradient(90deg, transparent, var(--line) 20%, var(--cyan) 50%, var(--line) 80%, transparent); box-shadow: var(--glow); }
/* visited in-content links decay to the dim phosphor green — a pixel that's already been lit */
#content a:visited { color: var(--muted); }
/* light list markers in the terminal accent so each bullet reads like a lit prompt marker */
#content li::marker { color: var(--cyan); }
/* the footnote you jumped to lights its own marker phosphor-green (same already-lit/active convention as ::marker cyan / :active green), so the exact landed-on item is unmistakable */
#content li:target::marker { color: var(--green); text-shadow: var(--glow); }
/* second-level-and-deeper markers drop to dim phosphor so nesting depth reads at a glance (same secondary-green convention as <small>/<time>/<cite>/<aside>) */
#content ul ul li::marker, #content ol ol li::marker { color: var(--muted); }
/* tabular figures so auto-numbered ordered lists keep a flush marker column past double digits (mirrors essay <time> stamps) */
#content ol { font-variant-numeric: tabular-nums; }
/* nested numbered lists shift numeral system by depth (1 → a → i) so outline structure reads at a glance, not just marker colour */
#content ol ol { list-style-type: lower-alpha; }
#content ol ol ol { list-style-type: lower-roman; }
/* lift bold key terms to the highlight-green so emphasised concepts glow one notch brighter (tracks the amber theme via --green) */
#content strong, #content b { color: var(--green); }
#content em, #content i { font-style: italic; color: var(--green); }
#content mark { background: var(--green); color: var(--bg); text-shadow: none; padding: 0 .2em; border-radius: 3px; box-shadow: var(--glow); }
#content abbr[title] { text-decoration: underline dotted var(--muted); text-underline-offset: .2em; cursor: help; }
#content abbr[title]:hover { text-decoration-color: var(--cyan); }
#content kbd { font-family: inherit; font-size: .85em; color: var(--bg); background: var(--green); border: 1px solid var(--line); border-radius: 4px; padding: .05em .45em; box-shadow: 0 1px 0 var(--line); text-shadow: none; white-space: nowrap; }
#content samp { font-family: inherit; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: .05em .4em; }
#content small { color: var(--muted); }
#content q { color: var(--muted); font-style: italic; }
#content q::before, #content q::after { color: var(--cyan); text-shadow: var(--glow); }
#content cite { font-style: italic; color: var(--muted); }
#content var { font-style: italic; color: var(--cyan); }
#content time { color: var(--muted); font-variant-numeric: tabular-nums; }
#content data { color: var(--muted); font-variant-numeric: tabular-nums; }
#content dfn { font-style: italic; color: var(--green); font-weight: 700; }
#content dfn[title] { cursor: help; }
#content sup, #content sub { line-height: 0; font-size: .72em; }
#content sup a, #content sub a { text-decoration: none; color: var(--cyan); padding: .25em .3em; }
#content sup a:visited, #content sub a:visited { color: var(--cyan); }
#content del, #content s { color: var(--muted); text-decoration-line: line-through; text-decoration-color: var(--cyan); text-decoration-thickness: 1px; }
#content ins { text-decoration-line: underline; text-decoration-color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: .18em; color: var(--green); }
#content u { text-decoration: underline wavy var(--muted); text-decoration-thickness: 1px; text-underline-offset: .18em; }
#content blockquote { margin: 1.4rem 0; padding: .4rem 0 .4rem 1rem; border-left: 2px solid var(--cyan); color: var(--muted); font-style: italic; text-wrap: pretty; box-shadow: -4px 0 12px -10px var(--cyan); }
#content blockquote > :first-child { margin-top: 0; }
#content blockquote > :last-child { margin-bottom: 0; }
#content blockquote footer { margin-top: .4rem; font-style: normal; font-size: .9em; color: var(--muted); }
#content aside { margin: 1.4rem 0; padding: .4rem 0 .4rem 1rem; border-left: 2px dashed var(--line); color: var(--muted); font-size: .95em; }
#content address { font-style: normal; color: var(--muted); border-left: 2px dotted var(--line); padding-left: .8rem; margin: 1.4rem 0; }
#content dt { color: var(--green); font-weight: 700; margin-top: .6rem; text-wrap: balance; }
#content dt:first-child { margin-top: 0; }
#content dd { margin: .15rem 0 .6rem 1.2rem; color: var(--muted); text-wrap: pretty; }
#content dd > :first-child { margin-top: 0; }
#content dd > :last-child { margin-bottom: 0; }
#content dl { margin: 1.4rem 0; padding: .4rem 0 .4rem 1rem; border-left: 2px solid var(--line); }
#content dl > :last-child { margin-bottom: 0; }
#content summary { cursor: pointer; color: var(--cyan); text-wrap: balance; transition: color .15s ease, text-shadow .15s ease; }
#content summary:hover, #content summary:focus-visible { text-shadow: var(--glow); }
#content summary:hover, #content summary:focus-visible { background: rgba(0,255,65,.05); border-radius: 4px; }
#content summary:active { color: var(--green); text-shadow: var(--glow); }
#content summary::marker { color: var(--cyan); }
#content details { margin: 1.4rem 0; padding: .4rem 0 .4rem 1rem; border-left: 2px solid var(--line); }
#content details[open] > summary { color: var(--green); }
#content details[open] > summary { margin-bottom: .5rem; }
#content details[open] > summary::marker { color: var(--green); text-shadow: var(--glow); }
#content details[open] { border-left-color: var(--cyan); }
#content a:hover,
#content a:focus-visible { color: var(--cyan); text-shadow: var(--glow); }
#content a:active { color: var(--green); text-shadow: var(--glow); }

/* flag links that leave the factory — internal SPA links stay unmarked */
#content a[href^="http"]:not([href*="raghunathnair1-rgb.github.io"])::after {
  content: "\00a0↗" / "";           /* empty alt text: decorative, not announced by SRs */
  font-size: .82em; color: var(--muted); text-shadow: none;
  display: inline-block; text-decoration: none;   /* keep the phosphor underline off the nbsp + arrow */
}
/* image/figure links carry their own meaning — drop the stray ↗ with no text to attach to */
#content a[href^="http"]:has(img, svg, picture)::after { content: none; }
#content a[href^="http"]:not([href*="raghunathnair1-rgb.github.io"]):hover::after,
#content a[href^="http"]:not([href*="raghunathnair1-rgb.github.io"]):focus-visible::after {
  color: var(--cyan); text-shadow: var(--glow);
}

/* skip-to-content link — off-screen until keyboard-focused, then reveals */
.skip { position: absolute; left: -9999px; top: 0; z-index: 10000; background: var(--green); color: var(--bg);
  padding: .5rem .9rem; border-radius: 0 0 6px 0; font-weight: 700; text-decoration: none; text-shadow: none; }
.skip:focus { left: 0; box-shadow: var(--glow); }

/* text selection uses the terminal palette, not OS blue (tracks the amber theme via --green) */
::selection { background: var(--green); color: var(--bg); text-shadow: none; }
::-moz-selection { background: var(--green); color: var(--bg); text-shadow: none; }
#content ::target-text { background: var(--green); color: var(--bg); text-shadow: none; }
#content ::selection { background: var(--green); color: var(--bg); text-shadow: none; }
input, textarea, [contenteditable] { caret-color: var(--cyan); }

/* themed scrollbar so the last un-themed OS chrome tracks the phosphor palette (recolors with amber) */
html { scrollbar-width: thin; scrollbar-color: var(--green) var(--bg); scrollbar-gutter: stable; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border: 2px solid var(--bg); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background: var(--green); box-shadow: var(--glow); }
::-webkit-scrollbar-corner { background: var(--bg); }

/* keep block/box ASCII (█ ▓ ─ ┌) on a self-consistent monospace so it stays aligned */
.clock-face, .nf-art { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* --- TTY consoles (tab navigation) --- */
.tty-bar { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1.1rem 0 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.tty-tab { font: inherit; font-size: .82rem; background: transparent; color: var(--muted); border: 1px solid var(--line); border-bottom: none; border-radius: 6px 6px 0 0; padding: .35rem .75rem; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; cursor: pointer; white-space: nowrap; transition: color .15s, border-color .15s, background .15s; -webkit-tap-highlight-color: transparent; }
.tty-tab:hover { color: var(--fg); border-color: var(--cyan); background: rgba(255,255,255,.02); }
.tty-tab.active { color: var(--cyan); border-color: var(--cyan); background: rgba(255,255,255,.04); text-shadow: var(--glow); }
.tty-tab:active { color: var(--green); border-color: var(--cyan); text-shadow: var(--glow); }
.console { animation: console-in .32s cubic-bezier(.16, 1, .3, 1); min-height: 22rem; }
@keyframes console-in {
  from { opacity: 0; transform: translateY(10px) scale(.994); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .console { animation: none; } }

/* --- pipeline console (watch the factory work) --- */
.pipe-wrap { margin: .8rem 0 1.4rem; }
.pipe-gl-stage { position: relative; width: 100%; aspect-ratio: 7 / 1; min-height: 84px; max-height: 150px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #010601;
  margin: .3rem 0 .45rem; box-shadow: inset 0 0 40px -20px rgba(0,255,65,.55); }
.pipe-gl { display: block; width: 100%; height: 100%; }
.pipe-stages { display: flex; justify-content: space-between; gap: .3rem; font-size: .7rem; color: var(--muted); margin: 0 .35rem 1rem; }
.pipe-stage { flex: 1; text-align: center; white-space: nowrap; border-radius: 4px; cursor: pointer; padding: .3rem 0; text-decoration: underline dotted var(--line); text-underline-offset: .3em; text-decoration-thickness: 1px; -webkit-tap-highlight-color: transparent; transition: color .15s ease, text-shadow .15s ease; }
.pipe-stage:hover, .pipe-stage:focus-visible { color: var(--cyan); text-shadow: var(--glow); text-decoration: underline; text-underline-offset: .3em; text-decoration-thickness: 1px; background: rgba(0,255,65,.06); }
.pipe-stage:active { color: var(--green); text-shadow: var(--glow); }
.pipe-stage:active { color: var(--green); text-shadow: var(--glow); }
.tty-tab, .pipe-stage { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
@media (prefers-reduced-motion: reduce) { .pipe-stage { transition: none; } }
.pipe-pill { display: inline-block; font-size: .74rem; margin: .1rem 0 .35rem; padding: .04rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pipe-pill.run { color: #ffc400; border-color: rgba(255,196,0,.5); animation: pipe-pulse 1.2s ease-in-out infinite; }
.pipe-pill.ok { color: #7effb0; border-color: rgba(126,255,176,.4); }
.pipe-pill.run::before{content:"⟳ "}
.pipe-pill.ok::before{content:"✓ "}
.pipe-pill.fail::before{content:"✗ "}
.pipe-pill.fail { color: #ff5f56; border-color: rgba(255,95,86,.55); }
@keyframes pipe-pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .pipe-pill.run { animation: none; } }

/* --- WebGL neural-brain (~/factory) --- */
.brain-gl-wrap { margin: .3rem 0 1.1rem; }
.brain-gl-stage { position: relative; width: 100%; aspect-ratio: 2 / 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #05070c; }
.brain-gl-stage.hero { aspect-ratio: 16 / 10; border-color: #14324a; box-shadow: 0 0 40px -12px rgba(50,210,255,.35), inset 0 0 60px -30px rgba(120,80,255,.4); }
.brain-gl { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.brain-gl:active { cursor: grabbing; }
.brain-gl-hud { position: absolute; left: .65rem; bottom: .5rem; font-size: .72rem; line-height: 1.55; color: var(--fg); text-shadow: 0 0 6px #000, 0 0 3px #000; pointer-events: none; user-select: none; -webkit-user-select: none; }
.bgl-row { display: flex; align-items: center; gap: .45rem; }
.bgl-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.bgl-k { background: #22d3ee; box-shadow: 0 0 6px #22d3ee; }
.bgl-l { background: #7effb0; box-shadow: 0 0 6px #7effb0; }
.bgl-h { background: #ff5470; box-shadow: 0 0 6px #ff5470; }
.bgl-o { background: #f5c542; box-shadow: 0 0 6px #f5c542; }

/* --- interactive 3D knowledge graph (#kg3d on ~/factory) --- */
.kg3d-wrap { margin: .3rem 0 1.3rem; }
.kg3d-stage { position: relative; width: 100%; aspect-ratio: 3 / 2; max-height: 460px;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #010601;
  box-shadow: inset 0 0 60px -30px rgba(0,255,65,.55); }
.kg3d-stage, .brain-gl-stage { transition: border-color .15s ease; }
@media (prefers-reduced-motion: reduce) { .kg3d-stage, .brain-gl-stage { transition: none; } }
.kg3d-stage, .brain-gl-stage, .pipe-gl-stage { overscroll-behavior: contain; }
.kg3d-stage:hover, .kg3d-stage:focus-within, .brain-gl-stage:hover, .brain-gl-stage:focus-within { border-color: var(--cyan); }
.kg3d-stage:has(.kg3d:active), .brain-gl-stage:has(.brain-gl:active) { border-color: var(--cyan); }
.kg3d-stage:has(.kg3d:active) .kg3d-hud, .brain-gl-stage:has(.brain-gl:active) .kg3d-hud { color: var(--cyan); }
.kg3d, .brain-gl { display: block; width: 100%; height: 100%; border-radius: 10px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; -webkit-user-drag: none; }
.kg3d:active { cursor: grabbing; }
.kg3d:focus-visible, .brain-gl:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; box-shadow: var(--glow); }
.kg3d-hud { color: var(--muted); font-size: .8rem; margin: .35rem 0 0; transition: color .15s ease; user-select: none; -webkit-user-select: none; text-wrap: pretty; }
.kg3d-stage:hover .kg3d-hud, .kg3d-stage:focus-within .kg3d-hud { color: var(--fg); }
@media (hover: none) { .kg3d-hud { color: var(--fg); } }
@media (prefers-reduced-motion: reduce) { .kg3d-stage, .brain-gl-stage, .kg3d-hud { transition: none; } }
.pipe-latest { color: var(--fg); margin-top: .4rem; overflow-wrap: anywhere; }
.pipe-cur { color: #7effb0; }
.pipe-updated { color: var(--muted); font-size: .8rem; margin: .15rem 0 .7rem; }
.pipe-loghead { color: var(--muted); font-size: .82rem; margin-bottom: .2rem; }
.pipe-log { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.pipe-evt { padding: .09rem 0 .09rem .7rem; font-size: .82rem; color: var(--fg); overflow-wrap: anywhere; text-wrap: pretty; }
.pipe-log:hover .pipe-evt { opacity: .38; transition: opacity .15s ease; }
.pipe-log:hover .pipe-evt:hover { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .pipe-log:hover .pipe-evt { transition: none; } }
@media (prefers-reduced-motion: reduce) { #content a, .tty-tab { transition: none; } }
.pipe-t { color: var(--muted); margin-right: .5rem; }
.pipe-k { display: inline-block; min-width: 6.2em; }
.pipe-k-router { color: #22d3ee; }
.pipe-k-post { color: #7effb0; }
.pipe-k-improve { color: #c792ea; }
.pipe-k-deploy { color: #ff9d5c; }
.pipe-ok { color: #7effb0; }
.pipe-fail { color: #ff5f56; }

/* cinematic WebGL CRT shader overlay */
#crtfx {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  z-index: 50; pointer-events: none; mix-blend-mode: soft-light;
}
@media (prefers-reduced-motion: reduce) { #crtfx { display: none; } }
@media (prefers-reduced-transparency: reduce) { #crtfx { display: none; } }
@media (prefers-reduced-transparency: reduce) { .kg3d-stage, .brain-gl-stage, .brain-gl-stage.hero, .pipe-gl-stage { box-shadow: none; } }
@media (prefers-reduced-transparency: reduce) { .kg3d:focus-visible, .brain-gl:focus-visible { box-shadow: none; } }
@media (prefers-reduced-transparency: reduce) { .pipe-gl-stage { box-shadow: none; } }
@media (prefers-reduced-transparency: reduce) { body::before, body::after { display: none; } }
@media (prefers-reduced-transparency: reduce) {
  #content hr { box-shadow: none; }
  #content blockquote { box-shadow: none; }
}
@media (prefers-reduced-data: reduce) { #crtfx { display: none; } }
@media (prefers-reduced-data: reduce) { #matrix, #sky { display: none; } }

/* BIOS / POST boot splash (first load per session) */
#boot {
  position: fixed; inset: 0; z-index: 9999; background: #05070b;
  color: var(--green); padding: 2rem 1.25rem;
  font-family: "VT323", ui-monospace, monospace; font-size: clamp(15px, 4vw, 21px); line-height: 1.15;
  transition: opacity .6s ease;
}
#boot pre { margin: 0; white-space: pre-wrap; text-shadow: 0 0 6px rgba(74, 222, 128, .4); }
#boot.boot-typed pre::after, #boot.boot-idle pre::after { content: "_"; color: var(--green); animation: boot-blink 1s step-end infinite; }
@keyframes boot-blink { 50% { opacity: 0; } }

/* CRT scanline+vignette overlay — enabled via [data-crt="on"], hydrated from localStorage "df-crt" */
:root[data-crt="on"] body::before {
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, .34) 0 1px, transparent 1px 3px),
    radial-gradient(130% 130% at 50% 50%, transparent 62%, rgba(0, 0, 0, .55) 100%);
  animation: crt-flicker .12s steps(2, end) infinite;
}
@keyframes crt-flicker { 0%, 100% { opacity: .92; } 50% { opacity: 1; } }
:root[data-crt="on"] body { text-shadow: 0 0 1px rgba(74, 222, 128, .25); }
:root[data-theme="amber"] #boot pre { text-shadow: 0 0 6px rgba(251, 191, 36, .4); }
:root[data-theme="amber"][data-crt="on"] body { text-shadow: 0 0 1px rgba(251, 191, 36, .25); }
@media (prefers-reduced-motion: reduce) { :root[data-crt="on"] body::before { animation: none; } }
@media (prefers-reduced-transparency: reduce) { :root[data-crt="on"] body::before { display: none; } }
#boot.boot-done { opacity: 0; pointer-events: none; }

/* phosphor "initializing" placeholder — shows only while #app is empty (pre-WASM hydration); self-removes the instant Yew mounts */
#app:empty::before {
  content: "> initializing dark-factory…";
  display: block;
  font-family: "VT323", ui-monospace, monospace;
  font-size: 1.1rem;
  color: var(--green);
  text-shadow: var(--glow);
  padding: 2rem 0;
  opacity: .8;
}
html, body { height: 100%; }
body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0,255,65,.08), transparent 60%),
    var(--bg);
  color: var(--fg);
  line-height: 1.7;
  text-wrap: pretty;
  overflow-wrap: break-word;
  max-width: 44rem;
  margin-inline: auto;
  padding: 3rem 1.25rem 4rem;
}
h1, h2, h3 { text-wrap: balance; }
:root[data-theme="amber"] body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(245,158,11,.08), transparent 60%),
    var(--bg);
}
/* faint scanlines for the CRT vibe */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.015) 0 1px, transparent 1px 3px);
}
/* phosphor scroll-progress beam — scroll-driven, JS-free; stays scaleX(0) (invisible) where animation-timeline is unsupported */
body::after {
  content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 2px;
  transform: scaleX(0); transform-origin: 0 50%;
  background: var(--green); box-shadow: var(--glow); z-index: 60; pointer-events: none;
  animation: df-read-progress linear; animation-timeline: scroll(root block);
}
@keyframes df-read-progress { to { transform: scaleX(1); } }
/* matrix-rain canvas layer (drawn by the script in index.html) */
#matrix {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none; opacity: .55;
  /* bold full-page rain, only a whisper of center softening for legibility */
  -webkit-mask-image: radial-gradient(ellipse 42% 58% at 50% 46%, rgba(0,0,0,0.68) 0%, rgba(0,0,0,0.9) 42%, black 74%);
  mask-image: radial-gradient(ellipse 42% 58% at 50% 46%, rgba(0,0,0,0.68) 0%, rgba(0,0,0,0.9) 42%, black 74%);
}
/* weather-reactive sky layer — live wttr.in condition, behind content (see index.html) */
#sky {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none; opacity: .55;
  -webkit-mask-image: radial-gradient(ellipse 46% 62% at 50% 46%, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.85) 45%, black 78%);
  mask-image: radial-gradient(ellipse 46% 62% at 50% 46%, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.85) 45%, black 78%);
}
@media (prefers-reduced-motion: reduce) { #matrix { display: none !important; } }
@media (prefers-reduced-motion: reduce) { #sky { display: none !important; } }
@media (prefers-reduced-transparency: reduce) { #matrix, #sky { opacity: .2; } .tty-tab.active { background: var(--panel); } }
@media (prefers-contrast: more) { #matrix, #sky { opacity: .22; } }
@media (forced-colors: active) { #crtfx, #matrix, #sky { display: none; } body::before { display: none; } .tty-tab.active { border-color: Highlight; color: Highlight; } :focus-visible { outline-color: Highlight; } }
@media (forced-colors: active) {
  header .logo, header .logo .cursor, body,
  .tty-tab.active, .skip { text-shadow: none; }
  #matrix, #sky, #crtfx { display: none; }
  .tty-tab.active { background: Highlight; color: HighlightText; }
}
/* --- Stranger Things header: red neon serif (ITC Benguiat vibe) with a flickering-sign glow --- */
header .logo {
  /* Matrix theme: phosphor-green CRT terminal look (VT323 is bundled — no CDN) */
  font-family: "VT323", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(2.4rem, 11vw, 4.4rem); font-weight: 400; letter-spacing: .05em;
  color: #00ff41;
  text-shadow: 0 0 5px #00ff41, 0 0 12px #00e63a, 0 0 26px #00a028, 0 0 46px #004d10;
}
.logo-name { animation: st-flicker 5s linear infinite; }
@media (prefers-reduced-motion: reduce) { .logo-name { animation: none; } .cursor { animation: none; } }
@keyframes st-flicker {
  0%, 88%, 100% { opacity: 1; }
  89% { opacity: .35; }
  90.5% { opacity: 1; }
  93% { opacity: .5; }
  94.5% { opacity: 1; }
}
.cursor { animation: blink 1.05s steps(1) infinite; color: var(--green); }
header .logo .cursor { color: #00ff41; text-shadow: 0 0 6px #00ff41, 0 0 16px #00c832; }
:root[data-theme="amber"] header .logo {
  color: #fbbf24;
  text-shadow: 0 0 5px #fbbf24, 0 0 12px #f59e0b, 0 0 26px #b45309, 0 0 46px #4a2708;
}
:root[data-theme="amber"] header .logo .cursor {
  color: #fbbf24; text-shadow: 0 0 6px #fbbf24, 0 0 16px #f59e0b;
}
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor, header .logo .cursor { animation: none; } }
.boot { color: var(--green); margin-top: .25rem; font-size: .9rem; opacity: .85; }

main { margin-top: 2.5rem; }

/* ♫ now playing — command line */
.np { margin-bottom: 1.9rem; font-size: .9rem; }
.np-cmd { color: var(--green); }
.np-out { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-top: .25rem; }
.np-note { color: var(--cyan); }
.np-track { color: var(--fg); font-weight: 700; }
.np-artist { color: var(--muted); }
.np-out a { color: var(--green); font-size: .82rem; }
.np-out a:hover { color: var(--cyan); text-shadow: var(--glow); }
/* now-playing → Spotify card (real cover self-hosted in /assets — CSP-clean, no external hosts) */
.np-sp { display: flex; align-items: center; gap: .7rem; text-decoration: none; margin-top: .35rem;
  padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 10px; background: #071008;
  max-width: 430px; transition: border-color .15s, box-shadow .15s; }
.np-sp:hover, .np-sp:focus-visible { border-color: #1db954; box-shadow: 0 0 16px -5px rgba(29,185,84,.55); }
.np-cover { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; flex: 0 0 auto; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
.np-meta { display: flex; flex-direction: column; min-width: 0; }
.np-sp .np-artist { font-size: .8rem; }
.np-spotify { margin-left: auto; display: inline-flex; align-items: center; gap: .35rem; color: #1db954; font-size: .78rem; white-space: nowrap; }
.np-spotify svg { width: 15px; height: 15px; flex: 0 0 auto; }

/* $ neofetch */
.nf-cmd { color: var(--green); margin-bottom: .4rem; }
.neofetch {
  display: flex; gap: 1.2rem; align-items: center; max-width: 34rem; margin-bottom: 1.9rem;
  border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: var(--panel);
}
.nf-art { margin: 0; color: var(--cyan); font-size: .8rem; line-height: 1.15; text-shadow: var(--glow); }
.nf-info { font-size: .86rem; min-width: 0; }
.nf-line .k { color: var(--cyan); display: inline-block; width: 4.5rem; }
.nf-ok { color: var(--green); }
@media (max-width: 30rem) { .neofetch { flex-direction: column; align-items: flex-start; } }

/* $ curl wttr.in — live weather */
.wx { max-width: 34rem; margin-bottom: 1.9rem; }
.wx-cmd { color: var(--green); margin-bottom: .4rem; }
.wx-out {
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem;
  background: var(--panel); color: var(--fg);
}
.wx-loading { color: var(--muted); font-size: .85rem; }

/* 🧠 brain-status widget (live, from status.json) */
.brain { max-width: 34rem; margin-bottom: 1.9rem; }
.brain-cmd { color: var(--green); margin-bottom: .5rem; }
.brain-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; font-size: .86rem;
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; background: var(--panel);
}
.brain .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.brain .dot.ok { background: var(--green); box-shadow: 0 0 7px var(--green); animation: brain-pulse 1.6s ease-in-out infinite; }
.brain .dot.bad { background: #ff5f56; box-shadow: 0 0 7px #ff5f56; }
@keyframes brain-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .brain .dot.ok { animation: none; } }
.brain-up { color: var(--cyan); font-variant-numeric: tabular-nums; margin-left: auto; }
.brain-pid { color: var(--muted); font-size: .76rem; }
.brain-loading { color: var(--muted); font-size: .85rem; }

/* 🤖 AI daily feed (auto-curated by the dark factory) */
.news { margin-bottom: 1.9rem; }

/* dmesg — the factory's dream journal */
.dj { max-width: 42rem; margin-bottom: 1.9rem; }
.dj-cmd { color: var(--green); margin-bottom: .5rem; }
.dj-loading { color: var(--muted); font-style: italic; }
.dj-list { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.dj-line { display: flex; gap: .55rem; padding: .13rem 0 .13rem .7rem; font-size: .82rem; line-height: 1.5; }
.dj-t { color: var(--muted); flex: 0 0 auto; opacity: .65; }
.dj-msg { color: var(--fg); }
.dj-ok { color: var(--green); }
.dj-info { color: var(--fg); opacity: .82; }
.dj-warn { color: #f59e0b; }
.dj-dream { color: #c4a3ff; font-style: italic; opacity: .92; }
.news-loading { color: var(--muted); font-size: .85rem; margin-top: .3rem; }
.news-list { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .7rem; }
.news-item { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; background: var(--panel); }
.news-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.news-title { color: var(--cyan); font-weight: 600; text-decoration: none; }
.news-title:hover { text-decoration: underline; }
.news-tag { color: var(--green); font-size: .72rem; }
.news-date { color: var(--muted); font-size: .72rem; margin-left: auto; }
.news-sum { color: var(--fg); font-size: .86rem; margin: .4rem 0 .35rem; line-height: 1.5; }
.news-src { color: var(--muted); font-size: .76rem; text-decoration: none; }
.news-src:hover { color: var(--fg); }
.news-pager { display: flex; align-items: center; justify-content: center; gap: .9rem; margin-top: .9rem; }
.np-btn {
  background: var(--panel); border: 1px solid var(--line); color: var(--cyan);
  font: inherit; font-size: .8rem; padding: .3rem .75rem; border-radius: 8px; cursor: pointer;
}
.np-btn:hover:not(:disabled) { border-color: var(--cyan); box-shadow: 0 0 8px rgba(34, 211, 238, .25); }
.np-btn:disabled { opacity: .3; cursor: default; }
.np-info { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }

/* 🍩🌍 spinning ASCII art (donut + globe) */
.ascii-art { margin-bottom: 1.9rem; }
.ascii-cmd { color: var(--green); margin-bottom: .4rem; }
.ascii-face {
  margin: 0; color: var(--cyan); text-shadow: var(--glow);
  font-size: clamp(.42rem, 1.7vw, .72rem); line-height: 1.2; letter-spacing: 0;
  white-space: pre; overflow-x: auto;
}
/* DGX Spark monitor: real telemetry readout — system-mono so █/░ bars align with labels */
.spark-face {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--green); text-shadow: 0 0 6px rgba(74, 222, 128, .3);
  font-size: clamp(.62rem, 2.1vw, .82rem); line-height: 1.4;
}

/* interactive force-directed knowledge graph */
.kg-wrap { position: relative; margin-bottom: 1.9rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #010601; box-shadow: inset 0 0 60px -30px rgba(0,255,65,.5); }
/* WebGL neural-energy field behind the graph (self-contained; graceful fallback hides it) */
.kg-gl { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; display: block; }
.kg-wrap > :not(.kg-gl) { position: relative; z-index: 1; }
.kg {
  width: 100%; max-width: 40rem; aspect-ratio: 360 / 280; height: auto; display: block;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(6, 12, 16, .45);
}
.kg-edge { stroke: rgba(130, 170, 180, .42); stroke-width: 1; stroke-dasharray: 5 4; animation: kg-flow .9s linear infinite; }
@keyframes kg-flow { to { stroke-dashoffset: -9; } }
.kg-edge.dim { stroke: rgba(120, 150, 160, .07); animation: none; }
.kg-node { cursor: grab; }
.kg-node:active { cursor: grabbing; }
.kg-node.dim { opacity: .2; }
.kg-node text { fill: var(--muted); font: 8px ui-monospace, monospace; pointer-events: none; }
.kg-clickable text { fill: var(--cyan); text-decoration: underline; }
.kg-ring { fill: none; stroke: #e8fff1; stroke-width: 1.4; opacity: .9; }
.kg-pulse { fill: #b8ffdb; opacity: .95; filter: drop-shadow(0 0 2px rgba(184, 255, 219, .8)); }
.kg-surge { fill: #e8fff1; opacity: 1; filter: drop-shadow(0 0 3.5px rgba(184, 255, 219, 1)) drop-shadow(0 0 7px rgba(120, 255, 180, .55)); }
.kg-path-edge { stroke: #b8ffdb; stroke-width: 2; filter: drop-shadow(0 0 3px rgba(184, 255, 219, .9)); animation: kg-flow .5s linear infinite; }
/* domain clustering: node fill (SVG) + legend dot (text) colored by domain */
/* Matrix theme: green-family domain palette (teal → lime → chartreuse), still distinguishable */
.kg-d0 { fill: #eaffe0; color: #eaffe0; }   /* core        — white-green hub */
.kg-d1 { fill: #00ffb0; color: #00ffb0; }   /* brain & AI  — teal-green */
.kg-d2 { fill: #34ffd6; color: #34ffd6; }   /* pipeline    — aqua-green */
.kg-d3 { fill: #00ff41; color: #00ff41; }   /* frontend    — matrix green */
.kg-d4 { fill: #c6ff00; color: #c6ff00; }   /* distribution— chartreuse */
.kg-d5 { fill: #7dff4d; color: #7dff4d; }   /* writing     — lime */
.kg .kg-d0, .kg .kg-d1, .kg .kg-d2, .kg .kg-d3, .kg .kg-d4, .kg .kg-d5 { filter: url(#kg-bloom); }
.kg-legend { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin: .5rem 0 .2rem; font-size: .76rem; color: var(--muted); }
.kg-leg { white-space: nowrap; }
.kg-leg > span:first-child { margin-right: .12rem; font-size: .7rem; }
/* guided tour */
.kg-tour-btn { font: inherit; font-size: .78rem; background: transparent; color: var(--cyan); border: 1px solid var(--line); border-radius: 5px; padding: .18rem .55rem; margin: .1rem 0 .3rem; cursor: pointer; }
.kg-tour-btn:hover { border-color: var(--cyan); text-shadow: var(--glow); }
.kg-tour { border: 1px solid var(--cyan); border-radius: 8px; padding: .7rem .9rem; margin: .5rem 0; background: rgba(34,211,238,.05); box-shadow: var(--glow); }
.kg-tour-hd { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .74rem; }
.kg-tour-x { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: .9rem; line-height: 1; }
.kg-tour-x:hover { color: var(--cyan); }
.kg-tour-title { color: var(--cyan); font-size: 1.05rem; margin: .3rem 0 .25rem; text-shadow: var(--glow); }
.kg-tour-text { color: var(--fg); font-size: .88rem; line-height: 1.5; }
.kg-tour-nav { display: flex; gap: .5rem; margin-top: .65rem; }
.kg-tour-b { font: inherit; font-size: .8rem; background: transparent; color: var(--cyan); border: 1px solid var(--cyan); border-radius: 5px; padding: .25rem .75rem; cursor: pointer; }
.kg-tour-b:hover { background: rgba(34,211,238,.12); }

/* richer post cards */
.post-excerpt { color: var(--muted); font-size: .82rem; margin: .3rem 0 0 1.1rem; line-height: 1.45; }
.rt { color: var(--muted); font-size: .75rem; margin-left: .5rem; opacity: .8; }
/* lab captions */
/* feed tag filters + RSS */
.nf-filters { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .85rem; }
.nf-chip { font: inherit; font-size: .76rem; background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .12rem .62rem; cursor: pointer; transition: color .15s, border-color .15s; }
.nf-chip:hover { color: var(--fg); border-color: var(--cyan); }
.nf-chip.active { color: var(--cyan); border-color: var(--cyan); box-shadow: var(--glow); }
.nf-rss { display: inline-block; margin-top: 1rem; color: var(--muted); font-size: .78rem; }
.nf-rss:hover { color: #ff9d5c; }
/* sunrise/sunset arc */
.sun-wrap { margin: 1rem 0 1.6rem; }
.sun-face { line-height: 1.02; font-size: .82rem; letter-spacing: .12em; margin: 0; }
.sun-face.sun-day { color: #ffd86b; text-shadow: 0 0 8px rgba(255,216,107,.45); }
.sun-face.sun-dawn { color: #ffb057; text-shadow: 0 0 8px rgba(255,176,87,.45); }
.sun-face.sun-dusk { color: #ff7a59; text-shadow: 0 0 8px rgba(255,122,89,.45); }
.sun-face.sun-night { color: #6d8fb8; text-shadow: 0 0 7px rgba(109,143,184,.4); }
.sun-info { color: var(--muted); font-size: .82rem; margin-top: .45rem; line-height: 1.55; }
/* --- responsive + fluid polish --- */
html { scroll-behavior: smooth; }
.ascii-face, .kg-wrap, .news-list, .console pre { -webkit-overflow-scrolling: touch; }
@media (max-width: 34rem) {
  .tty-tab { font-size: .74rem; padding: .3rem .55rem; }
  .kg-legend { gap: .2rem .55rem; font-size: .7rem; }
  .sun-info, .pipe-latest, .pipe-evt { font-size: .78rem; }
  main { margin-top: 1.6rem; }
}

/* --- smoother micro-interactions + graph hover glide --- */
a, .log li, .news-item, .news-title, .news-src, .kg-node, .kg-edge {
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, stroke .22s ease, opacity .22s ease, text-shadow .16s ease;
}
.log li:hover { background: rgba(255, 255, 255, .035); border-radius: 6px; }
.news-item:hover .news-title { color: var(--cyan); text-shadow: var(--glow); }
.news-list { animation: nf-fade .26s ease; }
@keyframes nf-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .news-list { animation: none; } }

/* --- ~/contact tab --- */
.contact-lede { color: var(--fg); font-size: .95rem; line-height: 1.65; margin: .35rem 0 1.15rem; max-width: 46rem; }
.contact-lede .cc-c { color: var(--muted); }
.contact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
@media (max-width: 34rem) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card {
  display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  color: var(--fg); text-decoration: none; position: relative;
  transition: transform .18s cubic-bezier(.16, 1, .3, 1), border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.contact-card:hover { transform: translateY(-3px); background: #0e1520; }
.contact-card:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.cc-ico { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.cc-ico svg { width: 24px; height: 24px; fill: var(--muted); transition: fill .18s ease; }
.contact-card:hover .cc-ico { transform: scale(1.15) rotate(-6deg); }
.cc-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.cc-plat { font-weight: 700; font-size: .92rem; }
.cc-handle { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-go { margin-left: auto; color: var(--muted); font-size: 1rem; transition: transform .2s ease, color .18s ease; }
.contact-card:hover .cc-go { transform: translate(3px, -3px); }
.cc-gh:hover   { border-color: #d0d7de; box-shadow: 0 0 0 1px rgba(208, 215, 222, .33), 0 10px 26px -10px rgba(208, 215, 222, .45); }
.cc-gh:hover   .cc-ico svg, .cc-gh:hover   .cc-go { fill: #f0f6fc; color: #f0f6fc; }
.cc-li:hover   { border-color: #0a66c2; box-shadow: 0 0 0 1px rgba(10, 102, 194, .33), 0 10px 26px -10px rgba(10, 102, 194, .6); }
.cc-li:hover   .cc-ico svg, .cc-li:hover   .cc-go { fill: #4aa3ff; color: #4aa3ff; }
.cc-ig:hover   { border-color: #e1306c; box-shadow: 0 0 0 1px rgba(225, 48, 108, .33), 0 10px 26px -10px rgba(225, 48, 108, .6); }
.cc-ig:hover   .cc-ico svg, .cc-ig:hover   .cc-go { fill: #ff5e9c; color: #ff5e9c; }
.cc-mail:hover { border-color: var(--green); box-shadow: 0 0 0 1px rgba(74, 222, 128, .3), 0 10px 26px -10px rgba(74, 222, 128, .6); }
.cc-mail:hover .cc-ico svg, .cc-mail:hover .cc-go { fill: var(--green); color: var(--green); }
.contact-foot { margin-top: 1.15rem; font-size: .9rem; color: var(--muted); }
.contact-foot .cc-prompt { color: var(--green); }
.contact-foot .cc-typed { color: var(--fg); }
.cc-cursor { display: inline-block; width: .55ch; height: 1.05em; background: var(--green); margin-left: 2px; vertical-align: text-bottom; animation: cc-blink 1.05s steps(1) infinite; }
@keyframes cc-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cc-cursor { animation: none; } .contact-card:hover { transform: none; } }

/* --- nerdy site footer --- */
.site-footer { margin-top: 2.6rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); line-height: 1.65; }
.foot-rule { text-align: center; color: var(--muted); opacity: .5; letter-spacing: .12em; margin-bottom: .9rem; font-size: .72rem; }
.foot-line { color: var(--fg); }
.foot-line .fp { color: var(--green); margin-right: .45rem; }
.foot-out { color: var(--muted); margin: .1rem 0 .55rem 1.1rem; }
.foot-stack { display: flex; flex-wrap: wrap; gap: .35rem; }
.foot-stack span { border: 1px solid var(--line); border-radius: 5px; padding: .05rem .45rem; color: var(--cyan); background: rgba(34, 211, 238, .06); font-size: .72rem; transition: transform .15s ease, border-color .15s ease, color .15s ease, background .15s ease; }
.foot-stack span:hover { transform: translateY(-2px); border-color: var(--cyan); color: var(--fg); background: rgba(34, 211, 238, .12); }
.foot-sign { margin-top: .9rem; color: var(--muted); font-size: .78rem; }
.foot-fine { margin-top: .35rem; font-size: .72rem; opacity: .68; }
.foot-cur { display: inline-block; width: .5ch; height: 1em; background: var(--green); vertical-align: text-bottom; animation: cc-blink 1.05s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .foot-cur { animation: none; } .foot-stack span:hover { transform: none; } }

/* --- ~/factory watchdog vitals --- */
.wd-head { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin: .3rem 0 .75rem; font-size: .95rem; }
.wd-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.wd-status { font-weight: 700; letter-spacing: .02em; }
.wd-summary { color: var(--muted); font-size: .82rem; }
.wd-ok   .wd-dot { background: var(--green); animation: wd-pulse-g 2s infinite; }
.wd-ok   .wd-status { color: var(--green); }
.wd-warn .wd-dot { background: #ffc400; animation: wd-pulse-a 1.4s infinite; }
.wd-warn .wd-status { color: #ffc400; }
.wd-down .wd-dot { background: #ff5470; animation: wd-pulse-r .9s infinite; }
.wd-down .wd-status { color: #ff5470; }
@keyframes wd-pulse-g { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, .7); } 70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }
@keyframes wd-pulse-a { 0% { box-shadow: 0 0 0 0 rgba(255, 196, 0, .7); } 70% { box-shadow: 0 0 0 8px rgba(255, 196, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 196, 0, 0); } }
@keyframes wd-pulse-r { 0% { box-shadow: 0 0 0 0 rgba(255, 84, 112, .7); } 70% { box-shadow: 0 0 0 8px rgba(255, 84, 112, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 84, 112, 0); } }
.wd-checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .9rem; }
@media (max-width: 34rem) { .wd-checks { grid-template-columns: 1fr; } }
.wd-check { display: flex; align-items: baseline; gap: .5rem; font-size: .82rem; padding: .2rem 0; border-bottom: 1px dotted rgba(255, 255, 255, .05); }
.wd-mark { flex: 0 0 auto; font-weight: 700; width: 1ch; }
.wd-check.ok  .wd-mark { color: var(--green); }
.wd-check.bad .wd-mark { color: #ff5470; }
.wd-name { color: var(--fg); min-width: 3.4em; }
.wd-detail { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wd-foot { margin-top: .6rem; font-size: .72rem; color: var(--muted); opacity: .72; }
@media (prefers-reduced-motion: reduce) { .wd-dot { animation: none !important; } }

/* --- ~/factory coverage badge --- */
.cov-row { display: flex; align-items: center; gap: .7rem; margin: .35rem 0 .5rem; }
.cov-pct { font-weight: 700; font-size: 1.15rem; color: var(--green); min-width: 3.4ch; }
.cov-bar { flex: 1; height: 10px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.cov-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--cyan)); box-shadow: 0 0 8px rgba(74, 222, 128, .5); transition: width .6s cubic-bezier(.16, 1, .3, 1); }
.cov-meta { color: var(--muted); font-size: .8rem; }
@media (prefers-reduced-motion: reduce) { .cov-fill { transition: none; } }

/* --- ~/factory idea-engine backlog --- */
.idea-list { list-style: none; padding: 0; margin: .35rem 0 0; display: flex; flex-direction: column; gap: .55rem; }
.idea { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; background: var(--panel); transition: border-color .15s ease; }
.idea:hover { border-color: rgba(74, 222, 128, .35); }
.idea-head { display: flex; align-items: center; gap: .5rem; }
.idea-score { font-weight: 700; color: var(--green); background: rgba(74, 222, 128, .1); border: 1px solid rgba(74, 222, 128, .3); border-radius: 5px; padding: .02rem .4rem; font-size: .82rem; min-width: 2.6ch; text-align: center; }
.idea-title { font-weight: 600; font-size: .9rem; }
.idea-auto { margin-left: auto; font-size: .68rem; color: var(--cyan); border: 1px solid rgba(34, 211, 238, .3); border-radius: 5px; padding: .02rem .35rem; white-space: nowrap; }
.idea-big { margin-left: auto; font-size: .68rem; color: #e14dff; border: 1px solid rgba(225, 77, 255, .4); border-radius: 5px; padding: .02rem .35rem; white-space: nowrap; }
.idea-why { color: var(--muted); font-size: .8rem; margin: .28rem 0 .22rem; line-height: 1.45; }
.idea-metrics { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .68rem; color: var(--muted); }
.idea-metrics span { border: 1px solid var(--line); border-radius: 4px; padding: 0 .35rem; }

@media (prefers-reduced-motion: reduce) { .kg-edge, .kg-path-edge { animation: none; } }

/* knowledge-graph node detail panel */
.kg-detail {
  margin-top: .7rem; max-width: 40rem; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel); padding: .7rem .9rem;
}
.kg-d-head { display: flex; align-items: center; gap: .55rem; }
.kg-d-title { font-weight: 700; color: var(--fg); }
.kg-d-kind { font-size: .68rem; padding: .05rem .45rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.kg-d-close { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 1.15rem; line-height: 1; }
.kg-d-close:hover { color: var(--fg); }
.kg-d-desc { color: var(--fg); font-size: .86rem; margin: .45rem 0; }
.kg-d-links { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.kg-chip { cursor: pointer; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .45rem; color: var(--green); }
.kg-chip:hover { background: rgba(74, 222, 128, .12); }
.kg-d-open { display: inline-block; margin-top: .55rem; color: var(--cyan); cursor: pointer; text-decoration: underline; }

/* 🦀 built-in-Rust badge (Ferris) */
.rustbadge { max-width: 34rem; margin-bottom: 1.9rem; }
.rb-cmd { color: var(--green); margin-bottom: .4rem; }
.rb-ferris {
  margin: 0 0 .55rem; color: #ff7a45; text-shadow: 0 0 9px rgba(255, 122, 69, .45);
  font-size: .8rem; line-height: 1.12; white-space: pre; overflow-x: auto;
}
.rb-line { color: var(--fg); font-size: .9rem; }
.rb-sub { color: var(--muted); font-size: .76rem; margin-top: .2rem; }

/* ASCII clock */
.clock { margin-bottom: 1.9rem; }
.clock-cmd { color: var(--green); margin-bottom: .5rem; }
.clock-face {
  margin: 0; color: var(--cyan); text-shadow: var(--glow);
  font-size: clamp(.5rem, 2.4vw, .85rem); line-height: 1.05; letter-spacing: 0;
  overflow-x: auto;
}
.clock-date { color: var(--muted); font-size: .8rem; margin-top: .4rem; }

/* $ fortune */
.fortune { margin-bottom: 1.9rem; }
.fortune blockquote {
  margin: .35rem 0 0; padding-left: .8rem; border-left: 2px solid var(--cyan);
  color: var(--muted); font-style: italic;
}
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 15px; }
.eq i { width: 3px; height: 3px; background: var(--cyan); border-radius: 1px; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(1) { animation-delay: 0s; }
.eq i:nth-child(2) { animation-delay: .25s; }
.eq i:nth-child(3) { animation-delay: .45s; }
.eq i:nth-child(4) { animation-delay: .12s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 15px; } }
/* forced-colors: OS drops the --cyan fill and box glows, so freeze the HUD
   equalizer to a static, legible bar in a system color (reduced-motion already
   freezes it above). */
@media (forced-colors: active) { .eq i { animation: none; height: 8px; background: CanvasText; } }

/* $ whoami card */
.about { margin-bottom: 2rem; }
.about .cmd { color: var(--green); margin-bottom: .55rem; }
.about .card {
  display: flex; gap: 1.1rem; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 1rem; background: var(--panel);
}
.about .avatar-wrap {
  position: relative; flex: none; line-height: 0; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--cyan);
}
.about .avatar {
  width: 96px; height: 96px; display: block; object-fit: cover;
  /* redacted / matrix duotone by default */
  filter: grayscale(1) contrast(1.05) brightness(.92) sepia(.5) hue-rotate(75deg) saturate(3);
  transition: filter .3s ease, transform .3s ease;
}
/* CRT scanline overlay */
.about .avatar-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; opacity: .6; transition: opacity .3s ease;
}
.about .avatar-wrap:hover { box-shadow: var(--glow); }
.about .avatar-wrap:hover .avatar { filter: none; transform: scale(1.04); }
.about .avatar-wrap:hover::after { opacity: .15; }
.about .bio { font-size: .92rem; }
.about .bio .line { white-space: pre-wrap; }
.about .bio .key { color: var(--cyan); }
@media (max-width: 30rem) { .about .card { flex-direction: column; text-align: center; } }
ul.log { list-style: none; padding: 0; margin: 0; }
ul.log li {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: baseline; gap: .75rem;
  padding: .7rem .75rem; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: .6rem; cursor: pointer; background: var(--panel);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
ul.log li:hover { border-color: var(--cyan); transform: translateX(3px); box-shadow: var(--glow); }
.prompt { color: var(--green); }
.title { color: var(--fg); }
.tag { color: var(--cyan); font-size: .8rem; }
time { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* post opens with a glitchy reveal */
article { animation: glitch-in .45s ease both; }
@keyframes glitch-in {
  0%   { opacity: 0; clip-path: inset(0 0 100% 0); transform: translateX(-5px); filter: hue-rotate(90deg) saturate(2.2); }
  35%  { opacity: 1; clip-path: inset(0 0 25% 0); transform: translateX(4px); }
  60%  { clip-path: inset(0 0 0 0); transform: translateX(-2px); filter: none; }
  100% { transform: none; }
}
article h2 { color: var(--cyan); text-shadow: var(--glow); margin-bottom: .2rem; }
article .meta { color: var(--muted); margin-bottom: 1.2rem; }
.back { color: var(--green); cursor: pointer; text-decoration: none; font-size: .9rem; }
.back:hover { text-decoration: underline; }

a { color: var(--cyan); }
main a, .np-out a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 55%, transparent); }
main a:hover, main a:focus-visible, .np-out a:hover, .np-out a:focus-visible { text-decoration-color: currentColor; text-shadow: var(--glow); }

footer {
  margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--line);
  color: var(--muted); font-size: .82rem;
}
/* ---------- nerdy animations ---------- */

/* ambient logo glitch — brief RGB split near the end of each cycle */
.logo { animation: logo-glitch 7s infinite; }
@keyframes logo-glitch {
  0%, 93%, 100% { text-shadow: var(--glow); transform: none; }
  94% { text-shadow: 2px 0 #f0f, -2px 0 #0ff; transform: translateX(1px); }
  96% { text-shadow: -2px 0 #0ff, 2px 0 #f0f; transform: translateX(-1px) skewX(-2deg); }
  98% { text-shadow: 1px 0 #f0f, -1px 0 #0ff; transform: translateX(1px); }
}

/* boot line types itself in (clip wipe — wrap-safe, no overflow) */
.boot { animation: type-reveal 1.5s steps(28, end) .2s both; }
@keyframes type-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* content boots in, staggered */
.about { animation: bootin .5s ease .15s both; }
ul.log li { animation: bootin .5s ease both; }
ul.log li:nth-child(1) { animation-delay: .30s; }
ul.log li:nth-child(2) { animation-delay: .42s; }
ul.log li:nth-child(3) { animation-delay: .54s; }
ul.log li:nth-child(4) { animation-delay: .66s; }
@keyframes bootin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .cursor, .logo, .logo-name, .boot, .about, ul.log li, article { animation: none !important; clip-path: none !important; }
  #matrix { display: none !important; }
  .eq i { animation: none !important; height: 8px !important; }
}

/* ---------- print: clean man-page hardcopy ---------- */
@media print {
  body { background: #fff !important; color: #000 !important; max-width: none; }
  body::before { display: none !important; }
  #matrix, #sky, #crtfx, #boot { display: none !important; }
  .logo { text-shadow: none !important; animation: none !important; }
  .np-out a, a { color: #000 !important; text-decoration: underline !important; }
}
