/* night-game.org: the radio booth's notes, drawn as the game's console in
   Under the Lights, Night Game's own colours: a night sky's navy ground,
   chalk-line white, infield dirt and outfield grass. They come from the
   shared palettes at the site's build, so a change to Under the Lights
   reaches the site with the next refresh. One face, JetBrains Mono, as the
   game draws in, served from this site (no font service is asked for it).
   Sections are the game's windows: a frame with its title set into the
   top edge. A sibling of ghost-boat.com and dog-watch.net: the same
   console, under the lights. */

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Regular.otf") format("opentype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono-Bold.otf") format("opentype");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --bg: #0a1726;
  --frame: #1f4d36;
  --faint: #5d7183;
  --label: #a8875c;
  --text: #cfc9ba;    /* the site's own body text, not a token: chalk dimmed, about 11:1 on the ground */
  --value: #f3efe4;
  --caution: #ffd827;
  --accent: #7ee08f;
  --red: #e8494b;
  --blue: #4fa8ff;
  /* Two shades between the ground and the frames, for code and table rows. */
  --well: color-mix(in srgb, var(--frame) 40%, var(--bg));
  --stripe: color-mix(in srgb, var(--frame) 21%, var(--bg));
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.65 var(--mono);
  -webkit-text-size-adjust: 100%;
}

::selection { background: var(--value); color: var(--bg); }

a { color: var(--value); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 0.12em; text-underline-offset: 0.2em; }
a:hover { color: var(--caution); text-decoration-color: var(--caution); }
:focus-visible { outline: 2px solid var(--caution); outline-offset: 2px; }

strong { color: var(--value); font-weight: 700; }
em { color: var(--value); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 16px; top: 8px; background: var(--bg); color: var(--caution); padding: 4px 8px; z-index: 2; }

/* The console: one column. */
.console { max-width: 62rem; margin: 0 auto; padding: 0 16px; container-type: inline-size; }

/* The top line: the mark, and the papers as the game's key bar. */
.bar {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3em 2ch;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--frame);
}
.mark { color: var(--value); font-weight: 700; letter-spacing: 0.3em; text-decoration: none; }
.bar nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.2em 2.5ch; }
.bar nav a { color: var(--label); text-decoration: none; }
.bar nav a:hover { color: var(--value); }
kbd {
  font: inherit; font-weight: 700; color: var(--caution);
  margin-right: 0.6ch;
}
p kbd, li kbd, dd kbd, figcaption kbd { margin-right: 0; }

/* The game's screens, as text. Each <pre> is one frame of the game's own
   drawing (scripts/screens.py), --cols cells wide, scaled so its cells
   fill the column it stands in. JetBrains Mono's advance is 0.6 em. Below
   about 7 px a screen stops shrinking and pans sideways in its frame. */
.shot { container-type: inline-size; margin: 1.6em 0 0; }
.screen {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(7px, calc((100cqi - 2px) / (var(--cols) * 0.6)), 22px);
  line-height: 1.2;
  white-space: pre;
  overflow-x: auto;
  width: fit-content; max-width: 100%;
  border: 1px solid var(--frame);
  /* Keep each advance at exactly 0.6 em; Chrome on Linux otherwise rounds
     each to a whole pixel and a wide frame comes out too wide. */
  text-rendering: geometricPrecision;
  font-variant-ligatures: none;
}
/* Every styled run is a block one line tall, so painted rows meet with no
   seam (block glyphs arrive painted; see screens.py). */
.screen span { display: inline-block; height: 1.2em; vertical-align: top; }
/* A glyph the font lacks (the suits, the braille pips) comes from another
   font, often wider. Each sits in a box one cell wide, centred, so the rest
   of its line stays on the grid. */
.screen .g { display: inline-flex; justify-content: center; width: 1ch; overflow: hidden; }
.shot figcaption, figure figcaption { color: var(--label); font-size: 0.9em; margin-top: 0.4em; }

/* The opening screen: the radio in the bottom of the 8th, and under it
   the tagline. On a phone the narrower 80-column radio takes its place. */
.hero { margin: 28px 0 0; }
.hero .screen { border: 0; overflow: hidden; font-size: calc((100cqi - 1px) / (var(--cols) * 0.6)); }
.hero .narrow { display: none; }
.tagline { margin: 0.9em 0 0; color: var(--value); font-style: italic; font-size: 1.2em; line-height: 1.45; }
.ready { color: var(--label); margin: 0.3em 0 0; font-size: 0.93em; }

/* A window: the frame, with its title set into the top edge. */
.window {
  position: relative;
  border: 1px solid var(--frame);
  padding: 1.5em 3ch 1.1em;
  margin: 2.6em 0;
}
.window > h2 {
  position: absolute; top: 0; left: 2ch;
  transform: translateY(-50%);
  margin: 0; padding: 0 1ch;
  background: var(--bg);
  color: var(--accent);
  font-size: 1em; font-weight: 700; line-height: 1.4;
  letter-spacing: 0.08em; text-transform: uppercase;
  max-width: calc(100% - 4ch);
}
.window p, .window ul, .window dl { max-width: 72ch; }
.window > :last-child { margin-bottom: 0; }

/* The scoreboard's bulletin is posted in the caution colour, and only it. */
.notice { border-color: var(--caution); }
.notice > h2 { color: var(--caution); }
.posted { margin: 0 0 0.8em; color: var(--label); white-space: pre-wrap; }

/* The booth's voices, as the log shows a label, then the line. */
.booth { margin: 1em 0; padding: 0; list-style: none; }
.booth li { margin: 0 0 0.45em; padding-left: 2ch; text-indent: -2ch; }
.booth .who { color: var(--label); font-weight: 700; margin-right: 1ch; }
.booth q { color: var(--value); quotes: none; }

.points { list-style: none; padding: 0; }
.points li { padding-left: 2ch; text-indent: -2ch; margin: 0 0 0.6em; }
.points li::before { content: "▸ "; color: var(--accent); }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2ch; }

/* The screen-reader mode's session, as it was said. */
.transcript {
  margin: 1em 0 0; padding: 0.7em 2ch;
  background: var(--well); border: 1px solid var(--frame);
  white-space: pre-wrap; font-family: var(--mono); font-size: 0.93em;
}
.transcript .you { color: var(--caution); }

.papers { display: grid; grid-template-columns: max-content 1fr; gap: 0.3em 3ch; }
.papers dt { margin: 0; }
.papers dd { margin: 0; color: var(--text); }

.foot {
  color: var(--label); font-size: 0.86em;
  border-top: 1px solid var(--frame);
  padding: 14px 0 40px; margin-top: 1em;
}
.foot p { margin: 0.2em 0; }

/* The papers: the manual, the roadmap and the rest. */
.paper { padding: 1.2em 0 0; }
.paper h1, .paper h2, .paper h3, .paper h4 { color: var(--value); line-height: 1.3; }
.paper h1 { font-size: 1.6em; letter-spacing: 0.04em; }
.paper h2 { font-size: 1.15em; border-top: 1px solid var(--frame); padding-top: 1.2em; margin-top: 2em; }
.paper h3 { font-size: 1em; }
.paper h4 { font-size: 1em; color: var(--label); }
.paper p, .paper li { max-width: 78ch; }
.paper blockquote {
  margin: 1em 0; padding: 0.6em 2ch;
  border-left: 3px solid var(--frame);
  background: color-mix(in srgb, var(--frame) 25%, transparent);
}
.paper blockquote.callout { border-left-color: var(--value); }
.paper blockquote.warning, .paper blockquote.caution { border-left-color: var(--caution); }
.paper code { color: var(--value); background: var(--well); padding: 0 0.3ch; font-family: var(--mono); }
.paper pre { background: var(--well); border: 1px solid var(--frame); padding: 0.8em 2ch; overflow-x: auto; }
.paper pre code { padding: 0; }
.paper table { border-collapse: collapse; display: block; overflow-x: auto; margin: 1em 0; }
.paper th, .paper td { border: 1px solid var(--frame); padding: 0.3em 1ch; text-align: left; vertical-align: top; }
.paper th { color: var(--value); }
.paper tr:nth-child(2n) td { background: var(--stripe); }
.window code { color: var(--value); font-family: var(--mono); }

@media (max-width: 640px) {
  body { font-size: 14px; }
  .bar nav { margin-left: 0; }
  .window { padding: 1.4em 1.5ch 1em; }
  .pair { grid-template-columns: 1fr; }
  .hero .wide { display: none; }
  .hero .narrow { display: block; }
  .hero .narrow + .narrow { margin-top: 1em; }
  .tagline, .ready { text-align: center; }
  .papers { grid-template-columns: 1fr; }
  .papers dd { margin-bottom: 0.6em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
