:root {
    --site-header-blue: #1c638f;
    --site-header-blue-bright: #2980b9;
    --site-header-line: #dbe4eb;
    --site-header-muted: #647486;
}

.site-header,
.site-header * {
    box-sizing: border-box;
}

.site-header {
    position: relative;
    z-index: 1000;
    flex: 0 0 auto;
    min-height: 72px;
    padding: 10px clamp(16px, 3vw, 42px);
    display: flex;
    align-items: center;
    gap: 24px;
    color: #263646;
    background: #fff;
    box-shadow: 0 2px 12px rgba(24, 50, 72, .09);
}

.site-brand {
    flex: 0 0 auto;
}

.site-brand img {
    display: block;
    width: auto;
    height: 52px;
}

.site-header-menu,
.site-nav,
.site-account-nav,
.site-account-nav .auth-section,
.site-account-nav .user-info {
    display: flex;
    align-items: center;
}

.site-header-menu {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-start;
    gap: clamp(14px, 2vw, 28px);
}

.site-nav,
.site-account-nav .user-info {
    gap: clamp(11px, 1.6vw, 22px);
}

.site-account-nav .auth-section {
    gap: 12px;
}

.site-account-nav,
.site-header-action {
    margin-left: auto;
}

.site-header-action {
    display: flex;
    align-items: center;
    gap: 9px;
}

.site-account-label {
    color: var(--site-header-muted);
    font-size: .78rem;
    white-space: nowrap;
}

/* Links and action buttons share one quiet navigation treatment. Buttons
   retain their correct semantics while looking identical to text links. */
.site-nav-link {
    appearance: none;
    min-height: 40px;
    padding: 7px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    color: var(--site-header-blue);
    background: transparent;
    box-shadow: none;
    font: 500 .9rem/1.25 'Poppins', sans-serif;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.site-nav-link:hover,
.site-nav-link[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 4px;
}

.site-nav-link:not(a):not(button) {
    cursor: default;
}

.site-nav-link:focus-visible,
.site-menu-toggle:focus-visible {
    outline: 3px solid rgba(52, 152, 219, .3);
    outline-offset: 3px;
}

/* At most one contextual action is filled. In results mode the account CTA
   becomes a text link and Back to planning takes over this visual priority. */
.site-primary-action,
.primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 7px;
    color: #fff !important;
    background: linear-gradient(45deg, #3498db, var(--site-header-blue-bright));
    box-shadow: 0 2px 5px rgba(26, 91, 133, .18);
    font-weight: 500;
    text-decoration: none !important;
}

.site-primary-action:hover,
.primary-link:hover {
    filter: brightness(.96);
}

/* The planner defines broad button rules after this stylesheet. These scoped
   declarations form a component boundary so button-based actions (Log out)
   render exactly like link-based actions (My Profile and Inspirations Admin). */
.site-header .site-primary-action {
    min-height: 40px;
    padding: 8px 16px;
    border: 0;
    border-radius: 7px;
    color: #fff !important;
    background: linear-gradient(45deg, #3498db, var(--site-header-blue-bright));
    box-shadow: 0 2px 5px rgba(26, 91, 133, .18);
    font: 500 .9rem/1.25 'Poppins', sans-serif;
    transform: none;
}

.site-header .site-primary-action:hover,
.site-header .site-primary-action:active {
    background: linear-gradient(45deg, #3498db, var(--site-header-blue-bright));
    box-shadow: 0 2px 5px rgba(26, 91, 133, .18);
    filter: brightness(.96);
    transform: none;
}

.site-header button.site-menu-toggle {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--site-header-line);
    border-radius: 8px;
    color: var(--site-header-blue);
    background: #fff;
    box-shadow: none;
    font-size: 1.25rem;
    transform: none;
}

.site-header button.site-menu-toggle:hover,
.site-header button.site-menu-toggle:active {
    color: var(--site-header-blue);
    background: #f7f9fb;
    box-shadow: none;
    transform: none;
}

.site-secondary-action {
    min-height: 40px;
    padding: 7px 14px;
    border: 1px solid #a9c9dd;
    border-radius: 7px;
    color: var(--site-header-blue) !important;
    background: #fff;
    box-shadow: none;
    text-decoration: none !important;
}

.site-secondary-action:hover {
    border-color: #72add1;
    background: #f3f9fc;
}

/* A guest's Login CTA yields the filled treatment to Back to planning in
   results mode. My profile remains an outlined button in every state. */
.site-header.results-mode .account-login {
    border: 1px solid #a9c9dd;
    color: var(--site-header-blue) !important;
    background: #fff;
    box-shadow: none;
}

.site-menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    margin-left: auto;
    padding: 0;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--site-header-line);
    border-radius: 8px;
    color: var(--site-header-blue);
    background: #fff;
    font-size: 1.25rem;
    cursor: pointer;
}

.site-header [hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    .site-header {
        min-height: 64px;
        padding: 7px 12px;
        flex-wrap: wrap;
        gap: 7px 12px;
    }

    .site-brand img {
        height: 45px;
    }

    .site-menu-toggle {
        display: inline-flex;
    }

    /* CSS closes the menu before JavaScript initializes, avoiding a flash of
       expanded navigation on slower mobile connections. */
    .site-header:not(.site-menu-open) .site-header-menu {
        display: none;
    }

    .site-header-menu {
        flex: 1 0 100%;
        width: 100%;
        padding: 6px 0 5px;
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
        border-top: 1px solid var(--site-header-line);
    }

    .site-nav,
    .site-account-nav,
    .site-header-action,
    .site-account-nav .auth-section,
    .site-account-nav .user-info {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        gap: 7px;
    }

    .site-account-nav,
    .site-header-action {
        margin-left: 0;
    }

    .site-account-label {
        padding: 4px 12px 1px;
        white-space: normal;
    }

    /* Mobile navigation keeps the requested button-like feel through large,
       subtle touch targets without turning every item into a primary CTA. */
    .site-nav-link {
        width: 100%;
        min-height: 46px;
        padding: 11px 13px;
        justify-content: flex-start;
        border: 1px solid #e4ebf0;
        border-radius: 8px;
        background: #f7f9fb;
        text-decoration: none !important;
    }

    .site-primary-action,
    .primary-link {
        justify-content: center;
        border-color: transparent;
        background: linear-gradient(45deg, #3498db, var(--site-header-blue-bright));
    }

    .site-secondary-action,
    .site-header.results-mode .account-login {
        justify-content: center;
        border-color: #a9c9dd;
        background: #fff;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header * {
        transition-duration: .01ms !important;
    }
}
