/*
 * En-tete + menu principal (maquette "Menu Abuelos Plus").
 * Les textes et liens des sous-menus viennent de la base (menu_riche_*) :
 * on ne fait que restyler leur structure textBlock / navBlock / img-block.
 * Hauteurs calees sur les marges des pages (.banner-block / .innerBanner-block) :
 * 120px >= 1200px, 100px entre 992 et 1199px, 65px en dessous.
 */
:root {
    --ap-teal: #007895;
    --ap-teal-soft: #E6F2F5;
    --ap-green: #8ACA3A;
    --ap-green-ink: #1E2A10;
    --ap-ink: #282828;
    --ap-ink-2: #4A4949;
    --ap-muted: #565656;
    --ap-line: #E6E6E6;
    --ap-line-soft: #EFEFEF;
    --ap-tint: #F5FAFB;
}

header.ap-header {
    padding: 0;
    min-height: 0;
    box-shadow: none;
    border-bottom: 1px solid var(--ap-line);
    font-family: 'Fira Sans', sans-serif;
    color: var(--ap-ink);
}
.ap-header a { text-decoration: none; }
.ap-header [hidden] { display: none !important; }
.ap-header a:focus-visible,
.ap-header button:focus-visible,
.ap-header input:focus-visible {
    outline: 3px solid var(--ap-green);
    outline-offset: 2px;
}
.ap-header__inner {
    max-width: 1376px;
    margin: 0 auto;
    padding: 0 32px;
    box-sizing: border-box;
}

/* ---------- Ligne du haut ---------- */
.ap-header__top .ap-header__inner {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.ap-header__logo { display: flex; align-items: center; flex: 0 0 auto; }
/* Logo horizontal HD (images/logo_ab.png, version web : images/logo-header.webp) */
.ap-header__logo picture { display: block; }
.ap-header__logo img { display: block; height: 48px; width: auto; max-width: 100%; padding: 0; margin: 0; }

.ap-header__tools { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.ap-header__link { color: var(--ap-ink-2); white-space: nowrap; }
.ap-header__link:hover { color: var(--ap-teal); }

/* Note Google */
.ap-rating { display: flex; align-items: center; gap: 8px; color: var(--ap-ink); white-space: nowrap; }
.ap-rating:hover { color: var(--ap-teal); }
.ap-rating__muted { color: var(--ap-muted); }
.ap-stars { position: relative; display: inline-block; line-height: 0; flex: 0 0 auto; }
.ap-stars__row { display: flex; gap: 1px; fill: #DDDDDD; }
.ap-stars__fill { position: absolute; top: 0; left: 0; width: 0; overflow: hidden; fill: #F5B400; }
.ap-stars svg { flex: 0 0 auto; }
.ap-header__sep { width: 1px; height: 18px; background: #DDDDDD; }
/* Telephone : pastille numero + horaires (dimensions reprises de capretraite.fr) */
.ap-header__phone {
    display: flex; align-items: center; gap: 9px; white-space: nowrap;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--ap-teal-soft);
    color: var(--ap-teal);
    transition: background .15s ease;
}
.ap-header__phone:hover { background: #D3E9EF; color: var(--ap-teal); }
.ap-header__phone-icon { flex: 0 0 auto; display: flex; color: var(--ap-teal); }
.ap-header__phone-icon svg { width: 16px; height: 16px; }
.ap-header__phone-text { display: flex; flex-direction: column; line-height: 16px; }
.ap-header__phone-number { font-size: 16px; font-weight: 700; color: var(--ap-teal); }
.ap-header__phone-label { font-size: 10px; font-weight: 500; color: var(--ap-muted); }

.ap-header__call,
.ap-header__toggle { display: none; }

/* ---------- Barre de navigation (desktop) ---------- */
.ap-nav { border-top: 1px solid var(--ap-line-soft); position: relative; }
.ap-nav__list {
    list-style: none; margin: 0 auto; padding: 0 32px;
    max-width: 1376px; box-sizing: border-box;
    height: 48px;
    display: flex; align-items: stretch; justify-content: space-between; gap: 16px;
}
.ap-nav__item { position: static; display: flex; flex: 0 0 auto; margin: 0; padding: 0; }
.ap-nav__link {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 4px 0;
    border-bottom: 4px solid transparent;
    font-size: 16px; font-weight: 600; line-height: 1.15;
    color: var(--ap-ink-2);
}
.ap-nav__link:hover,
.ap-nav__link.active,
.ap-nav__item.active > .ap-nav__link,
.ap-nav__item--mega:hover > .ap-nav__link,
.ap-nav__item--mega:focus-within > .ap-nav__link {
    color: var(--ap-teal);
    border-bottom-color: var(--ap-green);
}
/* Les libelles longs passent sur 2 lignes equilibrees, les courts restent sur une ligne */
.ap-nav__label { display: block; max-width: 13em; text-wrap: balance; }
@media (min-width: 1380px) {
    .ap-nav__label { max-width: none; white-space: nowrap; }
}
.ap-nav__chevron { display: inline-block; vertical-align: middle; margin: -2px 0 0 6px; transition: transform .15s ease; }
.ap-nav__item--mega:hover .ap-nav__chevron,
.ap-nav__item--mega:focus-within .ap-nav__chevron { transform: rotate(180deg); }

/* ---------- Mega-menu (desktop) ---------- */
.ap-mega {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    background: #fff;
    border-top: 1px solid var(--ap-line);
    border-bottom: 1px solid var(--ap-line);
    box-shadow: 0 16px 32px rgba(0, 60, 75, .10);
    z-index: 1000;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.ap-nav__item--mega:hover > .ap-mega,
.ap-nav__item--mega:focus-within > .ap-mega { display: block; }
.ap-mega__head { display: none; }
.ap-mega__inner {
    max-width: 1376px; margin: 0 auto; box-sizing: border-box;
    padding: 36px 32px 40px;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr) 260px;
    column-gap: 44px;
    align-items: start;
    text-align: left;
}
/* Le wrapper col-md-* saisi en base s'efface pour que textBlock / navBlock deviennent les colonnes */
.ap-mega__inner > [class*="col-"]:not(.img-block) { display: contents; }
.ap-mega__inner > p,
.ap-mega__inner > br,
.ap-mega .clearfix { display: none; }
.ap-mega .textBlock,
.ap-mega .navBlock,
.ap-mega .img-block {
    float: none; width: auto; min-height: 0;
    margin: 0; padding: 0; border: 0;
}

.ap-mega .textBlock { grid-column: 1; display: flex; flex-direction: column; gap: 14px; }
.ap-mega .textBlock .oldH2,
.ap-mega .textBlock h2,
.ap-mega .textBlock h3 {
    margin: 0; padding: 0;
    font-size: 24px; font-weight: 600; line-height: 1.25; color: var(--ap-teal);
}
.ap-mega .textBlock .oldH2 strong { font-weight: inherit; }
.ap-mega .textBlock p {
    margin: 0; padding: 0;
    font-size: 15px; line-height: 1.55; font-weight: 400; color: var(--ap-muted);
}
.ap-mega .textBlock span,
.ap-mega .textBlock strong { font-size: inherit !important; }
/* Boutons saisis en base (styles inline) : liens flechés, le bouton vert est dans l'encart conseil */
.ap-mega .textBlock a {
    display: inline !important;
    background: none !important; border: 0 !important; border-radius: 0 !important;
    padding: 0 !important;
    color: var(--ap-teal) !important;
    font-size: 15px !important; font-weight: 600 !important; line-height: 1.35;
    text-align: left; text-decoration: none !important;
}
.ap-mega .textBlock a::after { content: "\2192"; margin-left: 6px; }
.ap-mega .textBlock a:hover { color: var(--ap-ink) !important; }

.ap-mega .navBlock {
    grid-column: 2;
    padding-left: 40px;
    border-left: 1px solid var(--ap-line);
}
.ap-mega .navBlock ul {
    margin: 0; padding: 0; list-style: none;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px;
}
.ap-mega .navBlock li { margin: 0; padding: 0; list-style: none; }
.ap-mega .navBlock li span { font-size: inherit !important; }
.ap-mega .navBlock a {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 13px 0;
    border: 0; border-bottom: 1px solid var(--ap-line-soft);
    font-size: 15px !important; font-weight: 400; line-height: 1.35;
    color: var(--ap-ink);
}
.ap-mega .navBlock a::after {
    content: ""; flex: 0 0 auto;
    width: 7px; height: 7px;
    border-top: 2px solid var(--ap-green); border-right: 2px solid var(--ap-green);
    transform: rotate(45deg);
    margin-right: 4px;
}
.ap-mega .navBlock a > * { font-size: inherit !important; }
.ap-mega .navBlock a:hover,
.ap-mega .navBlock a.active { color: var(--ap-teal); }

/* Les photos saisies en base sont remplacees par l'encart conseil */
.ap-mega .img-block { display: none; }

/* ---------- Sous-menu Residencia (annuaire) : recherche | comunidades | encart conseil ---------- */
/* Pas de defilement interne : la liste de suggestions doit pouvoir depasser du sous-menu */
.ap-mega--directory { overflow: visible; max-height: none; }
.ap-dir__intro { grid-column: 1; display: flex; flex-direction: column; gap: 16px; }
.ap-dir__title { margin: 0; font-size: 24px; font-weight: 600; line-height: 1.25; color: var(--ap-teal); }
.ap-dir__text { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ap-muted); }
.ap-dir__search { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.ap-dir__search label { margin: 0; font-size: 13px; font-weight: 600; color: var(--ap-ink-2); }
.ap-dir__field { position: relative; display: flex; }
.ap-dir__field input {
    flex: 1 1 auto; min-width: 0; height: 50px; box-sizing: border-box;
    padding: 0 14px;
    border: 2px solid var(--ap-teal); border-right: 0; border-radius: 6px 0 0 6px;
    font-family: inherit; font-size: 15px; color: var(--ap-ink); background: #fff;
    box-shadow: none; outline: none;
}
.ap-dir__field input:focus { box-shadow: inset 0 0 0 1px var(--ap-teal); }
.ap-dir__field button {
    flex: 0 0 50px; height: 50px; padding: 0;
    border: 0; border-radius: 0 6px 6px 0;
    background: var(--ap-teal); color: #fff;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.ap-dir__field button:hover { background: #00627A; }
.ap-dir__results {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
    margin: 0; padding: 6px 0; list-style: none;
    background: #fff; border: 1px solid var(--ap-line); border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 60, 75, .14);
    max-height: 280px; overflow-y: auto;
}
.ap-dir__results li { margin: 0; padding: 9px 14px; font-size: 14px; color: var(--ap-ink); cursor: pointer; }
.ap-dir__results li.is-group {
    padding: 8px 14px 4px; cursor: default;
    font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ap-muted);
}
.ap-dir__results li.is-empty { cursor: default; color: var(--ap-muted); }
.ap-dir__results li[aria-selected="true"],
.ap-dir__results li[role="option"]:hover { background: var(--ap-teal-soft); color: var(--ap-teal); }
.ap-dir__error { margin: 0; font-size: 13px; color: #B3261E; }
.ap-dir__all { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; color: var(--ap-teal); }
.ap-dir__all:hover { color: var(--ap-ink); }

.ap-mega--directory .navBlock { display: flex; flex-direction: column; gap: 12px; }
.ap-dir__label {
    margin: 0; font-size: 13px; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase; color: var(--ap-muted);
}
/* Ordre alphabetique de haut en bas, colonne par colonne */
.ap-mega--directory .navBlock ul { display: block; columns: 3; column-gap: 28px; }
.ap-mega--directory .navBlock li { break-inside: avoid; }
.ap-mega--directory .navBlock a { padding: 8px 0; }

.ap-dir__cta {
    grid-column: 3; grid-row: 1;
    display: flex; flex-direction: column; gap: 12px;
    padding: 24px;
    background: var(--ap-tint);
    border-top: 4px solid var(--ap-green);
    border-radius: 6px;
}
.ap-dir__cta-title { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.3; color: var(--ap-ink); }
.ap-dir__cta-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ap-muted); white-space: pre-line; }
.ap-dir__cta-rating { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--ap-muted); fill: #F5B400; }
.ap-dir__cta-rating strong { color: var(--ap-ink); }
.ap-dir__cta-btn {
    display: block; padding: 12px 16px; border-radius: 6px;
    background: var(--ap-green); color: var(--ap-green-ink);
    font-size: 15px; font-weight: 600; text-align: center;
}
.ap-dir__cta-btn:hover { background: #7AB82F; color: var(--ap-green-ink); }

.ap-nav__footer,
.ap-nav__extra { display: none; }

/* ---------- Desktop compact ---------- */
@media (max-width: 1199px) {
    .ap-header__top .ap-header__inner { height: 56px; padding: 0 20px; }
    .ap-header__logo img { height: 38px; }
    .ap-header__tools { gap: 16px; font-size: 13px; }
    .ap-nav__list { height: 42px; padding: 0 20px; gap: 8px; }
    .ap-nav__link { font-size: 14px; padding-left: 2px; padding-right: 2px; }
    .ap-nav__label { max-width: 13.5em; }
    .ap-mega { max-height: calc(100vh - 100px); }
    .ap-mega__inner { grid-template-columns: 240px minmax(0, 1fr) 200px; column-gap: 28px; padding: 28px 20px 32px; }
    .ap-mega .navBlock { padding-left: 28px; }
}

/* ---------- Mobile / tablette ---------- */
@media (max-width: 991px) {
    .ap-header__top .ap-header__inner { height: 65px; padding: 0 10px 0 16px; gap: 6px; }
    .ap-header__logo { margin-right: auto; }
    .ap-header__logo { min-width: 0; }
    .ap-header__logo { flex: 0 1 auto; }
    .ap-header__logo picture { width: 180px; max-width: 100%; }
    .ap-header__logo img { width: 100%; height: auto; }
    .ap-header__tools { display: none; }

    .ap-header__call {
        flex: 0 0 46px;
        display: flex; align-items: center; justify-content: center;
        width: 46px; height: 46px; border-radius: 23px;
        background: var(--ap-teal-soft); color: var(--ap-teal);
    }
    .ap-header__toggle {
        flex: 0 0 auto;
        display: flex; align-items: center; gap: 8px;
        height: 46px; padding: 0 14px; box-sizing: border-box;
        border: 2px solid var(--ap-teal); border-radius: 23px;
        background: var(--ap-teal); color: #fff;
        font-family: inherit; font-size: 15px; font-weight: 600;
        cursor: pointer;
    }
    .ap-header__toggle .ap-toggle-open { display: flex; align-items: center; gap: 8px; }
    .ap-header__toggle .ap-toggle-close { display: none; }
    .ap-nav-open .ap-header__toggle { background: #fff; color: var(--ap-teal); }
    .ap-nav-open .ap-header__toggle .ap-toggle-open { display: none; }
    .ap-nav-open .ap-header__toggle .ap-toggle-close { display: flex; align-items: center; gap: 8px; }

    .ap-nav {
        display: none;
        position: fixed; top: 65px; left: 0; right: 0; bottom: 0;
        background: #fff; border-top: 1px solid var(--ap-line);
        flex-direction: column;
        overflow-y: auto; -webkit-overflow-scrolling: touch;
    }
    .ap-nav-open .ap-nav { display: flex; }
    html.ap-nav-open, html.ap-nav-open body { overflow: hidden; }

    .ap-nav__list {
        height: auto; max-width: none; width: 100%; margin: 0; padding: 6px 16px 0;
        flex-direction: column; justify-content: flex-start; gap: 0;
    }
    .ap-nav__item { display: block; }
    .ap-nav__link {
        min-height: 62px; box-sizing: border-box;
        padding: 8px 0; gap: 14px;
        border-bottom: 1px solid var(--ap-line-soft);
        font-size: 17px; color: var(--ap-ink);
        white-space: normal; text-align: left;
        justify-content: space-between;
    }
    .ap-nav__link:hover,
    .ap-nav__link.active,
    .ap-nav__item.active > .ap-nav__link,
    .ap-nav__item--mega:hover > .ap-nav__link,
    .ap-nav__item--mega:focus-within > .ap-nav__link {
        border-bottom-color: var(--ap-line-soft);
        color: var(--ap-teal);
    }
    .ap-nav__label { max-width: none; flex: 1 1 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
    .ap-nav__chevron { margin: 0; transform: rotate(-90deg); }
    .ap-nav__item--mega:hover .ap-nav__chevron,
    .ap-nav__item--mega:focus-within .ap-nav__chevron { transform: rotate(-90deg); }

    /* Sous-menu : on n'affiche que la rubrique ouverte */
    .ap-mega,
    .ap-nav__item--mega:hover > .ap-mega,
    .ap-nav__item--mega:focus-within > .ap-mega { display: none; }
    .ap-nav.has-sub .ap-nav__item:not(.is-open) { display: none; }
    .ap-nav.has-sub .ap-nav__item.is-open > .ap-nav__link { display: none; }
    .ap-nav .ap-nav__item.is-open > .ap-mega {
        display: block; position: static;
        max-height: none; overflow: visible;
        border: 0; box-shadow: none;
    }
    .ap-mega__head {
        display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
        padding: 6px 0 12px;
    }
    .ap-mega__back {
        display: flex; align-items: center; gap: 6px;
        height: 44px; padding: 0; border: 0; background: none;
        font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ap-teal);
        cursor: pointer;
    }
    .ap-mega__title { font-size: 22px; font-weight: 600; line-height: 1.25; color: var(--ap-teal); }
    .ap-mega__inner { display: flex; flex-direction: column; align-items: stretch; gap: 16px; padding: 0 0 20px; }
    .ap-mega__inner > [class*="col-"]:not(.img-block) { display: contents; }
    .ap-mega .textBlock { order: 2; gap: 12px; }
    .ap-mega .textBlock .oldH2,
    .ap-mega .textBlock h2,
    .ap-mega .textBlock h3 { display: none; }
    .ap-mega .textBlock p { font-size: 15px; }
    .ap-mega .navBlock { order: 1; padding-left: 0; border-left: 0; }
    .ap-mega .navBlock ul { grid-template-columns: minmax(0, 1fr); }
    .ap-mega .navBlock a { min-height: 44px; padding: 11px 0; box-sizing: border-box; font-size: 16px !important; }
    .ap-mega--directory .navBlock ul { columns: 2; column-gap: 16px; }
    .ap-mega--directory .navBlock a { min-height: 44px; padding: 8px 0; font-size: 15px !important; }
    .ap-dir__intro { order: 1; gap: 10px; }
    .ap-dir__title, .ap-dir__text, .ap-dir__all, .ap-dir__search label { display: none; }
    .ap-dir__field input { font-size: 16px; }
    .ap-dir__cta { display: none; }
    .ap-mega .img-block { display: none; }

    .ap-nav__extra { display: flex; flex-wrap: wrap; gap: 18px; padding: 14px 16px 0; }
    .ap-nav__extra a { min-height: 44px; display: flex; align-items: center; font-size: 15px; color: var(--ap-muted); }
    .ap-nav.has-sub .ap-nav__extra { display: none; }
    .ap-nav__footer {
        display: block;
        margin-top: auto;
        position: sticky; bottom: 0;
        background: var(--ap-tint);
        border-top: 4px solid var(--ap-green);
        padding: 16px 16px 22px;
    }
    .ap-nav__footer-top {
        display: flex; justify-content: space-between; align-items: center; gap: 8px;
        margin-bottom: 12px;
        font-size: 14px; color: var(--ap-muted);
    }
    .ap-nav__footer-top .ap-rating { gap: 6px; font-size: 14px; }
    .ap-nav__call {
        height: 50px; box-sizing: border-box;
        display: flex; align-items: center; justify-content: center; gap: 10px;
        border: 2px solid var(--ap-teal); border-radius: 6px;
        background: #fff; color: var(--ap-teal);
        font-size: 16px; font-weight: 700;
    }

    /* Les pages compensent l'en-tete fixe : 100px etait prevu ici, l'en-tete fait 65px */
    .banner-block, .innerBanner-block { margin-top: 65px; }
}
@media (max-width: 767px) {
    .innerBanner-block { margin-top: 65px; }
}
