/* ==========================================================================
   CHEL 2027 – thème sombre
   Activé par html[data-theme="dark"] (bouton lune/soleil de l'en-tête ; par défaut : réglage de l'appareil).
   Dans ce mode, --navy devient la couleur claire des titres ; les bandeaux bleu nuit utilisent --slab.
   ========================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1a1f;
  --bg-soft: #15252c;
  --surface: #172a32;
  --slab: #163843;
  --line: #2b4049;
  --text: #d9e4e8;
  --muted: #a3b6bd;
  --navy: #eef4f6;
  --navy-2: #1f5361;
  --teal-2: #5ccac5;
  --teal-50: #123332;
  --teal-100: #1b4644;
  --green-50: #1d2a13;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] body { background: var(--bg); color: var(--text); }
html[data-theme="dark"] a:hover { color: #fff; }

/* Surfaces blanches => surface sombre */
html[data-theme="dark"] :is(.site-header, .btn-outline, .submenu, .quick-link .ql-label, .team-card, .card-link, .finder-card, .dropdown ul,
  .tile .tile-ico, .tile:hover, .news-card, .job-item, .form-card, .dir-list a, .letters button, .mobile-bar, .page-parts, .svc-fig,
  .loc-badge, .fiche-plan, .team-group .ini, .px-check li, .px-cartes.fond-bordure .px-carte, .pay-hero-side, .pay-steps li, .pay-card-ico, .px-ess) {
  background-color: var(--surface);
}
html[data-theme="dark"] :is(.field input[type=text], .field input[type=email], .field input[type=tel], .field select, .field textarea, .header-search input:focus) {
  background-color: var(--bg-soft); color: var(--text); border-color: var(--line);
}
@media (max-width: 1000px) { html[data-theme="dark"] .main-nav { background: var(--surface); } }

/* Bandeaux bleu nuit => bleu nuit sombre (le bleu nuit d'origine sert aux textes clairs) */
html[data-theme="dark"] :is(.skip-link, .btn-navy, .alert-bar, .quick-links__title, .site-card, .dropdown.iam summary, .site-footer, .svc-hero,
  .pp-num.t2, .fiche-contact, .page-content.pratique .block-aside .info-card, .px-question, .px-ess.is-main, .px-horaires) {
  background-color: var(--slab); border-color: var(--slab);
}
html[data-theme="dark"] .site-card .pic { background-color: var(--slab); }
html[data-theme="dark"] .px-ess.is-main .px-ess-value, html[data-theme="dark"] .px-horaires h3 { color: #fff; }
html[data-theme="dark"] .fiche-navy { --tone: #4f7f8c; --tone-ink: #cfe0e5; --tone-soft: #1a2e35; }

/* Textes foncés sur fonds verts ou bleu ciel : on garde le bleu nuit d'origine */
html[data-theme="dark"] :is(.btn-green, .btn-green:hover, .news-card .pin, .social a:hover, .btn-svc.primary, .pp-num.t1, .pp-rdv, .loc-badge.bat,
  .fiche-green .fiche-num, .pay-cta, .cp-step.bat) {
  color: #1f3742 !important;
}
html[data-theme="dark"] .pay-cta svg { color: #1f3742; }

/* Logo (texte bleu nuit) : posé sur une pastille claire */
html[data-theme="dark"] .site-header .logo img { background: #fff; border-radius: 10px; padding: 4px 8px; box-sizing: content-box; }

/* Gris codés en dur dans les feuilles de style */
html[data-theme="dark"] :is(.page-parts li a, .px-lead, .px-hero .svc-crumbs a, .fiche-team-head p, .svc-fig span) { color: var(--muted); }
html[data-theme="dark"] :is(.page-parts li a:hover, .page-parts li a[aria-current="true"]) { color: var(--navy); background-color: transparent; }
html[data-theme="dark"] .page-parts li a:hover { background-color: var(--bg-soft); }
html[data-theme="dark"] .px-hero-ico { background: var(--teal-2); color: #0e1a1f; }

/* Blocs des pages pratiques */
html[data-theme="dark"] :is(.px-essentiel, .px-check, .px-cartes-wrap, .px-horaires, .px-apporter, .px-legende, .px-savoir) { --px-muted: var(--muted); --px-soft: var(--bg-soft); --px-line: var(--line); }
html[data-theme="dark"] .px-apporter-col.oui { background: #1d2a13; border-color: #3a4f23; }
html[data-theme="dark"] .px-apporter-col.non { background: #2b161b; border-color: #5a2d36; }
html[data-theme="dark"] .px-savoir { background: #2b2413; border-color: #5c4a1e; }
html[data-theme="dark"] .px-savoir.is-info { background: var(--teal-50); border-color: #22504e; }
html[data-theme="dark"] .px-box { border-color: var(--teal-2); color: var(--teal-2); }

/* Page Payer */
html[data-theme="dark"] .chel-pay { --p-navy: #163843; --p-line: var(--line); --p-muted: var(--muted); --p-teal-50: var(--teal-50); --p-green-50: var(--green-50); }
html[data-theme="dark"] .chel-pay :is(.pay-h2, .pay-steps h3, .pay-card h3, .pay-hero-side h3) { color: var(--navy); }
html[data-theme="dark"] .pay-hero-side { color: var(--text); }
html[data-theme="dark"] .pay-card { background: var(--bg-soft); }
html[data-theme="dark"] .pay-num { box-shadow: 0 0 0 4px var(--surface); }
html[data-theme="dark"] .pay-help { background: var(--teal-50); }

/* Plan d'accès : reste une carte claire, plus lisible */
html[data-theme="dark"] .chel-plan { color-scheme: light; background: #f7f9f6; color: #1f3742; border-radius: 16px; padding: 16px; }

/* Contenus divers */
html[data-theme="dark"] .rich :is(table, td, th) { border-color: var(--line); }
html[data-theme="dark"] .rich th { background: var(--bg-soft); }
html[data-theme="dark"] .rich blockquote { border-color: var(--teal); color: var(--text); }

/* Bouton clair / sombre */
.theme-toggle { flex: none; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--navy); display: grid; place-items: center; cursor: pointer; padding: 0; margin-left: 6px; transition: background .15s, border-color .15s; }
.theme-toggle:hover { border-color: var(--teal); }
.theme-toggle:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .ico-sun { display: none; }
html[data-theme="dark"] .theme-toggle .ico-sun { display: block; color: #f2c94c; }
html[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
@media (max-width: 1000px) { .theme-toggle { margin-left: auto; margin-right: 6px; } }
@media print { html[data-theme="dark"] { --bg: #fff; --text: #24343b; --navy: #1f3742; } .theme-toggle { display: none; } }
html[data-theme="dark"] .loc-badge.park { background-color: #15aff7; border-color: #15aff7; color: #fff; }
html[data-theme="dark"] .loc-badge.bat { background-color: var(--green); border-color: var(--green); }
html[data-theme="dark"] .tag.navy { background: #2a414b; color: var(--navy); }
html[data-theme="dark"] .tag.green { color: #c3d76b; }
