@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Plex Mono";
  src: url("fonts/plex-mono-600.woff2") format("woff2");
  font-weight: 600;
  font-display: block;
}

@font-face {
  font-family: "Manrope";
  src: url("fonts/manrope-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: block;
}

:root {
  color-scheme: dark;

  --black: #000;
  --white: #fff;

  /* Console: a touch warm, like phosphor. Dim text stays above 4.5:1 on black. */
  --console-fg: #ecebe4;
  --console-dim: #8e8d86;

  /* Splash halo, tight to wide. */
  --halo-core: rgb(255 255 255 / 0.9);
  --halo-near: rgb(255 255 255 / 0.4);
  --halo-far: rgb(255 255 255 / 0.16);
  --halo-air: rgb(255 255 255 / 0.07);

  --beat: 952ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --mono: "Plex Mono", ui-monospace, "SF Mono", monospace;
  --sans: "Manrope", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
}

html,
body {
  height: 100%;
  background: var(--black);
}

body {
  color: var(--white);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

::selection {
  background: var(--white);
  color: var(--black);
}

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

.boot {
  position: fixed;
  inset: 0;
  background: var(--black);
}

/* ---------- Phase 1: the console ---------- */

.console {
  position: absolute;
  inset: 0;
  padding:
    max(20px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  font: 400 clamp(10.5px, 0.55vw + 8px, 15px) / 1.5 var(--mono);
  color: var(--console-fg);
  text-shadow: 0 0 5px rgb(236 235 228 / 0.35);
  font-variant-numeric: tabular-nums;
  transform-origin: 50% 50%;
}

/* Scanlines and a soft vignette sell the tube without hurting legibility. */
.console::before,
.console::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.console::before {
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgb(0 0 0 / 0.22) 2px,
    rgb(0 0 0 / 0.22) 3px
  );
}

.console::after {
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgb(0 0 0 / 0.55) 100%);
}

.console__log {
  height: 100%;
  overflow: hidden;
}

.ln {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 1.5em;
}

.dim {
  color: var(--console-dim);
}

.hi {
  color: var(--white);
  font-weight: 600;
}

.tag {
  white-space: pre;
}

.tag b {
  color: var(--white);
  font-weight: 600;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.1em;
  margin-left: 1px;
  vertical-align: -0.18em;
  background: var(--console-fg);
  box-shadow: 0 0 6px rgb(236 235 228 / 0.5);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.cursor.is-still {
  animation: none;
}

.boot:not([data-phase="console"], [data-phase="prompt"]) .console {
  visibility: hidden;
}

/* ---------- The flash between eras ---------- */

.flash {
  position: absolute;
  inset: 0;
  background: var(--white);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Phase 2: the splash ---------- */

.splash {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  visibility: hidden;
}

.boot[data-phase="splash"] .splash,
.boot[data-phase="tease"] .splash {
  visibility: visible;
}

.lockup {
  position: relative;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Sit a little above true centre; the footer weighs down the bottom. */
  translate: 0 -3vh;
}

/* Wide, faint bloom: the glass of the display catching the light. */
.glare {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(150vw, 980px);
  aspect-ratio: 16 / 9;
  translate: -50% -50%;
  background: radial-gradient(
    closest-side,
    rgb(255 255 255 / 0.075),
    rgb(255 255 255 / 0.03) 42%,
    rgb(255 255 255 / 0.008) 70%,
    transparent
  );
  pointer-events: none;
  opacity: 0;
}

/* Fine grain inside the bloom. Without it, 8-bit black shows the gradient as rings. */
.glare::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0.09 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(closest-side, #000, transparent 80%);
  mask-image: radial-gradient(closest-side, #000, transparent 80%);
}

.lockup__logo,
.wordmark,
.progress {
  position: relative;
}

.logo {
  display: block;
  width: clamp(104px, 16vmin, 156px);
  height: auto;
  overflow: visible;
  color: var(--white);
  filter:
    drop-shadow(0 0 1px var(--halo-core))
    drop-shadow(0 0 7px var(--halo-near))
    drop-shadow(0 0 22px var(--halo-far))
    drop-shadow(0 0 54px var(--halo-air));
}

.wordmark {
  margin-top: clamp(22px, 3.6vmin, 34px);
  font: 500 clamp(36px, 5.4vmin + 14px, 78px) / 1 var(--sans);
  letter-spacing: -0.025em;
  white-space: nowrap;
  color: var(--white);
  text-shadow:
    0 0 1px var(--halo-core),
    0 0 9px var(--halo-near),
    0 0 26px var(--halo-far),
    0 0 64px var(--halo-air);
}

.wordmark__os {
  font-weight: 300;
  letter-spacing: 0;
}

.progress {
  margin-top: clamp(30px, 5.4vmin, 48px);
  width: clamp(168px, 30vmin, 280px);
  height: 2px;
  border-radius: 1px;
  background: rgb(255 255 255 / 0.13);
  filter: drop-shadow(0 0 3px rgb(255 255 255 / 0.55)) drop-shadow(0 0 10px rgb(255 255 255 / 0.2));
}

.progress__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--white);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.status {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 0 24px max(28px, calc(env(safe-area-inset-bottom) + 18px));
  text-align: center;
}

.status__message {
  font: 400 clamp(13px, 0.4vw + 11px, 15px) / 1.4 var(--sans);
  letter-spacing: 0.005em;
  color: rgb(255 255 255 / 0.74);
  text-shadow: 0 0 12px rgb(255 255 255 / 0.2);
  transition: opacity 260ms ease, filter 260ms ease;
}

.status__message.is-swapping {
  opacity: 0;
  filter: blur(3px);
  transition-duration: 180ms;
}

.status__dots i {
  font-style: normal;
  opacity: 0;
  transition: opacity 220ms ease;
}

.status__dots i.on {
  opacity: 1;
}

.status__version {
  font: 400 11px / 1 var(--mono);
  letter-spacing: 0.08em;
  color: rgb(255 255 255 / 0.52);
  font-variant-numeric: tabular-nums;
}

/* ---------- The ending: coming soon ---------- */

/* Hangs from the bottom of the lockup, where the bar was. The logo stays put
   while the buttons open above the text and push it down. */
.tease {
  position: absolute;
  top: calc(100% - 13px);
  left: 50%;
  width: min(calc(100vw - 48px), 560px);
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  visibility: hidden;
}

.boot[data-phase="tease"] .tease {
  visibility: visible;
}

.choices[hidden] {
  display: none;
}

.choices__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  /* Room for the glow and focus ring while the row is clipped mid-animation. */
  padding: 6px 6px clamp(18px, 2.8vmin, 26px);
}

.choice {
  min-height: 44px;
  padding: 0 22px;
  font: 500 15px / 1 var(--sans);
  letter-spacing: 0.005em;
  color: var(--white);
  background: rgb(255 255 255 / 0);
  border: 1px solid rgb(255 255 255 / 0.92);
  border-radius: 999px;
  box-shadow: 0 0 10px rgb(255 255 255 / 0.18), inset 0 0 8px rgb(255 255 255 / 0.07);
  text-shadow: 0 0 8px rgb(255 255 255 / 0.35);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 280ms ease,
    color 280ms ease,
    box-shadow 280ms ease,
    text-shadow 280ms ease,
    opacity 220ms ease;
}

/* Touch has no hover, and a sticky one would fill the wrong button. */
@media (hover: hover) {
  .choice:hover {
    background: var(--white);
    color: var(--black);
    text-shadow: none;
    box-shadow: 0 0 14px rgb(255 255 255 / 0.45), 0 0 40px rgb(255 255 255 / 0.16);
  }
}

.choice:active,
.choice.is-chosen {
  background: var(--white);
  color: var(--black);
  text-shadow: none;
  box-shadow: 0 0 16px rgb(255 255 255 / 0.55), 0 0 48px rgb(255 255 255 / 0.2);
  transition-duration: 40ms;
}

.choice:focus-visible {
  outline: 1px solid var(--white);
  outline-offset: 3px;
}

.choices.is-locked .choice {
  pointer-events: none;
}

.choices.is-locked .choice:not(.is-chosen) {
  opacity: 0.28;
}

/* Every character is laid out from the start and revealed in place, so the
   centred, wrapped text never shifts while it types. */
.typed {
  max-width: 34ch;
  min-height: 1.45em;
  font: 400 clamp(15px, 0.5vw + 13px, 18px) / 1.45 var(--mono);
  letter-spacing: 0.02em;
  text-align: center;
  text-wrap: balance;
  color: var(--white);
  text-shadow: 0 0 1px rgb(255 255 255 / 0.8), 0 0 10px rgb(255 255 255 / 0.35), 0 0 28px rgb(255 255 255 / 0.12);
}

.typed span {
  position: relative;
}

.typed span:not(.on) {
  visibility: hidden;
}

/* The caret hangs off the last shown character, so it takes no room in the line. */
.typed .caret::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 0.16em;
  width: 0.6em;
  height: 1.12em;
  margin-left: 1px;
  background: var(--white);
  box-shadow: 0 0 6px rgb(255 255 255 / 0.6), 0 0 18px rgb(255 255 255 / 0.22);
  animation: blink var(--beat) steps(1) infinite;
}

/* Shows even when its character hasn't been typed yet, but never once the splash is gone. */
.boot[data-phase="tease"] .typed .caret::after {
  visibility: visible;
}

.typed .caret--before::after {
  left: 0;
  margin-left: 0;
}

.typed.is-typing .caret::after {
  animation: none;
}

/* ---------- The meltdown ---------- */

/* Torn copies of the splash. Each covers a band of the real one. */
.slice {
  background: var(--black);
  pointer-events: none;
}

.boot.is-frozen *,
.boot.is-frozen *::after {
  animation-play-state: paused !important;
}

.wipe {
  position: absolute;
  inset: 0;
  background: var(--black);
  transform: translateY(-100%);
  pointer-events: none;
  visibility: hidden;
}

/* The bright edge of the wipe, riding just below the black. */
.wipe::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgb(255 255 255 / 0.85);
  box-shadow: 0 0 8px 1px rgb(255 255 255 / 0.45), 0 0 32px 4px rgb(255 255 255 / 0.12);
}

@media (prefers-reduced-motion: reduce) {
  .cursor,
  .typed .caret::after {
    animation: none;
  }

  .status__message.is-swapping {
    filter: none;
  }
}
