/* full width top nav bar, david left, links + social right, underline marks active */

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-strong);
    padding: 0 max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left));
    /* inherit body font so the bar matches the rest of the site even if UA css interferes */
    font-family: inherit;
}

/* nav is hidden under the modal anyway, kill it entirely when the modal opens so it cant cause repaints */
body.detail-open nav {
    display: none;
}

.nav-container {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding-top: env(safe-area-inset-top);
}

.nav-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.01em;
    cursor: pointer;
    padding: 0.5rem 0;
    line-height: 1;
    transition: color 0.15s;
}

.nav-name:hover {
    color: #000000;
}

.nav-center {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    /* how far inside each link the underline sits, kept in sync with link padding */
    --nav-indicator-inset: 16px;
}

.nav-item {
    position: relative;
}

.nav-link {
    position: relative;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.15s;
    cursor: pointer;
    padding: 1.4rem 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.nav-link:hover {
    color: var(--color-text);
}

.nav-link.is-active {
    color: var(--color-text);
    font-weight: 600;
}

.nav-link:focus-visible {
    outline: 2px solid #1e1e1e;
    outline-offset: 2px;
    border-radius: 4px;
}

/* shared sliding underline, JS sets transform + width to match the active link */
.nav-indicator {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
    opacity: 0;
    pointer-events: none;
    will-change: transform, width;
    transition:
        transform 0.32s cubic-bezier(0.65, 0, 0.35, 1),
        width 0.32s cubic-bezier(0.65, 0, 0.35, 1),
        opacity 0.18s ease;
}

.nav-indicator.is-visible {
    opacity: 1;
}

/* applied on first paint so the bar doesnt slide in from x=0 on initial load */
.nav-indicator.no-transition {
    transition: none;
}

.dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 0.35rem 0;
    min-width: 240px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    margin-top: 0.25rem;
    box-shadow: 0 16px 48px var(--color-shadow-strong);
}

.nav-item:hover .dropdown {
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    padding: 0.6rem 1rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    display: block;
    transition: background-color 0.15s, color 0.15s;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.4;
}

.dropdown-item:hover {
    background-color: var(--color-accent-soft);
    color: var(--color-accent-strong);
}

.nav-social {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.5rem;
    padding-left: 0.85rem;
    border-left: 1px solid var(--color-border-strong);
}

.linkedin-icon {
    color: var(--color-text-secondary);
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.15s;
    padding: 0.55rem 0.7rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.linkedin-icon:hover {
    color: #0a66c2;
}

.github-icon {
    color: var(--color-text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    transition: color 0.15s;
    padding: 0.55rem;
}

.github-icon:hover {
    color: var(--color-text);
}
