/*
 * Sizes are in rem against the browser's default font size, so the user's
 * own text-size preference is respected. Body text scales fluidly from 17px
 * on small phones to 20px on desktop.
 */
:root {
    --font-serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Source Code Pro", Menlo, Consolas, monospace;

    --color-text: #1f1f1f;
    --color-muted: #6b6b6b;
    --color-rule: #e4e4e4;
    --color-code-bg: #f5f5f3;
    --color-accent: #1a5fb4;

    --measure: 40rem;
    --gutter: clamp(1.25rem, 5vw, 2rem);
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
    color: var(--color-text);
    background: #fff;
    font-family: var(--font-serif);
    font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.25rem);
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    font-kerning: normal;
    overflow-wrap: break-word;
}

/* Headings */

h1, h2, h3, h4 {
    font-family: var(--font-sans);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-wrap: balance;
    margin: 2em 0 0.5em;
}
h1 { font-size: 1.75em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.2em; }
h4 { font-size: 1em; }
header + h1,
main > :first-child {
    margin-top: 0;
}

p, ul, ol, dl, pre, figure, .highlight {
    margin: 0 0 1.25em;
}
p { text-wrap: pretty; }

ul, ol { padding-left: 1.5em; }
li + li { margin-top: 0.35em; }

/* Links */

a {
    color: var(--color-accent);
    text-decoration-thickness: 0.06em;
    text-underline-offset: 0.15em;
}
a:hover { text-decoration-thickness: 0.12em; }
a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

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

/* Site header */

header {
    padding: 2.5rem 0 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-rule);
}
.logo {
    font-size: 1.5em;
    margin: 0 0 0.25em;
}
.logo a {
    color: inherit;
    text-decoration: none;
}
.tagline {
    margin: 0;
    color: var(--color-muted);
    font-size: 0.95em;
}

nav ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
nav li {
    display: inline-block;
    margin: 0 1em 0 0;
}

/* Articles */

article {
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-rule);
}
article:last-of-type {
    border-bottom: none;
}
article > h2 {
    margin: 0 0 0.25em;
}
article > h2 a {
    color: inherit;
    text-decoration: none;
}
article > h2 a:hover {
    text-decoration: underline;
}

time {
    display: block;
    color: var(--color-muted);
    font-family: var(--font-sans);
    font-size: 0.8em;
    letter-spacing: 0.02em;
}
time + div {
    margin-top: 1.25em;
}
.modified {
    display: none;
}
article > div > :last-child {
    margin-bottom: 0;
}

.tags {
    font-family: var(--font-sans);
    font-size: 0.8em;
    color: var(--color-muted);
}
.tags a {
    margin-right: 0.5em;
}

/* Code */

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.1em 0.3em;
    background-color: var(--color-code-bg);
    border-radius: 3px;
}

.highlight,
.highlight pre {
    background-color: var(--color-code-bg) !important;
    border-radius: 4px;
}
.highlight pre {
    margin: 0;
    padding: 1em 1.25em;
    overflow-x: auto;
    font-size: 0.8em;
    line-height: 1.5;
}
.highlight pre code {
    padding: 0;
    font-size: inherit;
    background: none;
}

/* Index pages */

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1em;
    font-family: var(--font-sans);
    font-size: 0.9em;
}
.pagination .current {
    color: var(--color-muted);
}

dt {
    color: var(--color-muted);
    font-family: var(--font-sans);
    font-size: 0.8em;
}
dd {
    margin: 0 0 1em;
}

/* Footer */

footer {
    margin: 3rem 0 0;
    padding: 1.5rem 0 2.5rem;
    border-top: 1px solid var(--color-rule);
    color: var(--color-muted);
    font-family: var(--font-sans);
    font-size: 0.8em;
}
footer p {
    margin: 0;
}
