/* ==========================================================
   VIDEO DE FOND (iframe YouTube maison) + BOUTON SON
   ========================================================== */

/* --- Conteneur de l'intro --- */
#intro {
  position: relative;
  z-index: 0;          /* tout le contenu de l'intro reste sous le menu */
  overflow: hidden;
}

#backgrounds {
  position: relative;
  overflow: hidden;
  /* height: 100vh + logo animé déjà définis dans styleDigue.css */
}

/* --- Calque vidéo : invisible au départ, fondu quand la vidéo démarre --- */
#back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 3s ease;
  pointer-events: none;
}

#back.is-visible {
  opacity: 1;
}

/* --- L'iframe en mode "cover" (comme background-size: cover) --- */
#yt-player {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw;          /* 16:9 calé sur la largeur */
  min-height: 100vh;
  min-width: 177.78vh;      /* 16:9 calé sur la hauteur */
  transform: translate(-50%, -50%);
  border: 0;
  pointer-events: none;     /* pas de survol = pas d'interface YouTube */
}

/* --- Barre de contrôles vidéo (bas gauche) --- */
#video-controls {
  position: absolute;
  left: 40px;
  right: 40px;
  bottom: 40px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--blanco);
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.6));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Le JS ajoute .is-ready quand la vidéo démarre */
#video-controls.is-ready {
  opacity: 1;
  visibility: visible;
}

/* --- Style commun des boutons --- */
.vc-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.vc-btn:hover {
  opacity: 0.5;
}

.vc-btn:focus-visible {
  outline: 1px solid var(--blanco);
  outline-offset: 4px;
}

.vc-btn svg {
  display: block;
}

/* Petit espace entre le son et les commandes de lecture */
#sound-toggle {
  margin-right: 16px;
}

/* --- Boutons à deux états : une seule icône visible --- */
#sound-toggle svg,
#play-toggle svg {
  display: none;
}

#sound-toggle.is-muted .icon-sound-off,
#sound-toggle.is-unmuted .icon-sound-on,
#play-toggle.is-paused .icon-play,
#play-toggle.is-playing .icon-pause {
  display: block;
}

/* --- Bloc titre + barre de progression --- */
#video-info {
  flex: 1;
  min-width: 0;
  margin-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* --- Titre de la vidéo --- */
#video-title {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 300;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Barre de progression --- */
#video-seek {
  position: relative;
  height: 12px;              /* zone cliquable confortable */
  cursor: pointer;
  touch-action: none;
}

/* La ligne de fond */
#video-seek::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-50%);
  transition: height 0.2s ease;
}

/* La partie déjà lue */
#video-seek-progress {
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 1px;
  background: var(--blanco);
  transform: translateY(-50%);
  transition: height 0.2s ease;
}

/* La pastille au bout (visible au survol) */
#video-seek-progress::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blanco);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

#video-seek:hover::before,
#video-seek:hover #video-seek-progress {
  height: 3px;
}

#video-seek:hover #video-seek-progress::after,
#video-seek:focus-visible #video-seek-progress::after {
  opacity: 1;
}

#video-seek:focus-visible {
  outline: 1px solid var(--blanco);
  outline-offset: 4px;
}

/* --- Bouton S'abonner --- */
.vc-sub,
.vc-sub:link,
.vc-sub:visited {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 32px;
  margin-left: 24px;
  padding: 0 16px;
  border: none;
  border-radius: 16px;              /* arrondi : à ajuster selon errorishuman.com */
  background-color: var(--violine); /* turquoise #70c6e3 */
  color: var(--black);
  font-family: "IBM Plex Mono", monospace;
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.vc-sub:hover {
  background-color: var(--blanco);  /* le bleu devient blanc */
  color: var(--black);
}

.vc-sub:focus-visible {
  outline: 1px solid var(--blanco);
  outline-offset: 4px;
}
/* --- Rideau noir pour les changements de vidéo --- */
#video-curtain {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
}

#video-curtain.is-closed {
  opacity: 1;
}
/* --- Indicateur de chargement sous le logo --- */
#video-loader {
  --loader-offset: 9vw;          /* distance sous le centre du logo : à ajuster */
  position: absolute;
  left: 50%;
  top: calc(50% + var(--loader-offset));
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;       /* centre le rond sur son point d'ancrage */
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--blanco);
  border-radius: 50%;
  pointer-events: none;
  animation:
    loader-spin 0.9s linear infinite,
    loader-timeout 0.6s ease 20s forwards; /* s'efface seul après 20 s */
  transition: opacity 0.6s ease;
}

/* La vidéo apparaît : le rond s'efface */
#back.is-visible ~ #video-loader {
  opacity: 0;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}
@keyframes loader-timeout {
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #video-loader {
    animation: loader-timeout 0.6s ease 20s forwards;
  }
}
/* --- Lecture d'un lien YouTube : vidéo masquée le temps du chargement --- */
#back.is-waiting {
  opacity: 0;
  transition: opacity 0.3s ease;   /* disparition rapide au clic */
}

/* Le rond de chargement revient (même s'il s'était effacé après 20 s) */
#video-loader.is-active {
  opacity: 1;
  animation: loader-spin 0.9s linear infinite;
}
/* --- Bouton plein écran --- */
#fullscreen-toggle {
  margin-left: 16px;
}

/* Une seule icône visible, comme pour le son et la lecture */
#fullscreen-toggle svg {
  display: none;
}

#fullscreen-toggle:not(.is-active) .icon-fs-enter,
#fullscreen-toggle.is-active .icon-fs-exit {
  display: block;
}

/* --- L'intro en plein écran --- */
#intro:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #000;
}

#intro:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  background: #000;
}

#intro.is-fullscreen #backgrounds {
  height: 100vh;
}

/* Souris immobile en plein écran : commandes et curseur masqués */
#intro.is-idle,
#intro.is-idle * {
  cursor: none;
}

#intro.is-idle #video-controls {
  opacity: 0;
}
/* --- Dégradé noir sous les commandes du player --- */
#backgrounds::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(160px, 30vh, 320px);   /* hauteur du dégradé */
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 1) 13%,
    rgba(0, 0, 0, 0.6) 25%,
    rgba(0, 0, 0, 0.3) 55%,
    rgba(0, 0, 0, 0.1) 80%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
  transition: opacity 0.5s ease;
}

/* En plein écran, souris immobile : le dégradé disparaît avec les commandes */
#intro.is-idle #backgrounds::after {
  opacity: 0;
}