/* Xenon 2 in the browser -- site stylesheet.
 * Palette is lifted from the game: near-black space, the steel-grey shop
 * chrome, and the orange/amber of the title logo. Single dark theme on
 * purpose (the game pages are dark by nature). */
:root {
  --bg: #07080c;
  --bg-2: #0d0f16;
  --panel: #12141b;
  --panel-2: #1a1d27;
  --line: #2a2e3c;
  --line-2: #3b4052;
  --steel: #8b90a8;
  --steel-2: #5a5f78;
  --text: #f1f3f6;
  --muted: #aab1bf;
  --dim: #7c8294;
  --orange: #e8752a;
  --amber: #ffb665;
  --amber-2: #ffd39a;
  --danger: #ff6b6b;
  --font-display: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --font-pixel: "Press Start 2P", "Courier New", monospace;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --maxw: 1100px;
  --radius: 6px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--amber); }
a:hover { color: var(--amber-2); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 900; letter-spacing: .04em; }
h2 { font-size: clamp(1.25rem, 2.6vw, 1.7rem); font-weight: 700; color: var(--amber); letter-spacing: .05em; }
h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: .04em; }
p { margin: 0 0 1em; }
code, pre, kbd { font-family: var(--font-mono); }
/* Long identifiers (blitter_DrawRawPanelBitmap96_FUN_00011f60...) break rather than widen the page
 * on a phone; pre blocks do not wrap and scroll as before. */
code { background: var(--panel-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; overflow-wrap: anywhere; }
pre { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; font-size: .85rem; line-height: 1.5; }
pre code { background: none; padding: 0; font-size: inherit; }
kbd {
  font-size: .8em;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--steel-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
}
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; margin: 0 0 1.2em; }
th, td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel-2); color: var(--amber-2); font-weight: 600; }
blockquote { margin: 0 0 1em; padding: .4em 1em; border-left: 3px solid var(--orange); color: var(--muted); background: var(--panel); }

.eyebrow {
  font-family: var(--font-pixel);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--orange);
  margin: 0 0 .8em;
}
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.wrap { width: min(100% - 32px, var(--maxw)); margin-inline: auto; }
.section { padding-block: clamp(2.5rem, 6vw, 5rem); }
.section + .section { border-top: 1px solid var(--line); }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 62ch; }

/* --- starfield canvas: fixed behind everything --- */
#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background: var(--bg);
  image-rendering: pixelated; /* keeps 1px stars crisp when the capped backing store is stretched */
}

/* --- top navigation --- */
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 8px; z-index: 100; }
.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  /* solid, not backdrop-filter: blurring a full-screen animated canvas
   * behind a sticky bar is re-rasterised on every scroll step */
  background: rgba(7, 8, 12, .94);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.brand img { image-rendering: auto; }
.brand span { white-space: nowrap; }
@media (max-width: 480px) { .topnav { padding: 8px 12px; } .topnav nav { gap: 4px 12px; } .topnav nav a { font-size: .88rem; } }
.topnav nav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; justify-content: flex-end; }
.topnav nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.topnav nav a:hover, .topnav nav a[aria-current] { color: var(--text); }
.topnav nav a[aria-current] { border-bottom: 2px solid var(--orange); }
.topnav nav a.btn { color: #1a0d05; }
.topnav nav a.btn:hover { color: #000; }

/* --- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  color: #1a0d05;
  background: linear-gradient(180deg, var(--amber-2), var(--orange));
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 14px 26px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 0 24px rgba(232,117,42,.25);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { color: #000; transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 0 36px rgba(255,182,101,.45); }
.btn:active { transform: translateY(0); }
.btn-small { padding: 7px 14px; font-size: .8rem; }
.btn-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--steel-2);
  box-shadow: none;
}
.btn-ghost:hover { color: var(--amber); border-color: var(--amber); box-shadow: none; }
.btn-big { padding: 18px 30px; font-size: 1.05rem; flex-direction: column; gap: 2px; line-height: 1.2; }
.btn-big small { font-family: var(--font-body); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: .8rem; opacity: .85; }

/* --- hero --- */
.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding-block: clamp(3rem, 9vw, 7rem) clamp(2.5rem, 6vw, 4.5rem);
  border-bottom: 1px solid var(--line);
}
.hero::before {
  /* the game's own organic background mosaic, faded into space */
  content: "";
  position: absolute;
  inset: 0;
  /* backdrop.png is the 320x384 mosaic plus its mirror image (640x384), shown at 2x */
  background: url("art/backdrop.png") center / 1280px 768px repeat;
  opacity: .18;
  image-rendering: pixelated;
  mask-image: radial-gradient(ellipse 70% 80% at 50% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 40%, #000 20%, transparent 75%);
  z-index: -1;
}
.hero-logo {
  width: min(560px, 80vw);
  filter: drop-shadow(0 0 28px rgba(232,117,42,.35));
  margin-bottom: 1.2rem;
}
.hero .lede { margin-inline: auto; margin-bottom: 1.8rem; }
.play-buttons { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-bottom: 1rem; }
.play-buttons .btn { min-width: 260px; }
.skip-intro { display: inline-flex; align-items: center; gap: .55em; margin-bottom: .4rem; color: var(--muted); font-size: .92rem; cursor: pointer; user-select: none; }
.skip-intro input { width: 1.05em; height: 1.05em; margin: 0; accent-color: var(--orange); cursor: pointer; }
.skip-intro:hover { color: var(--text); }
.hero .fineprint { color: var(--dim); font-size: .85rem; max-width: 60ch; margin-inline: auto; }
.hero .fineprint kbd { font-size: .75em; }

/* --- feature tiles (classic vs hi-res) --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
}
.tile .art { height: 120px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.tile .art img { max-height: 100%; }
.tile .art img.pixel { image-rendering: pixelated; }
.tile h3 { margin-bottom: .3em; }
.tile p { color: var(--muted); font-size: .92rem; margin: 0; }
.tile .links { margin-top: 14px; }

/* --- history timeline --- */
.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line-2); }
.timeline li { position: relative; padding: 0 0 1.1rem 20px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .45em; width: 12px; height: 12px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px var(--bg); }
.timeline .year { font-family: var(--font-display); font-weight: 700; color: var(--amber); display: block; letter-spacing: .06em; }
.timeline p { margin: 0; color: var(--muted); font-size: .95rem; }
.portrait { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-top: 1.5rem; }
.portrait img { width: 96px; flex: none; image-rendering: pixelated; border: 1px solid var(--line-2); }
.portrait p { margin: 0; font-size: .9rem; color: var(--muted); }

/* --- cards (docs, explorers, teasers) --- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .12s ease, transform .12s ease;
}
.card:hover { border-color: var(--orange); transform: translateY(-2px); color: var(--text); }
.card h3 { margin-bottom: .35em; color: var(--amber-2); }
.card p { color: var(--muted); font-size: .92rem; margin: 0; }
.card .meta { display: block; margin-top: .6em; font-size: .75rem; color: var(--dim); font-family: var(--font-mono); }
.card img { display: block; width: 100%; border-radius: 4px; border: 1px solid var(--line); margin-bottom: 10px; }
.card.featured { border-color: var(--orange); background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
.card.featured h3 { color: var(--amber); }
/* --- AI experiment verdict --- */
.verdict { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 1.5rem 0 2rem; }
.verdict-item { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--steel-2); border-radius: 0 var(--radius) var(--radius) 0; padding: 18px 20px; }
.verdict-item.good { border-left-color: #67d59a; }
.verdict-item.ok { border-left-color: var(--amber); }
.verdict-item.bad { border-left-color: var(--danger); }
.verdict-item h3 { margin-bottom: .4em; }
.verdict-item.good h3 { color: #9fe7bf; }
.verdict-item.ok h3 { color: var(--amber-2); }
.verdict-item.bad h3 { color: #ff9c9c; }
.verdict-item p { color: var(--muted); font-size: .95rem; margin: 0; }

.teasers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.teaser { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.teaser p { color: var(--muted); }
.teaser .links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

details.doclist { margin-top: 1.2rem; }
details.doclist summary { cursor: pointer; color: var(--amber); font-family: var(--font-display); font-size: .95rem; letter-spacing: .05em; padding: 8px 0; }
details.doclist ul { columns: 2; column-gap: 32px; padding-left: 1.1em; margin: .6em 0; }
@media (max-width: 640px) { details.doclist ul { columns: 1; } }
details.doclist li { break-inside: avoid; margin-bottom: .3em; font-size: .92rem; }
details.doclist li span { color: var(--dim); overflow-wrap: anywhere; }

/* --- controls strip --- */
.controls { display: flex; flex-wrap: wrap; gap: 10px 28px; justify-content: center; color: var(--muted); font-size: .95rem; }
.controls span { white-space: nowrap; }

.hero-controls { margin: 1.4rem 0 1rem; font-size: .9rem; }
.hero-controls kbd { font-size: .78em; }

/* --- cross-link to DMNet VR --- */
.crosslink { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.5rem); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.crosslink > div { flex: 1; min-width: 0; }
.crosslink img.pixel { image-rendering: pixelated; flex: none; width: 96px; height: auto; }
.crosslink img.badge { flex: none; width: 110px; height: auto; transform: rotate(-8deg); }
.crosslink h2 { margin-bottom: .4em; }
.crosslink p { color: var(--muted); }
.crosslink .links { margin-top: 8px; }
/* On a phone the two pictures share the first row and the text gets a row of its own: with
 * `flex: 1; min-width: 0` alone it stayed beside them, one word wide, and its button pushed the
 * page past the screen edge. */
@media (max-width: 640px) {
  .crosslink { flex-wrap: wrap; justify-content: center; }
  .crosslink img.badge { order: -1; }
  .crosslink > div { flex-basis: 100%; }
}

/* --- pipeline diagram --- */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 1.5rem 0; }
.pipeline .step { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 12px; font-size: .88rem; }
.pipeline .step b { display: block; font-family: var(--font-display); font-size: .78rem; letter-spacing: .06em; color: var(--amber); margin-bottom: 4px; }
.pipeline .step span { color: var(--muted); }
.pipeline .step + .step::before { content: "\25B6"; position: absolute; left: -11px; top: 50%; transform: translateY(-50%); color: var(--steel-2); font-size: .7rem; }
@media (max-width: 640px) { .pipeline .step + .step::before { content: "\25BC"; left: 50%; top: -11px; transform: translateX(-50%); } }

/* --- doc pages --- */
.doc-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
@media (max-width: 880px) { .doc-layout { grid-template-columns: 1fr; } }
.doc-toc { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; font-size: .85rem; padding-right: 8px; }
.doc-toc .eyebrow { margin-bottom: .6em; }
.doc-toc ul { list-style: none; margin: 0; padding: 0; }
.doc-toc ul ul { padding-left: 12px; }
.doc-toc li { margin: 0; }
.doc-toc a { display: block; color: var(--muted); text-decoration: none; padding: 3px 0; border-left: 2px solid transparent; padding-left: 8px; line-height: 1.35; }
.doc-toc a:hover { color: var(--text); border-left-color: var(--steel-2); }
.doc-toc .backlink { margin-top: 1rem; }
.doc-toc details > summary { list-style: none; cursor: default; }
.doc-toc details > summary::-webkit-details-marker { display: none; }
@media (max-width: 880px) {
  .doc-toc { position: static; max-height: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
  .doc-toc details > summary { list-style: disclosure-closed; cursor: pointer; }
  .doc-toc details[open] > summary { list-style: disclosure-open; }
  .doc-toc details > summary .eyebrow { display: inline; margin: 0; }
}
.doc-body { min-width: 0; }
.doc-body .doc-meta { color: var(--dim); font-family: var(--font-mono); font-size: .8rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
/* anchored headings land below the sticky top nav instead of under it */
.doc-body h1, .doc-body h2, .doc-body h3, .doc-body h4, .doc-body h5, .doc-body h6, [id] { scroll-margin-top: 72px; }
.doc-body h1 { margin-bottom: .3em; }
.doc-body h2 { margin-top: 2.2em; padding-top: .5em; border-top: 1px solid var(--line); }
.doc-body h3 { margin-top: 1.6em; color: var(--amber-2); }
.doc-body h4 { margin-top: 1.2em; color: var(--muted); font-size: .95rem; }
.doc-body h2 a.hl, .doc-body h3 a.hl, .doc-body h4 a.hl { color: inherit; text-decoration: none; }
.doc-body img { border: 1px solid var(--line); border-radius: var(--radius); }
.doc-body td img { border: 0; border-radius: 0; vertical-align: middle; image-rendering: pixelated; }
.doc-body table { display: block; overflow-x: auto; }
.doc-body ul, .doc-body ol { padding-left: 1.4em; }
.doc-body li { margin-bottom: .25em; }
.doc-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .92rem; }
.doc-nav a { text-decoration: none; }
.doc-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 1.5rem; }
.doc-filter input { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 8px 12px; min-width: 260px; }
.doc-filter .count { color: var(--dim); font-size: .85rem; }
.doc-body .error-hidden { display: none; }

/* --- footer --- */
.footer { border-top: 1px solid var(--line); background: rgba(7,8,12,.7); margin-top: 3rem; }
.footer-inner { width: min(100% - 32px, var(--maxw)); margin-inline: auto; padding-block: 1.6rem; color: var(--dim); font-size: .85rem; }
.footer-inner p { margin: 0 0 .5em; }
.footer-inner strong { color: var(--muted); }
