/* הילדים של העתיד: cream white + purple + the logo's green.
   The TV set is the loud element; the page around it stays light and calm. */

/* BN Oria, served from static/fonts by the backend (any file name containing "oria").
   If the file is not installed the request 404s and the fallbacks below are used. */
@font-face {
  font-family: "BN Oria";
  src: url("/fonts/bn-oria/regular");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "BN Oria";
  src: url("/fonts/bn-oria/bold");
  font-weight: 700;
  font-display: swap;
}

:root {
  --cream: #fff8ec;
  --paper: #ffffff;
  --purple: #6a2bc4;
  --purple-deep: #3b1478;
  --lilac: #ece1ff;
  --green: #88d902;       /* sampled from the logo */
  --green-dark: #4f9e00;  /* the logo's shaded green */
  --ink: #1c0f33;
  --muted: #5d4f78;

  --font-display: "BN Oria", "Secular One", "Arial Hebrew", "Rubik", system-ui, sans-serif;
  --font-body: "BN Oria", "Rubik", "Segoe UI", "Arial Hebrew", Arial, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.4rem;

  --outline: 3px solid var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(136, 217, 2, 0.16), transparent 40%),
    radial-gradient(circle at 90% 100%, rgba(106, 43, 196, 0.12), transparent 45%),
    radial-gradient(rgba(106, 43, 196, 0.10) 1.2px, transparent 1.3px);
  background-size: auto, auto, 20px 20px;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button, input { font: inherit; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ header */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem 0;
}
.logo { margin: 0; line-height: 0; }
.logo img {
  display: block;
  width: auto;
  height: clamp(84px, 11vw, 140px);
  transform: rotate(-2deg);
}
.masthead-clock {
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--paper);
  background: var(--purple);
  border: var(--outline);
  border-radius: 999px;
  padding: 0.1rem 1rem;
  box-shadow: 4px 4px 0 var(--green);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------- stage */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 2.5rem;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem 2rem;
}

/* ---------------------------------------------------------------- TV set */
.tv { position: relative; padding-top: 3.2rem; }

.antenna { position: absolute; top: 0; left: 50%; width: 0; height: 3.4rem; }
.antenna span {
  position: absolute; bottom: 0;
  width: 5px; height: 4.2rem;
  background: var(--ink);
  border-radius: 3px;
  transform-origin: bottom center;
}
.antenna span::after {
  content: "";
  position: absolute; top: -8px; left: -5px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid var(--ink);
}
.antenna span:first-child { transform: rotate(-32deg); }
.antenna span:last-child { transform: rotate(28deg); }
.antenna::before {
  content: "";
  position: absolute; bottom: -10px; left: -26px;
  width: 52px; height: 22px;
  background: var(--ink);
  border-radius: 26px 26px 6px 6px;
}

.tv-case {
  position: relative;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.28), transparent 32%),
    linear-gradient(180deg, #7d3ad9, var(--purple-deep));
  border: 4px solid var(--ink);
  border-radius: 34px;
  padding: clamp(0.8rem, 2.2vw, 1.6rem);
  box-shadow: 10px 10px 0 var(--green), 10px 10px 0 4px var(--ink);
}

.screen-bezel {
  background: #1d1230;
  border: 3px solid var(--ink);
  border-radius: 26px;
  padding: clamp(0.5rem, 1.4vw, 0.9rem);
  box-shadow: inset 0 0 0 4px #33204f;
}

.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  border-radius: 22px / 18px;
  isolation: isolate;
}
.screen::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
  border-radius: inherit;
}
.screen video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}

.noise {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  opacity: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity 120ms linear;
}
.noise.active { opacity: 1; }

/* Small translucent channel logo in the corner, like a real broadcast */
.bug {
  position: absolute;
  top: 4%;
  inset-inline-start: 3%;
  z-index: 4;
  width: clamp(44px, 9%, 96px);
  height: auto;
  opacity: 0.8;
  pointer-events: none;
}

.live {
  position: absolute;
  top: 4%;
  inset-inline-end: 3.5%;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.15rem 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 1.6vw, 1rem);
  color: #fff;
  background: rgba(28, 15, 51, 0.75);
  border: 2px solid #fff;
  border-radius: 999px;
}
.live-dot { width: 0.65rem; height: 0.65rem; border-radius: 50%; background: #8a8a8a; }
.live[data-status="on_air"] { background: #e3123d; }
.live[data-status="on_air"] .live-dot { background: #fff; animation: blink 1.2s steps(2, start) infinite; }
.live[data-status="off_air"] .live-dot { background: #555; }
@keyframes blink { to { visibility: hidden; } }

/* Full-screen panels on the TV */
.panel {
  position: absolute; inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1rem;
  text-align: center;
  background: var(--purple-deep);
}
.panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 4vw, 2.6rem);
  line-height: 1.1;
  color: var(--green);
  text-shadow: 3px 3px 0 var(--ink);
}
.panel-sub {
  margin: 0;
  max-width: 36ch;
  font-size: clamp(0.85rem, 1.8vw, 1.05rem);
  color: var(--cream);
}

.standby { background: #111; }
.bars {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  z-index: -1;
  opacity: 0.85;
}
.bars i:nth-child(1) { background: var(--cream); }
.bars i:nth-child(2) { background: var(--green); }
.bars i:nth-child(3) { background: #b48cf0; }
.bars i:nth-child(4) { background: var(--green-dark); }
.bars i:nth-child(5) { background: var(--purple); }
.bars i:nth-child(6) { background: #e3123d; }
.bars i:nth-child(7) { background: var(--purple-deep); }
.standby .panel-title,
.standby .panel-sub {
  background: var(--ink);
  padding: 0.2rem 1rem;
  border-radius: 12px;
}

.intermission { background: linear-gradient(135deg, var(--green), var(--green-dark)); }
.intermission .panel-title { color: var(--paper); }
.intermission .panel-sub { color: var(--ink); font-weight: 500; }
.signal { background: #000; }
.signal .panel-title { color: #fff; }

.start { background: rgba(59, 20, 120, 0.72); z-index: 6; }
.start-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.6rem;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.4vw, 2rem);
  color: var(--ink);
  background: var(--green);
  border: var(--outline);
  border-radius: 999px;
  box-shadow: 6px 6px 0 var(--ink);
  cursor: pointer;
  transition: transform 90ms ease, box-shadow 90ms ease;
}
.start-button:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink); }
.start-button:active { transform: translate(4px, 4px); box-shadow: 2px 2px 0 var(--ink); }
.start-icon { transform: scaleX(-1); display: inline-block; }

/* Lower-third "now showing" bumper */
.bumper {
  position: absolute;
  bottom: 7%;
  inset-inline-start: 0;
  z-index: 4;
  display: flex;
  align-items: stretch;
  font-family: var(--font-display);
  transform: translateX(110%);
  transition: transform 420ms cubic-bezier(.2, .9, .25, 1.2);
  pointer-events: none;
}
.bumper.show { transform: translateX(0); }
.bumper-label {
  padding: 0.25rem 0.8rem;
  background: var(--green);
  color: var(--ink);
  font-size: clamp(0.85rem, 1.8vw, 1.1rem);
}
.bumper-show {
  padding: 0.25rem 1rem;
  background: var(--purple);
  color: #fff;
  font-size: clamp(1rem, 2.4vw, 1.5rem);
  border-start-end-radius: 999px;
  border-end-end-radius: 999px;
}

.spinner {
  position: absolute; top: 50%; left: 50%;
  z-index: 4;
  width: 3rem; height: 3rem;
  margin: -1.5rem 0 0 -1.5rem;
  border: 5px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.screen:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.screen:-webkit-full-screen { border-radius: 0; width: 100vw; height: 100vh; }

/* Controls strip on the TV body */
.tv-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: clamp(0.7rem, 1.6vw, 1.1rem);
}
.power-led {
  flex: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #4a2a2a;
  border: 2px solid var(--ink);
}
.power-led.on { background: var(--green); box-shadow: 0 0 10px var(--green); }
.speaker {
  flex: 1;
  height: 28px;
  border-radius: 14px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 4px, transparent 4px 10px);
  opacity: 0.5;
}
.control-group {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.6rem;
  background: var(--green);
  border: var(--outline);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
}
.knob-button {
  display: grid;
  place-items: center;
  width: 2.6rem; height: 2.6rem;
  padding: 0;
  color: var(--ink);
  background: var(--cream);
  border: var(--outline);
  border-radius: 50%;
  cursor: pointer;
}
.knob-button:hover { background: #fff; }
.knob-button svg {
  width: 1.3rem; height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.knob-button .mute-cross { display: none; }
.knob-button[aria-pressed="true"] .mute-cross { display: inline; }
.knob-button[aria-pressed="true"] .sound-waves { display: none; }
.volume input { width: clamp(80px, 12vw, 140px); accent-color: var(--purple); cursor: pointer; }

.tv-feet { display: flex; justify-content: space-between; padding: 0 14%; }
.tv-feet span { width: 18%; height: 16px; background: var(--ink); border-radius: 0 0 10px 10px; }

/* ------------------------------------------------- on-air strip under the TV */
.on-air-strip {
  margin: 1.4rem 0 0;
  padding: 0.9rem 1.3rem;
  background: var(--paper);
  border: var(--outline);
  border-radius: 18px;
  box-shadow: 5px 5px 0 var(--green), 5px 5px 0 3px var(--ink);
}
.strip-now, .strip-next { margin: 0; }
.strip-now {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.15;
}
.strip-next { margin-top: 0.2rem; font-size: var(--step-1); color: var(--muted); }
.strip-label { color: var(--purple); }
.strip-next .strip-label { font-weight: 700; }

/* ------------------------------------------------------------- TV guide */
.guide {
  color: var(--ink);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 8px 8px 0 var(--purple), 8px 8px 0 4px var(--ink);
  transform: rotate(1.2deg);
  margin-top: 3.2rem;
}
.guide > section { padding: 1.1rem 1.3rem; }
.guide > section + section { border-top: 3px dashed rgba(106, 43, 196, 0.3); }

.guide-heading {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-0);
  color: var(--purple);
}
.now-show {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.05;
}
.now-meta, .next-meta { margin: 0.25rem 0 0; font-size: var(--step--1); color: var(--muted); }

.progress {
  position: relative;
  height: 16px;
  margin-top: 0.9rem;
  background: var(--lilac);
  border: var(--outline);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: repeating-linear-gradient(-45deg, var(--green) 0 10px, #a6eb3a 10px 20px);
  border-inline-end: 3px solid var(--ink);
  transition: width 0.5s linear;
}
.progress-times {
  display: flex;
  gap: 0.35rem;
  margin: 0.35rem 0 0;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}

.next-show {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.1;
}
.next-countdown {
  display: inline-block;
  margin-inline-start: 0.4rem;
  padding: 0 0.5rem;
  background: var(--green);
  border-radius: 6px;
  color: var(--ink);
  font-weight: 700;
}
.next-ready { margin: 0.4rem 0 0; font-size: var(--step--1); color: var(--muted); }
.next-ready[data-ready="true"] { color: var(--green-dark); font-weight: 700; }

.schedule-list { list-style: none; margin: 0; padding: 0; }
.schedule-list li {
  display: grid;
  grid-template-columns: 3.6rem 1fr;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.4rem 0;
}
.schedule-list li + li { border-top: 1px solid rgba(28, 15, 51, 0.1); }
.schedule-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.schedule-title { font-weight: 500; }
.schedule-sub { display: block; font-size: var(--step--1); color: var(--muted); }
.schedule-list .is-now .schedule-time { color: var(--purple); }
.schedule-empty { color: var(--muted); font-size: var(--step--1); }

/* ----------------------------------------------------------------- footer */
.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
  font-size: var(--step--1);
  color: var(--muted);
}
.footer p { margin: 0; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; gap: 1.5rem; padding: 1rem; }
  .guide { transform: none; margin-top: 0.5rem; }
}
@media (max-width: 520px) {
  .masthead { padding: 0.75rem 1rem 0; }
  .masthead-clock { font-size: var(--step-1); }
  .tv { padding-top: 2.4rem; }
  .tv-case { border-radius: 24px; box-shadow: 6px 6px 0 var(--green), 6px 6px 0 3px var(--ink); }
  .speaker { display: none; }
  .tv-controls { justify-content: space-between; }
  .now-show { font-size: var(--step-2); }
}
@media (prefers-reduced-motion: reduce) {
  .live[data-status="on_air"] .live-dot { animation: none; }
  .bumper, .progress-fill { transition: none; }
  .spinner { animation-duration: 3s; }
}
