/* Parcours guidé — chargé partout, actif seulement en version guidée (voir tuto.js) */

.tuto {
  position: fixed;
  inset: 0;
  z-index: 5000; /* au-dessus des écrans code/enveloppe, sous le curseur colombe */
  pointer-events: none;
  font-family: 'Cormorant Garamond', serif;
}

/* Écrans transparents autour de la zone éclairée : ils bloquent les clics ailleurs */
.tuto-ecran,
.tuto-voile {
  position: fixed;
  display: none;
  pointer-events: auto;
  touch-action: none;
}

.tuto[data-mode="cible"] .tuto-ecran { display: block; }

.tuto[data-mode="carte"] .tuto-voile {
  display: block;
  inset: 0;
  background: rgba(28, 20, 12, 0.7);
}

/* Zone éclairée : tout le reste du site est grisé par l'ombre portée */
.tuto-trou {
  position: fixed;
  display: none;
  border-radius: 12px;
  box-shadow: 0 0 0 200vmax rgba(28, 20, 12, 0.7);
}

.tuto[data-mode="cible"] .tuto-trou { display: block; }

.tuto-trou::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 3px solid var(--gold);
  border-radius: 15px;
  animation: tutoPulse 1.6s ease-in-out infinite;
}

.tuto-glisse .tuto-trou,
.tuto-glisse .tuto-bulle {
  transition: left 0.35s ease, top 0.35s ease, width 0.35s ease, height 0.35s ease;
}

.tuto-ici .tuto-trou::after { animation: tutoFlash 0.3s ease-in-out 3; }
.tuto-ici .tuto-bulle { animation: tutoSecoue 0.4s ease; }

/* Main qui montre où appuyer */
.tuto-main {
  position: fixed;
  display: none;
  width: 54px;
  height: 54px;
  transform-origin: 40% 6%;
  animation: tutoTape 1.3s ease-in-out infinite;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

.tuto[data-mode="cible"] .tuto-main.visible { display: block; }
.tuto-main svg { display: block; width: 100%; height: 100%; }

/* Bulle d'explication */
.tuto-bulle {
  position: fixed;
  display: none;
  width: min(calc(100vw - 16px), 400px);
  padding: 16px 18px;
  background: var(--ivory);
  color: var(--taiga-deep);
  border: 1px solid var(--gold);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.tuto[data-mode] .tuto-bulle { display: block; }
.tuto-pop .tuto-bulle { animation: tutoPop 0.35s ease; }

.tuto[data-mode="barre"] .tuto-bulle {
  left: 0;
  right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  margin: 0 auto;
  width: min(calc(100vw - 16px), 520px);
}

.tuto[data-mode="carte"] .tuto-bulle {
  inset: 0;
  margin: auto;
  height: fit-content;
}

.tuto-entete {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.tuto-colombe { flex: none; width: 30px; height: 30px; }
.tuto-colombe svg { display: block; width: 100%; height: 100%; }

.tuto-etape {
  font-family: 'Tenor Sans', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--olive-deep);
}

.tuto-texte {
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.35;
}

.tuto-aide-ligne {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.tuto-aide {
  font-size: 1.12rem;
  font-style: italic;
  line-height: 1.35;
  color: var(--taiga);
}

.tuto-erreur {
  margin-top: 8px;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.35;
  color: #a3362a;
}

.tuto-aide-ligne[hidden],
.tuto-erreur[hidden],
.tuto-actions[hidden],
.tuto-icone[hidden] { display: none; }

/* Petit dessin animé « faites défiler » : téléphone (tactile) ou souris */
.tuto-icone {
  position: relative;
  flex: none;
  width: 24px;
  height: 38px;
  border: 2px solid var(--olive-deep);
  border-radius: 12px;
}

.tuto-icone::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 8px;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--olive-deep);
  animation: tutoMolette 1.4s ease-in-out infinite;
}

.tuto-tactile .tuto-icone { border-radius: 6px; }
.tuto-tactile .tuto-icone::after { top: 22px; animation-name: tutoGlisser; }

.tuto-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.tuto-btn {
  flex: 1;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid var(--olive-deep);
  border-radius: 10px;
  background: var(--olive-deep);
  color: var(--ivory);
  font-family: 'Tenor Sans', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tuto-btn:hover { background: var(--olive); }

.tuto-btn-2 {
  flex: 0 1 auto;
  border-color: var(--taiga-light);
  background: transparent;
  color: var(--taiga-deep);
}

.tuto-btn-2:hover { background: var(--ivory-warm); }

/* Flèche de la bulle vers la zone éclairée */
.tuto-fleche {
  position: absolute;
  display: none;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  background: var(--ivory);
  border: 1px solid var(--gold);
  border-right: 0;
  border-bottom: 0;
}

.tuto[data-mode="cible"] .tuto-bulle[data-cote="bas"] .tuto-fleche {
  display: block;
  top: -9px;
  transform: rotate(45deg);
}

.tuto[data-mode="cible"] .tuto-bulle[data-cote="haut"] .tuto-fleche {
  display: block;
  bottom: -9px;
  transform: rotate(225deg);
}

.tuto-etape { flex: 1; }

.tuto-passer {
  flex: none;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--taiga);
  font-family: 'Tenor Sans', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tuto[data-mode="carte"] .tuto-passer { display: none; }

/* Écran trop petit (clavier ouvert…) : la bulle ne garde que la consigne et les boutons */
.tuto-serre .tuto-entete,
.tuto-serre .tuto-aide-ligne { display: none; }

@media (max-width: 480px) {
  .tuto-bulle { padding: 12px 14px; }
  .tuto-texte { font-size: 1.18rem; }
  .tuto-aide, .tuto-erreur { font-size: 1.02rem; }
  .tuto-actions { margin-top: 10px; }
  .tuto-btn { min-height: 48px; }
}

/* Bouton du site mis en avant pendant la visite (sans griser le reste) */
.tuto-attire { animation: tutoAttire 1.4s ease-in-out infinite; }

@keyframes tutoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.015); }
}

@keyframes tutoFlash {
  50% { border-color: #fff; box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.5); }
}

@keyframes tutoSecoue {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes tutoTape {
  0%, 100% { transform: translate(5px, 14px) rotate(-14deg); }
  45%, 60% { transform: translate(0, 0) rotate(-14deg) scale(0.94); }
}

@keyframes tutoPop {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes tutoMolette {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

@keyframes tutoGlisser {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

@keyframes tutoAttire {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 169, 106, 0.9); }
  50% { box-shadow: 0 0 0 12px rgba(201, 169, 106, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .tuto *,
  .tuto *::after,
  .tuto-attire { animation: none !important; transition: none !important; }
}
