/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fafafa;
}

/* Color system */
:root {
    --primary-color: rgba(24, 72, 146, 0.98);
    --primary-dark: rgba(14, 71, 161, 0.95);
    --primary-light: rgba(24, 72, 146, 0.1);
    --secondary-color: #64748b;
    --accent-color: #0ea5e9;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

/* Main content */
.main {
    padding: 48px 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 48px;
    align-items: start;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 120px;
    height: fit-content;
}

.table-of-contents {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--neutral-200);
}

.table-of-contents h3 {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin-bottom: 8px;
}

.toc-link {
    color: var(--neutral-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    display: block;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.toc-link:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    transform: translateX(4px);
}

.toc-link.active {
    background: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

/* Content */
.content {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--neutral-200);
}

.content-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 3px solid var(--primary-light);
}

.content-header h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 16px;
    letter-spacing: -0.025em;
}

.meta-info {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.meta-item {
    color: var(--neutral-500);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    background: var(--neutral-100);
    border-radius: 20px;
    border: 1px solid var(--neutral-200);
}

/* Sections */
.section {
    margin-bottom: 48px;
    scroll-margin-top: 120px;
}

.section:last-child {
    margin-bottom: 0;
}

.section h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
}

.section h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 16px;
    margin-top: 32px;
}

.section h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--neutral-700);
    margin-bottom: 12px;
    margin-top: 24px;
}

.section h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--neutral-600);
    margin-bottom: 8px;
    margin-top: 16px;
}

.section p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: var(--neutral-700);
}

.section ol, .section ul {
    margin-bottom: 16px;
    padding-left: 24px;
}

.section li {
    margin-bottom: 8px;
    line-height: 1.7;
    color: var(--neutral-700);
}

.section strong {
    color: var(--primary-color);
    font-weight: 600;
}

.section a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.section a:hover {
    text-decoration: underline;
    color: var(--primary-color);
}

/* Subsections */
.subsection {
    margin-bottom: 32px;
    padding-left: 16px;
    border-left: 3px solid var(--primary-light);
}

.sub-subsection {
    margin-bottom: 24px;
    padding-left: 16px;
    border-left: 2px solid var(--neutral-200);
}

/* Highlight box */
.highlight-box {
    background: linear-gradient(135deg, var(--primary-light), rgba(14, 71, 161, 0.05));
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.highlight-box h3 {
    color: var(--primary-color);
    margin-bottom: 16px;
    margin-top: 0;
}

.highlight-box ul {
    margin-bottom: 0;
}

.highlight-box li {
    color: var(--neutral-700);
    font-weight: 500;
}

/* Contact section */
.contact-info {
    background: var(--neutral-50);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--neutral-200);
    margin: 24px 0;
}

.contact-info h3 {
    color: var(--primary-color);
    margin-bottom: 16px;
    margin-top: 0;
}

.contact-info ul {
    list-style: none;
    padding-left: 0;
}

.contact-info li {
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--neutral-200);
}

.contact-info li:last-child {
    border-bottom: none;
}

/* Definitions */
.definitions {
    display: grid;
    gap: 24px;
}

.definition-item {
    padding: 20px;
    background: var(--neutral-50);
    border-radius: 12px;
    border: 1px solid var(--neutral-200);
    transition: var(--transition);
}

.definition-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.definition-item h3 {
    color: var(--primary-color);
    margin-bottom: 8px;
    margin-top: 0;
    font-size: 16px;
}

.definition-item p {
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.6;
}

/* Responsive design */
@media (max-width: 1024px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .sidebar {
        position: static;
        order: -1;
    }
    
    .table-of-contents {
        max-height: 300px;
        overflow-y: auto;
    }
    
    .content {
        padding: 32px;
    }
    
    .content-header h1 {
        font-size: 28px;
    }
    
    .section h2 {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .content {
        padding: 24px;
    }
    
    .content-header h1 {
        font-size: 24px;
    }
    
    .section h2 {
        font-size: 20px;
    }
    
    .section h3 {
        font-size: 18px;
    }
    
    .meta-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .definitions {
        gap: 16px;
    }
    
    .definition-item {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 24px 0;
    }
    
    .content {
        padding: 16px;
    }
    
    .content-header {
        margin-bottom: 24px;
    }
    
    .content-header h1 {
        font-size: 20px;
    }
    
    .section {
        margin-bottom: 32px;
    }
    
    .section h2 {
        font-size: 18px;
    }
    
    .section h3 {
        font-size: 16px;
    }
    
    .subsection {
        padding-left: 12px;
    }
    
    .sub-subsection {
        padding-left: 12px;
    }
}

/* Smooth scrolling and focus styles */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Focus styles for accessibility */
.toc-link:focus,
.section a:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header,
    .sidebar,
    .footer {
        display: none;
    }
    
    .content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .content {
        box-shadow: none;
        border: none;
    }
    
    .section {
        break-inside: avoid;
    }
}
