/* Les 5 ambiances + « Ma couleur ».
   Chaque thème ne fixe que des variables ; les halos et le reste les utilisent. */

:root,
[data-theme='montagne'] {
  --base: linear-gradient(180deg, #0a0620 0%, #170c3a 45%, #3b1c6e 100%);
  --base-mid: #170c3a;
  --accent: #8b5cf6;
  --halo-1: rgba(167, 139, 250, 0.4);
  --halo-2: rgba(90, 60, 200, 0.4);
  --halo-3: rgba(236, 120, 200, 0.22);
}

[data-theme='aurore'] {
  --base: #04050b;
  --base-mid: #0b0f24;
  --accent: #3b82f6;
  --halo-1: rgba(40, 90, 255, 0.55);
  --halo-2: rgba(230, 100, 30, 0.5);
  --halo-3: rgba(110, 60, 220, 0.35);
}

[data-theme='foret'] {
  --base: #031412;
  --base-mid: #072621;
  --accent: #14b8a6;
  --halo-1: rgba(20, 200, 160, 0.42);
  --halo-2: rgba(80, 220, 120, 0.3);
  --halo-3: rgba(40, 120, 220, 0.32);
}

[data-theme='coucher'] {
  --base: #12061a;
  --base-mid: #1e0b28;
  --accent: #f0568a;
  --halo-1: rgba(255, 90, 140, 0.45);
  --halo-2: rgba(255, 150, 60, 0.4);
  --halo-3: rgba(120, 60, 220, 0.4);
}

[data-theme='cyan'] {
  --base: linear-gradient(180deg, #04121f 0%, #06243a 55%, #0a3a57 100%);
  --base-mid: #06243a;
  --accent: #22d3ee;
  --halo-1: rgba(34, 211, 238, 0.42);
  --halo-2: rgba(125, 211, 252, 0.34);
  --halo-3: rgba(56, 130, 246, 0.34);
}

/* Ma couleur : --c-base et --c-accent sont posées par boot.js depuis les réglages. */
[data-theme='custom'] {
  --base: linear-gradient(
    180deg,
    var(--c-base) 0%,
    color-mix(in oklab, var(--c-base), var(--c-accent) 22%) 100%
  );
  --base-mid: var(--c-base);
  --accent: var(--c-accent);
  --halo-1: color-mix(in srgb, var(--c-accent) 45%, transparent);
  --halo-2: color-mix(in srgb, color-mix(in oklab, var(--c-accent), white 30%) 32%, transparent);
  --halo-3: color-mix(in srgb, color-mix(in oklab, var(--c-accent), var(--c-base) 45%) 40%, transparent);
}

/* ---------- Halos qui dérivent lentement ----------
   On anime uniquement « transform » : la carte graphique déplace des images déjà
   dessinées, sans recalcul de flou. Léger pour Lively. */
#bg-halos { overflow: hidden; }
.halo {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.halo-1 {
  width: 58vmax;
  height: 58vmax;
  right: -14vmax;
  top: -12vmax;
  background: radial-gradient(circle, var(--halo-1), transparent 65%);
  animation: drift1 28s ease-in-out infinite alternate;
}
.halo-2 {
  width: 52vmax;
  height: 52vmax;
  left: -16vmax;
  top: 38vh;
  background: radial-gradient(circle, var(--halo-2), transparent 65%);
  animation: drift2 34s ease-in-out infinite alternate;
}
.halo-3 {
  width: 48vmax;
  height: 48vmax;
  left: 32%;
  bottom: -24vmax;
  background: radial-gradient(circle, var(--halo-3), transparent 65%);
  animation: drift3 40s ease-in-out infinite alternate;
}

@keyframes drift1 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4vmax, -3vmax, 0) scale(1.1); }
}
@keyframes drift2 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-4.5vmax, 2.5vmax, 0) scale(1.06); }
}
@keyframes drift3 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(3vmax, 4vmax, 0) scale(0.94); }
}

/* Montagnes : seulement pour l'ambiance Montagne */
.mountains {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 38vh;
}
[data-theme='montagne'] .mountains { display: block; }

/* Halos désactivés (réglage pour l'image de fond, à venir) */
.no-halos #bg-halos { display: none; }

/* Réduire les animations : réglage du système OU interrupteur dans Réglages */
.reduce-motion .halo { animation: none; }
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after { transition-duration: 0s !important; }

@media (prefers-reduced-motion: reduce) {
  .halo { animation: none; }
  *,
  *::before,
  *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
