/* ==========================================================================
   MOBILE & TABLETTE — corrections communes, chargees en dernier (partials/header.html)
   - aucun texte sous 11 px, aucune zone qui deborde de l'ecran
   - marges laterales regulieres, textes alignes a gauche sur telephone
   - zones tactiles d'au moins 44 px
   ========================================================================== */

/* ==========================================================================
   OR « METAL POLI » (le degrade du carrousel de l'accueil)
   Reserve aux grands titres dores et aux boutons principaux ; partout ailleurs,
   l'or champagne uni (#B49A58) et ses declinaisons.
   ========================================================================== */
:root { --or-poli: linear-gradient(135deg, #A99220 0%, #EFE6B4 50%, #A99220 100%); }

/* Grands titres dores : sous-titres des hauts de page, titres en or */
:is(.service-hero-video, .front-hero-minimal) h1 span,
.asst-section-title span,
.faq-contact-box h3,
.mobile-content h2,
.sim-wrapper h2 span, .gold-text {
    background: var(--or-poli);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #B49A58;
}

/* Boutons principaux : la lumiere glisse au survol */
.hero-cta-primary,
.main-header .cta-devis,
.sol-cta-btn,
#mobile-devis-btn,
.mm-btn-gold {
    background: var(--or-poli) !important;
    background-size: 220% 100% !important;
    background-position: 0% 50% !important;
    color: #0B243E !important;
    transition: background-position 0.6s ease, transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease !important;
}
.hero-cta-primary:hover,
.main-header .cta-devis:hover,
.sol-cta-btn:hover,
#mobile-devis-btn:active,
.mm-btn-gold:active {
    background: var(--or-poli) !important;
    background-size: 220% 100% !important;
    background-position: 100% 50% !important;
    color: #0B243E !important;
}

/* Liens et cartes cliquables : pas de cadre ni de soulignement au clic ou au toucher.
   Le cadre dore reste affiche pour la navigation au clavier (accessibilite). */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
[role="button"]:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none;
}
a:has(h1, h2, h3, h4),
a:has(h1, h2, h3, h4):hover,
a:has(h1, h2, h3, h4):focus,
a:has(h1, h2, h3, h4):active,
h1 a, h2 a, h3 a, h4 a,
:is(h1, h2, h3, h4) a:is(:hover, :focus, :active) {
    text-decoration: none;
}
a, button { -webkit-tap-highlight-color: transparent; }

/* Textes justifies sur mobile et tablette : coupure automatique des mots (en francais) en fin de ligne,
   pour que le texte remplisse la largeur sans creer de grands espaces entre les mots */
html body p.is-hyph.is-hyph.is-hyph.is-justified.is-justified,
html body li.is-hyph.is-hyph.is-hyph.is-justified.is-justified {
    text-align: justify !important;
    text-align-last: left !important;
}
html body p.is-hyph.is-hyph.is-hyph.is-justified-center.is-justified-center {
    text-align: justify !important;
    text-align-last: center !important;
}
.is-hyph.is-hyph.is-hyph {
    -webkit-hyphens: auto !important;
    hyphens: auto !important;
    hyphenate-limit-chars: 7 3 3;
    -webkit-hyphenate-limit-before: 3;
    -webkit-hyphenate-limit-after: 3;
}

/* Mots longs (adresses mail, liens) : retour a la ligne plutot que debordement */
body { overflow-wrap: break-word; }
img, video, iframe { max-width: 100%; }

/* Menu ouvert : les boutons flottants (appel, devis, boussole) s'effacent */
html.menu-is-open #mobile-devis-btn,
html.menu-is-open #mobile-call-btn,
html.menu-is-open #mobile-aurum-btn,
html.menu-is-open #mobile-aurum-menu {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Petites etiquettes (pastilles, numeros, badges) : jamais sous 11 px, quel que soit l'ecran */
.pc-ess, .pq-stamp, .pk-stamp, .pc-top { font-size: 11px !important; letter-spacing: 1px !important; }
.pk-band-label { font-size: 11px !important; letter-spacing: 2px !important; }
.audit-versus-tile-label, .adn-vision-step-number,
.contact-form-section .contact-badge,
.partner-card-class, .partner-card-footer, .adn-rem-ref,
.faq-badge, .date-badge { font-size: 11px !important; }

/* Agenda Calendly : le widget imposait 320 px minimum, plus large que l'ecran une fois les marges retirees */
.calendly-inline-widget { min-width: 0 !important; }

/* ==========================================================================
   TABLETTE ET MOBILE (<= 1024 px)
   ========================================================================== */
@media (max-width: 1024px) {
    /* Grilles : une colonne ne peut jamais etre plus large que son conteneur */
    .page-adn .adn-valeurs-list { grid-template-columns: minmax(0, 1fr) !important; }
    .ad-layout, .ad-aside { min-width: 0; }
    .ad-aside > * { min-width: 0; }
    .avl-statement-grid, .avl-triangle-grid, .avl-quiz-grid { grid-template-columns: minmax(0, 1fr) !important; }

    /* Simulateurs : la grille ne doit jamais depasser l'ecran (les montants saisis etaient coupes) */
    .sim-wrapper { grid-template-columns: minmax(0, 1fr) !important; }
    .sim-wrapper > * { min-width: 0; }
    .sim-wrapper input, .sim-wrapper select { min-width: 0; max-width: 100%; }
}

/* Simulateur budget (resultats sous le formulaire jusqu'a 1100 px) : tableau et encart lisibles */
@media (max-width: 1100px) {
    .res-table th { font-size: 11px !important; }
    .res-table td { font-size: 13px !important; }
    .ratio-label { font-size: 11px !important; letter-spacing: 0.5px !important; }
    .budget-chart-legend { font-size: 12px !important; }
    .promo-coaching p { font-size: 13px !important; }
    .btn-promo, .btn-promo-outline { font-size: 12px !important; }
    .sim-wrapper [style*="font-size:0.55rem"] { font-size: 11px !important; }
}

/* ==========================================================================
   CARTES ETROITES (<= 1180 px)
   ========================================================================== */
@media (max-width: 1180px) {
    /* Assurances particuliers : la pastille « Essentielle » chevauchait le titre quand la carte est etroite.
       Elle se pose desormais a cheval sur le filet superieur de la carte. */
    .pc-ess {
        top: -8px !important;
        right: auto !important;
        left: 50% !important;
        transform: translateX(-50%);
        background: #ffffff;
        white-space: nowrap;
        line-height: 1.4;
    }
}

/* ==========================================================================
   TABLETTE (640 a 1024 px : iPad portrait et paysage, grands telephones a plat)
   ========================================================================== */
@media (min-width: 640px) and (max-width: 1024px) {
    /* Haut des pages services : texte d'accroche sur une largeur confortable, boutons sur une ligne */
    :is(.service-hero-video, .front-hero-minimal) .hero-lead { max-width: 600px !important; margin-left: auto !important; margin-right: auto !important; }
    :is(.service-hero-video, .front-hero-minimal) .hero-text-center { padding-left: 40px !important; padding-right: 40px !important; }
    :is(.service-hero-video, .front-hero-minimal) .hero-cta-group > a { min-width: 220px !important; white-space: nowrap; }

    /* Accueil : profils clients en 2 colonnes (le 3e centre dessous), atouts en 2 x 2 */
    body.home .clients-grid {
        max-width: 720px !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 24px !important;
    }
    body.home .clients-grid > * { grid-column: span 2; }
    body.home .clients-grid > :nth-child(3):last-child { grid-column: 2 / span 2; }
    body.home .benefits-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; max-width: 720px !important; }
    body.home .intro-content > p { max-width: 640px; margin-left: auto; margin-right: auto; }
    body.home .benefit-item { padding: 28px 24px 26px !important; }
}

/* ==========================================================================
   MOBILE (<= 768 px)
   ========================================================================== */
@media (max-width: 768px) {

    /* --- Lisibilite : plus aucune etiquette sous 11 px ------------------- */
    html body a.slide-btn { font-size: 12px !important; letter-spacing: 1px !important; }
    html body .slide-content .slide-btn { font-size: 12px !important; letter-spacing: 1px !important; padding: 12px 16px !important; }
    html body .slide-content p { font-size: 15px !important; line-height: 1.5 !important; letter-spacing: 0.2px !important; }
    body.home .blog-card .card-tag, .card-tag { font-size: 11px !important; }
    .back-link { font-size: 12px !important; }
    /* Petites mentions ecrites directement dans les pages (badges, notes) */
    main [style*="font-size: 0.7rem"], main [style*="font-size: 0.72rem"],
    main [style*="font-size: 0.75rem"], main [style*="font-size: 0.65rem"],
    main [style*="font-size: 0.6rem"],
    .sim-wrapper [style*="font-size:0.55rem"] { font-size: 11px !important; }

    /* Simulateurs : marges laterales regulieres */
    html body .sim-wrapper > .sim-input-section,
    html body .sim-wrapper > .sim-result-section { padding-left: 16px !important; padding-right: 16px !important; }
    .budget-chart-block { flex-wrap: wrap !important; justify-content: center !important; gap: 18px !important; }
    .budget-chart-block > * { min-width: 0; }



    /* --- Frise des SCPI / assurance-vie / PEA : etiquettes sur 2 lignes --- */
    .ed-tl-mark {
        width: 84px;
        white-space: normal !important;
        text-align: center;
        font-size: 11px !important;
        line-height: 1.25;
        letter-spacing: 0.3px !important;
    }
    .ed-tl-mark:nth-child(2) { width: auto; white-space: nowrap !important; text-align: left; }
    .ed-tl-mark:nth-child(3) { transform: translateX(-30%); }
    .ed-tl-mark:nth-child(3)::after { left: 30%; }
    .ed-tl-mark:last-child { transform: translateX(-70%); }
    .ed-tl-mark:last-child::after { left: 70%; }
    .ed-tl-track { margin-top: 56px !important; margin-bottom: 58px !important; }


    /* --- Pages legales : titre du sommaire aligne a gauche ---------------- */
    .legal-toc-title.legal-toc-title.legal-toc-title { text-align: left; }

    /* --- Bilan de prevoyance : le titre d'introduction touchait les bords - */
    .prev-intro-section .section-header { padding-left: 20px; padding-right: 20px; }

    /* --- ADN : liste des valeurs, marges internes allegees ----------------- */
    .page-adn .adn-valeurs-list { padding-left: 0 !important; padding-right: 0 !important; }

    /* --- Accueil : tuiles « objectifs » moins hautes ---------------------- */
    body.home .need-card { min-height: 0 !important; padding: 22px 52px 22px 22px !important; }
    body.home .need-card::after { top: 50%; transform: translateY(-50%); }
    body.home .need-card:hover::after { transform: translate(4px, -50%); }

    /* --- Devis : bandeau de logos aligne sur les marges de la page ------- */
    .devis-hero ~ .devis-partners .devis-logos { margin: 0 -16px !important; padding: 4px 16px 10px !important; }

    /* --- Zones tactiles ---------------------------------------------------- */
    .bb-backlink { display: inline-flex !important; align-items: center; min-height: 44px; }
}

/* ==========================================================================
   PETITS TELEPHONES (<= 380 px : iPhone SE, mini, petits Android)
   ========================================================================== */
@media (max-width: 380px) {
    .ed-tl-mark { width: 74px; letter-spacing: 0 !important; }
}

/* ==========================================================================
   BOUTONS FLOTTANTS (appel, devis, outils) — mobile et tablette
   Script : floating-actions.js
   ========================================================================== */
@media (max-width: 1024px) {
    /* Caches tant que le haut de page occupe l'ecran */
    html.fab-in-hero #mobile-call-btn,
    html.fab-in-hero #mobile-aurum-btn {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translateY(20px) !important;
    }
    html.fab-in-hero #mobile-devis-btn {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translate(-50%, 20px) !important;
    }
    html.fab-in-hero #mobile-aurum-menu { display: none !important; }

    /* Bouton de droite : quatre points dores (les outils), qui deviennent une croix a l'ouverture */
    html body #mobile-aurum-btn { animation: none; transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s !important; }
    .fab-tools-icon { position: relative; display: grid; grid-template-columns: 5px 5px; gap: 4px; }
    .fab-tools-icon i { width: 5px; height: 5px; border-radius: 50%; background: #D8C69A; transition: opacity 0.2s, transform 0.25s; }
    .fab-tools-icon::before, .fab-tools-icon::after {
        content: ""; position: absolute; left: 50%; top: 50%;
        width: 16px; height: 1.5px; margin: -0.75px 0 0 -8px;
        background: #D8C69A; opacity: 0; transition: opacity 0.2s, transform 0.25s;
    }
    #mobile-aurum-btn.is-open .fab-tools-icon i { opacity: 0; transform: scale(0.4); }
    #mobile-aurum-btn.is-open .fab-tools-icon::before { opacity: 1; transform: rotate(45deg); }
    #mobile-aurum-btn.is-open .fab-tools-icon::after { opacity: 1; transform: rotate(-45deg); }

    /* Panneau « Outils gratuits » */
    html body #mobile-aurum-menu {
        right: 16px !important;
        bottom: 76px !important;
        width: min(320px, calc(100vw - 32px));
        min-width: 0 !important;
        padding: 18px 18px 16px !important;
        background: #0B243E !important;
        border: 1px solid rgba(180, 154, 88, 0.45) !important;
        border-radius: 20px !important;
        box-shadow: 0 24px 60px rgba(11, 36, 62, 0.4) !important;
        transform-origin: bottom right;
    }
    html body #mobile-aurum-menu.open { animation: fabToolsIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
    @keyframes fabToolsIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }

    .fab-tools-eyebrow {
        display: flex; align-items: center; gap: 10px;
        margin: 0 0 6px !important;
        font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 600;
        letter-spacing: 2.5px; text-transform: uppercase; color: #D8C69A;
        text-align: left !important;
    }
    .fab-tools-eyebrow::before { content: ""; width: 22px; height: 1px; background: #B49A58; }

    .fab-tool {
        display: flex !important; align-items: center; justify-content: space-between; gap: 12px;
        min-height: 56px; padding: 8px 0;
        border-bottom: 1px solid rgba(180, 154, 88, 0.22);
        text-decoration: none; text-align: left !important;
        -webkit-tap-highlight-color: transparent;
    }
    .fab-tool span { display: grid; gap: 2px; }
    .fab-tool strong { font-family: 'Playfair Display', Georgia, serif; font-size: 17px; font-weight: 700; color: #ffffff; }
    .fab-tool small { font-family: 'Montserrat', sans-serif; font-size: 12.5px; color: rgba(255, 255, 255, 0.62); }
    .fab-tool em { font-style: normal; color: #B49A58; font-size: 16px; transition: transform 0.2s; }
    .fab-tool:active strong { color: #D8C69A; }
    .fab-tool:active em { transform: translateX(4px); }

    .fab-tools-cta {
        display: flex !important; align-items: center; justify-content: center;
        min-height: 46px; margin-top: 14px;
        border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 999px;
        font-family: 'Montserrat', sans-serif; font-size: 13.5px; font-weight: 600;
        color: #ffffff; text-decoration: none;
    }
    .fab-tools-cta:active { border-color: #D8C69A; color: #D8C69A; }
}
@media (max-width: 480px) {
    html body #mobile-aurum-menu { right: 12px !important; bottom: 68px !important; width: calc(100vw - 24px); }
}

/* ==========================================================================
   TELEPHONES (<= 600 px) : une seule marge laterale et des cartes plus larges
   Les marges de la section, du conteneur, de la grille et de la carte s'additionnaient
   (jusqu'a 85 px de chaque cote) : le texte des cartes n'avait plus que 200 a 260 px.
   ========================================================================== */
@media (max-width: 600px) {
    /* 1. Une seule marge de 16 px par section (hors hauts de page, carrousels et bandeaux pleine largeur) */
    main > section:not(.service-hero-video):not(.front-hero-minimal):not(.sol-hero):not(.slider-container):not(.partners-section):not(.sol-marquee):not(.bl-hero):not(.bb-hero):not(.ad-hero) {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    main > section:not(.service-hero-video):not(.front-hero-minimal):not(.sol-hero):not(.slider-container):not(.partners-section):not(.sol-marquee):not(.bl-hero):not(.bb-hero):not(.ad-hero) :is(.container, .container-narrow, .eng-grid-container, .devis-container, .ed-wrap, .bl-wrap, .bb-wrap, .ad-wrap, .ac-wrap, .sm-wrap, .legal-container) {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    main > #intro-focus.asst-intro-section, main > #intro-focus.ins-intro, main > #intro-focus[class] { padding-left: 16px !important; padding-right: 16px !important; }

    /* 2. Cartes : marges interieures de 20 px */
    .eng-card, .benefit-item, .asst-card, .asst-card-intro, .asst-card-step, .deliverable-card,
    .prev-checklist-item, .timeline-item, .audit-arc-step, .audit-versus-stage, .finance-journey-content,
    .asst-admin-path-step, .asst-admin-role-col, .asst-admin-folder-body, .front-credibility-block, .shore,
    .prevoy-path-step, .prevoy-timeline-content, .ed-tl-card, .aisle-card, .bb-cta-card, .histoire-note,
    .adn-valeur-row, .adn-partner-offer-inner, .contact-box-immersive, .intro-text {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

/* Courtage en financement, « Notre methode » sur telephone : numero a gauche, carte sur toute la largeur restante,
   identique pour toutes les etapes (les etapes paires etaient decalees de 56 px et sortaient de l'ecran) */
@media (max-width: 600px) {
    .page-financement .finance-journey-line { padding-left: 0 !important; }
    .page-financement .finance-journey-line::before { left: 22px !important; }
    .page-financement .finance-journey-item,
    .page-financement .finance-journey-item:nth-child(even) {
        grid-template-columns: 44px minmax(0, 1fr) !important;
        column-gap: 14px !important;
    }
    .page-financement .finance-journey-number {
        grid-column: 1 !important;
        grid-row: 1 !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 1rem !important;
        margin: 0 !important;
    }
    .page-financement .finance-journey-item .finance-journey-content,
    .page-financement .finance-journey-item:nth-child(even) .finance-journey-content {
        grid-column: 2 !important;
        grid-row: 1 !important;
        margin: 0 !important;
        padding: 18px 18px !important;
    }
}

/* ==========================================================================
   PAGES SOLUTIONS SUR TELEPHONE : schemas et curseurs
   ========================================================================== */
@media (max-width: 600px) {
    /* Schemas : affiches a une taille lisible (textes d'au moins 11 px), dans un cadre qu'on fait glisser */
    .ed-diagram::before {
        content: "Faites glisser le schéma →";
        display: block;
        margin: 0 0 10px;
        font-family: 'Montserrat', sans-serif;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.5px;
        color: #806a33;
        text-align: right;
    }
    .ed-dark .ed-diagram::before { color: #D8C69A; }
    .ed-diagram { min-width: 0 !important; max-width: 100% !important; box-sizing: border-box; }
    :has(> .ed-diagram) { min-width: 0; }
    .ed-svg-scroll {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
        margin: 0 -4px;
        padding: 0 4px 8px;
    }
    .ed-svg-scroll > svg.ed-svg { min-width: 540px; width: 540px !important; }

    /* Curseurs : pastille plus grande, facile a attraper au doigt */
    .ed-range { margin: 14px 0 !important; }
    .ed-range::-webkit-slider-thumb { width: 30px !important; height: 30px !important; }
    .ed-range::-moz-range-thumb { width: 26px !important; height: 26px !important; }
}

