/* studio.css: styles for the Studio Room TV on wesfryer.com.
   Every color, font and spacing value is a CSS variable in the :root block below.
   A later Castle, Dial or Plain View style can replace just that block. */

:root {
  /* Colors: simple high-contrast default */
  --page-bg: #f6f3ea;
  --surface: #ffffff;
  --text: #121212;
  --text-muted: #3b3b3b;
  --link: #0b4f9c;
  --accent: #0b4f9c;          /* selected video in the guide */
  --accent-text: #ffffff;
  --row-line: #d4cebf;
  --row-hover: #ece6d6;
  --cabinet: #4a3b33;
  --cabinet-dark: #1c1714;
  --cabinet-light: #7a6658;
  --bar-bg: #0d0d0d;
  --bar-text: #ffffff;
  --bar-num: #ffd23f;
  --screen-bg: #000000;
  --screen-text: #ffffff;
  --button-bg: #ffd23f;
  --button-text: #121212;
  --button-edge: #121212;
  --button-hover-bg: #ffe37f;
  --button-current-bg: #121212;
  --button-current-text: #ffd23f;
  --error-bg: #fff1f0;
  --error-edge: #a4161a;
  --focus-inner: #ffffff;     /* two-tone focus ring: shows on light and dark */
  --focus-outer: #121212;

  /* Type */
  --font-body: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-size: 1rem;
  --line-height: 1.5;

  /* Spacing and shape */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --pixel: 4px;               /* thickness of pixel borders */
  --step-1: 6px;              /* stepped corner sizes on the cabinet */
  --step-2: 12px;
  --tap-size: 2.75rem;        /* minimum button size (44px) */
  --page-max: 75rem;
  --tv-max: 48rem;
  --guide-max-height: 32rem;

  /* Motion (studio.js sets this from its config, capped under half a second) */
  --static-ms: 300ms;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--font-size);
  line-height: var(--line-height);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--space-2); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 var(--space-2); }
a { color: var(--link); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 0.15em; }
button, input { font: inherit; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Visible focus ring on everything that takes focus */
:focus-visible {
  outline: 3px solid var(--focus-outer);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--focus-inner);
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -10rem;
  z-index: 10;
  background: var(--surface);
  color: var(--link);
  padding: var(--space-2) var(--space-3);
  border: var(--pixel) solid var(--button-edge);
}
.skip-link:focus { top: var(--space-2); }

.note { color: var(--text-muted); font-size: 0.875rem; }

/* ---------- Page layout ---------- */

.page-header, .layout, .load-error {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--space-3);
}
.page-header { padding-top: var(--space-4); }

.layout {
  display: grid;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
}
.tv-column, .guide { min-width: 0; }

/* Desktop: TV on the left, guide on the right */
@media (min-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
  .guide { position: sticky; top: var(--space-3); }
  .guide-list { max-height: calc(100vh - 14rem); }
}

.load-error {
  background: var(--error-bg);
  border: var(--pixel) solid var(--error-edge);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
}

/* ---------- The TV ---------- */

.tv { max-width: var(--tv-max); margin-inline: auto; }
.tv:focus { outline: none; }
.tv:focus-visible { outline: 3px solid var(--focus-outer); }

.tv-antenna {
  display: block;
  width: 7.5rem;
  height: auto;
  margin: 0 auto -2px;
  fill: var(--cabinet-dark);
}

/* Cabinet with stepped "pixel" corners */
.tv-cabinet {
  background: var(--cabinet);
  border: var(--pixel) solid var(--cabinet-dark);
  padding: var(--space-3);
  box-shadow: inset var(--pixel) var(--pixel) 0 var(--cabinet-light);
  clip-path: polygon(
    0 var(--step-2), var(--step-1) var(--step-2), var(--step-1) var(--step-1), var(--step-2) var(--step-1), var(--step-2) 0,
    calc(100% - var(--step-2)) 0, calc(100% - var(--step-2)) var(--step-1), calc(100% - var(--step-1)) var(--step-1),
    calc(100% - var(--step-1)) var(--step-2), 100% var(--step-2),
    100% calc(100% - var(--step-2)), calc(100% - var(--step-1)) calc(100% - var(--step-2)),
    calc(100% - var(--step-1)) calc(100% - var(--step-1)), calc(100% - var(--step-2)) calc(100% - var(--step-1)),
    calc(100% - var(--step-2)) 100%,
    var(--step-2) 100%, var(--step-2) calc(100% - var(--step-1)), var(--step-1) calc(100% - var(--step-1)),
    var(--step-1) calc(100% - var(--step-2)), 0 calc(100% - var(--step-2))
  );
}

.tv-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
  background: var(--bar-bg);
  color: var(--bar-text);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-3);
  font-size: 1.125rem;
  border: var(--pixel) solid var(--cabinet-dark);
}
.ch-num { color: var(--bar-num); font-weight: bold; }
.ch-name { overflow-wrap: anywhere; }

.tv-screen {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--screen-bg);
  color: var(--screen-text);
  border: var(--pixel) solid var(--cabinet-dark);
  overflow: hidden;
}

.screen-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  margin: 0;
  text-align: center;
}
.screen-message a { color: var(--bar-num); }

/* Click-to-play facade: thumbnail plus a Play badge */
.play-facade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: var(--screen-bg);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.play-facade img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.play-badge {
  position: relative;
  background: var(--button-bg);
  color: var(--button-text);
  border: var(--pixel) solid var(--button-edge);
  box-shadow: 6px 6px 0 var(--button-edge);
  padding: var(--space-2) var(--space-4);
  font-weight: bold;
  font-size: 1.25rem;
  text-transform: uppercase;
}
.play-facade:hover .play-badge { background: var(--button-hover-bg); }
.play-facade:focus-visible { outline-offset: -10px; box-shadow: inset 0 0 0 4px var(--focus-inner); }

.player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Channel-change static: short, and off for reduced motion */
.tv-static {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background-color: #6f6f6f;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.22) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.30) 0 3px, rgba(255, 255, 255, 0.12) 3px 4px, transparent 4px 7px);
  background-size: 9px 9px, 13px 13px;
}
.tv-static.on { animation: tv-static var(--static-ms) linear 1; }
@keyframes tv-static {
  0%   { opacity: 0.9; background-position: 0 0, 0 0; }
  100% { opacity: 0;   background-position: 6px 11px, 17px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .tv-static, .tv-static.on { animation: none; display: none; }
}

.tv-panel {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.tv-grille {
  flex: 1;
  height: 1.25rem;
  background: repeating-linear-gradient(90deg, var(--cabinet-dark) 0 4px, transparent 4px 8px);
}
.tv-knob {
  width: 1.25rem;
  height: 1.25rem;
  background: var(--cabinet-dark);
  box-shadow: inset 4px 4px 0 var(--cabinet-light);
}

/* ---------- Remote ---------- */

.remote {
  max-width: var(--tv-max);
  margin: var(--space-3) auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "prev next" "pad pad";
  gap: var(--space-3);
  align-items: center;
}
#prev { grid-area: prev; }
#next { grid-area: next; }
/* Channel keypad: two columns on a phone, two rows of five on wider screens */
.keypad {
  grid-area: pad;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}
.keypad li { display: flex; }
@media (min-width: 600px) {
  .keypad { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.pixel-button {
  min-width: var(--tap-size);
  min-height: var(--tap-size);
  padding: var(--space-1) var(--space-3);
  background: var(--button-bg);
  color: var(--button-text);
  border: var(--pixel) solid var(--button-edge);
  box-shadow: var(--pixel) var(--pixel) 0 var(--button-edge);
  font-weight: bold;
  cursor: pointer;
}
.pixel-button:hover { background: var(--button-hover-bg); }
.pixel-button:active { transform: translate(var(--pixel), var(--pixel)); box-shadow: none; }
.pixel-button[aria-current="true"] {
  background: var(--button-current-bg);
  color: var(--button-current-text);
}
/* Keypad buttons: number on top, short label below */
.key {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  padding: var(--space-2) var(--space-1);
  font-size: 0.875rem;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}
.key-num { font-size: 1.125rem; }
.key-on {
  display: none;
  font-size: 0.75rem;
  border: 2px solid currentColor;
  padding: 0 var(--space-1);
}
/* Current channel: dark fill, inner frame, pressed-in position and an "ON" tag, so it is not marked by color alone */
.key[aria-current="true"] {
  box-shadow: inset 0 0 0 3px var(--button-current-text);
  transform: translate(var(--pixel), var(--pixel));
}
.key[aria-current="true"] .key-on { display: inline-block; }

/* ---------- Now showing ---------- */

.now { max-width: var(--tv-max); margin-inline: auto; }
.now-title { overflow-wrap: anywhere; }
.now-meta { color: var(--text-muted); }
.setting { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.setting input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--accent); }

/* ---------- Channel guide ---------- */

.guide-sub { color: var(--text-muted); }
.search-wrap { display: grid; gap: var(--space-1); margin-bottom: var(--space-2); }
.search-wrap input {
  width: 100%;
  min-height: var(--tap-size);
  padding: var(--space-1) var(--space-2);
  border: var(--pixel) solid var(--button-edge);
  background: var(--surface);
  color: var(--text);
}

.guide-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: var(--guide-max-height);
  overflow-y: auto;
  background: var(--surface);
  border: var(--pixel) solid var(--button-edge);
}
.guide-item {
  display: block;
  width: 100%;
  min-height: var(--tap-size);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-bottom: 2px solid var(--row-line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.guide-item:hover { background: var(--row-hover); }
.guide-item:focus-visible { outline-offset: -5px; box-shadow: inset 0 0 0 3px var(--focus-inner); }
.guide-item .meta { display: block; color: var(--text-muted); font-size: 0.875rem; }
.guide-item[aria-current="true"] { background: var(--accent); color: var(--accent-text); }
.guide-item[aria-current="true"] .meta { color: var(--accent-text); }

/* Links to the Radio and the rest of the site (added by the overnight build). */
.studio-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin-top: 0.6rem; }
.studio-links a { font-weight: 700; }

/* ---------- Shared site header and footer (added Nov 15, 2026) ----------
   The header and footer come from /assets/site.css; these lines keep the TV's own fonts out of them
   and keep site.css serif headlines out of the TV. */
.site-header, .site-footer { font-family: var(--font-sans); font-size: 1.0625rem; line-height: 1.6; }
.site-header { background: var(--bg); }
.site-footer { background: var(--bg); color: var(--text); }
main h1, main h2, main h3 { font-family: var(--font-body); }
