:root {
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
    --text: #1a1a1a;
    --text-muted: #444;
    --bg: #fafafa;
    --bg-alt: #f0f0f2;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #d4d4d8;
    --header-h: 3.5rem;
    --space: clamp(1rem, 4vw, 1.75rem);
    --max-w: 72rem;
    --article-max: 46rem;
    --radius: 0.5rem;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --text: #f4f4f5;
        --text-muted: #b4b4bc;
        --bg: #18181b;
        --bg-alt: #27272a;
        --border: #3f3f46;
        --shadow: 0 1px 3px rgb(0 0 0 / 0.35);
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
}

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

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.15em;
}

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

.skip-link {
    position: absolute;
    left: var(--space);
    top: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    transform: translateY(-120%);
    transition: transform 0.2s ease;
    z-index: 100;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.container {
    width: min(100% - 2 * var(--space), var(--max-w));
    margin-inline: auto;
}

main .article.container {
    width: min(100% - 2 * var(--space), var(--article-max));
}

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

.site-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: var(--header-h);
    width: min(100% - 2 * var(--space), var(--max-w));
    margin-inline: auto;
    padding-block: 0.5rem;
}

.logo {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

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

.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
}

.nav-toggle__bar {
    display: block;
    width: 1.25rem;
    height: 2px;
    margin-inline: auto;
    background: var(--text);
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    max-height: 0;
    overflow: hidden;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: max-height 0.25s ease;
}

.site-nav.is-open {
    max-height: 20rem;
}

.site-nav__list {
    list-style: none;
    margin: 0;
    padding: 1rem var(--space) 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-nav__list a {
    display: block;
    padding: 0.5rem 0;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

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

@media (min-width: 48rem) {
    .nav-toggle {
        display: none;
    }

    .site-nav {
        position: static;
        max-height: none;
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .site-nav__list {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
        gap: 0.75rem 1.25rem;
        padding: 0;
        max-width: 28rem;
    }

    .site-nav__list a {
        font-size: 0.9rem;
    }
}

.article {
    padding-block: clamp(1.5rem, 4vw, 2.75rem);
}

.article__header {
    padding-bottom: clamp(1.5rem, 4vw, 2.25rem);
    margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
    border-bottom: 1px solid var(--border);
}

.article h1 {
    margin: 0 0 0.65em;
    font-size: clamp(1.65rem, 4.5vw, 2.15rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.article__intro {
    margin: 0;
    font-size: clamp(1rem, 2.2vw, 1.125rem);
    color: var(--text-muted);
    line-height: 1.55;
}

.article-section {
    padding-bottom: clamp(2rem, 5vw, 3rem);
    margin-bottom: clamp(1.5rem, 4vw, 2.25rem);
    border-bottom: 1px solid var(--border);
}

.article-section:last-of-type {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.article-section h2 {
    margin: 0 0 1rem;
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    font-weight: 700;
    line-height: 1.25;
}

.article-section h3 {
    margin: 1.35em 0 0.5em;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.article-section h3:first-of-type {
    margin-top: 0;
}

.article-section p {
    margin: 0 0 1em;
    max-width: none;
    color: var(--text);
}

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

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: auto;
}

.site-footer__inner {
    text-align: center;
}

.site-footer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

main {
    flex: 1;
}
