:root {
    --bg-color: #f4f1ea;
    --surface-color: rgba(255, 253, 248, 0.5);
    --surface-strong: rgba(255, 253, 248, 0.7);
    --text-main: #181614;
    --text-muted: #6d665e;
    --border-color: rgba(24, 22, 20, 0.12);
    --accent-color: #a85c3b;
    --shadow-soft: 0 10px 30px rgba(24, 22, 20, 0.04);
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Source Serif 4', serif;
    --header-height: 76px;
    --content-width: 1040px;
    --transition-smooth: 220ms ease;
}

[data-theme="dark"] {
    --bg-color: #151515;
    --surface-color: rgba(29, 29, 29, 0.55);
    --surface-strong: rgba(29, 29, 29, 0.82);
    --text-main: #f2efe8;
    --text-muted: #afa79d;
    --border-color: rgba(242, 239, 232, 0.1);
    --accent-color: #f2d2b7;
    --shadow-soft: 0 24px 60px rgba(0, 0, 0, 0.28);
}

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

html {
    font-size: 17px;
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

body {
    background: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.35s ease, color 0.35s ease;
}

a {
    color: inherit;
    text-decoration: none;
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: color-mix(in srgb, var(--bg-color) 86%, transparent);
    border-bottom: 1px solid var(--border-color);
}

.header-inner,
.page-shell {
    width: min(calc(100% - 2rem), var(--content-width));
    margin: 0 auto;
}

.header-inner {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    box-shadow: 0 6px 18px rgba(24, 22, 20, 0.08);
    flex: 0 0 auto;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav a {
    color: var(--text-muted);
    font-size: 0.92rem;
    transition: color var(--transition-smooth);
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--text-main);
}

.theme-switch {
    display: inline-block;
    position: relative;
    width: 42px;
    height: 24px;
}

.theme-switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;
    background: var(--text-main);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.35s ease;
}

.slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    border-radius: 50%;
    background: var(--bg-color);
    transition: transform 0.35s ease, background-color 0.35s ease;
}

[data-theme="dark"] .slider {
    background: #f2efe8;
}

[data-theme="dark"] .slider::before {
    background: #151515;
    transform: translateX(18px);
}

.page-shell {
    padding: 3rem 0 4.5rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.archive-hero {
    text-align: center;
}

.archive-hero > div {
    max-width: 68ch;
    margin-inline: auto;
}

.archive-hero .hero-copy {
    margin-inline: auto;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.eyebrow::before {
    content: "";
    width: 30px;
    height: 1px;
    background: var(--border-color);
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(4rem, 10vw, 6.8rem);
    font-weight: 600;
    line-height: 0.9;
    letter-spacing: -0.05em;
    max-width: 9ch;
}

.hero-copy {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 54ch;
    margin-top: 1rem;
}

.intro-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.35rem;
}

.intro-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-main);
    font-size: 0.9rem;
    transition: background-color var(--transition-smooth), border-color var(--transition-smooth), color var(--transition-smooth);
}

.social-link:hover,
.social-link:focus-visible {
    background: var(--surface-strong);
    border-color: rgba(168, 92, 59, 0.28);
    color: var(--accent-color);
}

.sections {
    display: grid;
    gap: 1rem;
}

.content-card {
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
}

.section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.section-head h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    font-weight: 600;
    letter-spacing: -0.04em;
}

.section-kicker {
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.about-grid p {
    color: var(--text-muted);
}

.notes-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.note {
    padding: 0.95rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
}

.note strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.note span {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.essay-grid,
.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.projects-archive .project-grid {
    width: 100%;
    max-width: 920px;
    margin-inline: auto;
}

.archive-stack {
    display: grid;
    gap: 1.05rem;
    width: 100%;
    max-width: 920px;
    margin-inline: auto;
}

.writing-archive .essay-grid {
    width: 100%;
    max-width: 920px;
    margin-inline: auto;
}

.section-link-row {
    margin-top: 1rem;
}

.essay-card,
.project-card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1.2rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: transparent;
    height: 100%;
    transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

.essay-card:hover,
.project-card:hover {
    background: var(--surface-color);
    border-color: rgba(168, 92, 59, 0.28);
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.card-copy {
    color: var(--text-muted);
    max-width: 58ch;
}

.card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--accent-color);
    font-size: 0.92rem;
    margin-top: auto;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.78rem;
}

@media (max-width: 980px) {
    .essay-grid,
    .project-grid {
        grid-template-columns: 1fr;
    }

    .projects-archive .project-grid {
        max-width: none;
    }

    .archive-stack {
        max-width: none;
    }

    .writing-archive .essay-grid {
        max-width: none;
    }

    .writing-archive .archive-stack {
        max-width: none;
    }

    .notes-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .section-head {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .header-inner {
        min-height: auto;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        row-gap: 0.85rem;
        padding: 0.85rem 0;
    }

    .brand-name {
        font-size: 1.14rem;
        font-weight: 500;
        letter-spacing: -0.02em;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
        align-items: center;
        padding-top: 0.75rem;
        border-top: 1px solid var(--border-color);
    }

    .site-nav {
        flex: 1;
        flex-wrap: wrap;
        gap: 0.6rem 1rem;
    }

    .site-nav a {
        font-size: 0.88rem;
        line-height: 1.2;
    }

    .page-shell {
        padding: 2.25rem 0 4rem;
    }

    .content-card {
        padding: 1.2rem 0;
    }

    .hero {
        margin-bottom: 2.25rem;
    }

    .archive-hero {
        text-align: left;
    }

    .archive-hero > div {
        max-width: none;
        margin-inline: 0;
    }

}
