/*
  style.css — L'INTERFACE PAR-DESSUS LA 3D
  ----------------------------------------
  La 3D est un <canvas> qui prend tout l'écran. Tout le reste
  (accueil, viseur, carte) est en position: fixed, donc "flotte" au-dessus.
*/

/* On enlève les marges par défaut du navigateur et on empêche le scroll */
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #111;
  font-family: Georgia, "Times New Roman", serif;
  color: #2b2620;
}

/* Le canvas créé par Three.js : on le force en plein écran */
canvas {
  display: block;
}

/* Classe utilitaire : ajoutée/retirée par JS pour cacher un élément */
.cache {
  display: none !important;
}

/* ---------- Écran d'accueil / pause ---------- */
#accueil {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 16, 12, 0.55); /* voile sombre, on voit la galerie derrière */
  z-index: 20;
}

#accueil .boite {
  background: #f8f4ec;
  padding: 2.5rem 3rem;
  border-radius: 6px;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

#accueil h1 {
  margin: 0 0 0.4rem;
  font-weight: normal;
  font-size: 2.2rem;
}

#accueil p {
  margin: 0 0 1.6rem;
  font-style: italic;
  color: #6b6155;
}

#bouton-entrer {
  font: inherit;
  font-size: 1.1rem;
  padding: 0.7rem 2.2rem;
  border: 1px solid #2b2620;
  background: transparent;
  color: #2b2620;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.2s, color 0.2s;
}

#bouton-entrer:hover {
  background: #2b2620;
  color: #f8f4ec;
}

/* Tant que les photos chargent, le bouton est désactivé (pas cliquable) */
#bouton-entrer:disabled {
  opacity: 0.6;
  cursor: default;
  border-color: #a89a88;
  color: #a89a88;
}

#bouton-entrer:disabled:hover {
  background: transparent;
  color: #a89a88;
}

/* Barre de progression du chargement des photos */
#barre-progression {
  margin-top: 0.9rem;
  height: 4px;
  border-radius: 2px;
  background: rgba(43, 38, 32, 0.15);
  overflow: hidden;
}

#barre-progression-remplie {
  height: 100%;
  width: 0%;
  background: #2b2620;
  border-radius: 2px;
  transition: width 0.25s ease;
}

.aide {
  list-style: none;
  padding: 0;
  margin: 1.8rem 0 0;
  font-size: 0.85rem;
  color: #6b6155;
  line-height: 1.7;
  font-family: system-ui, sans-serif;
}

/* ---------- Viseur ---------- */
#viseur {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px; /* on recentre le point sur lui-même */
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.6);
  pointer-events: none; /* le viseur ne bloque jamais les clics */
  z-index: 10;
}

/* ---------- Carte d'info d'une photo ---------- */
#carte {
  position: fixed;
  left: 50%;
  bottom: 6vh;
  transform: translateX(-50%);
  max-width: min(560px, 85vw);
  background: rgba(248, 244, 236, 0.94);
  padding: 1rem 1.6rem 1.2rem;
  border-radius: 4px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 10;
  animation: apparition 0.35s ease;
}

#carte-titre {
  font-size: 1.3rem;
}

#carte-date {
  font-size: 0.85rem;
  color: #8a7e70;
  font-style: italic;
  margin-top: 0.15rem;
}

#carte-message {
  margin-top: 0.6rem;
  line-height: 1.5;
}

/* Un titre/date/message vide ne doit laisser AUCUN espace : sans ça, un
   <div> vide garde quand même la hauteur d'une ligne de texte, ce qui
   crée un vide bizarre au-dessus du secret sur une photo sans légende. */
#carte-titre:empty,
#carte-date:empty,
#carte-message:empty {
  display: none;
}

/* Indice "Appuie sur E…" : discret, clignote doucement pour attirer l'œil */
#carte-secret-indice {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  font-style: italic;
  color: #a89a3e;
  animation: clignote 1.8s ease-in-out infinite;
}

/* Le secret révélé : mis en valeur, façon "petit mot caché" */
#carte-secret {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px dashed #c9b25a;
  color: #7a5c00;
  font-style: italic;
  line-height: 1.5;
  animation: apparition 0.3s ease;
}

/* ---------- Message centré (ex : touche E sur une photo sans secret) ---------- */
#message-centre {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 80vw;
  text-align: center;
  font-size: 1.3rem;
  font-style: italic;
  color: #f8f4ec;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  z-index: 15;
  transition: opacity 0.5s ease;
}

#message-centre.visible {
  opacity: 1;
}

/* ---------- Indice + boîte des post-it roses ---------- */
#postit-indice {
  position: fixed;
  left: 50%;
  bottom: 14vh;
  transform: translateX(-50%);
  font-size: 0.95rem;
  font-style: italic;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 11;
  animation: clignote 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  #postit-indice {
    animation: none;
  }
}

#postit {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-3deg);
  width: min(320px, 70vw);
  background: #ffe780;
  padding: 1.6rem 1.8rem;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 16;
  font-family: Georgia, "Times New Roman", serif;
  color: #2b2620;
  animation: apparition-postit 0.3s ease;
}

#postit-titre {
  font-size: 1.15rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

#postit-message {
  line-height: 1.5;
}

#postit-titre:empty,
#postit-message:empty {
  display: none;
}

@keyframes apparition-postit {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-3deg) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-3deg) scale(1);
  }
}

@keyframes clignote {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #carte-secret-indice {
    animation: none;
  }
}

/* Petite animation de fondu quand la carte apparaît */
@keyframes apparition {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
