:root {
    --bg: #fcfcfc;
    --fg: #222;
    --muted: #777;
    --frame: #ccc;
    --gutter: clamp(20px, 6vw, 96px);
    color-scheme: light;
}

/* Dark: follows the system unless the visitor picked a theme with the button. */
:root[data-theme="dark"] {
    --bg: #1c1c1c;
    --fg: #f2f2f2;
    --muted: #999;
    --frame: #444;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #1c1c1c;
        --fg: #f2f2f2;
        --muted: #999;
        --frame: #444;
        color-scheme: dark;
    }
}

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 300 clamp(1.125rem, 0.9rem + 1vw, 1.75rem) / 1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
    transition: background-color 0.2s, color 0.2s;
}

main {
    max-width: 1100px;
    margin: 0 auto;
    padding: clamp(76px, 10vw, 112px) var(--gutter) clamp(48px, 8vw, 96px);
}

.kicker {
    margin: 0 48px clamp(24px, 5vw, 56px) 0; /* clear of the theme button */
    font-size: 0.6em;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ─── Principles ─────────────────────────────────────── */

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

.principles li {
    margin-bottom: clamp(56px, 10vw, 120px);
}


h2 {
    margin: 0 0 0.35em;
    font-family: "Anton", Impact, "Arial Narrow Bold", sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    line-height: 1;
    /* Fallback before the fit-to-width script runs (or without JavaScript). */
    font-size: clamp(2.5rem, 10vw, 7rem);
    overflow-wrap: break-word;
    text-wrap: balance;
}

/* Lines set by js/design.js: each one is sized to fill the column. */
h2.fitted {
    max-width: 100%;
}
h2.fitted .line {
    display: block;
    white-space: nowrap;
    line-height: 0.98;
}

p {
    margin: 0;
    max-width: 42em;
    text-wrap: pretty;
}

/* ─── Author ─────────────────────────────────────────── */

.author {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: clamp(20px, 4vw, 40px);
    padding-top: clamp(32px, 6vw, 64px);
    border-top: 1px solid var(--frame);
    font-size: 0.8em;
}

.author img {
    flex: 0 0 auto;
    width: clamp(140px, 30vw, 230px);
    height: auto;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--frame);
}

.author div {
    flex: 1 1 260px;
    min-width: 0; /* don't let a fitted (nowrap) heading widen the column */
}

.author h2 {
    font-size: clamp(2.25rem, 7vw, 4.5rem);
}

/* ─── Theme toggle ───────────────────────────────────── */

.back-link,
.theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--frame);
    border-radius: 50%;
    background: var(--bg);
    color: var(--fg);
    cursor: pointer;
}
.back-link {
    left: 16px;
    right: auto;
}
.back-link svg,
.theme-toggle svg { width: 20px; height: 20px; }
.back-link:hover,
.theme-toggle:hover { border-color: var(--fg); }
.back-link:focus-visible,
.theme-toggle:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

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

/* ─── Print ──────────────────────────────────────────── */

@media print {
    :root, :root[data-theme="dark"] { --bg: #fff; --fg: #000; --muted: #555; }
    .back-link, .theme-toggle { display: none; }
    main { padding: 0; max-width: none; }
    .principles li { break-inside: avoid; margin-bottom: 32px; }
}
