/* =========================================================================
   PIP-OS — stylesheet for chiahsinlee.github.io
   Read top to bottom: fonts → tokens & palettes → base → layout → page
   components (roughly in page order) → responsive → reduced motion.
   Every color comes from the tokens on :root; the palette switcher in the
   footer swaps them by setting [data-theme] on <html> (see pipos.js).
   ========================================================================= */

/* ---- fonts ------------------------------------------------------------- */
/* Self-hosted, SIL OFL (licenses in assets/fonts/). */
@font-face {
  font-family: "VT323";
  src: url("/assets/fonts/vt323.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Share Tech Mono";
  src: url("/assets/fonts/share-tech-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
/* CJK pixel font (Fusion Pixel) so Chinese renders as "terminal", not
   system sans. CJK-only range so English-only visitors never download it
   (excludes ·, '', … which appear on EN pages and would trigger the fetch). */
@font-face {
  font-family: "PixelZH";
  src: url("/assets/fonts/pixel-zh.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+3000-303F, U+4E00-9FFF, U+FF00-FFEF;
}
/* The same font cut down to the one glyph (中) of the EN | 中 switch, so
   English pages draw it without fetching the full 640 KB CJK file. */
@font-face {
  font-family: "PixelZHSwitch";
  src: url("/assets/fonts/pixel-zh-switch.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+4E2D;
}

/* ---- tokens ------------------------------------------------------------ */
:root {
  /* spacing */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.25rem;  --s-6: 1.5rem;   --s-7: 1.75rem;  --s-8: 2rem;
  --s-9: 2.25rem;  --s-10: 3rem;    --s-11: 4rem;

  /* type scale — VT323 runs small (x-height 0.40em, cap height 0.56em, vs
     ~0.52/0.72 for a typical sans), so these sit a step above the usual
     web sizes. rem-based, so they shrink with the mobile root size. */
  --fs-2xs: 0.75rem;   /* decorative chrome: hex ids, F-key badges, radar */
  --fs-xs:  0.85rem;   /* labels, tags, meta, crumbs, nav, footer */
  --fs-sm:  1.1rem;    /* secondary text: card + list blurbs, log entries */
  --fs-md:  1.2rem;    /* body text */
  /* body line-height: VT323's short x-height reads airy, so it sits tighter
     than usual; full-height CJK glyphs need more (see :lang(zh) below) */
  --lh-body: 1.45;

  /* CRT scanline strength */
  --scanline-opacity: 0.28;

  /* phosphor — GREEN (default). Contrast on --screen-color: text ~14:1,
     muted ~6:1 (readable labels), dim ~3.4:1 (decorative chrome only). */
  --bg-color:        #0b0f08;
  --screen-color:    #0a1106;
  --panel-bg:        rgba(0, 21, 8, 0.5);
  --text-color:      #3dff7a;
  --text-bright:     #a8ffb8;
  --text-muted:      #25a646;
  --text-dim:        #147828;
  --warn-color:      #ffd34a;
  --border-color:    #196b29;
  --border-bright:   #3dff7a;
  --rule-color:      #0d4d1a;
  --glow:            0 0 6px #3dff7a, 0 0 14px #1f8a3a;
  --glow-subtle:     0 0 4px #1f8a3a;
  /* fonts: VT323 for text (PixelZH covers Chinese), Share Tech Mono for
     small mono UI (code, boot log, command palette, buttons) */
  --heading-font:    "VT323", "PixelZH", "Courier New", monospace;
  --body-font:       "VT323", "Share Tech Mono", "PixelZH", monospace;
  --mono-font:       "Share Tech Mono", "Courier New", "Lucida Console", monospace;
  --max-width:       1040px;
  --spacing:         var(--s-7);
  --phosphor-rgb:    61, 255, 122;
}
:root:lang(zh) { --lh-body: 1.7; }
:root[data-theme="amber"] {
  --bg-color:#100a02; --screen-color:#0e0701;
  --panel-bg:rgba(40,18,0,0.5);
  --text-color:#ffb84a; --text-bright:#ffe8b0;
  --text-muted:#bc8120; --text-dim:#93560a;
  --warn-color:#ff6b3d;
  --border-color:#7a4f0d; --border-bright:#ffb84a;
  --rule-color:#4d2d05;
  --glow:0 0 6px #ffb84a, 0 0 14px #9a6a1a;
  --glow-subtle:0 0 4px #9a6a1a;
  --phosphor-rgb:    255, 184, 74;
}
:root[data-theme="white"] {
  --bg-color:#06080d; --screen-color:#04060a;
  --panel-bg:rgba(20,28,46,0.5);
  --text-color:#d8e8ff; --text-bright:#ffffff;
  --text-muted:#7a8da6; --text-dim:#4f6587;
  --warn-color:#ffd34a;
  --border-color:#3a4a63; --border-bright:#d8e8ff;
  --rule-color:#2a3850;
  --glow:0 0 6px #d8e8ff, 0 0 14px #7a8da6;
  --glow-subtle:0 0 4px #7a8da6;
  --phosphor-rgb:    216, 232, 255;
}
:root[data-theme="blue"] {
  --bg-color:#02060d; --screen-color:#020812;
  --panel-bg:rgba(8,32,60,0.5);
  --text-color:#5ab9ff; --text-bright:#bfe2ff;
  --text-muted:#4f93c4; --text-dim:#2b689e;
  --warn-color:#ff9a3d;
  --border-color:#1f4566; --border-bright:#5ab9ff;
  --rule-color:#143049;
  --glow:0 0 6px #5ab9ff, 0 0 14px #326b94;
  --glow-subtle:0 0 4px #326b94;
  --phosphor-rgb:    90, 185, 255;
}
/* RAD-ALERT — hidden red palette toggled by the Konami code (pipos.js).
   Never saved, so it reverts on reload or on any palette click. */
:root[data-theme="rad"] {
  --bg-color:#0d0202; --screen-color:#0a0101;
  --panel-bg:rgba(45,4,4,0.5);
  --text-color:#ff3b3b; --text-bright:#ff9a9a;
  --text-muted:#e75d5d; --text-dim:#c51414;
  --warn-color:#ffd34a;
  --border-color:#7a1414; --border-bright:#ff3b3b;
  --rule-color:#4d0808;
  --glow:0 0 6px #ff3b3b, 0 0 14px #a01818;
  --glow-subtle:0 0 4px #a01818;
  --phosphor-rgb:    255, 59, 59;
}

/* ---- reset / base ------------------------------------------------------ */
* { box-sizing: border-box; }
html { background-color: var(--bg-color); scroll-behavior: smooth; font-size: 112.5%; }
body {
  margin: 0;
  background-color: var(--screen-color);
  color: var(--text-color);
  font-family: var(--body-font);
  font-weight: 500;
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  /* antialiased: pixel fonts look paper-thin on dark backgrounds otherwise */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  position: relative;
  min-height: 100vh;
  /* sticky-footer scaffold so short pages (Contact, Now) keep the footer at the
     bottom of the viewport instead of floating mid-screen */
  display: flex;
  flex-direction: column;
}
main.page-content { flex: 1 0 auto; }
.site-footer { flex-shrink: 0; }

/* CRT scanlines */
body::before {
  content: ''; pointer-events: none;
  position: fixed; inset: 0; z-index: 9999;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,var(--scanline-opacity)) 2px 3px);
  mix-blend-mode: multiply;
}
/* Vignette + faint phosphor glow */
body::after {
  content: ''; pointer-events: none;
  position: fixed; inset: 0; z-index: 9998;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(var(--phosphor-rgb), 0.05), transparent 70%),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.7) 100%);
}

a {
  color: var(--text-color); text-decoration: none;
  border-bottom: 1px solid var(--border-color);
  transition: color 0.1s, border-color 0.1s, text-shadow 0.1s, background-color 0.1s;
}
a:hover {
  color: var(--text-bright); border-color: var(--text-bright);
  text-shadow: var(--glow); background: rgba(var(--phosphor-rgb), 0.07);
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--heading-font); font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--text-bright); text-shadow: var(--glow);
  margin-top: var(--s-8); margin-bottom: var(--s-3); line-height: 1.15;
  animation: flicker 10s infinite;
}
p { margin-bottom: var(--s-5); text-wrap: pretty; }
strong { color: var(--text-bright); text-shadow: var(--glow-subtle); }
em {
  color: var(--text-bright); font-style: normal;
  text-decoration: underline; text-decoration-color: var(--border-color);
}
hr { border: none; border-top: 1px solid var(--border-color); margin: var(--s-8) 0; }
code {
  font-family: var(--mono-font); background: rgba(0,0,0,0.35);
  border: 1px solid var(--rule-color);
  padding: 1px 6px; font-size: 0.9em;
  color: var(--text-bright);
}

@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
@keyframes flicker {
  0%,2%,4%,49%,54%,76%,79%,94%,97%,100%{opacity:1}
  3%{opacity:.82} 53%{opacity:.7} 77%{opacity:.55} 78%{opacity:1} 95%{opacity:.8} 96%{opacity:1}
}
@keyframes sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
/* ---- layout ------------------------------------------------------------ */
.wrapper { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--spacing); }
main.page-content { padding-bottom: var(--s-11); }

/* ============================================================
   SYSTEM BAR — sticky top bar: title, status, F-key nav,
   command button, language switch, clock
   ============================================================ */
.system-bar {
  position: sticky; top: 0; z-index: 9500;
  background: rgba(0,0,0,0.94);
  border-bottom: 1px solid var(--border-color);
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  color: var(--text-muted);
  user-select: none;
}
.system-bar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 1px; background: var(--text-color); box-shadow: var(--glow);
}
.sb-inner {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: var(--s-4);
  align-items: center;
  padding: 10px var(--s-6);
  max-width: 1320px;
  margin: 0 auto;
}
.sb-title {
  font-family: var(--heading-font);
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-bright);
  text-shadow: var(--glow);
  border: none;
  white-space: nowrap;
  padding: 2px 0;
  position: relative;
  cursor: pointer;
}
.sb-title::after {
  content: '_'; margin-left: 2px;
  animation: blink 1.1s step-start infinite;
}
.sb-title:hover {
  color: #ffffff;
  text-shadow: 0 0 8px var(--text-color), 0 0 22px var(--text-color);
}
.sb-status {
  display: flex; align-items: center; gap: var(--s-3);
  white-space: nowrap;
  padding-left: var(--s-4);
  border-left: 1px solid var(--border-color);
}
.sb-dot {
  width: 7px; height: 7px;
  background: var(--text-bright); box-shadow: var(--glow);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}
.sb-status-label { color: var(--text-bright); text-shadow: var(--glow-subtle); }
.sb-sep {
  color: var(--text-dim);
  opacity: 0.6;
}

.sb-keys {
  display: flex; align-items: center; justify-content: center;
  gap: 2px; flex-wrap: nowrap; overflow: hidden;
}
.sb-key {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border: 1px solid transparent;
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  font-family: inherit;
  text-transform: uppercase;
  transition: color 0.12s, border-color 0.12s, background-color 0.12s, text-shadow 0.12s;
  white-space: nowrap;
}
.sb-key .sb-key-label {
  color: var(--text-dim);
  font-size: var(--fs-2xs);
  letter-spacing: 0.12em;
}
.sb-key:hover, .sb-key.active {
  color: var(--text-bright);
  border-color: var(--border-color);
  background: rgba(var(--phosphor-rgb), 0.06);
  text-shadow: var(--glow-subtle);
}
.sb-key:hover .sb-key-label, .sb-key.active .sb-key-label {
  color: var(--text-color);
}
.sb-key.active {
  border-color: var(--text-bright);
  box-shadow: inset 0 -2px 0 var(--text-bright);
}

.sb-right {
  display: flex; align-items: center; gap: var(--s-4);
  white-space: nowrap;
}
.sb-cmd {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--text-color);
  color: var(--text-bright);
  background: rgba(var(--phosphor-rgb), 0.08);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  font-family: inherit;
  cursor: pointer;
  text-shadow: var(--glow-subtle);
  box-shadow: 0 0 0 1px transparent, inset 0 0 12px rgba(var(--phosphor-rgb), 0.12);
  transition: box-shadow 0.18s, background-color 0.18s;
  text-transform: uppercase;
}
.sb-cmd:hover {
  background: rgba(var(--phosphor-rgb), 0.16);
  box-shadow: 0 0 12px rgba(var(--phosphor-rgb), 0.35), inset 0 0 12px rgba(var(--phosphor-rgb), 0.18);
}
.sb-cmd kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--text-color);
  background: rgba(0,0,0,0.5);
  font: inherit; font-size: var(--fs-2xs);
  color: var(--text-bright);
  letter-spacing: 0;
}
.sb-uptime {
  color: var(--text-bright);
  font-variant-numeric: tabular-nums;
  text-shadow: var(--glow-subtle);
  letter-spacing: 0.1em;
}

/* "hint" pulse on first visit — draws eye to the cmd button */
.sb-cmd.sb-hint {
  animation: cmdHint 1.4s ease-out 3;
}
@keyframes cmdHint {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--phosphor-rgb), 0); inset 0 0 12px rgba(var(--phosphor-rgb), 0.12);}
  40%      { box-shadow: 0 0 24px 4px rgba(var(--phosphor-rgb), 0.5), inset 0 0 12px rgba(var(--phosphor-rgb), 0.25);}
}

/* language switch (EN | 中) — mirrors the .palette-btn affordances */
.lang-switch { display: inline-flex; gap: .25rem; align-items: center; }
.lang-btn {
  font: inherit; line-height: 1; padding: .2rem .45rem; min-width: 2.2ch;
  text-align: center; text-decoration: none;
  border: 1px solid var(--border-color); border-radius: 2px;
  color: var(--text-color); background: transparent;
}
.lang-btn:hover, .lang-btn:focus-visible { color: var(--text-bright); border-color: var(--text-bright); }
.lang-btn.active {
  background: var(--text-bright); border-color: var(--text-bright);
  color: var(--screen-color); text-shadow: none;
}
/* On English pages, draw "中" from the one-glyph subset (see fonts) instead
   of PixelZH, which would download the 640 KB CJK font for this glyph. */
html:not(:lang(zh)) .lang-btn[data-lang="zh"] { font-family: "PixelZHSwitch", var(--mono-font); }

/* ============================================================
   PAGE HEADER + INTRO
   ============================================================ */
.page-header {
  margin: var(--s-7) 0 var(--s-4);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--s-3);
  display: flex; align-items: baseline; gap: var(--s-3);
}
.page-header::before {
  content: '\25AC';
  color: var(--text-bright); font-family: var(--heading-font);
  font-size: 1.8rem; text-shadow: var(--glow); line-height: 1;
}
.page-title {
  font-family: var(--body-font);
  font-size: 2.6rem;
  margin: 0; letter-spacing: 0.04em; text-shadow: var(--glow);
}
.page-header .page-crumb {
  margin-left: auto;
  font-size: var(--fs-xs); color: var(--text-muted);
  letter-spacing: 0.14em; text-transform: uppercase;
  align-self: end; padding-bottom: 4px;
  white-space: nowrap;
}
.section-intro {
  color: var(--text-color);
  opacity: 0.9; margin: 0 0 var(--s-6) 0;
  max-width: 68ch;
  border-left: 2px solid var(--border-color);
  padding-left: var(--s-4);
}

/* ============================================================
   HOME — Hero
   ============================================================ */
.hero {
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  padding: var(--s-7) var(--s-8) var(--s-8);
  margin: var(--s-6) 0; position: relative;
  overflow: hidden;
}
.hero::before {
  content: '[USR_PROFILE / 0x00A1]   AUTH OK   ACCESS LVL 3';
  display: block; color: var(--text-muted);
  font-size: var(--fs-2xs); letter-spacing: 0.16em;
  margin-bottom: var(--s-4);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.hero::after {
  content: ''; position: absolute;
  bottom: -2px; right: -2px;
  width: 18px; height: 18px;
  border-bottom: 2px solid var(--text-bright);
  border-right: 2px solid var(--text-bright);
  box-shadow: var(--glow-subtle);
}

/* Decorative sweep line across hero top */
.hero-sweep {
  position: absolute; top: 28px; left: 0; right: 0;
  height: 1px; overflow: hidden;
  pointer-events: none;
  opacity: 0.6;
}
.hero-sweep::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 25%; height: 100%;
  background: linear-gradient(90deg, transparent, var(--text-bright), transparent);
  filter: blur(0.5px);
  animation: sweep 8s linear infinite;
}

.hero-title {
  font-family: var(--body-font);
  font-size: 3.8rem; letter-spacing: 0.04em;
  margin: 0 0 var(--s-1); line-height: 1;
  color: var(--text-bright);
  text-shadow: 0 0 10px var(--text-color), 0 0 22px var(--text-muted);
  animation: flicker 9s infinite;
  min-height: 1em;
}
.hero-title::before {
  content: '>> ';
  color: var(--text-muted); font-size: 2rem;
  vertical-align: middle; text-shadow: none;
}
.hero-title.is-typing .typed-caret,
.hero-subtitle.is-typing .typed-caret {
  display: inline-block; width: 0.55em; height: 0.95em;
  background: var(--text-bright); box-shadow: var(--glow);
  vertical-align: -0.08em; margin-left: 3px;
  animation: blink 0.9s step-start infinite;
}
.hero-subtitle {
  font-size: var(--fs-xs); color: var(--text-muted);
  letter-spacing: 0.14em; margin: 0;
  padding-left: var(--s-10); text-transform: uppercase;
  min-height: 1em;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--s-8); align-items: start;
  margin-top: var(--s-7);
}
.hero-grid .hero-about {
  margin: 0; color: var(--text-color);
  line-height: var(--lh-body);
  max-width: 62ch;
}
.hero-tags {
  margin-top: var(--s-4);
  display: flex; flex-wrap: wrap; gap: var(--s-2);
}
.hero-tag {
  font-size: var(--fs-xs); letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* ============================================================
   VITALS — per-row diegetic readouts
   Each row has its own widget type so they read as data, not decoration:
     INST     → campus building glyph
     FIELD    → 3 sub-discipline bars, lit = primary field
     YEAR     → stage dots (PhD years 1-5)
     LOC      → mini compass with rotating N pointer
     NPC      → looping marquee of seats per party
     ELECTION → segmented bar + T-minus countdown
     TIME     → heartbeat pulse + live clock
   The card is visually demoted (subtler border, dimmer values) so the
   typewriter hero remains the page's centre of gravity.
   ============================================================ */
.hero-vitals {
  border: 1px dashed rgba(var(--phosphor-rgb), 0.28);
  padding: 10px 12px 12px;
  color: var(--text-color);
  background: rgba(0,0,0,0.18);
  position: relative;
  font-size: var(--fs-xs);
}

/* ASCII chrome header: [ VITALS ]──────[ 06 ] */
.vitals-chrome {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: var(--fs-2xs);
  letter-spacing: 0.16em;
}
.vitals-chrome .vc-tag { color: var(--warn-color); text-shadow: 0 0 4px rgba(255,211,74,0.3); }
.vitals-chrome .vc-num { color: var(--text-muted); }
.vitals-chrome .vc-rule {
  height: 1px;
  background-image: linear-gradient(to right,
    rgba(var(--phosphor-rgb), 0.45) 0 4px,
    transparent 4px 8px);
  background-size: 8px 1px;
  background-repeat: repeat-x;
}

.vitals-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 14px;
  align-items: center;
}
.vitals-list dt {
  color: var(--text-muted); letter-spacing: 0.12em;
  font-weight: 500;
}
/* Each dd is itself a 2-col grid: widget (col 1) + value (col 2).
   Same widget width across rows so the right edge of the bar stack lines up. */
.vitals-list dd {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 5.5rem;
  align-items: center;
  gap: 10px;
  min-height: 1.2em;
}
.vitals-value {
  color: var(--text-color); text-align: right;
  letter-spacing: 0.05em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.vitals-value.warn { color: var(--warn-color); text-shadow: 0 0 3px rgba(255,211,74,0.35); }
.vitals-uptime {
  color: var(--text-bright); text-shadow: var(--glow-subtle);
}

/* Shared widget cell — full width of col 1, fixed height for vertical rhythm */
.vw {
  display: flex; align-items: center; gap: 4px;
  width: 100%; height: 12px;
  color: var(--text-color);
}

/* INST — three-bar building silhouette (chunky pixel skyline) */
.vw-campus { gap: 2px; align-items: flex-end; }
.vw-campus i {
  display: block; width: 5px;
  background: var(--text-color);
  box-shadow: 0 0 3px var(--text-color);
}
.vw-campus i:nth-child(1) { height: 6px; }
.vw-campus i:nth-child(2) { height: 12px; }
.vw-campus i:nth-child(3) { height: 9px; background: var(--text-bright); box-shadow: 0 0 5px var(--text-bright); animation: blink 2.6s step-start infinite; }
.vw-campus i:nth-child(4) { height: 10px; }

/* FIELD — three vertical bars (sub-discipline depth), lit = primary field.
   Each <i> carries a --h custom prop so bar heights vary; the <b> inside
   is the 3-letter label that sits below the bar like an EQ readout. */
.vw-field {
  gap: 3px;
  align-items: flex-end;
  height: 14px;
}
.vw-field i {
  position: relative;
  display: block;
  width: 7px;
  height: var(--h, 60%);
  background: rgba(var(--phosphor-rgb), 0.22);
  color: transparent; /* hide label visually, keep it for screen readers */
}
.vw-field i b { display: none; }
.vw-field i.on {
  background: var(--text-bright);
  box-shadow: 0 0 4px var(--text-color);
}

/* YEAR — 5 progress dots */
.vw-stage { gap: 5px; }
.vw-stage i {
  width: 7px; height: 7px;
  border: 1px solid rgba(var(--phosphor-rgb), 0.35);
  border-radius: 50%;
  background: transparent;
}
.vw-stage i.on {
  background: var(--text-bright);
  border-color: var(--text-bright);
  box-shadow: 0 0 5px var(--text-color);
}
.vw-stage i.on + i:not(.on) {
  /* leading edge — the "current" half-filled tick */
  background: rgba(var(--phosphor-rgb), 0.35);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* LOC — mini compass: ring + rotating N-needle */
.vw-compass {
  position: relative; width: 16px; height: 16px;
  align-items: center; justify-content: center;
  margin-left: 2px;
}
.vw-compass .vc-ring {
  position: absolute; inset: 0;
  border: 1px solid rgba(var(--phosphor-rgb), 0.45);
  border-radius: 50%;
}
.vw-compass .vc-ring::before, .vw-compass .vc-ring::after {
  content: ''; position: absolute; background: rgba(var(--phosphor-rgb), 0.45);
}
.vw-compass .vc-ring::before { left: 50%; top: -1px; width: 1px; height: 3px; transform: translateX(-50%); }
.vw-compass .vc-ring::after  { left: -1px; top: 50%; width: 3px; height: 1px; transform: translateY(-50%); }
.vw-compass .vc-needle {
  position: absolute; left: 50%; top: 50%;
  width: 1px; height: 8px;
  background: linear-gradient(to bottom, var(--text-bright) 0 50%, var(--warn-color) 50% 100%);
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(0deg);
  box-shadow: 0 0 3px var(--text-color);
  animation: compassSpin 18s cubic-bezier(.4,.2,.6,1) infinite;
}
.vw-compass .vc-n {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-size: 8px; color: var(--warn-color); letter-spacing: 0;
}
@keyframes compassSpin {
  0%   { transform: translate(-50%, -100%) rotate(-8deg); }
  25%  { transform: translate(-50%, -100%) rotate(12deg); }
  50%  { transform: translate(-50%, -100%) rotate(-4deg); }
  75%  { transform: translate(-50%, -100%) rotate(8deg); }
  100% { transform: translate(-50%, -100%) rotate(-8deg); }
}

/* Marquee — fixed-width window with a CSS keyframe slide */
.vw-marquee {
  overflow: hidden; gap: 6px;
  height: 1.2em;
  color: var(--text-color);
  letter-spacing: 0.02em;
  -webkit-mask: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 18px), transparent 100%);
          mask: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 18px), transparent 100%);
}
.vw-marquee .vm-icon {
  color: var(--text-bright); text-shadow: var(--glow-subtle);
  font-size: 0.6rem;
  animation: blink 2.2s step-start infinite;
  flex-shrink: 0;
}
.vw-marquee .vm-track {
  display: inline-flex; gap: 28px;
  white-space: nowrap;
  animation: vmScroll 36s linear infinite;
  padding-left: 100%;
}
.vw-marquee .vm-item em { font-style: normal; color: var(--text-bright); text-shadow: var(--glow-subtle); }
@keyframes vmScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* NPC — seat distribution as marquee items, each with a leading swatch in
   the party's bloc color. */
.vw-marquee-seats .vm-item {
  display: inline-flex; align-items: center; gap: 6px;
}
.vw-marquee-seats .vm-sw {
  display: inline-block;
  width: 8px; height: 8px;
  flex-shrink: 0;
  box-shadow: 0 0 3px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.12);
}

/* Vitals separator — dashed phosphor rule splitting profile vitals
   (INST/FIELD/YEAR/LOC) from research watch (NPC/ELECTION/UPTIME). */
.vitals-sep {
  grid-column: 1 / -1;
  height: 0;
  margin: 4px 0 2px;
  border-top: 1px dashed rgba(var(--phosphor-rgb), 0.28);
  opacity: 0.85;
}

/* ELECTION — segmented progress bar (16 ticks, built by pipos.js) */
.vw-countdown { width: 100%; }
.vw-countdown .vcd-bar {
  display: flex; gap: 2px; width: 100%; height: 8px;
}
.vw-countdown .vcd-fill {
  display: flex; gap: 2px; width: 100%; height: 100%;
}
.vw-countdown .vcd-fill i {
  flex: 1; height: 100%;
  background: rgba(var(--phosphor-rgb), 0.18);
  border: 1px solid transparent;
}
.vw-countdown .vcd-fill i.on {
  background: var(--warn-color);
  box-shadow: 0 0 3px rgba(255,211,74,0.5);
}
.vw-countdown .vcd-fill i.on:last-child {
  /* leading edge ticks */
  animation: blink 1.4s step-start infinite;
}

/* TIME — pulse dot + live clock */
.vw-pulse { justify-content: center; }
.vw-pulse .vp-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-bright);
  box-shadow: 0 0 6px var(--text-color);
  animation: pulse-dot 1.1s ease-in-out infinite;
}
/* ============================================================
   STATS — S.P.E.C.I.A.L. cards
   ============================================================ */
.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-color);
  margin: var(--s-6) 0; background: rgba(0,0,0,0.18);
}
.stat {
  padding: 16px 18px;
  border-right: 1px solid var(--border-color);
  position: relative;
}
.stat:last-child { border-right: none; }
.stat::before {
  content: ''; position: absolute;
  top: 8px; right: 8px; width: 6px; height: 6px;
  background: var(--text-color); box-shadow: var(--glow);
  animation: blink 2.4s step-start infinite;
}
.stat-lbl {
  font-size: var(--fs-xs); letter-spacing: 0.14em;
  color: var(--text-muted); text-transform: uppercase;
}
.stat-num {
  font-family: var(--heading-font); font-size: 2.8rem;
  color: var(--text-bright); text-shadow: var(--glow);
  line-height: 1; margin-top: 6px; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-size: var(--fs-xs); color: var(--text-muted); margin-top: 6px;
  letter-spacing: 0.12em;
}

/* ============================================================
   PERIPHERAL — small boxed panel at the foot of the home page; links
   flagged `periph: true` in _data/social.yml show under the text
   ============================================================ */
.periph {
  border: 1px solid var(--border-color);
  background: rgba(0,0,0,0.25);
  margin: var(--s-7) 0;
  padding: var(--s-5) var(--s-6) var(--s-5);
  position: relative;
}
.periph::after {
  content: ''; position: absolute;
  bottom: -2px; right: -2px;
  width: 14px; height: 14px;
  border-bottom: 2px solid var(--text-bright);
  border-right: 2px solid var(--text-bright);
  box-shadow: var(--glow-subtle);
}
.periph-hdr {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: var(--s-3);
  font-size: var(--fs-xs); letter-spacing: 0.14em; color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px dashed var(--rule-color);
  padding-bottom: var(--s-2);
}
.periph-hdr h2 {
  font-family: var(--heading-font); font-size: 1.3rem;
  margin: 0; color: var(--text-bright); letter-spacing: 0.06em;
  text-shadow: var(--glow-subtle); animation: none;
}
.periph p {
  margin: 0; color: var(--text-color);
  line-height: var(--lh-body);
  max-width: 64ch;
}
.periph-links {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  margin-top: var(--s-4);
}

/* ============================================================
   ITEM LIST — hex data rows
   Row 1: hex index · [year] · status tag (right). Title and blurb sit
   below, indented past the index, so they get the full column width.
   ============================================================ */
.item-list {
  list-style: none; padding: 0; margin: var(--s-6) 0;
  border-top: 1px solid var(--rule-color);
  counter-reset: itemrow;
}
.item-list li {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: var(--s-2) var(--s-4); padding: var(--s-5) 0 var(--s-5) 8px;
  border-bottom: 1px dashed var(--rule-color);
  align-items: baseline;
  counter-increment: itemrow; position: relative;
  transition: background-color 0.15s, padding-left 0.15s;
}
.item-list li::before {
  content: '0xA' counter(itemrow);
  color: var(--text-dim); font-size: var(--fs-2xs); letter-spacing: 0.12em;
  grid-column: 1; grid-row: 1;
  transition: color 0.15s, text-shadow 0.15s;
}
.item-list li::after {
  /* hover caret — sits in the reserved gutter; doesn't push content */
  content: '\25B6';
  position: absolute;
  left: -6px; top: calc(var(--s-5) + 0.15rem);
  color: var(--warn-color); font-size: var(--fs-2xs);
  text-shadow: 0 0 4px rgba(255,211,74,0.5);
  opacity: 0; transform: translateX(-6px);
  transition: opacity 0.18s, transform 0.18s;
  pointer-events: none;
}
.item-list li::marker { content: ''; }
/* a thin lit rail appears on hover; no layout shift, no reflow */
.item-list li > .item-rail {
  position: absolute; left: 0; top: 12%; bottom: 12%;
  width: 2px; background: var(--warn-color);
  box-shadow: 0 0 6px rgba(255,211,74,0.55);
  opacity: 0; transform: scaleY(0.2);
  transform-origin: center;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
}
.item-list li:hover {
  background: rgba(var(--phosphor-rgb),0.05);
}
.item-list li:hover::before {
  color: var(--warn-color);
  text-shadow: 0 0 4px rgba(255,211,74,0.4);
}
.item-list li:hover::after {
  opacity: 1; transform: translateX(2px);
}
.item-list li:hover > .item-rail {
  opacity: 1; transform: scaleY(1);
}
.item-meta {
  grid-column: 2; grid-row: 1;
  font-size: var(--fs-xs); color: var(--warn-color);
  text-transform: uppercase; letter-spacing: 0.14em;
  margin: 0; white-space: nowrap;
}
.item-meta::before { content: '['; }
.item-meta::after  { content: ']'; }
.item-title {
  grid-column: 2 / -1;
  font-family: var(--body-font); font-size: 1.6rem;
  margin: 0; letter-spacing: 0.02em;
  text-shadow: var(--glow-subtle); font-weight: 400;
  line-height: 1.2; animation: none;
}
.item-title a {
  color: var(--text-bright); border-bottom: none;
  text-shadow: var(--glow-subtle);
}
.item-title a:hover {
  color: #ffffff; background: transparent; text-shadow: var(--glow);
}
.item-title::before {
  content: '> '; color: var(--text-muted); text-shadow: none;
}
.item-list li > p {
  grid-column: 2 / -1; margin: 0;
  color: var(--text-color); opacity: 0.92; font-size: var(--fs-sm);
  max-width: 70ch;
}
.item-tag {
  grid-column: 3; grid-row: 1; align-self: center;
  font-size: var(--fs-xs); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  white-space: nowrap;
}
.item-tag.live { color: var(--warn-color); border-color: var(--warn-color); }
.item-tag.live::before {
  content: ''; display: inline-block;
  width: 5px; height: 5px; margin-right: 5px;
  background: var(--warn-color); box-shadow: 0 0 4px var(--warn-color);
  border-radius: 50%; vertical-align: middle;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

/* ============================================================
   FEATURED (home, two-up cards)
   ============================================================ */
.featured-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s-4); margin: var(--s-6) 0;
}
.featured-card {
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  padding: var(--s-5) var(--s-5) var(--s-6);
  position: relative;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.featured-card::after {
  content: ''; position: absolute;
  top: -1px; left: -1px; bottom: -1px;
  width: 2px; background: var(--text-bright);
  box-shadow: var(--glow);
  opacity: 0; transition: opacity 0.15s;
}
.featured-card:hover { background: rgba(var(--phosphor-rgb), 0.05); }
.featured-card:hover::after { opacity: 1; }
.featured-meta {
  font-size: var(--fs-xs); letter-spacing: 0.14em;
  color: var(--warn-color); text-transform: uppercase;
  margin-bottom: var(--s-2);
}
.featured-meta::before { content: '\25C6 '; }
.featured-title {
  font-family: var(--heading-font); font-size: 1.6rem;
  margin: 0 0 var(--s-2); line-height: 1.15;
  color: var(--text-bright); text-shadow: var(--glow-subtle);
  animation: none;
}
.featured-title a { border: none; color: inherit; }
/* the title link stretches over the whole card, so the card is one click
   target (the blurbs are plain text, so nothing else in it needs a click).
   z-index lifts it above .featured-body, whose opacity gives it its own
   paint layer. */
.featured-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.featured-title a:hover { background: transparent; }
.featured-body {
  margin: 0; color: var(--text-color); opacity: 0.9; font-size: var(--fs-sm);
}

/* ============================================================
   PROJECTS — card grid
   ============================================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: var(--s-4);
  margin: var(--s-6) 0;
}
.project-card {
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  padding: var(--s-5) var(--s-5) var(--s-6);
  display: flex; flex-direction: column;
  gap: var(--s-3);
  position: relative;
  transition: background-color 0.15s, border-color 0.15s;
}
.project-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; height: 2px; width: 24px;
  background: var(--text-bright); box-shadow: var(--glow-subtle);
}
.project-card:hover {
  background: rgba(var(--phosphor-rgb), 0.05);
}
/* header row: PROJ · 00N on the left, status tag on the right (wraps under
   it when the card is narrow) */
.project-card .project-head {
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: var(--s-2) var(--s-3);
}
.project-card .project-id {
  font-size: var(--fs-2xs); letter-spacing: 0.14em;
  color: var(--text-dim); text-transform: uppercase;
}
.project-card .project-status {
  font-size: var(--fs-xs); letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.project-card .project-status.live {
  color: var(--warn-color); border-color: var(--warn-color);
}
.project-card .project-status.live::before {
  content: ''; display: inline-block;
  width: 5px; height: 5px; margin-right: 4px;
  background: var(--warn-color); box-shadow: 0 0 4px var(--warn-color);
  border-radius: 50%; vertical-align: middle;
  animation: pulse-dot 1.6s ease-in-out infinite;
}
.project-card .project-status.queued {
  color: var(--text-muted); border-style: dashed;
}
.project-card h3 {
  font-family: var(--heading-font);
  font-size: 1.5rem; margin: 0; line-height: 1.2;
  color: var(--text-bright); text-shadow: var(--glow-subtle);
  animation: none; letter-spacing: 0.02em;
}
.project-card h3::before { content: '> '; color: var(--text-muted); }
.project-card p { margin: 0; color: var(--text-color); font-size: var(--fs-sm); opacity: 0.92; }
.project-card .project-stack {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto;
  padding-top: var(--s-3);
  border-top: 1px dashed var(--rule-color);
}
.project-card .project-stack span {
  font-size: var(--fs-2xs); letter-spacing: 0.14em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 2px 6px; border: 1px solid var(--rule-color);
}

/* ============================================================
   RESEARCH PAPER PAGE
   ============================================================ */
.research-paper .paper-meta {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border-color);
  background: rgba(0,0,0,0.22);
  margin: var(--s-4) 0 var(--s-6);
}
.research-paper .paper-meta > div {
  padding: 12px 16px;
  border-right: 1px solid var(--border-color);
}
.research-paper .paper-meta > div:last-child { border-right: none; }
.research-paper .paper-meta dt {
  font-size: var(--fs-xs); letter-spacing: 0.14em;
  color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px;
}
.research-paper .paper-meta dd {
  margin: 0; color: var(--text-bright);
  font-family: var(--heading-font); font-size: 1.15rem;
  letter-spacing: 0.04em;
}
.research-abstract {
  border-left: 2px solid var(--border-color);
  padding: 0 var(--s-5);
  margin: var(--s-6) 0;
}
/* keep paper prose to a readable measure (~75 characters a line) */
.research-abstract p,
.research-paper .post-content > * { max-width: 75ch; }
.research-abstract h2 {
  font-size: 1.4rem; margin: 0 0 var(--s-3);
  letter-spacing: 0.08em; animation: none;
}
.paper-actions {
  display: flex; gap: var(--s-3); flex-wrap: wrap;
  margin: var(--s-6) 0;
}
.paper-actions a, .paper-actions button {
  display: inline-block;
  border: 1px solid var(--border-color);
  background: rgba(0,0,0,0.25);
  color: var(--text-bright);
  padding: 8px 16px;
  font-family: var(--mono-font); font-size: 0.8rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  text-shadow: var(--glow-subtle);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.paper-actions a:hover, .paper-actions button:hover {
  background: rgba(var(--phosphor-rgb), 0.1);
  border-color: var(--text-bright);
  box-shadow: var(--glow-subtle);
}
.paper-actions button.bibtex-copy.copied {
  color: var(--warn-color);
  border-color: var(--warn-color);
}
.bibtex-block {
  margin: 0 0 var(--s-6);
  padding: var(--s-4);
  border: 1px dashed var(--rule-color);
  background: rgba(0,0,0,0.35);
  color: var(--text-color);
  font-family: var(--mono-font);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-x: auto;
}
/* ============================================================
   NOW page
   ============================================================ */
.now-board {
  display: grid; grid-template-columns: max-content 1fr;
  gap: var(--s-3) var(--s-6);
  margin: var(--s-4) 0 var(--s-6);
}
.now-board dt {
  color: var(--text-muted); letter-spacing: 0.14em;
  text-transform: uppercase; font-size: var(--fs-xs);
  align-self: baseline;
}
.now-board dt::before {
  content: '\25B8 ';
  color: var(--warn-color); text-shadow: 0 0 4px rgba(255,211,74,0.5);
}
.now-board dd {
  margin: 0; color: var(--text-color);
  line-height: var(--lh-body); max-width: 68ch;
  border-bottom: 1px dashed var(--rule-color);
  padding-bottom: var(--s-3);
}
.now-board dd:last-of-type { border-bottom: none; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-color);
  margin-top: var(--s-11);
  font-size: var(--fs-xs); color: var(--text-muted);
  letter-spacing: 0.1em;
  position: relative;
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px var(--s-6);
  max-width: var(--max-width); margin: 0 auto;
  flex-wrap: wrap; gap: var(--s-3);
}
.footer-copy::before { content: '[C] '; color: var(--warn-color); }

.footer-palette {
  display: flex; align-items: center; gap: 8px;
  letter-spacing: 0.14em; color: var(--text-muted);
}
.footer-palette-label {
  text-transform: uppercase; margin-right: 4px;
}
.palette-btn {
  width: 16px; height: 16px;
  border: 1px solid var(--border-color);
  background: transparent; cursor: pointer; padding: 0;
  position: relative;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.palette-btn::before {
  content: ''; position: absolute; inset: 2px;
  background: currentColor; opacity: 0.85;
}
.palette-btn[data-pal="green"] { color: #3dff7a; }
.palette-btn[data-pal="amber"] { color: #ffb84a; }
.palette-btn[data-pal="white"] { color: #d8e8ff; }
.palette-btn[data-pal="blue"]  { color: #5ab9ff; }
.palette-btn:hover { border-color: currentColor; box-shadow: 0 0 6px currentColor; }
.palette-btn.active { border-color: currentColor; box-shadow: 0 0 8px currentColor; }

.footer-links { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.footer-links a {
  color: var(--text-muted); border-bottom: none;
}
.footer-links a:hover {
  color: var(--text-bright); background: transparent; text-shadow: var(--glow-subtle);
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--s-4); margin: var(--s-6) 0;
}
.contact-card {
  border: 1px solid var(--border-color);
  background: var(--panel-bg);
  padding: var(--s-5) var(--s-5) var(--s-6);
  position: relative;
}
.contact-card-label {
  font-size: var(--fs-xs); color: var(--text-muted);
  letter-spacing: 0.14em; text-transform: uppercase;
  margin-bottom: var(--s-2);
}
.contact-card-label::before { content: '['; }
.contact-card-label::after  { content: ']'; }
.contact-card .v {
  font-family: var(--heading-font); font-size: 1.4rem;
  color: var(--text-bright); text-shadow: var(--glow-subtle);
  margin: 0; letter-spacing: 0.04em;
  word-break: break-all;
}
.contact-card .v::before { content: '> '; color: var(--text-muted); }
.contact-card .v a { border: none; color: inherit; }
.contact-card.wide { grid-column: 1 / -1; }
.contact-links {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  margin-top: var(--s-2);
}
.contact-links a, .periph-links a {
  color: var(--text-bright); border: 1px solid var(--border-color);
  padding: 6px 12px; font-size: var(--fs-xs); letter-spacing: 0.12em;
  text-transform: uppercase;
}
.contact-links a:hover, .periph-links a:hover {
  border-color: var(--text-bright); background: rgba(var(--phosphor-rgb),0.08);
}

/* ============================================================
   BOOT OVERLAY
   ============================================================ */
html.pipos-booting body { overflow: hidden; }
#boot-overlay {
  position: fixed; inset: 0; z-index: 10500;
  background: #000;
  display: none;
  font-family: var(--mono-font);
  padding: 24px 28px;
  color: var(--text-color);
  font-size: 13px;
  overflow: hidden;
}
html.pipos-booting #boot-overlay { display: block; }
#boot-overlay::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.32) 2px 3px);
  mix-blend-mode: multiply;
  z-index: 2;
}
.boot-skip {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  background: transparent; border: 1px solid var(--border-color);
  color: var(--text-muted); font-family: var(--mono-font);
  font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 4px 10px; cursor: pointer;
}
.boot-skip:hover { color: var(--text-bright); border-color: var(--text-bright); }

/* Single-column streaming POST that fills the screen.
   It scrolls itself so the latest line is always visible; once the finale
   prints the "WELCOME" banner the user sees that, not the start of POST. */
.boot-stream {
  position: absolute;
  inset: 28px 28px 28px 28px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  font-family: var(--mono-font);
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  /* fade the very top so older lines feel like they're rolling out the
     window of the terminal */
  mask-image: linear-gradient(to bottom, transparent 0, #000 60px, #000 100%);
}
.boot-stream::-webkit-scrollbar { display: none; }
.boot-line {
  opacity: 0; animation: bootIn 0.18s forwards;
  margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.boot-line.muted { color: var(--text-muted); }
.boot-line .ok    { color: var(--text-bright); text-shadow: var(--glow-subtle); margin-left: 8px; }
.boot-line .warn  { color: var(--warn-color); margin-left: 8px; }

/* Shell-style finale appended to the same stream */
.boot-finale { margin-top: 0; }
.boot-finale-prompt { color: var(--text-color); }
.boot-finale-prompt .prompt {
  color: var(--warn-color); font-weight: 700; margin-right: 6px;
  text-shadow: 0 0 4px rgba(255,211,74,0.35);
}
.boot-finale-prompt .cmd {
  color: var(--text-bright); text-shadow: var(--glow-subtle);
}
.boot-finale-echo .echo { color: var(--text-muted); }
.boot-finale-banner {
  margin-top: 8px;
}
.boot-finale-banner .banner {
  display: inline-block;
  font-family: var(--heading-font);
  font-weight: 400;
  font-size: clamp(28px, 5vw, 56px);
  letter-spacing: 0.06em;
  color: var(--text-bright);
  text-shadow:
    0 0 8px var(--text-color),
    0 0 24px var(--text-color),
    0 0 48px var(--text-muted);
  animation: bannerFlick 4s 0.5s infinite;
}
.boot-tail .prompt {
  color: var(--warn-color); font-weight: 700; margin-right: 6px;
  text-shadow: 0 0 4px rgba(255,211,74,0.35);
}
.boot-cursor {
  display: inline-block; width: 9px; height: 16px;
  background: var(--text-bright); box-shadow: var(--glow);
  vertical-align: -2px; margin-left: 4px;
  animation: blink 1.1s step-start infinite;
}
@keyframes bootIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
@keyframes bannerFlick {
  0%, 96%, 100% { opacity: 1; }
  97%           { opacity: 0.65; }
  98%           { opacity: 1; }
  99%           { opacity: 0.85; }
}

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.cmd-palette {
  position: fixed; left: 50%; top: 80px; z-index: 10200;
  transform: translate(-50%, -10px);
  width: min(680px, calc(100vw - 32px));
  background: rgba(0,0,0,0.96);
  border: 1px solid var(--text-color);
  box-shadow: 0 0 24px rgba(var(--phosphor-rgb), 0.32), 0 12px 40px rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none;
  transition: transform 0.18s cubic-bezier(.22,1,.36,1), opacity 0.18s;
}
.cmd-palette.open {
  opacity: 1; transform: translate(-50%, 0);
  pointer-events: auto;
}
.cmd-palette::before {
  content: ''; position: absolute; top: -1px; left: 0; right: 0;
  height: 1px; background: var(--text-bright); box-shadow: var(--glow);
}
.cmd-inner {
  padding: 14px var(--s-5) 16px;
  font-family: var(--mono-font); font-size: 0.8rem;
}
.cmd-meta {
  font-size: 0.7rem; letter-spacing: 0.16em;
  color: var(--text-muted); margin-bottom: 8px;
  display: flex; justify-content: space-between;
}
.cmd-out {
  max-height: 280px; overflow: auto;
  margin-bottom: 8px;
  scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}
.cmd-out p {
  margin: 0 0 2px;
  color: var(--text-color);
}
.cmd-out p.muted { color: var(--text-muted); }
.cmd-out p.cmd   { color: var(--text-bright); text-shadow: var(--glow-subtle); }
.cmd-out .prompt { color: var(--warn-color); margin-right: 6px; }
.cmd-out p.hit   {
  display: block; padding: 4px 6px;
  border-left: 2px solid transparent;
  transition: background-color 0.12s, border-color 0.12s;
  cursor: pointer;
}
.cmd-out p.hit:hover {
  background: rgba(var(--phosphor-rgb), 0.07);
  border-left-color: var(--text-bright);
}
.cmd-out .hit-type {
  color: var(--warn-color); font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; margin-right: 6px;
}
.cmd-out .hit-url { font-size: 0.7rem; }
.cmd-row {
  display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}
.cmd-row .cmd-prompt {
  color: var(--warn-color); font-size: 0.85rem;
  text-shadow: 0 0 4px rgba(255,211,74,0.4);
}
.cmd-row input {
  flex: 1; background: transparent; border: none; outline: none;
  font-family: var(--mono-font); font-size: 0.85rem;
  color: var(--text-bright); text-shadow: var(--glow-subtle);
  caret-color: var(--text-bright);
}

/* ============================================================
   RADAR (right-rail TOC)
   ============================================================ */
.radar {
  position: fixed; z-index: 9000;
  border: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.82);
  font-size: var(--fs-2xs); letter-spacing: 0.14em;
  color: var(--text-muted); text-transform: uppercase;
  display: none;
  left: 0; right: 0; bottom: 0;
  padding: 8px var(--s-4) 10px;
  transform: translateY(calc(100% - 32px));
  transition: transform 0.22s cubic-bezier(.22,1,.36,1);
}
.radar.has-items { display: block; }
.radar.expanded { transform: none; }
.radar-hdr {
  color: var(--text-dim);
  margin: 0 0 6px;
  cursor: pointer; user-select: none;
  display: flex; justify-content: space-between; align-items: center;
}
.radar-hdr::after {
  content: '\25B2';
  font-size: 0.6rem; color: var(--text-muted);
  transition: transform 0.2s;
}
.radar.expanded .radar-hdr::after { transform: rotate(180deg); }
.radar ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: row;
  gap: var(--s-3); overflow-x: auto;
  scrollbar-width: thin;
}
.radar li {
  flex: none; padding: 3px 6px; cursor: pointer;
  display: flex; gap: 6px; align-items: center;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.radar li::before {
  content: ''; width: 6px; height: 6px; flex: none;
  border: 1px solid var(--border-color);
  background: transparent;
}
.radar li.active { color: var(--text-bright); text-shadow: var(--glow-subtle); }
.radar li.active::before {
  background: var(--text-bright); box-shadow: var(--glow);
}
.radar li:hover {
  color: var(--text-color);
  border-color: var(--border-color);
  background: rgba(var(--phosphor-rgb), 0.05);
}
/* Numbered tick scanner — inner pieces of each radar <li>.
   Bottom-bar mode: number + tick + label all show inline as a chip.
   Side-rail mode (≥1320px, see below): number + tick only; label is a
   floating callout that fires on hover / when the section is in view. */
.radar .r-num   { font-variant-numeric: tabular-nums; color: var(--text-dim); }
.radar .r-tick  { color: var(--text-dim); transition: color 0.15s, transform 0.15s; }
.radar .r-label { color: inherit; }
.radar li.active .r-num,
.radar li.active .r-tick { color: var(--text-bright); text-shadow: var(--glow-subtle); }

/* Side-rail variant only kicks in when there's real room outside the
   main content frame (--max-width = 1040px); below 1320px it would overlap
   the article column. The rail is a thin column of `01 ▸` ticks; full
   labels float out as callouts on hover / for the active section. */
@media (min-width: 1320px) {
  .radar {
    right: 14px; left: auto; bottom: auto;
    top: 50%;
    transform: translateY(-50%) !important;
    padding: 10px 10px;
    width: 64px;          /* just wide enough for "01 ▸" */
    max-width: 64px;
    transition: none;
  }
  .radar-hdr { cursor: default; margin-bottom: 6px; text-align: center; }
  .radar-hdr::after { display: none; }
  .radar ol { flex-direction: column; gap: 2px; overflow: visible; }

  .radar li {
    position: relative;
    padding: 3px 0;
    border: none;
    white-space: nowrap;
    display: flex; align-items: center; gap: 4px;
    cursor: pointer;
  }
  /* Hide the legacy dot bullet — the number replaces it. */
  .radar li::before { display: none; }
  /* Hide hover background — the callout is the affordance. */
  .radar li:hover { border: none; background: transparent; color: var(--text-color); }

  .radar li .r-tick { font-size: 0.6rem; opacity: 0.7; }
  .radar li.active .r-tick { transform: translateX(2px); opacity: 1; }

  /* Floating label callout — slides out to the LEFT of the rail.
     Fires on hover (any item) and stays open for the active section. */
  .radar li .r-label {
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid var(--border-color);
    color: var(--text-bright);
    padding: 3px 8px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-shadow: var(--glow-subtle);
    box-shadow: 0 0 12px rgba(var(--phosphor-rgb), 0.15);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(.22,1,.36,1);
    z-index: 1;
  }
  /* Callout tail — a tiny phosphor line connecting label to tick. */
  .radar li .r-label::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    width: 6px;
    height: 1px;
    background: var(--border-color);
    transform: translateY(-50%);
  }
  .radar li:hover .r-label,
  .radar li.active .r-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
  /* If both hover and active fire, hover wins (more recently expressed
     intent). They share the same look so this is a no-op visually. */
}

/* ============================================================
   RAD-ALERT toast (Konami easter egg)
   ============================================================ */
.rad-toast {
  position: fixed; left: 50%; top: 16%; transform: translate(-50%, -10px);
  z-index: 10001; pointer-events: none;
  font-family: var(--heading-font, monospace);
  font-size: 1.7rem; letter-spacing: 0.2em; color: #ff5a5a;
  text-shadow: 0 0 8px #ff3b3b, 0 0 18px #a01818;
  border: 1px solid #7a1414; background: rgba(13,2,2,0.82);
  padding: 10px 24px; opacity: 0;
  transition: opacity .35s ease, transform .35s ease;
}
.rad-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   CURSOR PHOSPHOR WASH
   ============================================================ */
#cursor-glow {
  position: fixed; width: 240px; height: 240px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(var(--phosphor-rgb),0.06), transparent 65%);
  transform: translate(-50%, -50%);
  z-index: 9997;
  mix-blend-mode: screen;
  opacity: 0; transition: opacity 0.3s;
  left: -9999px; top: -9999px;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0;
}
.skip-link:focus {
  position: fixed; top: var(--s-2); left: var(--s-2);
  width: auto; height: auto;
  padding: var(--s-2) var(--s-4); margin: 0;
  overflow: visible; clip: auto;
  background: var(--bg-color);
  border: 1px solid var(--border-bright);
  color: var(--text-bright); text-shadow: var(--glow);
  z-index: 10000;
}
:focus-visible {
  outline: 2px solid var(--warn-color); outline-offset: 2px;
}
.post-content { margin-top: var(--s-6); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* system bar: shed chrome as the bar narrows so the nav keys never clip */
@media (max-width: 1160px) {
  .sb-inner { grid-template-columns: auto 1fr auto; }
  .sb-status { display: none; }
}
@media (max-width: 940px) {
  .sb-inner { padding: 10px var(--s-4); gap: var(--s-3); }
  .sb-keys .sb-key-label, .sb-right .sb-uptime { display: none; }
}
@media (max-width: 720px) {
  html { font-size: 100%; }

  /* System bar — keep title + cmd, hide F-keys (mobile strip below) */
  .sb-inner {
    grid-template-columns: auto 1fr;
    padding: 8px var(--s-3);
    gap: var(--s-3);
  }
  .sb-title { font-size: 1.05rem; letter-spacing: 0.08em; }
  .sb-keys, .sb-status { display: none; }
  .sb-right { gap: var(--s-2); justify-self: end; }
  .sb-cmd { padding: 3px 8px; font-size: var(--fs-2xs); }

  /* mobile floating keys ribbon */
  .sb-mobile-keys {
    display: flex; overflow-x: auto;
    gap: 0; padding: 6px var(--s-3);
    border-bottom: 1px solid var(--border-color);
    background: rgba(0,0,0,0.78);
    scrollbar-width: none;
  }
  .sb-mobile-keys::-webkit-scrollbar { display: none; }
  .sb-mobile-keys .sb-key {
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    margin-right: 6px;
    flex: none;
  }
  /* F-key badges are keyboard hints; dropping them on phones lets all five
     sections fit without side-scrolling the ribbon */
  .sb-mobile-keys .sb-key-label { display: none; }

  .footer-inner {
    flex-direction: column; gap: var(--s-3);
    text-align: center; padding: 10px var(--s-4);
  }

  /* title stays beside its ▬ marker; breadcrumb drops to its own line */
  .page-header { flex-wrap: wrap; }
  .page-title { flex: 1 1 0; min-width: 0; font-size: 2.1rem; }
  .page-header .page-crumb { margin-left: 0; flex-basis: 100%; white-space: normal; }

  .hero { padding: var(--s-6) var(--s-5); }
  .hero-title { font-size: 2.4rem; }
  .hero-subtitle { padding-left: 0; }
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-5); }

  .stats { grid-template-columns: 1fr; }
  .stat { border-right: none; border-bottom: 1px solid var(--border-color); }
  .stat:last-child { border-bottom: none; }

  .featured-grid, .contact-grid { grid-template-columns: 1fr; }
  .now-board { grid-template-columns: 1fr; gap: var(--s-2); }
  .now-board dt { padding-top: var(--s-3); }

  /* date above the entry, so the text gets the full width */
  .item-list li .item-title,
  .item-list li > p { grid-column: 1 / -1; }

  .research-paper .paper-meta { grid-template-columns: 1fr; }
  .research-paper .paper-meta > div { border-right: none; border-bottom: 1px solid var(--border-color); }
  .research-paper .paper-meta > div:last-child { border-bottom: none; }
}
@media (min-width: 721px) {
  .sb-mobile-keys { display: none; }
}
/* below the side-rail breakpoint the quest log is a bar pinned to the
   bottom of the viewport; leave room so it never covers the footer */
@media (max-width: 1319px) {
  body:has(.radar.has-items) { padding-bottom: 40px; }
}
/* touch: finger-sized tap targets */
@media (max-width: 720px), (pointer: coarse) {
  .sb-mobile-keys .sb-key { min-height: 40px; display: inline-flex; align-items: center; }
  .sb-cmd { min-height: 38px; }
  /* keep the small phosphor swatch but grow its hittable area to ~36px;
     widen the row gap so neighbouring hit areas don't overlap */
  .footer-palette { gap: 22px; }
  .palette-btn::after { content: ''; position: absolute; inset: -11px; }
}
/* small phones */
@media (max-width: 480px) {
  .hero-title { font-size: 1.9rem; }
  .hero-title::before { font-size: 1.4rem; }
  .hero { padding: var(--s-5) var(--s-4); }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  body::before, body::after { display: none; }
  #cursor-glow { display: none; }
}

