/* ===========================================================================
   MODE NUIT
   Le site est dessine pour le jour : fond blanc, texte charbon. En mode nuit,
   les variables de la maquette changent de valeur, et les surfaces qui portaient
   un blanc ecrit en dur sont reprises une a une. Les blocs deja sombres — pied
   de page, bandeau d urgence, section « engagement », appel a l action — ne
   bougent pas : ils font deja partie du dessin.
   =========================================================================== */

:root[data-theme='nuit'] {
  --ink: #e9eff5;
  --muted: #9db2c4;
  --line: #1d3247;
  --pale: #0d2031;
  --white: #102639;
  --navy: #58a9ee;
  --green: #4cb545;
  --deep-green: #4cb545;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ fonds */
:root[data-theme='nuit'] body { background: #08192a; color: var(--ink); }

:root[data-theme='nuit'] header { background: #0b1f33f2; border-bottom-color: var(--line); }
:root[data-theme='nuit'] .m-nav nav a { color: var(--ink); }
:root[data-theme='nuit'] .m-menu-toggle { border-color: var(--line); background: var(--white); color: var(--ink); }

/* ------------------------------------------------------------------ surfaces claires */
:root[data-theme='nuit'] .m-hero-light,
:root[data-theme='nuit'] .m-page-banner:not(.m-page-banner--nuit) {
  background:
    radial-gradient(1100px 380px at 12% -40%, rgba(88, 169, 238, 0.14), transparent 62%),
    linear-gradient(180deg, #0b1f33, #08192a);
  border-bottom-color: var(--line);
}
:root[data-theme='nuit'] .m-ariane { background: #0b1f33; border-bottom-color: var(--line); }

:root[data-theme='nuit'] .m-section { background: transparent; }
:root[data-theme='nuit'] .m-services,
:root[data-theme='nuit'] .m-process,
:root[data-theme='nuit'] .m-faq,
:root[data-theme='nuit'] .m-contact,
:root[data-theme='nuit'] .m-reviews { background: #08192a; }

/* cartes et encadres : tout ce qui etait blanc passe en bleu nuit clair */
:root[data-theme='nuit'] .m-service-card,
:root[data-theme='nuit'] .m-marks > div,
:root[data-theme='nuit'] .m-steps > div,
:root[data-theme='nuit'] .m-zone-cards article,
:root[data-theme='nuit'] .m-avis-carte,
:root[data-theme='nuit'] .m-table,
:root[data-theme='nuit'] .m-pills a,
:root[data-theme='nuit'] .m-prose-aside > div,
:root[data-theme='nuit'] .m-prose-aside > nav,
:root[data-theme='nuit'] .m-devis-garanties-grille > div,
:root[data-theme='nuit'] .m-faq-list details,
:root[data-theme='nuit'] .m-review-card,
:root[data-theme='nuit'] #quote-form,
:root[data-theme='nuit'] .m-footer-availability {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme='nuit'] .m-table thead th { background: #0b1f33; color: var(--muted); }
:root[data-theme='nuit'] .m-table th,
:root[data-theme='nuit'] .m-table td { border-bottom-color: var(--line); }
:root[data-theme='nuit'] .m-table tbody th { color: var(--ink); }

/* ------------------------------------------------------------------ textes */
:root[data-theme='nuit'] h1,
:root[data-theme='nuit'] h2,
:root[data-theme='nuit'] h3,
:root[data-theme='nuit'] .m-prose-body strong,
:root[data-theme='nuit'] .m-marks strong,
:root[data-theme='nuit'] .m-steps h3,
:root[data-theme='nuit'] .m-zone-cards h3,
:root[data-theme='nuit'] .m-avis-carte footer strong { color: var(--ink); }

:root[data-theme='nuit'] .m-prose-body p,
:root[data-theme='nuit'] .m-prose-body li,
:root[data-theme='nuit'] .m-marks p,
:root[data-theme='nuit'] .m-steps p,
:root[data-theme='nuit'] .m-zone-cards p,
:root[data-theme='nuit'] .m-avis-carte p,
:root[data-theme='nuit'] .m-section-heading p,
:root[data-theme='nuit'] .m-page-banner .m-hero-description,
:root[data-theme='nuit'] .m-hero-description { color: var(--muted); }

:root[data-theme='nuit'] .m-page-banner h1 em,
:root[data-theme='nuit'] .m-prose-body h2 em,
:root[data-theme='nuit'] .m-section-heading h2 em { color: var(--navy); }

:root[data-theme='nuit'] .m-prose-body a,
:root[data-theme='nuit'] .m-text-link,
:root[data-theme='nuit'] .m-ariane a { color: var(--navy); }

:root[data-theme='nuit'] .m-step-number { color: #17304a; }
:root[data-theme='nuit'] .m-step-note { background: #12304a; color: #7ad274; }

/* ------------------------------------------------------------------ boutons et champs */
:root[data-theme='nuit'] .m-button.m-outline,
:root[data-theme='nuit'] .m-page-banner:not(.m-page-banner--nuit) .m-hero-actions .m-outline {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}
:root[data-theme='nuit'] .m-page-banner:not(.m-page-banner--nuit) .m-hero-actions .m-outline:hover {
  background: #16324c;
  border-color: var(--navy);
}

:root[data-theme='nuit'] input,
:root[data-theme='nuit'] select,
:root[data-theme='nuit'] textarea {
  background: #0b1f33;
  border-color: var(--line);
  color: var(--ink);
}
:root[data-theme='nuit'] input::placeholder,
:root[data-theme='nuit'] textarea::placeholder { color: #6b8299; }

/* ------------------------------------------------------------------ popin et bandeau cookies */
:root[data-theme='nuit'] dialog { background: var(--white); color: var(--ink); border-color: var(--line); }
:root[data-theme='nuit'] .bandeau-cookies,
:root[data-theme='nuit'] .cookies-fenetre {
  background: var(--white);
  color: var(--ink);
  border-color: var(--line);
}

/* ------------------------------------------------------------------ interrupteur jour / nuit */
/* Les deux symboles restent visibles : le curseur indique le mode en cours,
   et l on voit d un coup d oeil ou l on va en cliquant. */
.cps-theme {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  /* 4 px collaient l interrupteur au bouton d appel : il lui faut sa propre
     respiration pour qu on le lise comme un reglage, pas comme une icone du
     bouton voisin */
  margin-right: 18px;
}
.cps-theme__piste {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 62px;
  height: 32px;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--pale);
  transition: background 220ms, border-color 220ms;
}
.cps-theme__symbole {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: 28px;
  color: var(--muted);
  transition: color 220ms;
}
.cps-theme__symbole svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cps-theme__curseur {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 0;
  width: 28px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(16, 43, 67, 0.18);
  transition: translate 240ms cubic-bezier(0.22, 0.8, 0.28, 1), background 220ms;
}
/* en mode jour, le curseur couvre le soleil */
.cps-theme .cps-theme__symbole--jour { color: var(--navy); }

/* en mode nuit, il glisse sur la lune */
:root[data-theme='nuit'] .cps-theme__piste { background: #0b1f33; border-color: var(--line); }
:root[data-theme='nuit'] .cps-theme__curseur { translate: 28px 0; background: #1d3a56; }
:root[data-theme='nuit'] .cps-theme__symbole--jour { color: #5c718a; }
:root[data-theme='nuit'] .cps-theme__symbole--nuit { color: #ffd479; }

.cps-theme:hover .cps-theme__piste { border-color: var(--navy); }
.cps-theme:focus-visible { outline: 3px solid #458db4; outline-offset: 4px; border-radius: 999px; }

@media (max-width: 1000px) {
  .cps-theme__piste { width: 56px; height: 30px; }
  .cps-theme__curseur { width: 25px; height: 24px; }
  :root[data-theme='nuit'] .cps-theme__curseur { translate: 25px 0; }
}

/* ------------------------------------------------------------------ logo */
/* le logo du jour porte un nom en charbon, illisible sur fond bleu nuit :
   c est la version claire, déjà utilisée dans le pied, qui prend sa place. */
:root[data-theme='nuit'] .cps-logo { content: url('/assets/img/logo-cps-nuit.svg'); }
:root[data-theme='nuit'] .m-brand-name { color: var(--ink); }
:root[data-theme='nuit'] .m-brand-name small { color: #8fa8bd; }

/* ------------------------------------------------------------------ menu déroulant */
:root[data-theme='nuit'] .cps-panneau {
  background: var(--white);
  border-color: var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
:root[data-theme='nuit'] .cps-entree { color: var(--ink); }
:root[data-theme='nuit'] .cps-entree:hover { background: #16324c; }
:root[data-theme='nuit'] .cps-entree > span:last-child > span { color: var(--muted); }
:root[data-theme='nuit'] .cps-entree > .cps-entree__code { background: #16324c; color: #7fc4ff; }
:root[data-theme='nuit'] .cps-panneau__pied { border-top-color: var(--line); }
:root[data-theme='nuit'] .cps-panneau__pied span { color: var(--muted); }

/* ------------------------------------------------------------------ avis et popins */
:root[data-theme='nuit'] .m-reviews-toolbar select,
:root[data-theme='nuit'] .m-reviews-arrows button {
  background: var(--white);
  border-color: var(--line);
  color: var(--ink);
}
:root[data-theme='nuit'] .m-review-quote-mark { color: #1c3550; }
:root[data-theme='nuit'] .m-avis-bandeau { background: #2a2113; border-color: #5a4520; }
:root[data-theme='nuit'] .m-avis-bandeau p { color: #d6c39a; }
:root[data-theme='nuit'] .m-avis-bandeau strong { color: #f0dcae; }

/* ------------------------------------------------------------------ section « engagement » */
/* claire dans la maquette : elle bascule aussi en bleu nuit */
:root[data-theme='nuit'] .m-commitments { background: #0b1f33; }
:root[data-theme='nuit'] .m-commitment-cards > div { background: var(--white); border-color: var(--line); }
:root[data-theme='nuit'] .m-commitment-cards strong { color: var(--ink); }
:root[data-theme='nuit'] .m-commitment-cards p { color: var(--muted); }
:root[data-theme='nuit'] .m-commitment-cards svg { color: #7fc4ff; }
:root[data-theme='nuit'] .m-commitment-list strong { color: var(--ink); }
:root[data-theme='nuit'] .m-commitment-list span { color: var(--muted); }
:root[data-theme='nuit'] .m-emergency { background: #061321; }
