/* Newsreader (SIL Open Font License, see /fonts/OFL-Newsreader.txt): one variable
   face with an optical-size axis, used for every passage and heading. Instrument Sans
   (SIL OFL, /fonts/OFL-InstrumentSans.txt) sets the small labels. Self-hosted; no
   third-party requests. */
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/newsreader-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/newsreader-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/newsreader-normal-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/newsreader-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* bookchime design tokens and shared primitives: one page of a book, in paper and ink.
   Pages follow the device's light/dark setting by default. The toggle (theme-toggle.js)
   can choose Light or Dark, and on the display view Daylight (dark after sunset). Page stylesheets take colour, type and spacing from
   these tokens only. */
:root {
  color-scheme: light;
  --paper: #f3eee3;
  --surface: #fbf8f1;
  --band: #ebe4d6;
  --line: #d8cfbe;
  --ink: #1e1b17;
  --muted: #5e574c;
  --accent: #8c2f1c;
  --accent-ink: #fbf8f1;
  --overlay: rgba(243, 238, 227, 0.97);

  --serif: "Newsreader", Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-xs: 0.78rem;
  --text-sm: 0.9rem;
  --text-md: 1.05rem;
  --text-lg: 1.25rem;
  --text-xl: clamp(1.35rem, 1.1rem + 0.9vw, 1.6rem);
  --text-2xl: clamp(2.2rem, 1.5rem + 2.6vw, 3.5rem);
  --radius: 999px;
  --gutter: clamp(1.25rem, 0.5rem + 4.5vw, 6rem);
}
body.night {
  color-scheme: dark;
  --paper: #14120f;
  --surface: #1c1915;
  --band: #1c1915;
  --line: #3a352d;
  --ink: #e8e0cf;
  --muted: #a39a89;
  --accent: #e0916f;
  --accent-ink: #14120f;
  --overlay: rgba(20, 18, 15, 0.97);
}
@media (prefers-color-scheme: dark) {
  /* The device setting is the default everywhere; an explicit Light choice (data-theme) overrides it. */
  body:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #14120f;
    --surface: #1c1915;
    --band: #1c1915;
    --line: #3a352d;
    --ink: #e8e0cf;
    --muted: #a39a89;
    --accent: #e0916f;
    --accent-ink: #14120f;
    --overlay: rgba(20, 18, 15, 0.97);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  transition: background-color 1.2s ease, color 1.2s ease;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } body { transition: none; } }

/* Small labels: the clock, the weather line, sources, bylines. */
.meta {
  font: 500 var(--text-xs)/1.4 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.label { font: 400 var(--text-sm)/1.4 var(--sans); letter-spacing: 0.02em; color: var(--muted); }

/* Brand and page nav, shared by the reading pages. */
.product-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--gutter);
  font: var(--text-sm)/1.4 var(--sans);
  color: var(--muted);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.mark { width: 1.25em; height: auto; flex: none; }
.mark .book { fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.mark .bars { fill: var(--accent); }
.nav-links { display: flex; align-items: center; gap: clamp(1rem, 2vw, 1.75rem); }
.nav-links a { display: inline-block; padding: 0.75rem 0; white-space: nowrap; text-decoration: none; transition: color 0.2s ease; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--accent); }
/* The colour-theme toggle: a glyph for the current look (theme-toggle.js), set apart from the links. */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0; font: inherit; color: var(--muted); background: none; border: 0; cursor: pointer; }
.theme-toggle:hover { color: var(--ink); }
.theme-glyph { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nav-links .theme-toggle { margin-left: -0.35rem; margin-right: -0.7rem; }
/* "Leave the clock open": the one filled button in the nav ("Full screen" on phones). */
.nav-links .nav-open { min-height: 40px; padding: 0.55rem 1.1rem; color: var(--paper); }
.nav-links .nav-open:hover { color: var(--paper); }
.nav-open .short { display: none; }
/* Every page carries the same links on every screen; phones shorten the labels (.short) rather than drop links. */
.nav-links .short { display: none; }
@media (max-width: 640px) {
  .product-nav { gap: 0.75rem; }
  .nav-links { gap: 0.9rem; font-size: var(--text-xs); }
  .nav-links .nav-open { padding: 0.45rem 0.85rem; }
  .nav-open .long, .nav-links .long { display: none; }
  .nav-open .short, .nav-links .short { display: inline; }
}
@media (max-width: 360px) {
  .brand .name { display: none; }
}

/* Buttons: ink pills, or quiet outlines. */
.btn {
  display: inline-block;
  min-height: 44px;
  padding: 0.7rem 1.4rem;
  font: 500 var(--text-sm)/1.3 var(--sans);
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-quiet { color: var(--ink); background: transparent; border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink); opacity: 1; }

/* Inline text links inside prose. */
.link { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
