/* ==========================================================================
   base.css — Reset, self-hosted fonts, base typography & layout primitives
   --------------------------------------------------------------------------
   Loaded AFTER tokens.css. Contains no magic numbers — every value comes
   from a custom property defined in tokens.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. SELF-HOSTED FONTS — Poppins (SIL Open Font License, free for web use)
   Files live in /assets/fonts. Two weights only: 400 Regular, 600 SemiBold.
   Each weight is split into latin + latin-ext subsets (latin-ext covers the
   accented characters in French copy and broadcaster names, e.g. ČT, RÚV).
   font-display: swap → text is visible immediately using the fallback.
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/poppins-latin-ext-600-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* --------------------------------------------------------------------------
   2. MODERN CSS RESET (lightweight)
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: clip; /* with body's clip: keeps pre-entrance shifts from widening the mobile viewport */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  /* Offset anchor jumps so targets aren't hidden behind the fixed header */
  scroll-padding-top: var(--header-height);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  /* side-entrance animations pre-shift elements ±48px; clip (NOT hidden — it
     would break position:sticky pins) keeps them from causing page scroll */
  overflow-x: clip;
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  letter-spacing: var(--ls-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  text-rendering: optimizeLegibility;
}

/* Media defaults — block-level, never overflow, no layout shift */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* <picture> is a wrapper, not a box: let the inner <img> size against the
   picture's PARENT (the sized media container) so height:100% / object-fit
   work inside fixed- or aspect-ratio boxes. Avoids the classic collapse. */
picture {
  display: contents;
}

/* Form elements inherit type */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

/* Avoid text overflow on long words (e.g. URLs, long FR strings) */
p,
h1,
h2,
h3,
h4,
h5,
h6,
li,
figcaption {
  overflow-wrap: break-word;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   3. BASE TYPOGRAPHY
   Headings default to SemiBold; exact per-section sizes live in sections.css.
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-weight: var(--fw-semibold);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-tight);
  text-wrap: balance; /* nicer multi-line headline wrapping (progressive)   */
}

h1 { font-size: var(--fs-fluid-h1); }
h2 { font-size: var(--fs-fluid-h2); }
h3 { font-size: var(--fs-fluid-h3); }
h4 { font-size: var(--fs-lg); }

p {
  max-width: var(--container-text);
  text-wrap: pretty;
}

strong,
b {
  font-weight: var(--fw-semibold);
}

small {
  font-size: var(--fs-sm);
}

/* --------------------------------------------------------------------------
   4. LAYOUT PRIMITIVES
   Reusable structural helpers shared by all sections.
   -------------------------------------------------------------------------- */

/* Centered page container with responsive side gutters */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: var(--container-narrow); }
.container--text   { max-width: var(--container-text); }

/* Generic section vertical rhythm */
.section {
  padding-block: var(--section-pad-y);
}

/* Eyebrow / kicker label above headlines */

/* Visually-hidden (screen-reader only) utility */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: var(--space-2xs);
  left: var(--space-2xs);
  z-index: var(--z-modal);
  padding: var(--space-2xs) var(--space-sm);
  background: var(--color-accent);
  color: var(--color-text-on-light);
  border-radius: var(--radius-sm);
  transform: translateY(-150%);
  transition: transform var(--transition-base) var(--ease-out);
}
.skip-link:focus {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   5. ACCESSIBLE FOCUS STATES (WCAG — visible keyboard focus)
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: var(--border-medium) solid var(--color-focus);
  outline-offset: var(--border-medium);
  border-radius: var(--radius-sm);
}
/* Only show the ring for keyboard users, not mouse clicks */
:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   6. MOTION PREFERENCE SCAFFOLD (Phase 5)
   Default: motion is allowed. Any future animation MUST be expressed through
   the --transition-*/--ease-* tokens so this single block can switch it off.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
