/* =============================================================================
   Mutual Fund Style Drift SLR - Academic Website Stylesheet
   Design: Clean academic styling with blue/gray palette
   Fonts: Georgia (serif) for body, system-ui for navigation
   ============================================================================= */

/* CSS Variables */
:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --secondary: #64748b;
    --accent: #f59e0b;
    --dark: #0f172a;
    --light: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --max-width: 1200px;
    --content-width: 800px;
    --sidebar-width: 240px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base Typography */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.7;
    color: var(--dark);
    background-color: var(--light);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: color 0.2s;
}

.main-nav a:hover {
    color: var(--primary);
}

/* Page Layout */
.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 2rem;
    padding: 2rem 1.5rem;
    min-height: calc(100vh - 160px);
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 80px;
    height: fit-content;
    padding-right: 1rem;
}

.sidebar h3 {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.section-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.section-nav a {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.875rem;
    color: var(--gray-700);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.section-nav a:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.section-nav a.active {
    background: #eff6ff;
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

/* Main Content */
.content {
    max-width: var(--content-width);
}

article {
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 2rem;
    line-height: 1.3;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.75rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 2rem 0 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-200);
}

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

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 1.5rem 0 0.75rem;
}

h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin: 1.25rem 0 0.5rem;
}

p {
    margin-bottom: 1rem;
    text-align: justify;
    hyphens: auto;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Lists */
ul, ol {
    margin: 1rem 0 1.5rem 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

li::marker {
    color: var(--primary);
}

/* Citations */
.citation {
    color: var(--primary);
    cursor: help;
    border-bottom: 1px dotted var(--primary);
}

.citation:hover {
    background: #eff6ff;
}

/* Figures */
.article-figure {
    margin: 2rem 0;
    text-align: center;
}

.article-figure img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.article-figure figcaption {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--gray-600);
    font-style: italic;
}

/* Tables */
.table-container {
    margin: 1.5rem 0;
    overflow-x: auto;
}

.table-caption {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-300);
}

.data-table tr:hover {
    background: var(--gray-50);
}

/* Code */
code {
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 0.9em;
    background: var(--gray-100);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

/* Prev/Next Navigation */
.prev-next {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
}

.prev-btn, .next-btn {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    color: var(--primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary);
    border-radius: 4px;
    transition: all 0.2s;
}

.prev-btn:hover, .next-btn:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 2rem 1.5rem;
    background: var(--gray-100);
    border-top: 1px solid var(--gray-200);
    margin-top: 2rem;
}

.site-footer p {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.85rem;
    color: var(--gray-600);
    text-align: center;
    margin: 0.25rem 0;
}

/* =============================================================================
   Homepage Specific Styles
   ============================================================================= */

.hero {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.25rem;
    border: none;
    color: white;
    margin-bottom: 0.5rem;
}

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

.hero .meta {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--gray-200);
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-card .label {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

/* Section Cards */
.section-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.section-card {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    text-decoration: none;
    transition: all 0.2s;
}

.section-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    text-decoration: none;
}

.section-card h3 {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.5rem;
}

.section-card p {
    font-size: 0.9rem;
    color: var(--gray-600);
    margin: 0;
    text-align: left;
}

/* Abstract Box */
.abstract-box {
    background: #fffbeb;
    border-left: 4px solid var(--accent);
    padding: 1.5rem;
    border-radius: 0 8px 8px 0;
    margin: 2rem 0;
}

.abstract-box h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 0.75rem;
    padding: 0;
    border: none;
}

.abstract-box p {
    margin: 0;
    font-size: 0.95rem;
    text-align: left;
}

/* Data Views */
.data-views {
    margin: 2rem 0;
}

.data-views h2 {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.view-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.view-link {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.view-link:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

/* Key Figures */
.figures-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.figure-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.figure-card img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.figure-card figcaption {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 0.5rem;
    text-align: center;
}

/* Homepage Container */
.home-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* =============================================================================
   Responsive Design
   ============================================================================= */

@media (max-width: 900px) {
    .page-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        border-bottom: 1px solid var(--gray-200);
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .section-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .section-nav a {
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .section-nav a.active {
        border-left: none;
        border-bottom-color: var(--primary);
    }
}

@media (max-width: 600px) {
    html {
        font-size: 15px;
    }

    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .main-nav {
        gap: 1rem;
    }

    article {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .hero {
        padding: 2.5rem 1.5rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .prev-next {
        flex-direction: column;
        gap: 0.75rem;
    }

    .prev-btn, .next-btn {
        text-align: center;
    }
}

/* =============================================================================
   Print Styles
   ============================================================================= */

@media print {
    .site-header,
    .sidebar,
    .prev-next,
    .site-footer {
        display: none;
    }

    .page-container {
        display: block;
    }

    article {
        box-shadow: none;
        padding: 0;
    }

    a {
        color: inherit;
        text-decoration: underline;
    }

    .citation {
        border-bottom: none;
    }
}
