:root {
    /* layout: [TOC] [text column] [sidenote margin], centered as one block */
    --content-width: 600px;
    --toc-width: 200px;
    --toc-gap: 25px;
    --margin-width: 250px;
    /* left edge of the text column; never closer than 300px so the TOC fits */
    --content-left: max(300px, calc(50vw - 312px));

    --color-text: #111;
    --color-muted: #424242;
    --color-link-bg: rgb(245, 245, 245);
}

html {
    font-size: 14px;
}

body {
    margin: 0;
    padding: 0 0 6rem var(--content-left);
    font-family: SourceSerif, serif;
    font-size: 1.3rem;
    line-height: 1.45;
    background-color: #ffffff;
    color: var(--color-text);
}

/* the navbar is fixed, the article starts below it */
article {
    padding-top: 7rem;
}

header,
section {
    width: 100%;
    max-width: var(--content-width);
}

section {
    hyphens: auto;
}

/* Page title block */

h1.title {
    font-weight: normal;
    font-size: 2.8rem;
    line-height: 1.15;
    margin: 2rem 0 0.8rem;
}

p.subtitle {
    font-size: 1.5rem;
    line-height: 1.25;
    color: var(--color-muted);
    margin: 0 0 1rem;
}

p.byline {
    font-family: SourceSans, sans-serif;
    font-size: 1.1rem;
    color: var(--color-muted);
    margin: 0 0 1rem;
}

/* Headings */

h1,
h2,
h3 {
    font-weight: bold;
    line-height: 1.2;
    hyphens: manual;
}

h1 {
    font-size: 2.1rem;
    margin: 3rem 0 1rem;
}

h2 {
    font-size: 1.7rem;
    margin: 2.4rem 0 0.9rem;
}

h3 {
    font-size: 1.4rem;
    margin: 2rem 0 0.8rem;
}

h1>code,
h2>code,
h3>code {
    font-size: 0.8em;
}

/* Text */

p {
    margin: 1rem 0;
}

ol,
ul {
    padding-left: 1.6em;
}

dt:not(:first-child),
li:not(:first-child) {
    margin-top: 0.25rem;
}

a {
    text-decoration: none !important;
    color: inherit;
    background: var(--color-link-bg);
    border-radius: 8px;
}

a:hover {
    transition-property: background;
    transition-duration: 0.2s;
    background: rgb(255, 255, 255);
    border-radius: 8px;
}

hr {
    height: 0;
    border: 0;
    border-top: 1px solid var(--color-muted);
    margin: 2rem 0;
}

blockquote {
    margin: 1.2rem 0;
    padding-left: 1.2rem;
    border-left: 2px solid var(--color-muted);
    color: var(--color-muted);
}

/* Figures */

img {
    max-width: 100%;
}

figure {
    margin: 2rem 0;
}

figure img {
    display: block;
}

figcaption {
    font-family: SourceSans, sans-serif;
    font-size: 1.05rem;
    line-height: 1.3;
    margin-top: 0.6rem;
}

/* large screenshots may extend into the sidenote margin */
figure:has(img.wide) {
    width: calc(100% + var(--margin-width));
    clear: right;
}

figure:has(img.wide) figcaption {
    max-width: var(--content-width);
}
