/* Adaptations petits écrans (téléphones) — surcharge les réglages "ordinateur" en ligne */
@media (max-width: 860px) {
  /* Bandeau d'urgence du haut */
  .topbar .topbar-msg { display: none !important; }
  .topbar .wrap { justify-content: center !important; padding-top: 7px !important; padding-bottom: 7px !important; }

  /* En-tête : logo + titre compacts, bouton menu toujours visible */
  [data-header] .wrap { padding: 8px 16px !important; gap: 10px !important; flex-wrap: nowrap !important; }
  .brand { flex: 1 1 auto !important; min-width: 0 !important; gap: 10px !important; }
  .brand img { width: 46px !important; height: 46px !important; }
  .brand-title { font-size: 14.5px !important; white-space: normal !important; line-height: 1.15 !important; }
  .brand-tag { display: none !important; }
  .hamburger-btn { flex-shrink: 0 !important; margin-left: auto !important; }

  /* Sections : marges verticales réduites */
  [style*="padding:150px 0"], [style*="padding:140px 0"], [style*="padding:130px 0"], [style*="padding:120px 0"] { padding-top: 64px !important; padding-bottom: 64px !important; }
  [style*="padding:100px 0 140px"], [style*="padding:0 0 140px"], [style*="padding:80px 0 150px"] { padding-bottom: 72px !important; }
  [style*="padding:100px 0 0"], [style*="padding:150px 0 0"] { padding-top: 56px !important; }
  [style*="padding:90px 0"] { padding-top: 56px !important; padding-bottom: 56px !important; }
  .page-hero { padding: 64px 0 44px !important; }

  /* Titres */
  [style*="font-size:44px"], [style*="font-size:42px"], [style*="font-size:40px"] { font-size: 30px !important; line-height: 1.15 !important; }
  [style*="font-size:38px"], [style*="font-size:36px"], [style*="font-size:34px"], [style*="font-size:32px"] { font-size: 26px !important; line-height: 1.2 !important; }
  h1 { word-break: normal; overflow-wrap: anywhere; }
  .ghost-num { font-size: 90px !important; }

  /* Espacements entre blocs */
  [style*="gap:90px"], [style*="gap:80px"], [style*="gap:70px"], [style*="gap:60px"], [style*="gap:56px"], [style*="gap:48px"], [style*="gap:44px"], [style*="gap:40px"] { gap: 26px !important; }
  [style*="row-gap:64px"], [style*="row-gap:56px"], [style*="row-gap:48px"], [style*="row-gap:44px"] { row-gap: 30px !important; }

  /* Rangées "icône + titre + texte + lien" : on empile */
  [style*="display:flex"][style*="gap:44px"] { flex-direction: column !important; align-items: flex-start !important; gap: 14px !important; }
  [style*="width:200px"] { width: auto !important; }
  [style*="width:240px"] { width: 100% !important; }

  /* Cartes et blocs à grosses marges internes */
  [style*="padding:56px"], [style*="padding:52px"], [style*="padding:44px"] { padding: 22px !important; }
  [style*="padding:26px 40px"] { padding: 18px 20px !important; }
  [style*="padding:26px 150px 26px 40px"], [style*="padding:26px 40px 26px 150px"] { padding: 18px 20px !important; }

  /* Accueil : bloc principal */
  .hero-deco { display: none !important; }
  .hero-content { padding: 64px 20px 32px !important; max-width: 100% !important; }
  .hero-content h1 { font-size: clamp(38px, 12vw, 52px) !important; }
  .hero-content .hero-sub { font-size: clamp(34px, 10.5vw, 46px) !important; }
  .hero-content > p.h-serif { font-size: 20px !important; margin-top: 26px !important; }

  /* Textes minuscules : lisibles au doigt */
  [style*="font-size:9.5px"], [style*="font-size:10px"], [style*="font-size:10.5px"] { font-size: 11px !important; }

  /* Boutons d'action : pleine largeur, faciles à toucher */
  a[style*="padding:15px 28px"], a[style*="padding:15px 26px"], .form-submit { width: 100% !important; justify-content: center !important; text-align: center !important; }
  [style*="flex-shrink:0"][class*="link-u"] { flex-shrink: 1 !important; }
  .link-u { white-space: normal !important; }

  /* Tableaux et longues lignes */
  table { font-size: 12.5px; }
  img { max-width: 100%; }
}

@media (max-width: 420px) {
  .wrap { padding-left: 16px !important; padding-right: 16px !important; }
  [style*="padding:56px"], [style*="padding:52px"], [style*="padding:44px"] { padding: 18px !important; }
}

@media (max-width: 860px) {
  /* Grands vides sous les introductions de section */
  [style*="margin:0 0 96px"], [style*="margin:0 0 90px"], [style*="margin:0 0 88px"], [style*="margin:0 0 80px"], [style*="margin:0 0 76px"], [style*="margin:0 0 70px"], [style*="margin:0 0 76px"] { margin-bottom: 34px !important; }
  [style*="margin-bottom:100px"], [style*="margin-bottom:96px"], [style*="margin-bottom:90px"], [style*="margin-bottom:88px"], [style*="margin-bottom:80px"], [style*="margin-bottom:76px"], [style*="margin-bottom:70px"] { margin-bottom: 34px !important; }
  [style*="margin-top:100px"], [style*="margin-top:76px"] { margin-top: 40px !important; }
  [style*="margin:0 0 60px"] { margin-bottom: 30px !important; }

  /* Photo + carte « nom » : la carte reste dans l'écran et respire */
  [style*="bottom:-20px"][style*="left:-20px"] { left: 0 !important; bottom: -24px !important; max-width: 92% !important; }
  [style*="grid-template-columns:0.85fr 1.15fr"] { gap: 56px !important; }

  /* Bandeau d'urgence : icône au-dessus du texte pour garder toute la largeur */
  [style*="display:flex"][style*="gap:22px"] { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
  [style*="padding:14px 26px;border:1px solid var(--red)"] { width: 100% !important; justify-content: center !important; }
}

/* Écrans intermédiaires (petits ordinateurs, tablettes) : menu compact dès que la place manque */
@media (max-width: 1380px) {
  nav#mainNav { display: none !important; }
  #headerCta { display: none !important; }
  .hamburger-btn { display: flex !important; align-items: center; justify-content: center; margin-left: auto; flex-shrink: 0; }
  [data-header] .wrap { flex-wrap: nowrap !important; }
  .brand { min-width: 0; }
}

@media (max-width: 860px) {
  /* Recherche d'articles et bouton 3114 : pleine largeur */
  #articleSearch { width: 100% !important; }
  div:has(> #articleSearch) { width: 100% !important; }
  [style*="flex-direction:column"][style*="flex-shrink:0"] { width: 100% !important; }
}

/* Fluidité au défilement */
/* Calque de "grain" plein écran : quasi invisible mais coûteux à dessiner */
svg[style*="position:fixed"][style*="opacity:.5"] { display: none !important; }

/* Téléphones et tablettes : le contenu est visible immédiatement, sans effet d'apparition */
@media (max-width: 1380px) {
  .wrap:has(.kicker), .wrap:has(.kicker) .medal, .wrap:has(.kicker) .chip, .wrap:has(.kicker) .card, .wrap:has(.kicker) .badge {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
  .kicker { animation: none !important; }
  .magnetic { will-change: auto !important; }
}

/* Personnes qui demandent moins d'animations */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .wrap:has(.kicker), .wrap:has(.kicker) .medal { opacity: 1 !important; transform: none !important; }
}
