@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap");

:root {
  --bg-color: #050505;
  --card-bg: rgba(10, 10, 12, 0.98);
  --accent: #e10606;
  --text-primary: #f0f0f0;
  --text-secondary: #aaa;
  --border-color: #4a0000;
  --glow: 0 0 15px rgba(225, 6, 6, 0.8);
  --font-st: "Bebas Neue", "Impact", sans-serif;
}

body.light-theme {
  --bg-color: #f4ecd8;
  --card-bg: #fff;
  --accent: #1e5ba0;
  --text-primary: #222;
  --text-secondary: #555;
  --border-color: #d3c4a1;
  --glow: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  padding: 20px;
  overflow-x: hidden;
  transition: background 0.5s ease;
}

/* --- LE H1 --- */
header h1 {
  font-family: var(--font-st);
  font-size: clamp(2rem, 8vw, 4rem);
  color: var(--accent);
  text-align: center;
  text-transform: uppercase;
  text-shadow: var(--glow);
  margin: 40px 0;
  letter-spacing: 4px;
}

/* --- L'ÉCLAIR ROUGE (UPSIDE DOWN) --- */
body:not(.light-theme)::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--accent);
  opacity: 0;
  pointer-events: none; /* Pour pouvoir cliquer à travers */
  z-index: 1500; /* Devant les sections, derrière le bouton */
  animation: lightning-strike 7s infinite;
}

@keyframes lightning-strike {
  0%,
  92%,
  100% {
    opacity: 0;
  }
  93% {
    opacity: 0.2;
  } /* Premier flash */
  94% {
    opacity: 0.05;
  }
  95% {
    opacity: 0.4;
  } /* Deuxième flash plus fort */
  97% {
    opacity: 0;
  }
}

/* --- LES CENDRES INFINIES --- */
body:not(.light-theme)::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9000;
  /* Trois couches de particules pour la profondeur */
  background-image:
    radial-gradient(circle, #853333 1.5px, transparent 1.5px),
    radial-gradient(circle, #fff 2px, transparent 2px),
    radial-gradient(circle, rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size:
    300px 300px,
    200px 200px,
    150px 150px;
  /* On monte l'opacité à 0.4 pour que ce soit bien visible */
  opacity: 0.1;
  animation: snow-infinite 15s linear infinite;
}

@keyframes snow-infinite {
  0% {
    background-position:
      0 0,
      0 0,
      0 0;
  }
  100% {
    background-position:
      50px 1000px,
      -50px 1000px,
      20px 1000px;
  }
}

/* --- BANDEAU ARTISTE --- */
.artist-header {
  display: flex;
  align-items: center;
  gap: 30px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

.artist-header img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: var(--glow);
  object-fit: cover;
  transition: all 0.4s ease;
}

/* Monde Normal : Mode Polaroid */
body.light-theme .artist-header img {
  border-radius: 2px;
  border: 8px solid #fff;
  border-bottom: 25px solid #fff; /* Look photo */
  transform: rotate(-3deg);
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
}

/* --- LE GLITCH RÉPARÉ --- */
.artist-header h2 {
  font-family: var(--font-st);
  font-size: clamp(2rem, 6vw, 3.5rem);
  margin: 0;
  color: var(--text-primary);
  position: relative;
  cursor: default;
}

/* --- ANIMATIONS : GLITCH vs DANSE --- */

/* Upside Down : Glitch au hover */
body:not(.light-theme) .artist-header h2:hover {
  animation: glitch 0.3s infinite;
}

body:not(.light-theme) .artist-header h2:hover::before,
body:not(.light-theme) .artist-header h2:hover::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

body:not(.light-theme) .artist-header h2:hover::before {
  left: 3px;
  text-shadow: -2px 0 #ff00c1;
  clip-path: inset(45% 0 0 0);
  animation: glitch-anim 0.2s infinite linear alternate-reverse;
}

body:not(.light-theme) .artist-header h2:hover::after {
  left: -3px;
  text-shadow: 2px 0 #00fff9;
  clip-path: inset(0 0 55% 0);
  animation: glitch-anim 0.3s infinite linear alternate;
}

/* Monde Normal : Danse joyeuse au hover */
body.light-theme .artist-header h2:hover {
  animation: joyful-dance 0.5s ease infinite;
  color: var(--accent);
}

@keyframes joyful-dance {
  0%,
  100% {
    transform: translateY(0) rotate(0);
  }
  25% {
    transform: translateY(-8px) rotate(-3deg);
  }
  75% {
    transform: translateY(-8px) rotate(3deg);
  }
}

/* --- RESTE DE L'INTERFACE --- */
section {
  background: var(--card-bg);
  max-width: 900px;
  margin: 0 auto 50px;
  padding: 30px;
  border: 1px solid var(--border-color);
  box-shadow: 10px 10px 0px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 10;
}

li {
  background: rgba(255, 255, 255, 0.03);
  border-left: 4px solid var(--accent);
  margin-bottom: 12px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 20px;
}

body.light-theme li {
  background: rgba(0, 0, 0, 0.05);
}

audio {
  width: 100%;
  display: block; /* Évite les petits décalages d'alignement */
  margin-top: 10px;
  filter: invert(1) hue-rotate(180deg) brightness(1.5);
  height: 35px;
}

body.light-theme audio {
  filter: none;
}

.song-info {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  width: 100%; /* Crucial pour que le contenu ne se base pas que sur la largeur du texte */
}

/* --- NOUVEAU BOUTON IMAGE --- */
.theme-btn-img {
  position: fixed;
  top: 20px;
  right: 20px;
  background: none; /* Plus de fond rouge */
  border: none;
  cursor: pointer;
  z-index: 2000;
  padding: 0;
  outline: none;
}

.toggle-icon {
  width: 60px; /* Ajuste la taille de tes icônes ici */
  height: 60px;
  object-fit: contain;
  transition:
    transform 0.3s ease,
    filter 0.3s ease;
}

/* --- LOGIQUE D'AFFICHAGE DES ICÔNES --- */

/* Par défaut (Mode UPSIDE DOWN) : On veut voir la fleur pour revenir au normal */
.icon-demo {
  display: block;
  filter: drop-shadow(0 0 5px var(--accent));
}
.icon-flower {
  display: none;
}

/* Quand on est en mode LIGHT : On veut voir le Demogorgon pour aller dans le sombre */
body.light-theme .icon-demo {
  display: none;
}
body.light-theme .icon-flower {
  display: block;
  filter: drop-shadow(2px 2px 5px rgba(0, 0, 0, 0.3)); /* Ombre douce */
}

/* Petit effet au survol */
.theme-btn-img:hover .toggle-icon {
  transform: scale(1.1) rotate(5deg);
}

/* --- LE FOND NOIR ET L'IMAGE CACHÉE --- */
body:not(.light-theme) {
  background-color: #000; /* Noir total par défaut */
  background-image: none;
  transition: background 0.5s ease;
}

/* On utilise le before pour l'image qui "pop" avec l'éclair */
body:not(.light-theme)::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("images/wallpaper/fond-dark.jpg");
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;

  /* Caché par défaut */
  opacity: 0;
  pointer-events: none;
  z-index: -1; /* Derrière les cartes */

  /* Animation synchro avec l'éclair */
  animation: reveal-background 7s infinite;
}
/* --- L'ANIMATION DE RÉVÉLATION (ÉCLAIR) --- */
@keyframes reveal-background {
  0%,
  92%,
  100% {
    opacity: 0;
    filter: brightness(1) sepia(0);
  }
  93% {
    opacity: 0.3;
    filter: brightness(1.2) sepia(1) saturate(5) hue-rotate(-50deg); /* Teinte rouge */
  }
  94% {
    opacity: 0.1;
  }
  95% {
    opacity: 0.8; /* Flash principal qui montre bien l'image */
    filter: brightness(1.5) sepia(1) saturate(10) hue-rotate(-50deg);
  }
  97% {
    opacity: 0;
  }
}
