/* ============================================
   Header Component CSS
   Source of truth: index.html
============================================ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    transition: box-shadow 0.3s ease;
}

.site-header.scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

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

.logo img {
    height: 70px;
    width: auto;
    display: block;
}

.header-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 24px;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-mid);
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--color-blue);
    background: var(--color-bg-light);
}

/* Dropdown */
.nav-links .has-dropdown {
    position: relative;
}

.nav-links .has-dropdown > a::after {
    content: '';
    display: inline-block;
    margin-left: 5px;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    vertical-align: middle;
}

.nav-links .dropdown.mega {
    display: none;
    position: fixed;
    top: 73px; /* header 72px + border 1px */
    left: 0;
    right: 0;
    z-index: 999;
    list-style: none;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
    pointer-events: none;
}

.nav-links .dropdown.mega.is-open {
    display: block;
}

.nav-links .dropdown.mega .mega-inner {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: stretch;
    padding: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-top: none;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
}

.nav-links .dropdown.mega .mega-card {
    padding: 28px 32px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    height: 100%;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    background: none;
    color: inherit;
    white-space: normal;
    box-sizing: border-box;
    transition: background 0.2s;
}

.nav-links .dropdown.mega .mega-card:nth-child(2n) {
    border-right: none;
}

.nav-links .dropdown.mega .mega-card:nth-last-child(-n+2) {
    border-bottom: none;
}

.nav-links .dropdown.mega .mega-card:hover {
    background: var(--color-bg-light);
    color: inherit;
}

.nav-links .dropdown.mega .mega-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-dark);
    line-height: 1.4;
}

.nav-links .dropdown.mega .mega-card-desc {
    font-size: 12px;
    color: var(--color-text-mid);
    line-height: 1.8;
    flex: 1;
}

.nav-links .dropdown.mega .mega-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 4px;
}

.nav-links .dropdown.mega .mega-card-link {
    font-size: 13px;
    font-weight: 400;
    color: var(--color-text-dark);
}

.nav-links .dropdown.mega .mega-card-btn {
    width: 34px;
    height: 34px;
    background: var(--color-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 15px;
    flex-shrink: 0;
}

.header-cta .btn {
    padding: 9px 28px;
    font-size: 13px;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    border: none;
    background: none;
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-navy);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

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

.hamburger.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 73px;
    left: 0;
    right: 0;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-border);
    padding: 8px 0 24px;
    z-index: 999;
    box-shadow: var(--shadow-lg);
}

.mobile-menu.is-open {
    display: block;
}

.mobile-nav-item {
    border-bottom: 1px solid var(--color-border);
}

.mobile-nav-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

.mobile-nav-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-mid);
}

.mobile-nav-icon {
    font-size: 18px;
    color: var(--color-text-mid);
    flex-shrink: 0;
    margin-left: 12px;
    line-height: 1;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    text-decoration: none;
}

.mobile-nav-sub {
    background: var(--color-bg-light);
}

.mobile-nav-sub[hidden] {
    display: none;
}

.mobile-nav-sub-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px 12px 36px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-mid);
    text-decoration: none;
    border-top: 1px solid var(--color-border);
}

.mobile-nav-cta {
    padding: 20px 24px 0;
}

.mobile-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: var(--color-blue);
    color: var(--color-white);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius);
}

/* Utility */
.nowrap { white-space: nowrap; }

/* Responsive */
@media (max-width: 768px) {
    .nowrap { white-space: normal; }
    .nav-links,
    .header-cta {
        display: none;
    }

    .logo img {
        height: 54px;
    }

    .logo {
        margin-left: 8px;
    }

    .hamburger {
        display: flex;
        margin-right: 8px;
    }
}
