@charset "UTF-8";

/**
 * @file
 * Styles du Hero Carousel - style Mairie 15/16 (pleine largeur, immersif).
 * Vanilla JS - aucune dépendance CDN.
 */

/* =========================================================================
   0. Prévention du scroll horizontal (Windows scrollbar ~17 px)
   overflow-x: clip coupe le débordement sans créer de barre de défilement
   ET sans bloquer position:sticky des éléments enfants (contrairement à hidden).
   ========================================================================= */

html,
body {
  overflow-x: hidden;
}

/* =========================================================================
   1. Conteneur principal
   ========================================================================= */

.hero-carousel-wrapper {
  /*
   * Pleine largeur via CSS pur.
   * html { overflow-x: clip } empêche tout scroll horizontal résiduel.
   */
  position: relative !important;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  padding: 0;
  /* Empêche le thème de rendre le carousel sticky ou fixed */
  top: auto !important;
  bottom: auto !important;
  /*
   * z-index: 0 crée un stacking context isolé : les z-index internes
   * (slides, flèches, dots) restent confinés ici et ne couvrent plus
   * le header du thème (logo, recherche, menu) qui a un z-index plus élevé.
   */
  z-index: 0;
}

.hero-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: #1b2a3a;
  height: var(--hero-height, 75vh);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

/* =========================================================================
   2. Piste (track)
   ========================================================================= */

.hero-carousel__track {
  position: relative;
  width: 100%;
  height: 100%;
}

/* =========================================================================
   3. Slides
   ========================================================================= */

.hero-carousel__slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: scroll;
  opacity: 0;
  z-index: 0;         /* base explicite : pas de surprise d'ordre DOM */
  transition: opacity 700ms ease-in-out;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.hero-carousel__slide.is-active {
  opacity: 1;
  z-index: 1;         /* la slide entrante passe au-dessus */
}

/* Slide sortante : reste visible (z-index 1) le temps du fondu */
.hero-carousel__slide.is-leaving {
  opacity: 0;
  z-index: 1;         /* garde son image visible pendant que la nouvelle arrive */
}

/* =========================================================================
   4. Calque sombre (overlay)
   ========================================================================= */

.hero-carousel__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* =========================================================================
   5. Contenu textuel
   ========================================================================= */

.hero-carousel__content {
  position: relative;
  z-index: 2;
  max-width: 650px;
  padding: 2rem 3rem;
  color: #ffffff;
  box-sizing: border-box;
}

.hero-carousel__title {
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  letter-spacing: -0.01em;
}

.hero-carousel__subtitle {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.6;
  margin: 0 0 1.5rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  opacity: 0.95;
}

/* =========================================================================
   6. Bouton CTA
   ========================================================================= */

.hero-carousel__cta {
  display: inline-block;
  padding: 0.8rem 2.2rem;
  background-color: #0072b9;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  border: 2px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.hero-carousel__cta:hover,
.hero-carousel__cta:focus {
  background-color: #005a94;
  color: #ffffff;
  text-decoration: none;
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
}

.hero-carousel__cta:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

/* =========================================================================
   7. Fleches de navigation
   ========================================================================= */

.hero-carousel__arrow {
  position: absolute;
  bottom: 1.5rem;
  top: auto;
  transform: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background-color: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 0;
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
  line-height: 0;
}

.hero-carousel__arrow:hover,
.hero-carousel__arrow:focus {
  background-color: rgba(255, 255, 255, 0.45);
  border-color: #ffffff;
  outline: none;
}

.hero-carousel__arrow:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

.hero-carousel__arrow--prev {
  right: calc(1.5rem + 48px);
  left: auto;
}

.hero-carousel__arrow--next {
  right: 1.5rem;
}

/* =========================================================================
   8. Indicateurs (points)
   ========================================================================= */

.hero-carousel__dots {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
}

.hero-carousel__dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.75);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.hero-carousel__dot:hover,
.hero-carousel__dot:focus {
  background-color: rgba(255, 255, 255, 0.75);
  outline: none;
}

.hero-carousel__dot:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

.hero-carousel__dot.is-active {
  background-color: #ffffff;
  border-color: #ffffff;
  transform: scale(1.35);
}

/* =========================================================================
   9. Accessibilite - mouvement reduit
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  .hero-carousel__slide {
    transition: none;
  }

  .hero-carousel__arrow,
  .hero-carousel__dot {
    transition: none;
  }
}

/* =========================================================================
   10. Responsive
   ========================================================================= */

@media (max-width: 575.98px) {
  .hero-carousel {
    height: var(--hero-height, 60vh);
  }

  .hero-carousel__content {
    padding: 1rem;
    max-width: 100%;
  }

  .hero-carousel__arrow {
    width: 36px;
    height: 36px;
  }

  .hero-carousel__arrow--prev {
    right: calc(0.5rem + 36px);
    left: auto;
  }

  .hero-carousel__arrow--next {
    right: 0.5rem;
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .hero-carousel {
    height: var(--hero-height, 60vh);
  }

  .hero-carousel__content {
    padding: 1.5rem 2rem;
  }
}
