@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   Variables
   ============================================ */

:root {
    --bg: #fafafa;
    --text: #1a1a1a;
    --text-secondary: #4a4a4a;
    --text-muted: #8a8a8a;
    --accent: #3872e9;
    --accent-hover: #5a8df0;
    --border: #e5e5e5;
    --border-light: #f0f0f0;
    --code-bg: #f4f4f4;
    --tag-bg: #eee;
}

[data-theme="dark"] {
    --bg: #161616;
    --text: #d4d4d4;
    --text-secondary: #a0a0a0;
    --text-muted: #666;
    --accent: #6a9ef5;
    --accent-hover: #8bb4fa;
    --border: #282828;
    --border-light: #1f1f1f;
    --code-bg: #1c1c1c;
    --tag-bg: #222;
}

/* ============================================
   Reset & Base
   ============================================ */

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 16px;
    font-weight: 300;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Layout
   ============================================ */

.container {
    max-width: 740px;
    margin: 0 auto;
    padding: 3.5rem 2rem 4rem;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   Header
   ============================================ */

.site-header {
    margin-bottom: 0.5rem;
}

.site-title {
    font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
    font-weight: 600;
    font-size: 1.65rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-image: none;
    transition: color 0.2s;
}

.site-title:hover {
    color: var(--accent);
}

.site-icon {
    flex-shrink: 0;
    transition: color 0.2s;
}

/* ============================================
   Navigation
   ============================================ */

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.6rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

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

.site-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    letter-spacing: 0.015em;
    background-image: none;
    transition: color 0.2s;
    padding-bottom: 2px;
    border-bottom: 1.5px solid transparent;
}

.site-nav a:hover {
    color: var(--text-secondary);
}

.site-nav a.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* Header controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.theme-toggle:hover {
    color: var(--text);
}

/* ============================================
   Search
   ============================================ */

#search-input {
    width: 50px;
    padding: 0;
    font-size: 0.8rem;
    font-family: inherit;
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: width 0.3s ease, color 0.2s;
    cursor: pointer;
}

#search-input::placeholder {
    color: var(--text-muted);
    transition: color 0.2s;
}

#search-input:hover::placeholder {
    color: var(--text-secondary);
}

#search-input:focus {
    outline: none;
    width: 140px;
    cursor: text;
    color: var(--text);
}

#search-input:focus::placeholder {
    color: transparent;
}

#search-results {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 240px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-top: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    z-index: 100;
}

[data-theme="dark"] #search-results {
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

#search-results a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text);
    text-decoration: none;
    background-image: none;
    font-size: 0.85rem;
    transition: background 0.15s;
}

#search-results a:hover {
    background: var(--border-light);
}

#search-results .no-results {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   Typography
   ============================================ */

h1 {
    font-family: 'Inter', sans-serif;
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--text);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.content h1 {
    font-size: 1.3rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.15rem;
    line-height: 1.35;
    margin-top: 2.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

h3 {
    font-weight: 600;
    font-size: 1.05rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

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

p {
    margin-bottom: 1.2em;
}

strong {
    font-weight: 700;
}

em {
    font-style: italic;
}

/* ============================================
   Content
   ============================================ */

.content {
    font-size: 1.06rem;
    line-height: 1.85;
}

.content a {
    text-decoration-line: underline;
    text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    background-image: none;
}

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

/* ============================================
   Homepage
   ============================================ */

.about-content {
    margin-bottom: 0;
}

.about-content p:last-child {
    margin-bottom: 0;
}

.home-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.section-heading {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.home-posts {
    list-style: none;
    padding: 0;
}

.home-posts li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.home-posts time {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 4.5rem;
}

.home-posts a {
    text-decoration: none;
    background-image: none;
}

.home-posts a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.section-more {
    margin-top: 1rem;
    font-size: 0.88rem;
}

.section-more a {
    color: var(--text-muted);
    text-decoration: none;
    background-image: none;
    transition: color 0.2s;
}

.section-more a:hover {
    color: var(--accent);
}

/* ============================================
   Blog Post (single)
   ============================================ */

.post-meta {
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.reading-time {
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border);
}

article header {
    margin-bottom: 1.5rem;
}

article header h1 {
    margin-bottom: 0.25rem;
}


/* ============================================
   Blog List
   ============================================ */

.home-post {
    margin-bottom: 1rem;
}

.home-post h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.home-post h2 a {
    color: var(--text);
    text-decoration: none;
    background-image: none;
    transition: color 0.2s;
}

.home-post h2 a:hover {
    color: var(--accent);
}

.post-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3rem 0;
}

.post-divider:last-of-type {
    display: none;
}

/* ============================================
   Tags
   ============================================ */

.tags {
    margin-top: 0.75rem;
}

.tag {
    display: inline-block;
    font-size: 0.76rem;
    color: var(--text-muted);
    background: var(--tag-bg);
    padding: 0.15em 0.55em;
    border-radius: 3px;
    margin-right: 0.3rem;
    margin-bottom: 0.3rem;
    text-decoration: none;
    background-image: none;
    transition: color 0.2s, background 0.2s;
}

.tag:hover {
    color: var(--text-secondary);
    background: var(--border);
}

/* ============================================
   Blockquotes & Pull Quotes
   ============================================ */

blockquote {
    font-style: italic;
    border-left: 2px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1.75rem 0;
    color: var(--text-secondary);
}

blockquote p:last-child {
    margin-bottom: 0;
}

.pull-quote, blockquote.pull {
    font-family: 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
    font-size: 1.3em;
    font-weight: 500;
    font-style: italic;
    text-align: center;
    border: none;
    border-left: none;
    padding: 1.5rem 2rem;
    margin: 2.5rem 0;
    color: var(--text);
}

/* ============================================
   Lists
   ============================================ */

ul, ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.35rem;
}

/* ============================================
   Code
   ============================================ */

code {
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15em 0.35em;
    border-radius: 3px;
}

pre {
    background: var(--code-bg);
    padding: 1.25rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
}

pre code {
    background: none;
    padding: 0;
}

/* ============================================
   Tables
   ============================================ */

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

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

th {
    font-weight: 600;
    border-bottom-width: 2px;
}

tr:hover td {
    background: var(--border-light);
}

/* ============================================
   Papers Page
   ============================================ */

.content ul {
    list-style: none;
    padding-left: 0;
    margin-top: 0;
}

.content h1 + ul,
.content h2 + ul {
    margin-top: 0;
}

.content ul li {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
    line-height: 1.6;
}

.content ul li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.content ul li a:first-child {
    font-weight: 500;
}

.content ul li em {
    color: var(--text-secondary);
}

/* Restore bullets inside blog posts */
.blog-post .content ul {
    list-style: disc;
    padding-left: 1.5rem;
}

.blog-post .content ul li {
    margin-bottom: 0.35rem;
    padding-bottom: 0;
    border-bottom: none;
}

/* ============================================
   Notes Listing
   ============================================ */

.note-entry {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
}

.note-entry:last-child {
    border-bottom: none;
}

.note-entry h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.note-entry h2 a {
    color: var(--text);
    text-decoration: none;
    background-image: none;
    transition: color 0.2s;
}

.note-entry h2 a:hover {
    color: var(--accent);
}

.note-entry .post-meta {
    margin-bottom: 0.4rem;
}

.note-excerpt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 0;
}

/* ============================================
   Post List (simple)
   ============================================ */

.post-list {
    list-style: none;
    padding: 0;
}

.post-list li {
    margin-bottom: 0.6rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.post-list time {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.post-list a {
    text-decoration: none;
    background-image: none;
}

.post-list a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ============================================
   Archive
   ============================================ */

.archive-year {
    font-family: 'Inter', sans-serif;
    font-size: 1.4rem;
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}

.archive-year:first-of-type {
    margin-top: 0;
}

.archive-list {
    list-style: none;
    padding: 0;
}

.archive-list li {
    margin-bottom: 0.5rem;
    display: flex;
    gap: 1rem;
}

.archive-list time {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    width: 4.5rem;
}

.archive-list a {
    text-decoration: none;
    background-image: none;
}

.archive-list a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ============================================
   Related Posts
   ============================================ */

.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-posts h3 {
    font-family: 'Inter', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.related-posts ul {
    list-style: none;
    padding: 0;
}

.related-posts li {
    margin-bottom: 0.4rem;
}

.related-posts a {
    text-decoration: none;
    background-image: none;
}

.related-posts a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ============================================
   Post Footer
   ============================================ */

.post-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.post-footer a {
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text-muted);
    background-image: none;
    transition: color 0.2s;
}

.post-footer a:hover {
    color: var(--accent);
}

/* ============================================
   Site Footer
   ============================================ */

.site-footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    background-image: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-copy {
    font-size: 0.8rem;
}

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

@media (max-width: 600px) {
    body {
        font-size: 16px;
    }

    .container {
        padding: 1.75rem 1.25rem 3rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .site-title {
        font-size: 1.4rem;
    }

    .header-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .site-nav {
        gap: 1.25rem;
    }

.pull-quote, blockquote.pull {
        font-size: 1.15em;
        padding: 1rem;
    }

    .home-posts li {
        flex-direction: column;
        gap: 0;
        margin-bottom: 0.75rem;
    }

    .post-list li {
        flex-direction: column;
        gap: 0;
    }

    .archive-list li {
        flex-direction: column;
        gap: 0;
    }
}
