:root {
    --primary-color: #007AFF;
    --primary-hover: #0056b3;
    --secondary-color: #8e8e93;
    --accent-color: #5856d6;
    --success-color: #34c759;
    --danger-color: #ff3b30;
    --bg-page: #f5f5f7;
    /* Apple style light gray */
    --navbar-bg: rgba(255, 255, 255, 0.82);
    --navbar-text: #1d1d1f;
    --card-bg: #ffffff;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --border-radius-lg: 28px;
    --border-radius-md: 18px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --transition: transform 0.2s ease, box-shadow 0.2s ease;

    /* RGB variants for translucency */
    --primary-color-rgb: 0, 122, 255;
    --text-main-rgb: 29, 29, 31;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-main);
    line-height: 1.47059;
    background-color: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden !important;
    /* Critical: Prevent horizontal scroll */
    width: 100% !important;
    position: relative;
}

/* Global Content Reset */
.row,
section,
main,
footer {
    max-width: 100vw;
    overflow-x: hidden;
}


/* Navbar Overflow Fix - High Specificity */
body header .container,
body header .row,
body .navbar .container,
body .navbar .row {
    overflow: visible !important;
    height: auto !important;
    min-height: 50px;
    /* Preserve vertical rhythm */
}

/* Ensure dropdowns break out */
.dropdown-menu {
    z-index: 9999 !important;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    margin-top: 0;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: -0.02em;
}

.product-name {
    font-size: 1rem;
    /* Base desktop size - elegant and legible */
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
    transition: var(--transition);
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Glassmorphism utility */
.glass {
    background: var(--navbar-bg);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Buttons */
.btn-premium {
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.btn-premium-primary {
    background: #000 !important;
    color: white !important;
}

.btn-premium-primary:hover {
    background: var(--primary-hover);
}

/* --- THE PREMIUM CARD OVERHAUL (Absolute Specificity) --- */
body .product-card,
body .product-card.h-100 {
    position: relative;
    background: var(--custom-product-bg, #ffffff) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: var(--card-radius, 24px) !important;
    box-shadow: var(--card-shadow-style, 0 4px 20px rgba(0, 0, 0, 0.04)) !important;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    overflow: hidden !important;
    min-height: 380px !important;
}

@media (max-width: 767.98px) {
    body .product-card,
    body .product-card.h-100 {
        min-height: 300px !important;
    }

    body.mobile-products-2 .product-grid > [class*="col-"] {
        flex: 0 0 auto;
        width: 50%;
    }

    body.mobile-products-2 .product-card-body {
        padding: 0.85rem !important;
    }

    body.mobile-products-2 .product-card-actions form {
        flex: 0 0 40px !important;
    }

    body.mobile-products-2 .product-card .btn-buy-black {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        padding: 0 !important;
        flex-grow: 0 !important;
    }

    body.mobile-products-2 .product-card .btn-buy-black span {
        display: none;
    }

    body .product-grid {
        --bs-gutter-x: 1rem;
        --bs-gutter-y: 1rem;
    }

    body .product-image-container {
        aspect-ratio: var(--mobile-product-image-ratio, 1 / 1);
    }

    body.mobile-card-compact {
        --product-card-title-size: 0.9rem;
        --product-card-price-size: 1.2rem;
    }

    body.mobile-card-compact .product-card,
    body.mobile-card-compact .product-card.h-100 {
        min-height: 0 !important;
    }

    body.mobile-card-compact .product-card-body {
        padding: 0.85rem !important;
    }

    body.mobile-card-compact .product-card-price-row {
        margin-bottom: 0.75rem !important;
    }

    body.mobile-card-compact .product-image {
        padding: 10px;
    }

    body.mobile-card-compact .product-card .btn-buy-black,
    body.mobile-card-compact .product-card .btn-whatsapp-green {
        height: 36px !important;
        font-size: 0.7rem !important;
    }

    body.mobile-card-compact .product-card .btn-wa-icon {
        width: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
    }

    body.mobile-products-2.mobile-card-compact .product-card-actions form,
    body.mobile-products-2.mobile-card-compact .product-card .btn-buy-black {
        flex-basis: 36px !important;
        width: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
    }
}

body .product-card:hover {
    transform: translateY(-8px) !important;
    box-shadow: var(--card-shadow-style, var(--shadow-md)) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}

/* Modern & Compact Product Card Actions */
body .product-card .btn-buy-black,
body .product-card button.btn-buy-black {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 50px !important;
    height: 40px !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.03em !important;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 15px !important;
    flex-grow: 1 !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

body .product-card .btn-buy-black:hover {
    background-color: #333333 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

body .product-card .btn-whatsapp-green,
body .product-card a.btn-whatsapp-green {
    background-color: #25D366 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 50px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    padding: 0 20px !important;
    margin: 0 !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
}

body .product-card .btn-wa-icon {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    padding: 0 !important;
}


body .product-card .btn-whatsapp-green:hover {
    background-color: #128c7e !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2) !important;
}

.product-card-actions {
    display: flex !important;
    gap: 8px !important;
    width: 100% !important;
    align-items: center !important;
    flex-direction: row !important;
    /* Always horizontal */
}



/* Typography Hierarchy in Cards */
body .product-card .product-name {
    color: #000000 !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--product-title-lines, 2);
    line-clamp: var(--product-title-lines, 2);
    overflow: hidden !important;
    overflow-wrap: anywhere;
    text-overflow: ellipsis;
    height: auto !important;
    min-height: calc(var(--product-title-lines, 2) * 1.4em);
    max-height: calc(var(--product-title-lines, 2) * 1.4em);
}

body .product-card .product-price {
    color: #000000 !important;
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-shadow-style, var(--shadow-md)) !important;
    border-color: rgba(0, 0, 0, 0.1);
}

.product-image-container {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fbfbfd;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--card-radius, 28px) var(--card-radius, 28px) 0 0;
}

.product-image-link {
    display: block;
    width: 100%;
    height: 100%;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: var(--product-image-fit, contain);
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    padding: 20px;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Configuración visual de las tarjetas de producto */
body.product-card-align-center .product-card-body,
body.product-card-align-center .product-card-price-row {
    text-align: center;
    justify-content: center;
}

body.product-card-align-center .product-card-actions {
    justify-content: center;
}

/* Tarjeta promocional para catálogos con ofertas y comunicación comercial. */
body.product-card-style-retail .product-card,
body.product-card-style-retail .product-card.h-100 {
    border-radius: var(--card-radius, 8px) !important;
    border-color: rgba(25, 118, 185, .12) !important;
}

body.product-card-style-retail .product-image-container {
    background: #ffffff;
    border-bottom: 1px solid rgba(0, 0, 0, .055);
}

body.product-card-style-retail .product-card-body {
    padding: 1.15rem !important;
}

body.product-card-style-retail .product-card-price-row {
    justify-content: center;
    margin-bottom: .65rem !important;
}

body.product-card-style-retail .product-card .product-price {
    color: var(--primary-color, #1976b9) !important;
    font-size: 1.65rem !important;
}

body.product-card-style-retail .product-badges .badge-discount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 4px;
    border-radius: 50%;
    background: var(--primary-color, #1976b9);
    font-size: .78rem;
    box-shadow: 0 7px 18px rgba(var(--primary-rgb, 25, 118, 185), .25);
}

.product-card-promo-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    margin: 0 0 .55rem;
    padding: 7px 9px;
    border-radius: 5px;
    background: var(--primary-color, #1976b9);
    color: #ffffff;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
}

body.product-card-style-retail .product-card-actions {
    margin-top: .45rem !important;
}

body.product-card-style-retail .product-card .btn-buy-black {
    border-radius: 5px !important;
}

@media (max-width: 767.98px) {
    body.product-card-style-retail .product-card-body { padding: .72rem !important; }
    body.product-card-style-retail .product-card .product-price { font-size: 1.15rem !important; }
    body.product-card-style-retail .product-badges .badge-discount {
        width: 38px;
        height: 38px;
        font-size: .62rem !important;
    }
    body.product-card-style-retail .product-card-promo-line {
        min-height: 30px;
        padding: 5px 4px;
        gap: 4px;
        font-size: .58rem;
    }
    body.mobile-products-2.product-card-style-retail .product-card-actions form,
    body.mobile-products-2.product-card-style-retail .product-card .btn-buy-black {
        flex-basis: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    body.mobile-products-2.product-card-style-retail .product-card .btn-buy-black span {
        display: inline !important;
    }
}

.product-card-body > .product-card-actions:last-child {
    margin-top: auto !important;
}

body.product-card-hover-none .product-card:hover,
body.product-card-hover-zoom .product-card:hover {
    transform: none !important;
}

body.product-card-hover-none .product-card:hover .product-image {
    transform: none !important;
}

body.product-card-hover-lift .product-card:hover .product-image {
    transform: none;
}

body.product-card-hover-zoom .product-card:hover .product-image {
    transform: scale(1.05);
}

body.product-image-fit-cover .product-image {
    padding: 0;
}

/* Vista rápida de productos */
.btn-quick-view {
    position: absolute;
    z-index: 4;
    top: auto;
    bottom: 16px;
    left: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translate(-50%, 12px);
    transition: opacity 0.22s ease, transform 0.22s ease, background-color 0.22s ease;
}

.product-card:hover .btn-quick-view,
.btn-quick-view:focus-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.btn-quick-view:hover {
    background: var(--primary-color, #000);
    color: #fff;
}

.quick-view-modal {
    --bs-modal-width: 1040px;
    z-index: 2000000 !important;
}

/* La cabecera configurable puede llegar a z-index 1000002. El fondo del modal
   debe cubrirla para que no quede una franja del menú por delante. */
body.quick-view-open .modal-backdrop {
    z-index: 1999999 !important;
}

.quick-view-modal .modal-content {
    overflow: hidden;
    border: 0;
    border-radius: 28px;
    background: var(--custom-product-bg, #fff);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.24);
}

.quick-view-close {
    position: absolute;
    z-index: 5;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.13);
}

.quick-view-loading,
.quick-view-error {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px;
    text-align: center;
}

.quick-view-layout { min-height: 540px; }
.quick-view-media { background: #f6f7f9; }
.quick-view-main-image-wrap {
    min-height: 440px;
    display: grid;
    place-items: center;
    padding: 38px;
}
.quick-view-main-image {
    width: 100%;
    height: 390px;
    object-fit: contain;
}
.quick-view-thumbs {
    display: flex;
    gap: 10px;
    padding: 0 28px 24px;
    overflow-x: auto;
}
.quick-view-thumb {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    padding: 4px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: #fff;
}
.quick-view-thumb.active { border-color: var(--primary-color, #111827); }
.quick-view-thumb img { width: 100%; height: 100%; object-fit: contain; }
.quick-view-info { padding: 64px 50px 44px; color: var(--custom-product-text, #111827); }
.quick-view-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    color: #667085;
}
.quick-view-price { font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; }
.quick-view-old-price { margin-left: 8px; color: #98a2b3; text-decoration: line-through; }
.quick-view-qty { max-width: 145px; }

@media (hover: none), (max-width: 767.98px) {
    .btn-quick-view {
        top: auto;
        bottom: 10px;
        right: auto;
        left: 18px;
        width: 38px;
        min-height: 38px;
        padding: 0;
        opacity: 1;
        transform: none;
    }
    .product-card:hover .btn-quick-view,
    .btn-quick-view:focus-visible {
        transform: none;
    }
    .btn-quick-view span { display: none; }
    .quick-view-modal .modal-dialog { margin: 10px; }
    .quick-view-modal .modal-content { border-radius: 22px; }
    .quick-view-layout { min-height: 0; }
    .quick-view-main-image-wrap { min-height: 280px; padding: 32px 24px 20px; }
    .quick-view-main-image { height: 250px; }
    .quick-view-thumbs { padding: 0 20px 18px; }
    .quick-view-info { padding: 28px 24px 30px; }
    .quick-view-info h2 { padding-right: 24px; font-size: 1.55rem; }
}

/* Carrito lateral */
.cart-drawer {
    --bs-offcanvas-width: min(var(--cart-drawer-width, 440px), 100vw);
    z-index: 2000000 !important;
    border: 0 !important;
    background: var(--cart-drawer-bg, #fff);
    color: #111827;
    box-shadow: -18px 0 60px rgba(0, 0, 0, 0.2);
}
body.cart-drawer-open .offcanvas-backdrop { z-index: 1999999 !important; }
.cart-drawer-header { padding: 24px; border-bottom: 1px solid #eaecf0; }
.cart-drawer-loading,
.cart-drawer-empty {
    min-height: 65vh;
    padding: 42px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
}
.cart-drawer-list { padding: 8px 22px 0; }
.cart-drawer-item {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid #eaecf0;
}
.cart-drawer-image {
    width: 82px;
    height: 82px;
    padding: 5px;
    border-radius: 15px;
    background: #f5f6f8;
    object-fit: contain;
}
.cart-drawer-name { color: #111827; font-size: 0.95rem; font-weight: 750; line-height: 1.25; }
.cart-drawer-variant { color: #667085; font-size: 0.78rem; }
.cart-drawer-price { color: #111827; font-size: 0.92rem; font-weight: 800; }
.cart-drawer-remove {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
}
.cart-drawer-quantity {
    display: inline-grid;
    grid-template-columns: 30px 34px 30px;
    align-items: center;
    margin-top: 9px;
    overflow: hidden;
    border: 1px solid #d0d5dd;
    border-radius: 999px;
}
.cart-drawer-quantity button { height: 30px; padding: 0; border: 0; background: transparent; color: #344054; }
.cart-drawer-quantity span { text-align: center; font-size: 0.82rem; font-weight: 700; }
.cart-drawer-summary {
    position: sticky;
    bottom: 0;
    padding: 20px 24px 24px;
    border-top: 1px solid #eaecf0;
    background: color-mix(in srgb, var(--cart-drawer-bg, #fff) 96%, transparent);
    box-shadow: 0 -10px 30px rgba(17, 24, 39, 0.06);
}
.cart-drawer-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; font-weight: 700; }
.cart-drawer-total strong { font-size: 1.4rem; }
.cart-drawer .btn-primary {
    --bs-btn-bg: var(--cart-drawer-button, #2563eb);
    --bs-btn-border-color: var(--cart-drawer-button, #2563eb);
    --bs-btn-hover-bg: color-mix(in srgb, var(--cart-drawer-button, #2563eb) 84%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--cart-drawer-button, #2563eb) 84%, #000);
}
@media (max-width: 420px) {
    .cart-drawer-item { grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; }
    .cart-drawer-image { width: 70px; height: 70px; }
}

/* Bloque de beneficios de compra */
.benefit-card {
    background: var(--benefit-card-bg, #ffffff);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--benefit-radius, 18px);
    box-shadow: var(--benefit-shadow, var(--shadow-sm));
}

.benefit-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--benefit-icon-text, #ffffff);
    background: var(--benefit-icon-bg, var(--primary-color));
    font-size: 1.2rem;
}

.benefit-title {
    color: var(--benefit-text, var(--text-main));
    font-size: 1rem;
    font-weight: 700;
}

.benefit-text {
    color: var(--benefit-text, #6e6e73);
    opacity: 0.78;
    font-size: 0.86rem;
    line-height: 1.4;
}

/* Galería configurable */
.gallery-block.gallery-width-limited > .container {
    max-width: var(--gallery-max-width);
}

.gallery-layout-grid .gallery-items.row {
    --bs-gutter-x: var(--gallery-gap, 16px);
    --bs-gutter-y: var(--gallery-gap, 16px);
}

.gallery-layout-masonry .gallery-items {
    column-count: var(--gallery-columns, 3);
    column-gap: var(--gallery-gap, 16px);
}

.gallery-layout-masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: var(--gallery-gap, 16px);
}

.gallery-layout-carousel .gallery-items {
    display: flex;
    gap: var(--gallery-gap, 16px);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 10px;
}

.gallery-layout-carousel .gallery-item {
    flex: 0 0 var(--gallery-basis, 33.333%);
    scroll-snap-align: start;
}

.gallery-link {
    color: inherit;
    text-decoration: none;
}

.gallery-figure {
    position: relative;
    overflow: hidden;
    border-radius: var(--card-radius, 18px);
    background: #f3f4f6;
    box-shadow: var(--card-shadow-style, var(--shadow-sm));
    transition: transform .35s ease, box-shadow .35s ease;
}

.gallery-figure img {
    width: 100%;
    display: block;
    object-fit: cover;
    transition: transform .5s cubic-bezier(.2,.7,.2,1), filter .35s ease;
}

.gallery-ratio-square:not(.gallery-layout-masonry) .gallery-figure img { aspect-ratio: 1 / 1; }
.gallery-ratio-landscape:not(.gallery-layout-masonry) .gallery-figure img { aspect-ratio: 4 / 3; }
.gallery-ratio-portrait:not(.gallery-layout-masonry) .gallery-figure img { aspect-ratio: 4 / 5; }
.gallery-ratio-auto .gallery-figure img,
.gallery-layout-masonry .gallery-figure img { height: auto; }
.gallery-fixed-height .gallery-figure img {
    height: var(--gallery-image-height) !important;
    aspect-ratio: auto !important;
}

.gallery-figure figcaption {
    position: absolute;
    inset: auto 0 0;
    padding: 28px 16px 14px;
    color: #fff;
    font-weight: 700;
    background: linear-gradient(transparent, rgba(0,0,0,.72));
    transform: translateY(100%);
    transition: transform .35s ease;
}

.gallery-hover-zoom .gallery-figure:hover img { transform: scale(1.07); }
.gallery-hover-lift .gallery-figure:hover { transform: translateY(-7px); box-shadow: 0 16px 35px rgba(0,0,0,.16); }
.gallery-hover-overlay .gallery-figure:hover img { filter: brightness(.65); transform: scale(1.03); }
.gallery-hover-overlay .gallery-figure:hover figcaption,
.gallery-hover-zoom .gallery-figure:hover figcaption,
.gallery-hover-lift .gallery-figure:hover figcaption { transform: translateY(0); }
.gallery-hover-none .gallery-figure figcaption { transform: translateY(0); }

.gallery-entrance-fade .gallery-item,
.gallery-entrance-slide .gallery-item,
.gallery-entrance-zoom .gallery-item {
    animation: galleryFade .6s ease both;
    animation-delay: calc(var(--gallery-index, 0) * 70ms);
}
.gallery-entrance-slide .gallery-item { animation-name: gallerySlide; }
.gallery-entrance-zoom .gallery-item { animation-name: galleryZoom; }
@keyframes galleryFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gallerySlide { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes galleryZoom { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }

@media (max-width: 767.98px) {
    .gallery-layout-masonry .gallery-items { column-count: 2; }
    .gallery-layout-carousel .gallery-item { flex-basis: 78%; }
    .gallery-figure figcaption { transform: translateY(0); }
    .gallery-fixed-height:not(.gallery-fixed-height-mobile) .gallery-figure img { height: auto !important; }
    .gallery-fixed-height:not(.gallery-fixed-height-mobile).gallery-ratio-square .gallery-figure img { aspect-ratio: 1 / 1 !important; }
    .gallery-fixed-height:not(.gallery-fixed-height-mobile).gallery-ratio-landscape .gallery-figure img { aspect-ratio: 4 / 3 !important; }
    .gallery-fixed-height:not(.gallery-fixed-height-mobile).gallery-ratio-portrait .gallery-figure img { aspect-ratio: 4 / 5 !important; }
    .gallery-fixed-height:not(.gallery-fixed-height-mobile).gallery-ratio-auto .gallery-figure img { aspect-ratio: auto !important; }
    .gallery-fixed-height-mobile .gallery-figure img {
        height: var(--gallery-image-height-mobile) !important;
        aspect-ratio: auto !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-item, .gallery-figure, .gallery-figure img { animation: none !important; transition: none !important; }
}

.product-badge {
    position: static;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    z-index: 10;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-badges {
    position: absolute;
    z-index: 10;
    top: 0.8rem;
    left: 0.8rem;
    right: 58px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    pointer-events: none;
}
.badge-new { background: #007aff; color: #fff; }
.badge-commercial,
.product-badge-static { color: #fff; }
.badge-shipping { background: #059669; }
.badge-urgent { background: #dc2626; }
.badge-offer { background: #ea580c; }
.badge-popular { background: #7c3aed; }
.badge-exclusive { background: #111827; }
.badge-custom { background: var(--primary-color, #2563eb); }
.product-badge-static {
    display: inline-flex;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-discount {
    background: var(--danger-color);
    color: white;
}

/* --- CONSOLIDATED MOBILE RESET (Under 768px) --- */
@media (max-width: 768px) {

    .product-badges { top: 10px; left: 10px; right: 52px; gap: 3px; }
    .product-badges .product-badge {
        max-width: 100%;
        padding: 3px 6px;
        overflow: hidden;
        font-size: 0.62rem !important;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Level 1: Main Page Titles (Product Detail Name, Page H1) */
    h1,
    .display-5,
    .page-title {
        font-size: 1.8rem !important;
        /* ~28.8px - Clearly dominant */
        letter-spacing: -0.02em !important;
        font-weight: 700 !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }

    /* Level 2: Section Titles (Featured, Categories, etc.) */
    .section-title,
    h2,
    .display-6,
    [id^="section-"] h2 {
        font-size: 1.5rem !important;
        /* ~24px */
        font-weight: 700 !important;
        letter-spacing: -0.01em !important;
        margin-bottom: 0.75rem !important;
    }

    /* Level 3: Product Names in Cards, Prices, and Sub-headings */
    .product-name,
    h3,
    h4,
    .price-box .fs-2,
    .product-price {
        font-size: 0.95rem !important;
        /* ~15.2px - Elegant and fits */
        font-weight: 600 !important;
        line-height: 1.3 !important;
    }

    /* Level 4: Muted Text, Badges, Secondary Info */
    .fs-5,
    .text-muted,
    h5,
    h6,
    .product-badge {
        font-size: 0.85rem !important;
        /* ~13.6px */
    }



    /* Product Detail Page Specifics */
    .product-main-view {
        min-height: auto !important;
        padding: 1rem !important;
    }

    .product-main-view img {
        max-height: 320px !important;
        object-fit: contain;
    }

    .product-info-premium {
        padding-left: 0 !important;
        max-width: 100% !important;
    }

    /* EMERGENCY FIX: Typography & Layout */
    .product-info-premium .display-5 {
        font-size: 1.5rem !important;
        /* Force smaller title */
        line-height: 1.2 !important;
        margin-bottom: 0.5rem !important;
        word-wrap: break-word;
    }

    .btn-theme-outline {
        padding: 6px 12px !important;
        /* Smaller size buttons */
        font-size: 0.9rem !important;
        margin: 0 4px 8px 0 !important;
    }

    /* Force Full Width Actions */
    .product-actions .d-grid,
    .product-actions .btn-lg {
        display: block !important;
        width: 100% !important;
        white-space: nowrap;
    }

    .product-gallery.sticky-top {
        position: relative !important;
        top: 0 !important;
    }

    /* Absolute Grid/Layout Protection */
    .container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .row {
        max-width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .row {
        --bs-gutter-x: 1rem !important;
    }

    [id^="section-"] {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }
}

/* Product Detail Page Refinements */
.product-main-view {
    min-height: 500px;
}

.product-main-view img {
    max-height: 500px;
    object-fit: contain;
}

.product-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: inherit;
}


/* Cart Float Button - Premium Pill */
.cart-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #1d1d1f;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 999;
    transition: var(--transition);
    text-decoration: none;
    font-weight: 600;
}

.cart-float:hover {
    transform: translateY(-5px);
    color: white;
}

.cart-float .badge-count {
    background: var(--primary-color);
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 50%;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

.pulse-animation {
    animation: pulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dynamic Block Themes */
.theme-light {
    background-color: #ffffff !important;
    color: #1d1d1f !important;
}

.theme-dark {
    background-color: #000000 !important;
    color: #f5f5f7 !important;
}

.theme-glass {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20%) saturate(180%) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.theme-gradient {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%) !important;
}

/* --- GLOBAL TEXT INHERITANCE (Simplificación Nuclear) --- */
body,
[id^="section-"],
#section-header,
.main-content,
main,
.category-sidebar {
    color: var(--text-main) !important;
}

/* Force standard elements to follow their parent's color (Including Inputs) */
p,
span,
h1,
h2,
h3,
h4,
h5,
h6,
label,
i,
.lead,
.breadcrumb-item,
.breadcrumb-item.active,
.nav-link,
input,
textarea,
select,
.form-control {
    color: inherit;
}

/* Links inherit unless they are premium buttons or product cards */
a:not(.btn):not(.product-card a) {
    color: inherit;
}

/* CARD PROTECTION (Forzar texto oscuro en fondos blancos) */
.product-card,
.card.bg-white,
.bg-white,
.protected-light-bg,
.icon-circle.bg-light,
.product-image-container {
    --internal-text: #1d1d1f !important;
    --internal-muted: #86868b !important;
    background-color: #ffffff !important;
    color: var(--internal-text) !important;
}

/* NUCLEAR SAFETY: Ensure buttons always have correct text color */
.btn-buy-black *,
.btn-buy-black {
    color: #ffffff !important;
}

.btn-whatsapp-green *,
.btn-whatsapp-green {
    color: #ffffff !important;
}

/* CARD PROTECTION (Isolated to text elements to avoid breaking buttons) */
.product-card .product-name,
.product-card .product-price {
    color: #000000 !important;
}

.product-card .text-muted {
    color: #86868b !important;
}

/* THEME-AWARE COMPONENTS */
.btn-theme-outline {
    border: 1px solid var(--text-main) !important;
    color: var(--text-main) !important;
    background: transparent !important;
    transition: all 0.2s ease;
}

.btn-theme-outline:hover {
    background: var(--text-main) !important;
    color: var(--bg-page) !important;
}

/* Hover & Active for Sidebar Links (Dynamic & Soft) */
.hover-bg-theme:hover,
.nav-link.active-theme {
    background: rgba(var(--primary-color-rgb, 0, 122, 255), 0.15) !important;
    color: var(--primary-color) !important;
    backdrop-filter: brightness(1.1);
}

.btn-check:checked+.btn-theme-outline {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #ffffff !important;
}

/* Theme Item Colors */
.review-item {
    background: transparent !important;
    color: inherit !important;
    border-color: rgba(var(--text-main-rgb), 0.1) !important;
}

.review-item * {
    color: inherit !important;
}

/* Mobile Navbar Adjustments (Kairex Aesthetic Mapped) */
@media (max-width: 991px) {
    .navbar-collapse {
        background-color: var(--primary-color);
        /* Kairex uses a 98% opacity blue, we use dynamic primary. For backdrop filter to work well, primary should ideally be slightly translucent, but we apply blur anyway */
        backdrop-filter: blur(64px);
        -webkit-backdrop-filter: blur(64px);
        border-radius: 16px;
        margin-top: 10px;
        padding: 20px;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
        border: 1px solid rgba(255, 255, 255, 0.15); /* Mapped from border-blue-800/50 for high contrast edge */
    }

    .navbar-collapse .nav-link-custom {
        color: var(--navbar-text) !important;
    }

    .nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Mapped from hr border-blue-800/50 */
    }

    .nav-item:last-child {
        border-bottom: none;
    }

    .navbar-brand img {
        max-height: 35px;
    }
}

/* Specific Input Fixes for Dark Themes */
.form-control {
    color: var(--text-main) !important;
}

.form-control::placeholder {
    color: var(--text-main) !important;
    opacity: 0.5;
}

.form-label {
    color: inherit !important;
}

/* Nuclear Slider Spacing Protection */
#section-slider,
#section-slider .container-fluid,
#section-slider .carousel,
#section-slider .carousel-inner,
#section-slider .carousel-item {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

.link-current {
    color: var(--text-main) !important;
    opacity: 0.9;
}

.search-input-group {
    background: rgba(128, 128, 128, 0.1) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(128, 128, 128, 0.2) !important;
}


.search-input-group input {
    background: transparent !important;
    color: inherit !important;
    border: none !important;
}




/* Theme specific overrides */
.theme-dark h1,
.theme-dark h2,
.theme-dark h3,
.theme-dark p,
.theme-dark .text-muted {
    color: #ffffff;
}

.theme-dark .text-muted,
.theme-dark small {
    opacity: 0.7;
}

/* Responsive Table */
.admin-table {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: none !important;
}

.admin-table thead th {
    background: #f5f5f7;
    border: none;
    color: #86868b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 16px;
}

/* Details Page (Refinement) */
.product-gallery .main-image-container {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
}

.breadcrumb-item a {
    color: var(--primary-color);
    font-weight: 500;
}

.lead {
    line-height: 1.6;
    color: inherit;
}

/* Authentication Pages (Login/Register) */
.auth-container {
    background-color: var(--bg-page);
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    border-radius: 24px;
    padding: 3rem;
    width: 100%;
    max-width: 480px;
}

.auth-title {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-control-auth {
    background-color: #fbfbfd;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control-auth:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 14px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.auth-footer {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Glassmorphism utility - BLUR REMOVED */
.glass {
    background: var(--navbar-bg);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.product-card:hover .product-image {
    transform: none !important;
}

.category-image-container img,
.hover-shadow img {
    transform: none !important;
}

.theme-glass {
    background: rgba(255, 255, 255, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Category Hover Effects - CLEAN */
.card-hover-effect {
    transition: transform 0.3s ease;
}

.card-hover-effect:hover {
    transform: translateY(-5px);
}

.hover-shadow {
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: var(--shadow-md) !important;
    border-color: var(--primary-color) !important;
}

.hover-shadow img {
    transition: none !important;
    transform: none !important;
}

.hover-shadow:hover img {
    transform: none !important;
}
/* Visual editor: device visibility (tablet follows desktop). */
@media (max-width: 767.98px) {
    .visual-block-wrapper.visual-hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
    .visual-block-wrapper.visual-hide-desktop { display: none !important; }
}

/* Explicit block alignment overrides template text alignment only when chosen. */
.visual-block-wrapper.visual-block-aligned :is(h1, h2, h3, h4, h5, h6, p, .text-center, .text-start, .text-end, .text-md-start, .text-lg-start, .text-md-end, .text-lg-end) {
    text-align: var(--block-text-align) !important;
}

/* Per-block heading colors override theme and Bootstrap utility colors. */
.visual-block-wrapper.visual-block-custom-headings :is(.section-title, .newsletter-title, .contact-cta-title),
.visual-block-wrapper.visual-block-custom-headings[data-block-id="about"] .about-copy > h2,
.visual-block-wrapper.visual-block-custom-headings[data-block-id="multimedia"] .multimedia-block__content h2,
.visual-block-wrapper.visual-block-custom-headings[data-block-id="countdown"] h2 {
    color: var(--block-title-color, var(--block-text-color, var(--text-main))) !important;
}
.visual-block-wrapper.visual-block-custom-headings :is(.section-title + p, .category-subtitle, .testimonials-subtitle, .newsletter-subtitle, .contact-cta-subtitle),
.visual-block-wrapper.visual-block-custom-headings[data-block-id="about"] .about-copy > p,
.visual-block-wrapper.visual-block-custom-headings[data-block-id="multimedia"] .multimedia-block__content p,
.visual-block-wrapper.visual-block-custom-headings[data-block-id="countdown"] h2 + p {
    color: var(--block-subtitle-color, var(--block-text-color, var(--text-main))) !important;
}

/* Buttons can inherit the store palette or be customized for one block only. */
.visual-block-wrapper.visual-block-custom-buttons :is(.btn, button[type="submit"], .multimedia-block__content a, .countdown-block a):not(.btn-link):not(.carousel-control-prev):not(.carousel-control-next) {
    color: var(--block-button-text, #fff) !important;
    background: var(--block-button-bg, var(--primary-color)) !important;
    border-color: var(--block-button-bg, var(--primary-color)) !important;
    border-radius: var(--block-button-radius, 50px) !important;
}
.visual-block-wrapper.visual-block-custom-buttons :is(.btn, button[type="submit"], .multimedia-block__content a, .countdown-block a):not(.btn-link):not(.carousel-control-prev):not(.carousel-control-next):hover {
    color: var(--block-button-text, #fff) !important;
    background: var(--block-button-hover, var(--block-button-bg, var(--primary-color))) !important;
    border-color: var(--block-button-hover, var(--block-button-bg, var(--primary-color))) !important;
}
.visual-block-wrapper.visual-block-custom-buttons.visual-block-buttons-outline :is(.btn, button[type="submit"], .multimedia-block__content a, .countdown-block a):not(.btn-link):not(.carousel-control-prev):not(.carousel-control-next) {
    color: var(--block-button-bg, var(--primary-color)) !important;
    background: transparent !important;
    border-color: var(--block-button-bg, var(--primary-color)) !important;
}
.visual-block-wrapper.visual-block-custom-buttons.visual-block-buttons-outline :is(.btn, button[type="submit"], .multimedia-block__content a, .countdown-block a):not(.btn-link):not(.carousel-control-prev):not(.carousel-control-next):hover {
    color: var(--block-button-text, #fff) !important;
    background: var(--block-button-hover, var(--block-button-bg, var(--primary-color))) !important;
}

/* Animate opening without changing Bootstrap/Popper positioning or interaction. */
.navbar-custom .dropdown-menu {
    animation-name: var(--submenu-animation, none);
    animation-duration: var(--submenu-duration, 250ms);
    animation-timing-function: ease-out;
    transform-origin: top center;
}
@keyframes submenu-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes submenu-slide {
    from { opacity: 0; translate: 0 -20px; }
    to { opacity: 1; translate: 0 0; }
}
@keyframes submenu-zoom {
    from { opacity: 0; scale: 0.90; }
    to { opacity: 1; scale: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .navbar-custom .dropdown-menu { animation: none !important; }
}

/* Optional color overrides: each fallback preserves the existing component. */
body .product-card .product-name, body .product-card .product-price {
    color: var(--custom-product-text, #000000) !important;
}
body .btn-premium-primary {
    background: var(--custom-button-bg, #000000) !important;
    color: var(--custom-button-text, white) !important;
}
body .btn-premium-primary:hover {
    background: var(--custom-button-hover, #000000) !important;
}
body .product-card .btn-buy-black {
    background-color: var(--custom-button-bg, #000000) !important;
}
body .product-card .btn-buy-black:hover {
    background-color: var(--custom-button-hover, #333333) !important;
}
body .btn-buy-black, body .btn-buy-black * {
    color: var(--custom-button-text, #ffffff) !important;
}
body .btn-primary {
    --bs-btn-bg: var(--custom-button-bg, #0d6efd);
    --bs-btn-border-color: var(--custom-button-bg, #0d6efd);
    --bs-btn-color: var(--custom-button-text, #fff);
    --bs-btn-hover-bg: var(--custom-button-hover, #0b5ed7);
    --bs-btn-hover-border-color: var(--custom-button-hover, #0a58ca);
    --bs-btn-hover-color: var(--custom-button-text, #fff);
    --bs-btn-active-bg: var(--custom-button-hover, #0a58ca);
    --bs-btn-active-border-color: var(--custom-button-hover, #0a53be);
    --bs-btn-active-color: var(--custom-button-text, #fff);
}
#main-footer .text-white {
    color: var(--custom-footer-text, #fff) !important;
}
#main-footer h5 {
    color: var(--custom-footer-text, var(--text-main)) !important;
}
#main-footer .btn-outline-light {
    --bs-btn-color: var(--custom-footer-text, #f8f9fa);
}

/* Preset palettes on built-in section headings; product cards retain their own palette. */
.preset-block[data-block-id="categories"] :is(h2,h6,p),
.preset-block[data-block-id="featured"] :is(.section-title,.section-title + p),
.preset-block[data-block-id="about"] :is(h2,h3,p,.product-description),
.preset-block[data-block-id="cta"] :is(h2,p) {
    color: var(--preset-block-text) !important;
}

/* Independent promotional banners that can be interleaved in the home builder. */
.promo-banner-section { width: 100%; }
.visual-block-wrapper[data-block-id^="promo_banner_"] {
    width: 100%;
}
.visual-block-wrapper[data-block-id^="promo_banner_"] > .promo-banner-section.promo-banner-full {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}
.promo-banner-card {
    position: relative;
    display: block;
    width: 100%;
    height: var(--promo-height, 320px);
    overflow: hidden;
    border-radius: var(--promo-radius, 0);
    color: #fff;
    text-decoration: none;
    background: #eef2f7;
}
.promo-banner-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0,0,0,.85), rgba(0,0,0,.1));
    opacity: var(--promo-overlay, .15);
    pointer-events: none;
}
.promo-banner-card picture,
.promo-banner-card img { display: block; width: 100%; height: 100%; }
.promo-banner-card img { object-fit: cover; transition: transform .45s ease; }
a.promo-banner-card:hover img { transform: scale(1.025); }
.promo-banner-content {
    position: absolute;
    z-index: 1;
    top: 50%;
    width: min(680px, 86%);
    padding: clamp(1.25rem, 4vw, 4rem);
    transform: translateY(-50%);
    color: #fff;
    text-shadow: 0 2px 18px rgba(0,0,0,.35);
}
.promo-banner-content-left { left: 0; text-align: left; }
.promo-banner-content-center { left: 50%; transform: translate(-50%, -50%); text-align: center; }
.promo-banner-content-right { right: 0; text-align: right; }
.promo-banner-content h2 { margin: 0 0 .45rem; color: inherit; font-size: clamp(1.8rem, 4vw, 3.5rem); font-weight: 800; }
.promo-banner-content p { margin: 0 0 1.1rem; color: inherit; font-size: clamp(1rem, 1.6vw, 1.3rem); }
.promo-banner-button { display: inline-flex; padding: .72rem 1.25rem; border-radius: 999px; color: #111; background: #fff; font-weight: 800; text-shadow: none; }
@media (max-width: 767.98px) {
    .promo-banner-card { height: var(--promo-mobile-height, 320px); }
    .promo-banner-content { width: 92%; padding: 1.25rem; }
    .promo-banner-content h2 { font-size: clamp(1.5rem, 8vw, 2.4rem); }
}

/* Retail catalog: reuse each category's image and description as a visual header. */
.catalog-header-shell {
    position: relative;
}

.catalog-header-description {
    max-width: 42rem;
}

.catalog-subcategory-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1.15rem;
}

.catalog-subcategory-chips a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0.42rem 0.9rem;
    border: 1px solid color-mix(in srgb, var(--primary-color) 28%, transparent);
    border-radius: 999px;
    color: inherit;
    background: color-mix(in srgb, var(--primary-color) 7%, transparent);
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.1;
    text-decoration: none;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}

.catalog-subcategory-chips a:hover,
.catalog-subcategory-chips a.active {
    color: #fff;
    border-color: var(--primary-color);
    background: var(--primary-color);
    transform: translateY(-1px);
}

body.header-layout-retail .catalog-header-shell {
    min-height: var(--category-hero-height, 280px);
    align-items: center !important;
    padding: clamp(1.5rem, 4vw, 3.25rem);
    border-radius: var(--category-hero-radius, 28px);
    overflow: hidden !important;
    color: var(--text-main);
    background: color-mix(in srgb, var(--primary-color) 8%, #fff);
    box-shadow: 0 18px 48px rgba(15, 23, 42, .10);
}

body.header-layout-retail .catalog-header-shell.catalog-header-has-image {
    color: #fff;
    background: #151515;
}

body.header-layout-retail .catalog-header-media {
    position: absolute;
    inset: 0;
    z-index: 0;
    padding: 0 !important;
    margin-top: 0 !important;
}

body.header-layout-retail .catalog-header-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(9, 12, 18, .95) 0%, rgba(9, 12, 18, .48) 48%, rgba(9, 12, 18, .06) 100%);
    opacity: var(--category-hero-overlay, 0);
}

body.header-layout-retail .catalog-header-media img {
    width: 100%;
    height: 100%;
    object-fit: var(--category-hero-fit, cover);
    object-position: var(--category-hero-position, center);
}

body.header-layout-retail .catalog-header-media picture {
    display: block;
    width: 100%;
    height: 100%;
}

body.header-layout-retail .catalog-header-full-width {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

body.header-layout-retail .catalog-page-retail {
    overflow-x: clip;
}

body.header-layout-retail .catalog-page-hero-full-width {
    padding-top: 0 !important;
}

body.header-layout-retail .catalog-page-hero-full-width .catalog-header-full-width {
    margin-top: 0;
}

body.header-layout-retail .catalog-header-copy,
body.header-layout-retail .catalog-header-search {
    position: relative;
    z-index: 1;
}

body.header-layout-retail .catalog-header-has-image .breadcrumb,
body.header-layout-retail .catalog-header-has-image .breadcrumb-item,
body.header-layout-retail .catalog-header-has-image .breadcrumb-item a,
body.header-layout-retail .catalog-header-has-image .breadcrumb-item.active {
    color: rgba(255, 255, 255, .82) !important;
}

body.header-layout-retail .catalog-header-has-image .catalog-subcategory-chips a {
    color: #fff;
    border-color: rgba(255, 255, 255, .42);
    background: rgba(255, 255, 255, .14);
}

body.header-layout-retail .catalog-header-has-image .catalog-subcategory-chips a:hover,
body.header-layout-retail .catalog-header-has-image .catalog-subcategory-chips a.active {
    border-color: #fff;
    color: #111;
    background: #fff;
}

@media (max-width: 991.98px) {
    body.header-layout-retail .catalog-header-shell {
        min-height: min(var(--category-hero-height, 280px), 380px);
        padding: 1.5rem;
    }

    body.header-layout-retail .catalog-header-media::after {
        background: rgba(9, 12, 18, .85);
    }
}

@media (max-width: 575.98px) {
    .catalog-page {
        padding-top: 1.5rem !important;
    }

    body.header-layout-retail .catalog-header-shell {
        margin-right: 0;
        margin-left: 0;
        padding: 1.2rem .8rem;
        border-radius: min(var(--category-hero-radius, 28px), 24px);
    }

    body.header-layout-retail .catalog-header-copy,
    body.header-layout-retail .catalog-header-search {
        padding-right: .35rem;
        padding-left: .35rem;
    }

    body.header-layout-retail .catalog-header-copy h1 {
        font-size: clamp(2rem, 10vw, 2.7rem);
    }

    .catalog-subcategory-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: .35rem;
        scrollbar-width: none;
    }

    .catalog-subcategory-chips::-webkit-scrollbar {
        display: none;
    }

    .catalog-subcategory-chips a {
        flex: 0 0 auto;
    }

    .catalog-header-search .search-input-group .btn {
        padding-right: 1rem !important;
        padding-left: 1rem !important;
    }
}
