/* ============================================================
   SODIUM://TERMINAL — the research wing
   Amber phosphor CRT. Everything glows at 589nm.
   ============================================================ */
:root {
  --bg: #0a0704;
  --bg-2: #120c05;
  --bg-3: #1a1108;
  --ph: #f5a03c;            /* phosphor */
  --ph-hi: #ffd9a0;         /* hot phosphor */
  --ph-dim: #8a5a22;
  --ph-faint: #4a3212;
  --line: rgba(245, 160, 60, 0.22);
  --line-strong: rgba(245, 160, 60, 0.5);
  --glow: 0 0 6px rgba(245, 160, 60, 0.55), 0 0 20px rgba(245, 160, 60, 0.18);
  --glow-hi: 0 0 8px rgba(255, 217, 160, 0.7), 0 0 28px rgba(245, 160, 60, 0.3);
  --f-mono: "Fragment Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --f-display: "Zodiak", Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(1.2rem, 4vw, 3.5rem);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ph);
  font-family: var(--f-mono);
  font-size: 1.7rem;
  line-height: 1.75;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ph); }
h1, h2, h3, p, figure, pre { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: var(--ph); color: #120c05; }
:focus-visible { outline: 2px solid var(--ph-hi); outline-offset: 3px; }

/* ---------- CRT furniture ---------- */
.scanlines {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(0,0,0,0.22) 0px, rgba(0,0,0,0.22) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: multiply;
}
.vignette {
  position: fixed; inset: 0; z-index: 19; pointer-events: none;
  background: radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(0,0,0,0.55) 100%);
}
.crt-flicker { animation: crt 7s steps(1) infinite; }
@keyframes crt {
  0%, 100% { opacity: 1; }
  92.1% { opacity: 0.92; } 92.3% { opacity: 1; }
  95.7% { opacity: 0.88; } 95.9% { opacity: 1; }
}
#rain { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5; }
main, .t-footer { position: relative; z-index: 2; }

/* HUD corner brackets */
.hud-corner { position: fixed; z-index: 30; width: 22px; height: 22px; pointer-events: none; border-color: var(--line-strong); border-style: solid; border-width: 0; }
.hud-corner.tl { top: 10px; left: 10px; border-top-width: 1px; border-left-width: 1px; }
.hud-corner.tr { top: 10px; right: 10px; border-top-width: 1px; border-right-width: 1px; }
.hud-corner.bl { bottom: 10px; left: 10px; border-bottom-width: 1px; border-left-width: 1px; }
.hud-corner.br { bottom: 10px; right: 10px; border-bottom-width: 1px; border-right-width: 1px; }
.hud-telemetry {
  position: fixed; z-index: 30; bottom: 14px; left: 44px;
  font-size: 0.62rem; letter-spacing: 0.14em; color: var(--ph-dim);
  pointer-events: none; font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}
.hud-clock {
  position: fixed; z-index: 30; top: 14px; right: 44px;
  font-size: 0.62rem; letter-spacing: 0.18em; color: var(--ph-dim);
  pointer-events: none; font-variant-numeric: tabular-nums;
}

/* ---------- boot overlay ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100;
  background: #070502;
  padding: clamp(1.5rem, 6vw, 4rem);
  font-size: 1.6rem; line-height: 2.4; font-weight: 700;
  transition: opacity 0.35s steps(3);
}
.boot.done { opacity: 0; pointer-events: none; }
.boot pre { white-space: pre-wrap; text-shadow: var(--glow); }
.boot .ok { color: var(--ph-hi); }
.boot .dim { color: var(--ph-dim); }
.boot-skip {
  position: absolute; right: 1.4rem; bottom: 1.2rem;
  font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ph-dim); border: 1px solid var(--line);
  padding: 0.5rem 0.9rem;
}
.boot-skip:hover { color: var(--ph); border-color: var(--line-strong); }
.cursor::after { content: "█"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- nav ---------- */
.t-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0.75rem var(--gutter);
  background: rgba(10, 7, 4, 0.88);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem; letter-spacing: 0.1em;
}
.t-brand { text-decoration: none; text-shadow: var(--glow); white-space: nowrap; }
.t-brand b { color: var(--ph-hi); font-weight: 400; }
.t-nav .path { color: var(--ph-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-nav-links { margin-left: auto; display: flex; gap: 1.4rem; }
.t-nav-links a { text-decoration: none; color: var(--ph-dim); text-transform: uppercase; }
.t-nav-links a:hover, .t-nav-links a[aria-current="page"] { color: var(--ph-hi); text-shadow: var(--glow); }

.wrap { padding-inline: var(--gutter); max-width: 82rem; margin-inline: auto; }

/* shell-prompt section headers */
.prompt {
  font-size: 0.8rem; letter-spacing: 0.08em; color: var(--ph-dim);
  display: flex; gap: 0.6rem; align-items: baseline;
}
.prompt::before { content: "breach@ai:~$"; color: var(--ph-faint); }
.prompt b { color: var(--ph-hi); font-weight: 400; }

/* ---------- reveals ---------- */
[data-tr] { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); transition-delay: var(--d, 0s); }
[data-tr].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-tr] { opacity: 1; transform: none; transition: none; }
}

/* ---------- hero ---------- */
.t-hero { min-height: 85svh; display: grid; align-content: center; gap: 1.2rem; padding-block: 4rem 2rem; }
.t-hero-title { font-family: var(--f-mono);
  font-size: clamp(2rem, 6vw, 4.2rem);
  font-weight: 400; letter-spacing: 0.01em; line-height: 1.25;
  text-shadow: var(--glow);
  min-height: 2.5em;
}
.t-hero-title .typed-done { color: var(--ph-hi); }
.t-hero-sub { color: var(--ph-dim); max-width: 62ch; font-size: 1.3rem; line-height: 1.7; }
.t-hero-meta { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ph-faint); }
.t-hero-meta b { color: var(--ph); font-weight: 400; }

/* ---------- ascii panel primitive ---------- */
.panel-t {
  border: 1px solid var(--line);
  position: relative; padding: 1.4rem 1.5rem;
  background: linear-gradient(180deg, rgba(245,160,60,0.03), transparent);
}
.panel-t::before {
  content: attr(data-label);
  position: absolute; top: -0.65em; left: 0.9rem;
  background: var(--bg); padding-inline: 0.5rem;
  font-size: 0.62rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ph-dim);
}

/* ---------- featured research ---------- */
.t-featured { padding-block: 4rem; display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
.t-featured h2 a {
  font-family: var(--f-display); font-weight: 900;
  font-size: clamp(1.9rem, 4.4vw, 3.4rem); line-height: 1.05; letter-spacing: -0.01em;
  color: var(--ph-hi); text-decoration: none; text-shadow: var(--glow-hi);
  display: block; margin-top: 0.8rem; text-wrap: balance;
}
.t-featured h2 a:hover { color: #fff; }
.t-abstract { margin-top: 1.2rem; color: var(--ph-dim); font-size: 0.88rem; }
.t-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.3rem; }
.tag { font-size: 0.78rem; letter-spacing: 0.14em; border: 1px solid var(--line); padding: 0.25rem 0.6rem; color: var(--ph-dim); text-transform: uppercase; }
.tag.hot { color: var(--ph-hi); border-color: var(--line-strong); text-shadow: var(--glow); }

/* fake readout block */
.readout { font-size: 0.82rem; line-height: 2.1; color: var(--ph-dim); white-space: pre; overflow-x: auto; }
.readout b { color: var(--ph); font-weight: 400; }
.readout .bar { color: var(--ph-hi); text-shadow: var(--glow); }

/* ---------- research log ---------- */
.t-log { padding-block: 3rem 4.5rem; }
.t-rows { margin-top: 1.6rem; border-top: 1px dashed var(--line); }
.t-row {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto auto;
  gap: 1.5rem; align-items: baseline;
  padding: 1rem 0.4rem; border-bottom: 1px dashed var(--line);
  text-decoration: none; font-size: 0.85rem;
  transition: background 0.2s ease, padding-left 0.3s var(--ease-out);
}
.t-row:hover { background: rgba(245, 160, 60, 0.06); padding-left: 1rem; }
.t-row:hover .t-row-t { color: var(--ph-hi); text-shadow: var(--glow); }
.t-row:hover .t-row-i::before { content: "> "; }
.t-row-i { color: var(--ph-faint); font-size: 0.82rem; }
.t-row-t { color: var(--ph); transition: color 0.2s ease; }
.t-row-tag, .t-row-d { color: var(--ph-faint); font-size: 0.8rem; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.1em; }

/* ---------- manifesto as cat ---------- */
.t-manifesto { padding-block: 4rem; }
.t-manifesto pre {
  white-space: pre-wrap; margin-top: 1.4rem;
  font-size: clamp(0.9rem, 1.8vw, 1.15rem); line-height: 2;
  color: var(--ph); text-shadow: var(--glow);
  border-left: 1px solid var(--line-strong); padding-left: 1.4rem;
}
.t-manifesto pre em { color: var(--ph-hi); font-style: normal; }

/* ---------- subscribe ---------- */
.t-sub { padding-block: 4rem; border-top: 1px solid var(--line); display: grid; gap: 2rem; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; }
.t-sub h2 { font-size: 1.7rem; font-weight: 400; letter-spacing: 0.04em; text-shadow: var(--glow); }
.t-sub-form { display: flex; border: 1px solid var(--line-strong); }
.t-sub-form input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--ph-hi); padding: 0.9rem 1rem; font: inherit; }
.t-sub-form input::placeholder { color: var(--ph-faint); }
.t-btn { background: var(--ph); color: #120c05; padding: 0.9rem 1.4rem; font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; }
.t-btn:hover { background: var(--ph-hi); box-shadow: var(--glow-hi); }
.t-sub-note { margin-top: 0.7rem; font-size: 0.78rem; color: var(--ph-faint); letter-spacing: 0.08em; }
.t-sub-note.ok { color: var(--ph-hi); }

/* ---------- footer ---------- */
.t-footer { border-top: 1px solid var(--line); padding: 2.2rem var(--gutter); display: flex; flex-wrap: wrap; gap: 1rem 3rem; justify-content: space-between; font-size: 0.8rem; letter-spacing: 0.1em; color: var(--ph-dim); }
.t-footer a { color: var(--ph-dim); }
.t-footer a:hover { color: var(--ph-hi); }

/* ============================================================
   NA-CHAN // UNIT-11 — original mascot, stream-overlay window
   ============================================================ */
.nachan {
  position: fixed; z-index: 50; right: 1rem; bottom: 1rem;
  width: clamp(150px, 17vw, 210px);
  border: 1px solid var(--line-strong);
  background: rgba(10, 7, 4, 0.92);
  box-shadow: var(--glow);
}
.nachan-bar {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.56rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ph-dim); padding: 0.35rem 0.55rem;
  border-bottom: 1px solid var(--line);
}
.nachan-bar .rec { width: 6px; height: 6px; border-radius: 50%; background: #c65f4e; animation: blink 1.4s steps(1) infinite; }
.nachan-bar .min { margin-left: auto; color: var(--ph-dim); padding: 0 0.2rem; }
.nachan-bar .min:hover { color: var(--ph-hi); }
.nachan-stage { position: relative; cursor: pointer; }
.nachan svg { width: 100%; display: block; }
.nachan-bubble {
  position: absolute; left: 0.55rem; right: 0.55rem; bottom: 0.5rem;
  font-size: 0.72rem; line-height: 1.7; letter-spacing: 0.04em;
  color: var(--ph-hi); background: rgba(10, 7, 4, 0.85);
  border: 1px solid var(--line); padding: 0.35rem 0.5rem;
  min-height: 2.9em; pointer-events: none;
}
.nachan.min .nachan-stage { display: none; }

/* character animation */
.na-bob { animation: na-bob 3.4s ease-in-out infinite; transform-origin: 100px 210px; }
@keyframes na-bob { 50% { transform: translateY(3px); } }
.na-ahoge { animation: na-ahoge 3.4s ease-in-out infinite; transform-origin: 100px 46px; }
@keyframes na-ahoge { 50% { transform: rotate(5deg); } }
.na-lids { transform: scaleY(0); transform-origin: center 118px; transition: transform 0.09s linear; }
.nachan.blink .na-lids { transform: scaleY(1); }
.na-mouth-open { display: none; }
.nachan.talk .na-mouth-open { display: block; }
.nachan.talk .na-mouth-line { display: none; }
.na-eyes-happy { display: none; }
.nachan.happy .na-eyes-happy { display: block; }
.nachan.happy .na-eyes-norm { display: none; }
.na-visor-dot { animation: blink 2s steps(1) infinite; }
.nachan.wind .na-hair-l { animation: na-sway 0.6s ease-in-out infinite; transform-origin: 62px 90px; }
.nachan.wind .na-hair-r { animation: na-sway 0.6s ease-in-out infinite reverse; transform-origin: 138px 90px; }
@keyframes na-sway { 50% { transform: rotate(3deg); } }

/* ============================================================
   ARTICLE — research paper
   ============================================================ */
.paper { max-width: 90ch; margin-inline: auto; padding: 5rem var(--gutter) 4rem; }
.paper-meta { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ph-faint); display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; }
.paper-meta b { color: var(--ph); font-weight: 400; }
.paper h1 {
  font-family: var(--f-display); font-weight: 900;
  font-size: clamp(2rem, 5.5vw, 3.8rem); line-height: 1.04; letter-spacing: -0.01em;
  color: var(--ph-hi); text-shadow: var(--glow-hi);
  margin-top: 1.2rem; text-wrap: balance;
}
.paper .authors { margin-top: 1.2rem; font-size: 0.82rem; color: var(--ph-dim); }
.paper .authors b { color: var(--ph); font-weight: 400; }
.abstract { margin-top: 2.2rem; }
.abstract p { font-size: 1.05rem; color: var(--ph); line-height: 1.8; font-family: "Switzer", system-ui, sans-serif; }
.paper h2 { font-size: 1.7rem; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ph-hi); text-shadow: var(--glow); margin-top: 3rem; }
.paper h2::before { content: "§ "; color: var(--ph-dim); }
.paper p + p { margin-top: 0.8em; }
.paper h2 + p { margin-top: 0.6em; }
/* body-text: readable mode */
.paper .body-text {
  font-family: "Switzer", system-ui, -apple-system, sans-serif;
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--ph-hi);
  max-width: none;
}
.paper .body-text p {
  margin-bottom: 0.8em;
}
.paper .body-text h2 {
  font-family: var(--f-display);
  margin-top: 2rem;
  margin-bottom: 1rem;
}
.paper .body-text pre,
.paper .body-text .datatable {
  font-family: var(--f-mono);
  font-size: 0.85rem;
  color: var(--ph);
}
pre.code {
  margin-block: 1em; padding: 1.2rem 1.4rem; overflow-x: auto;
  border: 1px solid var(--line); background: var(--bg-2);
  font-size: 0.88rem; line-height: 1.9; white-space: pre;
}
pre.code .k { color: var(--ph-hi); }
pre.code .c { color: var(--ph-faint); }
pre.code .s { color: #d9c9ae; }
.datatable { margin-block: 1em; font-size: 0.88rem; line-height: 2.1; white-space: pre; overflow-x: auto; color: var(--ph-dim); border: 1px solid var(--line); padding: 1rem 1.3rem; }
.datatable b { color: var(--ph-hi); font-weight: 400; }
.bibtex { margin-top: 3rem; }
.footnote { font-size: 0.85rem; font-family: "Switzer", system-ui, sans-serif; color: var(--ph-dim); border-top: 1px dashed var(--line); margin-top: 3rem; padding-top: 1.2rem; line-height: 1.7; }

/* article page: tone down CRT for reading */
body:has(.paper) .scanlines { opacity: 0.3; }
body:has(.paper) .crt-flicker { animation: none; }
body:has(.paper) #rain { opacity: 0.3; }
body:has(.paper) .vignette { opacity: 0.4; }
.reading-bar { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--ph); transform-origin: 0 50%; transform: scaleX(0); z-index: 60; box-shadow: var(--glow); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  body { font-size: 1.1rem; }
  .t-hero { min-height: 75svh; padding-block: 3rem 2rem; }
  .t-hero-title { font-size: clamp(1.4rem, 7vw, 2.4rem); min-height: auto; }
  .t-hero-sub { font-size: 1rem; }
  .t-featured, .t-sub { grid-template-columns: 1fr; }
  .t-featured h2 a { font-size: clamp(1.4rem, 6vw, 2rem); }
  .t-abstract { font-size: 0.85rem; }
  .t-row { grid-template-columns: 4rem minmax(0,1fr); row-gap: 0.2rem; }
  .t-row-tag, .t-row-d { grid-column: 2; }
  .hud-telemetry { display: none; }
  .hud-corner { display: none; }
  .hud-clock { display: none; }
  .nachan { display: none; }
  .t-nav { font-size: 0.65rem; gap: 0.6rem; }
  .t-nav .path { display: none; }
  .t-nav-links { gap: 0.8rem; }
  .wrap { padding-inline: 1rem; }
  .prompt { font-size: 0.7rem; }
  .prompt::before { display: none; }
  .panel-t { padding: 1rem; }
  .panel-t::before { font-size: 0.55rem; }
  .readout { font-size: 0.65rem !important; }
  .tag { font-size: 0.6rem; padding: 0.2rem 0.4rem; }
  .paper { padding: 3rem 1rem 2rem; }
  .paper h1 { font-size: clamp(1.5rem, 7vw, 2.2rem); }
  .paper h2 { font-size: 1.2rem; }
  .paper .body-text { font-size: 0.95rem; }
  .paper .body-text p { margin-bottom: 0.7em; }
  .datatable, pre.code { font-size: 0.65rem; padding: 0.8rem; }
  .boot { font-size: 0.9rem; line-height: 1.8; }
  .t-manifesto pre { font-size: 0.85rem; }
  .t-sub h2 { font-size: 1.2rem; }
  .t-footer { font-size: 0.6rem; flex-direction: column; gap: 0.5rem; padding: 1rem; }
  video { border: none !important; }
  img[alt="Shattered code mirror"] { margin: 1rem 0 !important; }
}

/* researchers page mobile */
@media (max-width: 860px) {
  [style*="grid-template-columns:1fr 300px"] { grid-template-columns: 1fr !important; }
  img[alt="Yash Vardhan Tripathi"], img[alt="Yash Somalkar"] { width: 150px !important; height: 150px !important; margin: 0 auto 1rem !important; display: block !important; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .boot, #rain, .scanlines { display: none; }
  .nachan-bubble { min-height: auto; }
}
