/* =========================================================================
   gallery.css — Carrousel photo réutilisable (Embla Carousel)
   Rendu inspiré de Lanserhof « Impressions from the resorts » :
   slide active centrée et large, slides voisines qui dépassent aux bords,
   flèches rondes semi-transparentes en bas au centre, bullets sous le slider.

   Autonome : fonctionne seul, mais réutilise les variables du site si présentes
   (var(--x, fallback)). Un même carrousel peut être répété plusieurs fois par page.
   ========================================================================= */

/* ------------------------------- Section ------------------------------- */
.embla-section {
  padding: clamp(3.5rem, 8vw, 7rem) 0;
  background: var(--bg-alt, #f4efe8);           /* fond gris/crème clair optionnel */
}
.embla-section__inner {
  width: min(100% - 2.5rem, 1280px);
  margin-inline: auto;
}

/* ------------------------------- Titre --------------------------------- */
.embla-heading-wrap { text-align: center; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
.embla-heading {
  margin: 0;
  font-family: var(--font-display, "Cormorant Garamond", Georgia, "Times New Roman", serif);
  font-weight: 300;                              /* police fine / légère */
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: .01em;
  color: var(--plum, #2c2a28);
}

/* --------------------------- Composant Embla --------------------------- */
.embla { position: relative; }

/* Viewport : masque le débordement horizontal */
.embla-slider {
  overflow: hidden;
  position: relative;
  outline: none;
}
.embla-slider:focus-visible { box-shadow: 0 0 0 3px var(--terracotta, #c2664a); border-radius: 8px; }

/* Container : rail flex qui glisse */
.embla-container {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2rem);
  touch-action: pan-y pinch-zoom;               /* laisse Embla gérer le drag horizontal */
  will-change: transform;
}

/* Slide : hauteur commune, LARGEUR ADAPTÉE au format de chaque image
   (carré, portrait, paysage…) — aucune photo n'est recadrée. */
.embla-slide {
  position: relative;
  flex: 0 0 auto;
  max-width: 92%;
  min-width: 0;
}
/* Effet « slide active large / voisines atténuées » : appliqué UNIQUEMENT
   quand le JS a initialisé le carrousel (classe .is-init). Sans JS
   (ex. ouverture directe en file://), les images restent pleinement visibles.
   IMPORTANT : l'effet vit sur .image-wrapper et JAMAIS sur .embla-slide —
   Embla (loop) repositionne les slides via leur transform inline ; une
   transition CSS sur ce transform anime ces repositionnements instantanés
   et fait se chevaucher/mélanger les photos au passage de la boucle. */
.embla.is-init .image-wrapper {
  opacity: .45; transform: scale(.86);
  transition: opacity .55s ease, transform .55s cubic-bezier(.22,.61,.36,1);
}
.embla.is-init .is-active .image-wrapper { opacity: 1; transform: scale(1); }

/* Image : hauteur fixe, largeur naturelle de l'image → visuel entier */
.image-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  height: clamp(300px, 42vw, 520px);
  background: #e7ded2;
  box-shadow: 0 24px 60px rgba(30, 20, 18, .22);
}
.image-wrapper img {
  display: block;
  width: auto;
  height: 100%;
  max-width: 88vw;
  object-fit: contain;
}

/* ------------------------- Flèches précédent / suivant ----------------- */
/* Deux boutons ronds en bas au centre de l'image (discrets, + visibles au survol) */
.embla-nav {
  position: absolute;
  left: 50%;
  bottom: clamp(14px, 2.2vw, 26px);
  transform: translateX(-50%);
  display: flex;
  gap: .75rem;
  z-index: 3;
  opacity: .68;
  transition: opacity .35s ease;
}
.embla:hover .embla-nav,
.embla-slider:focus-within .embla-nav { opacity: 1; }

.embla-btn {
  width: 48px; height: 48px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .32);
  color: #fff;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
  transition: background .3s ease, transform .3s ease, color .3s ease;
}
.embla-btn:hover { background: #fff; color: var(--plum, #2c2a28); transform: translateY(-2px); }
.embla-btn:active { transform: translateY(0) scale(.96); }
.embla-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.embla-btn svg { width: 22px; height: 22px; }

/* ------------------------------- Bullets ------------------------------- */
.embla-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: clamp(1.4rem, 3vw, 2.2rem);
}
.embla-dot {
  width: 10px; height: 10px;
  padding: 0;
  border: 1.5px solid var(--terracotta, #c2664a);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background .3s ease, transform .3s ease, border-color .3s ease;
}
.embla-dot:hover { transform: scale(1.15); }
.embla-dot.is-active { background: var(--terracotta, #c2664a); transform: scale(1.1); }
.embla-dot:focus-visible { outline: 2px solid var(--terracotta, #c2664a); outline-offset: 2px; }

/* ------------------------- Lien « Skip » a11y -------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
/* Rendre le lien visible quand il reçoit le focus clavier */
.embla-skip:focus {
  position: absolute; z-index: 5;
  width: auto; height: auto; margin: 0; clip: auto; clip-path: none;
  top: 8px; left: 8px; padding: .5rem 1rem;
  background: var(--plum, #2c2a28); color: #fff; border-radius: 6px;
}

/* ------------------------------ Responsive ----------------------------- */
@media (max-width: 768px) {
  .embla.is-init .image-wrapper { transform: scale(.94); }
  .embla.is-init .is-active .image-wrapper { transform: scale(1); }
  .embla-container { gap: .8rem; }
  .image-wrapper { border-radius: 12px; height: clamp(240px, 78vw, 380px); }
  .embla-btn { width: 42px; height: 42px; }
  .embla-btn svg { width: 19px; height: 19px; }
  .embla-dot { width: 9px; height: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .image-wrapper { transition: none; }
}
