/* 
    Navigation Styles
    
    This file contains all header and navigation styles for the site.
    All pages use a consistent side overlay menu system that slides in from
    the left when the hamburger menu button is clicked. The menu includes
    a dark backdrop overlay and provides mobile-friendly navigation.
    
    Students can learn about responsive navigation patterns, overlay menus,
    and accessible menu design.
*/

/* 
    Header Base Styles
    
    The header contains the site navigation and stays visible at the top
    of the page as users scroll. This section demonstrates flexbox layout
    and sticky positioning.
*/
header {
    background-color: var(--bg-color);              /* White background */
    border-bottom: 1px solid var(--border-color);  /* Subtle bottom border */
    position: sticky;  /* Sticks to top when scrolling - stays visible */
    top: 0;            /* Position at top of viewport when sticky */
    z-index: 100;      /* Ensures header appears above other content */
    box-shadow: var(--shadow);  /* Adds shadow below header for depth */
}

.navbar {
    padding: 1rem 0;  /* Vertical padding: 1rem top and bottom, 0 left and right */
}

/* 
    Flexbox Layout for Navigation
    
    display: flex creates a flexible container that arranges children horizontally
    by default. The menu toggle is now on the left, followed by the logo/title.
    align-items: center vertically centers items within the flex container.
*/
.navbar .container {
    display: flex;                      /* Creates flexible layout */
    align-items: center;                /* Vertically centers all items */
    gap: 1rem;                          /* Space between menu button and logo */
    position: relative;                 /* Allows absolute positioning of right-side elements */
}

/* Header right side - for About link and other actions */
.header-right {
    margin-left: auto;                  /* Pushes this to the right */
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.header-right a:hover {
    color: var(--primary-color);
    background-color: var(--bg-light);
}

.header-right a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo:hover {
    opacity: 0.8;
}

/* 
    Site Title and Subtitle Container
    
    This container holds the site title (logo) and subtitle in a vertical stack.
    It uses flexbox to arrange the title above the subtitle and takes up
    the remaining space in the header after the menu button.
*/
.site-header-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.site-subtitle {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 400;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.site-subtitle a {
    color: var(--primary-color);
    text-decoration: none;
}

.site-subtitle a:hover {
    text-decoration: underline;
}


/* 
    Hamburger Menu Button
    
    Now positioned on the left side of navigation.
    Always visible, as it controls the side overlay menu.
*/
.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.5rem;
    color: var(--text-color);
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.menu-toggle:hover,
.menu-toggle:focus {
    color: var(--primary-color);
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* 
    Side Overlay Menu
    
    Navigation menu slides in from the left as an overlay.
    This provides a mobile-friendly navigation experience
    that doesn't push content around.
*/

/* Backdrop overlay - darkens the page when menu is open */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Side menu panel */
.nav-links {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background-color: var(--bg-color);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 2rem 0;
    overflow-y: auto;
    transform: translateX(-100%);  /* Hidden off-screen by default */
    transition: transform 0.3s ease, visibility 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0;
    list-style: none;
    margin: 0;
    visibility: hidden;  /* Ensures menu is not accessible when hidden */
}

/* Menu slides in when expanded */
.nav-links.expanded {
    transform: translateX(0);  /* Slides into view */
    visibility: visible;  /* Makes menu accessible */
}

.nav-links li {
    width: 100%;
}

.nav-links a {
    display: block;
    padding: 1rem 2rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s, color 0.2s;
}

.nav-links a:hover,
.nav-links a:focus {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

.nav-links a.active {
    background-color: var(--bg-light);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
    padding-left: calc(2rem - 4px);
}

/* Navigation section headers (e.g., "Lessons", "Resources") */
.nav-section-header {
    padding: 1rem 2rem 0.5rem 2rem;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
    border-bottom: none;
}

.nav-section-header:first-child {
    margin-top: 0;
}

/* 
    Menu Invitation Text
    
    Optional utility class for displaying invitation text next to the menu button.
    Currently not used in the site but available for future enhancements.
*/
.menu-invitation {
    display: none;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-left: 0.5rem;
}

.navbar.minimal .menu-invitation {
    display: inline;
}

/* 
    Responsive Navigation
    
    The side overlay menu works well on all screen sizes.
    On mobile, it takes up more of the screen width for easier tapping.
*/
@media (max-width: 768px) {
    .nav-links {
        width: 280px;
        max-width: 90vw;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .site-subtitle {
        font-size: 0.75rem;
    }
    
    .header-right {
        margin-left: 0.5rem;
    }
    
    .header-right a {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

