/* Storefront cards and home sections */
:where(html[data-theme="dark"]) :is(.product-card, .hero-slide--empty, .usp-strip) {
    background-color: var(--theme-surface);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) .product-card {
    box-shadow: inset 0 0 0 1px var(--theme-border);
}

:where(html[data-theme="dark"]) .product-card:hover {
    box-shadow: inset 0 0 0 1px var(--theme-border), var(--theme-shadow);
}

:where(html[data-theme="dark"]) :is(.product-card__image-wrapper, .image-overlay) {
    background-color: var(--theme-raised);
}

:where(html[data-theme="dark"]) :is(.section-spacing, .categories-showcase, .related-products-section) .section-title,
:where(html[data-theme="dark"]) :is(.product-card__title, .product-card__price, .usp-item span, .newsletter-title) {
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) .product-card__price.old-price,
:where(html[data-theme="dark"]) .newsletter-sub {
    color: var(--theme-muted);
}

:where(html[data-theme="dark"]) .product-card__price.sale-price {
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.product-card__cart-btn, .newsletter-form button, .bundle-indicator, .bundle-qty-pill) {
    background: var(--theme-accent);
    color: var(--theme-bg);
    box-shadow: none;
}

:where(html[data-theme="dark"]) .product-card__cart-btn::before {
    background: var(--theme-bg);
}

:where(html[data-theme="dark"]) :is(.product-card__cart-btn, .newsletter-form button):hover {
    background: var(--theme-warning);
    box-shadow: none;
}

:where(html[data-theme="dark"]) .product-card__cart-btn.added {
    background: var(--theme-success);
    box-shadow: none;
}

:where(html[data-theme="dark"]) .product-card__cart-btn.error {
    background: var(--theme-danger);
    box-shadow: none;
}

:where(html[data-theme="dark"]) :is(.product-card .wishlist-btn, .product-details .wishlist-btn--lg) {
    background: var(--theme-raised);
    color: var(--theme-muted);
    border-color: var(--theme-border);
}

:where(html[data-theme="dark"]) :is(.product-card .wishlist-btn, .product-details .wishlist-btn--lg):is(:hover, .active) {
    border-color: var(--theme-danger);
    color: var(--theme-danger);
}

html[data-theme="dark"] :is(.discount-badge, .bundle-hero__discount) {
    background-color: #d9382b;
    color: #fff;
    box-shadow: 0 2px 8px rgb(217 56 43 / .36);
}

:where(html[data-theme="dark"]) :is(.bundles-slider, .popular-products-slider, .latest-products-slider, .discounted-products-slider, .related-products-slider) .swiper-pagination-bullet {
    background-color: var(--theme-border);
}

:where(html[data-theme="dark"]) :is(.bundles-slider, .popular-products-slider, .latest-products-slider, .discounted-products-slider, .related-products-slider) .swiper-pagination-bullet-active {
    background-color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .usp-divider {
    background: var(--theme-border);
}

:where(html[data-theme="dark"]) .usp-item i,
:where(html[data-theme="dark"]) .newsletter-section {
    background: var(--theme-accent-surface);
    border-color: var(--theme-border);
}

:where(html[data-theme="dark"]) .usp-item i {
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .newsletter-form input {
    background: var(--theme-bg);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) .newsletter-form input::placeholder {
    color: var(--theme-muted);
}

:where(html[data-theme="dark"]) .newsletter-form input:focus {
    border-color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .newsletter-msg.ok {
    color: var(--theme-success);
}

:where(html[data-theme="dark"]) .newsletter-msg.err {
    color: var(--theme-danger);
}

@media (max-width: 767px) {
    :where(html[data-theme="dark"]) .usp-strip__inner {
        background: var(--theme-border);
    }

    :where(html[data-theme="dark"]) .usp-item {
        background: var(--theme-surface);
    }
}

/* Catalog and mobile filters */
.price-range-currency,
.price-range-dash {
    color: #6b625b;
}

.panel-header__eyebrow {
    color: #9f4f12;
}

:where(html[data-theme="dark"]) :is(.catalog-heading h1, .panel-header h3, .panel-group h4, .filter-section-toggle, .filter-sidebar-head > span, .price-num-input) {
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) :is(.panel-header__eyebrow, .filter-sidebar-head > span i, .filter-section-toggle > span i, .clear-all-btn) {
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .clear-all-btn:hover {
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) .catalog-heading h1::after,
:where(html[data-theme="dark"]) .price-range-fill {
    background: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.filter-sidebar-inner, .filter-panel) {
    background: var(--theme-surface);
    border-color: var(--theme-border);
    box-shadow: var(--theme-shadow);
}

:where(html[data-theme="dark"]) :is(.filter-sidebar-head, .filter-panel .panel-header, .filter-panel .panel-footer, .price-range-input-box, .close-panel-btn, .panel-option, .btn-clear-filters, .btn-filter) {
    background: var(--theme-raised);
    border-color: var(--theme-border);
    color: var(--theme-text);
    box-shadow: none;
}

:where(html[data-theme="dark"]) :is(.filter-section, .panel-group, .products-toolbar) {
    border-color: var(--theme-border);
}

:where(html[data-theme="dark"]) :is(.toggle-chevron, .filter-section-title, .filter-opt, .price-range-dash, .price-range-currency, .results-count, .no-products-found) {
    color: var(--theme-muted);
}

:where(html[data-theme="dark"]) :is(.filter-section-toggle, .filter-opt, .close-panel-btn, .panel-option, .btn-clear-filters, .btn-filter):hover {
    background: var(--theme-hover);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) :is(.filter-opt.is-active, .panel-option.active, .btn-filter-mobile) {
    background: var(--theme-accent-surface);
    border-color: var(--theme-accent);
    color: var(--theme-accent);
    box-shadow: none;
}

:where(html[data-theme="dark"]) .btn-filter-mobile:hover {
    background: var(--theme-hover);
    border-color: var(--theme-accent);
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.filter-opt-dot, .filter-check-icon) {
    background: var(--theme-bg);
    border-color: var(--theme-muted);
}

:where(html[data-theme="dark"]) :is(.filter-opt.is-active .filter-opt-dot, .filter-opt.filter-check.is-active .filter-check-icon) {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    box-shadow: none;
}

:where(html[data-theme="dark"]) .filter-opt.filter-check.is-active .filter-check-icon::after {
    border-color: var(--theme-bg);
}

:where(html[data-theme="dark"]) .price-range-track {
    background: var(--theme-border);
}

:where(html[data-theme="dark"]) .price-range-input-box:focus-within {
    border-color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .price-thumb::-webkit-slider-thumb {
    background: var(--theme-surface);
    border-color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .price-thumb::-moz-range-thumb {
    background: var(--theme-surface);
    border-color: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.btn-apply-filters, .filter-active-badge) {
    background: var(--theme-accent);
    color: var(--theme-bg);
}

:where(html[data-theme="dark"]) .btn-apply-filters:hover {
    background: var(--theme-warning);
}

:where(html[data-theme="dark"]) .filter-panel-overlay {
    background: rgb(0 0 0 / 65%);
}

:where(html[data-theme="dark"]) .product-grid-loader {
    background: color-mix(in srgb, var(--theme-bg) 88%, transparent);
}

:where(html[data-theme="dark"]) .product-grid-loader .spinner {
    border-color: var(--theme-border);
    border-top-color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .pagination-wrapper .pagination .page-item :is(a, span) {
    background: var(--theme-surface);
    border-color: var(--theme-border);
    color: var(--theme-text);
    box-shadow: none;
}

:where(html[data-theme="dark"]) .pagination-wrapper .pagination .page-item:not(.disabled) a:hover {
    background: var(--theme-raised);
    border-color: var(--theme-accent);
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .pagination-wrapper .pagination .page-item.active span {
    background: var(--theme-accent);
    border-color: var(--theme-accent);
    color: var(--theme-bg);
}

:where(html[data-theme="dark"]) .pagination-wrapper .pagination .page-item.disabled span {
    background: var(--theme-surface);
    color: var(--theme-muted);
    opacity: .6;
}

/* Product detail, quantity controls, variants and reviews */
:where(html[data-theme="dark"]) :is(.product-breadcrumb, .product-breadcrumb a, .product-rating-summary .rating-text, .tab-link, .feature-key, .reviews-count, .review-date, .review-comment, .no-reviews),
:where(html[data-theme="dark"]) .product-breadcrumb > a:not(:first-child)::before,
:where(html[data-theme="dark"]) .product-breadcrumb > span:last-child::before {
    color: var(--theme-muted);
}

:where(html[data-theme="dark"]) :is(.product-breadcrumb span:last-child, .product-title, .product-price, .product-variants-selector label, .quantity-selector label, .tab-link.active, .feature-value, .reviews-title, .average-rating, .review-form-title, .rating-input > label, .comment-input label, .reviewer-name) {
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) :is(.product-breadcrumb a:hover, .product-price.sale-price, .product-description a) {
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.product-price.old-price, .variant-name-display .variant-name-label, .product-description) {
    color: var(--theme-muted);
}

/* Existing rich-text descriptions may carry light-mode colors inline. */
:where(html[data-theme="dark"]) .product-description :where([style*="color:" i]) {
    color: inherit !important;
}

:where(html[data-theme="dark"]) .product-description :is(mark, [style*="background-color:" i]) {
    background-color: var(--theme-accent-surface) !important;
    color: var(--theme-accent) !important;
}

:where(html[data-theme="dark"]) .product-description a[style*="color:" i] {
    color: var(--theme-accent) !important;
}

:where(html[data-theme="dark"]) :is(.main-image, .tabs-nav, .product-features-table, .feature-item, .related-products-section, .product-single-container ~ .reviews-section) {
    border-color: var(--theme-border);
}

:where(html[data-theme="dark"]) :is(.thumbnail-item.active, .price-wrapper, .tab-link.active) {
    border-color: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.variant-name-display, .quantity-selector input[type="number"], .quantity-btn, .variant-swatches-image .variant-item, .variant-swatches-text .variant-item, .comment-input textarea, .review-item) {
    background: var(--theme-surface);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) :is(.quantity-btn:hover:not(:disabled), .variant-swatches-text .variant-item:hover:not(.active), .variant-swatches-image .variant-item:hover:not(.active)) {
    background: var(--theme-hover);
    border-color: var(--theme-muted);
}

:where(html[data-theme="dark"]) .variant-swatches-color .variant-item {
    border-color: var(--theme-border);
}

:where(html[data-theme="dark"]) .variant-swatches-color .variant-item .color-swatch {
    border-color: var(--theme-surface);
}

:where(html[data-theme="dark"]) .variant-swatches .variant-item.active {
    border-color: var(--theme-accent);
    box-shadow: 0 0 0 2px var(--theme-accent-surface);
}

:where(html[data-theme="dark"]) .variant-swatches-text .variant-item.active {
    background: var(--theme-accent-surface);
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.add-to-cart-btn, .submit-review-btn) {
    background: var(--theme-accent);
    color: var(--theme-bg);
}

:where(html[data-theme="dark"]) :is(.add-to-cart-btn:hover:not(:disabled), .submit-review-btn:hover) {
    background: var(--theme-warning);
}

:where(html[data-theme="dark"]) .add-to-cart-btn:disabled {
    background: var(--theme-raised);
    color: var(--theme-muted);
}

:where(html[data-theme="dark"]) :is(.in-stock-badge, .bundle-hero__savings) {
    background: var(--theme-success-surface);
    border-color: var(--theme-success);
    color: var(--theme-success);
}

:where(html[data-theme="dark"]) .low-stock-badge {
    background: var(--theme-warning-surface);
    border-color: var(--theme-warning);
    color: var(--theme-warning);
}

:where(html[data-theme="dark"]) :is(.out-of-stock-badge, .reviews-section .alert-danger) {
    background: var(--theme-danger-surface);
    border-color: var(--theme-danger);
    color: var(--theme-danger);
}

:where(html[data-theme="dark"]) .stock-status-badge::before {
    background: currentColor;
}

:where(html[data-theme="dark"]) .reviews-section .alert-info {
    background: var(--theme-info-surface);
    border-color: var(--theme-info);
    color: var(--theme-info);
}

:where(html[data-theme="dark"]) .review-form-container {
    background: var(--theme-raised);
}

:where(html[data-theme="dark"]) .comment-input textarea:focus {
    border-color: var(--theme-accent);
}

:where(html[data-theme="dark"]) .star-rating label {
    color: var(--theme-muted);
}

:where(html[data-theme="dark"]) :is(.star-rating label:hover, .star-rating label:hover ~ label, .star-rating input:checked ~ label) {
    color: var(--theme-warning);
}

:where(html[data-theme="dark"]) .related-products-section .section-title::after {
    background: var(--theme-accent);
}

/* Bundle detail */
:where(html[data-theme="dark"]) .bundle-hero {
    background: linear-gradient(135deg, var(--theme-surface) 55%, var(--theme-accent-surface));
    border-color: var(--theme-border);
    box-shadow: var(--theme-shadow);
}

:where(html[data-theme="dark"]) :is(.bundle-hero__img, .bundle-hero__item-thumb) {
    background: var(--theme-raised);
    border-color: var(--theme-border);
}

:where(html[data-theme="dark"]) :is(.bundle-hero__img-empty, .bundle-hero__label) {
    background: var(--theme-accent-surface);
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.bundle-hero__title, .bundle-hero__price, .bundle-section-title) {
    color: var(--theme-text);
}

:where(html[data-theme="dark"]) :is(.bundle-hero__price--sale, .bundle-hero__plus) {
    color: var(--theme-accent);
}

:where(html[data-theme="dark"]) :is(.bundle-hero__original, .bundle-hero__desc) {
    color: var(--theme-muted);
}
