.sh {
    --sh-accent: #00A0DC;
    --sh-text: #4D4D4D;
    --sh-dark: #414141;
    --sh-muted: #999999;
    --sh-sub: #808080;
    --sh-panel: #F2F2F2;
    --sh-line: #D8D8D8;
    --sh-h: 80px;
    --sh-ease: cubic-bezier(.22, .61, .36, 1);
    --sh-speed: .3s;

    position: relative;
    z-index: 1989;
    background: #FFFFFF;
    border-bottom: 1px solid var(--sh-line);
    font-family: 'AvenirNextLTPro-Regular', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--sh-text);
}
#header.sticky { position: fixed; top: 0; left: 0; right: 0; }

/* Convivencia con style_header_nuevo.css durante la migración: #header.sh pisa a las reglas
   #header del CSS anterior (borde completo y flex column-reverse en ≤991px) */
#header.sh { display: block; padding: 0; border: 0; border-bottom: 1px solid var(--sh-line); }

/* Reset con :where() = especificidad 0, para que cualquier clase .sh-* lo pise */
:where(.sh) *, :where(.sh) *::before, :where(.sh) *::after { box-sizing: border-box; }
:where(.sh) ul { list-style: none; margin: 0; padding: 0; }
:where(.sh) p { margin: 0; }
:where(.sh) a { color: inherit; text-decoration: none; }
:where(.sh) button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sh :focus-visible { outline: 2px solid var(--sh-accent); outline-offset: 2px; }

.sh-icon {
    width: 24px;
    height: 24px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sh-chev { width: 12px; height: 12px; transition: transform var(--sh-speed) ease; }
@media (min-width: 992px) {
    .sh-chev { width: 26px; height: 26px; margin: -8px -6px; }
}

/* ---------- Barra principal ---------- */
.sh-bar {
    display: flex;
    align-items: center;
    gap: 32px;
    width: 96.5%;
    max-width: 1840px;
    height: var(--sh-h);
    margin: 0 auto;
}
.sh-logo { display: block; flex: none; margin-right: auto; }
.sh-logo img { display: block; width: 250px; height: auto; }

.sh-burger,
.sh-drawer-head,
.sh-panel-head { display: none; }

.sh-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--sh-text);
    transition: color .2s;
}
.sh-search-btn:hover { color: var(--sh-accent); }
.sh-search-btn .sh-icon { width: 28px; height: 28px; }

/* ---------- Navegación (desktop) ---------- */
.sh-nav { align-self: stretch; }
.sh-menu { display: flex; height: 100%; gap: clamp(18px, 2.4vw, 63px); }
.sh-item { position: relative; display: flex; }
.sh-item--mega { position: static; }

.sh-link {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    padding-top: 4px;
    border-bottom: 4px solid transparent;
    font-weight: 600;
    font-size: 13px;
    line-height: 16px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--sh-text);
    transition: color .2s, border-color .2s;
}
.sh-link:hover,
.sh-link[aria-expanded="true"] { color: var(--sh-accent); border-bottom-color: var(--sh-accent); }
.sh-link[aria-expanded="true"] .sh-chev { transform: rotate(180deg); }
.sh-item.destacar > .sh-link { color: #000000; font-family: 'AvenirNextLTPro-Bold', sans-serif; font-weight: 700; }

@media (min-width: 1501px) {
    .sh-link { font-size: 15px; line-height: 18px; }
}

/* Paneles (desplegables) */
.sh-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    min-width: 220px;
    transform: translateX(-50%);
    background: var(--sh-panel);
    border-top: 4px solid var(--sh-accent);
    box-shadow: 0 2px 10px 1px rgb(0 0 0 / 19%);
}
.sh-item.is-open > .sh-panel { display: block; animation: sh-fade .2s ease; }
@keyframes sh-fade { from { opacity: 0; } to { opacity: 1; } }

.sh-sublist { padding: 8px 18px; }
.sh-sublist a {
    display: block;
    padding: 8px 0;
    font-family: 'AvenirNextLTPro-Bold', sans-serif;
    font-weight: 700;
    font-size: 12px;
    line-height: 22px;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--sh-sub);
    transition: color .2s;
}
.sh-sublist a:hover { color: var(--sh-accent); }

/* Mega menú de vehículos */
.sh-item--mega > .sh-panel {
    left: 0;
    right: 0;
    transform: none;
    border-top: 0;
    max-height: calc(100vh - var(--sh-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
}
.sh-item--mega > .sh-panel::-webkit-scrollbar { display: none; }
.sh-mega { padding: 24px 24px 40px; }

.sh-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px clamp(24px, 5vw, 80px);
    margin: 8px auto 40px;
}
.sh-tab {
    padding: 4px 10px;
    font-family: 'AvenirNextLTPro-Demi', sans-serif;
    font-weight: 500;
    font-size: 18px;
    line-height: 22px;
    text-transform: uppercase;
    color: var(--sh-muted);
    transition: color .2s;
}
.sh-tab:hover,
.sh-tab[aria-selected="true"] { color: var(--sh-accent); }
.sh-tab[aria-selected="true"] { font-family: 'AvenirNextLTPro-Bold', sans-serif; font-weight: 700; }

.sh-cars {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 40px 24px;
    max-width: 1700px;
    margin: 0 auto;
}
.sh-car { justify-self: center; width: 100%; max-width: 300px; }
.sh-car:only-child { grid-column: 1 / -1; } /* categoría con un solo auto: centrado */
.sh-tabpanel[hidden] { display: none; }
.sh-car-link { display: block; }
.sh-car-img {
    display: block;
    width: 100%;
    max-width: 232px;
    height: auto;
    aspect-ratio: 480 / 190;
    object-fit: contain;
}
.sh-car-name {
    display: block;
    margin: 16px 0 8px 14px;
    font-family: 'AvenirNextLTPro-Bold', sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 19px;
    text-transform: uppercase;
    color: var(--sh-dark);
    transition: color .2s;
}
.sh-car-link:hover .sh-car-name { color: var(--sh-accent); }
.sh-car-tags { display: flex; gap: 8px; margin: 0 0 8px 10px; }
.sh-car-tags:empty { display: none; }
.sh-car-tags img { display: block; width: 54px; height: 19px; }
.sh-car-price,
.sh-car-cuota { margin: 0 0 6px 14px; font-size: 14px; line-height: 17px; color: var(--sh-dark); }
.sh-car-cuota { margin-bottom: 12px; font-weight: 600; }
.sh-car-actions { display: flex; flex-wrap: wrap; margin-left: 14px; }
.sh-car-actions a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 24px;
    padding: 0 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--sh-muted);
    transition: gap .3s, color .2s;
}
.sh-car-actions a:first-child { padding-left: 0; }
.sh-car-actions a + a { border-left: 1px solid #D2D1D1; }
.sh-car-actions a::after {
    content: "";
    width: 6px;
    height: 6px;
    border: solid currentColor;
    border-width: 1.5px 1.5px 0 0;
    transform: rotate(45deg);
}
.sh-car-actions a:hover { gap: 14px; color: var(--sh-accent); }

/* ---------- Buscador ---------- */
.sh-search {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    height: var(--sh-h);
    padding: 0 3.5%;
    background: #FFFFFF;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility 0s .2s;
}
.sh-search.is-open { opacity: 1; visibility: visible; transition: opacity .2s; }
@media (min-width: 992px) {
    /* Desktop: el buscador empieza después del logo (margen de .sh-bar + 250px de logo + 32px de gap) */
    .sh-search { left: calc(max(1.75%, (100% - 1840px) / 2) + 282px); }
}
.sh-search form {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border-bottom: 1px solid var(--sh-accent);
}
.sh-search input[type="search"] {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    border: 0;
    outline: 0;
    background: none;
    font: inherit;
    font-size: 16px; /* 16px evita el zoom automático en iOS */
    color: var(--sh-text);
}
.sh-search input[type="search"]::placeholder { color: var(--sh-dark); }
.sh-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.sh-search button { display: flex; padding: 8px; color: var(--sh-text); }
.sh-search button:hover { color: var(--sh-accent); }
.sh-search .sh-icon { width: 20px; height: 20px; }

.sh-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

html.sh-lock,
html.sh-lock body { overflow: hidden; }

/* =========================================================================
   Mobile / tablet (≤ 991px): el mismo marcado se convierte en drawer
   con paneles que se deslizan (drill-down)
   ========================================================================= */
@media (max-width: 991px) {
    .sh {
        --sh-h: 54px;
        border-bottom: 0;
        box-shadow: 0 4px 4px rgb(0 0 0 / 5%);
    }
    #header.sh { border-bottom: 0; }
    .sh-bar {
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        gap: 0;
        width: auto;
        max-width: none;
        padding: 0 9px 0 5px;
    }
    .sh-burger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        color: var(--sh-accent);
    }
    .sh-burger .sh-icon { width: 30px; height: 30px; stroke-width: 2.2; }
    .sh-logo { grid-column: 2; justify-self: center; margin: 0; }
    .sh-logo img { width: 66px; }
    .sh-search-btn { grid-column: 3; }
    .sh-search-btn .sh-icon { width: 24px; height: 24px; }

    /* Drawer */
    .sh-nav {
        position: fixed;
        inset: 0;
        z-index: 10;
        overflow: hidden;
        overflow: clip; /* clip impide que focus() desplace el drawer en horizontal */
        background: var(--sh-panel);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform var(--sh-speed) var(--sh-ease), visibility 0s var(--sh-speed);
    }
    .sh.nav-open .sh-nav {
        transform: none;
        visibility: visible;
        transition: transform var(--sh-speed) var(--sh-ease);
    }

    .sh-drawer-head,
    .sh-panel-head {
        display: flex;
        align-items: center;
        min-height: 50px;
        background: #FFFFFF;
    }
    .sh-drawer-head { justify-content: flex-end; }
    .sh-head-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 56px;
        height: 50px;
        color: var(--sh-text);
    }
    .sh-head-btn .sh-icon { width: 18px; height: 18px; stroke-width: 2; }
    .sh-back { color: var(--sh-accent); }
    .sh-back .sh-icon { width: 20px; height: 20px; stroke-width: 2.4; }
    .sh-panel-title {
        flex: 1;
        text-align: center;
        font-family: 'AvenirNextLTPro-Bold', sans-serif;
        font-weight: 700;
        font-size: 14px;
        line-height: 17px;
        text-transform: uppercase;
        color: var(--sh-accent);
    }

    .sh-menu {
        display: block;
        height: calc(100% - 50px);
        padding: 0 24px 24px 26px;
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .sh-item,
    .sh-item--mega { display: block; position: static; }

    .sh-link,
    .sh-sublist a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        height: auto;
        margin-bottom: 8px;
        padding: 24px 9px 16px 0;
        border-bottom: 1px solid var(--sh-muted);
        font-family: 'AvenirNextLTPro-Bold', sans-serif;
        font-weight: 700;
        font-size: 13px;
        line-height: 16px;
        text-align: left;
        white-space: normal;
        color: var(--sh-text);
    }
    .sh-link:hover,
    .sh-link[aria-expanded="true"] { color: var(--sh-text); border-bottom-color: var(--sh-muted); }
    .sh-link .sh-chev,
    .sh-link[aria-expanded="true"] .sh-chev { transform: rotate(-90deg); color: var(--sh-accent); width: 14px; height: 14px; }

    /* Paneles: se deslizan desde la derecha sobre el drawer */
    .sh-panel,
    .sh-item--mega > .sh-panel {
        display: flex;
        flex-direction: column;
        position: absolute;
        inset: 0;
        z-index: 2;
        min-width: 0;
        max-height: none;
        overflow: hidden;
        transform: translateX(100%);
        visibility: hidden;
        border: 0;
        box-shadow: none;
        transition: transform var(--sh-speed) var(--sh-ease), visibility 0s var(--sh-speed);
    }
    .sh-item.is-open > .sh-panel {
        display: flex;
        transform: none;
        visibility: visible;
        animation: none;
        transition: transform var(--sh-speed) var(--sh-ease);
    }
    .sh-panel-body {
        flex: 1;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-top: 4px solid var(--sh-accent);
    }

    .sh-sublist { padding: 0 24px 24px 26px; }
    .sh-sublist a { font-size: 14px; line-height: 17px; padding: 20px 9px 15px 0; }
    .sh-sublist a:hover { color: var(--sh-accent); }

    /* Vehículos en mobile = como el original: lista de categorías → panel de autos por categoría */
    .sh-mega { padding: 0; }
    .sh-tabs {
        display: block;
        margin: 0;
        padding: 0 24px 24px 26px;
    }
    .sh-tab,
    .sh-tab[aria-selected="true"] {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        margin-bottom: 8px;
        padding: 20px 9px 15px 0;
        border-bottom: 1px solid var(--sh-muted);
        font-family: 'AvenirNextLTPro-Bold', sans-serif;
        font-weight: 700;
        font-size: 14px;
        line-height: 17px;
        text-align: left;
        color: var(--sh-text);
    }
    .sh-tab::after {
        content: "";
        flex: none;
        width: 8px;
        height: 8px;
        margin-right: 4px;
        border: solid var(--sh-accent);
        border-width: 2px 2px 0 0;
        transform: rotate(45deg);
    }

    /* 3er nivel: panel de autos de la categoría. El atributo hidden solo aplica en desktop */
    .sh-tabpanel,
    .sh-tabpanel[hidden] {
        display: flex;
        flex-direction: column;
        position: absolute;
        inset: 0;
        z-index: 3;
        overflow: hidden;
        background: var(--sh-panel);
        transform: translateX(100%);
        visibility: hidden;
        transition: transform var(--sh-speed) var(--sh-ease), visibility 0s var(--sh-speed);
    }
    .sh-tabpanel.is-open {
        transform: none;
        visibility: visible;
        transition: transform var(--sh-speed) var(--sh-ease);
    }
    .sh-cars {
        flex: 1;
        width: 100%;
        margin: 0; /* sin el margin:auto de desktop, que en flex-column encoge la grilla a su contenido */
        overflow-y: auto;
        overscroll-behavior: contain;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        align-content: start;
        gap: 32px 20px;
        padding: 24px 24px 90px; /* 90px: espacio para la barra fija inferior (menu-side) */
        border-top: 4px solid var(--sh-accent);
    }
    .sh-car { max-width: 272px; }
    .sh-car-img { max-width: none; }
    .sh-car-actions a { font-size: 12px; }

    .sh-search { padding: 0 17px; }
}

@media (prefers-reduced-motion: reduce) {
    .sh *,
    .sh *::before,
    .sh *::after { transition-duration: 0s !important; animation: none !important; }
}
