/*
 * Celular. Se carga al final para ajustar tamaños sin tocar el diseño de escritorio:
 * imágenes y botones más pequeños, carruseles con dos tarjetas a la vista y barra de contacto.
 */

@media (max-width: 860px) {
    html,
    body {
        overflow-x: clip;
    }

    body {
        font-size: 15px;
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
    }

    h1 {
        font-size: 1.65rem;
    }

    h2,
    .section-title {
        font-size: 1.3rem;
    }

    .wrap {
        width: calc(100% - 2rem);
    }

    .section {
        padding: 2.25rem 0;
    }

    .section-head {
        flex-direction: row;
        align-items: flex-end;
        margin-bottom: 1rem;
    }

    .section-head .link-arrow {
        font-size: 0.85rem;
    }

    .eyebrow {
        font-size: 0.7rem;
        margin-bottom: 0.3rem;
    }

    .btn {
        min-height: 42px;
        padding: 0.55rem 1rem;
        font-size: 0.92rem;
    }

    .btn--small {
        min-height: 36px;
        padding: 0.4rem 0.7rem;
        font-size: 0.85rem;
    }

    /* Barra superior: llamar y redes */
    .topbar {
        font-size: 0.78rem;
    }

    .topbar__inner {
        justify-content: space-between;
        min-height: 34px;
    }

    .topbar__links {
        width: 100%;
        justify-content: space-between;
        gap: 0.6rem;
    }

    /* Cabecera */
    .icon-toggle {
        display: grid;
    }

    .header-actions {
        gap: 0.45rem;
    }

    .quote-pill {
        padding: 0.5rem 0.7rem;
    }

    .nav-toggle,
    .icon-toggle {
        width: 42px;
        height: 42px;
    }

    .site-header__inner > .brand {
        grid-row: 1;
        grid-column: 1;
    }

    .site-header__inner > .header-actions {
        grid-row: 1;
        grid-column: 2;
    }

    .site-header.is-search-open .site-header__inner > .header-search {
        display: flex;
        grid-row: 2;
        grid-column: 1 / -1;
        max-width: none;
        margin-bottom: 0.75rem;
    }

    .site-header.is-search-open .site-header__inner {
        row-gap: 0;
    }

    .search-toggle[aria-expanded="true"] {
        background: var(--navy);
        border-color: var(--navy);
        color: #fff;
    }

    .header-search input {
        font-size: 16px;
    }

    .nav-mobile-extra {
        display: grid;
        gap: 0.75rem;
        margin-top: 0.5rem;
    }

    .nav-mobile-extra__label {
        margin: 0.5rem 0 0;
        font-weight: 800;
        color: var(--ink);
    }

    .nav-cta {
        display: none;
    }

    /* Slider */
    .slide {
        min-height: 430px;
    }

    .slide--banner {
        min-height: 0;
    }

    .slide__copy {
        padding: 2rem 0 4.75rem;
    }

    .slide__title {
        font-size: 1.6rem;
        max-width: 18ch;
        margin-bottom: 0.5rem;
    }

    .slide__text {
        font-size: 0.92rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .slide__actions {
        margin-top: 1rem;
        gap: 0.5rem;
    }

    .slider-dots {
        bottom: 2.1rem;
    }

    .slider-dots button {
        width: 18px;
        height: 5px;
    }

    .slider-dots button[aria-current="true"] {
        width: 30px;
    }

    .slide__banner-cta {
        bottom: 3.3rem;
    }

    /* Buscador de portada */
    .finder__card {
        padding: 1rem;
        border-radius: 12px;
    }

    .finder__head {
        margin-bottom: 0.75rem;
    }

    .finder__head h2 {
        font-size: 1.1rem;
    }

    .finder__head p {
        font-size: 0.8rem;
    }

    .finder__fields {
        grid-template-columns: 1fr auto;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .finder__cat {
        display: none;
    }

    .finder input {
        font-size: 16px;
    }

    .chip {
        padding: 0.35rem 0.7rem;
        font-size: 0.82rem;
    }

    /* Beneficios: fila deslizable en lugar de cuatro tarjetas altas */
    .trust {
        padding: 1.25rem 0 0;
    }

    .trust__grid {
        display: flex;
        gap: 0.6rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        padding-bottom: 0.25rem;
    }

    .trust__grid::-webkit-scrollbar {
        display: none;
    }

    .trust__item {
        flex: 0 0 68%;
        flex-direction: row;
        align-items: center;
        gap: 0.6rem;
        padding: 0.7rem 0.8rem;
        scroll-snap-align: start;
    }

    .trust__item .icon--lg {
        width: 24px;
        height: 24px;
    }

    .trust__item strong {
        font-size: 0.86rem;
    }

    .trust__item span {
        font-size: 0.76rem;
    }

    /* Categorías: tres por fila, imagen pequeña */
    .cat-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .cat-card {
        padding: 0.5rem 0.5rem 0.65rem;
        border-radius: 10px;
        text-align: center;
    }

    .cat-card img {
        width: 70%;
        margin-bottom: 0.25rem;
    }

    .cat-card__name {
        font-size: 0.78rem;
        line-height: 1.2;
    }

    .cat-card__count {
        font-size: 0.7rem;
    }

    /* Carruseles: dos tarjetas y un borde de la tercera */
    .carousel__track {
        grid-auto-columns: 46%;
        gap: 0.6rem;
        padding-bottom: 0.25rem;
        scroll-padding-left: 0;
    }

    .carousel__track--news {
        grid-auto-columns: 82%;
    }

    .carousel__progress {
        display: block;
    }

    .pcard {
        border-radius: 12px;
    }

    .pcard__modes {
        top: 0.4rem;
        left: 0.4rem;
    }

    .badge {
        padding: 0.12rem 0.4rem;
        font-size: 0.62rem;
    }

    .pcard__body {
        padding: 0.6rem 0.65rem 0.7rem;
    }

    .pcard__kicker {
        font-size: 0.64rem;
        margin-bottom: 0.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pcard__title {
        font-size: 0.86rem;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 2.5em;
    }

    .pcard__actions {
        gap: 0.35rem;
    }

    .pcard__actions .btn {
        min-height: 34px;
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }

    .pcard__actions .btn .icon {
        width: 0.95em;
        height: 0.95em;
    }

    .icon-btn {
        width: 34px;
        height: 34px;
        flex: none;
    }

    /* Servicios y promociones: filas deslizables */
    [data-scroll-row] {
        display: flex !important;
        gap: 0.75rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        margin-right: -1rem;
        padding-right: 1rem;
    }

    [data-scroll-row]::-webkit-scrollbar {
        display: none;
    }

    [data-scroll-row] > * {
        flex: 0 0 78%;
        scroll-snap-align: start;
    }

    .social-grid[data-scroll-row] > * {
        flex-basis: 62%;
    }

    .service img {
        aspect-ratio: 16 / 8;
    }

    .service__body {
        padding: 0.9rem;
    }

    .service__body h3 {
        font-size: 1rem;
    }

    .service__body p {
        font-size: 0.86rem;
        margin-bottom: 0.6rem;
    }

    .promo__label {
        left: 0.6rem;
        bottom: 0.6rem;
        padding: 0.35rem 0.7rem;
        font-size: 0.82rem;
    }

    /* Pasos y marcas */
    .steps-wrap {
        gap: 1rem;
    }

    .steps li {
        padding: 0.75rem 0.9rem;
    }

    .steps li > span {
        width: 32px;
        height: 32px;
    }

    .brands {
        padding: 1.75rem 0 2rem;
    }

    .marquee img {
        width: 120px;
    }

    .cta-band {
        padding: 2rem 0;
    }

    .cta-band h2 {
        font-size: 1.25rem;
    }

    /* Redes */
    .social-section__head {
        margin-bottom: 1rem;
    }

    .social--cards {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .social--cards .social__link {
        padding: 0.65rem 0.8rem;
    }

    .social--cards .social__badge {
        width: 40px;
        height: 40px;
    }

    .social-section__head--inline {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-mobile-extra .social--icons .social__badge {
        width: 46px;
        height: 46px;
    }

    /* Catálogo */
    .section--catalog {
        padding-top: 1rem;
    }

    .page-hero {
        padding: 1.25rem 0 1.4rem;
    }

    .page-hero h1 {
        font-size: 1.5rem;
    }

    .page-hero p {
        font-size: 0.9rem;
    }

    .breadcrumbs ol {
        margin-bottom: 0.5rem;
        font-size: 0.78rem;
    }

    .catalog {
        gap: 0.75rem;
    }

    .catalog__toolbar {
        position: sticky;
        top: var(--header-h);
        z-index: 20;
        margin: 0 -1rem;
        padding: 0.6rem 1rem;
        background: rgb(255 255 255 / 96%);
        border-bottom: 1px solid var(--line);
    }

    .catalog__toolbar input {
        font-size: 16px;
        min-height: 42px;
    }

    .catalog__filter-toggle {
        flex: none;
        padding: 0.5rem 0.75rem;
    }

    .catalog__chips {
        display: flex;
    }

    .catalog__bar {
        margin-bottom: 0.75rem;
        font-size: 0.85rem;
    }

    .catalog__sort select {
        min-height: 36px;
        font-size: 0.85rem;
    }

    .grid {
        gap: 0.6rem;
    }

    /* Ficha */
    .product {
        padding-top: 1rem;
    }

    .product__top {
        gap: 1.25rem;
    }

    .product__media {
        --media-pad: 0.75rem;
        aspect-ratio: auto;
        height: min(300px, 75vw);
    }

    .product__title {
        font-size: 1.45rem;
    }

    .product__lead {
        font-size: 0.95rem;
    }

    .quote-box {
        margin: 1rem 0;
        padding: 1rem;
    }

    .quote-box__actions {
        grid-template-columns: 1fr 1fr;
    }

    .product__details,
    .product__top {
        grid-template-columns: minmax(0, 1fr);
    }

    .product__details {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        gap: 1.5rem;
    }

    .product__details > *,
    .product__top > * {
        min-width: 0;
    }

    .product__tags .chips--wrap {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    /* Notas */
    .post-grid {
        grid-template-columns: 1fr;
    }

    .post__actions .btn {
        flex: 1 1 45%;
    }

    /* Pie con acordeones */
    .footer-grid {
        gap: 0;
        padding: 2rem 0 1rem;
    }

    .footer-col {
        padding: 0.9rem 0;
        border-bottom: 1px solid rgb(255 255 255 / 10%);
    }

    .footer-col--brand {
        padding-top: 0;
    }

    .footer-acc summary {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: 0;
        cursor: pointer;
    }

    .footer-acc summary::after {
        content: "+";
        font-size: 1.3rem;
        line-height: 1;
        color: var(--yellow);
    }

    .footer-acc[open] summary::after {
        content: "–";
    }

    .footer-acc[open] .footer-links {
        margin-top: 0.75rem;
    }

    .footer-bottom {
        padding-bottom: 1rem;
    }

    /* Diálogo de cotización */
    .quote-dialog {
        max-height: 94vh;
    }

    .quote-dialog__body h2 {
        font-size: 1.3rem;
    }

    .form-grid {
        gap: 0.6rem;
    }

    .quote-dates__row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .field input,
    .field select,
    .field textarea {
        min-height: 44px;
        font-size: 16px;
    }

    .quote-actions {
        position: sticky;
        bottom: 0;
        margin: 1rem -1.25rem 0;
        padding: 0.75rem 1.25rem calc(0.75rem + env(safe-area-inset-bottom));
        background: #fff;
        border-top: 1px solid var(--line);
    }

    /* Barra de contacto fija y botón flotante */
    .wa-fab {
        display: none;
    }

    .contact-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 45;
        display: grid;
        grid-template-columns: 1fr 1fr 1.2fr;
        padding-bottom: env(safe-area-inset-bottom);
        background: #fff;
        border-top: 1px solid var(--line);
        box-shadow: 0 -6px 20px rgb(6 28 56 / 10%);
    }

    .contact-bar a,
    .contact-bar button {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.15rem;
        min-height: 58px;
        border: 0;
        background: none;
        color: var(--navy);
        font-size: 0.72rem;
        font-weight: 800;
        text-decoration: none;
    }

    .contact-bar .icon {
        width: 22px;
        height: 22px;
    }

    .contact-bar__wa {
        color: var(--wa) !important;
    }

    .contact-bar__quote {
        background: var(--red) !important;
        color: #fff !important;
    }

    .contact-bar__count {
        position: absolute;
        top: 6px;
        right: calc(50% - 26px);
        min-width: 18px;
        height: 18px;
        padding: 0 4px;
        border-radius: 9px;
        background: var(--yellow);
        color: #2b2100;
        font-size: 0.68rem;
        line-height: 18px;
    }

    .contact-bar__count.is-empty {
        display: none;
    }

    .contact-bar__quote.bump {
        animation: bump 0.4s ease;
    }

    .toast {
        bottom: calc(72px + env(safe-area-inset-bottom));
        max-width: calc(100% - 1.5rem);
        font-size: 0.88rem;
    }

    .notice {
        top: calc(var(--header-h) + 44px);
    }

    /* Rendimiento: el navegador no pinta lo que está fuera de pantalla */
    .site-main > .section:not(.section--catalog),
    .site-main > .brands,
    .site-footer {
        content-visibility: auto;
        contain-intrinsic-size: auto 600px;
    }
}

@media (max-width: 380px) {
    .quote-pill {
        padding: 0.45rem 0.55rem;
    }

    .brand img {
        width: 116px;
    }

    .cat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 860px) {
    .only-mobile {
        display: inline;
    }

    .only-desktop {
        display: none;
    }

    .site-header.is-search-open .site-header__inner > .header-search {
        margin-top: 0.35rem;
    }
}

@media (max-width: 860px) {
    .specs {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }

    .specs__head h2 {
        font-size: 1.25rem;
    }

    .specs__grid {
        columns: 1;
    }

    .specs__card {
        margin-bottom: 0.6rem;
    }

    .specs__card summary {
        padding: 0.75rem 0.85rem;
    }

    .specs__card th,
    .specs__card td {
        padding: 0.5rem 0.85rem;
        font-size: 0.86rem;
    }

    .sheet-file {
        padding: 0.65rem 0.7rem;
        gap: 0.6rem;
    }

    .sheet-file .btn {
        padding: 0.4rem 0.6rem;
    }
}
