/* Set like the app: white on black or black on white, IBM Plex Mono for
   labels, Courier New for prose. The fonts are served from this site, not
   a font service, so a visit makes no request anywhere else. */

/* Jacquard 24, a pixel blackletter, for the neutrinos page's title only.
   Cut down to basic Latin and a dotless i. Pixelify Sans, a pixel sans with
   a bold, for the rest of that page: cut down to Latin-1 and punctuation.
   Its digits are hard to tell apart small, so it takes plainer ones drawn on
   its grid (scripts/gen_pixel_digits.py); the score keeps its own. */
@font-face {
  font-family: "Jacquard 24";
  src: url("fonts/Jacquard24-Regular.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/PixelifySans-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("fonts/PixelDigits.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0030-0039;
}
@font-face {
  font-family: "Pixelify Sans Own Digits";
  src: url("fonts/PixelifySans-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
/* Departure Mono, a pixel monospace on an 11px grid, for the solar system
   view: its card, its pages and the gate numbers drawn in the scene. Cut
   down to Latin; one weight, so nothing in it is bold. */
@font-face {
  font-family: "Departure Mono";
  src: url("fonts/DepartureMono.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Light.ttf") format("truetype");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/IBMPlexMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

:root {
  --surface: #ffffff;
  --ink: #000000;
  --ink-secondary: #545454;
  --ink-tertiary: #737373;
  --figure-dim: #bfbfbf;
  --rule: #a8a8a8;
  --rain: #c4c4c4;
  --pink: #ff47b6;
  /* The four edges of a Windows 98 bevel, lit from the top left. */
  --bevel-hi: #ffffff;
  --bevel-light: #dfdfdf;
  --bevel-shadow: #808080;
  --bevel-dark: #000000;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #000000;
    --ink: #ffffff;
    --ink-secondary: #b4b4b4;
    --ink-tertiary: #939393;
    --figure-dim: #525252;
    --rule: #5a5a5a;
    --rain: #4a4a4a;
    --bevel-hi: #ffffff;
    --bevel-light: #a0a0a0;
    --bevel-shadow: #404040;
    --bevel-dark: #808080;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 16px/1.6 "Courier New", Courier, monospace;
}

main {
  max-width: 36rem;
  margin: 0 auto;
  padding: 3rem 20px 4rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.label, header a, nav a, h2 {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

header a { color: var(--ink); text-decoration: none; }

h1 {
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1.3;
  margin: 0 0 1.5rem;
}

h2 {
  margin: 2.5rem 0 0.75rem;
  color: var(--ink);
}

p, ul { margin: 0 0 1rem; }
ul { padding-left: 1.25rem; }

a { color: var(--ink); }

/* Dates and legal references under a page title. */
.note { color: var(--ink-secondary); font-style: italic; }

footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

nav a { color: var(--ink-secondary); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--ink); }

.credit { font-size: 13px; color: var(--ink-tertiary); }

/* The neutrino rain, behind everything. See rain.js. */
.rain { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }

.count { font-family: "IBM Plex Mono", ui-monospace, monospace; white-space: nowrap; }

/* The neutrinos page, on one screen with nothing to scroll, as an old
   computer's screen: the title in Jacquard 24, the invitation to catch a
   neutrino and the score, the Earth the neutrinos pass through, and a
   taskbar as its footer. Everything else is in Pixelify Sans, small, and the
   long texts in the windows in small IBM Plex Mono. Without the script, the
   facts are a plain list. */
body.one-screen { overflow: hidden; }
body:has(.taskbar) { padding-bottom: 32px; font-family: "Pixelify Sans", "Courier New", monospace; }
.fact-list { max-width: 34rem; margin: 2.5rem auto 0; font: 14px/1.6 "IBM Plex Mono", ui-monospace, monospace; }
.neutrinos {
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3vh 16px 2vh;
  text-align: center;
  font-size: 16px;
  line-height: 1.25;
}
@media (min-width: 720px) and (min-height: 640px) { .neutrinos { font-size: 18px; } }
/* "Neutrinos!" is 3.63 em wide in Jacquard 24: as wide as the screen allows,
   and never more than a fifth of its height. */
h1.huge {
  margin: 0;
  font-family: "Jacquard 24", "Courier New", monospace;
  font-weight: normal;
  font-size: min(calc((100vw - 32px) / 3.7), 20vh);
  line-height: 0.9;
  white-space: nowrap;
}
.catch { margin: 1.5vh 0 0; }
.catch-hint { margin: 0; color: var(--ink-secondary); }
.score { min-height: 1.25em; margin: 0; color: var(--ink-tertiary); font-family: "Pixelify Sans Own Digits", "Pixelify Sans", "Courier New", monospace; }
.earth-stage { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.earth { width: min(100%, 52vh, 560px); height: auto; max-height: 100%; aspect-ratio: 1; image-rendering: pixelated; }

/* A miss: a note that rises from the click and fades. */
.miss {
  position: fixed;
  z-index: 40;
  margin: 0;
  padding: 0 6px;
  background: var(--surface);
  color: var(--ink-secondary);
  width: max-content;
  max-width: calc(100vw - 16px);
  font-size: 16px;
  line-height: 1.25;
  pointer-events: none;
  transform: translate(-50%, -130%);
  animation: miss 1.4s ease-out forwards;
}
@keyframes miss { to { opacity: 0; transform: translate(-50%, -280%); } }
@media (prefers-reduced-motion: reduce) { .miss { animation: none; } }

/* A catch: the whole screen flashes pink. */
body.hit::after { content: ""; position: fixed; inset: 0; z-index: 15; background: var(--pink); pointer-events: none; animation: flash 0.7s ease-out forwards; }
@keyframes flash { from { opacity: 0.9; } to { opacity: 0; } }

/* Windows 98, in black and white: the same bevels, title bars, buttons and
   icons, with the page's surface for the grey face and ink for the blue.
   Bevels are drawn as inset shadows, outer edge first. */
.win, .start-menu, .start-submenu, .power-dialog {
  background: var(--surface);
  box-shadow: inset -1px -1px var(--bevel-dark), inset 1px 1px var(--bevel-light), inset -2px -2px var(--bevel-shadow), inset 2px 2px var(--bevel-hi);
}
.win-close, .win-crystal, .win-button, .start summary, .task {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: default;
  box-shadow: inset -1px -1px var(--bevel-dark), inset 1px 1px var(--bevel-hi), inset -2px -2px var(--bevel-shadow), inset 2px 2px var(--bevel-light);
}
.win-close:active, .win-crystal:active, .win-button:active, .start[open] summary, .task.pressed {
  box-shadow: inset -1px -1px var(--bevel-hi), inset 1px 1px var(--bevel-dark), inset -2px -2px var(--bevel-light), inset 2px 2px var(--bevel-shadow);
}

.win {
  position: fixed;
  width: min(400px, calc(100vw - 16px));
  padding: 3px;
  color: var(--ink);
  font: 12px/1.55 "IBM Plex Mono", ui-monospace, monospace;
  text-align: left;
}
.wide-win { width: min(540px, calc(100vw - 16px)); }
.win.opening { animation: win-open 0.16s ease-out; }
@keyframes win-open { from { transform: scale(0.15); opacity: 0.4; } }
.win-title {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 2px 0 5px;
  background: var(--ink);
  color: var(--surface);
  font: 700 14px/1 "Pixelify Sans", "Courier New", monospace;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.win.inactive .win-title { background: var(--ink-tertiary); }
.win-caption { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-top: 1px; }
.win-close, .win-crystal { display: grid; place-items: center; flex: none; width: 20px; height: 18px; }
.win-crystal { margin-right: -4px; }
.win-crystal svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; }
.win-crystal:active svg { transform: translate(1px, 1px); }
.win-close svg, .win-icon { shape-rendering: crispEdges; }
.win-close svg { fill: currentColor; }
.win-close:active svg { transform: translate(1px, 1px); }
.win-body { display: flex; align-items: flex-start; gap: 14px; padding: 14px 12px 2px; }
.win-icon { flex: none; }
.win-icon .px-ink, .px-icon .px-ink { fill: var(--ink); }
.win-icon .px-face, .px-icon .px-face { fill: var(--surface); }
.px-icon .px-pink { fill: var(--pink); }
.px-icon { flex: none; shape-rendering: crispEdges; }
.win-icon .px-shadow { fill: var(--rule); }
.win-text { flex: 1; min-width: 0; padding-top: 2px; }
.win-text p { margin: 0 0 8px; }
.win-text .fact-title { margin-bottom: 4px; font: 700 15px/1.2 "Pixelify Sans", "Courier New", monospace; }
.win-buttons { display: flex; justify-content: center; padding: 6px 0 9px; }
.win-button { min-width: 75px; height: 23px; padding: 0 10px; font: 14px/1 "Pixelify Sans", "Courier New", monospace; }
/* The default button: a black ring, and a dotted line inside while it has
   the focus. */
.win-button:focus { outline: none; box-shadow: inset 0 0 0 1px var(--bevel-dark), inset -2px -2px var(--bevel-dark), inset 2px 2px var(--bevel-hi), inset -3px -3px var(--bevel-shadow), inset 3px 3px var(--bevel-light); }
.win-button:focus::after { content: ""; position: absolute; inset: 4px; border: 1px dotted var(--ink); }
.win-button:active { box-shadow: inset 0 0 0 1px var(--bevel-dark), inset 0 0 0 2px var(--bevel-shadow); padding: 2px 0 0 2px; }
.win-close:focus-visible, .win-crystal:focus-visible { outline: 1px dotted var(--ink); outline-offset: -4px; }

/* A text page in a window, on the neutrinos page (facts.js) or on its own
   (document-neutrinos.js): the text in a sunken box that scrolls, in small
   IBM Plex Mono with the headings in Pixelify Sans. */
.window-text {
  overflow: auto;
  margin: 3px 1px 1px;
  padding: 18px 20px 4px;
  border: 1px solid;
  border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
  box-shadow: -1px -1px var(--bevel-shadow), 1px 1px var(--bevel-hi);
  font: 13px/1.6 "IBM Plex Mono", ui-monospace, monospace;
}
.window-text > :first-child { margin-top: 0; }
.window-text h1 { margin: 0 0 1rem; font: 700 22px/1.2 "Pixelify Sans", "Courier New", monospace; }
.window-text h2 { margin: 1.75rem 0 0.5rem; color: var(--ink); font: 700 15px/1.3 "Pixelify Sans", "Courier New", monospace; letter-spacing: 0; text-transform: none; }
.window-text .note { color: var(--ink-tertiary); font-style: normal; }
.window-text a { color: var(--ink); }
.window-text footer { margin-top: 1.5rem; padding-top: 0; border-top: 0; color: var(--ink-tertiary); font-size: 12px; }
.page-win { width: min(640px, calc(100vw - 16px)); }
.page-win .window-text { max-height: calc(100dvh - 32px - 96px); }
@media (max-width: 599px) { .window-text { padding: 14px 14px 4px; } }

/* The dictionary entry, in a sunken white box as Windows 98 showed long
   text, justified and hyphenated, with a hanging indent. */
.clipping {
  max-height: min(52vh, 420px);
  overflow: auto;
  padding: 6px 10px 2px;
  margin-bottom: 4px;
  box-shadow: inset 1px 1px var(--bevel-shadow), inset -1px -1px var(--bevel-hi), inset 2px 2px var(--bevel-dark), inset -2px -2px var(--bevel-light);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.clipping p { margin: 0 0 0.6rem; padding-left: 1.2em; text-indent: -1.2em; }
.clipping::-webkit-scrollbar, .window-text::-webkit-scrollbar { width: 16px; }
.clipping::-webkit-scrollbar-track, .window-text::-webkit-scrollbar-track { background: repeating-conic-gradient(var(--bevel-light) 0 25%, var(--surface) 0 50%) 0 0 / 2px 2px; }
.clipping::-webkit-scrollbar-thumb, .window-text::-webkit-scrollbar-thumb {
  background: var(--surface);
  box-shadow: inset -1px -1px var(--bevel-dark), inset 1px 1px var(--bevel-hi), inset -2px -2px var(--bevel-shadow), inset 2px 2px var(--bevel-light);
}

/* The taskbar: the Start button with the Earth on it and the site's pages
   in its menu, a button for every open window, and the clock. */
.taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 3px 2px 1px;
  background: var(--surface);
  box-shadow: inset 0 1px var(--bevel-light), inset 0 2px var(--bevel-hi);
  font: 14px/1 "Pixelify Sans", "Courier New", monospace;
}
.taskbar p { margin: 0; }
/* The Windows 98 arrow over the windows and the taskbar (start-menu.js), and
   over the game the crystal, which the rain passes through (facts.js). Links
   in a window keep the pointing hand. */
body[data-rain] { cursor: var(--cursor-crystal, crosshair); }
.win, .win :not(a), .taskbar, .taskbar * { cursor: var(--cursor-arrow, default); }
.start { position: relative; flex: none; }
.start summary { display: flex; align-items: center; gap: 5px; font-weight: 700; height: 26px; padding: 0 8px 0 5px; list-style: none; }
.start summary::-webkit-details-marker { display: none; }
.start summary:focus-visible { outline: 1px dotted var(--ink); outline-offset: -4px; }
.start[open] summary { padding: 1px 7px 0 6px; }
.start-earth { width: 16px; height: 16px; image-rendering: pixelated; }
.start-menu { position: absolute; left: 0; bottom: calc(100% + 3px); padding: 3px 3px 3px 29px; }
.start-banner {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 26px;
  padding: 8px 0;
  background: var(--ink);
  color: var(--surface);
  font: 22px/26px "Jacquard 24", "Courier New", monospace;
}
.start-banner span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.start-menu ul { margin: 0; padding: 0; list-style: none; min-width: 156px; }
.start-menu a {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 24px 0 12px;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}
.start-menu a, .start-sub-toggle { gap: 8px; padding: 0 24px 0 8px; }
.start-sub { position: relative; }
.start-sub-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  height: 30px;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
}
/* The submenu's arrow, a small solid triangle. */
.start-sub-toggle::after { content: ""; margin-left: auto; margin-right: -14px; border: 4px solid transparent; border-right-width: 0; border-left-color: currentColor; }
.start-menu .start-submenu { display: none; position: absolute; left: calc(100% - 3px); top: -3px; padding: 3px; }
.start-sub:hover > .start-submenu, .start-sub.open > .start-submenu, .start-sub:focus-within > .start-submenu { display: block; }
.start-menu a:hover, .start-menu a:focus-visible, .start-sub:hover > .start-sub-toggle, .start-sub.open > .start-sub-toggle, .start-sub-toggle:focus-visible { outline: none; background: var(--ink); color: var(--surface); }
.start-rule { height: 2px; margin: 3px 2px; border-top: 1px solid var(--bevel-shadow); border-bottom: 1px solid var(--bevel-hi); }
/* Shut Down and Restart (start-menu.js): a dither dims the screen, then it
   goes black, in every theme. Restart shows the name over a moving bar. */
.power {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: var(--cursor-arrow, default);
  background: repeating-conic-gradient(#000 0 25%, transparent 0 50%) 0 0 / 2px 2px;
  opacity: 0;
  transition: opacity 0.6s steps(3);
}
.power.dim { opacity: 1; }
.power.off { background: #000; transition: none; cursor: none; }
.power.busy { cursor: var(--cursor-busy, wait); }
.power-line { margin: 0; padding: 0 24px; color: var(--pink); font: 24px/1.3 "Pixelify Sans", "Courier New", monospace; text-align: center; }
.power-hourglass { animation: power-flip 1.2s steps(1) infinite; }
@keyframes power-flip { 50% { rotate: 180deg; } }
.power-hourglass .px-ink { fill: #fff; }
.power-hourglass .px-face { fill: #000; }
/* The Shut Down dialog, above the dimmed screen. */
.power-dialog {
  position: fixed;
  left: 50%;
  top: 42%;
  z-index: 2147483647;
  translate: -50% -50%;
  width: min(360px, calc(100vw - 16px));
  padding: 3px;
  color: var(--ink);
  font: 14px/1.4 "Pixelify Sans", "Courier New", monospace;
}
.power-dialog, .power-dialog * { cursor: var(--cursor-arrow, default); }
.power-body { display: flex; align-items: flex-start; gap: 16px; padding: 16px 14px 4px; }
.power-choices p { margin: 0 0 10px; }
.power-choices label { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; }
.power-choices input {
  appearance: none;
  width: 12px;
  height: 12px;
  margin: 0;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 1px 1px var(--bevel-shadow), inset -1px -1px var(--bevel-hi), inset 2px 2px var(--bevel-dark), inset -2px -2px var(--bevel-light);
}
.power-choices input:checked { background: radial-gradient(var(--ink) 0 2px, var(--surface) 2.5px); }
.power-choices input:focus-visible { outline: 1px dotted var(--ink); outline-offset: 2px; }
.power-dialog .win-buttons { gap: 6px; }
.power-name { margin: 0; color: #fff; font: clamp(40px, 9vw, 96px)/1 "Jacquard 24", "Courier New", monospace; }
.power-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12vh;
  height: 6px;
  background: linear-gradient(90deg, transparent, var(--pink), transparent) 0 0 / 40% 100% no-repeat;
  animation: power-bar 1.4s linear infinite;
}
@keyframes power-bar { from { background-position: -70% 0; } to { background-position: 170% 0; } }
@media (prefers-reduced-motion: reduce) { .power { transition: none; } .power-bar { animation: none; background-position: 50% 0; } }
.tasks { flex: 1; min-width: 0; display: flex; gap: 3px; }
.task { flex: 0 1 160px; min-width: 0; height: 26px; padding: 0 8px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.pressed { padding: 1px 7px 0 9px; background: repeating-conic-gradient(var(--bevel-light) 0 25%, var(--surface) 0 50%) 0 0 / 2px 2px; }
.tray {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px 0 5px;
  box-shadow: inset 1px 1px var(--bevel-shadow), inset -1px -1px var(--bevel-hi);
}
