* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: #f5f5f5;
    min-height: 100vh;
    overflow-x: hidden;
    color: #439b93;
}

/* Header styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid #eee;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
}

.menu-toggle {
    margin-left: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #439b93;
}

.nav-links {
    display: flex;
    gap: 4rem;
}

.nav-links a {
    text-decoration: none;
    color: #439b93;
    font-size: 0.9rem;
    letter-spacing: 1px;
    position: relative;
    white-space: nowrap;
}

.nav-links a.active {
    color: rgb(170, 57, 5);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -1.3rem;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #439b93;
}

.social-icons {
    display: flex;
    gap: 1rem;
    margin-right: 1rem;
}

.social-icons a {
    width: 24px;
    height: 24px;
    border: 1px solid #439b93;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #2a2374;
    font-size: 0.8rem;
}

/* Main content styles */
.main-content {
    margin-top: 5rem;
    padding: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.chapter-sidebar {
    position: fixed;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    line-height: 1.4;
    color: #666;
}

.chapter-content {
    margin-left: 12rem;
    max-width: 800px;
}

.chapter-label {
    font-size: 0.9rem;
    margin-bottom: 0.625rem;
    color: #666;
}

.chapter-title {
    font-family: serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 2.5rem;
    line-height: 1.2;
}

.chapter-text {
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.6;
    margin-bottom: 2.5rem;
    color: #333;
}

.visualization-section {
    background: #eaefec;
    padding: 2.5rem;
    border-radius: 10px;
    text-align: center;
    margin-top: 2.5rem;
}

.visualization-image {
    max-width: 100%;
    height: auto;
    margin: 1.875rem auto;
    border-radius: 5px;
    display: block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.visualization-title {
    font-family: serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1.25rem;
}

.visualization-text {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
    color: #444;
}

/* Chapter navigation */
.chapter-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    position: relative;
}

.prev-chapter, .next-chapter {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #439b93;
    text-decoration: none;
    font-size: 0.8rem;
    text-align: center;
    z-index: 90;
    bottom: 2.5rem;
}

.prev-chapter {
    left: 2.5rem;
}

.next-chapter {
    right: 2.5rem;
}

.prev-chapter-arrow, .next-chapter-arrow {
    margin-top: 0.625rem;
    font-size: 1.5rem;
}

.prev-chapter-arrow {
    transform: rotate(180deg);
}

/* Menu overlay styles */
.menu-overlay {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: #439b93;
    color: white;
    transition: left 0.3s ease-in-out;
    padding: 2.5rem;
    z-index: 1000;
    overflow-y: auto;
}

.menu-overlay.active {
    left: 0;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3.75rem;
}

.menu-title {
    font-family: serif;
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: white;
}

.close-menu {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 2rem;
    padding: 0.5rem;
}

.menu-links {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.menu-links a {
    color: white;
    text-decoration: none;
}

.chapter-label-menu {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 0.3125rem;
}

.chapter-link {
    font-family: serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    display: block;
}

.next-chapter-arrow {
    margin-top: 0.625rem;
    font-size: 1.5rem;
}

.prev-chapter {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #439b93;
    text-decoration: none;
    font-size: 0.8rem;
    text-align: center;
    z-index: 90;
    bottom: 2.5rem;
    left: 2.5rem;
}

.prev-chapter-arrow {
    margin-top: 10px;
    font-size: 1.5rem;
    transform: rotate(180deg); /* Rotates the arrow to point up */
}

.backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
    z-index: 999;
}

.backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive breakpoints */
@media (max-width: 1024px) {
    .chapter-content {
        margin-left: 8rem;
    }
    
    .prev-chapter {
        left: 2rem;
    }
    
    .next-chapter {
        right: 2rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem 0.5rem;
    }

    .menu-toggle {
        margin-left: 1rem;
    }

    .nav-links {
        gap: 2rem;
    }

    .chapter-sidebar {
        display: none;
    }

    .chapter-content {
        margin-left: 0;
        padding: 0 1rem;
    }

    .main-content {
        padding: 1rem;
        margin-top: 4rem;
    }

    .visualization-section {
        padding: 1.5rem;
        margin: 1.5rem -1rem;
        border-radius: 0;
    }

    .prev-chapter, .next-chapter {
        position: static;
        margin: 1rem 0;
    }

    .chapter-navigation {
        padding: 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .main-content {
        margin-top: 4rem;
    }

    .header {
        padding: 0.75rem;
    }

    .nav-links {
        gap: 1rem;
        font-size: 0.8rem;
    }

    .social-icons {
        gap: 0.5rem;
    }

    .menu-toggle {
        margin-left: 0.5rem;
        font-size: 1.2rem;
    }

    .chapter-navigation {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .visualization-section {
        padding: 1rem;
    }
}