:root {
    color-scheme: light;
    --paper: #faf8f2;
    --ink: #302c25;
    --gold: #906323;
    --line: #a58b5838;
    --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
    --sans: "Avenir Next", Avenir, "Segoe UI", sans-serif;
    --page-gutter: 64px;
    --page-max-width: 1280px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

code,
kbd,
pre,
samp {
    font-size: 1em;
}

.page {
    position: relative;
    isolation: isolate;
    overflow: clip;
    background:
        radial-gradient(ellipse at 76% 19%, #ffe3a478, transparent 34%),
        radial-gradient(ellipse at 3% 7%, #d8d6e252, transparent 26%),
        radial-gradient(ellipse at 0% 54%, #cfdee078, transparent 34%),
        radial-gradient(ellipse at 98% 67%, #d9d1e373, transparent 32%),
        radial-gradient(ellipse at 47% 100%, #eed49b66, transparent 40%);
}

.page::before,
.page::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    pointer-events: none;
}

/* Fixed-size tiles keep the grain fine on every screen. Never animate the noise. */
.page::before {
    background-image: url("data:image/svg+xml,%3Csvg width='192' height='192' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' seed='21' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 .35 0 0 0 0 .29 0 0 0 0 .22 1.5 0 0 0 -.45'/%3E%3C/filter%3E%3Cpath filter='url(%23grain)' d='M0 0h192v192H0z'/%3E%3C/svg%3E");
    background-size: 192px 192px;
    opacity: 0.16;
    content: "";
}

/* Scattered light gives the background depth. */
.page::after {
    background:
        radial-gradient(ellipse at 86% 23%, #fff9db99, transparent 42%),
        radial-gradient(ellipse at 12% 45%, #e5edf080, transparent 35%),
        linear-gradient(
            118deg,
            transparent 15%,
            #fffdf370 28%,
            transparent 41%,
            #e3d9ed38 53%,
            transparent 67%
        );
    opacity: 0.55;
    content: "";
}

::selection {
    background: #ead6a2;
    color: var(--ink);
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
}

a:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 7px;
}

.skip-link {
    position: absolute;
    z-index: 5;
    top: 1rem;
    left: 1rem;
    padding: 0.75rem 1rem;
    transform: translateY(-200%);
    background: var(--paper);
}

.skip-link:focus {
    transform: translateY(0);
}

.container {
    width: calc(100% - 2 * var(--page-gutter));
    max-width: var(--page-max-width);
    margin-inline: auto;
}

.site-header {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    border-bottom: 1px solid var(--line);
}

.brand {
    --brand-symbol-size: 56px;
    --brand-name-scale: 0.8;
    --brand-gap: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: var(--brand-gap);
    /* Keep the text proportional to the symbol as the logo shrinks. */
    width: calc(
        var(--brand-symbol-size) * (1 + var(--brand-name-scale) * 6636 / 812) + var(--brand-gap)
    );
    max-width: 100%;
    min-width: 0;
    /* Keep the logo row's height independent of the header's bottom border. */
    min-height: 109px;
    text-decoration: none;
}

.brand-symbol {
    flex: 1;
    min-width: 0;
}

.brand-name {
    flex: calc(var(--brand-name-scale) * 6636 / 812);
    min-width: 0;
}

.brand img {
    display: block;
    max-width: 100%;
    height: auto;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h2 {
    text-wrap: balance;
}

.content-page {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
}

.content-page main {
    flex: 1;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding-block: 28px 32px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 0.8rem;
    line-height: 1.7;
}

.site-footer p {
    margin: 0;
}

.site-footer p:last-child {
    white-space: nowrap;
}

@media (max-width: 1000px) {
    :root {
        --page-gutter: 36px;
    }

    .site-header {
        gap: 1rem;
    }
}

@media (max-width: 700px) {
    :root {
        --page-gutter: 24px;
    }

    .brand {
        --brand-symbol-size: 48px;
        --brand-gap: 0.6rem;
        min-height: 93px;
    }

    .site-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
