/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: #1a1a2e;
}

/* ============================================================
   ÉCRAN PRINCIPAL  (= FEN_Pa_Capona_P1_Carte)
   Plein écran sur tous les formats
============================================================ */
.screen {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   WRAPPER CARTE — regroupe bg-image + flèches directionnelles
   Le transform (rotation + pan) est géré entièrement par JS.
   Le CSS gère uniquement la position et la taille selon l'orientation.
   ┌──────────────────────────────────────────────────────────┐
   │  Portrait  → inset: 0 (remplit l'écran normalement)      │
   │  Paysage   → centré, dimensions permutées (100vh × 100vw)│
   └──────────────────────────────────────────────────────────┘
============================================================ */
.map-wrapper {
  position: absolute;
  inset: 0;
  z-index: 0;
  transform-origin: center center;
  /* Pas de transition ici : le JS la gère dynamiquement
     (désactivée pendant le pan, animée lors des rotations) */
}

@media (orientation: landscape) {
  .map-wrapper {
    inset:  auto;
    top:    50%;
    left:   50%;
    right:  auto;
    bottom: auto;
    width:  100vh;   /* hauteur écran → largeur visuelle après rotate */
    height: 100vw;   /* largeur écran → hauteur visuelle après rotate */
    /* transform : géré par JS (translate + rotate) */
  }
}

/* ============================================================
   IMAGE DE FOND — pleine page (img/depart_90.jpg)
   object-fit: contain → image entière, sans recadrage
   (la rotation est gérée par .map-wrapper, pas ici)
============================================================ */
.bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  z-index: 0;
  transition: opacity 0.35s ease;
}

/* Dégradé de secours si l'image est absente */
.bg-fallback {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    165deg,
    #4a7a5b 0%,
    #6a8a4e 25%,
    #8b9a42 50%,
    #7a8b55 75%,
    #5a6b3a 100%
  );
  z-index: 0;
}


/* ============================================================
   IMAGE INDICE — coin supérieur gauche (pic1V.jpg)
   Positionnée au-dessus du map-wrapper (z-index 2),
   indépendante du pan/rotation de la carte.
============================================================ */
.img-indice {
  position: absolute;
  top:  clamp(10px, 2vh, 18px);
  left: clamp(10px, 3vw, 28px);
  z-index: 2;
  width:  clamp(90px, 35vw, 200px);
  height: auto;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.img-indice:hover,
.img-indice:focus {
  transform: scale(1.08);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.75);
  outline: none;
}

.img-indice:active {
  transform: scale(0.94);
}

/* ============================================================
   BANDE DU BAS
   [ Voici votre parcours... ]  [ ? ]  [ → ]
============================================================ */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  background: rgba(10, 10, 10, 0.1);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  padding: clamp(2px, 2vh, 4px) clamp(10px, 3.5vw, 22px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ============================================================
   TEXTE "Voici votre parcours..."
============================================================ */
.parcours-text {
  flex: 1;
  color: #ffffff;
  font-size: clamp(1.32rem, 6.2vw, 8.8rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 1);
}

/* ============================================================
   BOUTON INFO — IMG_Explication (icône "?")
============================================================ */
.btn-explication {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
  position: relative;
}

.btn-explication:hover,
.btn-explication:focus {
  transform: scale(1.12);
  outline: none;
}

.btn-explication:active {
  transform: scale(0.95);
}

/* Image de l'icône "?" */
.icon-explication {
  width: clamp(38px, 9vw, 52px);
  height: clamp(38px, 9vw, 52px);
  object-fit: contain;
  display: block;
}

/* Fallback si img/intérrogation@dpi1x.png est absent :
   cercle bleu avec "?" */
.icon-fallback {
  display: none;
  width: clamp(38px, 9vw, 52px);
  height: clamp(38px, 9vw, 52px);
  background: #2979ff;
  border-radius: 50%;
  color: #ffffff;
  font-size: clamp(1.32rem, 6.2vw, 8.8rem);
  font-weight: 900;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  user-select: none;
}

/* ============================================================
   BOUTON SUIVANT — BTN_Suivant (flèche →)
============================================================ */
.btn-suivant {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}

.btn-suivant:hover,
.btn-suivant:focus {
  transform: scale(1.10);
  outline: none;
}

.btn-suivant:active {
  transform: scale(0.94);
}

.icon-qrCode {
  width: clamp(70px, 13vw, 84px);
  height: clamp(70px, 13vw, 84px);
  object-fit: contain;
  display: block;
}

/* ============================================================
   MODALE D'INFO — IMG_Explication
============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: #ffffff;
  border-radius: 14px;
  padding: clamp(20px, 6vw, 36px) clamp(22px, 7vw, 40px);
  max-width: min(92vw, 390px);
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: popIn 0.22s cubic-bezier(.22, .68, 0, 1.2) both;
}

.modal-box p {
  font-size: clamp(0.92rem, 2.2vw, 1.5rem);
  color: #1a1a2e;
  line-height: 1.55;
  margin-bottom: 4px;
}

.modal-box p:last-of-type {
  margin-bottom: 0;
}

.modal-close {
  display: block;
  margin: 20px auto 0;
  background: #2979ff;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 11px 36px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.modal-close:hover,
.modal-close:focus {
  background: #1c54b2;
  outline: none;
}

.modal-close:active {
  transform: scale(0.96);
}

/* ============================================================
   OVERLAY DE TRANSITION (fondu de sortie)
============================================================ */
.transition-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* ============================================================
   ANIMATIONS
============================================================ */
@keyframes popIn {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
   RESPONSIVE — PORTRAIT ÉTROIT (≤ 360px)
============================================================ */
@media (max-width: 360px) {
  .parcours-text     { font-size: 0.75rem; }
  .icon-explication,
  .icon-fallback     { width: 32px; height: 32px; }
  .icon-fleche       { width: 40px; height: 40px; }
}

/* ============================================================
   RESPONSIVE — PAYSAGE MOBILE (hauteur ≤ 450px)
============================================================ */
@media (max-height: 450px) and (orientation: landscape) {
  .bottom-bar        { padding: 5px 12px; }
  .parcours-text     { font-size: 1.5rem; }
  .icon-explication,
  .icon-fallback     { width: 30px; height: 30px; }
  .icon-fleche       { width: 36px; height: 36px; }
}

/* ============================================================
   RESPONSIVE — TABLETTE (≥ 600px)
============================================================ */
@media (min-width: 600px) {
  .parcours-text { font-size: 2.5rem; }
}
