/* ===== Base / verrouillage tactile ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #000;
  color: #fff;
  overflow: hidden;
  overscroll-behavior: none;          /* pas de « tirer pour rafraîchir » */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;        /* pas de menu sur appui long (iOS) */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;         /* pas de zoom au double-tap */
}

img, video {
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;               /* les touchers vont au conteneur, jamais à l'image */
}

button { font: inherit; color: inherit; }

/* ===== Accueil ===== */
#accueil {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    max(4vh, env(safe-area-inset-top))
    max(4vw, env(safe-area-inset-right))
    max(4vh, env(safe-area-inset-bottom))
    max(4vw, env(safe-area-inset-left));
  gap: 3.5vh;
}

#titre {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  text-align: center;
  font-size: clamp(28px, 6vmin, 72px);
  letter-spacing: 0.03em;
  line-height: 1.15;
}

#grille {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), var(--l, 1fr));
  justify-content: center;
  align-content: center;
  gap: 4vmin 3vmin;
}

.tuile {
  all: unset;
  display: flex;
  flex-direction: column;
  min-height: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tuile .cadre {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 6px;
  background: #151515;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.tuile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tuile .icone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(48px, 9vmin, 96px);
  height: clamp(48px, 9vmin, 96px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
}
.tuile .icone svg { width: 45%; height: 45%; fill: #fff; }

.tuile .libelle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4vmin;
  padding-top: 1.6vmin;
  text-align: center;
  line-height: 1.25;
}
.tuile .libelle .fr {
  font-size: clamp(16px, 2.5vmin, 30px);
  letter-spacing: 0.01em;
}
.tuile .libelle .en {
  font-size: clamp(13px, 1.9vmin, 22px);
  font-style: italic;
  color: rgba(255, 255, 255, 0.62);
}
.tuile .libelle span:empty { display: none; }

.tuile:active .cadre { transform: scale(0.97); opacity: 0.8; }

/* ===== Fenêtre (pop-up) ===== */
#modale {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#modale[hidden] { display: none; }
#modale.visible { opacity: 1; }

#contenu { position: absolute; inset: 0; }

#fermer {
  all: unset;
  position: absolute;
  z-index: 5;
  top: max(2.5vmin, env(safe-area-inset-top));
  right: max(2.5vmin, env(safe-area-inset-right));
  width: clamp(56px, 10vmin, 88px);
  height: clamp(56px, 10vmin, 88px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 2px solid rgba(255, 255, 255, 0.5);
  display: grid;
  place-items: center;
  cursor: pointer;
}
#fermer svg { width: 42%; height: 42%; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; fill: none; }
#fermer:active { background: rgba(255, 255, 255, 0.3); }

/* ===== Vidéo ===== */
.vue-video { position: absolute; inset: 0; }
.vue-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.vue-video .etat {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(80px, 16vmin, 140px);
  height: clamp(80px, 16vmin, 140px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.vue-video .etat svg { width: 42%; height: 42%; fill: #fff; margin-left: 8%; }
.vue-video.en-pause .etat { opacity: 1; }

.vue-video .progression {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
}
.vue-video .progression .barre {
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, 0.85);
}

.message-attente {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5vmin;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 4vmin, 44px);
  color: rgba(255, 255, 255, 0.85);
}
.message-attente .en { font-size: 0.6em; font-style: italic; color: rgba(255, 255, 255, 0.55); }

/* Vimeo : lecteur plein écran + couche qui capte tous les touchers */
.vue-video.vimeo iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;
  background: #000;
}
.vue-video.vimeo .couche {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.vue-video.vimeo .etat,
.vue-video.vimeo .progression { z-index: 2; }

/* ===== Carrousel photos ===== */
.vue-galerie {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;                /* on gère nous-mêmes le glissement horizontal */
}

.vue-galerie .piste {
  display: flex;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}
.vue-galerie .piste.glisse { transition: none; }

.vue-galerie .diapo {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vmin 12vmin 9vmin;
  gap: 2vh;
}
.vue-galerie .diapo img {
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
}
.vue-galerie .diapo figcaption {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5vh;
  text-align: center;
  max-width: 80ch;
  line-height: 1.35;
}
.vue-galerie .diapo figcaption:empty { display: none; }
.vue-galerie .legende {
  font-size: clamp(16px, 2.6vmin, 28px);
  color: rgba(255, 255, 255, 0.92);
}
.vue-galerie .credit {
  font-size: clamp(12px, 1.8vmin, 19px);
  font-style: italic;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.02em;
}

.vue-galerie .message-galerie {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 10vmin;
  text-align: center;
  font-size: clamp(16px, 2.6vmin, 26px);
  color: rgba(255, 255, 255, 0.6);
}
.vue-galerie .message-galerie.erreur { color: #ff8a80; }

/* Mode ?debug=1 seulement */
.vue-galerie .avertissements {
  position: absolute;
  top: 2vmin;
  left: 2vmin;
  right: 14vmin;
  z-index: 4;
  padding: 1.2vmin 1.6vmin;
  border-radius: 6px;
  background: rgba(120, 20, 20, 0.85);
  color: #fff;
  font-size: clamp(12px, 1.6vmin, 16px);
  line-height: 1.5;
  pointer-events: none;
}

.vue-galerie .fleche {
  all: unset;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(52px, 9vmin, 80px);
  height: clamp(52px, 9vmin, 80px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
}
.vue-galerie .fleche:active { background: rgba(255, 255, 255, 0.3); }
.vue-galerie .fleche svg { width: 40%; height: 40%; stroke: #fff; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.vue-galerie .prec { left: 2.5vmin; }
.vue-galerie .suiv { right: 2.5vmin; }

.vue-galerie .points {
  position: absolute;
  left: 0; right: 0;
  bottom: max(3vmin, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 14px;
  z-index: 2;
}
.vue-galerie .points button {
  all: unset;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.vue-galerie .points button.actif { background: #fff; transform: scale(1.2); }
.vue-galerie .points button[hidden] { display: none; }

.vue-galerie .compteur {
  position: absolute;
  left: 0; right: 0;
  bottom: max(3vmin, env(safe-area-inset-bottom));
  text-align: center;
  z-index: 2;
  font-size: clamp(14px, 2vmin, 20px);
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.6);
  font-variant-numeric: tabular-nums;
}

/* ===== Message d'erreur (fichier introuvable) ===== */
.erreur-media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10vmin;
  color: #ff8a80;
  font-size: clamp(14px, 2.2vmin, 22px);
  line-height: 1.5;
}
.tuile .erreur-media { position: absolute; padding: 2vmin; }
