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

:root {
    --accent-color: #4467C4;
    --bg-color: #faf8f3;
    --text-color: #1a1a1a;
    --text-secondary: #2a2a2a;
    --code-bg: #f0f0ea;
    --sidenote-text: #000;
}

[data-theme="dark"] {
    --accent-color: #6b8cdb;
    --bg-color: #1a1a1a;
    --text-color: #e5e5e5;
    --text-secondary: #c5c5c5;
    --code-bg: #2a2a2a;
    --sidenote-text: #e5e5e5;
}

body {
    font-family: 'EB Garamond', 'Palatino', 'Palatino Linotype', 'Book Antiqua', 'Georgia', serif;
    font-size: 19px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Header and Navigation */
header {
    padding: 2rem 0 1rem 0;
    background-color: var(--bg-color);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 3rem;
}

.logo {
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    color: var(--accent-color);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--accent-color);
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.7;
}

/* Main container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem 1.5rem;
}

/* About section */
.about-section {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: 4rem;
    align-items: start;
}

.about-content h1 {
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 0.8rem;
    color: var(--text-color);
    line-height: 1.2;
}

.about-content h2 {
    font-size: 2rem;
    font-weight: 400;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.about-content p {
    margin-bottom: 0.9rem;
    color: var(--text-secondary);
}

.about-content sup {
    font-size: 0.7em;
    color: var(--accent-color);
}

/* Links */
.link-red {
    color: var(--accent-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

.link-red:hover {
    opacity: 0.7;
}

.link-underline {
    color: var(--text-color);
    text-decoration: underline;
    transition: opacity 0.2s;
}

.link-underline:hover {
    opacity: 0.7;
}

/* Projects list */
.projects-list {
    list-style: disc;
    margin-top: 1rem;
    margin-left: 2.5rem;
    padding-left: 0;
}

.projects-list li {
    margin-bottom: 0.8rem;
    color: var(--text-secondary);
    padding-left: 0.2rem;
}

/* Profile image */
.profile-image {
    position: sticky;
    top: 2rem;
}

.profile-image img {
    width: 100%;
    border-radius: 12px;
    display: block;
}

/* Blog post styles */
.blog-post {
    max-width: 1400px;
    position: relative;
}

.blog-post .about-content {
    max-width: 750px;
    margin-left: 4rem;
}

/* Side notes */
.sidenote-ref {
    font-size: 0.6em;
    color: var(--accent-color);
    cursor: pointer;
}

.sidenote {
    position: absolute;
    left: 1000px;
    width: 400px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--sidenote-text);
    padding: 0.5rem 0;
}

.sidenote::before {
    content: attr(data-note-number);
    font-size: 1em;
    color: var(--accent-color);
    margin-right: 0.3em;
}

/* Code blocks */
code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.7em;
    background-color: var(--code-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: var(--text-color);
}

pre {
    background-color: var(--code-bg);
    border-radius: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 1rem 0;
    border-left: 3px solid var(--accent-color);
    border-top: none;
    border-right: none;
    border-bottom: none;
}

pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.7em;
    line-height: 1.5;
}

/* Images in blog posts */
.about-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5rem 0;
    border-radius: 6px;
    display: block;
}

/* Responsive design */
@media (max-width: 1400px) {
    /* Side notes inline on narrower screens */
    .sidenote {
        position: static;
        width: 100%;
        font-size: 0.85rem;
        margin: 0.5rem 0;
        padding: 0.5rem 1rem;
        background-color: var(--code-bg);
        border-left: 2px solid var(--accent-color);
    }

    .blog-post .about-content {
        margin-left: 1.5rem;
    }
}

@media (max-width: 768px) {
    nav {
        padding: 0 1.5rem;
    }

    .container {
        padding: 3rem 1.5rem;
    }

    .about-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .profile-image {
        order: -1;
        max-width: 250px;
        margin: 0 auto;
    }

    .about-content h1 {
        font-size: 2rem;
    }

    .about-content h2 {
        font-size: 1.3rem;
    }

    body {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .logo {
        font-size: 0.85rem;
    }

    .nav-links a {
        font-size: 0.85rem;
    }
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem;
    color: var(--accent-color);
    font-family: inherit;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: opacity 0.2s;
}

.theme-toggle:hover {
    opacity: 0.7;
}
