/* DOCMET'S BASIC: the retro look of every web page (task 272e46bf).
   A deep-blue screen in a light-blue border, our own pixel font (DOCMET 8, tools/web/pixelfont.py),
   pixel boxes with notched corners, reverse-video titles, optional scanlines.
   Every text colour on its background is WCAG AA (tests/test_retro.py computes the pairs below). */

@font-face {
  font-family: "DOCMET 8";
  src: url("/retro/docmet8.woff2") format("woff2");
  font-display: swap;
}

/* contrast pairs, checked by tests/test_retro.py: ink/screen dim/screen key-ink/key hot/screen
   ok/screen screen/ink hi/screen link/screen key-ink/hi
   The screen and the border are the machine's own colours 6 and 14 (palette() in our core's vic.rs),
   as on its boot screen; its light-blue text would be about 2:1 here, so page text is paler. */
:root {
  --screen: #4646be;
  --frame: #7d7df5;
  --ink: #f0f0ff;
  --dim: #d8daff;
  --hi: #ffffff;
  --link: #ffe36e;
  --key: #ffe36e;
  --key-ink: #20206a;
  --hot: #ffd3db;
  --ok: #ccffd6;
  --px: 4px;
  --font: "DOCMET 8", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

html { background: var(--frame); }
html, body { margin: 0; }
body.retro {
  min-height: 100vh;
  padding: clamp(16px, 5vw, 56px) clamp(16px, 6vw, 72px);
  box-sizing: border-box;
  background: var(--frame);
  color: var(--ink);
  font: 16px/1.75 var(--font);
  -webkit-font-smoothing: none;
  font-smooth: never;
  text-rendering: optimizeSpeed;
}
.retro *, .retro *::before, .retro *::after { box-sizing: border-box; }

.screen {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 40px) 40px;
  background: var(--screen);
  text-shadow: 0 0 3px rgba(190, 190, 255, .35);
  overflow-wrap: break-word;
}

.retro h1, .retro h2, .retro h3 { font-family: var(--font); font-weight: 400; line-height: 1.25; margin: 0 0 16px; }
.retro h1 { font-size: 32px; letter-spacing: 0; }
.retro h2 { font-size: 16px; }
.retro p { margin: 0 0 16px; }
.retro a { color: var(--link); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.retro a:hover { color: var(--hi); }
.retro :focus-visible { outline: var(--px) dashed var(--hi); outline-offset: 6px; }

/* The raster logo: our font, its rows banded in shifting colours like a raster split. */
.logo {
  display: inline-block;
  font-size: 32px;
  line-height: 1.25;
  color: var(--hi);
  background: linear-gradient(180deg, #fff 0 25%, #ffe36e 25% 37.5%, #ffb36e 37.5% 50%, #ff8fb0 50% 62.5%, #b9a0ff 62.5% 75%, #8fd8ff 75% 87.5%, #fff 87.5%);
  background-size: 100% 1.25em;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(4px 4px 0 #24246e);
}
@media (min-width: 720px) { .retro h1.logo, .logo.big { font-size: 48px; } }

.prompt { color: var(--ink); margin: 0 0 24px; }
.cursor { display: inline-block; width: .5em; height: 1em; vertical-align: -.15em; background: var(--ink); animation: blink 1.07s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.pitch { font-size: 16px; color: var(--ink); max-width: 46ch; margin-bottom: 24px; }
.muted, .retro .muted { color: var(--dim); }
.error, .retro .error { color: var(--hot); }
.ok { color: var(--ok); }

/* A box with notched pixel corners, its title in reverse video on the top line. */
.box, .card {
  position: relative;
  margin: 32px var(--px) 24px;
  padding: 24px 20px 16px;
  background: var(--screen);
  box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
              calc(-1 * var(--px)) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}
.box > :is(h1, h2):first-child, .card > :is(h1, h2):first-child {
  display: table;
  margin: -36px 0 12px -4px;
  padding: 0 8px;
  font-size: 16px;
  line-height: 24px;
  background: var(--ink);
  color: var(--screen);
  text-shadow: none;
}

/* Buttons are keys: reverse video, notched, pressed down a pixel. */
.button, .retro .button, .retro button {
  display: inline-block;
  margin: var(--px);
  padding: 8px 16px;
  border: 0;
  border-radius: 0;
  background: var(--key);
  color: var(--key-ink);
  font: 16px/24px var(--font);
  text-decoration: none;
  text-shadow: none;
  cursor: pointer;
  box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--key), 0 var(--px) 0 0 var(--key),
              calc(-1 * var(--px)) 0 0 0 var(--key), var(--px) 0 0 0 var(--key), 0 8px 0 0 #24246e;
}
.button:hover, .retro .button:hover, .retro button:hover { background: var(--hi); color: var(--key-ink);
  box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--hi), 0 var(--px) 0 0 var(--hi),
              calc(-1 * var(--px)) 0 0 0 var(--hi), var(--px) 0 0 0 var(--hi), 0 8px 0 0 #24246e; }
.button:active, .retro button:active { transform: translateY(4px); }
.button.ghost, .retro .button.ghost, .retro button.ghost {
  background: var(--screen); color: var(--ink);
  box-shadow: 0 calc(-1 * var(--px)) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
              calc(-1 * var(--px)) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
}
.button.ghost:hover, .retro .button.ghost:hover, .retro button.ghost:hover { background: var(--ink); color: var(--screen); }
.button.small, .retro button.small { padding: 0 8px; }

.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 8px 0 16px; }
.row form { margin: 0; }

/* Steps as a BASIC listing: "10 ..." */
ol.listing { list-style: none; margin: 0; padding: 0; counter-reset: line; }
ol.listing li { counter-increment: line; padding-left: 4ch; text-indent: -4ch; margin: 0 0 8px; }
ol.listing li::before { content: counter(line) "0 "; color: var(--link); }

.demo {
  aspect-ratio: 384 / 272;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  background: #24246e;
  color: var(--ink);
  image-rendering: pixelated;
}
.demo img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

.switches { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 24px 0 0; color: var(--dim); }
.switches button { font-size: 16px; }

footer.retro-foot { margin-top: 40px; color: var(--dim); }
footer.retro-foot a { color: var(--dim); }

/* The consent page: what the app may do, as a short listing. */
ul.scopes { list-style: none; padding: 0; margin: 0 0 16px; }
ul.scopes li { padding-left: 2ch; text-indent: -2ch; margin: 0 0 8px; }
ul.scopes li::before { content: "\25b8 "; color: var(--link); }

/* Scanlines and a soft vignette: a switch, on unless the visitor turned it off (retro.js). */
html.crt body.retro::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483000;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .14) 2px 3px),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, .28) 100%);
}

@media (max-width: 480px) {
  body.retro { padding: 12px 8px; }
  .screen { padding: 20px 12px 24px; }
  .retro h1, .logo { font-size: 24px; }
  .box, .card { padding: 24px 10px 8px; margin-left: var(--px); margin-right: var(--px); }
  .box > :is(h1, h2):first-child, .card > :is(h1, h2):first-child { margin-left: -2px; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
  .button:active, .retro button:active { transform: none; }
}
.fine { font-size: 16px; line-height: 1.5; margin-top: 24px; }

/* Forms, and pages written before the kit (platform/): their inline greys and hairlines take the
   kit's colours so every text stays AA on the blue screen. */
.retro input, .retro select, .retro textarea {
  font: 16px/24px var(--font);
  color: var(--ink);
  background: #24246e;
  border: 0;
  border-radius: 0;
  padding: 8px 12px;
  box-shadow: 0 0 0 var(--px) var(--ink);
  margin: var(--px);
  max-width: 100%;
}
.retro label { display: inline-block; margin: 8px 0 4px; }
.retro table { border-collapse: collapse; }
.retro th, .retro td { border-bottom: 2px solid var(--dim); padding: 4px 8px; text-align: left; }
.retro code, .retro pre { font-family: var(--font); }
.retro [style*="color"] { color: var(--dim) !important; }
.retro [style*="border"] { border-color: var(--ink) !important; border-radius: 0 !important; }
.retro [style*="background"] { background: #24246e !important; }

/* The landing's typed-in demo (retro.js): the machine's boot colours, at a size that stays AA. */
.demo { justify-content: flex-start; align-items: flex-start; }
.demo-screen {
  margin: 0;
  width: 100%;
  font: 16px/1.5 var(--font);
  color: var(--ink);
  white-space: pre-wrap;
  text-align: left;
  overflow: hidden;
  text-shadow: 0 0 3px rgba(190, 190, 255, .45);
}
@media (max-width: 480px) { .demo-screen { font-size: 8px; line-height: 12px; } }
