/*
 * untuned.gg: WARDEN's broadcast. The page is one deliberate dark look, the
 * game's own: its night-blue ground, cream type, and WARDEN's signal pink.
 * Every piece of pixel art is an <img class="pixel"> drawn at a whole-number
 * scale of its true size; the scales (--k-*) change only at breakpoints where
 * the larger scale fits. Two-frame art is a strip in a box one frame wide,
 * stepped across in whole frames. Nothing moves with reduced motion.
 *
 * Layout: a test card hero, a news crawl band, then the story, the clips on
 * CCTV monitors, the cast, and the sign-off, each in one centred column that
 * opens into a grid on wider screens.
 */
:root {
  --ink: #1b1528;
  --night: #113447;
  --deep: #0f2433;
  --teal: #2aa89a;
  --mint: #84e3c3;
  --cream: #f0e3c2;
  --paper: #fffbee;
  --red: #e63c3a;
  --yellow: #f6b830;
  --pink: #ff2fb0;
  --haze: #8389ab;
  --plum: #4a2140;

  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Whole-number scales of the art, smallest screens first. */
  --k-hero: 2;
  --k-soon: 2;
  --k-head: 2;
  --k-crawl: 2;
  --k-panel: 2;
  --k-clip: 2;

  color-scheme: dark;
}

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

html {
  background: var(--ink);
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font: 400 1rem/1.6 var(--mono);
  -webkit-text-size-adjust: 100%;
}

h1,
h2,
h3,
p,
ol,
ul,
figure {
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: calc(1120px + 32px);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.pixel {
  display: block;
  max-width: none;
  /* The width and height attributes give the true size; each image's width sets its scale and its height follows. */
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* Two frames side by side in a box one frame wide: the strip steps across in whole frames. */
.flip {
  display: block;
  overflow: hidden;
}
.flip > img,
.flip > picture > img {
  animation: flip 1.2s steps(2) infinite;
}
@keyframes flip {
  to {
    transform: translateX(-100%);
  }
}

/* ---------------------------------------------------------------- hero */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 38%, var(--night) 0%, var(--deep) 46%, var(--ink) 78%);
  padding-block: 40px 48px;
}
/* Scan lines over the test card's picture. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgb(0 0 0 / 0.16) 0 1px, transparent 1px 3px);
}

.hero-inner {
  display: grid;
  justify-items: center;
  gap: 20px;
  text-align: center;
}

.on-air {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  border: 2px solid var(--pink);
  color: var(--pink);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.dot,
.rec {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1s steps(1, end) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

.test-card {
  animation: signal 5s steps(1, end) infinite;
}
.title {
  width: calc(140px * var(--k-hero));
}
/* A picture on a bad signal: still nearly always, then a jolt of a pixel or two. */
@keyframes signal {
  0% {
    transform: none;
  }
  86% {
    transform: translateX(calc(2px * var(--k-hero)));
  }
  87% {
    transform: translateX(calc(-1px * var(--k-hero)));
  }
  88% {
    transform: none;
  }
  93% {
    transform: translateY(calc(1px * var(--k-hero)));
  }
  94% {
    transform: none;
  }
}

.soon-box {
  width: calc(105px * var(--k-soon));
}
.soon-strip {
  width: calc(210px * var(--k-soon));
}
.flip > .soon-strip {
  animation: lit 1.4s steps(1, end) infinite;
}
/* Lit for most of the beat, dimmed for the rest. */
@keyframes lit {
  0% {
    transform: none;
  }
  70% {
    transform: translateX(-50%);
  }
}

.tagline {
  max-width: 34ch;
  color: var(--paper);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.45;
  text-wrap: balance;
}
.hook {
  max-width: 40ch;
  color: var(--cream);
  line-height: 1.5;
  text-wrap: balance;
}
.platforms {
  text-wrap: balance;
  color: var(--mint);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

/* Where to follow the game: two buttons that wrap onto two lines on a narrow phone. */
.follow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.follow a {
  display: inline-block;
  padding: 10px 14px;
  border: 2px solid var(--mint);
  color: var(--mint);
  font-size: 0.85rem;
  line-height: 1.4;
  text-decoration: none;
}
.follow b {
  color: var(--paper);
}
.follow a:hover {
  background: var(--mint);
  color: var(--ink);
}
.follow a:hover b {
  color: var(--ink);
}
.follow a:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- crawl */

.crawl {
  overflow: hidden;
  border-block: 2px solid var(--pink);
  background: var(--plum);
  padding-block: 10px;
}
.crawl-track {
  display: flex;
  width: max-content;
  animation: crawl 40s steps(1325) infinite;
}
.crawl-strip {
  width: calc(1325px * var(--k-crawl));
}
@keyframes crawl {
  to {
    transform: translateX(-50%);
  }
}

/* ---------------------------------------------------------------- sections */

main {
  display: grid;
  gap: 72px;
  padding-block: 56px 72px;
}

section {
  display: grid;
  justify-items: center;
  gap: 24px;
}

.head-story {
  width: calc(147px * var(--k-head));
}
.head-clips {
  width: calc(151px * var(--k-head));
}
.head-cast {
  width: calc(75px * var(--k-head));
}

.section-note {
  margin-top: -12px;
  color: var(--haze);
  font-size: 0.85rem;
  text-align: center;
}

/* The story */

.story-text {
  display: grid;
  gap: 14px;
  max-width: 62ch;
  min-width: 0;
}
.kicker {
  color: var(--paper);
  font-weight: 700;
}

.panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 0;
  list-style: none;
}
.panel {
  display: grid;
  justify-items: center;
  gap: 8px;
}
.panel-box {
  width: calc(128px * var(--k-panel));
}
.panel-strip {
  width: calc(256px * var(--k-panel));
}
.panel p {
  max-width: calc(128px * var(--k-panel));
  text-wrap: balance;
  hyphens: manual;
  color: var(--yellow);
  font-size: 0.85rem;
  text-align: center;
}

/* The clips, on CCTV monitors */

.clips {
  grid-template-columns: 1fr;
}
.clips h2,
.clips .section-note {
  grid-column: 1 / -1;
}

.monitor {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
}
.cam {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.screen {
  /* The monitor's bezel is painted around the picture and takes no room, so the picture keeps its whole scale. */
  box-shadow:
    0 0 0 3px var(--ink),
    0 0 0 6px #3a3550,
    0 0 0 8px var(--ink);
}
.pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.clip-room {
  width: calc(144px * var(--k-clip));
}
/* The phone screen stays at twice its size: at three times it would stand taller than most screens. */
.clip-phone {
  width: calc(144px * 2);
}
.line {
  max-width: calc(144px * var(--k-clip));
  color: var(--paper);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  text-wrap: balance;
}
.monitor-pair .line {
  max-width: 36ch;
}

/* The cast */

.people {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  width: 100%;
  max-width: 900px;
  padding: 0;
  list-style: none;
}
.person {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  text-align: center;
}
.person h3 {
  margin-top: 6px;
  color: var(--yellow);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.person p {
  max-width: 28ch;
  font-size: 0.9rem;
}
/* Each figure at its own whole scale, standing on the same line. */
.ned-box {
  width: calc(14px * 4);
}
.ned-strip {
  width: calc(28px * 4);
}
.echo-box {
  width: calc(7px * 6);
  margin-top: calc(100px - 13px * 6);
}
.echo-strip {
  width: calc(14px * 6);
}
.warden-box {
  width: calc(34px * 3);
  margin-top: calc(100px - 18px * 3);
}
.warden-strip {
  width: calc(68px * 3);
}
.flip > .warden-strip {
  animation-duration: 2.4s;
}

/* ---------------------------------------------------------------- sign-off */

.sign-off {
  border-top: 2px solid var(--pink);
  background: radial-gradient(ellipse at 50% 0%, var(--night) 0%, var(--ink) 70%);
  padding-block: 48px;
}
.sign-off-inner {
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}
.small {
  color: var(--haze);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------- wider screens */

@media (max-width: 339px) {
  :root {
    --k-head: 1;
  }
}

@media (min-width: 480px) {
  :root {
    --k-hero: 3;
    --k-soon: 3;
    --k-crawl: 3;
  }
}

@media (min-width: 640px) {
  .panels {
    grid-template-columns: repeat(2, auto);
  }
  .clips {
    grid-template-columns: repeat(2, auto);
    justify-content: center;
    column-gap: 24px;
    row-gap: 56px;
  }
  .monitor-pair,
  .monitor-phone {
    grid-column: 1 / -1;
  }
  .pair {
    grid-template-columns: repeat(2, auto);
  }
  .people {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  :root {
    --k-hero: 4;
    --k-soon: 4;
    --k-head: 3;
    --k-clip: 3;
  }
  .hero {
    padding-block: 64px 72px;
  }
  .clips {
    column-gap: 48px;
  }
  .tagline {
    font-size: 1.4rem;
  }
}

@media (min-width: 1200px) {
  .panels {
    grid-template-columns: repeat(4, auto);
  }
}

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

.nowrap {
  white-space: nowrap;
}

.home {
  color: var(--mint);
  text-underline-offset: 4px;
}
.home:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 4px;
}
