/* =========================================================
   TERRA NOVA — Mode clair « aube martienne » (le mode sombre reste le thème d'origine)
   Activé par html[data-theme="light"] (bouton soleil/lune de l'en-tête, public/terra/theme.js).
   Seules les couleurs changent : mise en page, découpes, effets et animations sont identiques.
   Les « écrans » (carte 3D du réseau, cartes de secteurs, bandeau à image) restent volontairement sombres.
   ========================================================= */

/* Transition douce uniquement pendant le changement de thème (n'affecte pas les animations) */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color .45s ease, color .45s ease, border-color .45s ease, fill .45s ease, stroke .45s ease !important }

/* ---------- Bouton de bascule ---------- */
.theme-tg { position: relative }
.theme-tg::before { content: ""; width: 1.15rem; height: 1.15rem; background: currentColor; -webkit-mask: var(--ti) center/contain no-repeat; mask: var(--ti) center/contain no-repeat; transition: transform .5s var(--e) }
.theme-tg { --ti: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4.2'/%3E%3Cpath d='M12 2.5v2.2M12 19.3v2.2M4.6 4.6l1.6 1.6M17.8 17.8l1.6 1.6M2.5 12h2.2M19.3 12h2.2M4.6 19.4l1.6-1.6M17.8 6.2l1.6-1.6'/%3E%3C/svg%3E") }
html[data-theme=light] .theme-tg { --ti: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 14.2A8.5 8.5 0 0 1 9.8 3.5a8.5 8.5 0 1 0 10.7 10.7z'/%3E%3C/svg%3E") }
.theme-tg:hover::before { transform: rotate(30deg) }
.theme-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem }

/* =========================================================
   Palette claire
   ========================================================= */
html[data-theme=light] {
   color-scheme: light;
   --void: #efe9e2;
   --panel: rgba(255, 252, 248, .9);
   --panel2: rgba(255, 251, 246, .97);
   --neon: #c00f55;
   --mars: #c4470f;
   --ember: #985207;
   --cyan: #086891;
   --ok: #0a6f48;
   --warn: #8a5000;
   --crit: #b81a37;
   --ink: #1d1b2c;
   --mute: #535569;
   --line: rgba(29, 27, 44, .14);
   --ink-soft: rgba(29, 27, 44, .05);
   background: radial-gradient(110% 70% at 85% 0%, #f8d8cc 0%, #f1e9e1 45%, #ece6df 80%) fixed, #ece6df
}
html[data-theme=light] ::selection { background: rgba(209, 19, 90, .2) }

/* Fonds techniques (étoiles des pages internes : points sombres discrets) */
html[data-theme=light] body:not(.home) > canvas.deco { filter: invert(1) opacity(.35) }

/* En-tête, menu, pied de page */
html[data-theme=light] :is(.top.s, .inner .top) { background: rgba(248, 244, 239, .9); box-shadow: 0 1px 0 var(--line), 0 10px 30px -20px rgba(60, 30, 40, .35) }
html[data-theme=light] .nav, html[data-theme=light].fs-l .nav { background: rgba(248, 244, 239, .98) }
@media (min-width:72.01em) { html[data-theme=light]:not(.fs-l) .nav { background: none } }
html[data-theme=light] .foot { background: rgba(255, 252, 248, .75) }
html[data-theme=light] :is(.tool, .pop .opt, .chip, .radios label, .profile, .checklist li, .preview, .quote, .do li, .zone, .lang-b, .rdv-svc, .day, .slot, .rdv-card, .lock--soft, .pl-ico, .az a, .listen) { background: var(--ink-soft) }
html[data-theme=light] :is(.rdv-svc, .day, .slot):hover { background: rgba(29, 27, 44, .08) }
html[data-theme=light] .jr-e[open] { background: rgba(29, 27, 44, .03) }

/* Cartes et panneaux : légère ombre portée pour garder le relief sur fond clair */
html[data-theme=light] :is(.panel, .card, .svc, .q, .top-card, .kpi-btn, .pl-row, .lx-item, .toast) { box-shadow: inset 0 0 0 1px var(--line), 0 12px 30px -22px rgba(70, 30, 45, .45) }
html[data-theme=light] a.card:hover, html[data-theme=light] .card:focus-within, html[data-theme=light] .svc:hover, html[data-theme=light] .svc[open] { box-shadow: inset 0 0 0 1px rgba(209, 19, 90, .5), 0 26px 50px -26px rgba(209, 19, 90, .45) }

/* Textes blancs posés sur fond neutre → encre */
html[data-theme=light] :is(.kpi b, .tabs button[aria-selected=true], .chip[aria-pressed=true], .regsteps li.on, .ws-strip b, .xp, .load-n b, .load-facts b, .st-when b, .nd-n, .then b, .day b, .rdv-when-big, dialog.crit h2, .jr-s b, .term:hover, .term[aria-expanded=true], .ws-load, kbd, .ref) { color: var(--ink) }
html[data-theme=light] .hero h1 { text-shadow: 0 0 30px rgba(209, 19, 90, .12) }
html[data-theme=light] .chip[aria-pressed=true] { background: rgba(209, 19, 90, .12) }
html[data-theme=light] .ref { background: rgba(255, 252, 248, .9) }
html[data-theme=light] kbd { background: #fffdfa; box-shadow: inset 0 -2px 0 rgba(29, 27, 44, .25), inset 0 0 0 1px var(--line) }
html[data-theme=light] .dlg-x:hover { background: var(--ink) }
html[data-theme=light] .load-n b, html[data-theme=light] .nd-n { text-shadow: none }

/* Formulaires */
html[data-theme=light] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea) { background-color: #fffdfa; box-shadow: inset 0 0 0 1px rgba(29, 27, 44, .25) }
html[data-theme=light] :is(input, select, textarea):focus { box-shadow: inset 0 0 0 2px var(--cyan) }
html[data-theme=light] .file { border-color: rgba(29, 27, 44, .3) }
html[data-theme=light] .sw input { background: rgba(29, 27, 44, .2) }
html[data-theme=light] .sw input::before { box-shadow: 0 1px 3px rgba(0, 0, 0, .3) }

/* Boutons secondaires */
html[data-theme=light] .btn--ghost { color: var(--ink); background: rgba(255, 252, 248, .7); box-shadow: inset 0 0 0 1px rgba(29, 27, 44, .3) }
html[data-theme=light] .intent a { background: rgba(255, 252, 248, .78) }
html[data-theme=light] :is(.sector, .cta) .btn--ghost { color: #fff; background: rgba(8, 9, 18, .55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35) }

/* Pistes, barres et jauges */
html[data-theme=light] :is(.steps li::after, .next-steps li::after, .dots i, .meter, .bt, .pct, .gauge i, .strength i) { background: rgba(29, 27, 44, .12) }
html[data-theme=light] :is(.steps li::before, .next-steps li::before, .ck) { box-shadow: inset 0 0 0 2px rgba(29, 27, 44, .3) }
html[data-theme=light] :is(.regsteps li) { box-shadow: inset 0 -2px 0 rgba(29, 27, 44, .14) }
html[data-theme=light] .regsteps li.on { box-shadow: inset 0 -2px 0 var(--neon) }
html[data-theme=light] .tl { border-color: rgba(29, 27, 44, .14) }
html[data-theme=light] .no { color: rgba(29, 27, 44, .3) }

/* Couleurs d'état lisibles sur fond clair */
html[data-theme=light] .badge { background: rgba(10, 115, 160, .08) }
html[data-theme=light] .b-nouvelle { color: #b0124f; background: rgba(209, 19, 90, .08) }
html[data-theme=light] .b-en_cours { color: #8a4b00; background: rgba(176, 96, 12, .1) }
html[data-theme=light] .b-attente { color: #5d35b0; background: rgba(93, 53, 176, .08); box-shadow: inset 0 0 0 1px rgba(93, 53, 176, .45) }
html[data-theme=light] .b-resolue { color: #0b6b46; background: rgba(11, 127, 83, .08) }
html[data-theme=light] :is(.err, .err-sum a, .is-closed, .stops li.bad, .jr-ch del, .urgent .h3, .urg-call .h3, .danger .sub, .deny .eyebrow, .al-vul .sub, .st-down .st-h) { color: #b3142f }
html[data-theme=light] .st-h { color: #8a4b00 } html[data-theme=light] .st-planned .st-h { color: var(--cyan) }
html[data-theme=light] :is(.f-attente .fd, .src[data-mode=demo] .src-dot) { background: #5d35b0; color: #5d35b0 }
html[data-theme=light] :is(.src[data-mode=demo], .jr-e.cat-comptes .jr-cat) { color: #5d35b0 }
html[data-theme=light] .is-open { color: var(--ok) }
html[data-theme=light] .alert { box-shadow: inset 4px 0 0 var(--crit), inset 0 0 0 1px rgba(196, 29, 59, .35), 0 12px 30px -22px rgba(70, 30, 45, .45) }
html[data-theme=light] .alert[data-level=warn] { box-shadow: inset 4px 0 0 var(--warn), inset 0 0 0 1px rgba(156, 90, 0, .35), 0 12px 30px -22px rgba(70, 30, 45, .45) }
html[data-theme=light] .alert[data-level=info] { box-shadow: inset 4px 0 0 var(--cyan), inset 0 0 0 1px rgba(10, 115, 160, .35), 0 12px 30px -22px rgba(70, 30, 45, .45) }

/* Plan de la ville : carte claire */
html[data-theme=light] .pl-map { background: radial-gradient(circle at 50% 50%, rgba(217, 83, 26, .12), transparent 70%), #f6f0e9 }
html[data-theme=light] .pl-canvas .sec circle { fill: rgba(29, 27, 44, .04); stroke: rgba(29, 27, 44, .3) }
html[data-theme=light] .pl-canvas .sec.me circle { fill: rgba(176, 96, 12, .14) }
html[data-theme=light] .pl-canvas .links line { stroke: rgba(10, 115, 160, .45) }
html[data-theme=light] .pl-canvas .sec.me text { fill: var(--ink) }
html[data-theme=light] .pl-pin { box-shadow: 0 0 0 3px rgba(255, 252, 248, .95), 0 6px 14px rgba(70, 30, 45, .35) }
html[data-theme=light] .pl-pin[aria-pressed=true] { box-shadow: 0 0 0 3px var(--ink), 0 0 18px rgba(29, 27, 44, .4) }

/* Focus clavier : contour contrasté sur fond clair */
html[data-theme=light] :is(.btn, .chip, .q, .top-card, .profile, .rdv-svc, .day, .slot, .card, .kpi-btn, .lang-b, .sector, .ann, .pl-row, .pl-pin, .term, .listen, .skip):focus-visible { outline-color: var(--ink) !important }

/* Les « écrans » restent sombres : textes clairs conservés */
html[data-theme=light] :is(.sector, .cta, #reseau canvas, dialog::backdrop) { color-scheme: dark }

/* Contraste élevé : il garde la priorité (fond noir, textes blancs) quel que soit le thème */
html.hc[data-theme=light] { --panel: #000; --panel2: #000; --ink: #fff; --mute: #e8e8f2; --line: rgba(255, 255, 255, .55); --neon: #ff6fa6; --cyan: #7fe6ff; --ok: #4dffb0; --warn: #ffb15c; --crit: #ff3b5c; color-scheme: dark; background: #000 }
html.hc[data-theme=light] :is(input, select, textarea, .btn--ghost, kbd, .ref) { background: #000 !important; color: #fff !important }
html.hc[data-theme=light] :is(.kpi b, .nd-n, .day b, .rdv-when-big, .xp, .load-n b) { color: #fff }
