/* =====================================================
   APSEC – Mobile / Responsive Overrides
   Ciblage : ≤ 1024px (tablette) et ≤ 640px (mobile)
   ===================================================== */

/* ────────────────────────────────────────────
   TABLETTE  (≤ 1024px)
──────────────────────────────────────────── */
@media (max-width: 1024px) {

  /* Grids 3 colonnes → 2 colonnes */
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
  }

  [style*="grid-template-columns:1.6fr 1fr 1fr"],
  [style*="grid-template-columns: 1.6fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: auto !important;
  }

  /* Grids 4 colonnes → 2 */
  [style*="grid-template-columns:1fr 1fr 1fr 1fr"],
  [style*="grid-cols-4"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 2rem !important; }

  /* Card split : panneau gauche moins large */
  .card-split { grid-template-columns: 100px 1fr !important; }
}


/* ────────────────────────────────────────────
   MOBILE  (≤ 640px)
──────────────────────────────────────────── */
@media (max-width: 640px) {

  /* ── Navbar ── */
  .navbar { padding: 0 1rem !important; }
  .nav-brand-text span { display: none; }

  /* ── Hero slider (responsive : image entière en haut, texte sur fond sombre) ── */
  .hero-slider { height: auto; min-height: 90svh; }
  .hs-slide {
    background-size: contain;
    background-position: top center;
    background-color: #0a1a0f;
  }
  /* Dégradé : transparent en haut (image visible), sombre en bas (texte lisible) */
  .hs-slide::after {
    background: linear-gradient(
      to bottom,
      rgba(5,30,10,0) 0%,
      rgba(5,30,10,.25) 42%,
      rgba(5,25,10,.85) 70%,
      rgba(3,18,8,.96) 100%
    ) !important;
  }
  .hs-content {
    padding: 1.2rem 1.2rem 2rem !important;
    justify-content: flex-end;
  }
  .hs-h1 { font-size: clamp(1.3rem, 5.5vw, 1.8rem) !important; margin-bottom: .7rem; }
  .hs-p  { font-size: .82rem !important; margin-bottom: 1rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hs-btns { gap: .6rem; }
  .hs-btns .btn { padding: .55rem 1rem !important; font-size: .8rem !important; }
  .hs-stats { bottom: 1rem; gap: .4rem; }
  .hs-stat  { padding: .45rem .8rem !important; font-size: .78rem; }
  .hs-stat span:last-child { display: none; }
  .hs-arrow { width: 38px !important; height: 38px !important; font-size: .9rem; }
  .hs-arrow.prev { left: .6rem; }
  .hs-arrow.next { right: .6rem; }

  /* ── Sections ── */
  .section { padding: 2.8rem 1rem !important; }
  .section-alt { padding: 2.8rem 1rem !important; }
  .container { padding: 0 .2rem; }
  .section-header { margin-bottom: 1.8rem !important; }
  .section-header h2 { font-size: 1.4rem !important; }

  /* ── Tous les grids → 1 colonne ── */
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1.6fr 1fr 1fr"],
  [style*="grid-template-columns: 1.6fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr auto"],
  [style*="grid-template-columns: 1fr auto"],
  [style*="grid-template-columns:2fr 1fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto !important;
  }

  /* Reset grid-row:span */
  [style*="grid-row:span"],
  [style*="grid-row: span"] {
    grid-row: auto !important;
  }

  /* ── Card H (horizontale) ── */
  .card-h { flex-direction: column; gap: 1rem; padding: 1.4rem !important; }
  .card-h-icon { width: 48px !important; height: 48px !important; }

  /* ── Card Grad ── */
  .card-grad { padding: 1.6rem !important; }
  .card-grad-icon { font-size: 1.8rem !important; }

  /* ── Card Feat ── */
  .card-feat { padding: 1.8rem 1.2rem !important; }

  /* ── Card Split ── */
  .card-split { grid-template-columns: 1fr !important; }
  .card-split-left { min-height: 80px !important; flex-direction: row; gap: 1rem; font-size: 1.8rem !important; padding: 1rem; }
  .card-split-right { padding: 1.2rem !important; }

  /* ── Card Num ── */
  .card-num { padding: 1.5rem !important; }
  .card-num-val { font-size: 2.2rem !important; }

  /* ── Timeline ── */
  .timeline { padding-left: 1.5rem; }
  .tl-body { padding: 1rem !important; }

  /* ── Actu mini ── */
  .actu-featured { grid-template-columns: 1fr !important; }
  .actu-side { margin-top: 0 !important; }
  .actu-mini { padding: .85rem 1rem; }

  /* ── Contact grid ── */
  .contact-grid { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
  .contact-info  { padding: 1.8rem 1.4rem !important; }
  .contact-form  { padding: 1.8rem 1.4rem !important; }
  .form-row { grid-template-columns: 1fr !important; }

  /* ── Don methods ── */
  .don-method { padding: 1.4rem !important; }

  /* ── Gallery ── */
  .gallery-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* ── Actu grid ── */
  .actu-grid { grid-template-columns: 1fr !important; }

  /* ── Partenaires ── */
  .partner-tag { font-size: .8rem; }

  /* ── Quick contacts bar (contact.html) ── */
  .grid.grid-cols-2.md\:grid-cols-4 { grid-template-columns: 1fr !important; }

  /* ── Impact grid (don.html) ── */
  .grid-cols-2.md\:grid-cols-5 { grid-template-columns: 1fr 1fr !important; }

  /* ── CTA section ── */
  [style*="grid-template-columns:1fr auto"] > *:last-child,
  [style*="grid-template-columns: 1fr auto"] > *:last-child {
    flex-direction: row !important;
    flex-wrap: wrap !important;
  }

  /* ── Footer ── */
  .footer { padding: 2.5rem 1rem 0 !important; }
  .footer-grid { grid-template-columns: 1fr !important; gap: 1.5rem !important; }
  .footer-brand p { max-width: 100% !important; }
  .footer-bottom { flex-direction: column; text-align: center; gap: .3rem; padding: 1rem 0; }

  /* ── Page hero (inner pages) ── */
  .page-top .page-hero { padding: 5rem 1.2rem 2.5rem !important; }
  .page-hero h1 { font-size: 1.6rem !important; }

  /* ── Boutons ── */
  .btn { font-size: .82rem; padding: .6rem 1.1rem; }
  .btn-sm { padding: .38rem .8rem !important; font-size: .76rem !important; }

  /* ── Domaines page ── */
  [style*="grid-template-columns:1fr"] .domain-card,
  .grid { gap: 1rem !important; }

  /* ── Valeurs – reset 2-col ── */
  [style*="grid-template-columns:1fr 1fr"][style*="align-items:center"] {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  /* ── Don: donation methods grid ── */
  .grid.grid-cols-1.sm\:grid-cols-2.lg\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* ── Galerie: filter buttons ── */
  .filter-btns { flex-wrap: wrap !important; gap: .4rem !important; }
  .filter-btn  { font-size: .75rem !important; padding: .3rem .7rem !important; }

  /* ── Modal ── */
  .modal-content { width: 95vw !important; padding: 1.2rem !important; }
}


/* ── Page hero photo mobile ── */
@media (max-width: 640px) {
  .page-hero-photo { min-height: 280px !important; }
}
  .php-content { padding: 5rem 1.2rem 2rem !important; }
  .php-content h1 { font-size: 1.5rem !important; }
  .php-content p  { font-size: .85rem !important; }
  .php-badge { top: .8rem; right: .8rem; font-size: .65rem !important; padding: .25rem .6rem !important; }

/* ────────────────────────────────────────────
   TRÈS PETIT  (≤ 380px)
──────────────────────────────────────────── */
@media (max-width: 380px) {
  .hs-h1 { font-size: 1.3rem !important; }
  .hs-btns { flex-direction: column; }
  .hs-btns .btn { width: 100%; justify-content: center; }
  .section { padding: 2.2rem .8rem !important; }
  .card-num-val { font-size: 1.9rem !important; }
  .gallery-grid { grid-template-columns: 1fr !important; }
  .footer-socials { justify-content: flex-start; }
}
