:root {
    --sans-serif: -apple-system, system-ui, BlinkMacSystemFont, "avenir next", avenir, helvetica, "helvetica neue", ubuntu, roboto, noto, "segoe ui", arial, sans-serif;
    --code: ui-monospace, SFMono-Regular, Menlo, Consolas, Monaco, "Liberation Mono", "Courier New", monospace;
    --header-h: 56px;

    /* Readable line length (~65-75 chars) and a rem type scale that follows the reader's font size. */
    --measure: 34em; /* ~70 chars; ch overcounts because "0" is wider than average glyphs */
    --page-max: 1120px; /* site frame: header, index */
    --wide: 52rem; /* article figures that break out of the measure */
    --text-large-title: 2.125rem; /* 34px */
    --text-title: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem); /* 22-28px, HIG Title 2 -> Title 1 */
    --text-title2: 1.375rem;      /* 22px */
    --text-title3: 1.25rem;       /* 20px */
    --text-headline: 1.0625rem;   /* 17px, weight 600 */
    --text-body: 1.0625rem;       /* 17px, HIG body */
    --text-footnote: 0.8125rem;   /* 13px */
    --text-caption: 0.8125rem;    /* 13px, kept for existing callers */

    /* HIG-style semantic colors. */
    color-scheme: light dark;
    --label: #1d1d1f;
    --secondary-label: rgba(60, 60, 67, 0.6);
    --separator: rgba(60, 60, 67, 0.29);
    --bg: #fff;
    --grouped-bg: #f5f5f7;
    --tint: #0066cc;
    --icon-filter: none;
}

@media (prefers-color-scheme: dark) {
    :root {
        --label: #f5f5f7;
        --secondary-label: rgba(235, 235, 245, 0.6);
        --separator: rgba(84, 84, 88, 0.6);
        --bg: #000;
        --grouped-bg: #1c1c1e;
        --tint: #2997ff;
        --icon-filter: invert(1);
    }
}

body {
    font-family: var(--sans-serif);
    padding: 0;
    margin: 0px;
    padding-top: var(--header-h);
    line-height: 1.5;
    background: var(--bg);
    color: var(--label);
    -webkit-font-smoothing: antialiased;
}

:focus-visible {
    outline: 2px solid var(--tint);
    outline-offset: 2px;
    border-radius: 6px;
}

header {
    background-color: color-mix(in srgb, var(--bg) 80%, transparent);
    border-bottom: 0.5px solid var(--separator);
    -webkit-backdrop-filter: saturate(180%) blur(20px); /* Fixes blur for Safari */
    backdrop-filter: saturate(180%) blur(20px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 100;
}
header nav {
    max-width: var(--page-max); /* matches index .content */
    height: var(--header-h);
    margin: 0 auto;
    padding: 0 clamp(18px, 5vw, 72px); /* same gutter as index .content */
    box-sizing: border-box;
    display: flex;
    align-items: center;
}
header nav ul {
    display: flex;
    flex-direction: row;
    justify-content: right;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}
header nav ul li {
    align-items: center;
    display: inline-flex;
    padding: 0;
}
header nav ul li a {
    color: var(--label);
    font-size: 0.9375rem; /* 15px */
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0 8px;
    box-sizing: border-box;
}
header nav ul li a:hover {
    opacity: 0.7;
}
header nav img {
    width: 20px;
    height: 20px;
    filter: var(--icon-filter);
}
.icon-text {
    display: none;
    margin-left: 6px; /* small spacing between icon and text */
}
.name {
    margin: 0px 0px;
    margin-right: auto;
    padding: 0px 0px;
}
header nav ul li.name a {
    font-size: 1.1875rem; /* 19px */
    font-weight: 600;
    letter-spacing: -0.01em;
    padding-left: 0;
}

@media (prefers-reduced-motion: no-preference) {
    header nav ul li a {
        transition: opacity 0.2s ease;
    }
}

@media (max-width: 800px) {
    :root {
        --header-h: 48px;
    }
    header nav {
        position: relative;
        padding: 0 16px;
    }
    header nav ul li.name a {
        font-size: 1.0625rem;
    }
}

/* Hidden until focused; the first tab stop on every page. */
.skip-link {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 200;
    padding: 8px 14px;
    border-radius: 8px;
    background: var(--tint);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
}
.skip-link:focus {
    transform: none;
}
