/* Corrections mobiles communes a toutes les pages (charge apres les styles de page) */
@media (max-width: 768px) {
  /* Etapes : pastille a gauche, titre puis texte empiles (le texte n'est plus coince ni coupe) */
  .steps__grid .step-tab {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 16px;
    row-gap: 6px;
    align-items: start;
  }
  .steps__grid .step-tab__badge { grid-row: 1 / span 2; }
  .steps__grid .step-tab__title { margin: 0; padding-top: 4px; }
  .steps__grid .step-tab__desc { grid-column: 2; max-width: none; max-height: none !important; }

  /* Blocs en carte : un seul rythme vertical de 48 px, jamais colles a une section voisine */
  .city-stats, .local-intro, .city-projects, .city-services, .city-coverage, .city-faq, .city-related {
    margin-top: 48px !important;
    margin-bottom: 48px !important;
  }
  .city-hero + .city-stats, .city-hero + .local-intro { margin-top: 32px !important; }

  /* Communes desservies (pages Aix / Annecy) : marges alignees sur les autres cartes, texte resserre */
  .city-subzones {
    margin: 48px 16px !important;
    padding: 0 !important;
  }
  .city-subzones__title { font-size: 1.5rem; line-height: 1.25; }
  .city-subzones__intro { font-size: .95rem; margin-bottom: 24px; }
  .city-subzones__grid { grid-template-columns: 1fr; gap: 16px; }
  .city-subzone { padding: 20px 16px; }
}

@media (max-width: 768px) {
  /* Pages sans menu burger (pages legales) : le menu est masque sur mobile, on garde au moins FR · EN */
  .nav:not(:has(.nav__burger)) .nav__links { display: flex !important; gap: 0; margin-left: auto; }
  .nav:not(:has(.nav__burger)) .nav__links > li:not(:has(.nav__lang)) { display: none !important; }
  /* Tableaux larges (politique cookies) : defilement horizontal dans le tableau, pas dans la page */
  .legal table, main > table, section > table, article table { display: block; overflow-x: auto; max-width: 100%; }
}

/* ── Barre de contact mobile (2026-10-15) ─────────────────────────────────
   Sur mobile, l'accueil n'offrait aucun lien de contact visible avant 9 écrans
   de défilement. Barre fixe : un seul bouton « Contact », masquée quand le menu
   est ouvert, sous le bandeau cookies (z-index 9998). ── */
.cta-mobile { display: none; }
@media (max-width: 768px) {
  .cta-mobile {
    display: flex;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9990;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(10, 10, 10, 0.88);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }
  .cta-mobile__btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 999px;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
  }
  /* une règle globale force tout le texte en blanc avec !important : on la surclasse ici */
  .cta-mobile .cta-mobile__btn { background: #FFFFFF; color: #0A0A0A !important; -webkit-text-fill-color: #0A0A0A; }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  body.menu-open .cta-mobile { display: none; }
  /* bandeau cookies ouvert : il remonte au-dessus de la barre au lieu de la recouvrir */
  .nv-consent { bottom: calc(78px + env(safe-area-inset-bottom)) !important; }
}

/* ── Haut de page mobile (2026-10-15) ─────────────────────────────────────
   Titre proportionné à l'écran, bloc texte ancré en bas à gauche, au-dessus
   de la barre « Contact » ; le paragraphe d'accroche est limité à 4 lignes. ── */
@media (max-width: 768px) {
  .city-hero { padding: 0 20px calc(92px + env(safe-area-inset-bottom)) !important; }
  .hero { padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important; }
  .snap-section--hero .snap-section__content { padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important; }
  .city-hero__label, .hero__subtitle {
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
    letter-spacing: 0.2em !important;
    margin: 0 0 12px !important;
  }
  .city-hero__title, .hero__title, .lb__title, .project-hero__title {
    font-size: clamp(1.9rem, 8.6vw, 2.5rem) !important;
    line-height: 1.02 !important;
    letter-spacing: -0.01em !important;
    margin: 0 0 16px !important;
  }
  .hero .hero__title { font-size: clamp(1.7rem, 7.4vw, 2.2rem) !important; }
  .city-hero__intro, .hero__desc, .hero__description {
    font-size: 0.95rem !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    max-width: 34em;
    display: -webkit-box !important;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Écran d'ouverture : jamais sur mobile. Le test JS en tête de page peut échouer avant que
   la balise viewport soit appliquée (loader de 2,4 s mesuré par PageSpeed le 2026-10-15). */
@media (max-width: 768px) { .loader-overlay { display: none !important; } }

/* Haut de page : pas de fondu d'entrée sur mobile, le texte s'affiche tout de suite
   (l'accroche apparaissait 0,7 s après le premier affichage). */
@media (max-width: 768px) {
  .hero__text, .hero__text-block, .hero__subtitle, .hero__title, .hero__desc, .hero__description,
  .city-hero__text, .city-hero__label, .city-hero__title, .city-hero__intro { animation: none !important; }
}
