/*
 * main.css — American Standard Products Classic Theme
 * Core styles: design tokens, layout helpers, component base styles.
 * Tailwind CDN handles utility classes; this file handles everything else.
 */

/* ── Design tokens ────────────────────────────────────────────────── */
:root {
    --color-surface:            #0a0a0a;
    --color-surface-container:  #191919;
    --color-on-surface:         #ffffff;
    --color-on-surface-variant: #ababab;
    --color-primary:            #fdd355;
    --color-primary-container:  #f2c94c;
    --color-on-primary:         #1a1200;
    --color-on-primary-container: #1a1200;
    --color-outline:            rgba(255,255,255,0.08);
    --font-headline:            'Plus Jakarta Sans', sans-serif;
    --font-body:                'Plus Jakarta Sans', sans-serif;
    --transition-fast:          150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base:          300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth:        500ms cubic-bezier(0.25, 1, 0.5, 1);
}

/* ── Base reset & body ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--color-surface);
    color: var(--color-on-surface);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

main {
    align-self: stretch;
    width: 100%;
}

img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; transition: color var(--transition-fast); }

/* Selection highlight */
::selection { background-color: var(--color-primary-container); color: var(--color-on-primary); }

/* ── Header ── */
#asp-header {
    transition: all var(--transition-base);
}
#asp-header.scrolled > div {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(242, 201, 76, 0.15);
}

/* ── Typography Utilities ── */
.font-manrope { font-family: 'Manrope', sans-serif !important; }
.font-headline { font-family: 'Plus Jakarta Sans', sans-serif !important; }

/* ── Material Utility Fallbacks ── */
.bg-primary-container { background-color: var(--color-primary-container) !important; }
.text-primary-container { color: var(--color-primary-container) !important; }
.bg-on-primary-container { background-color: var(--color-on-primary-container) !important; }
.text-on-primary-container { color: var(--color-on-primary-container) !important; }
.text-on-primary { color: var(--color-on-primary) !important; }

/* ── Mega Menu Positioning ── */
.group {
    position: relative !important;
}

.mega-menu {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    visibility: hidden;
    position: absolute;
    left: 0;
    top: 100%;
}

.mega-menu.open {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

.nav-item {
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.nav-item:hover {
    transform: scale(1.05);
}

/* ── GLOBAL BUTTON STYLES (MATCH PROTOTYPE) ── */
.wp-block-button__link,
.btn-premium,
.card-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background-color: var(--color-primary-container);
    color: var(--color-on-primary) !important;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: 0.625rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 15px rgba(242, 201, 76, 0.1);
    text-transform: none;
    cursor: pointer;
    border: none;
}
.wp-block-button__link:hover,
.btn-premium:hover,
.card-cta:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 0 25px rgba(242, 201, 76, 0.25);
    background-color: var(--color-primary);
}
.wp-block-button__link:active,
.btn-premium:active { transform: scale(0.95); }

/* Secondary button style */
.btn-outline {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff !important;
}
.btn-outline:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
    color: #f2c94c !important;
}

/* ── PRODUCT GRID & CARD REFINEMENTS ── */
#products-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 2rem !important;
    width: 100% !important;
    min-height: 600px;
    transition: opacity 0.4s ease;
}

@media (max-width: 1024px) {
    #products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 640px) {
    #products-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Neutralize WooCommerce <li> wrapper so .product-scene is the direct grid child */
#products-grid li.product {
    display: contents;
}

.product-scene {
    width: 100%;
    display: block;
    position: relative;
    perspective: 1200px;
    min-width: 0;
}

.product-card {
    position: relative;
    width: 100%;
    height: 460px;          /* Fixed height — safe, predictable, matches prototype */
    min-width: 0;
    border-radius: 1.5rem;
    overflow: hidden;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 1s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.4s ease;
    isolation: isolate;
    display: block;
    will-change: transform;
}
.product-card .card-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.18) 50%, transparent 100%);
    opacity: 0.8;
    transition: opacity 0.5s ease;
    z-index: 1;
}
.product-card .card-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2rem;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}
.product-card .card-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(1.25rem, 2vw, 1.45rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #f2c94c;
    transition: transform 0.5s ease;
}
.product-card .card-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 9999px;
    background: #f2c94c;
    color: #1a1200;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}
.product-card.lifted {
    transform: translateY(-20px) scale(1.02);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(242, 201, 76, 0.12);
    border-color: rgba(255, 255, 255, 0.1);
    z-index: 30;
}
.product-card.lifted .card-cta {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Page blur when lifted */
.page-blurred .product-scene:not(.is-lifted) .product-card {
    filter: blur(2.5px);
    opacity: 0.45;
    transition: filter 0.4s ease, opacity 0.4s ease;
}
.page-blurred .product-scene.is-lifted .product-card {
    filter: none;
    opacity: 1;
}

/* Product image must fill the card absolutely so it doesn't
   participate in flex sizing — preventing height/width jitter on load */
.product-card > img,
.product-card > .asp-img-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.cat-tag {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    z-index: 3;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(208, 197, 175, 0.4);
}

/* ── BENTO GRID INTERACTION ── */
.bento-card {
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}
.bento-card:hover {
    transform: translateY(-0.5rem);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

/* ── NO SCROLLBAR ── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ── GRADIENTS ─────────────────────────────────────────────────────── */
#products-grid {
    display: grid !important;
    width: 100% !important;
    min-height: 600px;
    transition: opacity 0.4s ease;
}

.bento-gradient-yellow {
    background: linear-gradient(135deg, #fdd355 0%, #c19c20 100%);
}
/* ── PRODUCT FILTER PILL ────────────────────────────────────────── */
#filter-bar {
    position: fixed;
    top: 108px;
    left: 32px;
    z-index: 40;
}

.filter-inner {
    display: flex;
    align-items: center;
    border-radius: 9999px;
    background: rgba(18, 18, 16, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    white-space: nowrap;
    padding: 9px 20px;
    gap: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    max-width: 90vw; /* Prevent overflow on very small screens */
}

/* Expanded state: Enable horizontal scroll */
#filter-bar.expanded .filter-inner {
    padding: 6px 12px;
    gap: 6px;
    cursor: default;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}
#filter-bar.expanded .filter-inner::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.filter-pill-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(208, 197, 175, 0.7);
    user-select: none;
}
.filter-pill-label .active-label { color: #f2c94c; }

/* Filter Buttons (Hidden by default) */
.filter-btn {
    display: none;
    align-items: center;
    padding: 8px 18px;
    border-radius: 9999px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(208, 197, 175, 0.65);
    background: transparent;
    border: none;
}
#filter-bar.expanded .filter-btn { display: flex; }
#filter-bar.expanded .filter-pill-label { display: none; }

.filter-btn:hover { color: #fdd355; background: rgba(255,255,255,0.05); }
.filter-btn.active {
    background: #f2c94c;
    color: #1a1200;
    font-weight: 700;
}

/* Page content shift to avoid filter overlap on desktop */
@media (min-width: 1280px) {
    #products-grid { padding-left: 100px; }
}

.hero-gradient {
    background: radial-gradient(circle at 55% 45%, rgba(242,201,76,0.07) 0%, transparent 65%);
}

/* ── PAGE CONTENT REFINEMENTS ── */
.article-body {
    max-width: 800px;
    margin-inline: auto;
}
.article-body p {
    margin-bottom: 2rem;
    color: var(--color-on-surface-variant);
    font-size: 1.125rem;
    line-height: 1.8;
}

/* Transition for mobile menu backdrop */
#drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: all 0.4s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 199;
}
#drawer-backdrop.open {
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ── Mobile Drawer Links ── */
.mob-link span {
    color: #f2c94c !important;
    font-family: 'Manrope', sans-serif !important;
}
.mob-link svg path {
    stroke: #f2c94c !important;
}

/* ── MOBILE DRAWER ── */
#mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(85vw, 360px);
    background: #0e0e0e;
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#mobile-drawer.open {
    transform: translateX(0);
}

#mobile-drawer.open .mob-link {
    animation: slideInRight 0.3s ease forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ham-line {
    display: block;
    width: 22px;
    height: 1.5px;
    background: #e5e2e1;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

#ham-btn.active .ham-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

#ham-btn.active .ham-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

#ham-btn.active .ham-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ── MEGA MENU INTERACTION ── */
.group:hover .mega-menu {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

/* Desktop Slideshow */
.slideshow {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
}
.slideshow-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
}
.slideshow-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    position: relative;
    cursor: pointer;
}
.slideshow-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.slideshow-slide .slide-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 14px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
}
.slideshow-slide .slide-label h4 {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: #f2c94c;
    margin: 0 0 3px;
}
.slideshow-slide .slide-label p {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}
.slide-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 28px;
    height: 28px;
    background: rgba(20, 20, 20, 0.7);
    border: 1px solid rgba(242, 201, 76, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f2c94c;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}
.slide-arrow:hover {
    background: rgba(242, 201, 76, 0.15);
    border-color: rgba(242, 201, 76, 0.5);
}
.slide-arrow.prev { left: 8px; }
.slide-arrow.next { right: 8px; }

.slide-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 10;
}
.slide-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(242, 201, 76, 0.3);
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}
.slide-dot.active {
    background: #f2c94c;
    transform: scale(1.3);
}

/* Insight Card Specific */
#mega-insight-card {
    transition: all 0.3s ease;
}
#mega-insight-card:hover {
    background-color: #1a1200;
}
#mega-insight-card img {
    height: 110px !important;
    border-bottom: 1px solid rgba(242, 201, 76, 0.1);
}

/* Mobile Slideshow */
.mob-slideshow {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
}
.mob-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.mob-slide {
    flex-shrink: 0;
    width: 100%;
    position: relative;
    cursor: pointer;
}
.mob-slide .mob-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 12px 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
}
.mob-label h4 {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    color: #f2c94c;
    margin: 0 0 2px;
}
.mob-label p {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}
.mob-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 26px;
    height: 26px;
    background: rgba(20, 20, 20, 0.75);
    border: 1px solid rgba(242, 201, 76, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f2c94c;
}
.mob-dots {
    position: absolute;
    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 10;
}
.mob-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(242, 201, 76, 0.3);
}
.mob-dot.active {
    background: #f2c94c;
    transform: scale(1.35);
}
