/* ═══ Self-hosted type ═══
   Variable woff2, latin subset, roman and italic. Served from our own origin so
   no third party is contacted to render a page — which also means the privacy
   policy does not have to account for one. */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/source-serif-4-roman.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/source-serif-4-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/source-sans-3-roman.woff2") format("woff2");
}

/* ═══════════════════════════════════════════════════════════
   Millfield — base stylesheet
   Owns :root. Every other sheet extends this and never restates
   a palette value. No brand hex may appear outside :root.
   Canon: BRAND.md §6 (Palette Lock), CLAUDE.md (design system).
   ═══════════════════════════════════════════════════════════ */

:root {
  /* ── Palette Lock — raw values, never referenced by component rules ── */
  --storm-sky: #4A4653;
  --slate:     #2B2E33;
  --steel:     #8C9196;
  --field:     #5A6B4A;
  --cornstalk: #C4A661;
  --loam:      #4A3B30;
  --amber:     #E8B067;
  --bone:      #E4E1D9;

  /* ── Semantic — what component rules actually use ── */
  --bg:          var(--slate);
  --surface:     var(--storm-sky);
  --text:        var(--bone);
  --text-lead:   color-mix(in srgb, var(--bone) 90%, var(--steel));   /* 9.8:1 on slate */
  --text-muted:  #9BA0A5;                                             /* 5.2:1 on slate */

  /* #9BA0A5 is only 3.5:1 on storm sky and fails AA there. Anything muted
     sitting on a raised surface must use this instead — 5.1:1 on storm sky. */
  --text-muted-on-surface: color-mix(in srgb, var(--bone) 60%, var(--steel));

  --rule:            color-mix(in srgb, var(--steel) 32%, transparent);  /* hairlines only, 1.6:1 */
  --rule-carrying:   color-mix(in srgb, var(--steel) 76%, transparent);  /* rules that separate meaning, 3.1:1 */
  --rule-strong:     color-mix(in srgb, var(--steel) 78%, transparent);  /* control borders, 3.2:1 — WCAG 1.4.11 */
  --rule-on-surface: color-mix(in srgb, var(--bone) 52%, transparent);   /* control borders on storm sky, 3.2:1 */

  --accent:      var(--amber);                                 /* CTA + lit-window motif ONLY */
  --accent-ink:  var(--slate);                                 /* text on an amber fill */

  /* The one value not drawn from the Palette Lock, and deliberately so: a cast
     shadow is an absence of light rather than a color, and slate — the darkest
     locked value — is also the canvas, so a locked shadow on the canvas is a
     no-op. Declared here so it stays auditable. */
  --shadow-cast: color-mix(in srgb, black 45%, transparent);

  /* ── Type ──
     Source Serif 4 for the world's voice, Source Sans 3 for interface.
     Same superfamily, so they harmonize without being twins. The serif has
     sturdy stems that survive light-on-dark, where high-contrast hairlines
     bloom and thin out. */
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans:  "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Set larger than feels necessary — the engaged cohort skews older and it
     costs nothing at 45. Body floor is 18px. */
  --text-xs:   0.9375rem;
  --text-sm:   1.0625rem;
  --text-base: clamp(1.125rem, 0.4vw + 1.05rem, 1.25rem);
  --text-lg:   clamp(1.25rem, 0.6vw + 1.13rem, 1.4rem);
  --text-xl:   clamp(1.5rem, 1.1vw + 1.28rem, 1.85rem);
  --text-2xl:  clamp(1.9rem, 2vw + 1.5rem, 2.6rem);
  --text-3xl:  clamp(2.4rem, 3.6vw + 1.6rem, 3.9rem);

  --leading-tight: 1.16;
  --leading-snug:  1.35;
  --leading-body:  1.65;

  --measure:      64ch;   /* long-form reading */
  --measure-tight: 46ch;  /* headlines, pull quotes */

  /* ── Space ── */
  --space-2xs: 0.35rem;
  --space-xs:  0.6rem;
  --space-sm:  1rem;
  --space-md:  1.6rem;
  --space-lg:  2.6rem;
  --space-xl:  clamp(3.5rem, 6vw, 6rem);
  --space-2xl: clamp(5rem, 10vw, 9rem);

  --radius-sm: 3px;
  --radius-md: 6px;

  --container: 68rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);

  /* ── Motion — slow fades, nothing springy. Weather, not an app. ── */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 140ms;
  --dur: 320ms;
  --dur-slow: 620ms;
}

/* ═══ Reset ═══ */

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

* { margin: 0; }

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

p, h1, h2, h3, h4, li, figcaption { overflow-wrap: break-word; }

/* ═══ Headings — the world's voice ═══ */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--leading-tight);
  text-wrap: balance;
  max-width: var(--measure-tight);
}

h1 { font-size: var(--text-3xl); letter-spacing: -0.015em; }
h2 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { max-width: var(--measure); text-wrap: pretty; }

p + p { margin-top: var(--space-sm); }

/* ═══ Interface voice ═══ */

.ui,
nav,
button,
.button,
.button-quiet,
.label,
.meta {
  font-family: var(--font-sans);
}

.label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* .label is an eyebrow. When it is pressed into service as a section heading it
   stops being metadata and must not render smaller than the prose under it. */
h2.label,
h3.label {
  font-size: var(--text-sm);
  color: var(--text);
}

/* ═══ Links ═══
   Amber is reserved for the CTA and the lit window, so body links are
   underlined rather than colored. */

a {
  color: inherit;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.18em;
  text-decoration-thickness: from-font;
  transition: text-decoration-color var(--dur) var(--ease);
}

a:hover { text-decoration-color: currentColor; }

/* ═══ Focus — focus IS the lit window ═══ */

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

:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  z-index: 100;
  transform: translateY(-120%);
  padding: var(--space-xs) var(--space-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: transform var(--dur) var(--ease);
}

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

/* ═══ Buttons ═══
   One amber fill per view. If a second primary action appears on the same
   screen, one of them is wrong — use .button-quiet. */

.button,
.button-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 3rem;                 /* generous target */
  padding: 0.75rem 1.6rem;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}

.button {
  background: var(--accent);
  color: var(--accent-ink);         /* 7.0:1 */
}

.button:hover {
  background: color-mix(in srgb, var(--amber) 88%, var(--bone));
}

.button-quiet {
  background: transparent;
  color: var(--text);
  border-color: var(--rule-strong);
}

.button-quiet:hover {
  border-color: var(--text);
  background: color-mix(in srgb, var(--bone) 6%, transparent);
}

/* ═══ Layout ═══ */

.container {
  width: min(var(--container), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

.section {
  padding-block: var(--space-xl);
  border-top: 1px solid var(--rule);
}

.section:first-of-type { border-top: 0; }

.surface {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
}

/* ═══ Quotes — the world's voice, not decoration ═══ */

blockquote {
  max-width: var(--measure-tight);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  border-left: 2px solid var(--rule-carrying);
  padding-left: var(--space-md);
}

blockquote cite {
  display: block;
  margin-top: var(--space-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-style: normal;
  color: var(--text-muted-on-surface);
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin-block: var(--space-lg);
}

/* ═══ Motion preference ═══
   "Reduced" is close to the default register anyway. */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ═══ Shell primitives — shared by every page ═══ */

.masthead {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  padding-block: var(--space-md);
}

.wordmark {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.masthead nav a,
.colophon a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.masthead nav ul {
  display: flex;
  gap: var(--space-md);
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
  font-size: var(--text-sm);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

.actions__note {
  flex-basis: 100%;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.figure-wide { margin: var(--space-lg) 0; }

.figure-wide img {
  width: 100%;
  border-radius: var(--radius-md);
}

.list-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  max-width: 34rem;
}

.list-form label {
  flex-basis: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.list-form input[type="email"] {
  flex: 1 1 16rem;
  min-height: 3rem;
  padding: 0.65rem var(--space-sm);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
}

.list-form input::placeholder { color: var(--text-muted); }

.colophon {
  padding-block: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  justify-content: space-between;
}

.colophon ul {
  display: flex;
  gap: var(--space-md);
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
}

/* ═══ The shelf — a list of books with honest status ═══ */

.shelf {
  margin: var(--space-lg) 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-md);
}

.shelf li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-xs) var(--space-sm);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--rule);
}

.shelf__title { font-size: var(--text-lg); font-weight: 600; }

.shelf__status {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ═══ Consent banner ═══
   Markup is generated by analytics.js. It appears once, on first visit, and
   is reopened from the "Cookie choices" link in the footer. */

.consent-banner {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 90;
  padding: var(--gutter);
  display: flex;
  justify-content: center;
}

.consent-banner[hidden] { display: none; }

.consent-banner__card {
  width: min(42rem, 100%);
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--rule-on-surface);
  border-radius: var(--radius-md);
  box-shadow: 0 24px 70px var(--shadow-cast);
}

.consent-banner__eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted-on-surface);
}

.consent-banner__title {
  margin-top: var(--space-2xs);
  font-size: var(--text-xl);
  max-width: none;
}

.consent-banner__copy {
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  max-width: none;
}

.consent-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* A sentence with a link in it, not a label — so no tracking, no caps. */
.consent-banner__fine-print {
  margin-top: var(--space-sm);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-muted-on-surface);
  max-width: none;
}

@keyframes settle { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .consent-banner__card { animation: settle var(--dur-slow) var(--ease) both; }
}

/* ═══ Form status — spoken by the subscribe script ═══ */

.form-status {
  flex-basis: 100%;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

.form-status[data-state="ok"] { color: var(--text); }

.form-status:empty { display: none; }

/* Honeypot — off-screen rather than display:none, which some bots skip */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
