/* Mode sombre : on ne redéfinit que les variables + quelques exceptions.
   Activation : html[data-theme="dark"] (choix mémorisé) ou, sans choix, la préférence du système. */
:root{color-scheme:light}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
  color-scheme:dark;
    --white:#0e1522; --bg:#121b2b; --surface:#192438;
    --text:#d5dcea; --ink:#eef2f9; --muted:#9fabc0; --line:#2b3a54;
    --blue-100:#233450; --blue-50:#18243a;
    --head:#dfe8ff; --blue-text:#8fb6ff; --focus:#8fb6ff; --field-border:#3d4f6e;
    --shadow-card:0 10px 30px rgba(0,0,0,.45); --shadow-soft:0 4px 16px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --white:#0e1522; --bg:#121b2b; --surface:#192438;
  --text:#d5dcea; --ink:#eef2f9; --muted:#9fabc0; --line:#2b3a54;
  --blue-100:#233450; --blue-50:#18243a;
  --head:#dfe8ff; --blue-text:#8fb6ff; --focus:#8fb6ff; --field-border:#3d4f6e;
  --shadow-card:0 10px 30px rgba(0,0,0,.45); --shadow-soft:0 4px 16px rgba(0,0,0,.5);
}
:root[data-theme="light"]{color-scheme:light}

/* Exceptions du mode sombre (écrites deux fois : préférence système et choix manuel) */
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .btn--light:hover{background:#dbe6ff;border-color:#dbe6ff}
  :root:not([data-theme="light"]) .photo-frame img,:root:not([data-theme="light"]) .card img{filter:brightness(.92)}
  :root:not([data-theme="light"]) .form-status--ok,:root:not([data-theme="light"]) .modal__box{background:#12372a;color:#bff0d1}
  :root:not([data-theme="light"]) .form-status--error,:root:not([data-theme="light"]) .modal--error .modal__box{background:#441a1a;color:#ffc9c9}
  :root:not([data-theme="light"]) .field__error{color:#ff9d96}
}
:root[data-theme="dark"] .btn--light:hover{background:#dbe6ff;border-color:#dbe6ff}
:root[data-theme="dark"] .photo-frame img,:root[data-theme="dark"] .card img{filter:brightness(.92)}
:root[data-theme="dark"] .form-status--ok,:root[data-theme="dark"] .modal__box{background:#12372a;color:#bff0d1}
:root[data-theme="dark"] .form-status--error,:root[data-theme="dark"] .modal--error .modal__box{background:#441a1a;color:#ffc9c9}
:root[data-theme="dark"] .field__error{color:#ff9d96}

/* Bouton clair/sombre : languette fixe sur le bord droit (ordinateur), pastille en bas à droite (mobile) */
.theme-toggle{position:fixed;z-index:85;right:0;top:42%;display:flex;flex-direction:column;align-items:center;gap:.35rem;
  width:2.75rem;padding:.7rem 0;border:1px solid var(--line);border-right:0;border-radius:14px 0 0 14px;
  background:var(--surface);color:var(--blue-text);box-shadow:var(--shadow-soft);cursor:pointer;font:inherit;
  transition:transform .25s ease,box-shadow .25s ease,background-color .25s ease}
.theme-toggle:hover{transform:translateX(-4px);box-shadow:var(--shadow-card)}
.theme-toggle .icon{width:1.35rem;height:1.35rem}
.theme-toggle__moon{display:inline-flex} .theme-toggle__sun{display:none}
:root[data-theme="dark"] .theme-toggle__moon{display:none} :root[data-theme="dark"] .theme-toggle__sun{display:inline-flex}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .theme-toggle__moon{display:none}
  :root:not([data-theme="light"]) .theme-toggle__sun{display:inline-flex}
}
html:not(.js) .theme-toggle{display:none}
@media (max-width:56em){
  .theme-toggle{top:auto;bottom:1rem;right:1rem;width:3rem;height:3rem;padding:0;justify-content:center;border:1px solid var(--line);border-radius:50%}
  .theme-toggle:hover{transform:none}
}
/* Transition douce lors du changement de thème (désactivée si l'animation est réduite) */
@media (prefers-reduced-motion:no-preference){
  html.theme-anim body,html.theme-anim .card,html.theme-anim .tile,html.theme-anim .panel,html.theme-anim .site-header,html.theme-anim .section--tint{transition:background-color .35s ease,color .35s ease}
}
