/* ------------------------------------------------------------------
   Base: fonts, variables, reset and the opening white blast.
   ------------------------------------------------------------------ */

@font-face {
  font-family: "VT323";
  src: url("../assets/fonts/vt323-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --green: #00ff00;                 /* cmd "color a" */
  --osd: "VT323", "Lucida Console", monospace;                     /* TV on-screen text */
  --mono: Consolas, "Lucida Console", "DejaVu Sans Mono", "Courier New", monospace;
  --ui: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  margin: 0;
  background: #000;
  overflow: hidden;
}

body {
  font-family: var(--ui);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.noscript {
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-content: center; gap: 8px;
  padding: 24px;
  background: #000; color: var(--green);
  font-family: var(--mono); text-align: center;
}
.noscript a { color: inherit; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.stage { position: absolute; inset: 0; }

#blackout {
  position: absolute; inset: 0;
  z-index: 90;
  background: #000;
}

/* ---------- Opening: a dot in the dark, then white blasts out from the center ---------- */

#blast {
  position: absolute; inset: 0;
  z-index: 100;
  display: grid; place-items: center;
  background: #000;
  pointer-events: none;
}
#blast i {
  display: block;
  width: 12vmax; height: 12vmax;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6vmax 4vmax #fff;
  transform: scale(.012);
}
#blast.go i { animation: blast .24s cubic-bezier(.7, 0, 1, .55) forwards; }
#blast.go   { animation: blast-fade .75s .3s ease-out forwards; }

@keyframes blast {
  from { transform: scale(.012); }
  to   { transform: scale(15); }
}
@keyframes blast-fade {
  from { background: #fff; opacity: 1; }
  to   { background: #fff; opacity: 0; }
}

/* ---------- Switching off: the picture squeezes into a line, then a dot ---------- */
/* Used after HI! in the terminal and by "Turn off" on the computer. */

.stage.crt-off { animation: crt-off .5s cubic-bezier(.6, 0, .9, .4) forwards; }
@keyframes crt-off {
  0%   { transform: scale(1, 1);    filter: brightness(1); }
  55%  { transform: scale(1, .006); filter: brightness(4); }
  100% { transform: scale(0, .006); filter: brightness(8); }
}

@media (prefers-reduced-motion: reduce) {
  #blast.go i { animation: none; transform: scale(15); }
  #blast.go   { animation-duration: 1.2s; animation-delay: 0s; }
  .stage.crt-off { animation-duration: .01s; }
}
