/* ==========================================================================
   CUBINGSG Storefront - Design System (source: STOREFRONT_ARCHITECTURE_SPEC.md)
   Dark (default) <-> Light switchable palette via [data-theme]
   ========================================================================== */

:root,
html[data-theme="dark"] {
    --color-bg: #080C24;
    --color-card: #0D133D;
    --color-card-border: #1E275E;
    --color-accent: #39E75F;
    --color-accent-hover: #4ADE80;
    --color-sg-red: #EE2737;
    --color-text: #FFFFFF;
    --color-text-secondary: #94A3B8;
    --color-pill-bg: #FFFFFF;
    --color-pill-text: #080C24;
    --color-header-bg: #080C24;
    --color-footer-bg: #060917;
    --color-input-bg: #0D133D;
    --color-shadow: rgba(0, 0, 0, 0.45);
    --color-accent-glow: rgba(57, 231, 95, 0.4);
    --color-mega-bg: #060917;
    --color-wm: rgba(255, 255, 255, 0.09);
    --color-wm-hover: rgba(57, 231, 95, 0.16);
    color-scheme: dark;
}

html[data-theme="light"] {
    --color-bg: #F5F7FB;
    --color-card: #FFFFFF;
    --color-card-border: #DDE3EE;
    --color-accent: #17B84E;
    --color-accent-hover: #119a41;
    --color-sg-red: #EE2737;
    --color-text: #0B1024;
    --color-text-secondary: #55607A;
    --color-pill-bg: #0B1024;
    --color-pill-text: #FFFFFF;
    --color-header-bg: #FFFFFF;
    --color-footer-bg: #0B1024;
    --color-input-bg: #FFFFFF;
    --color-shadow: rgba(11, 16, 36, 0.10);
    --color-accent-glow: rgba(23, 184, 78, 0.28);
    --color-mega-bg: #FFFFFF;
    --color-wm: rgba(11, 16, 36, 0.07);
    --color-wm-hover: rgba(23, 184, 78, 0.18);
    color-scheme: light;
}

/* ---------- base ---------- */
body.cubingsg-store,
body.cubingsg-store #wrapper,
body.cubingsg-store .site,
body.cubingsg-store .site-inner,
body.cubingsg-store .content-area,
body.cubingsg-store .entry-content {
    background-color: var(--color-bg);
    color: var(--color-text);
    transition: background-color 0.25s ease, color 0.25s ease;
}

body.cubingsg-store h1, body.cubingsg-store h2, body.cubingsg-store h3,
body.cubingsg-store h4, body.cubingsg-store h5, body.cubingsg-store h6 {
    color: var(--color-text);
    font-weight: 800;
}

body.cubingsg-store p,
body.cubingsg-store li,
body.cubingsg-store td,
body.cubingsg-store th {
    color: var(--color-text-secondary);
}

body.cubingsg-store a {
    color: var(--color-accent);
    transition: color 0.15s ease;
}
body.cubingsg-store a:hover {
    color: var(--color-accent-hover);
}

/* ---------- header / nav ---------- */
body.cubingsg-store .site-header,
body.cubingsg-store .header-wrap,
body.cubingsg-store header#masthead {
    background-color: var(--color-header-bg) !important;
    border-bottom: 1px solid var(--color-card-border);
}

body.cubingsg-store .site-header a,
body.cubingsg-store .main-navigation a {
    color: var(--color-text) !important;
}
body.cubingsg-store .main-navigation a:hover {
    color: var(--color-accent) !important;
}

/* ---------- footer ---------- */
body.cubingsg-store footer#colophon,
body.cubingsg-store .site-footer {
    background-color: var(--color-footer-bg) !important;
    color: var(--color-text-secondary);
}
html[data-theme="light"] body.cubingsg-store footer#colophon *,
html[data-theme="light"] body.cubingsg-store .site-footer * {
    color: #94A3B8 !important;
}

/* ---------- cards (DailyPuzzles tile language) ---------- */
body.cubingsg-store .cubingsg-card,
body.cubingsg-store article.post,
body.cubingsg-store .entry-card,
body.cubingsg-store .woocommerce ul.products li.product {
    background: var(--color-card);
    border: 1px solid var(--color-card-border);
    border-radius: 18px;
    box-shadow: 0 4px 18px var(--color-shadow);
    transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.25s ease;
}
body.cubingsg-store .woocommerce ul.products li.product:hover,
body.cubingsg-store .cubingsg-card:hover {
    transform: scale(1.02);
    border-color: var(--color-accent-glow);
}

/* ---------- buttons / pills ---------- */
body.cubingsg-store .button,
body.cubingsg-store button,
body.cubingsg-store input[type="submit"],
body.cubingsg-store .woocommerce a.button,
body.cubingsg-store .woocommerce button.button,
body.cubingsg-store .woocommerce input.button,
body.cubingsg-store .wc-block-components-button {
    background: var(--color-accent) !important;
    color: var(--color-pill-text) !important;
    border: none !important;
    border-radius: 9999px !important;
    font-weight: 800 !important;
    letter-spacing: 0.02em;
    padding: 12px 26px !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    aspect-ratio: auto !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: background-color 0.15s ease, transform 0.15s ease;
}
html[data-theme="dark"] body.cubingsg-store .woocommerce a.button,
html[data-theme="dark"] body.cubingsg-store .woocommerce button.button,
html[data-theme="dark"] body.cubingsg-store .woocommerce input.button {
    color: #080C24 !important;
}
body.cubingsg-store .button:hover,
body.cubingsg-store button:hover,
body.cubingsg-store .woocommerce a.button:hover,
body.cubingsg-store .woocommerce button.button:hover {
    background: var(--color-accent-hover) !important;
    transform: translateY(-1px);
}

/* secondary pill */
body.cubingsg-store .cubingsg-pill {
    display: inline-block;
    background: var(--color-pill-bg);
    color: var(--color-pill-text);
    border-radius: 9999px;
    padding: 6px 16px;
    font: 800 13px/1 sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ---------- forms ---------- */
body.cubingsg-store input[type="text"],
body.cubingsg-store input[type="email"],
body.cubingsg-store input[type="password"],
body.cubingsg-store input[type="search"],
body.cubingsg-store textarea,
body.cubingsg-store select {
    background: var(--color-input-bg);
    color: var(--color-text);
    border: 1px solid var(--color-card-border);
    border-radius: 12px;
}
body.cubingsg-store ::placeholder {
    color: var(--color-text-secondary);
    opacity: 0.8;
}

/* ---------- WooCommerce surfaces ---------- */
body.cubingsg-store .woocommerce-tabs ul.tabs li.active a,
body.cubingsg-store .woocommerce table.shop_table,
body.cubingsg-store .woocommerce .cart_totals,
body.cubingsg-store .woocommerce-checkout #payment,
body.cubingsg-store .woocommerce-MyAccount-navigation ul li.is-active a {
    background: var(--color-card) !important;
    color: var(--color-text) !important;
    border-color: var(--color-card-border) !important;
    border-radius: 18px;
}
body.cubingsg-store .woocommerce .price,
body.cubingsg-store .woocommerce-Price-amount {
    color: var(--color-accent) !important;
    font-weight: 800;
}
body.cubingsg-store .star-rating span,
body.cubingsg-store .woocommerce .star-rating span {
    color: var(--color-accent);
}

/* ---------- theme toggle button (floating, bottom-right) ---------- */
#cubingsg-theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    padding: 0 !important;
    border-radius: 9999px !important;
    border: 1px solid var(--color-card-border) !important;
    background: var(--color-card) !important;
    color: var(--color-text) !important;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--color-shadow) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background-color 0.25s ease;
}
#cubingsg-theme-toggle svg {
    width: 22px;
    height: 22px;
    display: block;
}
#cubingsg-theme-toggle:hover {
    transform: scale(1.08);
    border-color: var(--color-accent-glow) !important;
    background: var(--color-card) !important;
}
@media (max-width: 767px) {
    #cubingsg-theme-toggle {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        right: 16px;
    }
}

/* ---------- header cart button ---------- */
body.cubingsg-store .csg-cart-item {
    list-style: none;
    display: flex;
    align-items: center;
}
body.cubingsg-store .csg-cart-button {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 9999px;
    background: var(--color-accent);
    color: #ffffff !important;
    font-weight: 700;
    text-decoration: none !important;
    box-shadow: 0 4px 14px var(--color-shadow);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
body.cubingsg-store .csg-cart-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px var(--color-shadow);
}
body.cubingsg-store .csg-cart-button svg {
    width: 20px;
    height: 20px;
    display: block;
    flex: none;
}
body.cubingsg-store .csg-cart-label {
    line-height: 1;
}
body.cubingsg-store .csg-cart-count {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.22);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
body.cubingsg-store .csg-cart-count.is-empty {
    opacity: 0.65;
}

/* ---------- product trust line ---------- */
body.cubingsg-store .csg-trust-line {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 16px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--color-card-border);
    font-size: 13px;
    color: var(--color-text);
    opacity: 0.9;
}
body.cubingsg-store .csg-trust-line li {
    margin: 0;
}
body.cubingsg-store .csg-trust-line a {
    color: inherit;
    text-decoration: underline;
}

/* ---------- footer legal links ---------- */
body.cubingsg-store .csg-legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    justify-content: center;
    font-size: 13px;
    padding: 6px 0;
}
body.cubingsg-store .csg-legal-links a {
    color: inherit;
    text-decoration: underline;
    opacity: 0.85;
}
body.cubingsg-store .csg-legal-links a:hover {
    opacity: 1;
}

/* header icon buttons (e.g. Kadence search toggle): keep clean, not pill */
body.cubingsg-store .site-header button,
body.cubingsg-store .site-header .search-drawer-open,
body.cubingsg-store .header-wrap button {
    background: transparent !important;
    color: var(--color-text) !important;
    padding: 6px 10px !important;
    box-shadow: none !important;
    transform: none !important;
    font-weight: 600 !important;
}

/* search form submit: sane pill that fits its label */
body.cubingsg-store .wp-block-search__button,
body.cubingsg-store form.search-form input[type="submit"],
body.cubingsg-store input[type="submit"][value="Search"] {
    width: auto !important;
    min-width: 110px !important;
    padding: 12px 26px !important;
    overflow: visible !important;
}

/* ---------- utility ---------- */
.cubingsg-glow {
    box-shadow: 0 0 22px var(--color-accent-glow);
}
.cubingsg-badge-new  { background: var(--color-accent); color: var(--color-pill-text); }
.cubingsg-badge-sale { background: var(--color-sg-red); color: #FFFFFF; }
.cubingsg-badge-new, .cubingsg-badge-sale {
    border-radius: 9999px;
    padding: 4px 12px;
    font: 800 11px/1 sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ==========================================================================
   Mega menu (DailyPuzzles-style: 9 event tiles + 4 feature cards)
   Desktop: fixed full-width panel under the header (positioned via JS)
   Mobile (<1024px): inline expansion inside the nav drawer
   ========================================================================== */
.mega {
    position: fixed;
    background: var(--color-mega-bg);
    border-top: 1px solid var(--color-card-border);
    box-shadow: 0 18px 40px var(--color-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 9998;
}
.mega.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega__inner { padding: 26px 0 30px; }
.mega__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
    flex-wrap: wrap;
}
.mega__title {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-accent);
}
.mega__hint { font-size: 12px; color: var(--color-text-secondary); }

.mega__layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 18px;
}

/* 3x3 event tile grid */
.tiles {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}
.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 20px 12px 16px;
    min-height: 148px;
    background: var(--color-card);
    border: 1px solid var(--color-card-border);
    border-radius: 18px;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.tile::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;
    background: radial-gradient(120% 80% at 50% 0%, var(--color-accent-glow), transparent 62%);
    transition: opacity 0.22s;
    pointer-events: none;
}
.tile:hover {
    transform: translateY(-3px);
    border-color: var(--color-accent-glow);
    box-shadow: 0 0 22px var(--color-accent-glow);
}
.tile:hover::after { opacity: 1; }

.tile__icon {
    width: 62px;
    height: 62px;
    color: var(--color-accent);
    display: grid;
    place-items: center;
    position: relative;
    z-index: 1;
}
.tile__icon svg { width: 100%; height: 100%; }
.tile__icon .cubing-icon { font-size: 54px; line-height: 1; }

/* No underlines in the mega panel: browser-default link underline paints beneath
   font-icon glyphs (SVG icons were atomic inlines and immune). Scoped to .mega. */
.mega .tile, .mega .feat, .mega .tile *, .mega .feat *,
.mega .tile *:before, .mega .feat *:before {
    text-decoration: none !important;
}

.tile__pill {
    position: relative;
    z-index: 1;
    background: var(--color-pill-bg);
    color: var(--color-pill-text);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 7px 20px;
    border-radius: 9999px;
    max-width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.18s, color 0.18s;
}
.tile:hover .tile__pill { background: var(--color-accent); color: #080C24; }

/* 2x2 feature cards */
.feats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.feat {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 18px;
    min-height: 178px;
    overflow: hidden;
    background: var(--color-card);
    border: 1px solid var(--color-card-border);
    border-radius: 18px;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.feat:hover {
    transform: translateY(-3px);
    border-color: var(--color-accent-glow);
    box-shadow: 0 0 22px var(--color-accent-glow);
}

.feat__wm {
    position: absolute;
    right: -34px;
    bottom: -34px;
    width: 168px;
    height: 168px;
    color: var(--color-wm);
    pointer-events: none;
    transition: transform 0.35s ease, color 0.35s ease;
}
.feat:hover .feat__wm {
    transform: rotate(-6deg) scale(1.06);
    color: var(--color-wm-hover);
}

.feat__label {
    font-size: 12.5px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-accent);
    position: relative;
    z-index: 1;
}
.feat__art {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 8px 0;
    position: relative;
    z-index: 1;
}
.feat__art svg { height: 62px; width: auto; color: var(--color-text); }
.feat__go {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: 0.01em;
    color: var(--color-accent);
    position: relative;
    z-index: 1;
    transition: transform 0.18s;
}
.feat:hover .feat__go { transform: translateX(5px); }

/* trigger caret */
li.has-mega > a::after {
    content: "";
    display: inline-block;
    margin-left: 7px;
    border: 4px solid transparent;
    border-top-color: currentColor;
    transform: translateY(2px);
}

/* mobile: inline expansion in the nav drawer */
@media (max-width: 1023px) {
    .mega {
        position: static !important;
        width: auto !important;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border-top: none;
        border-bottom: 1px solid var(--color-card-border);
    }
    .mega.is-open { display: block; }
    .mega__inner { padding: 12px 0 18px; }
    .mega__layout { grid-template-columns: 1fr; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tile { min-height: 110px; padding: 14px 8px 12px; }
    .tile__icon { width: 44px; height: 44px; }
    .feat { min-height: 130px; }
}

/* ==========================================================================
   Template + block coverage (fixes theme-boundary contrast, 2026-11-15)
   ========================================================================== */

/* content containers follow the palette (kills the white frame in dark mode) */
body.cubingsg-store #inner-wrap,
body.cubingsg-store .site-main,
body.cubingsg-store .content-area,
body.cubingsg-store .entry-content,
body.cubingsg-store article.page,
body.cubingsg-store article.post {
    background-color: transparent;
}

/* page-title bar follows the palette */
body.cubingsg-store .entry-header,
body.cubingsg-store .page-header,
body.cubingsg-store .entry-title-wrap {
    background-color: var(--color-bg) !important;
    border-bottom: 1px solid var(--color-card-border);
}
body.cubingsg-store .entry-header h1,
body.cubingsg-store .entry-title,
body.cubingsg-store .page-title {
    color: var(--color-text) !important;
}

/* front page: hero carries the heading - hide the redundant title bar */
body.cubingsg-store.home .entry-header,
body.cubingsg-store.page-id-11 .entry-header {
    display: none;
}

/* cover block: text stays light over dark hero art in BOTH themes */
body.cubingsg-store .wp-block-cover .wp-block-cover__inner-container h1,
body.cubingsg-store .wp-block-cover .wp-block-cover__inner-container h2,
body.cubingsg-store .wp-block-cover .wp-block-cover__inner-container h3,
body.cubingsg-store .wp-block-cover .wp-block-cover__inner-container p,
body.cubingsg-store .wp-block-cover .wp-block-cover-text {
    color: #FFFFFF !important;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
}

/* block buttons: brand pill, not Kadence blue */
body.cubingsg-store .wp-block-button__link,
body.cubingsg-store .wp-element-button {
    background: var(--color-accent) !important;
    color: #080C24 !important;
    border: none !important;
    border-radius: 9999px !important;
    font-weight: 800 !important;
    padding: 12px 26px !important;
    box-shadow: none !important;
    transition: background-color 0.15s ease, transform 0.15s ease;
}
body.cubingsg-store .wp-block-button__link:hover,
body.cubingsg-store .wp-element-button:hover {
    background: var(--color-accent-hover) !important;
    color: #080C24 !important;
    transform: translateY(-1px);
}