/* =========================================================
   GALLERY DARK MODE
   Global theme layer shared by every page.
========================================================= */
html[data-theme="dark"] {
    color-scheme: dark;
    --cream: #11100f;
    --cream-dark: #191715;
    --white: #1b1918;
    --text: #f1ede7;
    --muted: #aaa39b;
    --border: #3a3530;
    --dark: #090808;
    --dark-surface: #171514;
    --footer: #080707;
    --accent: #d7a9a7;
}

html[data-theme="dark"] body {
    background: var(--cream) !important;
    color: var(--text) !important;
}

html[data-theme="dark"] a { color: inherit; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background: #1d1a18 !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #817b74 !important; }

/* Header / navigation */
html[data-theme="dark"] .global-header {
    background: rgba(24,22,20,.94) !important;
    color: var(--text) !important;
    border-bottom-color: var(--border) !important;
    box-shadow: 0 8px 28px rgba(0,0,0,.22);
}
html[data-theme="dark"] .global-header-home:not(.is-scrolled) {
    background: linear-gradient(to bottom, rgba(0,0,0,.42), transparent) !important;
    color: #fff !important;
    border-bottom-color: rgba(255,255,255,.14) !important;
}
html[data-theme="dark"] .global-mobile-panel {
    background: #1b1918 !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html[data-theme="dark"] .global-mobile-panel a:hover { background: #27221f !important; }
html[data-theme="dark"] .global-cart { border-color: var(--border) !important; }
html[data-theme="dark"] .global-theme-toggle { border-color: var(--border) !important; }
html[data-theme="dark"] .global-theme-toggle:hover { background: #29231f !important; }

/* Common cards and surfaces */
html[data-theme="dark"] .artwork-card,
html[data-theme="dark"] .wish-card,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .checkout-card,
html[data-theme="dark"] .order-card,
html[data-theme="dark"] .detail-card,
html[data-theme="dark"] .search-results,
html[data-theme="dark"] .cart-item {
    background: var(--white) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

html[data-theme="dark"] .artwork-image,
html[data-theme="dark"] .wish-image {
    background: #25211e !important;
}
html[data-theme="dark"] .wish-body { background: var(--white) !important; }
html[data-theme="dark"] .wish-remove { background: rgba(28,25,23,.95) !important; color: var(--accent) !important; }

/* Home / catalog */
html[data-theme="dark"] .section-description,
html[data-theme="dark"] .artwork-meta,
html[data-theme="dark"] .artwork-category,
html[data-theme="dark"] .intro,
html[data-theme="dark"] .artist-name,
html[data-theme="dark"] .purchase-note { color: var(--muted) !important; }
html[data-theme="dark"] .artwork-bottom { border-top-color: var(--border) !important; }
html[data-theme="dark"] .artwork-price span { color: var(--muted) !important; }
html[data-theme="dark"] .dark-section { background: #090808 !important; }
html[data-theme="dark"] .dark-section .artwork-card { background: #171514 !important; border-color: #302c29 !important; }

/* Product detail */
html[data-theme="dark"] .main-image,
html[data-theme="dark"] .product-cart-control .inline-quantity,
html[data-theme="dark"] .artist-card,
html[data-theme="dark"] .related-card,
html[data-theme="dark"] .price-box {
    background: var(--white) !important;
    border-color: var(--border) !important;
}
html[data-theme="dark"] .artist-card { background: #211d1a !important; }
html[data-theme="dark"] .description-content { color: #b8b0a7 !important; }
html[data-theme="dark"] .specs,
html[data-theme="dark"] .spec-row,
html[data-theme="dark"] .description-section { border-color: var(--border) !important; }
html[data-theme="dark"] .product-cart-control .inline-quantity-btn:hover { background: #302725 !important; }
html[data-theme="dark"] .product-wishlist:not(.is-active) { background: transparent !important; }

/* Search / category / artist surfaces */
html[data-theme="dark"] .filter-panel,
html[data-theme="dark"] .sort-panel,
html[data-theme="dark"] .category-card,
html[data-theme="dark"] .artist-card,
html[data-theme="dark"] .collection-card {
    border-color: var(--border) !important;
}
html[data-theme="dark"] .category-card,
html[data-theme="dark"] .artist-card { background: var(--white) !important; }

/* Cart / checkout / orders */
html[data-theme="dark"] .cart-drawer,
html[data-theme="dark"] .cart-drawer-footer,
html[data-theme="dark"] .drawer-item,
html[data-theme="dark"] .cart-summary,
html[data-theme="dark"] .checkout-summary,
html[data-theme="dark"] .payment-card,
html[data-theme="dark"] .order-timeline,
html[data-theme="dark"] .order-items,
html[data-theme="dark"] .order-info {
    background: #1b1918 !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
html[data-theme="dark"] .cart-drawer-backdrop { background: rgba(0,0,0,.72) !important; }
html[data-theme="dark"] .drawer-secondary { color: var(--text) !important; border-color: var(--border) !important; }
html[data-theme="dark"] .drawer-secondary:hover { background: #29231f !important; }

/* Buttons / commerce controls */
html[data-theme="dark"] .card-add-button,
html[data-theme="dark"] .card-inline-quantity {
    background: rgba(29,26,24,.96) !important;
    border-color: #554b44 !important;
    color: var(--text) !important;
}
html[data-theme="dark"] .card-inline-quantity .inline-quantity-value,
html[data-theme="dark"] .card-inline-quantity .inline-quantity-btn { color: var(--text) !important; }
html[data-theme="dark"] .card-inline-quantity .inline-quantity-btn:hover { background: #332b27 !important; color: var(--accent) !important; }
html[data-theme="dark"] .artwork-wishlist { background: rgba(28,25,23,.95) !important; border-color: #4a413b !important; }
html[data-theme="dark"] .artwork-wishlist.is-active { background: var(--wine) !important; color: #fff !important; }

/* Footer */
html[data-theme="dark"] .global-footer { background: #070606 !important; color: #eee !important; }

/* Prevent hardcoded light surfaces from leaking into dark mode */
html[data-theme="dark"] .site-toast,
html[data-theme="dark"] .announcement,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .dropdown-panel {
    background: #211e1b !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* Smooth theme transition */
html[data-theme="dark"] body,
html[data-theme="dark"] .global-header,
html[data-theme="dark"] .artwork-card,
html[data-theme="dark"] .wish-card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .checkout-card,
html[data-theme="dark"] .order-card,
html[data-theme="dark"] .cart-drawer {
    transition: background-color .28s ease, color .28s ease, border-color .28s ease;
}

/* =========================================================
   UX / DARK CONTRAST POLISH
========================================================= */
html[data-theme="dark"] .global-register,
html[data-theme="dark"] .card-add-button,
html[data-theme="dark"] .add-cart,
html[data-theme="dark"] .product-view-cart,
html[data-theme="dark"] .drawer-primary,
html[data-theme="dark"] .cart-checkout-button,
html[data-theme="dark"] .checkout-submit,
html[data-theme="dark"] .primary-button,
html[data-theme="dark"] button[type="submit"] {
    background: #a93a3d !important;
    color: #fff !important;
    border-color: #c95a5c !important;
    text-shadow: none !important;
}
html[data-theme="dark"] .global-register:hover,
html[data-theme="dark"] .card-add-button:hover,
html[data-theme="dark"] .add-cart:hover,
html[data-theme="dark"] .product-view-cart:hover,
html[data-theme="dark"] .drawer-primary:hover,
html[data-theme="dark"] .checkout-submit:hover,
html[data-theme="dark"] .primary-button:hover,
html[data-theme="dark"] button[type="submit"]:hover {
    background: #c54b4e !important;
    color: #fff !important;
}
html[data-theme="dark"] .global-theme-toggle,
html[data-theme="dark"] .drawer-secondary,
html[data-theme="dark"] .inline-quantity,
html[data-theme="dark"] .product-wishlist {
    color: #f4eee7 !important;
    background: #211e1c !important;
    border-color: #5b5048 !important;
}
html[data-theme="dark"] .global-theme-toggle:hover,
html[data-theme="dark"] .drawer-secondary:hover,
html[data-theme="dark"] .product-wishlist:hover {
    color: #fff !important;
    background: #302824 !important;
    border-color: #b66a68 !important;
}
html[data-theme="dark"] .view-artwork,
html[data-theme="dark"] .artwork-price,
html[data-theme="dark"] .product-title,
html[data-theme="dark"] .section-title,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] strong {
    color: #f5f0e9 !important;
}


/* FINAL CONTRAST / THEME POLISH */
html[data-theme="light"] .global-header-home .global-theme-toggle { background:rgba(20,20,20,.58)!important; color:#fff!important; border-color:rgba(255,255,255,.58)!important; }
html[data-theme="light"] .global-header-home .global-theme-toggle:hover { background:rgba(20,20,20,.8)!important; color:#fff!important; }
html[data-theme="dark"] .global-header-home .global-theme-toggle { background:rgba(25,22,20,.86)!important; color:#f7f1e9!important; border-color:#75665a!important; }

/* Artist section dark-mode polish */
html[data-theme="dark"] .artist-section {
    background: #191715 !important;
    color: #f1ede7 !important;
}
html[data-theme="dark"] .artist-content p,
html[data-theme="dark"] .artist-stat span {
    color: #aaa39b !important;
}
html[data-theme="dark"] .artist-stat strong {
    color: #f5f0e9 !important;
}
html[data-theme="dark"] .artist-placeholder {
    background: linear-gradient(145deg, #332d28, #211d1a) !important;
    color: #f1ede7 !important;
}
html[data-theme="dark"] .artist-image {
    background: #25211e !important;
}
html[data-theme="dark"] .artist-tag {
    background: #a93a3d !important;
    color: #fff !important;
}

/* Quick View: keep it completely separate from the commerce controls */
.artwork-card {
    position: relative;
}
    top: 14px !important;
    left: 14px !important;
    bottom: auto !important;
    z-index: 12 !important;
    opacity: 0;
    transform: translateY(-6px);
}
    opacity: 1;
    transform: translateY(0);
}
.artwork-card .artwork-image {
    position: relative;
}
    background: rgba(15,12,10,.92) !important;
    transform: translateY(0) !important;
}
@media (max-width: 700px) {
        top: 10px !important;
        left: 10px !important;
        opacity: 1;
        transform: none;
        padding: 7px 11px;
    }
}


/* V8 contrast and mobile header polish */
html[data-theme="dark"] .specs,
html[data-theme="dark"] .specs .spec-row { color:#f3eee7 !important; }
html[data-theme="dark"] .specs .spec-label { color:#aaa39b !important; }
html[data-theme="dark"] .specs .spec-value { color:#f3eee7 !important; }
html[data-theme="dark"] .artist-card { background:#1b1918 !important; border-color:#3b3530 !important; color:#f3eee7 !important; }
html[data-theme="dark"] .artist-card h3,
html[data-theme="dark"] .artist-card h4,
html[data-theme="dark"] .artist-card strong { color:#f3eee7 !important; }
html[data-theme="dark"] .artist-card p { color:#aaa39b !important; }
html[data-theme="light"] .global-header-home.is-scrolled .global-mobile-menu summary { color:#232323 !important; background:#fff !important; border-color:#d9d3cc !important; }
html[data-theme="dark"] .global-header-home.is-scrolled .global-mobile-menu summary { color:#f3eee7 !important; background:#1b1918 !important; border-color:#4a413b !important; }


/* V9: wishlist controls must stay interactive above the product link overlay */
.js-wishlist-card, .js-wishlist-detail, .js-wishlist-toggle {
    position: relative;
    z-index: 20;
}

/* V17: latest-art section follows the selected theme instead of staying dark in light mode */
html[data-theme="light"] .dark-section {
    background: var(--cream, #F7F5F0) !important;
    color: var(--text, #292929) !important;
}
html[data-theme="light"] .dark-section .section-description,
html[data-theme="light"] .dark-section .artwork-category,
html[data-theme="light"] .dark-section .artwork-meta {
    color: var(--muted, #77736D) !important;
}
html[data-theme="light"] .dark-section .section-kicker,
html[data-theme="light"] .dark-section .section-link,
html[data-theme="light"] .dark-section .view-artwork {
    color: var(--wine, #7F1416) !important;
}
html[data-theme="light"] .dark-section .artwork-card {
    background: var(--white, #fff) !important;
    color: var(--text, #292929) !important;
    border-color: var(--border, #DEDAD2) !important;
}
html[data-theme="light"] .dark-section .artwork-price { color: var(--text, #292929) !important; }
html[data-theme="light"] .dark-section .artwork-bottom { border-color: var(--border, #DEDAD2) !important; }


/* V19: final theme-aware section contrast, loaded after previous theme overrides */
html[data-theme="light"] .dark-section { background: #e9e1d7 !important; color: #282321 !important; border-block: 1px solid #d8cbbd !important; }
html[data-theme="light"] .dark-section .artwork-card { background: #fffdf9 !important; border-color: #d8cbbd !important; }
html[data-theme="dark"] .dark-section { background: #100e0d !important; color: #f3eee8 !important; border-block: 1px solid #292321 !important; }
