/* ════════════════════════════════════════════════════════════
   HACKEFUFFEL 1337 — phosphor stylesheet
   ════════════════════════════════════════════════════════════ */

/* Self-hosted fonts (SIL Open Font License, see fonts/) */
/* cyrillic-ext */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/press-start-2p-cyrillic-ext.woff2) format('woff2');
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/press-start-2p-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/press-start-2p-greek.woff2) format('woff2');
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* latin-ext */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/press-start-2p-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/press-start-2p-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* vietnamese */
@font-face {
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/vt323-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/vt323-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/vt323-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


:root {
  --pixel: "Press Start 2P", "Courier New", monospace;
  --term: "VT323", "Lucida Console", "Courier New", monospace;
  --tl-h: 158px;
}

/* ── Phosphor themes ─────────────────────────────────────── */
.theme-green {
  --fg: #46ff8a; --fg-rgb: 70, 255, 138;
  --dim: #1f9f52; --faint: #0f4a27;
  --bg: #020f07; --bg2: #041a0c;
  --hi: #d8ffe6;
  --glow: rgba(70, 255, 138, .55);
}
.theme-amber {
  --fg: #ffb437; --fg-rgb: 255, 180, 55;
  --dim: #b8741a; --faint: #4d2f07;
  --bg: #120a01; --bg2: #1d1103;
  --hi: #fff0cf;
  --glow: rgba(255, 170, 40, .55);
}
.theme-c64 {
  --fg: #a7a0ff; --fg-rgb: 167, 160, 255;
  --dim: #7b70e0; --faint: #4a3fb0;
  --bg: #352879; --bg2: #3e3190;
  --hi: #ffffff;
  --glow: rgba(167, 160, 255, .45);
}
.theme-white {
  --fg: #dfe9ff; --fg-rgb: 223, 233, 255;
  --dim: #8592ad; --faint: #2d3445;
  --bg: #07090e; --bg2: #0d1119;
  --hi: #ffffff;
  --glow: rgba(190, 210, 255, .45);
}
.theme-plasma {   /* gas-plasma laptop display (GRiD, Toshiba T3100) */
  --fg: #ff6a1f; --fg-rgb: 255, 106, 31;
  --dim: #b5420f; --faint: #4a1a06;
  --bg: #120400; --bg2: #1e0802;
  --hi: #ffd2b0;
  --glow: rgba(255, 90, 20, .6);
}
.theme-vfd {      /* vacuum-fluorescent display */
  --fg: #4ff5dc; --fg-rgb: 79, 245, 220;
  --dim: #1f9e8c; --faint: #0b4038;
  --bg: #010d0c; --bg2: #031816;
  --hi: #d6fff8;
  --glow: rgba(60, 240, 210, .55);
}
.theme-cga {      /* CGA palette 1 magenta on black */
  --fg: #ff55ff; --fg-rgb: 255, 85, 255;
  --dim: #b03cb0; --faint: #4a1450;
  --bg: #0c020e; --bg2: #160519;
  --hi: #55ffff;
  --glow: rgba(255, 85, 255, .5);
}
.theme-lcd {      /* reflective handheld LCD: dark pixels on grey-green */
  --fg: #1e2a14; --fg-rgb: 30, 42, 20;
  --dim: #34422a; --faint: #8e9d78;
  --bg: #a9b893; --bg2: #b8c6a2;
  --hi: #0c1406;
  --glow: rgba(30, 42, 20, .18);
  --tint: #bccaa4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 30%, #3a352c 0%, #1a1814 55%, #0b0a08 100%);
  font-family: var(--term);
  color: var(--fg);
}

::selection { background: var(--fg); color: var(--bg); text-shadow: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* ── Bezel (the beige plastic monitor case) ──────────────── */
.bezel {
  position: absolute;
  inset: 10px;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 0;
  border-radius: 22px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(170deg, #e4dcc6 0%, #d3c9ae 45%, #bdb294 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.6),
    inset 0 -4px 0 rgba(0,0,0,.18),
    inset 4px 0 8px rgba(255,255,255,.15),
    0 30px 60px rgba(0,0,0,.6),
    0 6px 14px rgba(0,0,0,.5);
}

.bezel-bottom {
  height: 46px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-family: var(--pixel);
  font-size: 9px;
  color: #6b634f;
  letter-spacing: 1px;
}
.badge-plate {
  padding: 6px 10px;
  border-radius: 3px;
  background: linear-gradient(#5a5446, #3c372c);
  color: #e8dfc6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 0 rgba(255,255,255,.5);
  text-shadow: 0 -1px 0 #000;
}
.badge-plate b { color: #ff7a3b; }
.vents { display: flex; gap: 6px; }
.vents i {
  display: block; width: 46px; height: 5px; border-radius: 3px;
  background: #8f8670;
  box-shadow: inset 0 2px 2px rgba(0,0,0,.55), 0 1px 0 rgba(255,255,255,.55);
}
.power { display: flex; align-items: center; gap: 10px; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.led {
  width: 10px; height: 10px; border-radius: 50%;
  background: #4bff5a;
  box-shadow: 0 0 6px #4bff5a, 0 0 14px #4bff5a, inset 0 -2px 2px rgba(0,0,0,.3);
  transition: background .05s, box-shadow .05s;
}
.led.busy { background: #ffb02e; box-shadow: 0 0 6px #ffb02e, 0 0 14px #ffb02e; }

/* ── The CRT screen ──────────────────────────────────────── */
.screen {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 26px / 22px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 45%, var(--bg2) 0%, var(--bg) 70%, #000 120%);
  box-shadow:
    0 0 0 3px #2b2820,
    0 0 0 6px #8c8268,
    0 0 0 8px #5e5746,
    inset 0 0 120px rgba(0,0,0,.75),
    inset 0 0 18px rgba(0,0,0,.9);
  text-shadow: 0 0 1px var(--fg), 0 0 7px var(--glow);
  animation: flicker 6s infinite steps(1);
}

/* scanlines + chroma mask */
.crt::before {
  content: "";
  position: absolute; inset: 0;
  z-index: 50;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.28) 0px, rgba(0,0,0,.28) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(to right, rgba(255,0,0,.025) 0 1px, rgba(0,255,0,.02) 1px 2px, rgba(0,0,255,.025) 2px 3px);
}
/* vignette + glass reflection */
.crt::after {
  content: "";
  position: absolute; inset: 0;
  z-index: 51;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 58%, rgba(0,0,0,.55) 100%),
    linear-gradient(155deg, rgba(255,255,255,.07) 0%, rgba(255,255,255,.015) 28%, transparent 40%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.6);
}

.scanbar {
  position: absolute; left: 0; right: 0; top: -20%;
  height: 18%;
  z-index: 49;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(var(--fg-rgb), .045) 50%, transparent);
  animation: scanbar 7.5s linear infinite;
}
@keyframes scanbar { to { top: 110%; } }

@keyframes flicker {
  0%   { opacity: 1; }
  47%  { opacity: .985; }
  48%  { opacity: 1; }
  77%  { opacity: .975; }
  78%  { opacity: 1; }
  92%  { opacity: .99; }
}

/* static noise burst used on channel change */
.static {
  position: absolute; inset: 0;
  z-index: 48;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background-size: 256px 256px;
}
.static.on { animation: staticburst .32s steps(6) forwards; }
@keyframes staticburst {
  0%   { opacity: .55; background-position: 0 0; }
  20%  { background-position: 60px 90px; }
  40%  { opacity: .35; background-position: -120px 40px; }
  60%  { background-position: 30px -70px; }
  80%  { opacity: .12; background-position: -40px 10px; }
  100% { opacity: 0; background-position: 0 0; }
}

/* ── Boot sequence ───────────────────────────────────────── */
.boot {
  position: absolute; inset: 0;
  z-index: 40;
  background: var(--bg);
  padding: 40px 48px;
  font-size: 26px;
  line-height: 1.15;
  transition: opacity .5s, filter .5s;
}
.boot pre { margin: 0; font-family: var(--term); white-space: pre-wrap; }
.boot.gone { opacity: 0; filter: brightness(3) blur(2px); pointer-events: none; }
.boot .cursor, .cursor {
  display: inline-block;
  width: .6em; height: 1em;
  vertical-align: -0.12em;
  background: var(--fg);
  box-shadow: 0 0 8px var(--glow);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.blink { animation: blink 1.1s steps(1) infinite; }

/* power-on effect */
.screen.poweron { animation: poweron .9s ease-out, flicker 6s 1s infinite steps(1); }
@keyframes poweron {
  0%   { filter: brightness(0); transform: scale(1, .004); }
  25%  { filter: brightness(4); transform: scale(1, .004); }
  45%  { filter: brightness(2); transform: scale(1, 1); }
  100% { filter: brightness(1); transform: scale(1, 1); }
}

/* ── Menu bar ────────────────────────────────────────────── */
.menubar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 26px 8px;
  border-bottom: 2px solid var(--fg);
  box-shadow: 0 2px 10px -4px var(--glow);
  font-size: 20px;
  white-space: nowrap;
  position: relative;
  z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-logo { font-size: 22px; letter-spacing: -3px; }
.brand-name { font-family: var(--pixel); font-size: 13px; letter-spacing: 2px; }
.brand-ver { color: var(--dim); }
.progress { flex: 1; min-width: 0; overflow: hidden; color: var(--dim); letter-spacing: 0; text-align: center; }
.progress b { color: var(--fg); font-weight: normal; }
.menu { display: flex; gap: 4px; }
.mbtn {
  padding: 1px 8px;
  border: 1px solid transparent;
}
.mbtn:hover, .mbtn:focus-visible {
  background: var(--fg); color: var(--bg); text-shadow: none; outline: none;
  box-shadow: 0 0 12px var(--glow);
}

/* ── Exhibit layout ──────────────────────────────────────── */
.exhibit {
  flex: 1;
  min-height: 0;
  display: grid;
  /* wide: photo | heading + specs | history + facts */
  grid-template-columns: minmax(0, 34fr) minmax(0, 30fr) minmax(0, 36fr);
  grid-template-areas: "photo mid text";
  align-items: start;
  gap: 34px;
  padding: 24px 34px 18px;
  overflow-y: auto;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: var(--dim) transparent;
  position: relative;
  container-type: size;
}
.exhibit::-webkit-scrollbar { width: 10px; }
.exhibit::-webkit-scrollbar-thumb { background: var(--dim); border: 3px solid var(--bg); }

.exhibit.switching { animation: jolt .32s steps(4); }
@keyframes jolt {
  0%   { transform: translateX(0) skewX(0); filter: none; }
  25%  { transform: translateX(-6px) skewX(4deg); filter: blur(1px) brightness(1.6); }
  50%  { transform: translateX(5px) skewX(-3deg); filter: brightness(.7); }
  75%  { transform: translateX(-2px); filter: blur(.5px); }
  100% { transform: none; filter: none; }
}

.col { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.col-photo { grid-area: photo; }
.col-mid   { grid-area: mid; }
.col-text  { grid-area: text; }
/* the photo column is exactly one screen tall and stays put while text scrolls */
.col-photo {
  position: sticky;
  top: 0;
  height: 100cqh;
}

/* medium widths: photo on the left, heading + specs then history + facts on the right */
@media (min-width: 981px) and (max-width: 1399px) {
  .exhibit {
    grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
    grid-template-areas: "photo mid" "photo text";
  }
}

/* ── Photo ───────────────────────────────────────────────── */
.photo { margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.photo-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 10px;
  border: 2px solid var(--fg);
  box-shadow: 0 0 14px -2px var(--glow), inset 0 0 14px -4px var(--glow);
}
.photo-corner { position: absolute; width: 14px; height: 14px; border: 0 solid var(--hi); }
.photo-corner.tl { top: -6px; left: -6px; border-top-width: 4px; border-left-width: 4px; }
.photo-corner.tr { top: -6px; right: -6px; border-top-width: 4px; border-right-width: 4px; }
.photo-corner.bl { bottom: -6px; left: -6px; border-bottom-width: 4px; border-left-width: 4px; }
.photo-corner.br { bottom: -6px; right: -6px; border-bottom-width: 4px; border-right-width: 4px; }

.photo-inner {
  position: relative;
  flex: 1;
  min-height: 150px;
  overflow: hidden;
  background: #000;
  display: grid;
  place-items: center;
}
.photo-inner img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  filter: grayscale(1) contrast(1.25) brightness(var(--boost, 1.05));
  opacity: 0;
  transition: filter .6s, opacity .5s;
  image-rendering: auto;
}
.photo-inner img.ready { opacity: 1; }
/* phosphor tint layer */
.photo-inner::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--tint, var(--fg));
  mix-blend-mode: multiply;
  transition: opacity .6s;
  pointer-events: none;
}
/* scanlines + dot mask on the photo */
.photo-inner::before {
  content: "";
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.35) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
}
.photo-inner:hover img, body.truecolor .photo-inner img { filter: none; }
.photo-inner:hover::after, body.truecolor .photo-inner::after { opacity: 0; }

.ascii {
  margin: 0;
  font-family: "DejaVu Sans Mono", "Cascadia Mono", Consolas, Menlo, monospace;
  font-size: clamp(9px, 1vw, 13px);
  line-height: 1.15;
  color: var(--fg);
  position: relative;
  z-index: 3;
  white-space: pre;
}
.ascii:empty { display: none; }
.photo-loading {
  position: absolute; left: 0; right: 0; bottom: 14px;
  z-index: 3;
  text-align: center;
  font-size: 20px;
  color: var(--fg);
  mix-blend-mode: normal;
}
.photo-loading:empty { display: none; }

figcaption {
  flex: none;
  margin-top: 8px;
  font-size: 17px;
  color: var(--dim);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
figcaption a { color: var(--dim); }
figcaption a:hover { color: var(--fg); }

/* ── Panels ──────────────────────────────────────────────── */
.panel {
  position: relative;
  border: 3px double var(--fg);
  padding: 22px 20px 16px;
  box-shadow: 0 0 12px -4px var(--glow);
}
.panel-title {
  position: absolute;
  top: -11px; left: 16px;
  margin: 0;
  font-family: var(--pixel);
  font-size: 11px;
  font-weight: normal;
  letter-spacing: 1px;
}
.panel-title span {
  background: var(--bg);
  padding: 2px 10px;
  box-shadow: 0 0 0 1px var(--bg);
}
.panel-title span::before { content: "▶ "; color: var(--dim); }

/* specs with dotted leaders */
.specs dl { margin: 0; font-size: 21px; line-height: 1.2; }
.spec-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  opacity: 0;
  animation: rowin .25s forwards;
}
.spec-row dt { flex: none; color: var(--dim); text-transform: uppercase; }
.spec-row .lead { flex: 1; min-width: 14px; border-bottom: 2px dotted var(--faint); transform: translateY(-4px); }
.spec-row dd { margin: 0; text-align: right; max-width: 62%; color: var(--hi); }
@keyframes rowin { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

/* ── Exhibit header ──────────────────────────────────────── */
.exhibit-head { position: relative; }
.exhibit-no { font-size: 19px; color: var(--dim); letter-spacing: 2px; }
.year {
  font-family: var(--pixel);
  font-size: clamp(44px, 5.4vw, 88px);
  line-height: 1;
  margin: 6px 0 12px;
  color: transparent;
  -webkit-text-stroke: 2px var(--fg);
  text-shadow: 6px 6px 0 var(--faint), 0 0 18px var(--glow);
  letter-spacing: 4px;
  user-select: none;
}
.name {
  margin: 0;
  font-family: var(--pixel);
  font-weight: normal;
  font-size: clamp(20px, 2.5vw, 34px);
  line-height: 1.35;
  color: var(--hi);
  text-shadow: 0 0 2px var(--fg), 0 0 14px var(--glow), 3px 3px 0 var(--faint);
  min-height: 1.35em;
  word-break: break-word;
}
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; font-size: 19px; }
.badge {
  padding: 0 8px;
  border: 1px solid var(--fg);
  white-space: nowrap;
}
.badge.inv { background: var(--fg); color: var(--bg); text-shadow: none; box-shadow: 0 0 10px var(--glow); }
.tagline { margin: 6px 0 0; font-size: 27px; line-height: 1.1; color: var(--fg); }
.tagline::before { content: "» "; color: var(--dim); }

/* history */
.history p {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.22;
  opacity: 0;
  animation: rowin .4s forwards;
}
.history p:last-child { margin-bottom: 0; }
.history p:first-child::first-letter {
  font-family: var(--pixel);
  font-size: 34px;
  float: left;
  line-height: 1;
  margin: 4px 10px 0 0;
  padding: 6px;
  background: var(--fg);
  color: var(--bg);
  text-shadow: none;
  box-shadow: 0 0 12px var(--glow);
}

/* facts */
.facts ul { list-style: none; margin: 0; padding: 0; }
.facts li {
  position: relative;
  padding: 6px 0 6px 40px;
  font-size: 22px;
  line-height: 1.2;
  opacity: 0;
  animation: rowin .4s forwards;
}
.facts li + li { border-top: 1px dashed var(--faint); }
.facts li::before {
  content: attr(data-n);
  position: absolute; left: 0; top: 8px;
  font-family: var(--pixel);
  font-size: 11px;
  padding: 3px 4px;
  border: 1px solid var(--fg);
}

/* neighbours */
.neighbours { display: flex; justify-content: space-between; gap: 16px; font-size: 20px; margin-top: auto; padding-top: 4px; }
.nbtn { color: var(--dim); max-width: 48%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 6px; }
.nbtn:last-child { text-align: right; }
.nbtn:hover { color: var(--bg); background: var(--fg); text-shadow: none; }
.nbtn .key { color: var(--fg); }
.nbtn:hover .key { color: var(--bg); }
.nbtn:disabled { visibility: hidden; }

/* ── Timeline ────────────────────────────────────────────── */
.timeline-wrap {
  flex: none;
  height: var(--tl-h);
  position: relative;
  display: flex;
  border-top: 2px solid var(--fg);
  box-shadow: 0 -2px 12px -4px var(--glow);
  background: linear-gradient(to bottom, rgba(var(--fg-rgb), .05), transparent 40%);
  z-index: 5;
}
.tl-arrow {
  flex: none;
  width: 44px;
  font-size: 22px;
  color: var(--fg);
  position: relative;
  z-index: 3;
}
.tl-arrow:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.tl-arrow.left { border-right: 1px solid var(--faint); }
.tl-arrow.right { border-left: 1px solid var(--faint); }

.timeline {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--fg) var(--faint);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 50px, #000 calc(100% - 50px), transparent);
          mask-image: linear-gradient(to right, transparent, #000 50px, #000 calc(100% - 50px), transparent);
}
.timeline::-webkit-scrollbar { height: 8px; }
.timeline::-webkit-scrollbar-track { background: var(--faint); }
.timeline::-webkit-scrollbar-thumb { background: var(--fg); }

.tl-track {
  position: relative;
  display: flex;
  align-items: stretch;
  height: 100%;
  padding: 0 50%;
  width: max-content;
}
/* the rail */
.tl-track::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 62px;
  height: 0;
  border-top: 2px solid var(--fg);
  box-shadow: 0 0 8px var(--glow);
}

.tl-era {
  position: absolute;
  top: 8px;
  height: 18px;
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--dim);
  border-left: 1px solid var(--dim);
  padding: 4px 0 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-shadow: none;
}
.tl-era::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 0;
  border-top: 1px dashed var(--faint);
}

.tl-node {
  position: relative;
  flex: none;
  width: 112px;
  padding-top: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--dim);
  cursor: pointer;
  transition: color .15s;
}
.tl-node:hover { color: var(--fg); }
.tl-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--bg);
  border: 2px solid currentColor;
  position: relative;
  z-index: 1;
  transition: transform .15s, background .15s, box-shadow .15s;
}
.tl-icon svg { width: 24px; height: 24px; display: block; }
.tl-icon svg rect { fill: currentColor; }
.tl-year {
  margin-top: 6px;
  font-size: 20px;
  line-height: 1;
}
.tl-year.first { color: var(--fg); }
.tl-name {
  margin-top: 4px;
  width: 104px;
  font-size: 17px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-node:hover .tl-icon { transform: translateY(-3px); }
.tl-node.active { color: var(--hi); }
.tl-node.active .tl-icon {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  transform: scale(1.18);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--fg), 0 0 22px var(--glow);
}
.tl-node.active .tl-icon svg rect { fill: var(--bg); }
.tl-node.active .tl-year { font-family: var(--pixel); font-size: 11px; margin-top: 12px; color: var(--hi); }
.tl-node.active .tl-name { color: var(--fg); }
.tl-node.active::before {
  content: "▼";
  position: absolute;
  top: 10px;
  font-size: 18px;
  color: var(--fg);
  animation: bob 1s steps(2) infinite;
}
@keyframes bob { 50% { transform: translateY(3px); } }

.tl-gap {
  flex: none;
  width: 54px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--dim);
  font-size: 15px;
  line-height: 1;
  padding-top: 52px;
}
.tl-gap .zig {
  font-family: var(--pixel);
  font-size: 16px;
  background: var(--bg);
  position: relative;
  z-index: 1;
  padding: 0 2px;
  color: var(--fg);
}
.tl-gap span { margin-top: 10px; white-space: nowrap; }

/* ── GOTO + help modals ──────────────────────────────────── */
.goto, .help {
  position: absolute; inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.55);
}
.goto[hidden], .help[hidden] { display: none; }
.goto-box, .help-box {
  width: min(620px, 90%);
  background: var(--bg);
  border: 3px double var(--fg);
  box-shadow: 0 0 0 6px var(--bg), 0 0 30px var(--glow);
  padding: 22px 24px;
  font-size: 24px;
}
.goto-box label { color: var(--dim); }
.goto-box input {
  width: calc(100% - 110px);
  background: transparent;
  border: 0;
  outline: none;
  color: var(--hi);
  font: inherit;
  text-shadow: inherit;
  caret-color: var(--fg);
}
.goto-box input::placeholder { color: var(--faint); }
.goto-box ul { list-style: none; padding: 0; margin: 14px 0 0; max-height: 46vh; overflow: auto; }
.goto-box li { padding: 2px 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.goto-box li small { color: var(--dim); font-size: inherit; }
.goto-box li.sel, .goto-box li:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.goto-box li.sel small, .goto-box li:hover small { color: var(--bg); }

.help-box h2 { margin: 0 0 18px; font-family: var(--pixel); font-size: 13px; font-weight: normal; text-align: center; }
.help-box table { width: 100%; border-collapse: collapse; }
.help-box td { padding: 3px 6px; }
.help-box td:first-child { color: var(--hi); white-space: nowrap; width: 38%; }
.help-box p { font-size: 19px; color: var(--dim); margin: 16px 0 0; }
.help-box p.blink { color: var(--fg); text-align: center; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 980px) {
  .exhibit { grid-template-columns: minmax(0, 1fr); grid-template-areas: "mid" "photo" "text"; padding: 18px; gap: 26px; container-type: normal; }
  .col-photo { position: static; height: auto; }
  .photo-inner { flex: none; aspect-ratio: 4 / 3; }
  .menu .mbtn span, .brand-ver, .progress { display: none; }
  .vents { display: none; }
}
@media (max-width: 600px) {
  .bezel { inset: 0; border-radius: 0; padding: 8px 8px 0; }
  .menubar { padding: 8px 12px; gap: 8px; }
  .brand-name { font-size: 10px; }
  #btnPhos, #btnSound, .brand-ver { display: none; }
  .tl-era { display: none; }
  :root { --tl-h: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .scanbar, .static.on, .exhibit.switching { animation: none !important; }
}

/* very short screens: a fixed-ratio photo instead of a squashed one */
@media (max-height: 560px) and (min-width: 981px) {
  .exhibit { container-type: normal; }
  .col-photo { position: static; height: auto; }
  .photo-inner { flex: none; aspect-ratio: 4 / 3; }
}
@media (max-height: 800px) {
  .year { font-size: clamp(40px, 4.4vw, 70px); margin: 4px 0 8px; }
}

/* ~1080p and below: tighten type so a full exhibit fits without scrolling */
@media (max-height: 1000px) and (min-width: 981px) {
  .exhibit { padding-top: 20px; padding-bottom: 14px; }
  .year { font-size: clamp(40px, 3.8vw, 72px); margin: 4px 0 8px; }
  .name { font-size: clamp(18px, 1.9vw, 30px); }
  .badges { margin: 10px 0 8px; }
  .tagline { font-size: 24px; }
  .col { gap: 20px; }
  .panel { padding: 18px 18px 12px; }
  .specs dl { font-size: 20px; }
  .spec-row { padding: 1px 0; }
  .history p, .facts li { font-size: 20px; line-height: 1.17; }
  .history p { margin-bottom: 10px; }
  .facts li { padding: 4px 0 4px 40px; }
  .facts li::before { top: 5px; }
}

/* ── SEE IT IN ACTION demo panel ──────────────────────────── */
.demo { display: flex; flex-direction: column; }
.demo-screen {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #000;
  border-radius: 14px / 12px;
  overflow: hidden;
  box-shadow: 0 0 0 2px var(--faint), inset 0 0 24px rgba(0,0,0,.9);
}
.demo-screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.demo-screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.55) 100%),
    linear-gradient(160deg, rgba(255,255,255,.08), transparent 35%);
  border-radius: inherit;
}
.demo-caption { margin: 8px 0 0; font-size: 18px; line-height: 1.15; color: var(--dim); }
.demo-caption b { color: var(--hi); font-weight: normal; }

/* 3-column layout: the middle column fills the screen; the demo takes the leftover height */
@media (min-width: 1400px) and (min-height: 561px) {
  .col-mid { min-height: 100cqh; }
  .col-mid .demo { flex: 1; min-height: 0; }
  .col-mid .demo-screen { flex: 1; min-height: 170px; aspect-ratio: auto; }
  .col-mid .specs dl { display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; font-size: 18px; }
  .col-mid .spec-row { padding: 1px 0; gap: 8px; }
  .col-mid .spec-row .lead { display: none; }
  .col-mid .spec-row dt { flex: none; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .col-mid .spec-row dd { flex: 1; text-align: left; max-width: none; line-height: 1.05; }
}

/* 3-column layout on ~1080p screens: compact heading + shorter timeline so the demo fits */
@media (min-width: 1400px) and (max-height: 1000px) and (min-height: 561px) {
  :root { --tl-h: 134px; }
  .tl-node { padding-top: 30px; }
  .tl-track::before { top: 56px; }
  .tl-gap { padding-top: 46px; }
  .col-mid { gap: 16px; }
  .col-mid .exhibit-no { font-size: 17px; }
  .col-mid .year { font-size: clamp(36px, 3vw, 56px); margin: 2px 0 6px; -webkit-text-stroke-width: 1.5px; text-shadow: 4px 4px 0 var(--faint), 0 0 14px var(--glow); }
  .col-mid .name { font-size: clamp(16px, 1.45vw, 26px); }
  .col-mid .badges { margin: 8px 0 6px; font-size: 17px; }
  .col-mid .tagline { font-size: 20px; }
  .col-mid .panel { padding: 16px 16px 10px; }
  .demo-caption { font-size: 16px; margin-top: 6px; }
}

/* light LCD theme: no black letterbox behind photos, lighter scanlines */
.theme-lcd .photo-inner { background: var(--tint); }
.theme-lcd .crt::before { opacity: .45; }

/* ── DESIGNERS block (only when the photo leaves its frame half empty) ── */
.designers { display: none; }
.col-photo.split .photo { flex: none; }
.col-photo.split .photo-frame { flex: none; }
.col-photo.split .photo-inner { flex: none; min-height: 0; max-height: 60cqh; }
.col-photo.split .designers { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.designer-grid {
  flex: 1; min-height: 0;
  display: flex; justify-content: center; align-items: center; gap: 16px;
}
.designer {
  margin: 0; flex: 1 1 0; min-width: 0; max-width: 170px; height: 100%; max-height: 240px;
  display: flex; flex-direction: column; align-items: center;
  opacity: 0; animation: rowin .4s forwards;
}
.designer .pic {
  position: relative; flex: 1; min-height: 50px; width: 100%;
  display: grid; place-items: center;
  border: 2px solid var(--fg); background: #000; overflow: hidden;
  box-shadow: 0 0 12px -3px var(--glow);
  color: var(--fg);
}
.designer .pic img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 20%;
  filter: grayscale(1) contrast(1.2); transition: filter .5s;
}
.designer .pic:not(.empty)::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: var(--tint, var(--fg)); mix-blend-mode: multiply; transition: opacity .5s;
}
.designer .pic::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.3) 0 1px, transparent 1px 3px);
}
.designer .pic:hover img, body.truecolor .designer .pic img { filter: none; }
.designer .pic:hover::after, body.truecolor .designer .pic::after { opacity: 0; }
.designer .pic.empty { background: var(--bg2); }
.designer .pic.empty svg { width: 46%; height: auto; max-height: 70%; fill: var(--dim); }
.designer figcaption { display: block; margin-top: 6px; text-align: center; line-height: 1.05; width: 100%; }
.designer figcaption b { display: block; font-weight: normal; color: var(--hi); font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.designer figcaption span { display: block; color: var(--dim); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-lcd .designer .pic { background: var(--tint); }
.designer figcaption a.credit { display: block; margin-top: 2px; font-size: 12px; color: var(--dim); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.designer figcaption a.credit:hover { color: var(--fg); text-decoration: underline; }

/* long year labels such as "c. 100 BC" */
.year.long { font-size: clamp(30px, 3.4vw, 60px); letter-spacing: 1px; }
.tl-year { white-space: nowrap; }

.year.long { white-space: nowrap; }
.col-mid .year.long { font-size: clamp(24px, 2.3vw, 42px); -webkit-text-stroke-width: 1.2px; }
