/* =============================================================================
   RADIONL — BASE
   Reset, typography defaults and the two-column page frame.
   Load order: fonts.css → tokens.css → base.css → components.css → pages.css
   ========================================================================== */

/* ------------------------------- 1. Reset --------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;

  /*
   * Always reserve the scrollbar's column, whether or not this page needs one.
   *
   * Without it every move between a page that scrolls and a page that does not
   * shifts the entire layout sideways by the width of the scrollbar — the exact
   * sideways twitch that makes a soft navigation feel broken. Ignored on
   * platforms with overlay scrollbars, where there is nothing to reserve.
   */
  scrollbar-gutter: stable;

  /*
   * Nothing drags sideways. The layout has no horizontal scroll by design, so
   * any that appears is a defect — an editor's long URL, a pasted embed, a
   * table wider than the phone — and on a touch screen it reads as the page
   * being broken rather than as something to scroll.
   *
   * `clip` rather than `hidden`: hidden would make this element a scroll
   * container, which silently kills `position: sticky` on the header.
   */
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }

/*
 * <picture> must not exist as far as layout is concerned.
 *
 * It wraps images that offer generated WebP sizes, and a wrapper is exactly
 * what the surrounding CSS does not expect: .hero__portrait is positioned
 * absolutely against .hero, and the avatars are flex children of .onair__item
 * and .player-bar. Wrapping them made <picture> the box that got positioned
 * and the item that flexed, and the <img> inside it stopped obeying rules
 * written for a direct child. `display: contents` removes the wrapper's own
 * box and lets the image lay out exactly as it did before it gained a srcset.
 */
picture { display: contents; }

/*
 * ...and its <source> children must generate no box at all.
 *
 * This is the half that is easy to miss. `display: contents` hoists *every*
 * child of <picture> into the parent's layout, and a <source> computes to
 * `display: block` — it is normally invisible only because nothing ever
 * promotes it. Hoisted into a grid it becomes a real grid item, takes a cell,
 * and shunts everything after it along by one: in "Vandaag op de radio" the
 * presenter's name was pushed out of the text column and into the 46px avatar
 * column, where it wrapped.
 */
picture > source { display: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }

/* The handbook requires a focus state that survives keyboard use and does not
   rely on colour alone — hence a ring with its own offset, not a tint. */
:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------- 2. Type helpers ----------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--color-navy);
}

/* Links in running text carry an underline as well as the colour, because
   colour alone is not an accessible indicator. */
.prose a { color: var(--color-blue); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--color-blue-hover); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.icon { width: 1em; height: 1em; flex: none; }

.skip-link {
  position: fixed; inset-block-start: 10px; inset-inline-start: 10px; z-index: 300;
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: var(--color-blue); color: var(--color-white); font-weight: 700;
  transform: translateY(-200%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: none; }

/* ------------------------------ 3. Layout --------------------------------- */
.container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}

/*
 * The page frame from the design: content on the left, a fixed-width rail on
 * the right holding the live panels. The rail is a constant width rather than a
 * fraction so the "Nu op RADIONL" cover art keeps the same size on every page.
 */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--rail-width);
  gap: var(--gap);
  align-items: start;
  padding-block: var(--gap);
}

.layout__main,
.layout__rail {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

/* Pages with no live rail (article bodies, forms) span the full width. */
.layout--full { grid-template-columns: minmax(0, 1fr); }

/*
 * The rail scrolls with the page.
 *
 * It was sticky, with its own scrollbar to stop it growing past the viewport.
 * That traded one problem for a worse one: on a page whose main column is
 * shorter than the rail — the homepage, most days — the last panel was clipped
 * and the only way to reach it was a scrollbar inside a sidebar, which nobody
 * looks for. The design does not show a pinned rail either.
 */

/* ----------------------------- 4. Responsive ------------------------------ */
@media (max-width: 1320px) {
  :root { --rail-width: 372px; }
}

@media (max-width: 1120px) {
  :root { --rail-width: 328px; --gap: 14px; }
}

/*
 * Below this the rail stops being a column and becomes a band under the
 * content: two panels side by side on a tablet, stacked on a phone. The live
 * panel keeps the full width because its cover art is the largest element.
 */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .layout__rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
  .layout__rail > :first-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  :root { --gap: 12px; --header-height: 64px; }
  .container { width: min(100% - 24px, var(--container)); }
  .layout__rail { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 420px) {
  .container { width: min(100% - 20px, var(--container)); }
}

/* -------------------------- 5. Motion and print --------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  body { background: #fff; }
  .site-header, .search, .scrim, .layout__rail, .site-footer, .player-bar { display: none !important; }
  .hero { background: none !important; color: #000; }
}
