/* THE STATIC ROOM — nothing is currently showing. change the channel. */

:root {
  --scan: rgba(0, 0, 0, 0.25);
  --off-black: #050505;
}

body.static-room {
  background: var(--off-black);
  color: #d8d8d8;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  font-family: "Courier New", monospace;
  position: relative;
  overflow: hidden;
}

.static-room h1 {
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.4rem;
  opacity: 0.7;
  margin-bottom: 2rem;
  text-align: center;
}

.channel-changer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* the television */
.tv {
  width: min(90vw, 560px);
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: #111;
  border: 10px solid #1c1c1c;
  box-shadow: 0 0 0 2px #000, 0 30px 60px rgba(0,0,0,0.8);
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 8px;
}

/* animated noise — an SVG turbulence filter tiled and nudged every frame,
   the closest CSS/SVG gets to real television snow without a canvas */
.noise {
  position: absolute;
  inset: -20%;
  width: 140%;
  height: 140%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.9 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 120px 120px;
  filter: contrast(1.3);
  animation: jitter 0.1s steps(1) infinite;
  opacity: 1;
  transition: opacity 0.3s ease;
}

@keyframes jitter {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-4%, 2%); }
  50%  { transform: translate(3%, -3%); }
  75%  { transform: translate(-2%, -4%); }
  100% { transform: translate(0, 0); }
}

/* scanlines over everything */
.screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    var(--scan) 3px,
    transparent 4px
  );
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 5;
}

/* vignette + flicker */
.screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.7) 100%);
  animation: tv-flicker 4s infinite;
}

@keyframes tv-flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.7; }
  94% { opacity: 1; }
}

/* channel content — CSS-only tab switcher via radio inputs */
.channel-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 4;
}

.channel-content .ch-label {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 1.1rem;
  color: #eee;
  text-shadow: 0 0 12px rgba(255,255,255,0.5);
}

input[type="radio"].tuner { display: none; }

.noise { z-index: 3; }

/* :has() lets the channel state live anywhere in the set — the radios
   don't need to be direct siblings of what they control */
.channel-changer:has(#ch1:checked) .noise,
.channel-changer:has(#ch2:checked) .noise,
.channel-changer:has(#ch3:checked) .noise {
  opacity: 0.12;
}
.channel-changer:has(#ch1:checked) #content-1 { opacity: 1; }
.channel-changer:has(#ch2:checked) #content-2 { opacity: 1; }
.channel-changer:has(#ch3:checked) #content-3 { opacity: 1; }

/* the dial */
.dial {
  margin-top: 2rem;
  display: flex;
  gap: 0.75rem;
}
.dial label {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #888;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.channel-changer:has(#ch0:checked) label[for="ch0"],
.channel-changer:has(#ch1:checked) label[for="ch1"],
.channel-changer:has(#ch2:checked) label[for="ch2"],
.channel-changer:has(#ch3:checked) label[for="ch3"] {
  border-color: #d8d8d8;
  color: #fff;
}

/* click the set, it takes it personally */
.tv { cursor: pointer; }
.tv.tv-thump {
  animation: thump 0.3s ease-out;
}
@keyframes thump {
  0%   { transform: translate(0, 0) skewX(0deg); }
  20%  { transform: translate(-3px, 1px) skewX(-1deg); }
  40%  { transform: translate(3px, -1px) skewX(1deg); }
  60%  { transform: translate(-2px, 0) skewX(-0.5deg); }
  100% { transform: translate(0, 0) skewX(0deg); }
}

.static-room .placard.hint {
  margin-top: 2rem;
  max-width: 36ch;
  text-align: center;
  font-size: 0.75rem;
  opacity: 0.7;
}
