/* ============================================================
   BYD Cuautitlán — site styles
   ============================================================ */

/* ---------- Fonts (self-hosted, variable) ---------- */
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/assets/fonts/montserrat-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
        U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193,
        U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/assets/fonts/montserrat-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F,
        U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
        U+A720-A7FF;
}

/* ---------- Design tokens ---------- */
:root {
    --black: #000000;
    --ink: #0a0a0a;
    --gray-700: #3a3a3a;
    --gray-600: #585858;
    --gray-400: #999999;
    --gray-200: #e3e3e3;
    --gray-100: #f0f0f0;
    --gray-50: #f7f8f8;
    --white: #ffffff;

    --text: var(--ink);
    --muted: var(--gray-600);

    --font: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --t1: 0.78rem;
    --t2: 1rem;
    --t3: 1.2rem;
    --t4: 1.44rem;
    --t5: 2.07rem;
    --t6: 2.98rem;

    --br: 8px;
    --br-sm: 4px;

    --header-h: 96px;
    --subheader-h: 40px;

    --container: 1280px;
    --gap: 32px;

    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.18);
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (max-width: 800px) {
    :root {
        --t6: 1.95rem;
        --t5: 1.62rem;
        --t4: 1.35rem;
        --t3: 1.13rem;
        --header-h: 80px;
        --gap: 24px;
    }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
    font-family: var(--font);
    font-size: var(--t2);
    line-height: 1.5;
    color: var(--text);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

img, picture, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input, select, textarea { font: inherit; }

h1, h2, h3, h4 { line-height: 1.15; font-weight: 700; }

/* ---------- Utilities ---------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(16px, 5vw, 64px);
}
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 28px;
    font-size: var(--t2);
    font-weight: 600;
    border-radius: var(--br-sm);
    border: 1px solid transparent;
    transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
        border-color 0.25s var(--ease), transform 0.1s ease;
    text-align: center;
}
.btn:active { transform: translateY(1px); }

.btn--solid { background: var(--black); color: var(--white); }
.btn--solid:hover { background: var(--gray-700); }

.btn--outline { background: transparent; color: var(--black); border-color: var(--black); }
.btn--outline:hover { background: var(--black); color: var(--white); }

.btn--glass {
    color: var(--white);
    background: rgba(0, 0, 0, 0.22);
    border-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.btn--glass:hover { background: var(--white); color: var(--black); border-color: var(--white); }

/* ---------- Subheader ---------- */
.subheader {
    height: var(--subheader-h);
    background: var(--black);
    color: var(--white);
    font-size: var(--t1);
    display: flex;
    align-items: center;
}
.subheader .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.subheader a { font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.subheader a:hover { color: var(--gray-200); }
.subheader__legal { color: var(--gray-200); font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
    .subheader .container { justify-content: flex-end; }
    .subheader__legal { display: none; }
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
}
.site-header__inner {
    display: flex;
    align-items: center;
    gap: 20px;
    height: var(--header-h);
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(16px, 5vw, 64px);
}
.site-header__logo img { height: 26px; width: auto; filter: brightness(0); }
.site-header__location {
    font-size: var(--t3);
    font-weight: 600;
    color: var(--ink);
    padding-left: 16px;
    border-left: 1px solid var(--gray-400);
    line-height: 1;
}
.site-nav { margin-left: auto; }
.site-nav__list { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; }
.site-nav__item { position: relative; }
.site-nav__item > a {
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 16px;
    font-weight: 600;
    border-radius: var(--br-sm);
}
.site-nav__item > a:hover { background: var(--gray-100); }
.site-nav__cta { background: var(--black); color: var(--white); }
.site-nav__cta:hover { background: var(--gray-700) !important; }

.site-nav__sub {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--br);
    box-shadow: var(--shadow-lg);
    list-style: none;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}
.site-nav__item--has-sub:hover .site-nav__sub,
.site-nav__item--has-sub:focus-within .site-nav__sub {
    opacity: 1; visibility: visible; transform: translateY(0);
}
.site-nav__sub a {
    display: block;
    padding: 10px 12px;
    border-radius: var(--br-sm);
    font-size: var(--t2);
    color: var(--muted);
}
.site-nav__sub a:hover { background: var(--gray-100); color: var(--ink); }

/* Burger */
.burger {
    display: none;
    margin-left: auto;
    width: 44px; height: 44px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}
.burger span {
    display: block;
    width: 24px; height: 2px;
    background: var(--ink);
    transition: transform 0.3s var(--ease), opacity 0.2s ease;
}
body.nav-open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .burger span:nth-child(2) { opacity: 0; }
body.nav-open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
    .site-header__location { display: none; }
    .burger { display: flex; }
    /* While the menu is open: lock background scroll + hide the phone bar so
       the panel sits flush under the (now top-anchored) header at any scroll. */
    body.nav-open { overflow: hidden; }
    body.nav-open .subheader { display: none; }
    .site-nav {
        position: fixed;
        inset: var(--header-h) 0 0 0;
        background: var(--white);
        margin: 0;
        padding: 8px 0 40px;
        overflow-y: auto;
        transform: translateX(100%);
        transition: transform 0.35s var(--ease);
        z-index: 90;
        --nav-pad: clamp(20px, 6vw, 40px);
    }
    body.nav-open .site-nav { transform: translateX(0); }
    .site-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
    .site-nav__item { position: static; }

    /* "Modelos" acts as a section header */
    .site-nav__item--has-sub > a {
        display: flex; align-items: center;
        height: 52px; padding: 0 var(--nav-pad);
        font-size: var(--t1); font-weight: 700; letter-spacing: 0.08em;
        text-transform: uppercase; color: var(--gray-400);
        border-radius: 0; pointer-events: none;
    }

    /* Submenu = clean tap list */
    .site-nav__sub {
        position: static;
        opacity: 1; visibility: visible; transform: none;
        box-shadow: none; border: 0; border-radius: 0;
        padding: 0; min-width: 0; background: transparent;
    }
    .site-nav__sub a {
        display: flex; align-items: center;
        height: 52px; padding: 0 var(--nav-pad);
        font-size: var(--t3); color: var(--ink);
        border-top: 1px solid var(--gray-100);
    }
    .site-nav__item--has-sub .site-nav__sub li:first-child a { border-top: 0; }
    .site-nav__sub a:active { background: var(--gray-50); }

    /* Test-drive CTA: full-width, prominent */
    .site-nav__item:not(.site-nav__item--has-sub) { padding: 24px var(--nav-pad) 0; }
    .site-nav__cta {
        display: flex; justify-content: center;
        height: 52px; width: 100%;
        border-radius: var(--br-sm); font-size: var(--t2);
    }
}

/* ---------- Showcase (home + detail hero) ---------- */
.showcases { display: block; }
.showcase {
    position: relative;
    min-height: clamp(520px, 82vh, 860px);
    display: flex;
    overflow: hidden;
    background: var(--gray-100);
}
.showcase__media { position: absolute; inset: 0; z-index: 1; }
.showcase__overlay {
    position: absolute; inset: 0; z-index: 2;
    background:
        linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0) 28%),
        linear-gradient(0deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 34%);
    pointer-events: none;
}
.showcase__content {
    position: relative;
    z-index: 3;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    padding: clamp(40px, 8vh, 96px) clamp(16px, 5vw, 64px);
    color: var(--white);
    pointer-events: none;
}
.showcase__content > * { pointer-events: auto; }
.showcase__title {
    font-size: var(--t6);
    font-weight: 800;
    letter-spacing: 0.01em;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.4);
}
.showcase__subtitle {
    margin-top: 12px;
    font-size: var(--t3);
    font-weight: 500;
    max-width: 32ch;
    margin-inline: auto;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}
.showcase__actions { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }

/* ---------- Slider ---------- */
.slider { position: relative; width: 100%; height: 100%; }
.slider__track { position: absolute; inset: 0; list-style: none; padding: 0; }
.slider__slide {
    position: absolute; inset: 0;
    opacity: 0;
    transition: opacity 0.9s var(--ease);
}
.slider__slide.is-active { opacity: 1; }
.slider__img { width: 100%; height: 100%; object-fit: cover; }

.slider__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 4;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    color: var(--white);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease, background 0.25s ease;
}
.showcase:hover .slider__nav,
.slider:focus-within .slider__nav { opacity: 1; }
.slider__nav:hover { background: rgba(0, 0, 0, 0.55); }
.slider__nav--prev { left: clamp(12px, 3vw, 32px); }
.slider__nav--next { right: clamp(12px, 3vw, 32px); }
@media (hover: none) { .slider__nav { opacity: 1; } }

/* ---------- Features ---------- */
.features { padding: clamp(48px, 8vw, 96px) 0; background: var(--white); }
.features__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(24px, 4vw, 48px);
    list-style: none;
}
.features__item { display: flex; flex-direction: column; gap: 8px; }
.features__title {
    font-size: var(--t4);
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}
.features__text { color: var(--muted); font-size: var(--t2); }
@media (max-width: 800px) {
    .features__grid { grid-template-columns: 1fr; }
    .features__item { border-bottom: 1px solid var(--gray-100); padding-bottom: 24px; }
    .features__item:last-child { border-bottom: 0; padding-bottom: 0; }
}

/* ---------- Gallery ---------- */
.gallery { padding: 0 0 clamp(48px, 8vw, 96px); background: var(--white); }
.gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: clamp(12px, 2vw, 24px);
}
.gallery__item {
    display: block;
    overflow: hidden;
    border-radius: var(--br);
    aspect-ratio: 3 / 2;
    background: var(--gray-100);
}
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.gallery__item:hover img { transform: scale(1.05); }

/* ---------- CTA band ---------- */
.cta-band { background: var(--black); color: var(--white); padding: clamp(48px, 8vw, 88px) 0; }
.cta-band__inner { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 28px; }
.cta-band__title { font-size: var(--t5); font-weight: 700; }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.cta-band .btn--outline { color: var(--white); border-color: var(--white); }
.cta-band .btn--outline:hover { background: var(--white); color: var(--black); }

/* ---------- Test drive ---------- */
.test-drive__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    align-items: start;
}
.test-drive__media { grid-column: 1; grid-row: 1 / 3; position: sticky; top: 0; height: 100dvh; }
.test-drive__media img { width: 100%; height: 100%; object-fit: cover; }
.test-drive__intro { grid-column: 2; grid-row: 1; padding: clamp(48px, 6vw, 88px) clamp(24px, 5vw, 64px) 24px; }
.test-drive__intro h1 { font-size: var(--t5); font-weight: 700; }
.test-drive__intro p { margin-top: 16px; color: var(--muted); font-size: var(--t3); }
.test-drive__form-wrap { grid-column: 2; grid-row: 2; padding: 0 clamp(24px, 5vw, 64px) clamp(48px, 6vw, 88px); }

@media (max-width: 860px) {
    .test-drive__grid { grid-template-columns: 1fr; }
    .test-drive__media { grid-column: 1; grid-row: 1; position: static; height: 56vw; max-height: 420px; }
    .test-drive__intro { grid-column: 1; grid-row: 2; padding: 32px 16px 16px; }
    .test-drive__form-wrap { grid-column: 1; grid-row: 3; padding: 0 16px 40px; }
}

/* ---------- Forms ---------- */
.lead-form { display: flex; flex-direction: column; gap: 20px; max-width: 520px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: var(--t2); }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--br-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] {
    border-color: #c0392b;
}
.field__error { color: #c0392b; font-size: var(--t1); min-height: 1em; }
.field__error:empty { display: none; }
.req-mark { color: var(--ink); font-weight: 700; }

/* Radio group (contact preference) */
.field--radio { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.field--radio legend { font-weight: 600; font-size: var(--t2); padding: 0; }
.radio-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.radio {
    display: flex; align-items: center; gap: 14px;
    min-height: 46px; padding: 0 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--br-sm);
    background: var(--white);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.radio:hover { border-color: var(--gray-400); }
.radio input { accent-color: var(--black); width: 20px; height: 20px; margin: 0; flex-shrink: 0; cursor: pointer; }
.radio span { font-size: var(--t2); color: var(--ink); }
.radio:has(input:checked) { border-color: var(--black); background: var(--gray-50); }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.lead-form__submit { margin-top: 4px; }
.lead-form__note { font-size: var(--t1); color: var(--muted); }
.lead-form__note a { text-decoration: underline; }

.form-message { padding: 16px 18px; border-radius: var(--br); font-weight: 500; }
.form-message--ok { background: #eaf7ee; color: #1c6b34; border: 1px solid #b8e2c4; }
.form-message--error { background: #fdeceb; color: #b0392b; border: 1px solid #f3c6c1; }

/* ---------- Legal / error ---------- */
.legal { padding: clamp(48px, 8vw, 96px) 0; }
.legal__inner { max-width: 780px; }
.legal__inner h1 { font-size: var(--t5); margin-bottom: 24px; }
.legal__inner h2 { font-size: var(--t3); margin: 32px 0 8px; }
.legal__inner p { color: var(--muted); margin-bottom: 12px; }
.legal__inner ul { color: var(--muted); margin: 0 0 16px; padding-left: 22px; list-style: disc; }
.legal__inner li { margin-bottom: 6px; }
.legal__inner a { color: var(--ink); text-decoration: underline; }
.legal__inner a:hover { color: var(--gray-600); }
.legal__placeholder { font-style: italic; color: var(--gray-400); }

.error-page { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 64px 0; }
.error-page__code { font-size: clamp(64px, 14vw, 120px); font-weight: 800; line-height: 1; }
.error-page__title { font-size: var(--t4); margin: 8px 0 12px; }
.error-page__text { color: var(--muted); margin-bottom: 28px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--black); color: var(--white); padding: clamp(40px, 6vw, 64px) 0; }
.site-footer__inner { display: flex; flex-direction: column; align-items: center; gap: 20px; text-align: center; }
.site-footer__logo img { height: 24px; width: auto; filter: brightness(0) invert(1); }
.site-footer__legal { color: var(--gray-200); font-weight: 600; font-size: var(--t2); letter-spacing: 0.02em; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; }
.site-footer__links a { color: var(--gray-200); font-size: var(--t2); }
.site-footer__links a:hover { color: var(--white); text-decoration: underline; }
.site-footer__copy { color: var(--gray-400); font-size: var(--t1); }

/* ---------- WhatsApp FAB ---------- */
.whatsapp-fab {
    position: fixed;
    right: clamp(16px, 3vw, 28px);
    bottom: clamp(16px, 3vw, 28px);
    z-index: 200;
    width: 58px; height: 58px;
    display: grid; place-items: center;
    color: var(--white);
    background: #25d366;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s var(--ease);
}
.whatsapp-fab:hover { transform: scale(1.08); }

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed; inset: 0; z-index: 300;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    padding: 24px;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: var(--br-sm); }
.lightbox__btn {
    position: absolute;
    color: var(--white);
    width: 52px; height: 52px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    font-size: 28px;
    transition: background 0.2s ease;
}
.lightbox__btn:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox__close { top: 20px; right: 20px; }
.lightbox__prev { left: clamp(12px, 3vw, 32px); top: 50%; transform: translateY(-50%); }
.lightbox__next { right: clamp(12px, 3vw, 32px); top: 50%; transform: translateY(-50%); }
.lightbox__counter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: var(--gray-200); font-size: var(--t1); }

/* ---------- Reveal on scroll ---------- */
/* Only hide when JS is available (progressive enhancement). */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; } }
