/* ==========================================================================
   base.css — Reset + typographie + focus accessible
   ========================================================================== */

/* ---- Reset moderne ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition-base), color var(--transition-base);
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
img, video { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; max-width: 100%; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

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

/* ---- Titres ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: clamp(var(--text-3xl), 5vw, var(--text-5xl)); }
h2 { font-size: clamp(var(--text-2xl), 4vw, var(--text-3xl)); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm); }

p { text-wrap: pretty; }

/* ---- Tableaux de contenu (CMS) ---- */
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th, td { padding: var(--space-3) var(--space-4); text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: top; overflow-wrap: break-word; }
thead th { background: var(--color-surface-alt); font-weight: 600; }

/* Écrans étroits : les tableaux larges défilent horizontalement au lieu
   d'élargir la page (tableaux de contenu, programme, comparaisons…). */
@media (max-width: 48em) {
  table { display: block; overflow-x: auto; overscroll-behavior-x: contain; }
}

/* ---- Liens ---- */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-base);
}
a:hover { color: var(--accent-hover); }
a:where(.brand, .nav-link, .nav-sub__link, .btn, .footer-link, .card-link) { text-decoration: none; }

/* ---- Focus visible accessible (clavier uniquement) ---- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-md);
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform var(--transition-base);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---- Sélection ---- */
::selection {
  background-color: var(--accent-soft);
  color: var(--color-text);
}

/* ---- Scrollbar discrète ---- */
@supports (scrollbar-width: thin) {
  * { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
}

/* ---- Champs désactivés ---- */
:disabled, [aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---- Impression ---- */
@media print {
  body { background: #fff; color: #000; }
  .no-print { display: none !important; }
  a { color: #000; text-decoration: underline; }
}
