:root {
    --primary-color: #2d3748;
    --secondary-color: #667eea;
    --accent-color: #9f7aea;
    --text-color: #2d3748;
    --light-text: #718096;
    --light-bg: #f7fafc;
    --dark-bg: #1a202c;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --hover-color: #f7fafc;
    --sidebar-width: 280px;
    --header-height: 550px;
    --spacing-sm: 0.75rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2.5rem;
    --container-width: 1140px;
    --radius: 5px;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--light-bg);
}

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Merriweather', Georgia, 'Times New Roman', Times, serif;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: var(--spacing-md);
}

h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 2.5rem;
    margin-top: var(--spacing-lg);
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

h3 {
    font-size: 1.75rem;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
}

p, ul, ol {
    margin-bottom: var(--spacing-md);
}

ul, ol {
    padding-left: var(--spacing-md);
}

li {
    margin-bottom: 0.5rem;
}

nav {
    background-color: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.nav-logo {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    margin-left: var(--spacing-sm);
    padding: 0.5rem 0.75rem;
    color: var(--light-text);
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--secondary-color);
    text-decoration: none;
}

.github-link {
    background-color: var(--secondary-color);
    border-radius: var(--radius);
    color: white !important;
    padding: 0.5rem 1rem !important;
    margin-left: var(--spacing-md) !important;
}

.github-link:hover {
    background-color: var(--accent-color);
    text-decoration: none;
}

header {
    height: var(--header-height);
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding-top: 70px;
}

header .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

header h1 {
    margin-bottom: 1rem;
    font-size: 4rem;
}

.subtitle {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.meta {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.scroll-cta {
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    display: inline-block;
    margin-top: 2rem;
    transition: background-color 0.3s;
}

.scroll-cta:hover {
    background-color: rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

main {
    display: flex;
    padding: var(--spacing-lg) 0;
    min-height: calc(100vh - var(--header-height));
}

.sidebar {
    width: var(--sidebar-width);
    position: sticky;
    top: 90px;
    height: calc(100vh - 90px);
    overflow-y: auto;
    padding-right: var(--spacing-md);
}

.content {
    flex: 1;
    max-width: calc(var(--container-width) - var(--sidebar-width) - (2 * var(--spacing-md)));
    padding-left: var(--spacing-md);
}

.toc {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow);
}

.toc h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.toc ul {
    list-style-type: none;
    padding-left: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--text-color);
    display: block;
    padding: 0.25rem 0;
    transition: 0.2s;
}

.toc a:hover, .toc a.active {
    color: var(--secondary-color);
    text-decoration: none;
    padding-left: 0.5rem;
}

.key-findings {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    box-shadow: var(--shadow);
}

.key-findings h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.key-findings ul {
    padding-left: 1.5rem;
}

section {
    margin-bottom: var(--spacing-lg);
    scroll-margin-top: 80px;
}

.table-container {
    overflow-x: auto;
    margin-bottom: var(--spacing-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    min-width: 650px;
}

thead {
    background-color: var(--light-bg);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    position: sticky;
    top: 0;
    background-color: var(--light-bg);
    z-index: 10;
}

.story-showcase {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background-color: var(--light-bg);
    border-radius: var(--radius);
}

.story-showcase h3 {
    margin-top: 0;
}

.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.story-card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: var(--spacing-md);
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.story-card:hover {
    transform: translateY(-5px);
}

.story-card h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.character {
    color: var(--light-text);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
}

.excerpt {
    font-family: 'Merriweather', serif;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--primary-color);
}

footer {
    background-color: var(--dark-bg);
    color: white;
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-lg);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.footer-logo {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    font-size: 1.5rem;
}

.footer-links {
    display: flex;
}

.footer-links a {
    margin-left: var(--spacing-md);
    color: white;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: none;
}

.footer-meta {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-md);
    font-size: 0.9rem;
    opacity: 0.7;
    text-align: center;
}

.footer-meta p {
    margin-bottom: 0.5rem;
}

@media (max-width: 1024px) {
    :root {
        --header-height: 450px;
        --sidebar-width: 250px;
    }

    h1 {
        font-size: 3rem;
    }

    .toc, .key-findings {
        padding: var(--spacing-sm);
    }

    .nav-links a:not(.github-link) {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 400px;
        --sidebar-width: 0;
    }

    main {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        height: auto;
        padding-right: 0;
        margin-bottom: var(--spacing-md);
    }

    .content {
        max-width: 100%;
        padding-left: 0;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-logo {
        margin-bottom: var(--spacing-sm);
    }

    .footer-links {
        flex-direction: column;
    }

    .footer-links a {
        margin: 0.5rem 0;
    }

    .story-grid {
        grid-template-columns: 1fr;
    }

    .table-container {
        max-width: 100vw;
        margin-left: -1rem;
        margin-right: -1rem;
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    :root {
        --header-height: 350px;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .nav-logo {
        font-size: 1.1rem;
        max-width: 200px;
    }
}