/* ════════════════════════════════════════════════════════════
   RESPONSIVE — Génération Marocaine Bordeaux
   Breakpoints :
     • lg  : < 1100px  (petits desktops)
     • md  : < 900px   (tablettes / paysage mobile)
     • sm  : < 640px   (mobiles standards)
     • xs  : < 480px   (très petits mobiles)

   Hiérarchie z-index (menu mobile) :
     .site-header      → z-index: 100  (contexte d'empilement)
     .nav-toggle       → z-index: 101  (toujours au-dessus du nav)
     .main-nav (mobile)→ z-index: 99   (sous le header, au-dessus du contenu)
     .main-nav-overlay → z-index: 98   (sous le nav, au-dessus du contenu)
════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────
   Overlay navigation mobile (global, hors breakpoint)
   Permet au JS de le gérer quelle que soit la taille d'écran
────────────────────────────────────────── */
.main-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 98; /* Sous le nav (99) et le toggle (101), au-dessus du contenu */
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.main-nav-overlay.visible {
  display: block;
}

/* ──────────────────────────────────────────
   LG — < 1100px  (petits desktops)
────────────────────────────────────────── */
@media (max-width: 1100px) {

  /* Hero split : réequilibrer les colonnes */
  .hero-split {
    grid-template-columns: 55fr 45fr;
  }
  .hero-title {
    font-size: clamp(2.6rem, 5vw, 4.4rem);
  }

  /* Association — stats en 4 colonnes conservées mais resserrées */
  .assoc-stats-bar .container {
    grid-template-columns: repeat(4, 1fr);
  }
  .histoire-grid {
    gap: 40px;
  }
}

/* ──────────────────────────────────────────
   MD — < 900px  (tablettes / paysage mobile)
────────────────────────────────────────── */
@media (max-width: 900px) {

  /* ====== Navigation mobile ====== */

  /* Bouton hamburger : visible, z-index au-dessus du nav ouvert */
  .nav-toggle {
    display: block;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 1.3rem;
    cursor: pointer;
    /* CRITIQUE : z-index > nav (99) pour que le ✕ soit cliquable quand nav ouvert */
    z-index: 101;
    position: relative;
  }

  /* Nav mobile : panneau latéral droit
     Slide via transform (plus fiable que right: -100%)
     Le nav est un enfant du header (z-index:100) mais avec position:fixed
     il crée son propre contexte d'empilement indépendant du header */
  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    /* Caché hors écran à droite */
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    /* z-index: 99 → sous le toggle (101) mais au-dessus de l'overlay (98) */
    z-index: 99;
    width: 280px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--wine-deep);
    padding: 90px 24px 40px;
    box-shadow: -8px 0 48px rgba(0, 0, 0, 0.4);
    gap: 4px;
    overflow-y: auto;
  }

  /* État ouvert : glisser dans le viewport */
  .main-nav.open {
    transform: translateX(0);
  }

  /* Liens du menu mobile */
  .main-nav a {
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    display: block;
    opacity: 1;
    transition: background 0.2s, color 0.2s;
  }
  .main-nav a:hover,
  .main-nav a:focus {
    background: rgba(255, 255, 255, 0.1);
    color: var(--gold);
  }
  .main-nav a:active {
    background: rgba(255, 255, 255, 0.18);
  }

  /* ====== Header ====== */
  .site-header {
    padding: 14px 5%;
  }
  .brand span {
    font-size: 0.9rem;
  }

  /* ====== Hero split-screen → empilement vertical ====== */
  .hero-split {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height: auto;
  }
  .hero-left {
    padding: 110px 6% 48px;
    text-align: center;
  }
  .hero-left-inner {
    max-width: 100%;
  }
  .hero-badge {
    margin: 0 auto 24px;
  }
  .hero-title {
    font-size: clamp(2.6rem, 9vw, 4.2rem);
    line-height: 1;
  }
  .hero-desc {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
  .hero-actions {
    justify-content: center;
  }
  .hero-stats {
    justify-content: center;
  }
  .hero-right {
    padding: 0 6% 72px;
  }
  .hero-photo-wrap {
    max-width: 400px;
    margin: 0 auto;
  }
  .float-card-1 {
    bottom: -12px;
    right: 0;
  }
  .scroll-indicator {
    display: none;
  }

  /* ====== Grilles globales ====== */
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .three {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }
  .gallery-strip,
  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  /* ====== Sections ====== */
  .section {
    padding: 72px 0;
  }
  .hero {
    background-attachment: scroll;
  }

  /* ====== Countdown : 2×2 sur tablette ====== */
  .countdown {
    grid-template-columns: repeat(2, 1fr);
  }

  /* ====== Page hero (pages internes) ====== */
  .page-hero {
    padding: 110px 5% 72px;
  }

  /* ════════════════════════════════════════
     PAGE ASSOCIATION — grilles responsive
  ════════════════════════════════════════ */

  /* Bande stats : 2×2 */
  .assoc-stats-bar .container {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .assoc-stat-item {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 16px;
  }
  /* Séparer visuellement les deux colonnes */
  .assoc-stat-item:nth-child(odd) {
    border-right: 1px solid rgba(255, 255, 255, 0.2);
  }
  /* Dernière rangée : pas de border-bottom */
  .assoc-stat-item:nth-last-child(-n+2) {
    border-bottom: none;
  }

  /* Histoire : 1 colonne */
  .histoire-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  /* Badges histoire : 2 colonnes conservées */
  .histoire-badge-grid {
    grid-template-columns: 1fr 1fr;
  }

  /* Mission pillars : 1 colonne */
  .mission-pillars {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 36px;
  }
  /* Mission block : marge auto */
  .mission-block {
    max-width: 100%;
  }

  /* Objectifs : 1 colonne */
  .objectifs-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  /* Actions : 1 colonne */
  .actions-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  /* Rejoindre : 1 colonne */
  .rejoindre-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ──────────────────────────────────────────
   SM — < 640px  (mobiles standards)
────────────────────────────────────────── */
@media (max-width: 640px) {

  /* ====== Header ====== */
  .site-header {
    padding: 12px 4%;
  }
  .brand img {
    width: 46px;
    height: 46px;
  }
  .brand span {
    font-size: 0.82rem;
    max-width: 130px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  /* ====== Hero ====== */
  .hero-left {
    padding: 100px 5% 40px;
  }
  .hero-title {
    font-size: clamp(2.2rem, 10vw, 3.2rem);
  }
  .hero-badge {
    font-size: 0.72rem;
    padding: 7px 14px;
    letter-spacing: 0.12em;
  }
  .hero-desc {
    font-size: 0.95rem;
  }
  .hero-stats {
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
  }
  .hero-stat-sep {
    display: none;
  }
  .hero-right {
    padding: 0 5% 60px;
  }
  .hero-photo-frame {
    aspect-ratio: 4 / 3;
    min-height: 260px;
  }
  .float-card-1 {
    font-size: 0.76rem;
    padding: 10px 14px;
    right: 0;
    bottom: -10px;
  }

  /* ====== Boutons pleine largeur ====== */
  .btn {
    width: 100%;
    margin: 5px 0;
    justify-content: center;
  }
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
  }

  /* ====== Grilles ====== */
  .three {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }
  .footer img,
  .footer-logo-img {
    margin: 0 auto 12px;
  }
  .gallery-strip,
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .gallery-strip img,
  .gallery-grid img {
    height: 220px;
  }

  /* ====== Countdown 2×2 ====== */
  .countdown {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .countdown div {
    padding: 14px 10px;
    border-radius: 16px;
  }
  .countdown strong {
    font-size: 1.6rem;
  }

  /* ====== Cards ====== */
  .card,
  .feature-card,
  .event-card,
  .contact-card {
    padding: 22px 18px;
  }

  /* ====== Sections ====== */
  .section {
    padding: 56px 0;
  }
  .page-hero {
    padding: 96px 5% 60px;
  }
  .page-hero h1 {
    font-size: clamp(1.8rem, 9vw, 3rem);
  }

  /* ====== Map ====== */
  .map-section iframe {
    height: 280px;
  }

  /* ====== Poster événement ====== */
  .poster img {
    border-radius: 18px;
  }

  /* ════════════════════════════════════════
     PAGE ASSOCIATION — mobile sm
  ════════════════════════════════════════ */

  /* Hero association */
  .assoc-hero {
    padding: 110px 5% 72px;
  }
  .assoc-hero h1 {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  /* Bande stats : 2 colonnes */
  .assoc-stats-bar .container {
    grid-template-columns: 1fr 1fr;
  }
  .assoc-stat-item strong {
    font-size: 1.5rem;
  }

  /* Histoire badges : 1 colonne */
  .histoire-badge-grid {
    grid-template-columns: 1fr;
  }

  /* Bloc fondateurs */
  .histoire-founders {
    padding: 28px 20px;
  }
  .founder-list li {
    padding: 12px 14px;
  }

  /* Cards objectifs & rejoindre : empiler icône + texte */
  .objectif-card {
    flex-direction: column;
    gap: 14px;
    padding: 22px 18px;
  }
  .rejoindre-card {
    flex-direction: column;
    gap: 14px;
    padding: 22px 18px;
  }

  /* Piliers mission */
  .mission-pillar {
    padding: 24px 18px;
  }

  /* Action cards */
  .action-card {
    padding: 22px 18px;
  }

  /* CTA rejoindre : bouton auto (pas 100%) */
  .rejoindre-cta .btn {
    width: auto;
    padding: 14px 28px;
  }

  /* Meta hero */
  .assoc-hero-meta {
    font-size: 0.78rem;
    flex-wrap: wrap;
    gap: 6px;
    text-align: center;
    justify-content: center;
  }
}

/* ──────────────────────────────────────────
   XS — < 480px  (très petits mobiles)
────────────────────────────────────────── */
@media (max-width: 480px) {

  /* Typographie */
  .hero-title {
    font-size: clamp(2rem, 11vw, 2.8rem);
  }
  h2 {
    font-size: clamp(1.6rem, 7vw, 2.4rem) !important;
  }

  /* Badge hero : multi-ligne */
  .hero-badge {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    line-height: 1.5;
  }

  /* Marque : cacher le texte, garder seulement le logo */
  .brand span {
    display: none;
  }
  .brand img {
    width: 42px;
    height: 42px;
  }

  /* Countdown : 2 colonnes */
  .countdown {
    grid-template-columns: repeat(2, 1fr);
  }
  .countdown strong {
    font-size: 1.4rem;
  }

  /* Cards 3 colonnes → 1 */
  .cards.three {
    grid-template-columns: 1fr;
  }

  /* Photo hero : carré sur très petits écrans */
  .hero-photo-frame {
    aspect-ratio: 1 / 1;
    min-height: 240px;
  }

  /* Floating card masquée */
  .float-card-1 {
    display: none;
  }

  /* Footer compact */
  .footer {
    padding: 40px 0;
  }
  .footer-grid {
    gap: 20px;
  }

  /* ════════════════════════════════════════
     PAGE ASSOCIATION — mobile xs
  ════════════════════════════════════════ */

  /* Stats bar compacte */
  .assoc-stats-bar {
    padding: 20px 0;
  }
  .assoc-stat-item strong {
    font-size: 1.3rem;
  }
  .assoc-stat-item span {
    font-size: 0.68rem;
  }

  /* Bloc fondateurs */
  .histoire-founders h3 {
    font-size: 1.2rem;
  }
  .founder-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.82rem;
  }

  /* Label de section */
  .section-label {
    font-size: 0.7rem;
  }

  /* Meta hero association */
  .assoc-hero-meta {
    font-size: 0.74rem;
    padding: 8px 14px;
  }

  /* Galerie */
  .gallery-strip img,
  .gallery-grid img {
    height: 180px;
  }
}
