:root {
    --bg-primary: #faf9f7;
    --bg-secondary: #f5f3f0;
    --bg-tertiary: #ebe8e4;
    --text-primary: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #6b6b6b;
    --accent-primary: #7c5e3c;
    --accent-secondary: #a67c52;
    --accent-vibrant: #c9a66b;
    --border-color: #ddd8d0;
    --blockquote-bg: #f0ece6;
    --blockquote-border: #c9a66b;
    --table-header-bg: #ebe8e4;
    --table-row-alt: #f8f6f3;
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1f;
    --bg-secondary: #232328;
    --bg-tertiary: #2d2d35;
    --text-primary: #e8e6e3;
    --text-secondary: #b8b5b0;
    --text-muted: #8a8780;
    --accent-primary: #c9a66b;
    --accent-secondary: #dbb987;
    --accent-vibrant: #e8c992;
    --border-color: #3d3d45;
    --blockquote-bg: #252530;
    --blockquote-border: #c9a66b;
    --table-header-bg: #2d2d35;
    --table-row-alt: #252528;
    --shadow-light: rgba(0, 0, 0, 0.2);
    --shadow-medium: rgba(0, 0, 0, 0.3);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 10px var(--shadow-light);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.theme-toggle svg {
    color: var(--accent-primary);
    transition: opacity var(--transition-speed);
}

.sun-icon {
    display: none;
}

.moon-icon {
    display: block;
}

[data-theme="dark"] .sun-icon {
    display: block;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform var(--transition-speed);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
}

.sidebar-header h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-primary);
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    transition: color var(--transition-speed);
}

.sidebar-close:hover {
    color: var(--text-primary);
}

.nav-list {
    list-style: none;
    padding: 1rem 0;
}

.nav-list li {
    padding: 0;
}

.nav-list a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all var(--transition-speed);
    border-left: 3px solid transparent;
}

.nav-list a:hover {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-left-color: var(--accent-vibrant);
}

.nav-list a.active {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    border-left-color: var(--accent-vibrant);
    font-weight: 500;
}

.menu-toggle {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 99;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 10px var(--shadow-light);
}

.menu-toggle:hover {
    background: var(--bg-tertiary);
}

.menu-toggle svg {
    color: var(--accent-primary);
}

.content {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

article {
    background: var(--bg-primary);
}

.hero {
    text-align: center;
    padding: 4rem 0 3rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 3rem;
}

.hero h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero .subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.hero .edition {
    font-size: 1rem;
    color: var(--accent-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.hero .edition-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

.hero .date {
    font-size: 0.9rem;
    color: var(--text-muted);
}

section {
    margin-bottom: 4rem;
    padding-top: 2rem;
}

h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-vibrant);
}

h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

h4 {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-secondary);
    margin-top: 2rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

p {
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

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

em {
    font-style: italic;
}

blockquote {
    background: var(--blockquote-bg);
    border-left: 4px solid var(--blockquote-border);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
}

blockquote p {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.15rem;
    font-style: italic;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

blockquote cite {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-style: normal;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

.formula {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.1rem;
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin: 1.5rem 0;
    color: var(--accent-primary);
}

.table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-light);
}

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

thead {
    background: var(--table-header-bg);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--accent-primary);
    border-bottom: 2px solid var(--accent-vibrant);
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

tbody tr:nth-child(even) {
    background: var(--table-row-alt);
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

ul {
    margin: 1rem 0 1.5rem 1.5rem;
}

ul li {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

ul li strong {
    color: var(--accent-primary);
}

.document-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--accent-vibrant);
    text-align: center;
}

.document-footer .date {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.document-footer blockquote {
    background: transparent;
    border-left: none;
    padding: 0;
    max-width: 500px;
    margin: 0 auto;
}

@media (min-width: 1200px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .menu-toggle {
        display: none;
    }
    
    .content {
        margin-left: 320px;
        padding: 4rem 3rem;
    }
    
    .sidebar-close {
        display: none;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 3rem 1.25rem;
    }
    
    .hero {
        padding: 3rem 0 2rem;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero .subtitle {
        font-size: 1rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.2rem;
    }
    
    blockquote {
        padding: 1rem 1.25rem;
    }
    
    blockquote p {
        font-size: 1rem;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    th, td {
        padding: 0.625rem 0.75rem;
    }
    
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
    
    .menu-toggle {
        top: 1rem;
        left: 1rem;
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
    }
}

::selection {
    background: var(--accent-vibrant);
    color: var(--bg-primary);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}
