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

:root {
    --bg: #fff;
    --fg: #1a1a1a;
    --fg-muted: #555;
    --fg-light: #888;
    --accent: #2563eb;
    --border: #e5e5e5;
    --font-serif: 'Source Serif 4', Georgia, serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max-width: 1100px;
    --spacing: 60px;
}

html {
    font-size: 18px;
}

body {
    font-family: var(--font-serif);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--fg);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Navigation */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem var(--spacing);
}

.nav-name {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--fg);
}

.nav-name:hover {
    color: var(--accent);
}

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

.nav-links a {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    text-decoration: none;
    color: var(--fg-muted);
}

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

/* Main container */
.site-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem var(--spacing);
}

/* Hero section - two column */
.hero {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 4rem;
    align-items: start;
    margin-bottom: 5rem;
}

.hero-bio {
    /* padding-top: 1rem; */
}

.hero-intro {
    font-size: 1.1rem;
    line-height: 1.7;
}

.hero-intro p {
    margin-bottom: 1rem;
}

.hero-intro p:last-child {
    margin-bottom: 0;
}

.hero-intro strong {
    font-weight: 600;
}

.hero-links {
    margin-top: 2rem;
    display: flex;
    gap: 1.5rem;
}

.hero-links a {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--fg-muted);
    text-decoration: none;
}

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

.hero-photo {
    width: 100%;
    border-radius: 4px;
}

/* Sections */
.section {
    margin-bottom: 4rem;
}

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

.section-title {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--fg-muted);
    margin-bottom: 1.5rem;
}

/* Table of contents style (writing) */
.toc-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    text-decoration: none;
    margin-bottom: 0.75rem;
}

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

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

.toc-title {
    color: var(--fg);
    flex-shrink: 0;
}

.toc-dots {
    flex: 1;
    border: none;
    border-top: 1px dotted var(--fg-light);
    margin: 0;
    opacity: 0.4;
}

.toc-date {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--fg-light);
    flex-shrink: 0;
}

/* Item lists (projects) */
.item {
    margin-bottom: 1.25rem;
}

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

.item a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    text-decoration: none;
}

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

.item-title {
    font-size: 1.1rem;
    color: var(--fg);
}

.item-description {
    font-size: 0.95rem;
    color: var(--fg-muted);
    margin-top: 0.25rem;
    line-height: 1.5;
}

/* Photo grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.photo-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
    display: block;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s;
}

.photo-thumb:hover img {
    opacity: 0.85;
}

/* Empty states */
.empty-state {
    color: var(--fg-light);
    font-style: italic;
}

/* Footer */
.site-footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem var(--spacing) 2rem;
}

.site-footer .updated {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--fg-light);
}

/* Page header (for posts, photos, projects) */
.page-header {
    margin-bottom: 2.5rem;
}

.page-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.page-brand:hover .page-name {
    color: var(--accent);
}

.page-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.page-name {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--fg);
}

/* Single post/project page */
.post {
    max-width: 700px;
}

.post-header {
    margin-bottom: 2.5rem;
}

.post-header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.post-header time {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--fg-light);
}

.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem;
}

.post-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
}

.post-content ul,
.post-content ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content li:last-child {
    margin-bottom: 0;
}

.post-content code {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85em;
    background: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
}

.post-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.875rem;
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-content img {
    width: 100%;
    border-radius: 4px;
    margin: 2rem 0;
}

.post-content blockquote {
    border-left: 3px solid var(--border);
    margin: 1.5rem 0;
    padding: 0.5rem 0 0.5rem 1.5rem;
    color: var(--fg-muted);
    font-style: italic;
}

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

.back-link {
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

/* Moment page */
.moment-page {
    max-width: var(--max-width);
}

.moment-header {
    margin-bottom: 2rem;
}

.moment-header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.moment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--fg-muted);
}

.moment-location {
    color: var(--fg);
    font-weight: 500;
}

.moment-description {
    margin-top: 1.5rem;
    line-height: 1.7;
    color: var(--fg-muted);
}

.moment-description p {
    margin-bottom: 0;
}

.moment-gallery {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.moment-photo {
    margin: 0;
}

.moment-photo img {
    width: 100%;
    border-radius: 4px;
}

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

/* 404 */
.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page h1 {
    font-size: 4rem;
    font-weight: 600;
    color: var(--fg-light);
}

.error-page p {
    margin: 1rem 0;
    color: var(--fg-muted);
}

/* Responsive */
@media (max-width: 900px) {
    :root {
        --spacing: 30px;
    }

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

    .hero-photo {
        max-width: 300px;
        order: -1;
    }

    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    :root {
        --spacing: 20px;
    }

    html {
        font-size: 16px;
    }

    .nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .nav-links {
        gap: 1.25rem;
    }

    .hero-photo {
        max-width: 250px;
    }

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

    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .item a {
        flex-direction: column;
        gap: 0.25rem;
    }
}
