/* ==========================================================================
   AGENCES — feuille de style alternative (test)
   Fichier : css/agences-v2.css
   Aucune modification de HTML/PHP : mêmes sélecteurs que agences.css.

   Pour tester, au choix dans php/_inc_header.php :
     A) remplacer  css/agences.css  par  css/agences-v2.css
     B) ou ajouter une ligne  css/agences-v2.css  juste APRÈS agences.css
   Pour revenir en arrière : remettre agences.css (ce fichier peut être supprimé).
   ========================================================================== */

#agence {
    --ag-line: #e6e8eb;
    --ag-soft: #f6f4f1;
    --ag-tint: #fbe9ea;
    --ag-ink: #1f2328;
    --ag-radius: 16px;
}

/* ---------- Titres de page ---------- */

.agence-pre-title {
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #6b7280;
}

.agence-title {
    font-size: clamp(30px, 3.3vw, 46px);
    line-height: 1.08;
    color: var(--col-grey-m);
    
    /*text-transform: uppercase;*/
}
.agence-title strong{
    font-weight: 800;
    color: var(--col-red);
    font-family: var(--font-main);
    text-transform: uppercase;
}

/* ---------- Mise en page deux colonnes ---------- */

#agence-bloc {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
    align-items: start;
    width: 100%;
    gap: 64px;
    margin-top: 24px;
}

.agence-bloc-left {
    width: 100%;
    min-width: 0;
    display: block;
}

.agence-bloc-right {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.agence-sidebar {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ---------- Photo de l'agence ---------- */

.agence-bloc-left > .image-wrapper {
    display: block;
    width: auto;
    margin: 32px var(--ag-band) 56px 0;
    isolation: isolate;
}

.image-wrapper {
    position: relative;
}

.image-wrapper img,
.agence-bloc-left img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--ag-radius);
}

/* Liseré rouge en L derrière la photo : un seul rectangle décalé de --ag-band
   vers le bas et la droite. Son coin extérieur a pour rayon (rayon de la photo +
   épaisseur) : il est donc concentrique au coin arrondi de l'image et le liseré
   garde la même épaisseur tout autour. */
.image-wrapper {
    --ag-band: 14px;
}

.image-wrapper::before {
    content: "";
    position: absolute;
    right: calc(var(--ag-band) * -1);
    bottom: calc(var(--ag-band) * -1);
    width: 45%;
    height: 45%;
    background-color: var(--col-red);
    border-radius: 0 0 calc(var(--ag-radius) + var(--ag-band)) 0;
    z-index: -1;
}

.image-wrapper::after {
    content: none;
}

/* ---------- Blocs de texte ---------- */

.agence-description {
    max-width: 76ch;
    margin-top: 72px;
    font-size: 17px;
    line-height: 1.75;
}

.agence-bloc-left > .image-wrapper + .agence-description {
    margin-top: 0;
}

.agence-description h2 {
    margin-bottom: 24px;
    color: var(--col-red);
    font-size: clamp(26px, 2.6vw, 34px);
    line-height: 1.15;
}

.agence-bloc-left .agence-description h2 {
    padding-left: 18px;
    border-left: 5px solid var(--col-red);
}

#agence .agence-description p {
    margin: 0 0 18px;
    text-align: left;
}

.agence-description p + p {
    margin-top: 0;
}

/* ---------- Matériel : cartes en 2 colonnes (titre + paragraphe) ----------
   Le HTML est à plat (h3 puis p). Chaque h3 / p est placé dans la grille selon
   sa position : h3 pairs = colonne 1, h3 impairs (hors 1er) = colonne 2, et le
   paragraphe qui suit reste dans la colonne de son titre. Le 1er h3 (introduction)
   et le paragraphe de conclusion occupent toute la largeur. */

.agence-materiel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row dense;
    column-gap: 20px;
    row-gap: 0;
    align-items: stretch;
}

.agence-materiel > * {
    grid-column: 1 / -1;
}

.agence-materiel > h3:nth-of-type(even),
.agence-materiel > h3:nth-of-type(even) + p {
    grid-column: 1;
}

.agence-materiel > h3:nth-of-type(odd):not(:first-of-type),
.agence-materiel > h3:nth-of-type(odd):not(:first-of-type) + p {
    grid-column: 2;
}

.agence-materiel h3 {
    margin: 0;
    padding: 24px 24px 0;
    background: #fff;
    border: 1.5px solid var(--ag-line);
    border-bottom: 0;
    border-radius: 16px 16px 0 0;
    font-size: 21px;
    line-height: 1.3;
    color: var(--ag-ink);
}

#agence .agence-materiel h3 + p {
    margin: 0 0 20px;
    padding: 10px 24px 24px;
    background: #fff;
    border: 1.5px solid var(--ag-line);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    font-size: 16px;
    line-height: 1.7;
}

/* carte d'introduction : pleine largeur, fond crème, sans icône */
.agence-materiel h3:first-of-type,
#agence .agence-materiel h3:first-of-type + p {
    background: var(--ag-soft);
    border-color: transparent;
}

.agence-materiel h3:first-of-type {
    padding-top: 28px;
    padding-left: 30px;
    padding-right: 30px;
}

#agence .agence-materiel h3:first-of-type + p {
    padding: 10px 30px 28px;
    font-size: 17px;
}

/* icône au-dessus du titre (Font Awesome Pro, déjà chargé sur le site) */
.agence-materiel h3:not(:first-of-type)::before {
    content: "\f0ad";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: var(--ag-tint);
    color: var(--col-red);
    font-family: var(--font-awesome);
    font-weight: 900;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
}

.agence-materiel h3:nth-of-type(2)::before { content: "\f85e"; } /* terrassement */
.agence-materiel h3:nth-of-type(3)::before { content: "\f47a"; } /* manutention */
.agence-materiel h3:nth-of-type(4)::before { content: "\f0d1"; } /* véhicules */
.agence-materiel h3:nth-of-type(5)::before { content: "\f807"; } /* bâtiment */
.agence-materiel h3:nth-of-type(6)::before { content: "\f0e7"; } /* énergie */
.agence-materiel h3:nth-of-type(7)::before { content: "\f06c"; } /* espaces verts */

/* paragraphe de conclusion après la dernière carte */
#agence .agence-materiel h3 + p + p {
    margin: 12px 0 0;
    font-size: 17px;
}

.agence-materiel a {
    color: var(--col-red);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    font-weight: 500;
}

.agence-materiel a:hover,
.agence-materiel a:focus-visible {
    background: var(--ag-tint);
    text-decoration-thickness: 2px;
}

/* ---------- Livraison ---------- */

.agence-livraison h3 {
    margin: 32px 0 12px;
    font-size: 22px;
    line-height: 1.3;
    color: var(--ag-ink);
}

.agence-livraison ul {
    display: grid;
    gap: 12px;
    margin: 20px 0 24px;
    padding: 0;
    list-style: none;
}

.agence-livraison li {
    padding: 18px 22px;
    background: #f3f4f6;
    border-radius: 12px;
    line-height: 1.7;
}

.agence-livraison li:first-child {
    background: var(--ag-tint);
}

.agence-livraison li + li {
    margin-top: 0;
}

.agence-livraison li strong {
    color: var(--col-red-f);
}

/* ---------- FAQ ---------- */

.agence-faq details {
    margin-top: 12px;
    background: #fff;
    border: 1.5px solid var(--ag-line);
    border-radius: 14px;
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.agence-faq details:first-of-type {
    border-top: 1.5px solid var(--ag-line);
}

.agence-faq details:hover,
.agence-faq details[open] {
    border-color: var(--col-red);
}

.agence-faq details[open] {
    box-shadow: 0 10px 28px rgba(var(--col-red-rgb), .10);
}

.agence-faq summary {
    position: relative;
    display: block;
    padding: 18px 60px 18px 24px;
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    line-height: 1.5;
    color: var(--ag-ink);
}

.agence-faq summary::-webkit-details-marker {
    display: none;
}

.agence-faq summary::marker {
    content: "";
}

.agence-faq summary::after {
    content: "";
    position: absolute;
    right: 26px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2.5px solid var(--col-red);
    border-bottom: 2.5px solid var(--col-red);
    transform: translateY(-70%) rotate(45deg);
    transition: transform .2s ease;
}

.agence-faq details[open] summary {
    color: var(--col-red);
}

.agence-faq details[open] summary::after {
    transform: translateY(-30%) rotate(-135deg);
}

.agence-faq summary:focus-visible {
    outline: 2px solid var(--col-red);
    outline-offset: -2px;
}

.agence-faq-reponse {
    padding: 0 24px 22px;
}

/* ---------- Boutons ---------- */

.agence-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 2em;
}

.agence-bloc-right .agence-actions {
    margin-top: 4px;
}

.agence-actions a.button,
a.btn-itineraire-agence {
    margin: 0;
    padding-top: .7em;
    padding-bottom: .7em;
    border-radius: 10px;
    font-size: 112%;
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1.2;
}

.agence-actions a.btn-fa {
    padding-left: 3.4em;
}

a.btn-contact-agence {
    margin-top: 0;
}

a.btn-itineraire-agence {
    display: inline-block;
    padding-left: 1.5em;
    padding-right: 1.5em;
    background-color: transparent;
    border: 2px solid var(--col-red);
    color: var(--col-red);
}

a.btn-itineraire-agence:hover,
a.btn-itineraire-agence:focus-visible {
    background-color: var(--col-red);
    background-image: none;
    color: #fff;
}

/* ---------- Colonne latérale : horaires ---------- */

#agence-horaires {
    margin: 0;
    padding: 24px 26px;
    background: #fff;
    border: 1.5px solid var(--ag-line);
    border-radius: var(--ag-radius);
    box-shadow: 0 8px 24px rgba(31, 35, 40, .06);
}

#agence-horaires strong {
    display: block;
    margin-bottom: 10px;
    color: var(--col-red);
    text-transform: uppercase;
    letter-spacing: .03em;
}

#agence-horaires table {
    width: 100%;
    border-collapse: collapse;
}

#agence-horaires table td,
.agence-sidebar #agence-horaires table td {
    padding: .5em .6em;
}

#agence-horaires tr + tr td {
    border-top: 1px solid #f0f1f3;
}

.hor-tab-jour {
    width: 7.5em;
    text-align: left;
    color: var(--ag-ink);
}

/* ---------- Colonne latérale : informations ---------- */

#agence-bloc-contact,
.agence-sidebar #agence-bloc-contact {
    display: block;
    position: relative;
    margin: 0;
    padding: 24px 26px;
    background: var(--ag-soft);
    border: 0;
    border-radius: var(--ag-radius);
}

.agence-bloc-right h6 {
    position: static;
    margin-bottom: 16px;
    color: var(--col-red);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.agence-bloc-right ul {
    list-style-type: none;
}

#agence-bloc-contact li {
    position: relative;
    min-height: 38px;
    padding: 7px 0 7px 54px;
    line-height: 1.5;
}

#agence-bloc-contact li:not(:last-child) {
    margin-bottom: 14px;
}

#agence-bloc-contact li:first-child {
    margin-top: 0;
}

#agence-bloc-contact li > span {
    position: absolute;
    left: 0;
    top: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 10px;
    color: var(--col-red);
    font-size: 100%;
}

#agence-bloc-contact a:hover {
    color: var(--col-red);
}

/* ---------- Colonne latérale : carte et sections ---------- */

.agence-sidebar .agence-description {
    max-width: none;
    margin-top: 48px;
    font-size: 16px;
}

.agence-sidebar .agence-description h2 {
    margin-bottom: 16px;
    font-size: clamp(22px, 2vw, 28px);
}

.agence-carte-cadre {
    position: relative;
    height: clamp(280px, 32vw, 380px);
    margin: 20px 0 24px;
    background: #eee;
    border: 1.5px solid var(--ag-line);
    border-radius: var(--ag-radius);
    overflow: hidden;
}

.agence-carte-cadre iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.agence-carte-attente {
    padding: 24px;
}

.agence-carte-attente a {
    text-decoration: underline;
}

.agence-sidebar .agence-description a:not(.button) {
    color: var(--col-red);
}

/* ---------- Tablette / mobile (logique d'origine conservée) ---------- */

@media screen and (max-width: 1079px) {
    #agence a.button {
        display: block;
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        white-space: normal;
    }

    .agence-title {
        font-size: clamp(26px, 5vw, 36px);
        line-height: 1.2;
        overflow-wrap: break-word;
    }

    #agence-bloc {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    #agence-bloc > .agence-bloc-left,
    #agence-bloc > .agence-sidebar {
        display: contents;
    }

    #agence-bloc .agence-bloc-right {
        order: 1;
        min-width: 0;
        overflow-wrap: anywhere;
        margin-top: 16px;
    }

    .agence-bloc-left > .agence-description,
    .agence-bloc-left > .agence-actions {
        order: 2;
    }

    .agence-sidebar > .agence-description {
        order: 3;
    }

    /* ajustements propres à cette version */
    .agence-description {
        margin-top: 48px;
        font-size: 16px;
    }

    .agence-bloc-left > .image-wrapper {
        --ag-band: 10px;
        margin: 24px var(--ag-band) 40px 0;
    }

    .agence-materiel h3 {
        padding: 20px 20px 0;
        font-size: 19px;
    }

    #agence .agence-materiel h3 + p {
        padding: 8px 20px 20px;
    }

    .agence-faq summary {
        padding: 16px 52px 16px 18px;
    }

    .agence-faq summary::after {
        right: 20px;
    }

    .agence-faq-reponse {
        padding: 0 18px 18px;
    }
}

@media screen and (max-width: 760px) {
    .agence-materiel {
        grid-template-columns: minmax(0, 1fr);
    }

    #agence .agence-materiel > h3,
    #agence .agence-materiel > h3 + p {
        grid-column: 1 / -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .agence-faq details,
    .agence-faq summary::after {
        transition: none;
    }
}

/* ==========================================================================
   Sélecteur d'agences (pastilles regroupées par zone)
   ========================================================================== */

.agence-switcher {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    margin: 14px 0 28px;
    padding: 4px 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.agence-switcher::-webkit-scrollbar {
    display: none;
}

.agence-switcher-group {
    display: flex;
    flex: none;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
}

.agence-switcher-group + .agence-switcher-group {
    margin-left: 18px;
    padding-left: 18px;
    border-left: 1.5px solid var(--ag-line, #e6e8eb);
}

.agence-switcher-label {
    margin-right: 4px;
    font-family: var(--font-main);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #6b7280;
}

.agence-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1.5px solid var(--ag-line, #e6e8eb);
    border-radius: 999px;
    background: #fff;
    font-family: var(--font-main);
    font-size: 14.5px;
    font-weight: 600;
    color: #1f2328;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}

.agence-chip:hover {
    border-color: var(--col-red);
    color: var(--col-red);
}

.agence-chip:focus-visible {
    outline: 2px solid var(--col-red);
    outline-offset: 2px;
}

.agence-chip[aria-current="page"] {
    background: var(--col-red);
    border-color: var(--col-red);
    color: #fff;
    pointer-events: none;
}

/* Écrans moyens : pastilles un peu plus compactes pour tenir sur la ligne */
@media screen and (min-width: 1080px) and (max-width: 1279px) {
    .agence-chip {
        min-height: 38px;
        padding: 0 13px;
        font-size: 14px;
    }
}

/* Bouton de dépliage : masqué sur grand écran */
.agence-switcher-toggle {
    display: none;
}

/* Mobile / tablette : bouton « Changer d'agence » qui déplie les pastilles */
@media screen and (max-width: 1079px) {
    .agence-switcher-wrap {
        margin: 14px 0 24px;
    }

    .agence-switcher-toggle {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        min-height: 52px;
        padding: 0 18px;
        border: 1.5px solid #dadada;
        border-radius: 12px;
        background: #fff;
        font-family: var(--font-main);
        font-size: 15px;
        font-weight: 700;
        color: #1f2328;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .agence-switcher-toggle::before {
        content: "\f3c5";
        font-family: var(--font-awesome);
        font-weight: 900;
        font-size: 16px;
        color: var(--col-red);
    }

    .agence-switcher-toggle-current {
        margin-left: auto;
        padding: 4px 12px;
        border-radius: 999px;
        background: var(--ag-tint, #fbe9ea);
        font-size: 13px;
        font-weight: 700;
        color: #8f0f19;
    }

    .agence-switcher-toggle::after {
        content: "";
        flex: none;
        width: 9px;
        height: 9px;
        border-right: 2.5px solid #1f2328;
        border-bottom: 2.5px solid #1f2328;
        transform: translateY(-2px) rotate(45deg);
        transition: transform .2s ease;
    }

    .agence-switcher-wrap.is-open .agence-switcher-toggle {
        border-color: var(--col-red);
    }

    .agence-switcher-wrap.is-open .agence-switcher-toggle::after {
        transform: translateY(2px) rotate(-135deg);
    }

    /* Panneau replié par défaut, pastilles à la ligne une fois ouvert */
    .agence-switcher {
        display: none;
        width: auto;
        max-width: none;
        margin: 10px 0 0;
        padding: 18px 16px 16px;
        overflow: visible;
        border: 1px solid var(--ag-line, #e6e8eb);
        border-radius: 14px;
        background: var(--ag-soft, #f6f4f1);
    }

    .agence-switcher-wrap.is-open .agence-switcher {
        display: block;
    }

    .agence-switcher-group {
        flex-wrap: wrap;
        gap: 8px;
    }

    .agence-switcher-group + .agence-switcher-group {
        margin: 18px 0 0;
        padding: 18px 0 0;
        border-left: 0;
        border-top: 1.5px solid var(--ag-line, #e6e8eb);
    }

    .agence-switcher-label {
        flex: 0 0 100%;
        margin: 0 0 4px;
    }

    .agence-chip {
        min-height: 44px;
        padding: 0 16px;
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .agence-chip,
    .agence-switcher-toggle::after { transition: none; }
}
