/* Nightboard'83 homepage. Orbitron, Oxanium, IBM Plex: SIL OFL 1.1, see fonts/OFL.txt */

@font-face {
  font-family: Orbitron;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/orbitron-latin-700.woff2") format("woff2");
}
@font-face {
  font-family: Oxanium;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/oxanium-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
}

:root {
  --void: #000;
  --ink: #d7eef3;
  --muted: #8eacb6;
  --cyan: #7ee9ff;
  --amber: #ffb15a;
  --ease: cubic-bezier(0.16, 0.84, 0.24, 1);
  --settle: 2.15s;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
}

body {
  min-height: 100dvh;
  overflow-x: clip;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.65;
  text-wrap: pretty;
  hyphens: auto;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 2.2s ease;
}

body::before {
  inset: -48px;
  background-image:
    linear-gradient(rgb(120 220 255 / 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgb(120 220 255 / 0.09) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 12%, #000 8%, transparent 70%);
}

body::after {
  left: 0;
  right: 0;
  bottom: 0;
  height: 32vh;
  background: radial-gradient(ellipse at 50% 120%, rgb(70 190 230 / 0.18), transparent 62%);
}

html.is-playing.is-settling body::before,
html.is-playing.is-settling body::after,
html.is-settled body::before,
html.is-settled body::after {
  opacity: 1;
}

::selection {
  background: rgb(126 233 255 / 0.28);
  color: #fff;
}

:focus-visible {
  outline: 1px solid #e7fcff;
  outline-offset: 3px;
}

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

.col {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 36px), 920px, calc(46dvh * 752 / 416));
  margin-inline: auto;
  transition: width var(--settle) var(--ease);
}

html.is-playing:not(.is-settling) .col {
  width: min(calc(100% - 36px), 1100px, calc(78dvh * 752 / 416));
}

.hero {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 28px 0 0;
  transition: min-height var(--settle) var(--ease), padding var(--settle) var(--ease);
}

html.is-playing:not(.is-settling) .hero {
  min-height: 100dvh;
  padding: 0;
}

.frame {
  position: relative;
  width: 100%;
  aspect-ratio: 752 / 416;
  background: #000;
  box-shadow:
    0 0 0 1px rgb(170 236 255 / 0.5),
    0 0 28px rgb(80 200 255 / 0.22);
}

.frame::before {
  content: "";
  position: absolute;
  inset: -8px;
  pointer-events: none;
  background:
    linear-gradient(var(--cyan), var(--cyan)) left top / 16px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) left top / 1px 16px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right top / 16px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right top / 1px 16px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) left bottom / 16px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) left bottom / 1px 16px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right bottom / 16px 1px no-repeat,
    linear-gradient(var(--cyan), var(--cyan)) right bottom / 1px 16px no-repeat;
  opacity: 0.8;
}

.frame video,
.frame .hold {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.frame .hold { opacity: 1; }
.frame video { opacity: 0; }

html.is-playing:not(.is-settled) .frame .hold { opacity: 0; }

html.is-playing.is-rolling:not(.is-settled) .frame video {
  opacity: 1;
  transition: opacity 0.45s linear;
}

html.is-settled .frame video { opacity: 0; }
html.is-settled .frame .hold { opacity: 1; }

.copy {
  position: relative;
  width: min(100%, 66ch);
  margin-inline: auto;
  padding: 1.45rem 2px max(4.5rem, env(safe-area-inset-bottom));
  opacity: 1;
  transform: none;
  transition: opacity 1.55s ease, transform 1.55s var(--ease);
}

html.is-playing:not(.is-settling) .copy {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.copy::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  top: 0;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0;
  pointer-events: none;
}

html.is-playing.is-settling .copy::after {
  animation: sweep 1.7s var(--ease) forwards;
}

@keyframes sweep {
  0% { top: 0; opacity: 0.85; }
  100% { top: 100%; opacity: 0; }
}

.status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 1.15rem;
  font-family: Orbitron, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #9aefff;
}

.lamp {
  width: 0.48rem;
  height: 0.48rem;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.copy p { margin: 0 0 1rem; }

code {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.9em;
  color: #f3fdff;
  background: rgb(126 233 255 / 0.08);
  border: 1px solid rgb(126 233 255 / 0.22);
  padding: 0.02em 0.35em;
}

.warn {
  margin-top: 1.35rem;
  padding: 0.85rem 1rem 0.95rem;
  border: 1px solid rgb(255 177 90 / 0.48);
  background: linear-gradient(180deg, rgb(255 177 90 / 0.07), transparent 78%);
  color: #f2e2cf;
}

.warn strong {
  font-family: Orbitron, sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--amber);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.65rem 1.15rem;
  font-family: Oxanium, sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  color: #c9f7ff;
  background: rgb(6 16 20 / 0.55);
  border: 1px solid rgb(126 233 255 / 0.55);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.btn:hover {
  background: rgb(126 233 255 / 0.12);
  color: #fff;
  box-shadow: 0 0 18px rgb(126 233 255 / 0.22);
}

.btn-primary {
  background: #dff9ff;
  border-color: #dff9ff;
  color: #041016;
}

.btn-primary:hover {
  background: #fff;
  color: #041016;
  box-shadow: 0 0 22px rgb(190 245 255 / 0.35);
}

.sound,
.skip {
  font-family: Orbitron, sans-serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  background: rgb(0 0 0 / 0.55);
  border: 1px solid rgb(126 233 255 / 0.45);
  cursor: pointer;
}

.sound {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  padding: 0.45rem 0.6rem;
}

.sound[hidden] { display: none; }

html.needs-gesture .sound {
  top: 50%;
  right: auto;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0.8rem 1rem;
  background: rgb(0 0 0 / 0.78);
}

.skip {
  position: fixed;
  z-index: 3;
  top: 14px;
  left: 16px;
  display: none;
  padding: 0.5rem 0.7rem;
}

html.is-playing:not(.is-settled) .skip { display: inline-block; }

.boot {
  display: none;
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: 14vh;
  margin: 0;
  transform: translateX(-50%);
  font-family: Orbitron, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgb(126 233 255 / 0.8);
  opacity: 0;
  animation: arrive 0.01s linear 0.5s forwards;
}

.boot::after {
  content: " ▋";
  animation: blink 1s steps(1) infinite;
}

html.is-playing:not(.is-rolling):not(.is-settling) .boot { display: block; }

@keyframes arrive { to { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 640px) {
  body { font-size: 1.05rem; }
  .status { letter-spacing: 0.14em; }
  .actions { flex-direction: column; align-items: stretch; }
  .warn { padding-inline: 0.8rem; }
}

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

html.is-instant .hero,
html.is-instant .col,
html.is-instant .copy,
html.is-instant .copy::after {
  animation: none !important;
  transition: none !important;
}
