:root {
    --bg: oklch(0.98 0.01 85);
    --text: oklch(0.15 0.01 50);
    --text-muted: oklch(0.4 0.01 50);
    --link: oklch(0.5 0.15 230);
    --border: oklch(0 0 0 / 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: oklch(0.12 0.015 50);
        --text: oklch(0.85 0.01 80);
        --text-muted: oklch(0.6 0.01 80);
        --link: oklch(0.55 0.15 230);
        --border: oklch(1 0 0 / 0.1);
    }
}

@layer reset {
    html {
        color-scheme: light dark;
        font:
            1rem / 1.5 system-ui,
            sans-serif;
        tab-size: 2;
        hanging-punctuation: first allow-end last;
        word-break: break-word;
    }

    body {
        margin: 0;
        padding: 2rem;
        background: var(--bg);
        color: var(--text);
        @media (width < 500px) {
            padding: 1rem;
        }
    }

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

    h1,
    h2 {
        font-weight: 900;
        letter-spacing: -0.02em;
    }
    h1,
    h2,
    h3 {
        line-height: 1.1;
    }
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        text-wrap: balance;
        margin-block-start: 0;
    }

    p,
    li,
    dd {
        text-wrap: pretty;
        max-inline-size: 65ch;
    }

    a {
        color: var(--link);
        text-decoration: none;
        &:is(:hover, :focus) {
            text-decoration: underline;
            text-underline-offset: 2px;
        }
    }

    ul,
    ol,
    dl {
        margin: 0;
        padding: 0;
        list-style: none;
        ul,
        ol,
        dl {
            padding-inline-start: 2ch;
        }
    }

    img,
    video,
    iframe {
        display: block;
        max-inline-size: 100%;
        block-size: auto;
    }

    pre,
    code,
    kbd,
    samp {
        font-family: ui-monospace, SFMono-Regular, monospace;
    }

    [hidden] {
        display: none !important;
    }

    :focus-visible {
        outline-offset: 2px;
    }

    @media (prefers-reduced-motion: no-preference) {
        html:focus-within {
            scroll-behavior: smooth;
        }
    }
}

main {
    max-inline-size: 640px;
    margin-inline: auto;
}

.site-nav {
    display: flex;
    gap: 1.5ch;
    margin-block-end: 2rem;
    font-size: 0.9em;

    & a {
        color: var(--text-muted);
        &:is(:hover, :focus) {
            color: var(--link);
        }
        &[aria-current="page"] {
            color: var(--text);
        }
    }
}

header {
    margin-block-end: 3rem;

    & > span[aria-hidden] {
        font-size: 2rem;
    }

    & > h1 {
        display: inline;
    }
}

section {
    margin-block-end: 2.5rem;
}

h2 {
    margin-block-end: 0.5rem;
    font-size: 1.125rem;
    text-transform: lowercase;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

li {
    margin-block-end: 0.25rem;
}

.muted {
    color: var(--text-muted);
    font-size: 0.9em;
}

footer {
    margin-block-start: 4rem;
    padding-block-start: 1.5rem;
    border-block-start: 1px solid var(--border);
}

a[rel~="external"]::after {
    content: " ↗";
    font-size: 0.75em;
    vertical-align: super;
    text-decoration: none;
    display: inline-block;
}

/* CV Page Styles */
.cv-page {
    & header {
        margin-block-end: 2rem;
    }
}

.cv-actions {
    display: flex;
    gap: 1ch;
    align-items: center;
}

.print-btn {
    background: none;
    border: none;
    color: var(--link);
    font: inherit;
    cursor: pointer;
    padding: 0;
    &:hover {
        text-decoration: underline;
        text-underline-offset: 2px;
    }
}

.cv-entry {
    margin-block-end: 1.5rem;
}

.cv-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5ch;
}

.cv-entry h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.cv-date {
    color: var(--text-muted);
    font-size: 0.9em;
    white-space: nowrap;
}

.cv-location {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-block: 0.25rem;
}

.cv-contact ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

/* Print Styles */
@media print {
    body {
        padding: 0;
        font-size: 11pt;
    }

    .site-nav,
    .no-print {
        display: none !important;
    }

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

    a[rel~="external"]::after {
        display: none;
    }

    .cv-page header {
        margin-block-end: 1rem;
    }

    section {
        margin-block-end: 1rem;
    }

    h2 {
        margin-block-end: 0.25rem;
    }

    .cv-entry {
        margin-block-end: 0.75rem;
    }
}

.post {
    margin-block-end: 0.75rem;

    & .subtitle {
        display: block;
        color: var(--text-muted);
        font-size: 0.9em;
    }

    &:has(time) {
        display: grid;
        grid-template-columns: 6ch 1fr;
        align-items: baseline;
        gap: 0 0.5ch;

        & time {
            grid-column: 1;
        }

        & a {
            grid-column: 2;
        }

        & .subtitle {
            grid-column: 2;
        }
    }

    &.post--full-date {
        grid-template-columns: 11ch 1fr;
    }
}
