/* SPSA — Styles 3/3 : carte Leaflet, marqueurs, responsive, utilitaires.
   Se charge EN DERNIER (contient les media queries qui priment). */

/* ===== Marqueurs personnalisés ===== */
.marker-pin-wrap { background: transparent; border: none; }

.marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.28);
  transition: transform var(--ease);
}

.marker-pin svg { width: 17px; height: 17px; }

.marker-pin--garage { background: var(--ocean); color: #fff; }
.marker-pin--vendeur { background: var(--gold); color: var(--ocean); }

.marker-pin:hover { transform: scale(1.12); }

.marker-pin--bounce { animation: pin-bounce 0.6s ease; }

@keyframes pin-bounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-11px); }
  55% { transform: translateY(-4px); }
  75% { transform: translateY(-1px); }
}

/* Clusters aux couleurs SPSA */
.marker-cluster { background: rgba(0, 31, 82, 0.32) !important; }
.marker-cluster div {
  background: var(--ocean) !important;
  color: #fff !important;
}
.marker-cluster span { font-family: 'Manrope', sans-serif; font-weight: 700; }

/* ===== Leaflet ===== */
/* Ravive les tuiles Esri (un peu pâles par défaut) : plus de saturation et de
   contraste. N'affecte QUE le fond de carte — les marqueurs/clusters sont sur
   d'autres calques (marker-pane, overlay-pane) et restent nets. */
.leaflet-tile-pane {
  filter: saturate(0.60) contrast(1.00) brightness(1.00);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--r-md) !important;
  box-shadow: var(--sh-md) !important;
  border: 1.5px solid var(--border) !important;
}

.leaflet-popup-content {
  font-family: 'Inter', sans-serif !important;
  font-size: 0.85rem !important;
  line-height: 1.5 !important;
  margin: 12px 16px !important;
}

.leaflet-popup-content strong {
  font-family: 'Manrope', sans-serif;
  color: var(--ocean);
  font-size: 0.9rem;
  font-weight: 700;
}

.leaflet-popup-content a {
  color: var(--accent-ink);
  font-weight: 600;
}

.popup-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  color: var(--accent-ink);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid var(--gold);
  padding-bottom: 2px;
  transition: color var(--ease);
}

.popup-link:hover { color: var(--ocean); }

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .container { padding: 0 32px; }

  .hero { padding: 110px 0 96px; }
  .hero h1 { font-size: 3rem; }

  .stats__grid { grid-template-columns: repeat(2, 1fr); max-width: 600px; }

  .footer__grid {
    grid-template-columns: 2fr 1fr 1fr;
    gap: 56px;
  }
}

@media (max-width: 1023px) {
  /* Empilement vertical : carte en haut, fiches partenaires listées dessous */
  .split-view {
    position: static;
    flex-direction: column;
    gap: 16px;
    height: auto;
    min-height: 0;
  }

  /* La carte passe au-dessus de la liste (ordre DOM : liste avant carte) */
  .split-view__map {
    display: block;
    position: relative;
    inset: auto;
    order: -1;
    flex: none; /* annule flex:1 (sinon flex-basis:0 écrase la hauteur) */
    width: 100%;
    height: 320px;
    border-radius: var(--r-lg);
  }

  /* La liste reprend un défilement vertical normal, toutes les fiches visibles */
  .split-view__list {
    position: static;
    width: 100%;
    height: auto;
    overflow: visible;
    padding-right: 0;
  }

  .partners-grid {
    flex-direction: column;
    gap: 12px;
    padding-bottom: 8px;
  }
}

@media (max-width: 767px) {
  :root { --header-h: 56px; }

  .header .container { height: 56px; }
  .header__toggle { display: inline-flex; align-items: center; justify-content: center; }

  /* Menu mobile : fond navy, accents or (identité navy/or) */
  .header__nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 56px;
    background: linear-gradient(180deg, var(--ocean) 0%, var(--ocean-mid) 130%);
    flex-direction: column;
    gap: 3px;
    padding: 0 14px;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    box-shadow: 0 16px 34px rgba(0, 25, 69, 0.35);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 220ms ease, max-height 220ms ease, padding 220ms ease;
  }

  .header.nav-open .header__nav,
  .header__nav.open {
    max-height: 400px;
    opacity: 1;
    padding: 12px 14px 16px;
  }

  .header__nav a {
    padding: 13px 18px;
    border-radius: var(--r-md);
    color: var(--ocean-pale);
    text-align: right;
    transition: background var(--ease), color var(--ease);
  }

  .header__nav a:hover,
  .header__nav a:active {
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
  }

  /* Page en cours : pastille or arrondie sur fond navy */
  .header__nav a[aria-current="page"] {
    color: var(--ocean);
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    box-shadow: 0 3px 12px rgba(233, 181, 68, 0.32);
  }

  .header__nav a::after { display: none; }

  .nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 31, 82, 0.55); /* primary (bob 1) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 220ms ease, visibility 220ms;
    z-index: 900;
  }

  .nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .lock-scroll { overflow: hidden; }

  /* Espace réservé en bas du héro pour accueillir la carte sous le bouton */
  .hero { padding: 56px 0 320px; }
  /* Interligne aéré : le souligné or de « SPSA » ne mord plus la ligne suivante */
  .hero h1 { font-size: 1.8rem; line-height: 1.3; }
  /* Trait or remonté pour ne pas mordre sur « près de chez vous » */
  .hero h1 span { padding-bottom: 1px; background-size: 100% 2px; }
  .hero__tag { font-size: 0.62rem; }

  /* La carte de l'île descend sous le CTA, centrée, avant les stats */
  .hero__topo {
    top: auto;
    bottom: 24px;
    left: 50%;
    right: auto;
    width: 270px;
    max-width: 80%;
    transform: translateX(-50%);
    -webkit-mask-image: none;
            mask-image: none;
  }

  /* La carte est ~3x plus petite sur mobile : on agrandit les points pour
     garder une taille cohérente avec le desktop. 'scale' n'interfère pas avec
     l'animation pin-pop (qui utilise 'transform'), et l'ancrage bas conserve
     la position GPS de la pointe. */
  .hero__topo .topo-pin { scale: 1.8; }

  /* Halos décoratifs conservés sur mobile, recentrés sur le titre
     (en haut du héro) pour garder le fond coloré sans aplat derrière la carte */
  .hero__shape--1 {
    width: 360px;
    height: 360px;
    top: -150px;
    right: -110px;
  }

  .hero__shape--2 {
    width: 240px;
    height: 240px;
    top: 40px;
    bottom: auto;
    left: -110px;
  }

  .stats { padding: 36px 0 18px; }
  .stats__grid { gap: 1px; }
  .stats__item { padding: 22px 14px; }
  .stats__number { font-size: 1.7rem; }

  /* Filtres compacts : recherche pleine largeur, 2 listes côte à côte */
  .filters__bar {
    position: static;
    gap: 8px;
    padding: 10px;
  }

  .filters__input-wrap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .filters__bar select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .filters__count {
    flex: 1 1 100%;
    text-align: center;
    padding: 2px 0 0;
  }

  /* Adresse : champ pleine largeur, boutons côte à côte dessous */
  .geo-bar__input-wrap { flex: 1 1 100%; }
  .geo-bar__btn { flex: 1 1 auto; }

  /* Boutons des fiches : 2 par ligne (Maps + Waze, puis Appeler + Site) */
  .card__link,
  .card__call {
    flex: 1 1 calc(50% - 3px);
    justify-content: center;
  }

  /* Fiche à deux numéros : le bouton « Appeler » remplit tout son conteneur
     (sinon il rétrécit à son contenu et la rangée est cassée / coupée). */
  .card__call > .card__link {
    flex: 1 1 auto;
    width: 100%;
  }

  .annuaire { padding: 28px 0 40px; }

  /* ===== Fond unifié mobile =====
     On prolonge l'ambiance du héro (dégradé crème + halos bleutés) derrière
     TOUTE la page : un fond commun sur <body>, puis les sections empilées
     deviennent transparentes pour le laisser transparaître en continu.
     (Pas de background-attachment: fixed — bug de rendu sur iOS Safari ;
     les halos sont répartis verticalement sur la hauteur réelle de la page.) */
  body {
    background:
      radial-gradient(50% 30% at 92% 5%,  rgba(129, 159, 234, 0.18), transparent 70%),
      radial-gradient(48% 24% at 12% 16%, rgba(233, 181, 68, 0.12), transparent 70%),
      radial-gradient(55% 28% at 8% 32%,  rgba(129, 159, 234, 0.12), transparent 70%),
      radial-gradient(60% 26% at 95% 62%, rgba(129, 159, 234, 0.10), transparent 70%),
      radial-gradient(50% 24% at 88% 78%, rgba(233, 181, 68, 0.09), transparent 70%),
      radial-gradient(55% 28% at 5% 88%,  rgba(129, 159, 234, 0.10), transparent 70%),
      linear-gradient(170deg, var(--surface-low) 0%, var(--surface) 40%);
    background-repeat: no-repeat;
  }

  /* Sections transparentes : le fond commun reste visible de bout en bout.
     Les bulles de stats, fiches et barres gardent leur propre fond (cartes). */
  .hero,
  .stats,
  .annuaire,
  .footer {
    background: transparent;
  }

  /* Transition désormais continue : plus de liseré ni de vague de séparation */
  .hero { border-bottom: none; }
  .wave-separator { display: none; }
}

@media (min-width: 1280px) {
  .container { padding: 0 40px; }
  .hero h1 { font-size: 3.4rem; }
  .hero { padding: 130px 0 110px; }
}

/* ===== Utilitaires ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  :root { --ease: 0s; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}
