/*
 * SignalNids Rando — correctif alignement des panneaux PC / PWA / Android V2.8.0.
 * Surcouche non destructive : ne modifie ni la logique des cartes Leaflet,
 * ni les appels GPS, ni les menus, ni le header, ni la navigation mobile.
 * Chargement impérativement APRES toutes les autres feuilles de style.
 */

/* Les éléments d'une grille ne doivent jamais imposer une largeur supérieure
   à la colonne qui les contient (titres longs, listes, contenu dynamique). */
.site-shell main,
.site-shell main > section,
.site-shell main > .wrap,
.sn-home .sn-home-grid,
.sn-home .sn-home-grid > *,
.sn-home .sn-featured-grid > *,
.sn-home .sn183-popular-grid > *,
.sn-home .sn183-review-grid > *,
.sn-home .sn183-benefits > *,
.sn-home .sn-panel-title,
.sn-home .sn-panel-header > * {
  min-width: 0;
}

/* Les images et médias intégrés ne doivent jamais élargir leur carte. */
.sn-home :is(.sn-panel, .sn-trail-card, .sn-mini-card, .sn183-review-card),
.sn-home :is(.sn-home-grid, .sn-photo-section-inner, .sn-featured-grid, .sn-region-grid) {
  max-width: 100%;
}
.sn-home .sn-panel-title { overflow-wrap: anywhere; }
.sn-home .sn-panel-header > a { flex: 0 0 auto; }
.sn-home .sn-create-intro,
.sn-home .sn-create-facts,
.sn-home .sn-upload-preview { min-width: 0; max-width: 100%; }

/* Correction vérifiée dans le CSS d'origine : un width:100% ajouté à une
   carte ayant déjà 14px de marge de chaque côté la faisait déborder.
   On conserve exactement les 14px visuels, avec une largeur calculée. */
.sn-panel > .sn-panel-header + div[id*="Map"],
.sn-home .sn-map-panel > #homeMap {
  display: block;
  box-sizing: border-box;
  width: calc(100% - 28px) !important;
  max-width: calc(100% - 28px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* La légende et le message de synchronisation sont centrés sur la carte. */
.sn-home .sn-map-panel > .sn-map-explain {
  box-sizing: border-box;
  width: calc(100% - 28px);
  max-width: calc(100% - 28px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 4px;
  padding-right: 4px;
}
.sn-home .sn-map-panel > .sn-data-quality {
  box-sizing: border-box;
  width: calc(100% - 28px);
  max-width: calc(100% - 28px);
  margin: 8px auto 13px !important;
}

@media (max-width: 820px) {
  /* Cadre mobile identique d'une section à l'autre : même axe central. */
  .site-shell main { width: 100%; max-width: 100%; }
  .site-shell main .wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .sn-home .sn-home-grid,
  .sn-home .sn-photo-section-inner,
  .sn-home .sn-community-content,
  .sn-home .sn183-benefits:not(.sn184-scroll),
  .sn-home .sn183-faq-grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }
  .sn-home .sn-home-grid > *,
  .sn-home .sn-photo-section-inner > *,
  .sn-home .sn-community-content > * {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .sn-home .sn-panel,
  .sn-community-content .sn-panel {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .sn-home .sn-start-panel > .btn {
    box-sizing: border-box;
    display: flex;
    width: calc(100% - 32px);
    max-width: calc(100% - 32px);
    margin-left: auto;
    margin-right: auto;
  }
  .sn-home .sn-info-strip-inner { width: 100%; min-width: 0; }
  .sn-home .sn-info-strip-inner > div { min-width: 0; }
  .sn-home .sn-info-strip-inner > div > div { min-width: 0; overflow-wrap: anywhere; }
  .sn-home .sn-info-strip-inner .sn-strip-action { grid-column: 1 / -1; }
  .sn-home .sn-section-title { min-width: 0; max-width: 100%; }
  .sn-home .sn-section-title > * { min-width: 0; max-width: 100%; }
  .sn-home .sn-section-title h2 { overflow-wrap: anywhere; }
  .sn-home .sn-photo-actions {
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Les nouveaux blocs de discussion utilisent également des pistes flex.
     Ces garde-fous ne changent pas l'interface ni les fonctionnalités. */
  .sn-home :is([class*="discussion"], [class*="community"]) {
    min-width: 0;
    max-width: 100%;
  }
  .sn-home :is([class*="discussion"], [class*="community"]) :is(img, video, iframe) {
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  /* Carrousels PWA : les cartes occupent maintenant exactement la largeur
     intérieure disponible, sans carte coupée ni débordement à droite.
     Le glissement horizontal et les commandes existantes sont conservés. */
  .sn-home .sn184-scroll {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    scroll-padding-left: 0;
    scroll-padding-right: 0;
  }
  .sn-home .sn184-scroll > *,
  .sn-home .sn184-scroll.sn-mini-gallery > *,
  .sn-home .sn184-scroll.sn-region-grid > *,
  .sn-home .sn184-scroll.sn183-benefits > *,
  .sn-home .sn184-scroll.sn183-review-grid > *,
  .sn-home .sn184-scroll.sn-region-grid > .sn-region-card {
    box-sizing: border-box;
    flex: 0 0 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    scroll-snap-align: start;
  }
  .sn-home .sn184-controls { width: 100%; max-width: 100%; }

  /* Alignement et retour à la ligne dans les cartes étroites. */
  .sn-home .sn-panel-header { padding-left: 16px; padding-right: 16px; }
  .sn-home .sn-panel-title { flex: 1 1 auto; min-width: 0; }
  .sn-home .sn-panel-title > strong { overflow-wrap: anywhere; }
  .sn-home .sn-map-explain { justify-content: flex-start; }
  .sn-home .sn-info-strip-inner > div { align-items: center; }
  .sn-home .sn-info-strip-inner .sn-strip-action { padding-top: 10px; }
}

@media (max-width: 380px) {
  /* Sur petits Android, éviter qu'un titre et son icône poussent la carte. */
  .sn-home .sn-panel-header { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .sn-home .sn-panel-title { gap: 7px; }
  .sn-home .sn-panel-title strong { font-size: 13px; }
}
