@import './variables.css';

.navbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 64px;
    width: calc(100vw - 24px);
    max-width: 1180px;
    background: var(--surface-color-elevated);
    position: fixed;
    top: 12px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 1000;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: border-color 0.35s ease, background 0.35s ease;
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    box-sizing: border-box;
    overflow: visible;
}

.navbar.scrolled {
    border-color: rgba(126, 200, 184, 0.35);
}

.logo-container,
.logo {
    display: none;
}

.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: clamp(10px, 1.4vw, 20px);
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    padding: 6px 2px;
    border-radius: 0;
    position: relative;
    transition: color 0.25s ease;
    letter-spacing: var(--letter-spacing-normal);
    overflow: visible;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-links a::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-color);
    transition: transform 0.2s ease;
}

.nav-links a::after {
    display: none;
}

.nav-links a:hover::before,
.nav-links a.active::before {
    transform: translateY(-50%) scale(1);
}

.nav-links a:hover,
.nav-links a:focus,
.nav-links a.active {
    color: var(--accent-color);
    background: transparent;
    transform: none;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-color);
    padding: 7px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    letter-spacing: var(--letter-spacing-wide);
    transition: all 0.25s ease;
    box-shadow: none;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 4px;
}

.theme-toggle:hover,
.theme-toggle:focus {
    border-color: var(--secondary-color);
    color: var(--accent-color);
    transform: none;
    box-shadow: none;
    outline: none;
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    cursor: pointer;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--surface-border);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.hamburger:hover {
    border-color: var(--secondary-color);
}

.hamburger .bar {
    width: 18px;
    height: 2px;
    background: var(--text-color);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger .bar:nth-child(1),
.hamburger .bar:nth-child(2) {
    margin-bottom: 4px;
}

.hamburger.change .bar:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
}

.hamburger.change .bar:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.hamburger.change .bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Collapse earlier — 7 code-tag links need room */
@media (max-width: 1200px) {
    .navbar {
        width: auto;
        min-width: 64px;
        max-width: none;
        padding: 0 10px;
        left: auto;
        right: 12px;
        transform: none;
        justify-content: flex-end;
        overflow: visible;
    }

    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: min(360px, 100vw);
        height: 100vh;
        background: linear-gradient(160deg, var(--surface-color-elevated) 0%, var(--secondary-color-dark) 100%);
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        padding: 40px 36px;
        gap: 18px;
        transform: translateX(100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.35s ease;
        border-left: 1px solid var(--surface-border);
        border-radius: 0;
        z-index: 999;
    }

    .nav-links.active {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-links a {
        font-size: var(--text-lg);
        line-height: var(--line-height-snug);
        padding: 10px 0;
        width: auto;
    }

    .nav-links a::before {
        left: -18px;
        width: 8px;
        height: 8px;
    }

    .theme-toggle {
        display: none;
    }

    .nav-links .theme-toggle {
        display: flex;
        margin-top: 18px;
        margin-left: 0;
        font-size: 0.9rem;
        padding: 10px 16px;
    }
}

@media (max-width: 768px) {
    .navbar {
        top: 10px;
        right: 10px;
        height: 58px;
        border-radius: 8px;
        background: var(--surface-color-elevated);
    }
}
