/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    color: #2c3e50;
    background-color: #f8f9fa;
}

/* Header - Static and Fixed */
.main-header {
    background-color: #0f1419;
    color: #ffffff;
    padding: 0.75rem 0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.main-title {
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 2rem;
    margin-bottom: 0.3rem;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 0.2rem;
    color: #e8e9ea;
}

.context {
    font-size: 0.95rem;
    font-weight: 300;
    color: #b8bcc0;
}

/* Container with three-column layout */
.container {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 200px 1fr 350px;
    gap: 2rem;
    padding: 2rem;
}

/* Left Index Navigation */
.left-index {
    position: sticky;
    top: 110px;
    height: fit-content;
    background-color: #ffffff;
    padding: 1.5rem 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.index-nav ul {
    list-style: none;
}

.index-nav li {
    margin-bottom: 0.8rem;
}

.nav-link {
    display: block;
    text-decoration: none;
    color: #555;
    font-size: 0.9rem;
    padding: 0.5rem;
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #133a7c;
    background-color: #f0f0f0;
}

.nav-link.active {
    color: #133a7c;
    border-left-color: #133a7c;
    font-weight: 600;
    background-color: #f8f9fa;
}

/* Main Content */
.main-content {
    background-color: #ffffff;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.content-section {
    margin-bottom: 4rem;
    min-height: 70vh;
}

.intro-section {
    padding-top: 2rem;
}

/* Scrollable Text Sections */
.scrollable-text-section {
    margin-bottom: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.text-block {
    max-width: 800px;
    text-align: left;
}

.text-block p {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #444;
    margin: 0;
}

.scrollable-text-section .component-list {
    margin-top: 0;
    max-width: 800px;
}

.scrollable-text-section .component-item {
    border-left-width: 4px;
}

.scrollable-text-section .component-item h4 {
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
}

.scrollable-text-section .component-item p {
    font-size: 1.2rem;
    color: #666;
}

/* Typography */
h2 {
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 1.75rem;
    margin: 2.5rem 0 1.5rem 0;
    color: #133a7c;
    line-height: 1.3;
}

h2:first-of-type {
    margin-top: 0;
}

/* Special styling for scatter plot section title to match graph titles */
.section-title {
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 1.75rem;
    color: #133a7c;
    margin: 2.5rem 0 1.5rem 0;
}

.lead {
    font-size: 1.15rem;
    font-weight: 300;
    line-height: 1.8;
    color: #444;
    margin-bottom: 2.5rem;
}

p {
    margin-bottom: 1.2rem;
    font-size: 1rem;
    line-height: 1.7;
}

/* Visualization Sections */
.figure {
    margin: 2rem 0;
}

.visualization-img {
    width: 100%;
    height: auto;
    display: block;
    border: none;
    background-color: #fff;
}

figcaption {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-top: 0.8rem;
    padding-left: 0.5rem;
    text-align: left;
}

.scatter-grid figcaption {
    font-size: 0.75rem;
}

/* Scatter grid for 2x2 layout */
.scatter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

.scatter-grid .figure {
    margin: 0;
}

/* Right Sidebar - Dynamic Content */
.right-sidebar {
    position: sticky;
    top: 110px;
    max-height: calc(100vh - 130px);
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    overflow-x: hidden;
}

.right-sidebar.scroll-locked {
    overflow-y: auto;
}

.right-sidebar.unlocked {
    overflow-y: visible;
}

.sidebar-content-wrapper {
    position: relative;
}

.sidebar-content {
    display: none;
    padding: 1.5rem;
}

.sidebar-content.active {
    display: block;
    padding-top: 3rem;
}

/* Lock main content scrolling when sidebar is scrolling */
.main-content.scroll-locked {
    overflow: hidden;
    pointer-events: none;
}

.sidebar-title {
    font-family: 'Lora', serif;
    font-weight: 600;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #133a7c;
}

.component-list {
    margin-top: 1.5rem;
}

.component-item {
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid #133a7c;
}

.component-item h4 {
    font-family: 'Lora', serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.component-item p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0;
}

.data-note {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.data-note h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: #555;
}

.data-note p {
    font-size: 0.85rem;
    color: #777;
    line-height: 1.6;
}

.references-list {
    margin-top: 1rem;
}

.references-list p {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #555;
    margin-bottom: 0.8rem;
}

.references-list a {
    color: #133a7c;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.references-list a:hover {
    color: #0a2540;
}

.references-list strong {
    color: #333;
    font-weight: 600;
}

/* Footer */
.footer {
    background-color: #0f1419;
    color: #b8bcc0;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    font-size: 0.9rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.author-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.author-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid #b8bcc0;
}

.author-name {
    font-family: 'Lora', serif;
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    text-align: center;
}

.author-button {
    display: inline-block;
    background-color: #E00A0A;
    color: #ffffff;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-family: 'Open Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease;
    margin-top: 0.5rem;
    text-align: center;
}

.author-button:hover {
    background-color: #C00808;
    color: #ffffff;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .container {
        grid-template-columns: 180px 1fr 320px;
        gap: 1.5rem;
        padding: 1.5rem;
    }
}

@media (max-width: 1200px) {
    .container {
        grid-template-columns: 160px 1fr 300px;
        gap: 1rem;
    }
    
    .left-index {
        padding: 1rem 0.5rem;
    }
    
    .main-content {
        padding: 1.5rem;
    }
    
    .right-sidebar {
        padding: 1rem;
    }
}

@media (max-width: 968px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .left-index {
        position: static;
        order: 1;
    }
    
    .main-content {
        order: 2;
    }
    
    .right-sidebar {
        order: 3;
        position: static;
    }
    
    .scatter-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-content-wrapper {
        min-height: 200px;
    }

    .sidebar-content {
        position: static;
        opacity: 1;
        visibility: visible;
    }

    .sidebar-content:not(.active) {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 1.5rem 1rem;
    }
    
    .main-title {
        font-size: 1.5rem;
    }
    
    .container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .lead {
        font-size: 1.05rem;
    }

    .left-index {
        padding: 1rem;
    }

    .right-sidebar {
        padding: 1rem;
    }

    .scrollable-text-section {
        min-height: 80vh;
        padding: 2rem 1rem;
    }

    .text-block p {
        font-size: 1.1rem;
    }

    .scrollable-text-section .component-item h4 {
        font-size: 1.3rem;
    }

    .scrollable-text-section .component-item p {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.25rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .context {
        font-size: 0.9rem;
    }
    
    .container {
        padding: 0.5rem;
    }
}
