:root {
  --bg: #0a0a0a;
  --bg-elevated: #141414;
  --bg-panel: #181818;
  --border: #2a2a2a;
  --border-bright: #3a3a3a;
  --accent: #f0c020;
  --accent-dim: #b8920c;
  --accent-glow: rgba(240, 192, 32, 0.25);
  --text: #e8e8e8;
  --text-dim: #8a8a8a;
  --fg-faint: #555;
  --cyan: #7be0e0;
  --danger: #ff4444;
  --success: #4caf50;
  --mono: "Berkeley Mono", "JetBrains Mono", "SF Mono", "Cascadia Code",
    Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ───────────────────── CRT / VHS overlays (CSS-only) ───────────────────── */

.crt-scanlines,
.crt-tracking,
.crt-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9000;
}

/* fine horizontal scanlines */
.crt-scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(0, 0, 0, 0.22) 4px
  );
  mix-blend-mode: multiply;
  opacity: 0.7;
}

/* a single bright "tracking" band that drifts down the screen */
.crt-tracking {
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(123, 224, 224, 0.05) 45%,
    rgba(255, 255, 255, 0.10) 50%,
    rgba(123, 224, 224, 0.05) 55%,
    rgba(255, 255, 255, 0) 100%
  );
  height: 22%;
  top: -22%;
  opacity: 0.6;
  animation: tracking-roll 7s linear infinite;
}

@keyframes tracking-roll {
  0%   { top: -22%; }
  92%  { top: 100%; }
  92.5%{ top: 100%; }
  100% { top: -22%; }
}

/* soft darkened corners */
.crt-vignette {
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 55%,
    rgba(0, 0, 0, 0.55) 100%
  );
}

/* whole-page chroma wobble + flicker (very subtle) */
@keyframes chroma-wobble {
  0%, 100% { transform: translateX(0); filter: none; }
  48%      { transform: translateX(0.4px); }
  49%      { transform: translateX(-0.6px); filter: hue-rotate(2deg); }
  50%      { transform: translateX(0.5px); }
  52%      { transform: translateX(0); filter: none; }
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  3%   { opacity: 0.96; }
  6%   { opacity: 1; }
  55%  { opacity: 0.985; }
  56%  { opacity: 1; }
}

main {
  flex: 1;
  padding: 0 0 32px;
  width: 100%;
  animation: chroma-wobble 5.5s steps(60) infinite, flicker 6s ease-in-out infinite;
}

/* ───────────────────── shared chrome (eagle5 lineage) ───────────────────── */

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

header.site {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.site .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1rem 1.75rem;
  padding-top: 1.25rem;
  padding-bottom: 1rem;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-size: 1.05rem;
  white-space: nowrap;
}
.brand::before { content: "» "; color: var(--fg-faint); }

nav.main { display: flex; flex-wrap: wrap; gap: 0 1.25rem; font-size: 0.92rem; }
nav.main .tag { color: var(--cyan); }

.title-strip {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 0 1rem;
  margin-bottom: 1rem;
}
.title-strip h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  color: var(--accent);
  letter-spacing: 0.03em;
}
.title-strip h1::before { content: "# "; color: var(--fg-faint); }
.title-strip .tagline {
  color: var(--text-dim);
  font-style: italic;
  margin: 0;
  font-size: 0.95rem;
}

.dim { color: var(--fg-faint); }
.hidden { display: none !important; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 2px solid var(--cyan);
  border-radius: 4px;
  padding: 20px;
  margin-bottom: 20px;
}

.panel h2 {
  color: var(--accent);
  font-size: 14px;
  letter-spacing: 2px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--cyan);
}

/* ───────────────────── insert-tape drop zone ───────────────────── */

.drop-zone {
  border: 2px dashed var(--border-bright);
  border-radius: 6px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(240, 192, 32, 0.04);
  box-shadow: inset 0 0 24px var(--accent-glow);
  outline: none;
}

/* little tape cartridge glyph */
.tape-glyph {
  width: 120px;
  height: 56px;
  border: 2px solid var(--border-bright);
  border-radius: 5px;
  background: linear-gradient(180deg, #222, #111);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  position: relative;
}
.tape-glyph::after {
  content: "";
  position: absolute;
  bottom: 7px;
  left: 12px; right: 12px;
  height: 8px;
  background: #050505;
  border-radius: 2px;
}
.tape-glyph .reel {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 3px solid var(--accent-dim);
  background: radial-gradient(circle, #000 35%, #1a1a1a 40%);
  animation: reel-spin 3.5s linear infinite;
}
.drop-zone:hover .tape-glyph .reel,
.drop-zone.dragover .tape-glyph .reel { border-color: var(--accent); }
@keyframes reel-spin { to { transform: rotate(360deg); } }

.drop-text { color: var(--text); font-size: 14px; letter-spacing: 1px; }
.drop-text .small { color: var(--text-dim); font-size: 11px; letter-spacing: 1px; }

.tape-info {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-dim);
}
.tape-info.error { border-color: var(--danger); color: var(--danger); }
.tape-info b { color: var(--accent); }

/* ───────────────────── CRT screen ───────────────────── */

.screen-panel { border-left-color: var(--accent); }

.crt-bezel {
  position: relative;
  background: #000;
  border: 10px solid #1c1c1c;
  border-radius: 14px / 22px;
  box-shadow:
    inset 0 0 60px rgba(0,0,0,0.9),
    inset 0 0 8px var(--accent-glow),
    0 0 0 2px #000;
  padding: 16px 10px;
  overflow: hidden;
}

.screen {
  position: relative;
  z-index: 1;
  color: var(--accent);
  background: transparent;
  font-family: var(--mono);
  font-size: clamp(7px, 1.55vw, 15px);
  line-height: 1.0;
  letter-spacing: 0;
  white-space: pre;
  text-align: left;
  margin: 0 auto;
  min-height: 14em;
  display: block;
  width: max-content;
  max-width: 100%;
  text-shadow: 0 0 3px var(--accent-glow), 0 0 1px rgba(240,192,32,0.5);
}

/* curved glass glare over the tube */
.crt-glass {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 18%),
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px,
      rgba(0,0,0,0.18) 3px, rgba(0,0,0,0.18) 4px
    );
  border-radius: 10px;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.7);
}

/* ───────────────────── transport controls ───────────────────── */

.transport {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.deck-btn {
  background: linear-gradient(180deg, #232323, #151515);
  border: 1px solid var(--border-bright);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 1.5px;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.12s ease;
  box-shadow: 0 2px 0 #000, inset 0 1px 0 rgba(255,255,255,0.04);
  flex: 1;
  min-width: 96px;
}
.deck-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 0 #000, 0 0 12px var(--accent-glow);
}
.deck-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 2px 4px #000; }
.deck-btn.play { border-color: var(--accent-dim); color: var(--accent); }
.deck-btn.engaged {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #000;
  border-color: var(--accent);
}
.deck-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* scrub + readout */
.scrub-row { margin-top: 16px; }
.scrub {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.scrub:disabled { opacity: 0.4; cursor: not-allowed; }
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 3px;
  background: var(--accent);
  border: 1px solid #000;
  box-shadow: 0 0 8px var(--accent-glow);
  cursor: pointer;
}
.scrub::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 3px;
  background: var(--accent);
  border: 1px solid #000;
  cursor: pointer;
}

.readout {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 12px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.readout .counter { color: var(--accent); }
.readout .speed { color: var(--cyan); }
.readout .state { color: var(--text-dim); }
.readout .state.playing { color: var(--success); }

/* ───────────────────── footer ───────────────────── */

footer.site {
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding: 1.5rem 0 2rem;
  color: var(--fg-faint);
  font-size: 0.85rem;
  flex-shrink: 0;
}
footer.site .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
}
footer.site .credit { color: var(--text-dim); }

/* respect reduced-motion: kill the moving CRT bits */
@media (prefers-reduced-motion: reduce) {
  .crt-tracking,
  .tape-glyph .reel { animation: none; }
  main { animation: none; }
}

/* ── phone polish (<=560px) ──────────────────────────────── */
@media (max-width: 560px) {
  .wrap { padding: 0 0.9rem; }
  header.site .wrap { gap: 0.45rem 1rem; padding-top: 1rem; }
  nav.main { gap: 0.1rem 0.9rem; font-size: 0.88rem; }
  nav.main a { padding: 0.32rem 0; }
  .title-strip h1 { font-size: 1.25rem; }
}
/* ── Spaceballs display-font polish (Orbitron) — additive, cascades last ── */
:root { --display: "Orbitron", var(--mono); }

.brand {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-shadow: 0 0 8px rgba(240,192,32,0.35), 0 1px 2px rgba(0,0,0,0.8);
}
.brand::before {            /* keep the » glyph mono + untracked */
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: normal;
  text-shadow: none;
}

.title-strip h1 {
  font-family: var(--display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-shadow: 0 0 10px rgba(240,192,32,0.3), 0 1px 3px rgba(0,0,0,0.9);
}
.title-strip h1::before {   /* keep the # prefix mono */
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: normal;
  text-shadow: none;
}

@media (max-width: 560px) {
  .title-strip h1 { letter-spacing: 0.03em; }
  .brand { letter-spacing: 0.08em; }
}
/* ── Orbitron on nav + section headers (h2/h3), prefixes stay mono ── */
nav.main a {
  font-family: var(--display);
  letter-spacing: 0.06em;
}
nav.main a::before { font-family: var(--mono); letter-spacing: normal; }

h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
h2::before, h3::before { font-family: var(--mono); font-weight: 400; letter-spacing: normal; }
/* ── Exo 2 body to pair with Orbitron (prose only; console/code stay mono) ── */
:root { --sans: "Exo 2", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Helvetica, Arial, sans-serif; }
p, ul, ol, li, .muted, .dim, .lede, .note, .tagline, blockquote { font-family: var(--sans); }
code, pre, kbd { font-family: var(--mono); }
