@layer utilities {
    /* ========================================================================
     * Store Locator (Yeboyebo_Stores) — /stores, diseño devlab
     * Hero con foto + bloque partido: mapa (Google Maps + markerclusterer) | buscador
     * (Hombre/Mujer, país, ciudad) + "Países El Ganso". En móvil: hero,
     * buscador, mapa y países. Plantilla: Yeboyebo_Stores/templates/stores_map.phtml
     * (también /tiendas-wholesale: página CMS con el mismo bloque, mode="wholesale";
     * y /intl_cl/puntos-devoluciones: mode="devoluciones-cl", sin hero)
     * ===================================================================== */

    /* Página a ancho completo, sin el padding lateral global de #maincontent
     * ni el max-width de .columns (mismo patrón que la home en 01-base.css). */
    .stores-index-index #maincontent,
    .cms-tiendas-wholesale #maincontent,
    .cms-puntos-devoluciones #maincontent {
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: none !important;
        margin-block: 0 !important;
    }
    .stores-index-index .columns,
    .cms-tiendas-wholesale .columns,
    .cms-puntos-devoluciones .columns {
        max-width: none !important;
        padding-inline: 0 !important;
        margin-inline: 0 !important;
        display: block !important;
        width: 100% !important;
    }
    .stores-index-index .column.main,
    .cms-tiendas-wholesale .column.main,
    .cms-puntos-devoluciones .column.main {
        max-width: none !important;
        width: 100% !important;
    }
    .stores-index-index .breadcrumbs,
    .cms-tiendas-wholesale .breadcrumbs,
    .cms-puntos-devoluciones .breadcrumbs { display: none; }

    .elg-stores { color: rgb(4 29 64); }

    /* ---------- Hero (mismo patrón que GansoInside) ---------- */
    .elg-stores-hero {
        position: relative;
        width: 100%;
        aspect-ratio: 4 / 5;
        display: flex;
        align-items: flex-end;
        padding: 2rem 1.25rem;
        background-size: cover;
        background-position: center;
        background-color: rgb(4 29 64);
        color: var(--color-on-primary);
    }
    .elg-stores-hero::before {
        content: "";
        position: absolute; inset: 0;
        background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.5) 100%);
        pointer-events: none;
    }
    @media (min-width: 768px) {
        .elg-stores-hero { aspect-ratio: 2 / 1; max-height: 80vh; padding: 3rem; }
    }
    .elg-stores-hero-overlay {
        position: relative;
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    @media (min-width: 768px) {
        .elg-stores-hero-overlay { grid-template-columns: auto 1fr; align-items: end; column-gap: 2rem; }
    }
    .elg-stores-hero-title {
        font-size: clamp(1.5rem, 4.5vw, 3.25rem);
        font-weight: 500;
        text-transform: uppercase;
        line-height: 1;
        margin: 0;
    }
    .elg-stores-hero-sub {
        font-size: clamp(0.625rem, 1.2vw, 1rem);
        text-transform: uppercase;
        line-height: 1.3;
        margin: 0;
    }
    .elg-stores-hero-sub a {
        color: inherit;
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    /* ---------- Bloque partido: mapa | buscador + países ---------- */
    .elg-stores-split {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-areas: "locator" "map" "countries";
    }
    @media (min-width: 1024px) {
        .elg-stores-split {
            grid-template-columns: 1fr 1fr;
            grid-template-rows: auto 1fr;
            grid-template-areas: "map locator" "map countries";
        }
    }
    .elg-stores-map {
        grid-area: map;
        width: 100%;
        aspect-ratio: 1 / 1;
        background: rgb(170 211 223);
        /* Mapa apagado en grises, como en Scandi (StoresPage.style.scss) */
        filter: grayscale(60%);
    }
    /* Escritorio: altura fija y fijo (sticky) mientras se baja por la lista de
     * países; con height:100% se estiraba al desplegar las tiendas de un país. */
    @media (min-width: 1024px) {
        .elg-stores-map {
            aspect-ratio: auto;
            position: sticky;
            top: 0;
            align-self: start;
            height: min(100vh, 900px);
            min-height: 640px;
        }
    }

    .elg-stores-locator { grid-area: locator; padding: 2rem 1.25rem; }
    .elg-stores-countries { grid-area: countries; padding: 2rem 1.25rem 3rem; }
    @media (min-width: 1024px) {
        .elg-stores-locator { padding: 4rem 3.5rem 2rem; }
        .elg-stores-countries { padding: 2rem 3.5rem 4rem; }
    }

    .elg-stores-locator-title {
        font-size: clamp(1rem, 1.8vw, 1.5rem);
        font-weight: 500;
        text-transform: uppercase;
        line-height: 1.15;
        margin: 0 0 0.5rem;
    }
    .elg-stores-locator-text {
        font-size: 0.75rem;
        line-height: 1.4;
        margin: 0 0 1.25rem;
    }

    .elg-stores-tabs { display: flex; }
    .elg-stores-tab {
        padding: 0.35rem 0.75rem;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        border: 1px solid rgb(4 29 64 / 0.35);
        background: var(--color-bg);
        color: rgb(4 29 64 / 0.55);
        cursor: pointer;
    }
    .elg-stores-tab + .elg-stores-tab { border-left: 0; }
    .elg-stores-tab.is-active { color: rgb(4 29 64); font-weight: 600; background: rgb(4 29 64 / 0.04); }

    .elg-stores-form {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        max-width: 30rem;
        margin-top: 0.5rem;
    }
    .elg-stores-select-wrap { display: block; }
    .elg-stores-select {
        width: 100%;
        height: 2.75rem;
        padding: 0 2.25rem 0 0.875rem;
        border: 1px solid rgb(4 29 64);
        border-radius: 0;
        background-color: var(--color-bg);
        color: rgb(4 29 64);
        font-size: 0.6875rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23041d40' stroke-width='1.5'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3Cpath d='M9.5 11l2.5 2.5 2.5-2.5'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 0.75rem center;
        background-size: 1rem;
    }
    .elg-stores-select:disabled { opacity: 0.5; }
    .elg-stores-form-actions { display: flex; justify-content: flex-end; }
    .elg-stores-cta {
        padding: 0.75rem 1rem;
        min-width: 6.5rem;
        background: rgb(4 29 64);
        color: var(--color-on-primary);
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        border: 0;
        cursor: pointer;
    }
    .elg-stores-cta:disabled { opacity: 0.5; cursor: not-allowed; }

    /* ---------- Países El Ganso (acordeón) ---------- */
    .elg-stores-countries-title {
        font-size: clamp(0.9375rem, 1.4vw, 1.125rem);
        font-weight: 500;
        text-transform: uppercase;
        margin: 0 0 1rem;
    }
    .elg-stores-country-list { max-width: 25rem; }
    .elg-stores-country-btn {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.4rem 0;
        font-size: 0.75rem;
        color: rgb(4 29 64);
        background: none;
        border: 0;
        cursor: pointer;
        text-align: left;
    }
    .elg-stores-country-icon { font-size: 0.875rem; line-height: 1; }
    /* Tiendas del país: agrupadas por ciudad y con scroll interno para que un
     * país con muchas tiendas (España) no alargue la página */
    .elg-stores-country-stores {
        max-height: 50vh;
        overflow-y: auto;
        overscroll-behavior: contain;
        margin: 0.25rem 0 0.75rem;
        padding-right: 0.5rem;
        scrollbar-width: thin;
        scrollbar-color: rgb(4 29 64 / 0.35) transparent;
    }
    @media (min-width: 1024px) { .elg-stores-country-stores { max-height: 60vh; } }
    /* Degradado abajo: indica que hay más tiendas */
    .elg-stores-country-stores::after {
        content: "";
        position: sticky;
        bottom: 0;
        display: block;
        height: 1.5rem;
        margin-top: -1.5rem;
        background: linear-gradient(to bottom, rgb(255 255 255 / 0), var(--color-bg));
        pointer-events: none;
    }
    /* Nombre de la ciudad fijo arriba mientras se recorren sus tiendas */
    .elg-stores-city {
        position: sticky;
        top: 0;
        z-index: 1;
        margin: 0;
        padding: 0.5rem 0 0.35rem;
        background: var(--color-bg);
        font-size: 0.6875rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        border-bottom: 1px solid rgb(4 29 64 / 0.35);
    }
    .elg-stores-city-group + .elg-stores-city-group { margin-top: 0.5rem; }
    .elg-stores-city-group .elg-stores-store:first-child { border-top: 0; }
    .elg-stores-store {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        padding: 0.6rem 0;
        border-top: 1px solid rgb(4 29 64 / 0.12);
        font-size: 0.6875rem;
    }
    .elg-stores-store-name {
        font-weight: 600;
        font-size: 0.75rem;
        text-align: left;
        background: none;
        border: 0;
        padding: 0;
        color: rgb(4 29 64);
        cursor: pointer;
    }
    .elg-stores-store-name:hover { text-decoration: underline; }
    .elg-stores-store-line { color: rgb(4 29 64 / 0.75); }
    /* Teléfono pulsable: en negrita y subrayado al pasar el cursor (como en el globo del mapa) */
    a.elg-stores-store-line { color: rgb(4 29 64); font-weight: 600; text-decoration: none; }
    a.elg-stores-store-line:hover { text-decoration: underline; text-underline-offset: 2px; }
    .elg-stores-store-link {
        margin-top: 0.2rem;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: rgb(4 29 64);
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    /* ---------- Mapa: globo de la tienda (InfoWindow de Google Maps) ----------
     * Los círculos de los clusters y las chinchetas los dibuja Google (stores_map.phtml). */
    .elg-stores-popup {
        display: flex;
        flex-direction: column;
        gap: 0.15rem;
        font-size: 0.75rem;
        line-height: 1.4;
        color: rgb(4 29 64);
    }
    .elg-stores-popup strong { font-size: 0.8125rem; margin-bottom: 0.15rem; }
    /* Lo que se puede pulsar (teléfono, "Cómo llegar") en negrita */
    .elg-stores-popup a { color: rgb(4 29 64); font-weight: 600; text-decoration: none; }
    .elg-stores-popup a:hover { text-decoration: underline; text-underline-offset: 2px; }
    .elg-stores-popup-link {
        margin-top: 0.35rem;
        font-size: 0.625rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        text-decoration: underline;
    }
}
