/* TOBY TV
   Layout: the whole viewport is a broadcast screen; a news ticker runs along the bottom.
   The about page is the "station information" card: same palette, read like a TV guide. */
:root {
  --ink: #08090b;          /* off-air black */
  --phosphor: #f1efe6;     /* warm CRT white */
  --dim: #9a978c;          /* secondary text */
  --signal: #ffb21a;       /* ticker / broadcast amber */
  --tally: #ff3b30;        /* LIVE tally light */
  --panel: rgba(8, 9, 11, .78);
  --rule: rgba(241, 239, 230, .18);

  --f-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-osd: "VT323", ui-monospace, "SF Mono", Menlo, monospace;

  --ticker-h: 46px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--phosphor);
  font-family: var(--f-display);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

/* ───────── Channel ───────── */
.channel {
  overflow: hidden; background: #000;
  display: grid; place-items: center;
}
/* The "set": a 16:9 picture as wide as fits, with the ticker directly under it.
   Fills the width on most screens; on very wide/short windows it narrows instead. */
.stage {
  width: min(100vw, calc((100vh - var(--ticker-h) - env(safe-area-inset-bottom, 0px)) * 16 / 9));
  width: min(100vw, calc((100dvh - var(--ticker-h) - env(safe-area-inset-bottom, 0px)) * 16 / 9));
}
.tv {
  position: relative;
  width: 100%; aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.screen { position: absolute; inset: 0; overflow: hidden; }
.screen iframe, .screen #yt {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  /* size set by JS to cover (landscape) or contain (portrait) */
}

.glass { position: absolute; inset: 0; z-index: 6; cursor: pointer; }
.glass:focus-visible { outline-offset: -6px; }
.tv.sound-on .glass { cursor: default; }

.crt {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.16) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,.55) 100%);
  mix-blend-mode: multiply;
}

.static {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 4; pointer-events: none;
  image-rendering: pixelated;
  opacity: 0; transition: opacity .25s;
}
.static.on { opacity: 1; transition: none; }

/* On-screen display */
.osd, .bug, .lower-third, .sound, .info { z-index: 7; }
.osd-tr {
  position: absolute; top: 18px; right: 22px;
  display: flex; gap: 18px; align-items: baseline;
  font-family: var(--f-osd); font-size: 30px; line-height: 1;
  color: #7dff8a; text-shadow: 0 0 6px rgba(125,255,138,.55), 2px 2px 0 rgba(0,0,0,.6);
  pointer-events: none;
}
.osd-tr { pointer-events: auto; }
.osd-ch {
  font: inherit; color: inherit; text-shadow: inherit; letter-spacing: inherit;
  background: none; border: 0; padding: 2px 6px; margin: -2px -6px; border-radius: 3px; cursor: pointer;
}
.osd-ch:hover { background: rgba(125,255,138,.14); }
.osd-ch b { font-weight: 400; }
/* Big channel number shown for a moment after changing channel, like an old TV */
.ch-big {
  position: absolute; z-index: 8; top: 12%; right: 6%;
  font-family: var(--f-osd); font-size: clamp(48px, 9vw, 140px); line-height: 1;
  color: #7dff8a; text-shadow: 0 0 14px rgba(125,255,138,.6), 4px 4px 0 rgba(0,0,0,.6);
  pointer-events: none;
}
.ch-big small { display: block; font-size: .38em; text-align: right; letter-spacing: .08em; margin-top: .1em; }
.osd-clock { color: var(--phosphor); text-shadow: 0 0 6px rgba(241,239,230,.35), 2px 2px 0 rgba(0,0,0,.6); }

.bug {
  position: absolute; top: 16px; left: 22px;
  display: flex; align-items: center; gap: 10px;
  opacity: .9; text-decoration: none; transition: opacity .2s;
}
.bug:hover { opacity: 1; }
.bug:hover .bug-logo { filter: drop-shadow(0 0 10px rgba(255,178,26,.7)); }
.bug-mark {
  font-weight: 900; font-stretch: 70%; font-size: 26px; letter-spacing: .01em; line-height: 1;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.bug-mark em {
  font-style: normal; margin-left: 3px; padding: 1px 5px 0;
  background: var(--phosphor); color: var(--ink); border-radius: 3px;
}
.bug-logo { display: block; height: 60px; width: auto; filter: drop-shadow(0 1px 6px rgba(0,0,0,.45)); }
.bug-live {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 700; font-stretch: 85%; font-size: 12px; letter-spacing: .14em;
  padding: 4px 8px; background: rgba(0,0,0,.45); border-radius: 3px;
}
.bug-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--tally); box-shadow: 0 0 8px var(--tally); animation: tally 1.6s steps(2) infinite; }
@keyframes tally { 50% { opacity: .35; } }

/* Lower third */
.lower-third {
  position: absolute; left: 22px; bottom: 26px; max-width: min(760px, calc(100% - 44px));
  display: flex; align-items: stretch; pointer-events: none;
  animation: lt-in .5s cubic-bezier(.2,.8,.2,1) both;
}
.lt-tag {
  background: var(--signal); color: var(--ink);
  font-weight: 900; font-stretch: 75%; text-transform: uppercase; letter-spacing: .06em;
  font-size: 15px; padding: 8px 12px; display: flex; align-items: center;
}
.lt-title {
  background: var(--panel); backdrop-filter: blur(6px);
  font-weight: 600; font-stretch: 90%; font-size: 19px; padding: 8px 14px; min-width: 0;
  text-wrap: balance;
}
@keyframes lt-in { from { transform: translateX(-24px); opacity: 0; } }

/* Info card */
.info {
  position: absolute; left: 22px; bottom: 26px; width: min(440px, calc(100% - 44px));
  background: var(--panel); backdrop-filter: blur(10px);
  border-top: 4px solid var(--signal);
  padding: 18px 20px 20px;
  display: grid; gap: 12px;
  animation: lt-in .3s cubic-bezier(.2,.8,.2,1) both;
}
.info-min {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; border-radius: 2px; cursor: pointer; color: var(--phosphor);
}
.info-min span { width: 12px; height: 2px; background: currentColor; }
.info-min:hover, .info-min:focus-visible { border-color: var(--rule); background: rgba(241,239,230,.08); }
.info-kicker { padding-right: 34px; }
.info-tab {
  position: absolute; left: 22px; bottom: 26px; z-index: 7;
  font: 700 12px/1 var(--f-display); font-stretch: 85%; letter-spacing: .14em; text-transform: uppercase;
  color: var(--phosphor); background: var(--panel); backdrop-filter: blur(8px);
  border: 0; border-top: 3px solid var(--signal); padding: 10px 14px; cursor: pointer;
}
.info-tab:hover { color: var(--signal); }
.tv.awake .lower-third:has(~ .info-tab:not([hidden])) { display: none; }
.info-kicker {
  margin: 0; font-weight: 700; font-stretch: 85%; font-size: 12px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--signal);
}
.info-title { margin: 0; font-weight: 800; font-stretch: 80%; font-size: 26px; line-height: 1.08; text-wrap: balance; }
.info-meta { margin: 0; display: grid; gap: 6px; }
.info-meta div { display: grid; grid-template-columns: 112px 1fr; gap: 10px; align-items: baseline; }
.info-meta dt { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.info-meta dd { margin: 0; font-size: 15px; min-width: 0; }
/* Mini programme guide (old set-top box EPG) */
.epg { --epg-blue: #2f63c9; --epg-blue-2: #1f48a3; --epg-text: #eef3ff; display: grid; gap: 3px; font-stretch: 85%; }
.epg-head, .epg-row { display: grid; grid-template-columns: var(--epg-ch-w, 118px) 1fr; gap: 3px; }
.epg-day { font-size: 13px; font-weight: 700; color: var(--signal); padding-left: 2px; }
.epg-marks { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); font-size: 13px; font-weight: 700; color: var(--signal); }
.epg-marks i { position: absolute; right: -2px; top: -1px; font-style: normal; font-size: 16px; line-height: 1; }
.epg-ch {
  display: flex; align-items: center; gap: 6px; padding: 0 8px; height: 30px;
  background: var(--signal); color: var(--ink);
  font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.epg-track { position: relative; height: 30px; }
.epg-block {
  position: absolute; top: 0; bottom: 0; min-width: 6px;
  display: block; line-height: 30px; padding: 0 7px;
  background: linear-gradient(to bottom, var(--epg-blue), var(--epg-blue-2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  color: var(--epg-text); text-decoration: none;
  font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-overflow: "..";
}
.epg-block.is-now { background: var(--signal); color: var(--ink); box-shadow: none; }
.epg-block:hover, .epg-block:focus-visible { background: var(--phosphor); color: var(--ink); outline: none; }
.epg-now { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--tally); box-shadow: 0 0 6px var(--tally); pointer-events: none; }

.info-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.info-guide { background: transparent; color: var(--phosphor); cursor: pointer; font-family: var(--f-display); }

/* Full programme guide (Foxtel-era set-top box) */
.tvg {
  --epg-blue: #3a6fd6; --epg-blue-2: #24509f; --epg-text: #eef3ff;
  position: absolute; inset: 0; z-index: 9;
  display: grid; grid-template-rows: auto auto 1fr auto; gap: clamp(6px, 1vw, 10px);
  padding: clamp(14px, 3.5%, 44px) clamp(14px, 5%, 64px);
  background: radial-gradient(ellipse at 30% 0%, #3d78d8 0%, #1e4596 55%, #132e6b 100%);
  color: #eef3ff; font-stretch: 85%;
  animation: fade .2s both;
}
.tvg-top { display: flex; justify-content: space-between; align-items: baseline; }
.tvg-title { font-weight: 900; font-size: clamp(16px, 2vw, 26px); color: var(--signal); letter-spacing: .04em; }
.tvg-clock { font-weight: 800; font-size: clamp(14px, 1.6vw, 22px); color: var(--signal); }
.tvg-head { display: grid; grid-template-columns: clamp(130px, 22%, 240px) 1fr; gap: 4px; }
.tvg-head .epg-day, .tvg-head .epg-marks { font-size: clamp(12px, 1.4vw, 19px); color: #fff; }
.tvg-rows { display: grid; gap: 4px; align-content: start; min-height: 0; }
.tvg-row { display: grid; grid-template-columns: clamp(130px, 22%, 240px) 1fr; gap: 4px; }
.tvg-row .epg-track { height: clamp(28px, 4.6vw, 52px); }
.tvg-ch {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; text-align: left; cursor: pointer;
  font: 800 clamp(13px, 1.5vw, 20px)/1 var(--f-display); font-stretch: 85%; color: #eef3ff;
  background: linear-gradient(to bottom, #3a6fd6, #24509f); border: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  white-space: nowrap; overflow: hidden;
}
.tvg-ch:hover, .tvg-ch:focus-visible { background: var(--phosphor); color: var(--ink); outline: none; }
.tvg .epg-block { font-size: clamp(12px, 1.4vw, 19px); line-height: clamp(28px, 4.6vw, 52px); padding: 0 10px; }
.tvg-row.is-current .tvg-ch, .tvg-row.is-current .epg-block { background: var(--signal); color: var(--ink); box-shadow: none; }
.tvg-row.is-current .epg-block:hover { background: var(--phosphor); }
.tvg .epg-block.is-now { box-shadow: inset 0 -3px 0 rgba(255,255,255,.55); }
.tvg-row.is-current .epg-block.is-now { box-shadow: inset 0 -3px 0 rgba(8,9,11,.35); }
.epg-break {
  position: absolute; top: 0; bottom: 0; display: block; padding: 0 10px; overflow: hidden; white-space: nowrap;
  font-size: clamp(11px, 1.2vw, 16px); line-height: clamp(28px, 4.6vw, 52px); font-style: italic; color: rgba(238,243,255,.7);
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.08) 0 6px, transparent 6px 12px);
}
.tvg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: clamp(12px, 1.3vw, 17px); color: rgba(238,243,255,.85); }
.tvg-foot b { color: var(--signal); }
.tvg-close {
  font: 800 clamp(12px, 1.3vw, 16px)/1 var(--f-display); font-stretch: 85%; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); background: var(--signal); border: 0; padding: 9px 14px; cursor: pointer;
}
.tvg-close:hover { background: var(--phosphor); }
.tv.tvg-open .lower-third, .tv.tvg-open .info-tab, .tv.tvg-open .sound { display: none; }

.tvg .epg-block.is-now { background: linear-gradient(to bottom, #5b8ff0, #3a6fd6); color: #fff; }
.tvg-row.is-current .epg-block.is-now { background: var(--signal); color: var(--ink); }
/* Guide tooltip */
.epg-tip {
  position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none;
  max-width: min(360px, 70%); display: grid; gap: 4px;
  padding: 9px 12px 10px; background: #0d1f4a; color: #eef3ff;
  border: 1px solid rgba(255,255,255,.25); border-top: 3px solid var(--signal);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  font-stretch: 90%; font-size: 15px; line-height: 1.25;
}
.epg-tip b { font-weight: 800; }
.epg-tip-when { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--signal); }
.epg-tip-go { font-size: 12px; color: rgba(238,243,255,.7); }
@media (hover: none) { .epg-tip:not(.tap) { display: none; } .tvg-hint-mouse { display: none; } }
@media (hover: hover) { .tvg-hint-touch { display: none; } }
.epg-tip.tap { position: fixed; pointer-events: auto; max-width: calc(100vw - 24px); width: max-content; }
.epg-tip-open {
  justify-self: start; margin-top: 4px; padding: 8px 12px; text-decoration: none;
  font-weight: 800; font-size: 13px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--signal); color: var(--ink);
}

/* Backdrop behind vertical (9:16) videos: soft, dimmed colour bars */
.screen { background: #000; }
.tv.vertical .screen {
  background:
    linear-gradient(to right, rgba(8,9,11,.35), rgba(8,9,11,.82) 30%, rgba(8,9,11,.82) 70%, rgba(8,9,11,.35)),
    linear-gradient(to right, #b9b6a8 0 14.28%, #c9c27a 14.28% 28.57%, #7fbdbb 28.57% 42.85%, #86b585 42.85% 57.14%, #b58fb3 57.14% 71.42%, #c08884 71.42% 85.71%, #7f8fc0 85.71%);
}
.tv.vertical .screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.18) 0 2px, transparent 2px 4px);
}

.info-link {
  justify-self: start; text-decoration: none;
  font-weight: 700; font-stretch: 85%; font-size: 14px; letter-spacing: .04em; text-transform: uppercase;
  padding: 9px 14px; border: 1px solid var(--phosphor); border-radius: 2px;
}
.info-link:hover { background: var(--phosphor); color: var(--ink); }
.tv.show-info .lower-third { display: none; }

/* Sound button */
.sound {
  position: absolute; right: 22px; bottom: 26px;
  display: inline-flex; align-items: center; gap: 10px;
  font: 700 13px/1 var(--f-display); font-stretch: 85%; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink); background: var(--phosphor);
  border: 0; border-radius: 2px; padding: 11px 14px; cursor: pointer;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
.sound-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tally); }
.tv.sound-on .sound { background: rgba(0,0,0,.5); color: var(--phosphor); opacity: 0; transition: opacity .3s; }
.tv.sound-on .sound-dot { background: #7dff8a; }
.tv.sound-on.awake .sound, .tv.sound-on .sound:focus-visible { opacity: 1; }

/* Ad breaks */
.break { position: absolute; inset: 0; z-index: 3; overflow: hidden; background: var(--ink); }
.spot { position: absolute; inset: 0; display: grid; padding: clamp(24px, 6vw, 96px); }
/* Ads size themselves to the picture (not the window), so they fit on a phone too */
.break { container-type: size; }
.spot-lead, .spot-service { padding: max(9cqh, 34px) 6cqw max(7cqh, 12px); }
.spot-lead .spot-kicker, .spot-service .spot-kicker, .spot-lead .spot-cta, .spot-service .spot-cta { font-size: clamp(9px, min(1.3cqw, 2.4cqh), 18px); }
.spot-lead .spot-cta, .spot-service .spot-cta { padding-top: min(1.2cqw, 2cqh); border-top-width: max(2px, .3cqw); }
.spot-kicker { font-weight: 700; font-stretch: 85%; font-size: clamp(12px, 1.3vw, 17px); letter-spacing: .2em; text-transform: uppercase; }
.spot-headline { margin: 0; font-weight: 900; line-height: .95; text-wrap: balance; }
.spot-body { margin: 0; font-size: clamp(16px, 1.9vw, 26px); line-height: 1.3; max-width: 34ch; }
.spot-cta { font-weight: 700; font-stretch: 85%; font-size: clamp(13px, 1.4vw, 18px); letter-spacing: .14em; text-transform: uppercase; }
.spot * { animation-fill-mode: both; animation-timing-function: cubic-bezier(.2,.8,.2,1); }

/* First ad: yellow, with the slot-machine symbol */
.spot-lead { background: var(--signal); color: var(--ink); grid-template-columns: 1fr auto; align-items: center; gap: 5cqw; }
.spot-lead .spot-text { display: grid; gap: min(1.8cqw, 3cqh); align-content: center; }
.spot-lead .spot-kicker { animation-name: fade; animation-duration: .8s; }
.spot-lead .spot-headline { font-stretch: 62%; font-size: min(7.6cqw, 11cqh); line-height: 1; text-transform: uppercase; max-width: 11ch; animation-name: rise; animation-duration: .9s; animation-delay: .2s; }
.spot-lead .spot-body { font-weight: 800; font-size: max(11px, min(2.4cqw, 4.2cqh)); animation-name: fade; animation-duration: 1s; animation-delay: 1.4s; }
.spot-lead .spot-cta { animation-name: fade; animation-duration: .6s; animation-delay: 3.5s; border-top: 3px solid var(--ink); padding-top: 12px; justify-self: start; }

/* Slot machine: films, cuts, captions. Rests 2s on each, then spins to the next. */
.reel {
  --reel: min(22cqw, 46cqh);
  display: block; position: relative; width: var(--reel); height: var(--reel); overflow: hidden;
  background: var(--ink); color: var(--phosphor); border-radius: 14px;
  box-shadow: inset 0 0 0 6px var(--ink), inset 0 14px 18px -8px rgba(0,0,0,.9), inset 0 -14px 18px -8px rgba(0,0,0,.9);
  animation: fade .6s .4s both;
}
.reel::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: linear-gradient(to bottom, rgba(8,9,11,.85), transparent 22%, transparent 78%, rgba(8,9,11,.85)); }
.reel-strip { display: block; animation: reel 7.2s infinite; }
.reel-cell { display: grid; place-items: center; height: var(--reel); }
.reel-cell svg { width: 66%; height: 66%; }
@keyframes reel {
  0%, 27.78%     { transform: translateY(0);        filter: none; animation-timing-function: cubic-bezier(.55,0,.35,1.18); }
  30.5%          { filter: blur(3px); }
  33.33%, 61.11% { transform: translateY(-30.769%); filter: none; animation-timing-function: cubic-bezier(.55,0,.35,1.18); }
  64%            { filter: blur(3px); }
  66.67%, 94.44% { transform: translateY(-61.538%); filter: none; animation-timing-function: cubic-bezier(.55,0,.35,1.18); }
  97.2%          { filter: blur(3px); }
  100%           { transform: translateY(-92.308%); filter: none; }
}

/* Service ads: "Also available" */
.spot-service { background: var(--phosphor); color: var(--ink); grid-template-columns: auto 1fr; align-items: center; gap: 5cqw; }
.spot-service .spot-icon { display: grid; place-items: center; width: min(24cqw, 50cqh); aspect-ratio: 1; background: var(--ink); color: var(--phosphor); border-radius: 14px; animation-name: zoom; animation-duration: .9s; }
.spot-service .spot-icon svg { width: 70%; height: 70%; overflow: visible; }
.spot-service .spot-text { display: grid; gap: min(1.8cqw, 3cqh); align-content: center; }
.spot-service .spot-kicker { color: var(--tally); animation-name: fade; animation-duration: .8s; }
.spot-service .spot-headline { font-stretch: 75%; font-size: min(5.4cqw, 10cqh); max-width: 16ch; animation-name: rise; animation-duration: .9s; animation-delay: .3s; }
.spot-service .spot-cta { animation-name: fade; animation-duration: .6s; animation-delay: 2.5s; border-top: 3px solid var(--ink); padding-top: 12px; justify-self: start; }

/* Ad symbols (see js/ad-icons.js) */
.ic * { transform-box: fill-box; transform-origin: center; animation-timing-function: ease-in-out; animation-iteration-count: infinite; }
.ic .clap-arm { transform-origin: 0% 100%; animation: clap 1.6s infinite; }
@keyframes clap { 0%, 35% { transform: rotate(-24deg); } 45%, 100% { transform: rotate(0); } }
.ic .heart { animation: float-up 1.8s infinite; }
@keyframes float-up { 0% { transform: translateY(14px) scale(.6); opacity: 0; } 30% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { transform: translateY(-34px) scale(.9); opacity: 0; } }
.ic .feed { animation: feed 1.8s infinite; }
@keyframes feed { 0%, 60% { transform: translateY(0); } 100% { transform: translateY(-14px); } }
.ic .blink, .ic .live-dot { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ic .bob { animation: bob 1s infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.ic .pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(1.07); } }
.ic .progress { transform-origin: 0% 50%; animation: progress 3s linear infinite; }
@keyframes progress { from { transform: scaleX(0); } }
.ic .wv { animation: wv 1.4s infinite; }
.ic .wv2 { animation-delay: .25s; }
@keyframes wv { 0%, 100% { opacity: .15; } 40% { opacity: 1; } }
.ic .bar { animation: eq 1s infinite; }
.ic .b1 { animation-delay: -.3s; } .ic .b2 { animation-delay: -.6s; } .ic .b3 { animation-delay: -.15s; }
.ic .b4 { animation-delay: -.75s; } .ic .b5 { animation-delay: -.45s; } .ic .b6 { animation-delay: -.9s; }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
.ic .ln { transform-origin: 0% 50%; animation: write 4s infinite; }
.ic .l2 { animation-delay: .5s; } .ic .l3 { animation-delay: 1s; } .ic .l4 { animation-delay: 1.5s; }
@keyframes write { 0% { transform: scaleX(0); opacity: 1; } 15%, 80% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.ic .playhead { transform-box: view-box; animation: sweep 3s linear infinite; }
@keyframes sweep { from { transform: translateX(0); } to { transform: translateX(92px); } }
.ic .hover { animation: hover 2.4s infinite; }
@keyframes hover { 50% { transform: translateY(-9px); } }
.ic .rotor { animation: rotor .18s linear infinite; }
.ic .r2 { animation-delay: -.09s; }
@keyframes rotor { 50% { transform: scaleX(.25); } }
.ic .burst { animation: burst 2s infinite; }
@keyframes burst { 0%, 55% { opacity: 0; transform: scale(.4); } 62% { opacity: 1; transform: scale(1.15); } 80%, 100% { opacity: 0; transform: scale(1); } }
.ic .spark { animation: twinkle 1.8s infinite; }
.ic .s2 { animation-delay: .6s; } .ic .s3 { animation-delay: 1.2s; }
@keyframes twinkle { 0%, 100% { transform: scale(0) rotate(0); opacity: 0; } 40% { transform: scale(1) rotate(45deg); opacity: 1; } 70% { transform: scale(.2) rotate(90deg); opacity: 0; } }
.ic .focus { animation: focus 2.4s infinite; }
@keyframes focus { 0% { transform: scale(1.25); opacity: 0; } 35%, 85% { transform: scale(1); opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.ic .ring-l { animation: ring-l 2.4s infinite; }
.ic .ring-r, .ic .gem { animation: ring-r 2.4s infinite; }
@keyframes ring-l { 0%, 100% { transform: translateX(-10px); } 50% { transform: translateX(0); } }
@keyframes ring-r { 0%, 100% { transform: translateX(10px); } 50% { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .ic *, .reel-strip { animation: none !important; } }

/* Break bumpers */
.bumper { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 18px; padding: 24px;
  background: repeating-linear-gradient(90deg, #111 0 2px, var(--ink) 2px 9px); }
.bumper-logo { width: min(46vw, 520px); height: auto; justify-self: center; animation: zoom 1.2s both; }
.bumper-mark { font-weight: 900; font-stretch: 62%; font-size: clamp(64px, 14vw, 220px); line-height: 1; letter-spacing: -.01em; animation: zoom 1.2s both; }
.bumper-mark em { font-style: normal; display: inline-block; line-height: .9; background: var(--phosphor); color: var(--ink); padding: .04em .12em 0; margin-left: .06em; border-radius: .05em; }
.bumper-line { font-family: var(--f-osd); font-size: clamp(22px, 2.6vw, 36px); color: var(--signal); animation: fade .8s .6s both; }
.bumper-next { font-size: clamp(15px, 1.6vw, 21px); color: var(--dim); max-width: 46ch; margin-inline: auto; animation: fade .8s 1.2s both; text-wrap: balance; }

@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes zoom { from { transform: scale(.86); opacity: 0; } }
@keyframes grow { from { transform: scaleX(0); } }

/* Stand-by test card */
.standby { position: absolute; inset: 0; z-index: 3;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,.18) 0 2px, transparent 2px 4px),
    linear-gradient(to right, rgba(8,9,11,.35), rgba(8,9,11,.82) 30%, rgba(8,9,11,.82) 70%, rgba(8,9,11,.35)),
    linear-gradient(to right, #b9b6a8 0 14.28%, #c9c27a 14.28% 28.57%, #7fbdbb 28.57% 42.85%, #86b585 42.85% 57.14%, #b58fb3 57.14% 71.42%, #c08884 71.42% 85.71%, #7f8fc0 85.71%); display: grid; place-content: center; text-align: center; gap: 10px; }
.standby-text, .standby-sub { position: relative; margin: 0; background: var(--ink); justify-self: center; }
.standby-text { font-weight: 900; font-stretch: 62%; font-size: clamp(40px, 7vw, 96px); text-transform: uppercase; padding: 4px 22px 0; }
.standby-sub { font-family: var(--f-osd); font-size: 24px; color: var(--signal); padding: 4px 16px; }

/* Ticker */
.ticker {
  position: relative; z-index: 10;
  height: calc(var(--ticker-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; text-decoration: none;
  background: var(--signal); color: var(--ink);
}
.ticker-label {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 0 16px;
  background: var(--ink); color: var(--phosphor);
  font-weight: 900; font-stretch: 70%; font-size: 18px; text-transform: uppercase; letter-spacing: .02em;
}
.ticker-label b { color: var(--signal); font-weight: 900; }
.ticker-window { flex: 1; overflow: hidden; position: relative; display: flex; align-items: center; min-width: 0; }
.ticker-track { display: inline-flex; white-space: nowrap; will-change: transform; }
.ticker-item { font-weight: 700; font-stretch: 85%; font-size: 17px; text-transform: uppercase; letter-spacing: .03em; padding-right: 22px; }
.ticker-item::after { content: "▶"; padding-left: 22px; font-size: .7em; vertical-align: .1em; color: var(--ink); }
.ticker-item.ticker-solo::after { content: none; }
.ticker:hover .ticker-label, .ticker:focus-visible .ticker-label { background: var(--tally); }
.ticker:focus-visible { outline-offset: -3px; outline-color: var(--ink); }
.ticker-fixed { position: fixed; left: 0; right: 0; bottom: 0; }

/* Small screens */
@media (max-width: 640px) {
  :root { --ticker-h: 40px; }
  .osd-tr { font-size: 22px; right: 12px; top: 10px; gap: 10px; }
  .bug { left: 12px; top: 8px; }
  .bug-logo { height: 36px; }
  .bug-live { display: none; }
  .ch-big { top: 28%; }
  .lower-third { left: 10px; bottom: 10px; max-width: calc(100% - 20px); }
  .lt-tag { font-size: 12px; padding: 5px 8px; }
  .lt-title { font-size: 13px; padding: 5px 10px; }
  /* Picture is small on a phone, so the info card and sound button sit in the black space below */
  .info { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: auto; }
  .tvg { position: fixed; inset: 0; z-index: 20; grid-template-rows: auto auto auto auto; align-content: start; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .tvg-head, .tvg-row { grid-template-columns: 124px 1fr; }
  .tvg-ch { font-size: 13px; padding: 0 8px; gap: 5px; }
  .info-tab { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .sound { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .tv.sound-on .sound { opacity: 1; }
  .info-title { font-size: 21px; }
  .info-meta div { grid-template-columns: 96px 1fr; }
  .sound { right: 16px; bottom: 18px; }
  .reel, .spot-service .spot-icon { border-radius: 8px; }
  .ticker-label { font-size: 15px; padding: 0 12px; }
  .ticker-item { font-size: 15px; }
}

@media (max-width: 640px) {
  .tv.show-info .sound { display: none; }
}
/* Portrait phones: picture sits near the top, leaving room below for the info card */
@media (max-aspect-ratio: 1/1) {
  .channel { align-items: start; }
  .stage { margin-top: max(48px, 10vh); }
}

/* Docked layout (phones held upright): logo above the picture, card and sound button under the ticker */
.dock, .dock-top { display: none; }
body.docked .dock-top { display: flex; justify-content: center; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px; }
body.docked .stage { margin-top: 0; }
body.docked .bug { position: static; opacity: 1; }
body.docked .bug-logo { height: 46px; filter: none; }
body.docked .tv > .bug-live { display: inline-flex; position: absolute; top: 12px; left: 12px; z-index: 7; pointer-events: none; }
body.docked { overflow-y: auto; }
body.docked .dock { display: grid; gap: 12px; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
body.docked .info { position: static; width: auto; max-width: none; animation: none; }
body.docked .info-min, body.docked .info-tab { display: none !important; }
body.docked .sound { position: static; justify-self: start; opacity: 1; }
body.docked .tv.show-info .sound { display: inline-flex; }
body.docked .epg-ch { font-size: 12px; padding: 0 6px; gap: 4px; }
body.docked .epg-marks, body.docked .epg-day { font-size: 11px; }

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

/* ───────── About page ───────── */
.station { min-height: 100%; padding-bottom: calc(var(--ticker-h) + env(safe-area-inset-bottom, 0px)); }
.station-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 24px 14px;
  background: var(--ink); border-bottom: 1px solid var(--rule);
}
.station-bar .bug-logo { height: 44px; filter: none; }
.back { font-family: var(--f-osd); font-size: 24px; color: #7dff8a; text-decoration: none; }
.back:hover { text-decoration: underline; }

.station-main { max-width: 1080px; margin: 0 auto; padding: 56px 24px 80px; display: grid; gap: 72px; }
.station-hero { display: grid; gap: 20px; }
.station-hero .eyebrow { font-family: var(--f-osd); font-size: 26px; color: var(--signal); margin: 0; }
.station-hero h1 { margin: 0; font-weight: 900; font-stretch: 62%; font-size: clamp(56px, 11vw, 148px); line-height: .88; text-transform: uppercase; text-wrap: balance; }
.station-hero p.lede { margin: 0; font-size: clamp(18px, 2vw, 22px); line-height: 1.5; max-width: 60ch; color: var(--phosphor); }

.guide { display: grid; gap: 0; border-top: 2px solid var(--phosphor); }
.guide h2 { margin: 0; padding: 14px 0; font-weight: 800; font-stretch: 75%; font-size: 15px; letter-spacing: .16em; text-transform: uppercase; color: var(--signal); border-bottom: 1px solid var(--rule); }
.guide-row { display: grid; grid-template-columns: 200px 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.guide-row dt { font-family: var(--f-osd); font-size: 22px; color: var(--dim); }
.guide-row dd { margin: 0; font-size: 17px; line-height: 1.5; max-width: 62ch; min-width: 0; }
.guide-row dd strong { font-weight: 700; font-stretch: 90%; font-size: 20px; display: block; color: var(--phosphor); }

.station-hero .hero-sub { margin: -6px 0 6px; font-family: var(--f-osd); font-size: clamp(28px, 3.4vw, 40px); line-height: 1; color: var(--signal); }
.station-menu { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.station-menu a {
  text-decoration: none; padding: 10px 16px; border: 1px solid var(--rule); border-radius: 2px;
  font-weight: 800; font-stretch: 80%; font-size: 15px; letter-spacing: .1em; text-transform: uppercase;
}
.station-menu a:hover, .station-menu a:focus-visible { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.station-main section[id] { scroll-margin-top: 90px; }

.meet-grid { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; gap: 40px; padding: 28px 0 8px; align-items: start; }
.meet-photo {
  margin: 0; position: relative; aspect-ratio: 4 / 5; max-width: 100%; overflow: hidden;
  background: repeating-linear-gradient(135deg, #15161a 0 10px, #101114 10px 20px); border: 1px solid var(--rule);
  display: grid; place-items: center;
}
.meet-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.meet-photo figcaption { font-family: var(--f-osd); font-size: 22px; color: var(--dim); }
.meet-photo img + figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 12px; background: var(--panel); color: var(--phosphor); }
.meet-side { display: grid; gap: 14px; align-content: start; min-width: 0; }
.meet-copy { display: grid; gap: 16px; min-width: 0; }
.meet-copy p { margin: 0; font-size: 17px; line-height: 1.6; max-width: 64ch; }
.socials { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.socials a { display: grid; place-items: center; aspect-ratio: 1; min-height: 44px; border: 1px solid var(--rule); border-radius: 2px; color: var(--phosphor); }
.socials a:hover, .socials a:focus-visible { background: var(--signal); border-color: var(--signal); color: var(--ink); }
.socials svg { width: 42%; height: auto; fill: currentColor; }

.table-h { margin: 28px 0 0; font-family: var(--f-osd); font-weight: 400; font-size: 26px; color: var(--phosphor); }
.table-wrap { overflow-x: auto; margin-top: 10px; }
.station-table { width: 100%; border-collapse: collapse; font-size: 16px; line-height: 1.45; }
.station-table th, .station-table td { text-align: left; vertical-align: baseline; padding: 13px 16px 13px 0; border-bottom: 1px solid var(--rule); }
.station-table thead th { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); padding-top: 4px; }
.station-table tbody th { font-weight: 700; font-stretch: 90%; font-size: 18px; white-space: nowrap; }
.station-table.services tbody th { width: 260px; white-space: normal; }
.table-note { margin: 6px 0 0; font-size: 14px; color: var(--dim); }
.award-link { text-decoration: none; border-bottom: 1px solid var(--rule); }
.award-link span { color: var(--signal); font-size: .85em; }
.award-link:hover, .award-link:focus-visible { color: var(--signal); border-bottom-color: var(--signal); }
.station-table td.num { white-space: nowrap; color: var(--signal); font-family: var(--f-osd); font-size: 21px; }
.station-table tbody tr:hover { background: rgba(241,239,230,.03); }
.meet-close { margin: 4px 0 0; font-size: 19px; line-height: 1.55; max-width: 62ch; font-weight: 600; font-stretch: 95%; }

.contact { display: grid; grid-template-columns: 1fr 1.4fr; gap: 48px; border-top: 2px solid var(--phosphor); padding-top: 28px; }
.contact h2 { margin: 0 0 12px; font-weight: 900; font-stretch: 62%; font-size: clamp(44px, 6vw, 80px); line-height: .9; text-transform: uppercase; }
.contact-side p { margin: 0 0 14px; font-size: 17px; line-height: 1.5; color: var(--dim); max-width: 40ch; }
.contact-email { font-family: var(--f-osd); font-size: 28px; color: var(--signal); word-break: break-all; }

form.enquiry { display: grid; gap: 18px; min-width: 0; }
.field { display: grid; gap: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field label { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.field input, .field select, .field textarea {
  font: 400 17px/1.4 var(--f-display); color: var(--phosphor);
  background: #121316; border: 1px solid var(--rule); border-radius: 2px; padding: 12px 14px; width: 100%;
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal); }
.hp { position: absolute; left: -9999px; }
.send {
  justify-self: start; font: 800 16px/1 var(--f-display); font-stretch: 80%; letter-spacing: .1em; text-transform: uppercase;
  background: var(--signal); color: var(--ink); border: 0; border-radius: 2px; padding: 16px 26px; cursor: pointer;
}
.send:hover { background: var(--phosphor); }
.send[disabled] { opacity: .6; cursor: wait; }
.form-status { margin: 0; font-size: 16px; min-height: 1.4em; }
.form-status.ok { color: #7dff8a; }
.form-status.err { color: var(--tally); }

@media (max-width: 760px) {
  .guide-row { grid-template-columns: 1fr; gap: 4px; }
  .meet-grid { grid-template-columns: 1fr; gap: 20px; }
  .meet-side { max-width: 320px; }
  .station-table.services thead { display: none; }
  .station-table.services tr { display: grid; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
  .station-table.services th, .station-table.services td { border: 0; padding: 0; width: auto; }
  .station-table:not(.services) { font-size: 15px; }
  .contact { grid-template-columns: 1fr; gap: 28px; }
  .field-row { grid-template-columns: 1fr; }
  .station-main { padding-top: 36px; gap: 56px; }
  .station-bar { padding-inline: 16px; }
  .station-main { padding-inline: 16px; }
}

/* TOBY TV wordmark, used in place of the words "TOBY TV" in labels.
   Drawn as a mask so it takes the colour of the text around it. */
.wm {
  display: inline-block; height: .78em; aspect-ratio: 1000 / 187; flex: none;
  vertical-align: -.02em; background-color: currentColor;
  -webkit-mask: url(../img/tobytv-wordmark-white.png) center / contain no-repeat;
          mask: url(../img/tobytv-wordmark-white.png) center / contain no-repeat;
}
.ticker-label .wm { height: .74em; vertical-align: 0; }
.tvg-title .wm { height: .82em; }

/* About page footer */
.station-foot { margin: 0 max(24px, calc((100% - 1032px) / 2)); padding: 24px 0 40px; text-align: center; border-top: 1px solid var(--rule); color: var(--dim); font-size: 14px; line-height: 1.6; }
.station-foot p { margin: 0; }

/* Ad preview bar (index.html?ads) */
.ad-preview { position: fixed; z-index: 50; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px;
  padding: 6px; background: var(--ink); color: var(--phosphor); border: 1px solid var(--rule); border-radius: 6px; font: 600 14px/1 var(--f-display); white-space: nowrap; }
.ad-preview button { font: inherit; color: var(--ink); background: var(--signal); border: 0; border-radius: 4px; padding: 8px 12px; cursor: pointer; }
.ad-preview span { min-width: 16ch; text-align: center; }

/* Hidden from view, still read by screen readers and search engines */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
