@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/montserrat-latin-600-normal.woff2') format('woff2');
}

:root {
  --black: #000;
  --frost: #e7ecf2;
  --mag: #ff3d9a;
  --grn: #36f0a0;
  --mag-slip: rgba(255, 61, 154, 0.75);
  --grn-slip: rgba(54, 240, 160, 0.75);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

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

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

body {
  color: var(--frost);
  font: 600 1rem/1.4 'Montserrat', system-ui, sans-serif;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

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

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

/* ---------- layout ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--black);

  /* one shared cell, so a <noscript> wrapper never adds a row */
  > * { grid-area: 1 / 1; }
  &.is-locked { cursor: none; }
}

.snow, .snow-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}
.snow-still { object-fit: cover; }

/* ---------- mark and text ---------- */
.ident {
  position: relative;
  display: grid;
  justify-items: center;
  gap: clamp(1.1rem, 3.4vh, 2.4rem);
  width: 100%;
  padding-inline: 16px;
  transform: translateY(-2vh);
}

.logo {
  margin: 0;
  width: min(78vw, 96vh, max(46rem, 40vw));
  line-height: 0;
}

.mark {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.line, .plain-line {
  margin: 0;
  min-height: 1.4em;
  font-size: clamp(0.9rem, 0.7rem + 1vw, 1.5rem);
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-align: center;
}

/* legibility without the canvas */
.plain-line { text-shadow: 0 1px 2px #000, 0 2px 12px rgba(0, 0, 0, 0.9); }

.line span {
  display: inline-block;
  animation: settle 900ms var(--ease-out) both;
}
.line.is-breaking span { animation: break-up 300ms steps(6, end) both; }

@keyframes settle {
  from {
    opacity: 0;
    text-shadow: -7px 0 var(--mag-slip), 7px 0 var(--grn-slip);
  }
  to {
    opacity: 1;
    text-shadow: 0 0 transparent, 0 0 transparent;
  }
}

@keyframes break-up {
  0% { opacity: 1; transform: translateX(0); text-shadow: -2px 0 var(--mag-slip), 2px 0 var(--grn-slip); }
  30% { transform: translateX(-9px) skewX(-14deg); }
  55% { opacity: 0.7; transform: translateX(14px); text-shadow: -9px 0 var(--mag-slip), 9px 0 var(--grn-slip); }
  80% { transform: translateX(-4px) scaleY(0.35); }
  100% { opacity: 0; transform: translateX(22px) scaleY(0.1); text-shadow: -14px 0 var(--mag-slip), 14px 0 var(--grn-slip); }
}

/* ---------- osd ---------- */
.osd {
  position: absolute;
  top: max(8vh, 28px);
  right: max(8vw, 24px);
  width: clamp(28px, 3.1vw, 50px);
  height: auto;
  visibility: hidden;

  &.is-on { visibility: visible; }
}

/* ---------- no script ---------- */
@media (scripting: none) {
  .snow, .plain { display: none; }
  .osd { visibility: visible; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition: none !important;
  }
  .line span { animation: none; }
}
