/* =============================================================
   CANSIN.OS — design system
   ============================================================= */

:root {
  /* base palette */
  --bg: #0a0a0a;
  --bg-2: #0f0f0e;
  --bg-3: #15140f;
  --line: #2a261d;
  --line-2: #3a3429;
  --paper: #f4ede0;
  --ink: #ddd6c5;
  --ink-2: #9a907c;
  --ink-3: #6a6256;
  --mute: #4a443a;

  /* accent (default: amber) */
  --accent: #ff8a1a;
  --accent-soft: #ff8a1a33;
  --accent-glow: #ff8a1a55;

  /* phosphor */
  --phos: #6ee896;
  --phos-soft: #6ee89633;
  --red: #ff4d4d;
  --amber: #ffb84d;

  /* type */
  --mono: 'JetBrains Mono', ui-monospace, 'IBM Plex Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;

  /* layout */
  --rail-l: 280px;
  --rail-r: 64px;
  --top: 36px;

  /* CRT */
  --scan-op: 0.35;
  --noise-op: 0.07;
  --vign-op: 0.6;
}

/* Theme variants */
body.theme-amber    { --accent: #ff8a1a; --accent-soft: #ff8a1a33; --accent-glow: #ff8a1a55; }
body.theme-phosphor { --accent: #6ee896; --accent-soft: #6ee89633; --accent-glow: #6ee89655; }
body.theme-electric { --accent: #5d83ff; --accent-soft: #5d83ff33; --accent-glow: #5d83ff55; }
body.theme-mono     { --accent: #f4ede0; --accent-soft: #f4ede022; --accent-glow: #f4ede033; }

/* CRT intensity */
body.crt-off    { --scan-op: 0; --noise-op: 0; --vign-op: 0.2; }
body.crt-low    { --scan-op: 0.15; --noise-op: 0.04; --vign-op: 0.4; }
body.crt-medium { --scan-op: 0.35; --noise-op: 0.07; --vign-op: 0.6; }
body.crt-high   { --scan-op: 0.55; --noise-op: 0.12; --vign-op: 0.75; }

/* =============================================================
   Reset & base
   ============================================================= */

*,*::before,*::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  letter-spacing: 0.01em;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; margin: 0; }

/* selection */
::selection { background: var(--accent); color: var(--bg); }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* =============================================================
   Background layers (full bleed)
   ============================================================= */

#bg-mesh {
  position: fixed; inset: 0; z-index: 0;
  width: 100vw; height: 100vh; display: block;
  opacity: 0.85;
  pointer-events: none;
}

.bg-streams {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.stream {
  position: absolute;
  top: 0; bottom: 0;
  width: 260px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--accent);
  opacity: 0.18;
  white-space: pre;
  overflow: hidden;
  mix-blend-mode: screen;
}
.stream-left  { left: calc(var(--rail-l) + 8px); mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent); -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent); }
.stream-right { right: calc(var(--rail-r) + 8px); mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent); -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent); text-align: right; }

.stream-inner { animation: streamScroll 60s linear infinite; }
.stream-right .stream-inner { animation-duration: 75s; }

@keyframes streamScroll {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

/* CRT layers */
.crt-scanlines {
  position: fixed; inset: 0; z-index: 90;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.32) 0px,
    rgba(0,0,0,0.32) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: var(--scan-op);
  mix-blend-mode: multiply;
}
.crt-noise {
  position: fixed; inset: 0; z-index: 91;
  pointer-events: none;
  opacity: var(--noise-op);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.9'/></svg>");
  background-size: 200px 200px;
  mix-blend-mode: overlay;
  animation: noiseShift 0.12s steps(2) infinite;
}
@keyframes noiseShift {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(-2px, 1px); }
  50%  { transform: translate(1px, -1px); }
  75%  { transform: translate(-1px, 2px); }
  100% { transform: translate(0,0); }
}
.crt-vignette {
  position: fixed; inset: 0; z-index: 92;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.7) 100%),
    radial-gradient(ellipse at center, transparent 70%, rgba(0,0,0,0.35) 100%);
  opacity: var(--vign-op);
}

/* Page transition flicker */
.flicker {
  position: fixed; inset: 0; z-index: 95;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}
.flicker.is-firing {
  animation: flickFire 240ms steps(6) 1;
}
@keyframes flickFire {
  0%   { opacity: 0; }
  20%  { opacity: 0.25; }
  35%  { opacity: 0; }
  55%  { opacity: 0.18; }
  70%  { opacity: 0; }
  85%  { opacity: 0.08; }
  100% { opacity: 0; }
}

/* =============================================================
   Top status bar
   ============================================================= */

.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--top);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
  background: rgba(8,8,7,0.75);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-2);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.mono-xs { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.sep { color: var(--mute); }
.live-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--phos); box-shadow: 0 0 6px var(--phos-soft);
  margin-right: 6px;
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* =============================================================
   Left sidebar (menu)
   ============================================================= */

.sidebar-left {
  position: fixed;
  top: var(--top); bottom: 0; left: 0;
  width: var(--rail-l);
  background: rgba(8,8,7,0.78);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--line);
  z-index: 30;
  display: flex; flex-direction: column;
  padding: 22px 16px 16px;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 4px 18px;
  border-bottom: 1px dashed var(--line);
  color: var(--paper);
  transition: color 0.2s ease;
}
.brand:hover { color: var(--accent); }
.brand-mark {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center;
  color: var(--paper);
  transition: color 0.2s ease, transform 0.3s ease;
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute; left: -2px; bottom: 0;
  width: 18px; height: 1px;
  background: var(--accent);
  opacity: 0.7;
}
.brand-mono {
  font-family: 'Great Vibes', 'Allura', cursive;
  font-size: 46px;
  line-height: 0.85;
  letter-spacing: -0.04em;
  color: inherit;
  display: block;
  margin-top: -2px;
  transform: translateX(-1px);
  text-shadow: 0 1px 0 rgba(244,237,224,0.12);
}
.brand:hover .brand-mark { color: var(--accent); transform: rotate(-2deg); }
.brand-name { font-family: var(--mono); font-weight: 700; letter-spacing: 0.22em; font-size: 12px; color: var(--paper); }
.brand-sub  { font-family: var(--mono); font-weight: 300; letter-spacing: 0.42em; font-size: 9px; color: var(--ink-3); margin-top: 2px; }

.menu {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 18px;
}
.menu-item {
  display: grid;
  grid-template-columns: 28px 1fr 16px;
  align-items: start;
  gap: 10px;
  padding: 12px 10px;
  text-align: left;
  border: 1px solid transparent;
  position: relative;
  transition: all 0.18s ease;
  color: var(--ink-2);
}
.menu-item:hover {
  color: var(--paper);
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%);
  border-color: var(--line);
}
.menu-item:hover .menu-arrow { transform: translateX(2px); opacity: 1; }
.menu-item.is-active {
  color: var(--paper);
  background: linear-gradient(90deg, var(--accent-soft), transparent 80%);
  border-color: var(--accent);
}
.menu-item.is-active::before {
  content: '';
  position: absolute; left: -16px; top: 50%;
  width: 14px; height: 1px; background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.menu-id {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  padding-top: 2px;
}
.menu-item.is-active .menu-id { color: var(--accent); }
.menu-name {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: inherit;
  margin-bottom: 4px;
}
.menu-tag {
  display: block;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  line-height: 1.5;
}
.menu-item.is-active .menu-tag { color: var(--accent); opacity: 0.9; }
.menu-arrow {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  opacity: 0.5;
  transition: transform 0.18s ease, opacity 0.18s ease;
  padding-top: 3px;
}
.menu-item.is-active .menu-arrow { color: var(--accent); opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.syssum { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.syssum-row {
  display: grid;
  grid-template-columns: 32px 1fr 36px;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink-3);
}
.syssum-row .bar {
  height: 4px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.syssum-row .bar-fill {
  position: absolute; inset: 0;
  width: var(--w);
  background: linear-gradient(90deg, var(--accent), var(--accent-glow));
  box-shadow: 0 0 6px var(--accent-glow);
}
.syssum-row span:last-child { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.ctrl-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-2);
  transition: all 0.16s ease;
}
.ctrl-btn:hover { color: var(--paper); border-color: var(--accent); background: rgba(255,138,26,0.06); }
.ctrl-icon { color: var(--accent); }
.ctrl-btn[aria-pressed="true"] .ctrl-icon { color: var(--phos); }

/* =============================================================
   Right sidebar (follow)
   ============================================================= */

/* Right rail: center icons vertically with FOLLOW eyebrow */
.sidebar-right {
  position: fixed;
  top: var(--top); bottom: 0; right: 0;
  width: var(--rail-r);
  background: rgba(8,8,7,0.78);
  backdrop-filter: blur(8px);
  border-left: 1px solid var(--line);
  z-index: 30;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 0;
}
.follow-stack {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}
.follow-eyebrow {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.5em;
  color: var(--accent);
  margin-bottom: 4px;
}
.follow-eyebrow span { color: var(--ink-3); margin: 0 1px; }
.follow-rail {
  display: flex; flex-direction: column; gap: 6px;
}
.follow-link {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: all 0.18s ease;
}
.follow-link svg { width: 18px; height: 18px; }
.follow-link:hover {
  color: var(--accent);
  border-color: var(--line);
  background: var(--accent-soft);
}

/* =============================================================
   Stage & pages
   ============================================================= */

.stage {
  position: relative;
  z-index: 10;
  margin-left: var(--rail-l);
  margin-right: var(--rail-r);
  margin-top: var(--top);
  min-height: calc(100vh - var(--top));
  padding: 32px 48px;
}
.page { display: none; animation: pageIn 0.42s ease both; }
.page.is-active { display: block; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); filter: blur(2px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* =============================================================
   00 — CORE
   ============================================================= */

.core-frame {
  min-height: calc(100vh - var(--top) - 64px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  position: relative;
  padding: 32px 40px;
  background:
    linear-gradient(135deg, rgba(255,138,26,0.025), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(255,138,26,0.04), transparent 60%);
}
.core-frame::before, .core-frame::after {
  content: ''; position: absolute; width: 24px; height: 24px;
  border: 1px solid var(--accent); pointer-events: none;
}
.core-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.core-frame::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.core-tag-top {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
  text-transform: uppercase;
}
.core-tag-bottom {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.core-hero {
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  padding: 28px 0;
  max-width: 1100px;
}

.core-pre {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px;
}
.core-pre .pre-line { display: inline-block; width: 56px; height: 1px; background: var(--accent); }
.core-pre .pre-text {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.32em;
  color: var(--accent);
  text-transform: uppercase;
}

.core-name {
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(56px, 11vw, 168px);
  line-height: 0.86;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--paper);
  text-shadow: 0 0 24px rgba(244,237,224,0.08);
  display: flex; flex-direction: column;
}
.core-name .name-part {
  display: block;
  position: relative;
}
.core-name .name-part:nth-child(2) {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--paper);
  text-shadow: 4px 4px 0 var(--accent-soft);
}

.core-title-row {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono);
  font-size: clamp(14px, 1.4vw, 20px);
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 20px;
}
.t-bracket { color: var(--accent); font-weight: 700; }
.t-text { color: var(--paper); letter-spacing: 0.22em; }

.core-bio {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 2vw, 26px);
  color: var(--ink);
  max-width: 720px;
  margin: 0 0 36px;
  line-height: 1.4;
  text-wrap: pretty;
}

.core-cta-row {
  display: flex; gap: 14px; flex-wrap: wrap;
}
.cta {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  transition: all 0.18s ease;
}
.cta.primary { background: var(--accent); color: var(--bg); }
.cta.primary:hover { background: var(--paper); border-color: var(--paper); }
.cta.ghost { color: var(--paper); border-color: var(--line-2); }
.cta.ghost:hover { color: var(--accent); border-color: var(--accent); }
.cta-arrow { transition: transform 0.18s ease; }
.cta:hover .cta-arrow { transform: translateX(4px); }

.core-fact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px dashed var(--line);
  margin-top: 28px;
  padding-top: 18px;
}
.fact {
  padding: 4px 16px;
  border-right: 1px dashed var(--line);
}
.fact:last-child { border-right: 0; }
.fact:first-child { padding-left: 0; }
.fact-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.fact-value {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--paper);
  font-weight: 500;
}

.blink { animation: blink 1.1s steps(2) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* =============================================================
   01 — RESEARCH
   ============================================================= */

.page-head { margin-bottom: 32px; max-width: 980px; }
.page-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.page-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(48px, 7vw, 96px);
  letter-spacing: -0.01em;
  line-height: 0.9;
  margin: 0 0 18px;
  color: var(--paper);
}
.page-lede {
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  color: var(--ink);
  max-width: 720px;
  margin: 0 0 14px;
  line-height: 1.5;
  text-wrap: pretty;
}
.page-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 12px;
}
.research-card {
  border: 1px solid var(--line);
  background: rgba(10,10,9,0.5);
  position: relative;
  cursor: pointer;
  transition: all 0.22s ease;
  overflow: hidden;
}
.research-card:hover {
  border-color: var(--accent);
  background: rgba(255,138,26,0.04);
  transform: translateY(-2px);
}
.research-card:hover .rc-img-wrap { filter: none; }
.research-card:hover .rc-img-wrap::before { opacity: 0; }
.research-card:hover .rc-readmore { color: var(--accent); }

.rc-img-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  filter: grayscale(1) contrast(1.15) brightness(0.7);
  transition: filter 0.4s ease;
  overflow: hidden;
}
.rc-img-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.5), rgba(0,0,0,0.2));
  z-index: 1;
  opacity: 1;
  transition: opacity 0.4s ease;
}
.rc-img { position: absolute; inset: 0; width: 100%; height: 100%; }

.rc-body { padding: 18px 20px 22px; }
.rc-meta {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.rc-num { color: var(--accent); }
.rc-title {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--paper);
  line-height: 1.35;
  margin: 0 0 12px;
  text-transform: uppercase;
  text-wrap: balance;
}
.rc-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px;
}
.rc-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--ink-2);
  padding: 3px 8px;
  border: 1px solid var(--line);
  text-transform: uppercase;
}
.rc-readmore {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--ink-3);
  text-transform: uppercase;
  transition: color 0.18s ease;
}

/* Reader overlay */
.reader-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,5,4,0.86);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.reader-overlay.is-open { display: flex; }
.reader-shell {
  width: min(820px, 100%);
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--accent);
  position: relative;
  box-shadow: 0 0 60px rgba(255,138,26,0.18);
}
.reader-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px dashed var(--line);
  flex: 0 0 auto;
}
.reader-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--accent);
  text-transform: uppercase;
}
.reader-close {
  width: 28px; height: 28px;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 18px;
  display: grid; place-items: center;
  transition: all 0.18s ease;
}
.reader-close:hover { border-color: var(--accent); color: var(--accent); }
.reader-body { padding: 26px 28px 32px; overflow-y: auto; flex: 1 1 auto; }
.reader-body h3 {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--paper);
  margin: 0 0 16px;
  line-height: 1.3;
  text-transform: uppercase;
}
.reader-body p {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0 0 14px;
  text-wrap: pretty;
}
.reader-meta-row {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
  text-transform: uppercase;
}
.reader-meta-row strong { color: var(--paper); font-weight: 500; }
.reader-tags {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.reader-tags .rc-tag { border-color: var(--accent); color: var(--accent); }

/* =============================================================
   02 — ASSISTANT (Bento) — strict viewport, fills available area
   ============================================================= */

.page.page-assistant.is-active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--top) - 32px);
  overflow: hidden;
  margin: -16px -16px;
  padding: 16px 16px;
}

.dash-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
  gap: 16px;
  flex: 0 0 auto;
}
.dash-head-left {
  display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; min-width: 0;
}
.dash-head-left .page-eyebrow { margin-bottom: 0; }
.dash-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(26px, 3.2vw, 44px);
  letter-spacing: -0.01em;
  line-height: 0.95;
  margin: 0;
  color: var(--paper);
  white-space: nowrap;
}
.dash-meta { display: flex; gap: 18px; flex-wrap: wrap; }
.dash-meta-row {
  display: flex; flex-direction: column;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  text-transform: uppercase;
  text-align: right;
}
.dash-meta-row span:last-child { color: var(--paper); font-size: 11px; margin-top: 2px; }
.phos { color: var(--phos) !important; }

.bento-fit {
  flex: 1;
  display: block;
  overflow: hidden;
  min-height: 0;
  width: 100%;
}
.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 8px;
  height: 100%;
  width: 100%;
}
.cell {
  background: rgba(10,10,9,0.7);
  border: 1px solid var(--line);
  padding: 10px 12px;
  position: relative;
  transition: border-color 0.18s ease;
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.cell:hover { border-color: var(--line-2); }
.cell-h {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.cell-id { color: var(--accent); font-weight: 700; }
.cell-name { color: var(--paper); flex: 1; }
.cell-status { color: var(--ink-3); }
.cell-status.amber { color: var(--accent); }

/* Explicit grid placement — 5 rows × 12 cols, fills full area */
.cell-operator { grid-area: 1 / 1  / 3 / 5;  }
.cell-temporal { grid-area: 1 / 5  / 2 / 10; }
.cell-compute  { grid-area: 1 / 10 / 3 / 13; }
.cell-ingest   { grid-area: 2 / 5  / 4 / 10; }
.cell-watch    { grid-area: 3 / 1  / 5 / 6;  }
.cell-signals  { grid-area: 3 / 10 / 5 / 13; }
.cell-intel    { grid-area: 4 / 6  / 5 / 10; }
.cell-repo     { grid-area: 5 / 1  / 6 / 9;  }
.cell-ops      { grid-area: 5 / 9  / 6 / 13; }

/* 01 Operator */
.op-body { display: flex; gap: 12px; flex: 1; align-items: flex-start; min-height: 0; }
.op-avatar {
  width: 72px; height: 72px;
  border: 1px solid var(--accent);
  color: var(--accent);
  flex: 0 0 72px;
  background: rgba(255,138,26,0.04);
}
.op-avatar svg { width: 100%; height: 100%; }
.op-info { flex: 1; min-width: 0; }
.op-name { font-family: var(--mono); font-size: 18px; font-weight: 600; color: var(--paper); margin-bottom: 8px; letter-spacing: 0.02em; }
.op-name em { font-family: var(--serif); font-weight: 400; color: var(--accent); font-style: italic; }
.op-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; }
.op-meta span { color: var(--ink-3); display: block; margin-bottom: 2px; }
.op-meta strong { color: var(--paper); font-weight: 400; font-size: 10px; letter-spacing: 0.06em; }

/* 02 Temporal */
.temporal-body { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; flex: 1; min-height: 0; }
.greet-line { font-family: var(--serif); font-size: 22px; color: var(--paper); font-weight: 400; line-height: 1.15; }
.greet-line em { font-style: italic; color: var(--accent); }
.greet-date { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: var(--ink-3); margin-top: 6px; text-transform: uppercase; }
.clock { text-align: right; }
.clock-time {
  font-family: var(--mono); font-weight: 700;
  font-size: 42px; line-height: 1;
  color: var(--paper);
  letter-spacing: -0.02em;
  display: inline-flex; align-items: baseline; gap: 2px;
}
.clock-sep { color: var(--accent); animation: blink 1.1s steps(2) infinite; }
.clock-time sub { font-size: 14px; vertical-align: super; color: var(--accent); margin-left: 4px; font-weight: 400; }
.clock-iso { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--ink-3); margin-top: 4px; }

/* 03 Compute */
.compute-body { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; flex: 1; }
.metric { display: flex; flex-direction: column; gap: 4px; }
.metric-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; color: var(--ink-3); text-transform: uppercase; }
.metric-value { font-family: var(--mono); font-weight: 600; font-size: 22px; color: var(--paper); }
.metric-value small { font-size: 10px; color: var(--ink-3); margin-left: 3px; font-weight: 400; }
.metric-bar { height: 3px; background: var(--line); position: relative; overflow: hidden; }
.metric-bar > span { display: block; width: var(--w); height: 100%; background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.metric-spark { height: 24px; }

/* 04 Ingestion */
.ingest-list { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ingest-list li {
  display: grid;
  grid-template-columns: 48px 1fr 80px 40px;
  align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}
.ingest-list li:last-child { border-bottom: 0; }
.src-tag { color: var(--phos); font-weight: 600; letter-spacing: 0.12em; }
.src-tag.amber { color: var(--accent); }
.src-name { color: var(--ink); text-transform: capitalize; }
.src-bar { background: var(--line); height: 3px; position: relative; overflow: hidden; }
.src-bar > span { display: block; width: var(--w); height: 100%; background: var(--paper); opacity: 0.7; }
.src-num { color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; }

/* 05 Watchlist */
.watch-list { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.watch-list li {
  display: grid;
  grid-template-columns: 56px 1fr 80px 64px 56px;
  align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 11px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.watch-list li:last-child { border-bottom: 0; }
.sym { color: var(--paper); font-weight: 600; letter-spacing: 0.08em; }
.org { color: var(--ink-3); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.spark { height: 18px; }
.px { color: var(--paper); text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.dlt { text-align: right; font-size: 10px; font-variant-numeric: tabular-nums; }
.dlt.up { color: var(--phos); }
.dlt.dn { color: var(--red); }

/* 06 Signals */
.signal-list { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.sig {
  display: grid;
  grid-template-columns: 44px 1fr 36px;
  align-items: flex-start; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.sig:last-child { border-bottom: 0; }
.sig-badge {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em;
  padding: 3px 6px;
  border: 1px solid currentColor;
  text-align: center;
}
.sig-crit .sig-badge { color: var(--red); }
.sig-warn .sig-badge { color: var(--accent); }
.sig-info .sig-badge { color: var(--phos); }
.sig-head { font-family: var(--mono); font-size: 11px; color: var(--paper); margin-bottom: 2px; }
.sig-head em { color: var(--ink-3); font-style: normal; font-size: 9px; letter-spacing: 0.1em; }
.sig-sub { font-family: var(--mono); font-size: 10px; color: var(--ink-2); line-height: 1.45; }
.sig-time { font-family: var(--mono); font-size: 9px; color: var(--ink-3); text-align: right; padding-top: 4px; letter-spacing: 0.1em; }

/* 07 Intel */
.intel-list { display: flex; flex-direction: column; }
.intel-list li {
  display: grid;
  grid-template-columns: 44px 56px 1fr 64px;
  align-items: center; gap: 14px;
  font-family: var(--mono); font-size: 11px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.intel-list li:last-child { border-bottom: 0; }
.intel-list .src { color: var(--accent); font-weight: 700; letter-spacing: 0.1em; font-size: 9px; }
.intel-list .time { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 10px; }
.intel-list .head { color: var(--ink); line-height: 1.4; }
.intel-list .tag { color: var(--ink-3); text-align: right; letter-spacing: 0.1em; font-size: 9px; }

/* 08 Repo */
.repo-body { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; flex: 1; }
.repo-heatmap {
  display: grid;
  grid-template-columns: repeat(26, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 2px;
  align-content: center;
}
.heat-cell { aspect-ratio: 1; background: var(--line); }
.heat-cell.h1 { background: var(--accent); opacity: 0.25; }
.heat-cell.h2 { background: var(--accent); opacity: 0.5; }
.heat-cell.h3 { background: var(--accent); opacity: 0.75; }
.heat-cell.h4 { background: var(--accent); opacity: 1; box-shadow: 0 0 4px var(--accent-glow); }
.repo-side { display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.repo-stat { display: flex; flex-direction: column; gap: 4px; }
.rs-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; color: var(--ink-3); text-transform: uppercase; }
.rs-val { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--paper); }
.lang-bar { display: flex; height: 6px; background: var(--line); overflow: hidden; margin-top: 4px; }
.lb-seg { display: block; width: var(--w); background: var(--c); }
.lang-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--ink-2); }
.lang-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 4px; vertical-align: middle; }

/* 09 Ops */
.ops-body { flex: 1; display: flex; min-height: 0; }
.ops-locked {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 8px; padding: 8px;
  border: 1px dashed var(--accent); color: var(--accent);
  background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,138,26,0.04) 10px, rgba(255,138,26,0.04) 20px);
  min-height: 0;
}
.ops-locked svg { width: 22px; height: 22px; flex: 0 0 auto; }
.ops-title { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--accent); margin-bottom: 2px; }
.ops-sub { font-family: var(--mono); font-size: 9px; color: var(--ink-2); line-height: 1.4; }
.ops-unlock {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em;
  padding: 5px 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
  transition: all 0.18s ease;
}
.ops-unlock:hover { background: var(--accent); color: var(--bg); }
.ops-revealed { flex: 1; }
.ops-list { display: flex; flex-direction: column; gap: 8px; }
.ops-list li { display: grid; grid-template-columns: 18px 1fr 48px; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-family: var(--mono); font-size: 11px; }
.ops-list li:last-child { border-bottom: 0; }
.ck { width: 12px; height: 12px; border: 1px solid var(--ink-3); }
.ck.checked { background: var(--phos); border-color: var(--phos); }
.ops-list .ck.checked + span { color: var(--ink-3); text-decoration: line-through; }
.ops-time { color: var(--ink-3); font-size: 10px; letter-spacing: 0.1em; text-align: right; }

/* =============================================================
   03 — TRACK
   ============================================================= */

.track-head { margin-bottom: 22px; }
.track-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(40px, 5.5vw, 72px);
  letter-spacing: -0.01em;
  line-height: 0.9;
  margin: 0 0 14px;
  color: var(--paper);
}
.breadcrumb {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent);
  text-transform: uppercase;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: rgba(255,138,26,0.04);
  display: inline-block;
}

.track-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  min-height: 560px;
}

/* Tree */
.track-tree {
  background: rgba(10,10,9,0.85);
  border: 1px solid var(--line);
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}
.tree-head {
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
  display: flex; gap: 6px;
}
.prompt { color: var(--phos); }
.cmd { color: var(--paper); }

.tree { font-family: var(--mono); font-size: 12px; }
.tree li { padding-left: 0; }
.tree-folder, .tree-file {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  cursor: pointer;
  transition: all 0.14s ease;
  border-left: 2px solid transparent;
  user-select: none;
}
.tree-folder:hover, .tree-file:hover {
  background: rgba(255,138,26,0.06);
  border-left-color: var(--accent);
  color: var(--paper);
}
.tree-file.is-active {
  background: rgba(255,138,26,0.12);
  border-left-color: var(--accent);
  color: var(--accent);
}
.tree-folder { color: var(--paper); }
.tree-file { color: var(--ink); padding-left: 18px; font-size: 11px; }
.tree-file .file-ico { color: var(--ink-3); }
.tree-folder .fold-arr {
  display: inline-block; width: 10px;
  transition: transform 0.18s ease;
  color: var(--accent);
}
.tree-folder.is-open .fold-arr { transform: rotate(90deg); }
.tree-folder .fold-ico { color: var(--accent); }
.tree-children {
  margin-left: 14px;
  padding-left: 8px;
  border-left: 1px dashed var(--line);
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}
.tree-folder.is-open + .tree-children { max-height: 800px; }

/* Readout terminal */
.track-readout {
  background: #050504;
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.readout-tabs {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,138,26,0.04);
}
.rtab {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
  display: flex; align-items: center; gap: 6px;
  text-transform: uppercase;
}
.rtab-x { color: var(--accent); }
.rtab-actions { display: flex; gap: 4px; }
.rt-btn {
  font-family: var(--mono); font-size: 14px; color: var(--ink-3);
  width: 22px; height: 22px;
  display: grid; place-items: center;
}

.readout-body {
  flex: 1;
  padding: 24px 28px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  text-shadow: 0 0 4px rgba(255,138,26,0.45);
  line-height: 1.6;
  overflow-y: auto;
  max-height: 70vh;
}
.ro-placeholder { color: var(--ink-3); }
.ro-placeholder .ascii-art {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.3;
  text-shadow: 0 0 6px var(--accent-glow);
  white-space: pre;
}
.placeholder-hint { font-family: var(--mono); font-size: 11px; color: var(--ink-2); margin-top: 14px; }
.placeholder-hint em { color: var(--accent); font-style: normal; }

.ro-stream-head {
  color: var(--phos);
  margin-bottom: 14px;
  font-size: 12px;
  letter-spacing: 0.1em;
}
.ro-meta {
  border: 1px dashed var(--line);
  padding: 8px 12px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  font-size: 11px;
  color: var(--ink-2);
}
.ro-meta span { display: block; font-size: 9px; color: var(--ink-3); letter-spacing: 0.18em; margin-bottom: 2px; text-transform: uppercase; }
.ro-meta strong { color: var(--paper); font-weight: 500; }
.ro-section-head {
  color: var(--paper);
  font-size: 14px;
  letter-spacing: 0.08em;
  margin: 18px 0 10px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.ro-line {
  display: block;
  padding: 3px 0;
  color: var(--accent);
}
.ro-line::before {
  content: '> ';
  color: var(--phos);
}
.ro-line em { color: var(--paper); font-style: normal; }
.ro-cursor {
  display: inline-block;
  width: 8px; height: 14px;
  background: var(--accent);
  vertical-align: middle;
  animation: blink 1.1s steps(2) infinite;
  margin-left: 2px;
}

/* =============================================================
   Tweaks panel
   ============================================================= */

.tweaks-panel {
  position: fixed;
  right: calc(var(--rail-r) + 16px);
  bottom: 16px;
  z-index: 80;
  width: 280px;
  background: rgba(8,8,7,0.95);
  border: 1px solid var(--accent);
  box-shadow: 0 0 40px rgba(255,138,26,0.18);
}
.tw-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px;
  border-bottom: 1px dashed var(--line);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
}
.tw-close {
  font-size: 18px; color: var(--ink-2);
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
}
.tw-close:hover { color: var(--accent); border-color: var(--accent); }
.tw-body { padding: 14px; display: flex; flex-direction: column; gap: 18px; }
.tw-group { display: flex; flex-direction: column; gap: 8px; }
.tw-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em; color: var(--ink-3); text-transform: uppercase; }
.tw-options { display: flex; gap: 6px; flex-wrap: wrap; }
.tw-swatch {
  width: 38px; height: 38px;
  border: 1px solid var(--line);
  background: var(--c);
  font-family: var(--mono); font-size: 0;
  position: relative;
  transition: all 0.16s ease;
}
.tw-swatch::after {
  content: attr(data-val);
  position: absolute; bottom: -16px; left: 0; right: 0;
  font-size: 8px; color: var(--ink-3); letter-spacing: 0.1em;
  text-align: center;
}
.tw-swatch:hover, .tw-swatch.is-on { border-color: var(--accent); transform: translateY(-1px); }
.tw-swatch.is-on { outline: 1px solid var(--accent); outline-offset: 2px; }
.tw-pill {
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink-2);
  text-transform: uppercase;
  transition: all 0.16s ease;
}
.tw-pill:hover { color: var(--paper); border-color: var(--ink-3); }
.tw-pill.is-on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
#tw-crt { width: 100%; accent-color: var(--accent); }
.tw-meta { font-family: var(--mono); font-size: 10px; color: var(--accent); text-align: right; }
.tw-hint { font-family: var(--mono); font-size: 9px; color: var(--ink-3); letter-spacing: 0.08em; margin-top: 4px; }

/* =============================================================
   Responsive
   ============================================================= */

@media (max-width: 1100px) {
  :root { --rail-l: 240px; }
  .stage { padding: 24px 28px; }
  /* Allow scroll on narrow viewports — strict viewport is desktop-only */
  .page.page-assistant.is-active {
    height: auto;
    overflow: visible;
    margin: 0;
    padding: 0;
  }
  .bento-fit { overflow: visible; }
  .bento {
    grid-template-rows: repeat(8, minmax(160px, auto));
    height: auto;
  }
  .cell-operator { grid-area: 1 / 1 / 3 / 7; }
  .cell-temporal { grid-area: 1 / 7 / 2 / 13; }
  .cell-compute  { grid-area: 2 / 7 / 4 / 13; }
  .cell-ingest   { grid-area: 3 / 1 / 5 / 7; }
  .cell-watch    { grid-area: 4 / 7 / 6 / 13; }
  .cell-signals  { grid-area: 5 / 1 / 7 / 7; }
  .cell-intel    { grid-area: 6 / 7 / 7 / 13; }
  .cell-repo     { grid-area: 7 / 1 / 9 / 9; }
  .cell-ops      { grid-area: 7 / 9 / 9 / 13; }
}
@media (max-width: 820px) {
  :root { --rail-l: 60px; }
  .menu-body, .menu-arrow, .brand-text, .syssum, .ctrl-label { display: none; }
  .menu-item { grid-template-columns: 1fr; justify-items: center; }
  .menu-id { font-size: 14px; }
  .research-grid { grid-template-columns: 1fr; }
  .track-shell { grid-template-columns: 1fr; }
  .core-fact-grid { grid-template-columns: repeat(2, 1fr); }
  .fact { border-right: 0; border-bottom: 1px dashed var(--line); padding: 8px 0; }
  .core-name { font-size: 48px; }
}
