/* ============================================================
   GéoClic Collectivités — Fondation commune (Lot A)
   Chargé en DERNIER sur toutes les pages intérieures :
   1. Palette V14 unifiée (remappe les variables des anciennes pages)
   2. Classes scroll-reveal partagées (pour les pages sans style.css)
   3. Hover cartes + accordéons FAQ
   ============================================================ */

/* ---------- 1. Palette V14 — source de vérité ---------- */
:root {
    --gc-blue: #0b63ce;
    --gc-blue-dark: #0757bd;
    --gc-navy: #08285a;
    --gc-green: #16a34a;
    --gc-orange: #f59e0b;
    --gc-orange-deep: #f97316;
    --gc-soft: #f4f8ff;
    --gc-border: rgba(12, 44, 89, .12);

    /* Remap des variables héritées (Gen A: #1565C0/#FF6F00, Gen C: #2563eb)
       — ce fichier étant chargé après les <style> inline, ces valeurs gagnent. */
    --primary: var(--gc-blue);
    --primary-dark: var(--gc-navy);
    --primary-light: #3b82f6;
    --accent: var(--gc-orange);
    --accent-soft: #fbbf24;
    --success: var(--gc-green);
}

/* ---------- 2. Scroll reveal (copie de style.css pour les pages qui ne le chargent pas) ---------- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms cubic-bezier(0.16, 1, 0.3, 1), transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left { transform: translateX(-30px); }
.reveal-right { transform: translateX(30px); }
.reveal-left.visible,
.reveal-right.visible { transform: translateX(0); }

.reveal-scale { transform: scale(0.95); }
.reveal-scale.visible { transform: scale(1); }

.stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger.visible > *:nth-child(1) { transition-delay: 0ms; }
.stagger.visible > *:nth-child(2) { transition-delay: 80ms; }
.stagger.visible > *:nth-child(3) { transition-delay: 160ms; }
.stagger.visible > *:nth-child(4) { transition-delay: 240ms; }
.stagger.visible > *:nth-child(5) { transition-delay: 320ms; }
.stagger.visible > *:nth-child(6) { transition-delay: 400ms; }

.stagger.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- 3. Hover discret sur les cartes (élévation + ombre) ---------- */
.grid > .card,
.module-card,
.price-card,
.tutorial-card,
.next-step-card,
.faq-item {
    transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.grid > .card:hover,
.module-card:hover,
.price-card:hover,
.tutorial-card:hover,
.next-step-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 22px 60px rgba(7, 27, 58, .11);
}

/* ---------- 4. Accordéons FAQ (details/summary avec chevron animé) ---------- */
.faq details,
.faq-list details,
details.faq-item {
    background: #fff;
    border: 1px solid var(--gc-border);
    border-radius: 14px;
    padding: 0;
    margin-bottom: 12px;
    overflow: hidden;
    transition: box-shadow 250ms ease;
}

.faq details[open],
.faq-list details[open],
details.faq-item[open] {
    box-shadow: 0 14px 38px rgba(7, 27, 58, .08);
}

.faq summary,
.faq-list summary,
details.faq-item summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    font-weight: 700;
    color: var(--gc-navy);
}

.faq summary::-webkit-details-marker,
.faq-list summary::-webkit-details-marker,
details.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq summary::after,
.faq-list summary::after,
details.faq-item summary::after {
    content: '';
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--gc-blue);
    border-bottom: 2px solid var(--gc-blue);
    transform: rotate(45deg);
    transition: transform 250ms ease;
}

.faq details[open] > summary::after,
.faq-list details[open] > summary::after,
details.faq-item[open] > summary::after {
    transform: rotate(-135deg);
}

.faq details > p,
.faq-list details > p,
details.faq-item > p {
    padding: 0 20px 16px;
    margin: 0;
    color: #475569;
}

/* ---------- 5. Habillage des pages piliers (Lot B) ---------- */
.pillar-illustration {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    border: 1px solid var(--gc-border);
}

.product-shot {
    margin: 30px auto;
    text-align: center;
}

.product-shot img {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--gc-border);
    box-shadow: 0 18px 50px rgba(7, 27, 58, .12);
}

.product-shot figcaption {
    margin-top: 12px;
    color: #64748b;
    font-size: .88rem;
}

.product-duo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    align-items: start;
    margin: 30px 0;
}

.product-duo .product-shot {
    margin: 0;
}

.product-shot--phone img {
    max-height: 460px;
    width: auto;
}

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: #e8f2ff;
    font-size: 1.35rem;
    margin-bottom: 12px;
}

/* Sommaire d'ancres (mentions légales) */
.toc-anchors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 30px;
    padding: 16px;
    background: var(--gc-soft);
    border: 1px solid var(--gc-border);
    border-radius: 14px;
}

.toc-anchors a {
    display: inline-block;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--gc-border);
    border-radius: 999px;
    color: var(--gc-blue);
    text-decoration: none;
    font-size: .86rem;
    font-weight: 700;
    transition: background 200ms ease, color 200ms ease;
}

.toc-anchors a:hover {
    background: var(--gc-blue);
    color: #fff;
}

.toc-anchors ~ h2[id],
h2[id] {
    scroll-margin-top: 90px;
}

/* Carte tarifaire recommandée (tarifs.html) — doit gagner sur la couche
   polish de style.css (!important) et sur le transform du stagger */
.pricing-card.recommended,
body:not(.home-modern) .pricing-card.recommended {
    border: 2px solid var(--gc-orange) !important;
    transform: scale(1.04) !important;
    box-shadow: 0 16px 44px rgba(245, 158, 11, 0.2) !important;
}

.pricing-card.recommended:hover,
body:not(.home-modern) .pricing-card.recommended:hover {
    transform: scale(1.04) translateY(-3px) !important;
    box-shadow: 0 20px 52px rgba(245, 158, 11, 0.28) !important;
}

/* Highlight box plus contrastée (anciennes pages SEO) */
.highlight-box {
    background: linear-gradient(135deg, #e8f2ff, #dbeafe) !important;
    border-left: 5px solid var(--gc-blue) !important;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(7, 27, 58, .08);
}

/* Bulles de chat — démo Q/R de l'assistant IA (hero-card) */
.hero-card .search-demo {
    display: block;
    width: fit-content;
    max-width: 88%;
    margin: 16px 0 14px auto;
    background: linear-gradient(135deg, var(--gc-blue), var(--gc-blue-dark));
    color: #fff;
    border: none;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 8px 22px rgba(11, 99, 206, .25);
    font-weight: 600;
}

.hero-card .answer {
    display: block;
    width: fit-content;
    max-width: 92%;
    margin-right: auto;
    background: #fff;
    border: 1px solid var(--gc-border);
    border-left: 1px solid var(--gc-border);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 8px 22px rgba(7, 27, 58, .08);
    color: #17365f;
}

.hero-card .answer strong {
    color: var(--gc-blue);
}

/* ---------- 6. Respect des préférences utilisateur ---------- */
@media (prefers-reduced-motion: reduce) {
    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .stagger > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .grid > .card,
    .module-card,
    .price-card,
    .tutorial-card,
    .next-step-card {
        transition: none;
    }
}

/* ============================================================
   7. Mobile (Lot P0) — menu burger universel des pages
      intérieures, garde anti-débordement, tableaux défilables.
      L'accueil (body.home-modern) garde son propre dispositif
      (modern-home.css / modern-home.js) — rien ici ne le touche.
   ============================================================ */

/* ---------- 7.1 Bouton burger ----------
   Masqué par défaut (desktop). Stylé ici pour les pages qui ne
   chargent PAS style.css (demo-ia, tarifs-ia, video, sig-commune…).
   Le JS (animations.js) l'injecte dans la barre de navigation. */
.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 12px;
    border: 1px solid var(--gc-border);
    background: #fff;
    color: var(--gc-navy);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(7, 27, 58, .08);
}
.nav-toggle:hover { background: var(--gc-soft); }
.nav-toggle:focus-visible { outline: 2px solid var(--gc-blue); outline-offset: 2px; }

/* Le conteneur qui héberge logo + menu ancre le panneau déroulant */
.gc-mnav-host { position: relative; }

@media (max-width: 860px) {
    /* Affiche le burger sur toutes les pages intérieures */
    body:not(.home-modern) .nav-toggle { display: inline-flex !important; }

    /* Le menu devient un panneau déroulant sous la barre.
       Les !important neutralisent le display:none inline (768px)
       et le « flex:1 0 100%; overflow-x:auto » de style.css (860px). */
    body:not(.home-modern) .nav-links {
        display: none !important;
        position: absolute !important;
        top: calc(100% + 12px) !important;
        left: 0 !important;
        right: 0 !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 4px !important;
        margin: 0 !important;
        padding: 12px !important;
        background: #fff !important;
        border: 1px solid var(--gc-border) !important;
        border-radius: 16px !important;
        box-shadow: 0 24px 70px rgba(7, 27, 58, .18) !important;
        flex: 0 1 auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        max-height: calc(100vh - 90px) !important;
        z-index: 1001 !important;
    }
    body:not(.home-modern) .nav-links.is-open { display: flex !important; }

    body:not(.home-modern) .nav-links a {
        display: block !important;
        width: 100% !important;
        padding: 12px 14px !important;
        border-radius: 10px !important;
        font-size: 1rem !important;
        text-align: left !important;
    }
    body:not(.home-modern) .nav-links a:hover { background: var(--gc-soft) !important; }
    /* Le CTA (« Demander une démo ») en pleine largeur, centré */
    body:not(.home-modern) .nav-links a.btn {
        text-align: center !important;
        margin: 6px 0 0 0 !important;
    }
}

/* ---------- 7.2 Garde anti-débordement horizontal ----------
   Empêche le scroll latéral parasite sur mobile (maquettes à
   largeur fixe, blocs larges…). Scopé ≤860px pour ne pas casser
   les en-têtes de tableau « sticky » en desktop. */
@media (max-width: 860px) {
    body:not(.home-modern) { overflow-x: hidden; }
    body:not(.home-modern) pre { max-width: 100%; overflow-x: auto; }
}

/* ---------- 7.3 Tableaux larges défilables sur mobile ----------
   Couvre .comparison-table, .compare-table et les <table> sans
   classe. display:block + overflow-x:auto rend le tableau
   défilable horizontalement sans déborder la page. */
@media (max-width: 860px) {
    body:not(.home-modern) table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Neutralise le sticky (top:76px) calé sur la nav desktop */
    body:not(.home-modern) table th { position: static !important; }
}

/* ============================================================
   8. Mobile (Lot P1) — effondrement universel des grilles
      multi-colonnes + sécurités (images, titres).
      Couvre toutes les pages intérieures qui chargent site.css.
      Deux paliers : ≤768px (tablette portrait / grand mobile) et
      ≤560px (mobile). Les !important priment sur les @media inline
      de chaque page (souvent un seul, et incomplet).
   ============================================================ */

/* ---------- 8.1 Blocs 2 colonnes & héros → 1 colonne dès 768px ---------- */
@media (max-width: 768px) {
    body:not(.home-modern) .hero-inner,
    body:not(.home-modern) .feature-block,
    body:not(.home-modern) .contact-grid,
    body:not(.home-modern) .pricing-grid,
    body:not(.home-modern) .usp-grid,
    body:not(.home-modern) .process,
    body:not(.home-modern) .module-grid,
    body:not(.home-modern) .apps-info,
    body:not(.home-modern) .services-2col {
        grid-template-columns: 1fr !important;
    }

    /* Grilles de cartes 3+ colonnes → 2 colonnes sur grand mobile */
    body:not(.home-modern) .cards3,
    body:not(.home-modern) .grid,
    body:not(.home-modern) .pricing-preview,
    body:not(.home-modern) .savings-grid,
    body:not(.home-modern) .why-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    /* Barre de stats : reste compacte sur 2 colonnes */
    body:not(.home-modern) .stats-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    /* Section « tout-en-un » (tarifs) en colonne */
    body:not(.home-modern) .tout-en-un { flex-direction: column !important; text-align: center; }
}

/* ---------- 8.2 Mobile strict : tout en 1 colonne dès 560px ---------- */
@media (max-width: 560px) {
    body:not(.home-modern) .cards3,
    body:not(.home-modern) .grid,
    body:not(.home-modern) .pricing-preview,
    body:not(.home-modern) .savings-grid,
    body:not(.home-modern) .why-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ---------- 8.3 Sécurités images & titres ---------- */
/* Aucune image ne déborde (filet ; n'altère pas le logo en width:auto) */
body:not(.home-modern) img { max-width: 100%; }

@media (max-width: 768px) {
    /* Titres d'en-tête fluides pour les pages qui ne les réduisent pas */
    body:not(.home-modern) .page-header h1 {
        font-size: clamp(1.6rem, 6.2vw, 2.2rem) !important;
        line-height: 1.15 !important;
    }
}

/* ============================================================
   9. Mobile (Lot P2) — finition : maquettes fluides, anti-
      débordement de texte, densité (espacements), en-têtes.
      Toujours scopé body:not(.home-modern) → zéro impact desktop
      ni sur l'accueil.
   ============================================================ */

/* ---------- 9.1 Maquettes jamais plus larges que l'écran ----------
   Filet de sécurité : avec la garde overflow-x:hidden (§7.2) une
   maquette à largeur fixe serait coupée au lieu de déborder.
   max-width:100% ne réduit que si nécessaire (sans toucher aux
   maquettes déjà fluides). */
body:not(.home-modern) .feature-device,
body:not(.home-modern) .feat-phone,
body:not(.home-modern) .product-shot,
body:not(.home-modern) .product-shot--phone,
body:not(.home-modern) .product-mockup,
body:not(.home-modern) .product-phone,
body:not(.home-modern) .phone-screen,
body:not(.home-modern) .city-phone,
body:not(.home-modern) .city-phone-frame,
body:not(.home-modern) .city-phone-stage {
    max-width: 100% !important;
}

/* ---------- 9.2 Longues chaînes (URL, e-mails) : coupure propre ----------
   Évite qu'une URL/adresse non sécable pousse la page latéralement
   (mentions légales, contact, pieds de page). Sans effet visible
   en desktop (ne casse que ce qui déborderait). */
body:not(.home-modern) { overflow-wrap: break-word; }

/* ---------- 9.3 Densité & en-têtes sur mobile ---------- */
@media (max-width: 768px) {
    /* Réduit l'espace mort sous la barre fixe en haut des pages.
       Tous les .page-header ont un padding-top de 90–140px (réservé
       à la nav fixe) → 92px suffit à dégager la nav partout. */
    body:not(.home-modern) .page-header { padding-top: 92px !important; }
}

@media (max-width: 560px) {
    /* Sections un peu plus denses sur petit écran (moins de blanc). */
    body:not(.home-modern) .section {
        padding-top: 44px !important;
        padding-bottom: 44px !important;
    }
}
