/*
 * Shared by the hand-written pages. Paper and ink: one column of serif text,
 * one warm accent, and a couple of hand-drawn strokes. Nothing moves.
 */

/* Self-hosted so that no request leaves this site. See fonts/NOTICE.txt. */
@font-face {
    font-family: "Newsreader";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/fonts/newsreader-variable-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Newsreader";
    font-style: italic;
    font-weight: 200 800;
    font-display: swap;
    src: url("/fonts/newsreader-variable-latin-italic.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/inter-variable-latin.woff2") format("woff2");
}

:root {
    --paper: #faf6ef;
    --ink: #2b2723;
    --muted: #7c7368;
    --faint: #d9cfc0;
    --accent: #b4532a;
    --accent-soft: rgba(180, 83, 42, 0.14);

    --serif: "Newsreader", "Iowan Old Style", Charter, Georgia, serif;
    --sans: "Inter", system-ui, -apple-system, sans-serif;

    /* Hand-drawn strokes, used as masks so they take the accent colour. */
    --swash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 14'%3E%3Cpath d='M3 9 C 25 3, 48 3, 70 7 S 105 11, 117 4' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
    --squiggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 12'%3E%3Cpath d='M2 6 q 6 -6 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 12 0 t 6 -3' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #1c1a17;
        --ink: #e9e2d6;
        --muted: #9d9487;
        --faint: #3c372f;
        --accent: #e0895e;
        --accent-soft: rgba(224, 137, 94, 0.18);
    }
}

* {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.25rem;
    line-height: 1.6;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--accent-soft);
}

.page {
    max-width: 38rem;
    margin: 0 auto;
    padding: 3.5rem 1.25rem 2.5rem;
}

/* The pages listing is a list to scan, not text to read, so it gets more room. */
.page-wide {
    max-width: 54rem;
}

.page-wide .lede {
    max-width: 38rem;
}

a {
    color: inherit;
    text-decoration-line: underline;
    text-decoration-color: var(--faint);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover,
a:focus-visible {
    color: var(--accent);
    text-decoration-color: currentColor;
}

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

h1,
h2 {
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 2.4rem;
    margin: 0 0 0.75rem;
}

p {
    margin: 0 0 1.1rem;
}

.muted {
    color: var(--muted);
}

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

/* Elements below set their own display, which would otherwise beat [hidden]. */
[hidden] {
    display: none !important;
}

/* Small uppercase labels: section names, dates, the nav. */
.label,
.site-header nav,
.site-footer,
.meta {
    font-family: var(--sans);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.label {
    display: block;
    margin: 3.5rem 0 1rem;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

/* ---------- Header ---------- */

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 4rem;
}

.site-name {
    position: relative;
    font-size: 1.6rem;
    font-style: italic;
    font-weight: 600;
    text-decoration: none;
}

/* The swash under the name, drawn in the accent colour. */
.site-name::after {
    content: "";
    position: absolute;
    left: -0.1em;
    right: -0.35em;
    bottom: -0.3em;
    height: 0.45em;
    background: var(--accent);
    -webkit-mask: var(--swash) no-repeat center / 100% 100%;
    mask: var(--swash) no-repeat center / 100% 100%;
}

.site-name:hover,
.site-name:focus-visible {
    color: var(--ink);
}

.site-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    font-size: 0.875rem;
}

.site-header nav a {
    color: var(--muted);
    text-decoration: none;
}

.site-header nav a:hover,
.site-header nav a:focus-visible,
.site-header nav a[aria-current="page"] {
    color: var(--accent);
}

/* ---------- Home ---------- */

.lede {
    font-size: 1.35rem;
    color: var(--muted);
}

/* Posts grouped by year, each row a title and date joined by a dotted leader. */
.year {
    display: grid;
    grid-template-columns: 4rem 1fr;
    gap: 0 1rem;
    margin-bottom: 1.25rem;
}

.year h2,
.year h3 {
    margin: 0;
    font-size: 1.05rem;
    font-style: italic;
    font-weight: 500;
    color: var(--accent);
    line-height: 2;
}

.leaders {
    list-style: none;
    margin: 0;
    padding: 0;
}

.leaders li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    line-height: 1.5;
    padding: 0.2rem 0;
}

.leaders li::after {
    content: "";
    order: 1;
    flex: 1 1 1rem;
    min-width: 1rem;
    border-bottom: 1px dotted var(--faint);
    transform: translateY(-0.3em);
}

.leaders a {
    text-decoration: none;
}

.leaders .meta {
    order: 2;
    flex: none;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.leaders .note {
    order: 2;
    flex: none;
    font-style: italic;
    color: var(--muted);
}

.more {
    margin-top: 0.5rem;
    font-style: italic;
}

/* ---------- Pages listing ---------- */

.search {
    margin: 2.5rem 0 3rem;
}

.search input {
    width: 100%;
    padding: 0.4rem 0;
    border: 0;
    border-bottom: 1px solid var(--faint);
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-style: italic;
    -webkit-appearance: none;
    appearance: none;
}

.search input::placeholder {
    color: var(--muted);
}

.search input:focus {
    outline: none;
    border-bottom-color: var(--accent);
}

.archive .year {
    margin-bottom: 2rem;
}

/* ---------- Apps ---------- */

.app {
    margin: 0 0 2.5rem;
}

.app h2 {
    font-size: 1.6rem;
    margin: 0 0 0.35rem;
}

.app h2 a {
    text-decoration: none;
}

.app p {
    margin-bottom: 0.35rem;
}

/* ---------- Contact ---------- */

.letter {
    font-size: 1.35rem;
}

.address {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem 1rem;
    margin: 2rem 0;
}

.address a {
    font-size: 1.9rem;
    font-style: italic;
    color: var(--accent);
    text-decoration-color: var(--accent-soft);
    text-decoration-thickness: 2px;
}

.text-button {
    font: inherit;
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--muted);
    background: none;
    border: 1px solid var(--faint);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    cursor: pointer;
}

.text-button:hover,
.text-button:focus-visible {
    color: var(--accent);
    border-color: var(--accent);
}

.signoff {
    margin-top: 2.5rem;
    font-style: italic;
}

/* ---------- Privacy ---------- */

.prose h2 {
    font-size: 1.35rem;
    margin: 2.5rem 0 0.6rem;
}

.prose section p {
    font-size: 1.15rem;
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: 5rem;
    text-align: center;
    color: var(--muted);
}

.site-footer::before {
    content: "";
    display: block;
    width: 5rem;
    height: 0.6rem;
    margin: 0 auto 1.5rem;
    background: var(--faint);
    -webkit-mask: var(--squiggle) no-repeat center / 100% 100%;
    mask: var(--squiggle) no-repeat center / 100% 100%;
}

.site-footer a {
    color: var(--muted);
}

.site-footer .thanks {
    margin-bottom: 0.4rem;
    font-family: var(--serif);
    font-size: 1.1rem;
    font-style: italic;
    letter-spacing: 0;
}

/* ---------- Small screens ---------- */

@media (max-width: 520px) {
    body {
        font-size: 1.15rem;
    }

    .page {
        padding-top: 2.5rem;
    }

    .site-header {
        margin-bottom: 3rem;
    }

    .year {
        grid-template-columns: 1fr;
    }

    .year h2,
    .year h3 {
        line-height: 1.6;
    }

    .address a {
        font-size: 1.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    a {
        transition: none;
    }
}
