/* ==========================================
   HEADER
========================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);

    height: var(--header-height);

    display: flex;
    align-items: center;

    border-bottom: 1px solid rgba(255, 255, 255, .06);

    transition: height var(--transition), box-shadow var(--transition);
}

/* Blur/background live on a pseudo-element so .header itself never
   establishes a new containing block (backdrop-filter would otherwise
   break position:fixed on nested elements like the mobile nav drawer).
   Positive z-index stacking is used throughout (instead of a negative
   z-index on this pseudo-element) to avoid known Safari/WebKit paint
   bugs where negative z-index on a fixed ancestor's pseudo-element can
   mis-render or hide sibling content. */
.header::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;

    background: rgba(9, 9, 9, .72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    transition: background var(--transition);
    pointer-events: none;
}

.header.scrolled::before {
    background: rgba(7, 7, 7, .92);
}

.header .container {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

/* ==========================================
   LOGO
========================================== */

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 20;
}

.logo img {
    display: block;
    height: 66px;
    width: auto;
    transition: height var(--transition);
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .45));
}

.header.scrolled .logo img {
    height: 52px;
}

/* ==========================================
   NAVIGATION
========================================== */

.navigation {
    flex: 1;
    display: flex;
    justify-content: center;
}

.navigation ul {
    display: flex;
    align-items: center;
    gap: 36px;
    list-style: none;
}

.navigation li {
    flex-shrink: 0;
}

.navigation a {
    display: inline-block;
    position: relative;
    padding: 8px 0;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .01em;
    white-space: nowrap;
    transition: color var(--transition-fast);
}

.navigation a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width var(--transition-fast);
}

.navigation a:hover {
    color: var(--color-primary);
}

.navigation a:hover::after,
.navigation a.active::after {
    width: 100%;
}

.navigation a.active {
    color: var(--color-primary);
}

/* ==========================================
   HEADER CTA
========================================== */

.header-cta {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 26px;
    border-radius: var(--radius-round);
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary-dark) 100%);
    color: #111;
    font-weight: 700;
    font-size: .875rem;
    white-space: nowrap;
    box-shadow: 0 12px 32px rgba(201, 155, 58, .28);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.header-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 44px rgba(201, 155, 58, .4);
    filter: brightness(1.05);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-arrow {
    display: inline-flex;
    transition: transform var(--transition-fast);
}

.btn-primary:hover .btn-arrow {
    transform: translateX(4px);
}

/* ==========================================
   HAMBURGER (animated 3-line -> X)
========================================== */

.hamburger {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-round);
    cursor: pointer;
    z-index: 1100;
}

.hamburger span {
    position: absolute;
    left: 12px;
    width: 20px;
    height: 2px;
    background: var(--color-white);
    border-radius: 2px;
    transition: transform var(--transition-fast), opacity var(--transition-fast), top var(--transition-fast);
}

.hamburger span:nth-child(1) { top: 15px; }
.hamburger span:nth-child(2) { top: 21px; }
.hamburger span:nth-child(3) { top: 27px; }

.mobile-open .hamburger span:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}

.mobile-open .hamburger span:nth-child(2) {
    opacity: 0;
}

.mobile-open .hamburger span:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}

/* ==========================================
   SCROLL STATE
========================================== */

.header.scrolled {
    height: var(--header-height-scrolled);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

/* ==========================================
   RESPONSIVE
========================================== */

@media (max-width: 1400px) {

    .navigation {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;

        flex-direction: column;
        justify-content: flex-start;

        background: rgba(9, 9, 9, .98);
        backdrop-filter: blur(20px);

        opacity: 0;
        visibility: hidden;
        transform: translateY(-12px);
        transition: opacity var(--transition), transform var(--transition), visibility var(--transition);

        z-index: var(--z-mobile-nav);
        overflow-y: auto;
        overflow-x: hidden;
    }

    .navigation ul {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 12px 0;
        width: 100%;
    }

    .navigation li {
        border-bottom: 1px solid var(--color-border);
    }

    .navigation li:first-child {
        border-top: 1px solid var(--color-border);
    }

    .navigation a {
        display: block;
        width: 100%;
        padding: 20px var(--container-padding);
        font-size: 1.05rem;
    }

    .navigation a::after {
        display: none;
    }

    .mobile-open .navigation {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .header.scrolled .navigation {
        top: var(--header-height-scrolled);
    }

    .header-cta {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .mobile-open {
        overflow: hidden;
    }
}

@media (max-width: 768px) {

    :root {
        --header-height: var(--header-height-mobile);
    }

    .header.scrolled {
        height: var(--header-height-mobile);
    }

    .logo img {
        height: 46px;
    }

    .header.scrolled .logo img {
        height: 40px;
    }
}