/* ============================================
   HEADER.CSS — CM HOME DECOR
   Single source of truth for the floating
   glassmorphism pill header + mobile menu.
   Linked by every page.
   ============================================ */

/* --- Header height token ---
   --header-h  = pill visual height (~56px content + 12px inner pad)
                 + top offset (16px).
   Used by the hero to set its top padding so content
   never hides behind the fixed pill.                              */
:root {
    --header-h: 88px; /* 16px top + ~72px pill (12+40+12 padding+logo) */
}

/* === FLOATING GLASS PILL === */
#spatial-header {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: calc(100% - 48px);
    max-width: 1200px;
    padding: 12px 32px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
                backdrop-filter 0.4s ease,
                background 0.4s ease,
                box-shadow 0.4s ease,
                padding 0.3s ease;
    will-change: transform;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Scrolled (shrunk) state */
#spatial-header.scrolled {
    transform: translateX(-50%) scale(0.98);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    padding: 10px 32px;
}

/* === LOGO === */
.header-logo {
    height: 42px;
    width: auto;
    filter: brightness(0) saturate(100%);
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.header-logo:hover {
    opacity: 1;
    transform: scale(1.03);
}

/* === SEGMENTED NAV (pill style) === */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: 100px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.header-nav a {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: #424245;
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 100px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 1;
}

/* Kill any underline pseudo-elements from other sheets */
.header-nav a::after {
    display: none !important;
}

.header-nav a:hover {
    color: #1D1D1F;
    background: #FFFFFF;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.header-nav a.active {
    color: #fff;
    background: #1D1D1F;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

/* === HAMBURGER BUTTON (hidden on desktop) === */
#spatial-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    color: #424245;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease, transform 0.1s ease;
}

#spatial-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}
#spatial-menu-btn:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.08);
}

/* === MOBILE DROPDOWN MENU (standalone panel below header) === */
#spatial-mobile-menu {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    width: calc(100% - 48px);
    max-width: 1200px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 24px;
    padding: 16px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#spatial-mobile-menu.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

#spatial-mobile-menu a {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #424245;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 12px;
    transition: background 0.2s ease, color 0.2s ease;
    text-align: center;
}

#spatial-mobile-menu a:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #1D1D1F;
}

/* === MOBILE HEADER (< 768px) === */
@media (max-width: 767px) {
    :root {
        --header-h: 76px; /* 12px top + ~64px smaller pill */
    }

    #spatial-header {
        width: calc(100% - 32px);
        padding: 10px 20px;
        top: 12px;
    }

    .header-logo {
        height: auto;
        max-height: 36px;
    }

    /* Nav becomes a dropdown sheet */
    .header-nav {
        display: none;
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 24px;
        padding: 16px;
        flex-direction: column;
        gap: 8px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    .header-nav.active {
        display: flex;
    }

    .header-nav a {
        display: block;
        width: 100%;
        text-align: center;
        padding: 14px 20px;
        border-radius: 12px;
        font-size: 15px;
        background: transparent;
        color: #424245;
        transition: background 0.2s ease, color 0.2s ease;
    }

    .header-nav a:hover,
    .header-nav a.active {
        background: rgba(239, 68, 68, 0.08);
        color: #EF4444;
    }

    #spatial-menu-btn {
        display: flex;
    }
}
