/* Navigation styles */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: #fff;
    height: 48px;
}

#main-nav.visible {
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    height: 48px;
    background: #fff;
    z-index: 1002;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.logo {
    text-decoration: none;
}

.logo h2 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 48px;
    transition: color 0.3s ease;
}

.logo:hover h2 {
    color: #4a4a4a;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

.nav-links li {
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-links li:not(:first-child) {
    margin-left: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.25rem 0;
    position: relative;
    transition: color 0.3s ease;
}

/* Active page indicator */
.nav-links a[aria-current="page"] {
    color: #4a4a4a;
    font-weight: 600;
}

.nav-links a[aria-current="page"]::after {
    transform: scaleX(1) !important;
}

/* Focus styles */
.nav-links a:focus {
    outline: none;
    color: #4a4a4a;
}

.nav-links a:focus:not(:focus-visible) {
    outline: none;
}

.nav-links a:focus-visible {
    outline: 2px solid #4a4a4a;
    outline-offset: 4px;
    border-radius: 2px;
}

/* Desktop hover effect */
@media (min-width: 769px) {
    .nav-links a::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 0;
        width: 100%;
        height: 2px;
        background-color: currentColor;
        transform: scaleX(0);
        transition: transform 0.3s ease;
    }

    .nav-links a:hover {
        color: #4a4a4a;
    }

    .nav-links a:hover::after {
        transform: scaleX(1);
    }

    .nav-links a {
        opacity: 0.9;
        transform: translateY(0);
        transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
    }

    .nav-links a:hover {
        opacity: 1;
        transform: translateY(-1px);
    }

    .nav-content {
        opacity: 0;
        transform: translateY(-4px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    #main-nav.visible .nav-content {
        opacity: 1;
        transform: translateY(0);
    }

    #main-nav {
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }

    #main-nav.visible {
        transform: translateY(0);
    }

    .nav-links {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .nav-links li:not(:first-child) {
        margin-left: 1.5rem;
    }
}

#mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: #000;
    position: relative;
    transition: all 0.3s ease;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: #000;
    left: 0;
    transition: all 0.3s ease;
}

.hamburger::before { top: -6px; }
.hamburger::after { bottom: -6px; }

.mobile-menu-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.mobile-menu-backdrop.active {
    opacity: 1;
}

/* Mobile styles */
@media (max-width: 768px) {
    #main-nav {
        height: 60px;
    }

    .nav-content {
        height: 60px;
    }

    #mobile-nav-toggle {
        display: block;
    }

    body.menu-active .mobile-menu-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links {
        position: fixed;
        top: 60px;
        right: 0;
        width: 80%;
        height: calc(100vh - 60px);
        background: #fff;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1002;
    }

    .nav-links li {
        display: flex;
        width: 100%;
        margin: 0.25rem 0;
        height: 10%;
    }

    .nav-links a {
        display: flex;
        width: 100%;
        padding: 0.75rem 1rem;
        margin: 0;
        border-radius: 4px;
        align-items: center;
    }

    /* Remove any hover/active state transforms */
    .nav-links a:hover,
    .nav-links a:active,
    .nav-links.active li {
        transform: none !important;
        margin: 0;
        text-indent: 0;
    }

    .nav-links li {
        position: relative; /* Reset position */
        margin: 0;
        padding: 0;
        width: 100%;
        opacity: 0;
        transform: none;
        transition: opacity 0.3s ease;
        display: block; /* Change to block for consistent layout */
    }

    .nav-links.active li {
        opacity: 1;
    }

    .nav-links a {
        position: relative; /* Reset position */
        display: block;
        width: 100%;
        text-align: left;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border-radius: 4px;
        transform: none;
        left: 0; /* Ensure no offset */
    }

    /* Remove transition delays as they may cause alignment issues */
    .nav-links li:nth-child(1),
    .nav-links li:nth-child(2),
    .nav-links li:nth-child(3),
    .nav-links li:nth-child(4) {
        --item-index: 0;
    }

    .nav-links a[aria-current="page"] {
        background: rgba(74, 74, 74, 0.05);
    }

    .nav-content {
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    body.menu-active {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    #wrapper {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: auto;
    }

    body.menu-active #wrapper {
        transform: translateX(-20px);
        pointer-events: none;
    }

    .nav-links a:focus-visible {
        outline-offset: 0;
    }

    .mobile-menu-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    #mobile-nav-toggle {
        display: block;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
        z-index: 1003;
    }

    .hamburger {
        display: block;
        width: 24px;
        height: 2px;
        background: #000;
        position: relative;
        transition: all 0.3s ease;
    }

    .hamburger::before,
    .hamburger::after {
        content: '';
        position: absolute;
        width: 24px;
        height: 2px;
        background: #000;
        left: 0;
        transition: all 0.3s ease;
    }

    .hamburger::before { top: -6px; }
    .hamburger::after { bottom: -6px; }

    #mobile-nav-toggle.active .hamburger {
        background: transparent;
    }

    #mobile-nav-toggle.active .hamburger::before {
        top: 0;
        transform: rotate(45deg);
    }

    #mobile-nav-toggle.active .hamburger::after {
        bottom: 0;
        transform: rotate(-45deg);
    }

    body.menu-active {
        overflow: hidden;
    }

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

    .nav-links {
        position: fixed;
        top: 60px;
        right: 0;
        width: 80%;
        height: calc(100vh - 60px);
        background: #fff;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1002;
    }

    .nav-links li {
        display: flex;
        width: 100%;
        margin: 0.25rem 0;
    }

    .nav-links a {
        display: flex;
        width: 100%;
        padding: 0.75rem 1rem;
        border-radius: 4px;
        align-items: center;
        position: static; /* Remove relative positioning */
    }

    /* Remove all transitions except the slide in/out */
    .nav-links,
    .nav-links li,
    .nav-links a {
        transition: none;
    }

    .nav-links {
        transition: transform 0.3s ease;
    }

    .nav-links.active {
        transform: translateX(0);
        box-shadow: -10px 0px 10px rgba(0,0,0,0.1);
    }
}

/* Always ensure content is pushed down */
#wrapper {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

@media (max-width: 768px) {
    #wrapper {
        padding-top: 60px;
    }
}

/* Page transition states */
#main-nav.transitioning .nav-links a {
    pointer-events: none;
}

#main-nav.transitioning .nav-content {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }
}