/*
 * Autos Esquivel · V2 refinement
 * A calm visual pass: more breathing room, clearer grouping and motion that
 * confirms an interaction without changing any public flow or destination.
 */

body.public-site-v2 {
    --ae-v2-ease: cubic-bezier(.2, .72, .18, 1);
    --ae-v2-lift-shadow: 0 24px 58px rgba(26, 20, 16, .14);
}

/*
 * Search placement requested by the commercial team:
 * - Desktop: the large web search belongs only on Home.
 * - Inventory and the rest of the public flow do not repeat the large search panel.
 * - Mobile: the large Home panel is removed because the persistent bottom navigation
 *   already exposes the dedicated “Buscar” sheet.
 */
body.public-site-v2 .ae-v2-inventory .ae-v2-filter-panel {
    display: none !important;
}

body.public-site-v2 .ae-v2-home {
    overflow: clip;
}

body.public-site-v2 .ae-v2-section {
    padding-block: clamp(78px, 8vw, 132px);
}

body.public-site-v2 .ae-v2-section + .ae-v2-section {
    border-top: 1px solid color-mix(in srgb, var(--ae-v2-taupe) 19%, transparent);
}

body.public-site-v2 .ae-v2-section-head {
    align-items: end;
    gap: 24px;
    margin-bottom: clamp(26px, 3.4vw, 42px);
    padding-bottom: 22px;
}

body.public-site-v2 .ae-v2-section-head__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

body.public-site-v2 .ae-v2-section-head__link:hover,
body.public-site-v2 .ae-v2-section-head__link:focus-visible {
    color: var(--ae-v2-taupe);
    letter-spacing: .065em;
}

body.public-site-v2 .ae-v2-categories,
body.public-site-v2 .ae-v2-grid,
body.public-site-v2 .ae-v2-home .vehicle-grid {
    gap: clamp(14px, 1.55vw, 24px);
}

body.public-site-v2 .ae-v2-category {
    border-radius: 18px !important;
    box-shadow: 0 12px 28px rgba(18, 14, 11, .10);
    isolation: isolate;
}

body.public-site-v2 .ae-v2-category::before {
    position: absolute;
    z-index: 1;
    top: 14px;
    right: 14px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ae-v2-taupe);
    box-shadow: 0 0 0 5px rgba(140, 122, 107, .18);
    content: "";
    opacity: 0;
    transform: scale(.5);
    transition: opacity .28s ease, transform .28s var(--ae-v2-ease);
}

body.public-site-v2 .ae-v2-category:hover,
body.public-site-v2 .ae-v2-category:focus-visible {
    box-shadow: var(--ae-v2-lift-shadow);
    transform: translate3d(0, -5px, 0);
}

body.public-site-v2 .ae-v2-category:hover::before,
body.public-site-v2 .ae-v2-category:focus-visible::before {
    opacity: 1;
    transform: scale(1);
}

body.public-site-v2 .ae-v2-energy-categories {
    gap: clamp(14px, 1.6vw, 22px);
    margin-top: clamp(20px, 2.4vw, 32px);
}

body.public-site-v2 .ae-v2-energy-category {
    border-radius: 18px !important;
}

body.public-site-v2 .ae-v2-energy-category::before {
    position: absolute;
    inset: auto -12% -86% auto;
    width: 220px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, .10);
    content: "";
    transform: scale(.72);
    transition: transform .6s var(--ae-v2-ease);
}

body.public-site-v2 .ae-v2-energy-category:hover::before,
body.public-site-v2 .ae-v2-energy-category:focus-visible::before {
    transform: scale(1.18);
}

body.public-site-v2 .ae-v2-stats {
    overflow: hidden;
    border-radius: 18px !important;
}

body.public-site-v2 .ae-v2-stat {
    padding: clamp(24px, 2.7vw, 36px);
    transition: background-color .28s ease, transform .28s var(--ae-v2-ease), box-shadow .28s ease;
}

body.public-site-v2 .ae-v2-stat:hover {
    position: relative;
    z-index: 1;
    background: color-mix(in srgb, var(--ae-v2-taupe) 10%, #fff);
    box-shadow: 0 18px 38px rgba(36, 28, 22, .13);
    transform: translate3d(0, -4px, 0);
}

html[data-theme="dark"] body.public-site-v2 .ae-v2-stat:hover {
    background: color-mix(in srgb, var(--ae-v2-taupe) 18%, #151515);
}

body.public-site-v2 .ae-v2-home .vehicle-grid > * {
    min-width: 0;
}

body.public-site-v2 .vehicle-card {
    border-radius: 18px !important;
    overflow: hidden;
    transition: transform .3s var(--ae-v2-ease), box-shadow .3s ease, border-color .3s ease;
}

body.public-site-v2 .vehicle-card:hover {
    border-color: color-mix(in srgb, var(--ae-v2-taupe) 72%, transparent);
    box-shadow: var(--ae-v2-lift-shadow);
    transform: translate3d(0, -5px, 0);
}

body.public-site-v2 .vehicle-card img {
    transition: transform .58s var(--ae-v2-ease), filter .38s ease;
}

body.public-site-v2 .vehicle-card:hover img {
    filter: saturate(1.06) contrast(1.02);
    transform: scale(1.025);
}

body.public-site-v2 .ae-v2-sell,
body.public-site-v2 .ae-v2-finance-strip {
    overflow: hidden;
    border-radius: 22px !important;
}

body.public-site-v2 .ae-v2-sell {
    box-shadow: var(--ae-v2-lift-shadow);
}

body.public-site-v2 .ae-v2-sell__media img {
    transition: transform .8s var(--ae-v2-ease), filter .42s ease;
}

body.public-site-v2 .ae-v2-sell:hover .ae-v2-sell__media img {
    filter: saturate(1.12) contrast(1.04) brightness(1);
    transform: scale(1.045);
}

body.public-site-v2 .ae-v2-finance-strip {
    border: 1px solid rgba(140, 122, 107, .54);
    box-shadow: 0 15px 36px rgba(51, 40, 32, .09);
}

body.public-site-v2 :is(.ae-v2-button, .ae-hero__cta, .ae-legacy-search__submit) {
    box-shadow: 0 10px 22px rgba(12, 10, 9, .16);
}

body.public-site-v2 :is(.ae-v2-button, .ae-hero__cta, .ae-legacy-search__submit):hover,
body.public-site-v2 :is(.ae-v2-button, .ae-hero__cta, .ae-legacy-search__submit):focus-visible {
    box-shadow: 0 16px 30px rgba(12, 10, 9, .24);
    transform: translate3d(0, -3px, 0);
}

body.public-site-v2 :is(input, select, textarea):focus-visible,
body.public-site-v2 button:focus-visible,
body.public-site-v2 a:focus-visible {
    outline: 2px solid var(--ae-v2-taupe);
    outline-offset: 3px;
}

@media (max-width: 760px) {
    /* The large search is desktop-only. Mobile keeps the bottom “Buscar” action/sheet. */
    body.public-site-v2 .ae-v2-home-search-shell,
    body.public-site-v2 .ae-home-search-noscript {
        display: none !important;
    }

    /* `100dvw` incluye el espacio del scrollbar en algunos navegadores
     * móviles. El hero full-bleed quedaba desplazado media barra hacia la
     * izquierda y cortaba CTA/header. En móvil el padre ya ocupa el viewport,
     * por lo que no necesita compensación negativa. */
    body.public-site-v2 [data-public-home-hero] {
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-inline: 0 !important;
    }

    /* Home V2: el shell siempre debe calcularse contra el viewport real.
     * Esto evita que header, hero y el comparador de sucursales conserven un
     * ancho de escritorio al abrirse desde Safari/Chrome móvil. */
    body.public-site-v2 .ae-v2-shell {
        width: min(1320px, calc(100% - 28px)) !important;
        max-width: calc(100vw - 28px) !important;
        min-width: 0 !important;
    }

    body.public-site-v2 :is(.ae-v2-home-search-shell, .ae-v2-section--branch-compare) {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: clip;
    }

    body.public-site-v2 .ae-public-nav .ae-nav-main__inner {
        width: min(var(--shell), calc(100% - 24px)) !important;
        max-width: calc(100vw - 24px) !important;
        min-width: 0 !important;
        margin-inline: auto !important;
        grid-template-columns: 44px minmax(0, 1fr) 44px !important;
        gap: 8px !important;
    }

    body.public-site-v2 .ae-public-nav .ae-nav-brand {
        width: min(118px, 100%) !important;
        min-width: 0 !important;
    }

    body.public-site-v2 .ae-hero__shell,
    body.public-site-v2 .ae-hero__content,
    body.public-site-v2 .ae-hero__actions {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body.public-site-v2 .ae-hero__actions {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.public-site-v2 .ae-hero__cta {
        min-width: 0 !important;
        padding-inline: 10px !important;
        white-space: nowrap;
    }

    body.public-site-v2 .ae-energy-split,
    body.public-site-v2 .ae-energy-split__scene,
    body.public-site-v2 .ae-energy-split__content {
        min-width: 0 !important;
        max-width: 100% !important;
    }

    body.public-site-v2 .ae-energy-split__content {
        width: 48% !important;
        padding-inline: 12px !important;
    }

    body.public-site-v2 .ae-energy-split__title {
        font-size: clamp(23px, 7.5vw, 34px) !important;
        letter-spacing: -.045em !important;
        overflow-wrap: anywhere;
    }

    body.public-site-v2 .ae-v2-section {
        padding-block: 64px;
    }

    body.public-site-v2 .ae-v2-section-head {
        align-items: start;
        margin-bottom: 24px;
    }

    body.public-site-v2 :is(.ae-v2-category, .ae-v2-energy-category, .ae-v2-stats, .ae-v2-sell, .ae-v2-finance-strip, .vehicle-card) {
        border-radius: 14px !important;
    }

    body.public-site-v2 .ae-v2-stat {
        min-height: 142px;
    }
}

@media (max-width: 390px) {
    body.public-site-v2 .ae-public-nav .ae-nav-main__inner {
        width: calc(100% - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        grid-template-columns: 42px minmax(0, 1fr) 42px !important;
        gap: 6px !important;
    }

    body.public-site-v2 .ae-hero__actions {
        grid-template-columns: 1fr !important;
    }

    body.public-site-v2 .ae-energy-split__content {
        width: 49% !important;
        padding-inline: 10px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.public-site-v2 *,
    body.public-site-v2 *::before,
    body.public-site-v2 *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

/* The rest of the public funnel uses the same spacing and calm interaction
   language as the showroom without changing a form, filter, or endpoint. */
body.public-site-v2 :is(
    .ae-inventory-hero__stage,
    .ae-financing-hero__deck-stage,
    .ae-financing-simulator,
    .ae-finance-ui__workspace,
    .ae-sell-page__configurator,
    .ae-contact__form-panel,
    .ae-contact-map__shell,
    .favorites-premium__selection
) {
    border-radius: 20px !important;
    box-shadow: 0 18px 46px rgba(26, 20, 16, .10);
}

body.public-site-v2 :is(
    .ae-inventory-hero__stage,
    .ae-financing-hero__deck-stage,
    .ae-sell-page__configurator,
    .ae-contact__form-panel,
    .ae-contact-map__shell
) {
    overflow: hidden;
}

body.public-site-v2 :is(
    .ae-inventory-results,
    .ae-financing-overview,
    .ae-financing-products,
    .ae-financing-faq,
    .ae-sell-page__rail,
    .ae-sell-page__faq,
    .ae-contact__workspace,
    .favorites-premium__selection
) {
    padding-block: clamp(64px, 7vw, 116px);
}

body.public-site-v2 :is(
    .ae-inventory-card-wrap,
    .ae-financing-product-card,
    .ae-sell__option,
    .ae-contact__branch-card,
    .ae-contact__info-grid article,
    .favorites-premium__counter
) {
    border-radius: 16px !important;
    transition: transform .28s var(--ae-v2-ease), box-shadow .28s ease, border-color .28s ease, background-color .28s ease;
}

body.public-site-v2 :is(
    .ae-inventory-card-wrap,
    .ae-financing-product-card,
    .ae-sell__option,
    .ae-contact__branch-card,
    .ae-contact__info-grid article
):hover {
    box-shadow: 0 19px 38px rgba(26, 20, 16, .14);
    transform: translate3d(0, -4px, 0);
}

body.public-site-v2 :is(
    .ae-inventory-button,
    .ae-financing-button,
    .ae-sell-page__primary,
    .ae-sell-page__secondary,
    .ae-contact__submit,
    .favorites-premium__button,
    .favorites-premium__empty-action,
    .ae-finance-ui button
) {
    transition: transform .22s var(--ae-v2-ease), box-shadow .22s ease, background-color .22s ease, color .22s ease, border-color .22s ease;
}

body.public-site-v2 :is(
    .ae-inventory-button,
    .ae-financing-button,
    .ae-sell-page__primary,
    .ae-sell-page__secondary,
    .ae-contact__submit,
    .favorites-premium__button,
    .favorites-premium__empty-action,
    .ae-finance-ui button
):hover,
body.public-site-v2 :is(
    .ae-inventory-button,
    .ae-financing-button,
    .ae-sell-page__primary,
    .ae-sell-page__secondary,
    .ae-contact__submit,
    .favorites-premium__button,
    .favorites-premium__empty-action,
    .ae-finance-ui button
):focus-visible {
    box-shadow: 0 14px 28px rgba(26, 20, 16, .18);
    transform: translate3d(0, -2px, 0);
}

body.public-site-v2 :is(.ae-contact__field, .ae-finance-ui__field):focus-within {
    border-color: color-mix(in srgb, var(--ae-v2-taupe) 74%, transparent);
    box-shadow: 0 0 0 4px rgba(140, 122, 107, .13);
}

body.public-site-v2 .favorites-premium__hero,
body.public-site-v2 .ae-financing-hero,
body.public-site-v2 .ae-inventory-hero,
body.public-site-v2 .ae-sell-page__hero {
    position: relative;
    isolation: isolate;
}

body.public-site-v2 .favorites-premium__hero::after,
body.public-site-v2 .ae-financing-hero::after,
body.public-site-v2 .ae-inventory-hero::after,
body.public-site-v2 .ae-sell-page__hero::after {
    position: absolute;
    z-index: -1;
    inset: auto 8% 0 auto;
    width: min(24vw, 320px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(140, 122, 107, .20), transparent 68%);
    content: "";
    pointer-events: none;
}

@media (max-width: 760px) {
    body.public-site-v2 :is(
        .ae-inventory-hero__stage,
        .ae-financing-hero__deck-stage,
        .ae-financing-simulator,
        .ae-finance-ui__workspace,
        .ae-sell-page__configurator,
        .ae-contact__form-panel,
        .ae-contact-map__shell,
        .favorites-premium__selection
    ) {
        border-radius: 14px !important;
    }

    body.public-site-v2 :is(
        .ae-inventory-results,
        .ae-financing-overview,
        .ae-financing-products,
        .ae-financing-faq,
        .ae-sell-page__rail,
        .ae-sell-page__faq,
        .ae-contact__workspace,
        .favorites-premium__selection
    ) {
        padding-block: 54px;
    }
}

/* Empty inventory: keep the WhatsApp CTA branded and readable in both themes. */
body.public-site-v2 .ae-v2-empty .ae-v2-button--light,
html[data-theme="light"] body.public-site-v2 .ae-v2-empty .ae-v2-button--light,
html[data-theme="dark"] body.public-site-v2 .ae-v2-empty .ae-v2-button--light {
    border-color: #128c7e !important;
    background: #128c7e !important;
    color: #fff !important;
}

body.public-site-v2 .ae-v2-empty .ae-v2-button--light:hover,
body.public-site-v2 .ae-v2-empty .ae-v2-button--light:focus-visible,
html[data-theme="light"] body.public-site-v2 .ae-v2-empty .ae-v2-button--light:hover,
html[data-theme="light"] body.public-site-v2 .ae-v2-empty .ae-v2-button--light:focus-visible,
html[data-theme="dark"] body.public-site-v2 .ae-v2-empty .ae-v2-button--light:hover,
html[data-theme="dark"] body.public-site-v2 .ae-v2-empty .ae-v2-button--light:focus-visible {
    border-color: #0f766e !important;
    background: #0f766e !important;
    color: #fff !important;
}

/* Compact header actions: preserve a clean silhouette in both themes. */
@media (min-width: 1081px) {
    body.public-site-v2 .ae-public-nav .ae-nav-link--sell {
        min-height: 40px;
        padding: 0 17px;
        border-radius: 999px !important;
        box-shadow: 0 7px 18px rgba(73, 58, 48, .16);
        transition: transform .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
    }

    body.public-site-v2 .ae-public-nav .ae-nav-link--sell:hover,
    body.public-site-v2 .ae-public-nav .ae-nav-link--sell:focus-visible {
        border-color: var(--ae-v2-action-hover);
        background: var(--ae-v2-action-hover) !important;
        box-shadow: 0 10px 22px rgba(73, 58, 48, .22);
        transform: translateY(-1px);
    }

    body.public-site-v2 .ae-public-nav :is(.ae-nav-header-favorite, .ae-nav-theme-toggle) {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        flex-basis: 40px;
        margin-left: 7px;
        border-color: rgba(255, 255, 255, .18);
        border-radius: 50% !important;
        background: rgba(255, 255, 255, .055);
        box-shadow: 0 5px 16px rgba(0, 0, 0, .10);
    }

    body.public-site-v2 .ae-public-nav :is(.ae-nav-favorite-heart, .ae-nav-theme-toggle__icon, .ae-nav-theme-toggle__icon svg) {
        width: 18px;
        height: 18px;
    }

    body.public-site-v2 .ae-public-nav :is(.ae-nav-header-favorite, .ae-nav-theme-toggle):hover,
    body.public-site-v2 .ae-public-nav :is(.ae-nav-header-favorite, .ae-nav-theme-toggle):focus-visible {
        border-color: rgba(255, 255, 255, .44) !important;
        background: rgba(255, 255, 255, .12) !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, .15);
        transform: translateY(-1px);
    }

    html[data-theme="light"] body.public-site-v2 .ae-public-nav :is(.ae-nav-header-favorite, .ae-nav-theme-toggle) {
        border-color: rgba(23, 19, 17, .16);
        background: #faf9f7;
        color: #171311;
        box-shadow: 0 5px 16px rgba(55, 43, 34, .08);
    }

    html[data-theme="light"] body.public-site-v2 .ae-public-nav :is(.ae-nav-header-favorite, .ae-nav-theme-toggle):hover,
    html[data-theme="light"] body.public-site-v2 .ae-public-nav :is(.ae-nav-header-favorite, .ae-nav-theme-toggle):focus-visible {
        border-color: rgba(117, 98, 85, .48) !important;
        background: #eee8e2 !important;
        color: #5f4f43 !important;
    }
}
