/* PTV C9: tv.css — the station chassis (plan §4.2–§4.3 experience, §7
 * accessibility, §16 C9).
 *
 * Late-90s music-television / public-access feel: dark high-contrast
 * chassis, crisp system monospace type, one strong station mark, a
 * restrained amber signal accent, test-pattern standby. No MTV marks, no
 * external fonts, no CRT skeuomorphism (§2 rejected alternatives), and
 * nothing is ever drawn over the player rectangle (D9/L-1): every element
 * that could overlap the screen box (slate, NO SIGNAL, PLAYER_UNAVAILABLE)
 * is display:none whenever the player iframe is mounted, so it has no box
 * to intersect.
 */

:root {
  --bg: #0a0a0c;
  --panel: #131417;
  --panel-2: #17181c;
  --edge: #2c2f35;
  --edge-dim: #202227;
  --ink: #e8e8e3;
  --dim: #9aa094;
  --amber: #ffb000;
  --amber-ink: #141310;
  --red: #ff5340;
  --green: #58c98a;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-monospace, "cascadia mono", "sf mono", menlo, consolas, "dejavu sans mono", "liberation mono", monospace;
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ── Chassis ────────────────────────────────────────────────────────────── */

.chassis {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px 28px;
}

.masthead {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 2px 14px;
  border-bottom: 1px solid var(--edge-dim);
}

.masthead .mark {
  margin: 0;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.22em;
  color: var(--amber);
  border: 2px solid var(--amber);
  padding: 2px 10px 2px 12px;
}

.masthead .mark-sub {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ── Standby (§4.2) ──────────────────────────────────────────────────────── */

#ptv-standby { display: none; }
body[data-state="STANDBY"] #ptv-standby { display: block; }

#ptv-standby {
  border: 1px solid var(--edge);
  background: var(--panel);
  margin-top: 18px;
}

/* Test pattern: muted SMPTE-style bars, scanlines, no motion above 3 Hz. */
.testcard {
  height: clamp(120px, 28vh, 220px);
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.22) 0 1px,
      transparent 1px 3px
    ),
    linear-gradient(
      to right,
      #7a7b6d 0 14.28%,
      #7d7b7c 14.28% 28.56%,
      #6f8a79 28.56% 42.84%,
      #4f7d70 42.84% 57.12%,
      #54555c 57.12% 71.4%,
        #6d5a7d 71.4% 85.68%,
      #3d3f45 85.68% 100%
    );
  border-bottom: 1px solid var(--edge);
}

.standby-info {
  padding: 26px 18px 30px;
  text-align: center;
}

#ptv-standby-title {
  margin: 0 0 10px;
  font-size: 20px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  animation: standby-pulse 2.6s ease-in-out infinite;
}

@keyframes standby-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.standby-meta {
  margin: 0 0 22px;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.tune-in {
  font: inherit;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 16px 46px;
  min-height: 44px;
  background: var(--amber);
  color: var(--amber-ink);
  border: 0;
  cursor: pointer;
  transition: background-color 0.15s ease-out;
}

.tune-in:hover { background: #ffc23d; }
.tune-in:active { background: #e09b00; }

.standby-error {
  margin: 18px auto 0;
  max-width: 46ch;
  color: var(--red);
  font-size: 14px;
}

/* ── On-air layout (§4.3) ────────────────────────────────────────────────── */

.onair { display: none; }
body:not([data-state="STANDBY"]) .onair { display: block; }

.stage-col {
  max-width: 960px;
  margin: 18px auto 0;
}

/* Side drawer only where the player keeps its 480px minimum with a 320px
 * drawer beside it (≥960px); narrower screens get the below-player sheet. */
@media (min-width: 960px) {
  body:not([data-state="STANDBY"]) .onair.upnext-open {
    display: grid;
    grid-template-columns: minmax(480px, 1fr) 320px;
    gap: 24px;
    align-items: start;
  }
  .stage-col { margin-top: 18px; }
}

/* Screen box: 16:9, ≥480×270 on desktop (L-3); the iframe fills it exactly.
 * At narrow widths min-width drops (the box must fit the phone) and
 * min-height keeps the ≥200px mobile player minimum; YouTube letterboxes
 * the extra height inside its own iframe. The edge is an outline, not a
 * border, so the L-3 minimums describe the player itself, not the frame. */
.screen {
  position: relative;
  aspect-ratio: 16 / 9;
  min-width: 480px;
  min-height: 270px;
  max-width: 100%;
  background: #000;
  outline: 1px solid var(--edge);
  outline-offset: 0;
}

#ptv-player-host, #ptv-screen iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* Slate and state cards: shown only when no player iframe is mounted. */
.slate {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #000;
}

.slate-title {
  margin: 0;
  font-size: clamp(20px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--ink);
}

.slate-sub {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.22em;
  color: var(--amber);
  min-height: 1em;
}

.card {
  display: none;
  position: absolute;
  inset: 0;
  background: #000;
  padding: 20px;
  overflow: auto;
}

.card-centered {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

body[data-state="NETWORK_LOST"] #ptv-nosignal { display: flex; }
body[data-state="PLAYER_UNAVAILABLE"] #ptv-unavailable { display: block; }

.card-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

#ptv-nosignal .card-title { color: var(--red); }
#ptv-unavailable .card-title { color: var(--amber); }

.card-sub { margin: 0 0 12px; font-size: 14px; color: var(--dim); overflow-wrap: anywhere; }
.card-actions { margin: 10px 0; }

.plainlist {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  font-size: 13px;
  color: var(--dim);
}

.plainlist li { padding: 5px 0; border-top: 1px dotted var(--edge); }

/* Status strip (§4.3) — outside the screen box, never over the player. */
.strip {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--edge-dim);
}

.strip-left {
  margin: 0;
  font-size: 16px;
  overflow-wrap: anywhere;
  min-height: 1.4em;
}

.strip-right {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

#ptv-state-label { color: var(--amber); }

.strip-button {
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  background: transparent;
  border: 1px solid var(--amber);
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
}

#ptv-resume { color: var(--green); border-color: var(--green); }

#ptv-behind, #ptv-tap { margin: 10px 0 0; }

.note {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--dim);
  overflow-wrap: anywhere;
}

/* ── Control row (§4.3, §7 L-8) ─────────────────────────────────────────── */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 0;
}

.controls button, .button {
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--edge);
  padding: 11px 16px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.controls button:hover, .button:hover { border-color: var(--amber); }

.controls button[aria-pressed="true"],
.controls button[aria-expanded="true"],
.button:hover {
  border-color: var(--amber);
  color: var(--amber);
}

/* Visible focus everywhere: 2px, ≥3:1 against the chassis (§7). */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ── Keyboard help (§4.4) ────────────────────────────────────────────────── */

.help {
  border: 1px solid var(--edge-dim);
  background: var(--panel-2);
  padding: 16px 18px;
  margin: 6px 0 18px;
}

.help h2 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
}

.help-table { border-collapse: collapse; }
.help-table th, .help-table td { text-align: left; padding: 4px 14px 4px 0; font-size: 14px; }
.help-table kbd {
  border: 1px solid var(--edge);
  padding: 1px 7px;
  color: var(--amber);
  font: inherit;
}
.help-hint { margin: 12px 0 4px; font-size: 13px; color: var(--dim); }

/* ── Up Next (§4.6) — read-only plain text, never focusable items ────────── */

.upnext {
  border: 1px solid var(--edge);
  background: var(--panel);
  padding: 14px 16px 16px;
  margin-top: 16px;
}

.upnext-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.upnext-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--amber);
}

.upnext-head .button { padding: 8px 12px; min-height: 44px; }

.upnext-block {
  margin: 10px 0 0;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.upnext-items {
  list-style: none;
  margin: 8px 0;
  padding: 0;
}

.upnext-items li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 0;
  border-top: 1px dotted var(--edge);
  font-size: 14px;
  cursor: default; /* L-9: read-only items never look clickable */
  overflow-wrap: anywhere;
}

.upnext-items .rel {
  color: var(--amber);
  font-size: 13px;
  white-space: nowrap;
}

/* ── Static no-JS section (§7) ───────────────────────────────────────────── */

.static {
  border: 1px solid var(--edge-dim);
  background: var(--panel-2);
  padding: 16px 18px;
  margin-top: 26px;
}

.static h2 {
  margin: 0 0 8px;
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.static p { font-size: 14px; color: var(--dim); margin: 0 0 8px; }
.static h3 { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber); margin: 14px 0 4px; }
.static ul { list-style: none; margin: 0; padding: 0; }
.static li { padding: 5px 0; border-top: 1px dotted var(--edge-dim); font-size: 13px; }

/* ── Footer ─────────────────────────────────────────────────────────── */

/* @PTV:footer */

.footer {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--edge-dim);
  font-size: 12.5px;
  color: var(--dim);
}

.footer p { margin: 0 0 6px; }
.footer a { color: var(--amber); }

/* ── C10 content pages (/about, /privacy, /404) ──────────────────────────
 * Same chassis and palette as the station. Prose is capped at 68ch for
 * readable line lengths (§7), headings are semantic and amber-labeled, no
 * motion is added anywhere, and the global :focus-visible rule above covers
 * visible focus. Nothing here touches the station layout (D9 untouched). */

.page-nav {
  margin-left: auto;
  display: flex;
  gap: 16px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-nav a { color: var(--dim); }
.page-nav a:hover, .page-nav a:focus-visible { color: var(--amber); }
.page-nav [aria-current="page"] { color: var(--amber); border-bottom: 2px solid var(--amber); }

.doc article, .doc .nosignal {
  max-width: 68ch; /* §7 readable line lengths */
  margin: 24px auto 0;
}

.doc h1 {
  margin: 0 0 14px;
  font-size: 24px;
  letter-spacing: 0.04em;
}

.doc .lede { color: var(--ink); font-size: 15.5px; }

.doc h2 {
  margin: 26px 0 8px;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}

.doc p { margin: 0 0 12px; font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.doc a { color: var(--amber); }
.doc .contact { overflow-wrap: anywhere; }

.doc .rights {
  margin: 6px 0 14px;
  padding: 12px 16px;
  border-left: 3px solid var(--amber);
  background: var(--panel);
}

.doc .rights p { margin: 0; color: var(--ink); font-size: 14.5px; }

.table-scroll { overflow-x: auto; margin: 0 0 14px; }

.doc table.blocks {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.doc table.blocks th, .doc table.blocks td {
  border: 1px solid var(--edge);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}

.doc table.blocks thead th {
  color: var(--amber);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.doc table.blocks tbody th { color: var(--ink); white-space: nowrap; }
.doc table.blocks tbody td { color: var(--dim); }

/* The 404 "No signal" card: test pattern, big red title, one way home. */
.doc .nosignal { text-align: center; padding-bottom: 8px; }

.doc .nosignal h1 {
  margin: 18px 0 6px;
  font-size: 28px;
  letter-spacing: 0.34em;
  color: var(--red);
}

.doc .nosignal .nosignal-sub { margin: 0 0 6px; color: var(--dim); font-size: 14.5px; }

.footer-nav {
  display: flex;
  gap: 16px;
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.footer-nav a { color: var(--amber); }


/* ── Mobile (<720px): inline player, two-column 44px controls, hidden
 *    keyboard help, dogtag wrapping (§4.3, §7) ─────────────────────────── */

@media (max-width: 719px) {
  .screen { min-width: 0; min-height: 200px; }
  .strip-left { font-size: 14px; } /* §7: dogtag at least 14px on mobile */
  .controls { display: grid; grid-template-columns: 1fr 1fr; }
  #ptv-help-toggle { display: none; }
  .tune-in { font-size: 22px; padding: 14px 34px; }
  .chassis { padding: 10px 10px 20px; }
}

/* Landscape phones (§4.3): the screen fills the width, the strip collapses
 * to one line, and the control row is hidden. Fullscreen stays YouTube's
 * own button inside the player. */
@media (orientation: landscape) and (max-height: 480px) {
  .controls { display: none; }
  .strip { flex-wrap: nowrap; }
  .strip-left { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .testcard { height: 22vh; }
}

/* ── §7 reduced motion: every decorative animation and transition stops;
 *    the standby card is a still card, and cuts are hard cuts ───────────── */

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