/* One dark scheme, taken from the artwork: black, white and its deep red. There is no light
   version, as the artwork has none.

   Contrast of every pair in use (WCAG 2.2, 1.4.3 and 1.4.11):
     text   #ededee  on page 16.8:1, on panel 15.1:1, on band 17.9:1
     dim    #a9a9ae  on page  8.4:1, on panel  7.6:1, on band  9.0:1
     link   #ff6b78  on page  7.1:1, on panel  6.4:1, on band  7.6:1
     white  #ffffff  on red   8.4:1 (the buttons' text)
     edge   #e03040  on page  4.3:1, on panel  3.9:1 (the buttons' and the panels' edge)
     focus  #ffffff  on page 19.7:1, on red    8.4:1
   The deep red itself is 2.3:1 on the page: it is only ever behind white text or decoration. */
:root {
  color-scheme: dark;
  --page: #0b0b0c;
  --band: #000;
  --panel: #18181b;
  --text: #ededee;
  --dim: #a9a9ae;
  --link: #ff6b78;
  --red: #a00000;
  --red-lit: #b80a0a;
  --edge: #e03040;
  --rule: #3a3a40;
}

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

/* A layout rule must not bring an empty status line back. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--text);
  font: 1.0625rem/1.6 system-ui, sans-serif;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:hover {
  color: #fff;
}

:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  padding: 0.5rem 0.75rem;
  background: var(--red);
  color: #fff;
  font-weight: 700;
}

.skip:focus {
  top: 0.5rem;
}

/* The bands above and below the content, as wide as the window. */
.site {
  background: var(--band);
  padding: 0.75rem max(1rem, (100% - 64rem) / 2);
}

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  border-bottom: 3px solid var(--red);
}

footer.site {
  margin-top: auto;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.brand {
  display: block;
  padding: 0.375rem 0;
  line-height: 0;
}

.wordmark {
  width: auto;
  height: 2rem;
  fill: #fff;
}

.site ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site nav a {
  display: inline-block;
  padding: 0.375rem 0;
  color: var(--text);
}

header.site nav a {
  border-bottom: 3px solid transparent;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

header.site nav a:hover,
header.site nav a[aria-current] {
  border-bottom-color: var(--edge);
}

/* Beside "Stream" in the menu while the channel is live. */
.on-now {
  margin-left: 0.5rem;
  padding: 0.1rem 0.45rem;
  background: var(--red);
  border: 1px solid var(--edge);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site nav a:hover {
  color: #fff;
}

footer.site nav a[aria-current] {
  font-weight: 700;
}

main {
  width: 100%;
  max-width: 66rem;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

/* Text keeps to a line one can read, wherever it sits. */
h1,
h2,
p,
ol,
ul,
dl {
  max-width: 42rem;
}

/* Two pieces side by side once there is room. With side-right the first piece, which a
   narrow window shows first, goes to the right as the narrower one. */
.columns {
  display: grid;
  gap: 0 3rem;
}

.columns > * {
  min-width: 0;
}

@media (min-width: 52rem) {
  .columns {
    grid-template-columns: 1fr 1fr;
  }

  .columns.side-right {
    grid-template-columns: minmax(0, 1fr) 21rem;
  }

  .side-right > .side {
    grid-column: 2;
    grid-row: 1;
  }

  .side-right > .body {
    grid-column: 1;
    grid-row: 1;
  }
}

h1,
h2 {
  font-style: italic;
  font-weight: 800;
  line-height: 1.15;
}

h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

h2 {
  margin: 2.5rem 0 0.75rem;
  padding-left: 0.75rem;
  border-left: 0.3rem solid var(--red);
  font-size: 1.5rem;
}

p,
ol,
ul,
dl {
  margin: 0 0 1rem;
}

li {
  margin-bottom: 0.4rem;
}

/* The two rows above a server's page: which game, and which of its servers. Each choice is
   a link, and the chosen one is marked by its edge and its weight, not by colour alone. */
.selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2.5rem;
  margin: 0 0 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.selector div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.selector span {
  color: var(--dim);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selector ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.selector a {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  background: var(--panel);
  border: 2px solid var(--rule);
  color: var(--text);
  text-decoration: none;
}

.selector a:hover {
  border-color: var(--edge);
  color: #fff;
}

.selector a[aria-current] {
  border-color: var(--edge);
  color: #fff;
  font-weight: 700;
}

.lead {
  font-size: 1.1875rem;
}

.note {
  color: var(--dim);
  font-size: 0.9375rem;
}

code {
  padding: 0.1em 0.3em;
  background: var(--panel);
  border: 1px solid var(--rule);
  font: 0.9em ui-monospace, Consolas, Menlo, monospace;
}

.button {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  background: var(--red);
  border: 2px solid var(--edge);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.button:hover {
  background: var(--red-lit);
  border-color: #fff;
}

.links {
  padding: 0;
  list-style: none;
}

.links li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--rule);
}

.links a {
  min-width: 7rem;
  font-size: 1.1875rem;
  font-weight: 700;
}

.links span {
  color: var(--dim);
}

.panel {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border-left: 0.3rem solid var(--edge);
}

.body > section:first-child h2 {
  margin-top: 1.5rem;
}

.panel h2 {
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
  font-size: 1.125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel p {
  margin: 0;
}

#status-summary {
  font-size: 1.25rem;
  font-weight: 700;
}

#status-restart,
#status-version {
  color: var(--dim);
}

.facts div {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.facts dt {
  color: var(--dim);
}

.facts dd {
  margin: 0;
}

@media (max-width: 24rem) {
  .facts div {
    grid-template-columns: 1fr;
  }
}

/* The set that opens the start page: a screen with the astronaut as its picture. While the
   channel is off air there is static over the picture. Live, the screen has a red edge and
   an "on air" sign, shows the stream's own picture and a large button to play it; and once
   the visitor has pressed play it gives way to YouTube's player and chat (live.js).
   The static is one small tile of noise, shifted five times a second, under scan lines and
   darker corners. It is fine grain at an even brightness, so nothing flashes, and it moves
   only once live.js is there with its pause button, and not at all for someone whose device
   asks for less motion until they start it. */
.set {
  margin: 0 0 1rem;
}

.screen {
  position: relative;
  display: grid;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1rem 3.75rem;
  overflow: hidden;
  background: #000;
  border: 2px solid var(--rule);
}

/* Live, the screen is the stream's: its picture with the plate below it as a bar. */
.live .screen {
  display: block;
  padding: 0;
  border-color: var(--edge);
}

/* The page's headline is for those who hear the page: the wordmark above says it to the
   rest. */
.screen h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The astronaut on the banner's red slant. */
.stage {
  justify-self: center;
  width: min(100%, 16rem);
}

.art {
  line-height: 0;
  background: linear-gradient(105deg, transparent 0 24%, var(--red) 24.3%);
}

/* Live, the stage is the shape of a video. It shows the stream's picture, or the astronaut
   at its side when there is none. */
.live .stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.live .art {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  aspect-ratio: 1;
}

.live .art img {
  width: 100%;
  height: 100%;
}

.pictured .art {
  display: none;
}

/* Out of the stage's layout, so the button alone is centred in it. */
.picture {
  position: absolute;
  inset: 0;
}

.picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The offer to play, in the middle of the picture as a player has it. */
.play {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  background: var(--red);
  border: 2px solid var(--edge);
  box-shadow: 0 0 2.5rem 0.5rem #000;
  color: #fff;
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.play:hover {
  background: var(--red-lit);
  border-color: #fff;
}

.play svg {
  width: 1.75rem;
  height: 1.75rem;
  fill: currentColor;
}

/* Larger, with the words under the triangle, once the picture has the room. */
@media (min-width: 40rem) {
  .play {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.9rem 1.75rem 1rem;
  }

  .play svg {
    width: 3rem;
    height: 3rem;
  }
}

@media (min-width: 46rem) {
  .screen {
    grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
    gap: 1.5rem 2rem;
    padding: 2rem;
  }

  .stage {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
  }
}

.screen::before,
.screen::after {
  content: "";
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.screen::before {
  inset: -6rem;
  background: url("/static.webp") 0 0 / 256px 256px;
  image-rendering: pixelated;
  opacity: 0.5;
}

.screen::after {
  inset: 0;
  background:
    repeating-linear-gradient(to bottom, transparent 0 2px, rgb(0 0 0 / 0.4) 2px 4px),
    radial-gradient(ellipse at center, transparent 50%, rgb(0 0 0 / 0.75));
}

/* Live, the picture is clear. */
.live .screen::before,
.live .screen::after {
  content: none;
}

.moving .screen::before {
  animation: static 1s steps(1) infinite;
}

@keyframes static {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-37px, 61px); }
  40% { transform: translate(53px, -29px); }
  60% { transform: translate(-71px, -43px); }
  80% { transform: translate(19px, 83px); }
}

@media (prefers-reduced-motion: reduce) {
  .moving .screen::before {
    animation: none;
  }
}

/* The words on the screen, on black of their own so the static never runs over them. */
.plate {
  position: relative;
  z-index: 2;
  max-width: 36rem;
  padding: 1rem 1.25rem;
  background: #000;
  border: 1px solid var(--rule);
}

@media (min-width: 46rem) {
  .plate {
    grid-column: 1;
    grid-row: 1;
  }
}

.plate > p:last-child,
.plate > .actions:has(+ [hidden]) {
  margin-bottom: 0;
}

.live .plate {
  position: static;
  max-width: none;
  padding: 1rem 1.25rem;
  border: 0;
  border-top: 2px solid var(--edge);
}

.signal {
  margin-bottom: 0.25rem;
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* The sign in the screen's corner, with a lamp that glows and dims. */
.on-air {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin: 0;
  padding: 0.15em 0.6em;
  background: var(--red);
  border: 2px solid var(--edge);
  color: #fff;
  font-size: clamp(1.25rem, 1rem + 1.5vw, 2rem);
}

.on-air::before {
  content: "";
  width: 0.55em;
  height: 0.55em;
  background: #fff;
  border-radius: 50%;
  /* Twice down and back, 3.2 seconds, and then it stays lit: blinking that goes on for more
     than five seconds needs a way to stop it (WCAG 2.2.2). */
  animation: lamp 0.8s ease-in-out 4 alternate;
}

@keyframes lamp {
  to { opacity: 0.2; }
}

@media (prefers-reduced-motion: reduce) {
  .on-air::before {
    animation: none;
  }
}

.stream-title {
  max-width: none;
  font-size: clamp(1.25rem, 1rem + 1.5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
}

.stream-title:empty {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

/* Beside the offer to play, the way to YouTube is the second choice and looks it. */
.live .actions .button {
  background: none;
}

/* The introduction, below the screen while the channel is live. */
.set > .lead {
  margin: 1.25rem 0 0;
}

button {
  font: inherit;
  cursor: pointer;
}

/* Pausing the static, in the screen's corner. */
.tv-pause {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: #000;
  border: 1px solid var(--dim);
  color: var(--text);
}

.tv-pause svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.set-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  max-width: none;
  margin: 0.75rem 0 0;
}

.set-controls button {
  padding: 0.35rem 0.9rem;
  background: var(--panel);
  border: 1px solid var(--dim);
  color: var(--text);
}

.set-controls button:hover,
.tv-pause:hover {
  border-color: #fff;
  color: #fff;
}

/* Playing: the screen gives way to the player, with the chat beside it once there is room. */
.playing .screen {
  display: block;
  padding: 0;
  border: 0;
}

.playing .screen::before,
.playing .screen::after {
  content: none;
}

.playing .stage,
.playing .plate {
  display: none;
}

.frames {
  display: grid;
  width: 100%;
  gap: 0.75rem;
}

.frames iframe {
  display: block;
  width: 100%;
  border: 0;
  background: #000;
}

.frames .player {
  height: auto;
  aspect-ratio: 16 / 9;
}

.frames .chat {
  height: 30rem;
}

@media (min-width: 60rem) {
  .frames {
    grid-template-columns: minmax(0, 1fr) 22rem;
  }

  .frames .chat {
    height: 100%;
    min-height: 20rem;
  }
}

/* With the reader's own colours the red backgrounds go, so the edges carry the shapes. */
@media (forced-colors: active) {
  /* The wordmark in the reader's text colour, on whatever their background is. */
  .wordmark {
    fill: CanvasText;
  }

  /* The slant behind the astronaut is part of the picture, so it keeps its red. */
  .art {
    forced-color-adjust: none;
  }

  .button {
    border-color: ButtonText;
  }

  /* A transparent border shows here, so the links that aren't the current page hide theirs. */
  header.site nav a {
    border-bottom-color: Canvas;
  }

  header.site nav a:hover,
  header.site nav a[aria-current] {
    border-bottom-color: LinkText;
  }
}
