/* =============================================================================
   DiatonicTab — Design System (2026)
   -----------------------------------------------------------------------------
   Socle CSS unique partagé par les 5 pages (index, telecharger, videos,
   soundfonts, partoches.php). Aucune dépendance externe hormis la police Inter.

   Organisation :
     1.  Design tokens (variables :root) — palette claire
     2.  Thème sombre ([data-theme="dark"]) + auto prefers-color-scheme
     3.  Reset & base
     4.  Typographie & hiérarchie
     5.  Layout (conteneur, grille, sections)
     6.  Navbar (sticky)
     7.  Sidebar / drawer mobile + overlay
     8.  Cartes (cards)
     9.  Boutons & liens
     10. Listes, tableaux, badges
     11. Callouts (info / warning / success / danger)
     12. Figures & médias (images, vidéo, audio)
     13. Cards de téléchargement
     14. Footer
     15. Bouton retour en haut
     16. Utilitaires
     17. Responsive (tablette / mobile)
     18. Accessibilité (focus, reduced-motion)
   ============================================================================= */


/* ==========================================================================
   1. DESIGN TOKENS — thème clair
   ========================================================================== */
:root {
  /* Palette — fond */
  --bg: #f5f7fa;
  --bg-alt: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f8fafc;

  /* Marque */
  --primary: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --secondary: #06b6d4;     /* cyan */
  --success: #16a34a;       /* validations */
  --danger: #dc2626;        /* erreurs uniquement */
  --warning: #d97706;

  /* Texte */
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --on-primary: #ffffff;

  /* Lignes & bordures */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Échelle d'espacement */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 64px;

  /* Rayons */
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* Ombres (discrètes) */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow: 0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .10), 0 4px 8px rgba(15, 23, 42, .05);
  --shadow-primary: 0 8px 20px rgba(59, 130, 246, .25);

  /* Transitions */
  --t: .2s ease;
  --t-slow: .35s cubic-bezier(.4, 0, .2, 1);

  /* Layout */
  --maxw: 1140px;
  --navbar-h: 64px;
  --sidebar-w: 264px;

  /* Typographie */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-h1: 2rem;
  --fs-h2: 1.6rem;
  --fs-h3: 1.3rem;
  --fs-h4: 1.1rem;
  --fs-body: 1rem;
  --fs-sm: .875rem;
  --fs-xs: .8rem;
  --lh: 1.65;
}

/* ==========================================================================
   2. THÈME SOMBRE
   ========================================================================== */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-alt: #0b1322;
  --surface: #1e293b;
  --surface-2: #243349;
  --text: #e2e8f0;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --border: #334155;
  --border-strong: #475569;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 4px 12px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
  --shadow-primary: 0 8px 20px rgba(59, 130, 246, .35);
}

/* Respect de la préférence système tant que l'utilisateur n'a pas choisi */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f172a;
    --bg-alt: #0b1322;
    --surface: #1e293b;
    --surface-2: #243349;
    --text: #e2e8f0;
    --text-soft: #cbd5e1;
    --muted: #94a3b8;
    --border: #334155;
    --border-strong: #475569;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 4px 12px rgba(0, 0, 0, .35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
  }
}


/* ==========================================================================
   3. RESET & BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Sécurité anti-débordement horizontal */
  overflow-x: hidden;
}

img, svg, video, canvas { max-width: 100%; height: auto; display: block; }

img { border-radius: var(--r-sm); }

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: color var(--t);
}
a:hover { color: var(--primary); text-decoration: underline; }

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.3em; }
p { margin: 0 0 var(--sp-4); }
h1, h2, h3, h4, h5, h6 { margin: 0 0 var(--sp-3); line-height: 1.25; font-weight: 700; }

/* ==========================================================================
   4. TYPOGRAPHIE & HIÉRARCHIE
   ========================================================================== */
h1 {
  font-size: var(--fs-h1);
  color: var(--text);
  letter-spacing: -.02em;
  /* Liseré bleu sous les titres de section (rappel discret de l'ancien site) */
  padding-bottom: var(--sp-3);
  border-bottom: 3px solid var(--primary);
  border-image: linear-gradient(90deg, var(--primary), var(--secondary)) 1;
}

h2 { font-size: var(--fs-h2); color: var(--text); letter-spacing: -.01em; }
h3 { font-size: var(--fs-h3); color: var(--primary-600); }
h4 { font-size: var(--fs-h4); color: var(--text-soft); }
h5 { font-size: var(--fs-body); color: var(--muted); font-weight: 600; }

strong, b { font-weight: 700; color: var(--text); }
i, em { font-style: italic; }

.text-muted { color: var(--muted); }
.text-center { text-align: center; }


/* ==========================================================================
   5. LAYOUT — conteneur, grille, sections
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

/* Zone de contenu principale (avec sidebar à gauche sur desktop) */
.main {
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--navbar-h));
  transition: margin var(--t-slow);
}

.section {
  padding-block: var(--sp-9);
}
.section--alt { background: var(--bg-alt); }

/* Grille éditoriale 2 colonnes (contenu / aside) */
.grid-edit {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--sp-7);
  align-items: start;
}

/* Grille responsive générique */
.grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}


/* ==========================================================================
   6. NAVBAR (sticky)
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--navbar-h);
}

.navbar__inner {
  height: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text);
  white-space: nowrap;
}
.navbar__brand:hover { text-decoration: none; color: var(--primary-600); }
.navbar__brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.navbar__links {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: auto;
  list-style: none;
  margin-bottom: 0;
  padding: 0;
}

.navbar__links a {
  display: inline-block;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.navbar__links a:hover {
  background: var(--surface-2);
  color: var(--primary-600);
  text-decoration: none;
}

/* Bouton hamburger (mobile) */
.nav-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 42px; height: 42px;
  border-radius: var(--r-sm);
  cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* Sélecteur de thème */
.theme-toggle {
  margin-left: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 42px; height: 42px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center; justify-content: center;
  transition: background var(--t), transform var(--t);
}
.theme-toggle:hover { background: var(--surface-2); transform: translateY(-1px); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }


/* ==========================================================================
   7. SIDEBAR / DRAWER + OVERLAY
   ========================================================================== */
.sidebar {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--sp-5) var(--sp-3);
  overflow-y: auto;
  z-index: 90;
  transition: transform var(--t-slow);
}

.sidebar__title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 700;
  margin: var(--sp-4) var(--sp-3) var(--sp-2);
}
.sidebar__title:first-child { margin-top: 0; }

.sidebar a {
  display: block;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  margin-bottom: 2px;
}
.sidebar a:hover {
  background: var(--surface-2);
  color: var(--primary-600);
  text-decoration: none;
}
/* État actif (scrollspy) */
.sidebar a.is-active {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary-700);
  font-weight: 600;
}
[data-theme="dark"] .sidebar a.is-active { color: var(--primary); }

.sidebar hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-4) var(--sp-3);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  backdrop-filter: blur(2px);
  z-index: 80;
  animation: fade .2s ease;
}
.overlay.is-open { display: block; }


/* ==========================================================================
   8. CARTES (cards)
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.card--hover:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.card__title { margin-top: 0; }

/* Carte image (remplace les vieux encadrés w3-border) */
.figure-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.figure-card img { margin-inline: auto; }
.figure-card figcaption {
  margin-top: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
}


/* ==========================================================================
   9. BOUTONS & LIENS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t), transform var(--t), box-shadow var(--t), border-color var(--t);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-primary);
}
.btn--primary:hover { background: var(--primary-600); color: var(--on-primary); }

.btn--secondary {
  background: color-mix(in srgb, var(--secondary) 12%, var(--surface));
  color: var(--secondary);
  border-color: color-mix(in srgb, var(--secondary) 30%, transparent);
}
.btn--secondary:hover { background: color-mix(in srgb, var(--secondary) 20%, var(--surface)); }

.btn--ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn svg { width: 18px; height: 18px; }
.btn--block { display: flex; width: 100%; justify-content: center; }


/* ==========================================================================
   10. LISTES, TABLEAUX, BADGES
   ========================================================================== */
/* Listes enrichies (puces personnalisées) */
.list { list-style: none; padding: 0; }
.list > li {
  position: relative;
  padding-left: var(--sp-6);
  margin-bottom: var(--sp-2);
}
.list > li::before {
  content: "";
  position: absolute;
  left: 0; top: .55em;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
}
/* Listes imbriquées */
.list .list { margin-top: var(--sp-2); margin-bottom: 0; }
.list .list > li::before { background: var(--muted); }

/* Liste numérotée moderne */
.list-decimal {
  counter-reset: step;
  list-style: none;
  padding: 0;
}
.list-decimal > li {
  counter-increment: step;
  position: relative;
  padding-left: var(--sp-7);
  margin-bottom: var(--sp-3);
}
.list-decimal > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* Tableaux */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); }
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: var(--fs-sm);
}
.table th {
  background: var(--primary);
  color: var(--on-primary);
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-weight: 600;
  white-space: nowrap;
}
.table td {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table tbody tr:nth-child(even):hover { background: var(--surface-2); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px var(--sp-2);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary-700);
}
[data-theme="dark"] .badge { color: var(--primary); }
.badge--success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.badge--warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.badge--danger  { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }


/* ==========================================================================
   11. CALLOUTS (messages d'information)
   ========================================================================== */
.callout {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r);
  border: 1px solid var(--border);
  border-left-width: 4px;
  background: var(--surface);
  margin-bottom: var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.callout__icon { flex: none; margin-top: 2px; }
.callout__icon svg { width: 22px; height: 22px; }
.callout__body { flex: 1; }
.callout__body > :last-child { margin-bottom: 0; }
.callout__title { font-weight: 700; margin-bottom: var(--sp-1); }

.callout--info    { border-left-color: var(--primary); }
.callout--info    .callout__icon { color: var(--primary); }
.callout--warning { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 6%, var(--surface)); }
.callout--warning .callout__icon { color: var(--warning); }
.callout--success { border-left-color: var(--success); }
.callout--success .callout__icon { color: var(--success); }
.callout--danger  { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.callout--danger  .callout__icon { color: var(--danger); }


/* ==========================================================================
   12. FIGURES & MÉDIAS
   ========================================================================== */
figure { margin: 0 0 var(--sp-5); }
figure figcaption {
  text-align: center;
  margin-top: var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* Vidéo */
.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t);
}
.video-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.video-card video { width: 100%; display: block; background: #000; }
.video-card__body { padding: var(--sp-4) var(--sp-5); }
.video-card__body h3 { margin: 0 0 var(--sp-1); font-size: var(--fs-h4); color: var(--text); }
.video-card__body p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }

/* Audio stylé */
.audio-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: var(--sp-2) var(--sp-4);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-4);
}
.audio-bar audio { width: 100%; height: 40px; }


/* ==========================================================================
   13. CARDS DE TÉLÉCHARGEMENT
   ========================================================================== */
.dl-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), transform var(--t), border-color var(--t);
  height: 100%;
}
.dl-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}
.dl-card__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.dl-card__icon {
  flex: none;
  width: 44px; height: 44px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, transparent), color-mix(in srgb, var(--secondary) 14%, transparent));
  color: var(--primary-600);
}
[data-theme="dark"] .dl-card__icon { color: var(--primary); }
.dl-card__icon svg { width: 24px; height: 24px; }
.dl-card__title { font-weight: 600; color: var(--text); margin: 0; font-size: var(--fs-body); }
.dl-card__desc { color: var(--muted); font-size: var(--fs-sm); margin: 0; flex: 1; }
.dl-card__link { margin-top: auto; }


/* ==========================================================================
   14. FOOTER
   ========================================================================== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: var(--sp-9);
}
.footer__inner {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: var(--sp-7) var(--sp-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-5);
  align-items: center;
  justify-content: space-between;
}
.footer__brand { font-weight: 800; font-size: 1.1rem; color: var(--text); }
.footer__meta { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.footer a { color: var(--text-soft); }
.footer a:hover { color: var(--primary-600); }


/* ==========================================================================
   15. BOUTON RETOUR EN HAUT
   ========================================================================== */
.to-top {
  position: fixed;
  right: var(--sp-5);
  bottom: var(--sp-5);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  box-shadow: var(--shadow-primary);
  cursor: pointer;
  display: grid; place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--t), transform var(--t), background var(--t);
  z-index: 70;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--primary-600); }
.to-top svg { width: 22px; height: 22px; }


/* ==========================================================================
   16. UTILITAIRES
   ========================================================================== */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.stack > * + * { margin-top: var(--sp-4); }
.center-img { display: block; margin-inline: auto; }
.nowrap { white-space: nowrap; }

/* Hero (page d'accueil) */
.hero {
  background:
    radial-gradient(1200px 400px at 80% -10%, color-mix(in srgb, var(--secondary) 14%, transparent), transparent),
    radial-gradient(900px 400px at 0% 0%, color-mix(in srgb, var(--primary) 12%, transparent), transparent);
  border-bottom: 1px solid var(--border);
}
.hero__eyebrow {
  display: inline-block;
  padding: 4px var(--sp-3);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary-700);
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-bottom: var(--sp-3);
}
[data-theme="dark"] .hero__eyebrow { color: var(--primary); }
.hero__logos { display: flex; flex-wrap: wrap; gap: var(--sp-5); align-items: center; }
.hero__logos img { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-3); box-shadow: var(--shadow-sm); }


/* ==========================================================================
   17. RESPONSIVE
   ========================================================================== */
@media (max-width: 992px) {
  :root { --fs-h1: 1.7rem; --fs-h2: 1.4rem; }
  .grid-edit { grid-template-columns: 1fr; }
  /* Sidebar devient drawer */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    width: min(86vw, 320px);
  }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .nav-toggle { display: inline-flex; }
  .navbar__links { display: none; }       /* la navigation passe dans la sidebar */
}

@media (max-width: 600px) {
  :root { --fs-h1: 1.5rem; --fs-h2: 1.25rem; --sp-9: 40px; }
  .section { padding-block: var(--sp-8); }
  .container, .navbar__inner { padding-inline: var(--sp-4); }
  .card, .figure-card { padding: var(--sp-4); }
  .grid { grid-template-columns: 1fr; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
  .to-top { right: var(--sp-4); bottom: var(--sp-4); width: 44px; height: 44px; }
}


/* ==========================================================================
   18. ACCESSIBILITÉ
   ========================================================================== */
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 60%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Compensation de la navbar sticky pour les ancres */
:where(section, [id]) { scroll-margin-top: calc(var(--navbar-h) + var(--sp-3)); }

/* Lien d'évitement (clavier) */
.skip-link {
  position: absolute;
  left: var(--sp-3);
  top: -60px;
  background: var(--primary);
  color: var(--on-primary);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  z-index: 200;
  transition: top var(--t);
}
.skip-link:focus { top: var(--sp-3); color: var(--on-primary); }

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

/* Animation fade utilitaire */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Apparition douce du contenu principal */
.main { animation: rise .4s ease both; }
