/* =========================================================================
   LAVACASCADE — css/components/header.css
   Sticky header: wordmark, main nav, cart, log in, deploy. Below 900px the
   nav collapses into a panel opened by .nav-toggle (js/components/nav.js).
   A thin molten seam runs under the bar, like the panel theme's.
   ========================================================================= */

/* =========================================
   BAR
   ========================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: rgba(11, 7, 19, 0.78);
    -webkit-backdrop-filter: saturate(150%) blur(16px);
    backdrop-filter: saturate(150%) blur(16px);
    border-bottom: 1px solid var(--line);
}

/* the molten seam, brighter once the page scrolls */
.site-header::after {
    content: "";
    position: absolute;
    inset: auto 0 -1px 0;
    height: 1px;
    background: var(--grad-seam);
    opacity: 0.35;
    transition: opacity var(--dur) var(--ease);
}

.site-header.is-scrolled::after {
    opacity: 0.8;
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    height: var(--header-h);
}

/* =========================================
   WORDMARK: "Lava" + molten "Cascade"
   ========================================= */
.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    flex: none;
    text-decoration: none;
}

.brand img {
    width: 32px;
    height: 32px;
}

.brand__name {
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.035em;
    color: var(--text-strong);
}

.brand__accent {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* =========================================
   NAV LINKS
   ========================================= */
.site-nav {
    flex: 1;
}

.site-nav__list {
    display: flex;
    justify-content: center;
    gap: var(--space-1);
    padding: 0;
    list-style: none;
}

.site-nav__link {
    position: relative;
    display: block;
    padding: 0.5rem 0.8rem;
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-soft);
    text-decoration: none;
    border-radius: var(--radius-sm);
}

.site-nav__link:hover {
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.04);
}

/* current page: lava text + a short molten underline */
.site-nav__link[aria-current="page"] {
    color: var(--lava-300);
}

.site-nav__link[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    bottom: 2px;
    height: 2px;
    background: var(--grad-molten);
    border-radius: 2px;
}

/* the mobile-only actions inside the collapsed menu */
.site-nav__mobile {
    display: none;
}

/* =========================================
   RIGHT-SIDE ACTIONS
   ========================================= */
.site-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: none;
}

.cart-link {
    position: relative;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: var(--text-soft);
    border-radius: var(--radius);
    transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}

.cart-link:hover {
    color: var(--text-strong);
    background: rgba(255, 255, 255, 0.05);
}

.cart-link svg {
    width: 21px;
    height: 21px;
}

/* little count badge on the cart */
.cart-count {
    position: absolute;
    top: 3px;
    right: 1px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    color: #FFFFFF;
    background: var(--lava-600);
    border-radius: 6px;
}

/* =========================================
   HAMBURGER
   ========================================= */
.nav-toggle {
    display: none;
    width: 44px;
    height: 44px;
    padding: 12px 11px;
    border-radius: var(--radius);
}

.nav-toggle span {
    display: block;
    height: 2px;
    margin: 4px 0;
    background: var(--text-strong);
    border-radius: 2px;
    transition: transform var(--dur) var(--ease), opacity var(--dur-fast) var(--ease);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* =========================================
   RESPONSIVE: collapse below 900px
   ========================================= */
@media (max-width: 900px) {
    .nav-toggle {
        display: block;
    }

    /* desktop log-in / deploy move into the panel */
    .site-header__actions .btn {
        display: none;
    }

    .site-header__inner {
        justify-content: space-between;
    }

    .site-nav {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        z-index: var(--z-menu);
        max-height: calc(100dvh - var(--header-h));
        overflow-y: auto;
        padding: var(--space-3) var(--gutter) var(--space-6);
        background: var(--night-900);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow-lift);
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur);
    }

    .site-nav.is-open {
        visibility: visible;
        opacity: 1;
        transform: none;
        transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
    }

    .site-nav__list {
        flex-direction: column;
        gap: 0;
    }

    .site-nav__link {
        padding: 0.95rem 0.25rem;
        font-size: var(--fs-body);
        border-bottom: 1px solid var(--line);
        border-radius: 0;
    }

    .site-nav__link[aria-current="page"]::after {
        display: none;
    }

    .site-nav__mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-3);
        margin-top: var(--space-5);
    }
}

@media (max-width: 380px) {
    .brand__name { font-size: 1rem; }
    .site-nav__mobile { grid-template-columns: 1fr; }
}

/* =========================================
   LANGUAGE SWITCH (includes/partials/lang-switch.php)
   ========================================= */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--night-800);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.lang-switch__link {
    min-width: 34px;
    padding: 4px 9px;
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    color: var(--text-soft);
    text-decoration: none;
    border-radius: 999px;
}

.lang-switch__link:hover {
    color: var(--text-strong);
}

.lang-switch__link[aria-current="true"] {
    color: var(--night-950);
    background: var(--grad-molten);
}

/* the header one hides with the other buttons on small screens; the
   menu panel and footer ones take over there */
.lang-switch--menu { grid-column: 1 / -1; justify-self: start; }

@media (max-width: 900px) {
    .lang-switch--header { display: none; }
}

@media (min-width: 901px) {
    .lang-switch--menu { display: none; }
}
