/* Canonical site header — single source of truth.
   Loaded last in <head> so it overrides per-page inline header styles. */

header {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(250, 250, 250, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-100);
    z-index: 1000;
    transition: all 0.3s ease;
}

header.scrolled {
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

/* Fixed width, not var(--max-width): narrow pages (contact, privacy) set it to 880px */
header nav {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .logo {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--black);
    text-decoration: none;
    border-bottom: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    letter-spacing: -0.02em;
}

header .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--black) 0%, var(--gray-700) 100%);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    border-radius: 8px;
    font-family: var(--font-mono);
}

header .nav-links {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

header .nav-links a {
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    position: relative;
}

header .nav-links a:hover {
    color: var(--black);
}

header .nav-links a.nav-cta {
    background: var(--black);
    color: var(--white);
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

header .nav-links a.nav-cta:hover {
    background: var(--gray-700);
    transform: translateY(-1px);
}

/* Dropdowns */
header .nav-dropdown {
    position: relative;
}

header .nav-dropdown-toggle {
    color: var(--gray-500);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: color 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

header .nav-dropdown-toggle:hover {
    color: var(--black);
}

header .nav-dropdown-toggle::after {
    content: '▾';
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

header .nav-dropdown:hover .nav-dropdown-toggle::after {
    transform: rotate(180deg);
}

header .nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1001;
}

header .nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    margin-top: 0;
}

header .nav-dropdown-menu a {
    display: block;
    padding: 0.75rem 1.25rem;
    color: var(--gray-600);
    text-decoration: none;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

header .nav-dropdown-menu a:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

header .nav-dropdown-menu a:last-child {
    border-bottom: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

header .nav-dropdown-menu a:hover {
    background: var(--gray-50);
    color: var(--black);
    padding-left: 1.5rem;
}

/* Language switch */
header .lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 18px;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.04em;
}

header .lang-switch a {
    color: inherit;
    opacity: 0.55;
    text-decoration: none;
    border-bottom: none;
    padding: 2px 4px;
    transition: opacity 0.15s ease;
}

header .lang-switch a:hover {
    opacity: 0.9;
}

header .lang-switch a.active {
    opacity: 1;
    font-weight: 600;
}

header .lang-switch .sep {
    opacity: 0.35;
}

header .mobile-nav-links .lang-switch {
    margin: 12px 0 0 0;
}

/* Mobile menu */
header .mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    color: var(--black);
}

header .mobile-nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(250, 250, 250, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    /* "safe" keeps the first item reachable once the menu is taller than the
       viewport — plain centering pushes it above the scrollable area */
    justify-content: safe center;
    gap: 1.25rem;
    z-index: 1000;
    padding: 2rem;
    overflow-y: auto;
}

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

header .mobile-nav-links a {
    font-size: 1.125rem;
    color: var(--black);
    text-decoration: none;
    border-bottom: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

header .mobile-nav-links a:hover {
    background: var(--gray-100);
}

@media (max-width: 1200px) {
    header .nav-links {
        gap: 1.5rem;
    }

    header .lang-switch {
        margin-left: 6px;
    }
}

/* Below 1024px the full menu no longer fits on one line, so switch to the burger */
@media (max-width: 1024px) {
    header .nav-links {
        display: none;
    }

    header .mobile-menu-toggle {
        display: block;
    }
}
