/* ── The genre channels and the guide ────────────────────────
   Loaded by /tv and the channels' pages only (templates/tv.html,
   templates/channels/watch.html). Colours are the site's tokens
   (style.css). The player's box has its shape before Play (16:9, or a
   band for sound), so nothing moves when it starts.                    */

/* ── A channel's page ────────────────────────────────────── */
.channel-page {
  padding: 1rem var(--gutter) 2rem;
  max-width: 96rem;
  margin: 0 auto;
}
.channel-stage {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.channel-screen { position: relative; min-width: 0; }
.channel-player {
  position: relative;
  aspect-ratio: 16 / 9;
  /* As the player's own box (.inv-player): the same shape before and after Play. */
  max-height: 80vh;
  background: var(--media-bg);
  color: var(--on-media);
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  min-width: 0;
}
.channel-player.channel-player--audio { aspect-ratio: 16 / 5; }
.channel-player .inv-player,
.channel-player video { width: 100%; height: 100%; }
.channel-between {
  position: absolute;
  inset: auto 1rem 1rem 1rem;
  margin: 0;
  padding: 0.75rem 1rem;
  background: color-mix(in oklab, var(--media-bg) 80%, transparent);
  color: var(--on-media);
  border-radius: 8px;
  z-index: 4;
}
.channel-between button { margin-inline-start: 0.75rem; }
.channel-now { min-width: 0; }
.channel-kicker { margin: 0 0 0.5rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.channel-tier { color: var(--text-muted); font-size: var(--step--1); }
.channel-about { color: var(--text-muted); margin: 0 0 1rem; text-wrap: pretty; }
/* What changes at a boundary keeps its box: two lines for a title, two for
   its rights, one for each line of the list. */
.channel-title { font-size: var(--step-1); font-weight: 650; margin: 0 0 0.35rem; overflow-wrap: anywhere; }
.channel-title a {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-height: 2lh;
}
.channel-title a { color: var(--text); }
.channel-times { display: block; font-weight: 400; font-size: var(--step--1); color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* A time's box does not change with its digits, so what follows it never moves. */
.channel-times time { display: inline-block; inline-size: 5ch; text-align: center; }
.channel-rights {
  color: var(--text-dim);
  font-size: var(--step--1);
  margin: 0 0 1rem;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  min-height: 2lh;
}
.channel-switch { display: flex; flex-wrap: wrap; gap: 0.5rem; }
/* The line in the channel's voice keeps two lines' box, so a boundary moves nothing. */
.channel-line {
  margin: 0 0 0.5rem;
  color: var(--text);
  text-wrap: pretty;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  min-height: 3lh;
}
.channel-strand { color: var(--text-muted); font-size: var(--step--1); font-weight: 600; }
.channel-strand:empty { display: none; }
/* Year, source and rights: one press down, never removed. */
.channel-facts { margin: 0 0 1rem; }
.channel-facts summary { cursor: pointer; color: var(--text-muted); font-size: var(--step--1); min-height: 24px; }
.channel-facts .channel-rights { margin: 0.35rem 0 0; }
.channel-written { font-size: var(--step--1); }

.channel-next, .channel-about-it, .channel-others { margin-top: 2rem; }
.channel-list { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; gap: 0.25rem; }
.channel-slot {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  column-gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--hairline);
}
.channel-slot time { color: var(--text-muted); font-variant-numeric: tabular-nums; grid-row: span 2; }
.channel-slot-title,
.channel-slot-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1lh; min-width: 0; }
.channel-slot-meta { color: var(--text-dim); font-size: var(--step--1); }
.channel-slot time { min-height: 1lh; }
.channel-about-it p { max-width: 48rem; color: var(--text-muted); text-wrap: pretty; }
.channel-others-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0.5rem;
}
.channel-others-list a,
.channel-closed {
  display: grid;
  gap: 0.15rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  background: var(--bg-card);
  height: 100%;
  box-sizing: border-box;
}
.channel-others-list a[aria-current="page"] { border-color: var(--accent); }
.channel-others-list span, .channel-closed span { color: var(--text-muted); font-size: var(--step--1); overflow-wrap: anywhere; }

@media (max-width: 800px) {
  .channel-stage { grid-template-columns: minmax(0, 1fr); }
}

/* ── The guide (crate::guide; templates/guide/macros.html) ──
   Every row keeps its height when its words change (a programme's end, the
   time left, a favourite's state looked up), so nothing below it moves: a
   row that lists programmes is one height, a row that says its state
   another, each line of words clamped to its lines. The guide's rows are a
   grid per group; the arrow keys are inv-guide.js's. */
.guide {
  --guide-line: 1.35;
  --guide-tall: 6.5rem;
  --guide-short: 5rem;
}
.guide-keys { color: var(--text-muted); }
.guide-index { margin: 0.5rem 0 0; padding-inline: var(--gutter); }
.guide-index-list { display: flex; gap: 0.5rem; overflow-x: auto; padding-block: 0.35rem; scrollbar-width: thin; }
.guide-index-list .filter-pill { flex: none; display: inline-flex; align-items: center; gap: 0.35em; min-height: 44px; box-sizing: border-box; }
/* What is typed of a number, over the page: it takes no room, so it moves nothing. */
.guide-jump {
  position: fixed; inset-block-start: 5.5rem; inset-inline-end: 1.5rem; z-index: 60;
  margin: 0; padding: 0.7rem 1.2rem; border-radius: var(--radius-lg);
  background: var(--bg-card); color: var(--text); border: 1px solid var(--border);
  font-size: var(--step-1); font-weight: 650; font-variant-numeric: tabular-nums;
  box-shadow: 0 8px 24px color-mix(in oklab, black 28%, transparent);
  pointer-events: none;
}
.guide-jump:empty { opacity: 0; }
.guide-group { margin-top: 1.25rem; }
.guide-group[hidden] { display: none; }
.guide-group-h { padding-inline: var(--gutter); margin: 0 0 0.15rem; font-size: var(--step-1); }
.guide-about { padding-inline: var(--gutter); margin: 0 0 0.25rem; color: var(--text-muted); font-size: var(--step--1); max-width: 60rem; }
.guide-grid { padding-inline: var(--gutter); display: grid; gap: 0; align-content: start; }
/* (align-content: start: the room kept for rows to come stays below the
   rows there, instead of stretching them, which would move them when the
   rows came.) */
.guide-row {
  display: grid;
  grid-template-columns: minmax(11rem, 1.1fr) repeat(3, minmax(0, 1fr)) 2.75rem;
  column-gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--hairline);
  align-items: start;
  line-height: var(--guide-line);
  box-sizing: border-box;
  min-block-size: var(--guide-short);
}
.guide-row:not(.guide-row--state):not(.guide-head):not([data-key^="y:"]),
.guide-row--fav { block-size: var(--guide-tall); overflow: hidden; }
.guide-head { color: var(--text-muted); font-size: var(--step--1); font-weight: 600; min-block-size: 0; padding-block: 0.35rem; }
.guide-ch { min-width: 0; }
.guide-ch a {
  font-weight: 650; color: var(--text);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  overflow-wrap: anywhere;
}
.guide-ch a[aria-current="page"] { color: var(--accent-text); }
.guide-n { display: inline-block; min-inline-size: 2.6em; margin-inline-end: 0.25rem; color: var(--text-muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.guide-ch small { display: block; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide-cell { min-width: 0; overflow-wrap: anywhere; }
.guide-cell ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.guide-cell a { color: var(--text); }
.guide-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.guide-time, .guide-left { display: block; color: var(--text-muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guide-left { color: var(--accent-text); }
.guide-reason {
  grid-column: span 3; color: var(--text-muted); font-size: var(--step--1);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.guide-row[data-state="on"] .guide-reason { color: var(--text); }
.guide-sport { color: var(--text-muted); font-size: var(--step--1); }
.guide-label { display: none; }
.guide-favc { display: flex; justify-content: center; }
.guide-fav {
  inline-size: 44px; block-size: 44px; margin-block-start: -0.35rem;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.25rem; line-height: 1;
}
.guide-fav:hover { border-color: var(--border); color: var(--text); }
.guide-star::before { content: "☆"; }
.guide-fav[aria-pressed="true"] { color: var(--accent-text); }
.guide-fav[aria-pressed="true"] .guide-star::before { content: "★"; }
.guide-more { padding-inline: var(--gutter); margin: 0.5rem 0 0; }
.guide-more .btn { min-height: 44px; }
.guide [role="gridcell"]:focus-visible, .guide [role="rowheader"]:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
/* Titles a work they were made from holds here (routes::channels::HeldView). */
.guide-held { margin: 0.75rem var(--gutter) 0; color: var(--text-muted); font-size: var(--step--1); }
.guide-held summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--text); }
.guide-held ul { margin: 0.25rem 0 0; padding-inline-start: 1.1rem; display: grid; gap: 0.5rem; overflow-wrap: anywhere; }
.guide-held a { color: var(--text); font-weight: 600; }
.guide-held small { color: var(--text-dim); margin-inline: 0.25rem; }
/* A genre channel's and a world channel's page carry the guide's rows. */
.channel-others.guide .guide-grid, .live-guide .guide-grid { padding-inline: 0; }
.live-guide { padding-inline: var(--gutter); }

@media (max-width: 720px) {
  .guide { --guide-tall: 10.2rem; --guide-short: 5rem; }
  .guide-head { display: none; }
  .guide-row {
    grid-template-columns: minmax(0, 1fr) 2.75rem;
    grid-auto-flow: row;
    row-gap: 0.25rem;
  }
  .guide-ch { grid-column: 1; grid-row: 1; }
  .guide-favc { grid-column: 2; grid-row: 1; }
  .guide-cell:not(.guide-favc) { grid-column: 1 / -1; }
  .guide-reason { grid-column: 1 / -1; }
  .guide-label { display: inline; color: var(--text-dim); font-size: var(--step--1); margin-inline-end: 0.35rem; }
  .guide-cell ul { display: block; }
  .guide-cell li { display: block; }
  .guide-cell .guide-title { display: inline; -webkit-line-clamp: 1; line-clamp: 1; }
  .guide-cell:not(.guide-reason) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .guide-time, .guide-left { display: inline; margin-inline-start: 0.35rem; }
}

/* ── Tonight (templates/channels/tonight.html) ───────────── */
.tonight-page { padding: 1rem var(--gutter) 2rem; max-width: 72rem; margin: 0 auto; }
.tonight-head .section-desc { max-width: 48rem; }
.tonight-zone { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.75rem 0 0.25rem; }
.tonight-zone select { min-height: 44px; max-width: 100%; font: inherit; border-radius: var(--field-radius, 8px); border: 1px solid var(--border); background: var(--bg-card); color: var(--text); padding: 0 0.5rem; }
/* The device's zone is offered in a line that is always there, so showing it moves nothing. */
.tonight-device { min-height: 2lh; margin: 0.25rem 0 0; color: var(--text-muted); font-size: var(--step--1); visibility: hidden; }
.tonight-device[data-shown] { visibility: visible; }
.tonight-channel { margin-top: 1.75rem; }
.tonight-tagline { color: var(--text-muted); margin: 0 0 0.5rem; text-wrap: pretty; }
.tonight-reason { color: var(--text-muted); }
.tonight-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tonight-item {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  column-gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--hairline);
}
.tonight-item time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tonight-item--fixed { border-inline-start: 3px solid var(--accent); padding-inline-start: 0.5rem; }
.tonight-body p { margin: 0; overflow-wrap: anywhere; }
.tonight-title { font-weight: 650; }
.tonight-title a { color: var(--text); }
.tonight-strand { color: var(--text-muted); font-size: var(--step--1); font-weight: 600; }
.tonight-line { margin-top: 0.2rem; text-wrap: pretty; }
.tonight-facts { color: var(--text-muted); font-size: var(--step--1); margin-top: 0.2rem; }
.tonight-week, .tonight-season { margin-top: 2rem; }
.tonight-season p, .tonight-pieces, .tonight-nights { max-width: 52rem; }
.tonight-pieces, .tonight-nights { padding-inline-start: 1.25rem; }
.tonight-pieces li, .tonight-nights li { margin: 0.35rem 0; }
.tonight-here { color: var(--text-muted); }
.tonight-foot { margin-top: 2rem; }
@media (max-width: 480px) {
  .tonight-item { grid-template-columns: minmax(0, 1fr); }
  .tonight-device { min-height: 3lh; }
}
/* A channel not offered where the visitor is: why, in plain words. */
.channel-not-offered { margin: 0 0 1rem; max-width: 62ch; text-wrap: pretty; }
.channel-not-offered a { color: var(--accent-text); text-decoration: underline; }
