/*
 * CarDiagnosticScanner Product Experience v1.1
 * Final, head-loaded scoped override for card density, CTA, 1500px alignment,
 * and existing WooCommerce product_brand archives.
 * Lato | charcoal #111C25 | green #FFB400 | white. No gradients.
 */

/* Layout: Elementor sections may be wider than the rest of the homepage;
   constrain only our own product components, not their parent wrappers. */
html body .csc-product-slider[data-csc-product-slider],
html body .csc-product-grid-wrap,
html body .csc-product-wishlist-page {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 1500px !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    font-family: 'Lato', Arial, sans-serif !important;
}
html body .csc-product-archive {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: none !important; /* full-width page background */
    margin-inline: auto !important;
    overflow-x: clip !important;
    font-family: 'Lato', Arial, sans-serif !important;
}
html body .csc-product-archive > .csc-product-archive-inner {
    box-sizing: border-box !important;
    width: calc(100% - 40px) !important;
    max-width: 1500px !important;
    min-width: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 !important;
}
html body .csc-product-archive .csc-product-grid-wrap,
html body .csc-product-archive .csc-product-category-section {
    width: 100% !important;
    max-width: 1500px !important;
    margin-inline: auto !important;
}
html body .csc-product-slider[data-csc-product-slider] {
    position: relative !important;
    isolation: isolate !important;
}
html body .csc-product-slider[data-csc-product-slider] > .csc-product-slider-track,
html body .csc-product-grid-wrap > .csc-product-grid {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}
html body .csc-product-slider[data-csc-product-slider] > .csc-product-slider-track {
    gap: 14px !important;
    padding: 2px 0 12px !important;
    scroll-padding-inline: 1px !important;
    scroll-snap-type: x proximity !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y !important;
}
html body .csc-product-slider[data-csc-product-slider] .csc-product-slider-track > .csc-product-card,
html body .csc-product-grid-wrap .csc-product-grid > .csc-product-card {
    min-width: 0 !important;
}

/* Calm, recognizable CarDiagnosticScanner cards. */
html body .csc-product-slider .csc-product-card,
html body .csc-product-grid-wrap .csc-product-card,
html body .csc-product-archive .csc-product-card,
html body .csc-product-wishlist-page .csc-product-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    border: 1px solid #DAE2E9 !important;
    border-radius: 13px !important;
    overflow: hidden !important;
    background: #fff !important;
    box-shadow: 0 3px 12px rgba(17,25,28,.035) !important;
    transform: none !important;
}
@media (hover:hover) {
    html body .csc-product-card:hover {
        border-color: #EBC668 !important;
        box-shadow: 0 7px 20px rgba(17,25,28,.085) !important;
    }
}
html body .csc-product-card .csc-product-card-media {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    background: #fff !important;
    border-bottom: 1px solid #edf1ed !important;
}
html body .csc-product-card .csc-product-card-image-link {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
}
html body .csc-product-card .csc-product-card-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* retain the entire diagnostic tool */
    object-position: center !important;
    padding: 9px !important;
    margin: 0 !important;
    transform: none !important;
}
html body .csc-product-card .csc-product-wishlist-ui {
    background: #fff !important;
    color: #111C25 !important;
    border: 1px solid #e4ebe6 !important;
    border-radius: 50% !important;
}
html body .csc-product-card .csc-product-sale-badge {
    background: #111C25 !important;
    color: #fff !important;
    border-radius: 5px !important;
    padding: 6px 8px !important;
    font-size: 10px !important;
}
html body .csc-product-card .csc-product-card-body {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    padding: 13px !important;
    background: #fff !important;
}
html body .csc-product-card .csc-product-card-eyebrow {
    font: 900 10px/1.35 'Lato', Arial, sans-serif !important;
    text-transform: uppercase !important;
    letter-spacing: .065em !important;
    color: #9B6200 !important;
    margin: 0 0 7px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
html body .csc-product-card .csc-product-card-title {
    display: block !important;
    width: 100% !important;
    min-height: 55px !important;
    max-height: 55px !important;
    height: 55px !important;
    overflow: hidden !important;
    font: 800 13.5px/18.3px 'Lato', Arial, sans-serif !important;
    letter-spacing: -.006em !important;
    text-align: left !important;
    margin: 0 0 10px !important;
    padding: 0 !important;
    -webkit-line-clamp: unset !important;
}
html body .csc-product-card .csc-product-card-title > a {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 3 !important;
    overflow: hidden !important;
    color: #141c20 !important;
    font: inherit !important;
    text-decoration: none !important;
    overflow-wrap: anywhere !important;
}
html body .csc-product-card .csc-product-card-bottom {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 0 auto !important;
    justify-content: flex-end !important;
    min-width: 0 !important;
    width: 100% !important;
    margin-top: auto !important;
    padding: 0 !important;
}
html body .csc-product-card .csc-product-price-row {
    min-height: 30px !important;
    display: flex !important;
    align-items: center !important;
    margin: 0 0 11px !important;
}
html body .csc-product-card .csc-product-price {
    font: 900 17px/1.25 'Lato', Arial, sans-serif !important;
    letter-spacing: -.025em !important;
    color: #10181c !important;
}
html body .csc-product-card .csc-product-price del {
    color: #84908a !important;
    font: 600 11px/1.35 'Lato', Arial, sans-serif !important;
}
html body .csc-product-card .csc-product-card-buy-row {
    flex: 0 0 auto !important;
    width: 100% !important;
    margin-top: auto !important;
}
html body .csc-product-card a.csc-product-buy-button,
html body .csc-product-card a.csc-product-buy-button:visited {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 11px 8px !important;
    background: #FFB400 !important;
    border: 1px solid #32c82d !important;
    border-radius: 8px !important;
    color: #101819 !important;
    font: 900 12px/1.2 'Lato', Arial, sans-serif !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    text-align: center !important;
    text-decoration: none !important;
}
html body .csc-product-card a.csc-product-buy-button:hover {
    background: #2cc227 !important;
    border-color: #28aa23 !important;
    color: #101819 !important;
}
html body .csc-product-card a.csc-product-buy-button:focus-visible {
    outline: 2px solid #111C25 !important;
    outline-offset: 2px !important;
}
html body .csc-product-card .csc-product-button-icon {
    width: 14px !important;
    height: 14px !important;
    flex: 0 0 14px !important;
    stroke: currentColor !important;
}

/* Unified grid / carousel rules. Maintain admin-configured desktop count,
   while protecting readable card widths on compact viewports. */
@media (min-width: 1101px) {
    html body .csc-product-slider[data-csc-product-slider] .csc-product-slider-track {
        grid-auto-columns: calc((100% - (var(--csc-product-slider-desktop, 5) - 1) * 14px)/var(--csc-product-slider-desktop, 5)) !important;
    }
    html body .csc-product-grid-wrap > .csc-product-grid:not(.csc-product-archive-grid) {
        grid-template-columns: repeat(var(--csc-product-grid-desktop, 5), minmax(0, 1fr)) !important;
    }
    html body .csc-product-archive-grid {
        grid-template-columns: repeat(var(--csc-product-archive-desktop, 5), minmax(0, 1fr)) !important;
    }
}
@media (min-width: 768px) and (max-width: 1100px) {
    html body .csc-product-slider[data-csc-product-slider] .csc-product-slider-track {
        gap: 12px !important;
        grid-auto-columns: calc((100% - 24px)/3) !important;
    }
    html body .csc-product-grid-wrap .csc-product-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}
@media (max-width: 767px) {
    html body .csc-product-slider[data-csc-product-slider],
    html body .csc-product-grid-wrap,
    html body .csc-product-wishlist-page {
        width: calc(100% - 24px) !important;
        max-width: 1500px !important;
        margin-inline: auto !important;
        padding-inline: 0 !important;
    }
    html body .csc-product-archive > .csc-product-archive-inner {
        width: calc(100% - 24px) !important;
    }
    html body .csc-product-slider[data-csc-product-slider] .csc-product-slider-track {
        gap: 9px !important;
        grid-auto-columns: calc((100% - (var(--csc-product-slider-mobile, 2) - 1)*9px)/var(--csc-product-slider-mobile, 2)) !important;
    }
    html body .csc-product-grid-wrap .csc-product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }
    html body .csc-product-card .csc-product-card-body {padding: 10px !important;}
    html body .csc-product-card .csc-product-card-title {
        font: 800 11.5px/16px 'Lato', Arial, sans-serif !important;
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        margin-bottom: 8px !important;
    }
    html body .csc-product-card .csc-product-card-eyebrow {
        font-size: 8.5px !important;
        margin-bottom: 6px !important;
    }
    html body .csc-product-card .csc-product-price {font-size: 14px !important;}
    html body .csc-product-card .csc-product-price-row {margin-bottom: 9px !important;}
    html body .csc-product-card a.csc-product-buy-button {
        min-height: 40px !important;
        padding: 8px 4px !important;
        border-radius: 6px !important;
        font-size: 10.5px !important;
        white-space: normal !important;
    }
    html body .csc-product-card .csc-product-card-image {padding: 5px !important;}
    html body .csc-product-archive-hero {padding: 23px 17px !important;}
}
@media (max-width: 360px) {
    html body .csc-product-card .csc-product-card-body {padding: 8px !important;}
    html body .csc-product-card a.csc-product-buy-button {font-size: 10px !important;}
}

/* Brand archives use the same product grid and button styles as categories. */
html body .csc-product-archive--brand .csc-product-archive-hero {
    background: #111C25 !important;
    border-color: #111C25 !important;
    border-radius: 14px !important;
}
html body .csc-product-archive--brand .csc-product-archive-hero__eyebrow {
    color: #FFB400 !important;
}
html body .csc-product-archive--brand .csc-product-archive-hero__line,
html body .csc-product-archive--brand .csc-product-archive-hero__line i {
    background: #FFB400 !important;
}
html body .csc-product-archive--brand .csc-product-archive-hero h1 {
    font-family: 'Lato', Arial, sans-serif !important;
    color: #fff !important;
}
html body .csc-product-archive .csc-product-load-more {
    background: #111C25 !important;
    border-color: #111C25 !important;
    color: #fff !important;
}
html body .csc-product-archive .csc-product-load-more:hover {
    background: #267c28 !important;
    border-color: #267c28 !important;
}
@media (prefers-reduced-motion: reduce) {
    html body .csc-product-card,
    html body .csc-product-card a.csc-product-buy-button {transition: none !important;}
}

/* Brand logo only appears when a native WooCommerce thumbnail exists. */
html body .csc-product-archive--brand .csc-product-archive-hero__copy {
    flex: 1 1 0 !important;
    min-width: 0 !important;
}
html body .csc-product-archive--brand .csc-product-brand-hero-logo {
    flex: 0 0 min(25%, 240px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 240px !important;
    aspect-ratio: 1024 / 671 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    border: 1px solid #e5eee7 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
}
html body .csc-product-archive--brand .csc-product-brand-hero-logo__image {
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
}
@media (max-width: 767px) {
    html body .csc-product-archive--brand .csc-product-archive-hero {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }
    html body .csc-product-archive--brand .csc-product-brand-hero-logo {
        width: min(60%, 240px) !important;
        max-width: 240px !important;
        flex: 0 0 auto !important;
    }
}

/* CarDiagnosticScanner readable brand header and aligned badges */
html body .csc-product-archive--brand .csc-product-archive-hero{background:#111C25!important;color:#fff!important;}
html body .csc-product-archive--brand .csc-product-archive-hero h1{color:#fff!important;opacity:1!important;}
html body .csc-product-archive--brand .csc-product-archive-hero__description,
html body .csc-product-archive--brand .csc-product-archive-hero__description p{color:#E2EAF0!important;opacity:1!important;}
html body .csc-product-archive--brand .csc-product-archive-hero__eyebrow{background:#fff!important;color:#815400!important;}
html body .csc-product-archive--brand .csc-product-brand-hero-logo__image{width:100%!important;height:auto!important;object-fit:contain!important;aspect-ratio:1024 / 671;}
html body .csc-product-card .csc-product-card-button,
html body .csc-product-card .csc-product-buy-button,
html body .csc-product-card .csc-product-cta{background:#111C25!important;color:#fff!important;border-radius:7px!important;}
html body .csc-product-card a:hover{transition:none;}

/* Final brand contrast and tool-buying safety. */
html body .csc-product-archive--brand .csc-product-archive-hero__description,html body .csc-product-archive--brand .csc-product-archive-hero__description *{color:#E2EAF0!important;}
html body .csc-product-card .csc-product-card-button, html body .csc-product-card .csc-product-card-cta,html body .csc-product-card .csc-product-card-action {background:#111C25!important;color:#fff!important;}
html body .csc-product-card .csc-product-card-button:hover,html body .csc-product-card .csc-product-card-cta:hover{background:#263B4A!important;color:#FFB400!important;}
