@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,300..600;1,6..72,300..500&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

/* ── Global nav — editorial design system ── */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: transparent;
    border-bottom: 1px solid transparent;
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, height 0.3s ease;
}

.navbar.scrolled {
    height: 62px;
    background: var(--bg-secondary, #FBF8F3);
    border-color: var(--border, rgba(33, 30, 26, 0.10));
    box-shadow: 0 1px 0 var(--border, rgba(33, 30, 26, 0.08));
}

.nav-container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 48px;
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 36px;
    min-width: 0;
}

/* ── Logo ── */
.nav-logo {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 22px;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--text, #211E1A);
    text-decoration: none;
    line-height: 1;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

.nav-logo em {
    font-style: italic;
    color: var(--accent, #B25E3A);
}

.nav-logo:hover { opacity: 0.78; }

/* ── Nav links ── */
.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav-link {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #6B655B);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text, #211E1A);
}

/* ── Focus rings ── */
.nav-link:focus-visible,
.nav-auth-btn:focus-visible,
.nav-user:focus-visible,
.dropdown-item:focus-visible {
    outline: 2px solid var(--accent, #B25E3A);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ── Nav right ── */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex-shrink: 0;
}

/* ── Auth buttons ── */
.nav-auth-btn {
    padding: 9px 20px;
    border-radius: 999px;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-signin {
    color: var(--text, #211E1A);
    background: transparent;
    border: 1px solid var(--border-strong, rgba(33, 30, 26, 0.18));
}

.btn-signin:hover {
    border-color: var(--text-secondary, #6B655B);
}

.btn-signup {
    background: var(--ink-btn, #211E1A);
    color: var(--ink-btn-text, #FFFFFF);
    border: none;
}

.btn-signup:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

/* ── User pill (logged in) ── */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 4px 14px;
    background: var(--surface-input, #FFFFFF);
    border: 1px solid var(--border-strong, rgba(33, 30, 26, 0.18));
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    max-width: min(280px, 50vw);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.nav-user:hover {
    border-color: var(--text-secondary, #6B655B);
}

.nav-user.active {
    border-color: var(--accent, #B25E3A);
    background: var(--accent-soft, rgba(178, 94, 58, 0.06));
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #211E1A);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-faint, #9A958C);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--accent, #B25E3A);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--accent-on, #FFFFFF);
    flex-shrink: 0;
}

/* ── Dropdown ── */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-secondary, #FBF8F3);
    border: 1px solid var(--border, rgba(33, 30, 26, 0.10));
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 8px 32px -8px rgba(40, 34, 28, 0.22), 0 2px 8px -2px rgba(40, 34, 28, 0.08);
    display: none;
    animation: navSlideDown 0.18s ease forwards;
    z-index: 10;
}

.nav-dropdown.open { display: block; }

@keyframes navSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    padding: 10px 14px;
    border-radius: 10px;
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #6B655B);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    border: none;
    width: 100%;
    background: transparent;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg, #F4F0E9);
    color: var(--text, #211E1A);
}

.dropdown-divider {
    height: 1px;
    background: var(--border, rgba(33, 30, 26, 0.10));
    margin: 6px 0;
}

.btn-logout {
    color: var(--error, #B0413A);
}

.btn-logout:hover {
    background: var(--error-soft, rgba(176, 65, 58, 0.08));
    color: var(--error, #B0413A);
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .nav-links { display: none; }

    .nav-container {
        padding: 0 16px;
        max-width: 100%;
    }

    .nav-logo { font-size: 20px; }
    .nav-right { gap: 8px; }

    .nav-auth-btn { padding: 8px 16px; }

    .btn-signup { display: none; }

    .user-info { display: none; }
    .nav-user { padding-left: 4px; }
}

@media (max-width: 420px) {
    .nav-auth-btn { white-space: nowrap; }
}

/* ── Theme toggle in nav ── */
.nav-theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid var(--border, rgba(33, 30, 26, 0.10));
    color: var(--text, #211E1A);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.nav-theme-toggle:hover { border-color: var(--border-strong, rgba(33, 30, 26, 0.18)); transform: translateY(-1px); }
.nav-theme-toggle .moon { display: none; }
[data-theme="dark"] .nav-theme-toggle .sun { display: none; }
[data-theme="dark"] .nav-theme-toggle .moon { display: inline; }

/* ── Page spacing for sticky nav ── */
body { padding-top: 68px; }
