/*
 * RTB - couche partagée accessibilité / mobile.
 * Chargée après le CSS propre à chaque page pour ne modifier que ce qui est nécessaire.
 */

/* ---------- Texte : base 16 px, tout en unités relatives ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { font-size: 1rem; overflow-wrap: break-word; }

/* ---------- Lien d'évitement ---------- */
.skip-link {
    position: absolute;
    top: -5rem;
    left: 0.75rem;
    z-index: 100;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: #1f2b35;
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
}
.skip-link:focus { top: 0.75rem; }
main:focus, main:focus-visible { outline: none; }

/* ---------- Focus clavier visible ---------- */
:focus-visible {
    outline: 3px solid #1f2b35;
    outline-offset: 2px;
}
/* Sur fonds sombres, l'anneau passe en blanc pour rester visible (≥ 3:1). */
.topbar :focus-visible,
.hero-copy :focus-visible,
.contact-panel :focus-visible,
.territory-note :focus-visible { outline-color: #fff; }
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline-offset: 0;
    border-color: #1f2b35;
}

/* ---------- Liens reconnaissables sans la couleur : soulignés ---------- */
p a:not(.btn),
li a:not(.channel):not(.btn),
.card > a:not(.btn),
.photo-rights a,
.reviews-note a,
.footer-links a,
.footer-zones a,
.topbar a { text-decoration: underline; text-underline-offset: 0.18em; }

/* ---------- Cibles tactiles d'au moins 44 x 44 px ---------- */
.nav-link,
.nav a { min-height: 2.75rem; }
.menu-toggle { min-width: 2.75rem; min-height: 2.75rem; border-color: rgba(31, 43, 53, 0.55); }
.topbar a,
.footer-links a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.footer-zones a { display: inline-block; min-width: 2.75rem; padding: 0.7rem 0.2rem; text-align: center; }
.brand { min-height: 2.75rem; }
.contact-line a,
.card div > a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.zone-links a { min-width: 2.75rem; justify-content: center; }
.nav-link.is-current,
.nav a.is-current {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 6px;
}

/* Très petits écrans (320 px, zoom 400 %) : l'en-tête reste sur une ligne sans débordement. */
@media (max-width: 22.5rem) {
    .header-inner { gap: 0.25rem; }
    .brand img { width: 6rem; }
    .header-cta .btn { padding: 0 0.5rem; }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto !important; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .btn:hover,
    a.service-card:hover { transform: none !important; }
}

/* ---------- Explications du jargon, toujours visibles (aucune infobulle au survol) ---------- */
.plain-note {
    margin: 0.75rem 0 0;
    padding: 0.625rem 0.75rem;
    border-left: 4px solid #1495c9;
    background: #eef6fa;
    color: #24313a;
    font-size: 1rem;
}
.service-body .plain-note { margin-top: 0.75rem; }
.glossary { margin: 1rem 0 0; }
.glossary dt { margin-top: 0.875rem; color: #1f2b35; font-weight: 800; }
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: 0.125rem 0 0; color: #55616b; font-size: 1rem; }

/* ---------- Bandeau cookies (consentement) ---------- */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 90;
    max-height: 80vh;
    overflow: auto;
    padding: 1rem max(1rem, env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: #fff;
    color: #24313a;
    border-top: 3px solid #1f2b35;
    box-shadow: 0 -10px 30px rgba(27, 39, 49, 0.2);
}
.cookie-banner[hidden] { display: none; }
.cookie-banner-inner {
    width: min(1240px, 100%);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
}
.cookie-banner-text { flex: 1 1 26rem; margin: 0; font-size: 1rem; line-height: 1.5; }
.cookie-banner-text a { color: #0a6590; text-decoration: underline; text-underline-offset: 0.18em; }
.cookie-actions { display: flex; flex: 0 1 auto; flex-wrap: wrap; gap: 0.75rem; }
/* « Tout refuser » et « Tout accepter » ont exactement le même aspect (recommandation CNIL). */
.cookie-btn {
    min-width: 8.5rem;
    min-height: 2.75rem;
    padding: 0 1.25rem;
    border: 2px solid #1f2b35;
    border-radius: 6px;
    background: #1f2b35;
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.cookie-btn:hover { background: #314250; }
.cookie-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 0.25rem;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 0.18em;
    cursor: pointer;
}
@media (max-width: 760px) {
    .cookie-actions { width: 100%; }
    .cookie-btn { flex: 1 1 0; }
}

/* ---------- Utilitaires ---------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Le formulaire de devis ne doit pas passer sous l'en-tête fixe après un défilement. */
#devis { scroll-margin-top: 7rem; }

/* ---------- Barre d'actions mobile (Appeler / Devis) ---------- */
.mobile-bar { display: none; }

@media (max-width: 760px) {
    .mobile-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        padding: 0.5rem max(0.75rem, env(safe-area-inset-right)) calc(0.5rem + env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
        background: #fff;
        border-top: 1px solid rgba(31, 43, 53, 0.25);
        box-shadow: 0 -8px 20px rgba(27, 39, 49, 0.12);
    }

    .mobile-bar-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        min-height: 3rem;
        padding: 0 1rem;
        border-radius: 6px;
        font-size: 1rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        text-decoration: none;
    }

    .mobile-bar-btn svg { flex: 0 0 auto; width: 1.25rem; height: 1.25rem; }
    .mobile-bar-call { background: #1f2b35; color: #fff; }
    .mobile-bar-devis { background: #f29a1f; color: #1f1f1f; }

    /* Le contenu et le pied de page restent entièrement accessibles au-dessus de la barre. */
    body.has-mobile-bar .site-footer,
    body.has-mobile-bar .footer {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }

    html { scroll-padding-bottom: 5.5rem; }

    body.has-mobile-bar .scroll-top {
        right: 1rem;
        bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }
}

/* Écrans très courts (zoom élevé, paysage) : rien ne reste fixé et ne masque le contenu. */
@media (max-height: 30rem) {
    .site-header { position: static; }
    .mobile-bar { position: static; box-shadow: none; }
    body.has-mobile-bar .site-footer,
    body.has-mobile-bar .footer { padding-bottom: 2rem; }
    body.has-mobile-bar .scroll-top { bottom: 1rem; }
}

/* Formulaire : les messages restent visibles sous l'en-tete collant lors du deplacement du focus. */
.form-success,
.form-summary,
.form-alert {
    scroll-margin-top: 7rem;
    scroll-margin-bottom: 6rem;
}

select,
select option {
    font-size: 1rem;
}
