:root {
    --sans: 'Inter', 'system-ui', sans-serif;
    --mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* Dark — Catppuccin Mocha */
[data-theme="dark"] {
    --bg: #1e1e2e;
    --surface: #181825;
    --overlay: #313244;
    --text: #bac2de;
    --text-bright: #cdd6f4;
    --text-dim: #585b70;
    --accent: #b4befe;
    --accent-dim: rgba(180, 190, 254, 0.1);
    --border: rgba(69, 71, 90, 0.6);
}

/* Light — Championship White */
[data-theme="light"] {
    --bg: #f0f0ec;
    --surface: #e6e6e1;
    --overlay: #d8d8d3;
    --text: #3c3c43;
    --text-bright: #1a1a1f;
    --text-dim: #8e8e93;
    --accent: #6c5ce7;
    --accent-dim: rgba(108, 92, 231, 0.08);
    --border: rgba(60, 60, 67, 0.12);
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 24px;
    right: 28px;
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

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

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.page {
    max-width: 860px;
    margin: 0 auto;
    padding: 72px 48px 96px;
}

/* Header */
.header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-weight: 600;
    font-size: 2rem;
    color: var(--text-bright);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.header .tagline {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-dim);
    letter-spacing: 0.06em;
}

/* Navigation */
.nav {
    margin-bottom: 44px;
    font-family: var(--mono);
    font-size: 0.72rem;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

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

.nav a::before {
    content: '/';
    margin-right: 2px;
    color: var(--accent);
    opacity: 0.4;
}

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

/* Sections */
.section {
    margin-bottom: 44px;
}

.section-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Bio */
.bio p {
    margin-bottom: 12px;
    color: var(--text);
    font-size: 0.95rem;
}

.bio a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-dim);
    transition: border-color 0.2s;
}

.bio a:hover {
    border-bottom-color: var(--accent);
}

/* Margin notes */
.margin-note {
    font-family: var(--mono);
    font-size: 0.62rem;
    color: var(--text-dim);
    font-style: normal;
}

/* Items (research, blog entries) */
.item {
    margin-bottom: 20px;
    padding: 14px 0 14px 16px;
    border-left: 2px solid var(--border);
    transition: border-color 0.2s;
}

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

.item:hover {
    border-left-color: var(--accent);
}

.item-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-bright);
    margin-bottom: 2px;
}

.item-title a {
    color: var(--text-bright);
    text-decoration: none;
    transition: color 0.2s;
}

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

.item-meta {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.item-desc {
    font-size: 0.85rem;
    color: var(--text);
    opacity: 0.8;
    line-height: 1.55;
}

.tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.58rem;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 1px 7px;
    border-radius: 3px;
    margin-right: 4px;
    margin-top: 6px;
}

/* Resume link */
.resume-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: all 0.2s;
}

.resume-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.resume-link .arrow {
    transition: transform 0.2s;
}

.resume-link:hover .arrow {
    transform: translateX(3px);
}

/* Contact */
.contact-list {
    list-style: none;
    font-family: var(--mono);
    font-size: 0.75rem;
}

.contact-list li {
    margin-bottom: 8px;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.contact-list .label {
    color: var(--text-dim);
    min-width: 60px;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

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

/* Blog sort controls */
.blog-sort {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.sort-btn {
    font-family: var(--mono);
    font-size: 0.6rem;
    color: var(--text-dim);
    background: none;
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.sort-btn:hover {
    color: var(--text-bright);
    border-color: var(--text-dim);
}

.sort-btn.active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* Scribble decorations */
.scribble {
    display: none;
}

/* Page number */
.page-number {
    position: fixed;
    bottom: 24px;
    right: 32px;
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-dim);
    opacity: 0.3;
}

/* Fade in */
.fade-in {
    opacity: 0;
    transform: translateY(6px);
    animation: fadeUp 0.5s ease forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in:nth-child(1) { animation-delay: 0.03s; }
.fade-in:nth-child(2) { animation-delay: 0.08s; }
.fade-in:nth-child(3) { animation-delay: 0.14s; }
.fade-in:nth-child(4) { animation-delay: 0.2s; }
.fade-in:nth-child(5) { animation-delay: 0.26s; }
.fade-in:nth-child(6) { animation-delay: 0.32s; }
.fade-in:nth-child(7) { animation-delay: 0.38s; }

/* Blog post styles */
.blog-header {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.blog-header h1 {
    font-weight: 600;
    font-size: 1.75rem;
    color: var(--text-bright);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.blog-header .blog-meta {
    font-family: var(--mono);
    font-size: 0.65rem;
    color: var(--text-dim);
}

.blog-back {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s;
    margin-bottom: 32px;
    display: inline-block;
}

.blog-back:hover {
    color: var(--accent);
}

.blog-content h2 {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-bright);
    margin-top: 32px;
    margin-bottom: 12px;
}

.blog-content h3 {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-bright);
    margin-top: 24px;
    margin-bottom: 8px;
}

.blog-content p {
    margin-bottom: 14px;
    font-size: 0.95rem;
    color: var(--text);
}

.blog-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-dim);
    transition: border-color 0.2s;
}

.blog-content a:hover {
    border-bottom-color: var(--accent);
}

.blog-content code {
    font-family: var(--mono);
    font-size: 0.82rem;
    background: var(--accent-dim);
    padding: 2px 5px;
    border-radius: 3px;
    color: var(--text-bright);
}

.blog-content pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.blog-content pre code {
    background: none;
    padding: 0;
    font-size: 0.78rem;
    line-height: 1.6;
}

.blog-content blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 16px;
    margin-bottom: 16px;
    color: var(--text-dim);
    font-style: italic;
}

.blog-content ul,
.blog-content ol {
    margin-bottom: 14px;
    padding-left: 20px;
}

.blog-content li {
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.blog-content img {
    max-width: 100%;
    border-radius: 4px;
    margin: 16px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .page {
        padding: 48px 24px 80px;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .blog-header h1 {
        font-size: 1.4rem;
    }

    .nav {
        gap: 14px;
    }

    .page-number {
        right: 20px;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 32px 16px 64px;
    }
}
