/* identity.css: this site's own sheet, its colour tokens and its two faces.
   The Almanac recolours the tokens to almanac stock, sepia ink and
   rubric red; the themed layer itself is almanac.css. kit/base.css stays on
   disk, linked only from 404.html. */

:root {
  color-scheme: light;
  /* THE ALMANAC: aged almanac stock, sepia letterpress ink and
     rubric red for the red-letter days. Every colour stays a token. */
  --paper: #efe5cf;
  --panel: #fbf5e6;
  --ink: #2b2118;
  --ink-soft: #5a4733;
  --line: #d6c5a1;
  --line-strong: #8a714c;
  --accent: #2b2118;
  --accent-soft: #efe2c4;
  --focus: #1f3f73;
  --pass: #2e6a2a;
  --pass-soft: #e3eccf;
  --fail: #a3231a;
  --fail-soft: #f6ddd2;
  --warn: #7a4f00;
  --weekend: #eadcbb;
  --weekend-hol: #f4ead2; /* the lighter wash under a red holiday numeral */
  --brass: #7d5b12;
  --readout-bg: #2b2118;
  --readout-ink: #f6eedb;
  --readout-dim: #cdb995;
  /* almanac-only tokens */
  --leaf: #fffaf0;          /* a fresh tear-off leaf */
  --grain: rgba(98, 68, 30, .045);
  --shadow: rgba(66, 42, 14, .28);
  --moon-lit: #fffaf0;
  --moon-shade: #4a3a28;
  --moon-hatch: #1f1710;
  --moon-stipple: #c9b48c;

  --sans: "Libre Caslon Text", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --display: "Abril Fatface", "Bodoni 72", "Didot", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 2px;
  --maxw: 62rem;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* by lamplight: the same almanac, read after dark */
    --paper: #17110b;
    --panel: #221910;
    --ink: #f2e7cd;
    --ink-soft: #cdb894;
    --line: #3d2f20;
    --line-strong: #9a8160;
    --accent: #f2e7cd;
    --accent-soft: #33261a;
    --focus: #9cc2ff;
    --pass: #93d38c;
    --pass-soft: #1d2a17;
    --fail: #ff8f78;
    --fail-soft: #3b1b14;
    --warn: #e9bd62;
    --weekend: #3a2c1d;
    --weekend-hol: #221910; /* --panel */
    --brass: #dcb563;
    --readout-bg: #0f0a06;
    --readout-ink: #f2e7cd;
    --readout-dim: #bba67f;
    --leaf: #2a2015;
    --grain: rgba(255, 230, 180, .025);
    --shadow: rgba(0, 0, 0, .55);
    --moon-lit: #f2e7cd;
    --moon-shade: #0f0a06;
    --moon-hatch: #5a4733;
    --moon-stipple: #b9a47e;
  }
}

/* Two families, self-hosted, SIL OFL 1.1 (licences beside the files).
   Libre Caslon Text is one variable file for 400 to 700, subset to Latin-1
   and the punctuation the site uses. Abril Fatface ships whole, because its
   licence reserves the name for unmodified copies. */
@font-face {
  font-family: "Libre Caslon Text";
  src: url("/fonts/libre-caslon-text-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Libre Caslon Text";
  src: url("/fonts/libre-caslon-text-italic-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Abril Fatface";
  src: url("/fonts/abril-fatface-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 750;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.05rem;
}

.brand .brand-mark { vertical-align: -0.19em; }

.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-nav a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid transparent; padding-bottom: 1px; }
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--line-strong); }
.site-nav a[aria-current="page"] { color: var(--fail); border-bottom-color: var(--fail); }

/* ---------- Layout ---------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }
main.wrap { padding-top: 1.5rem; padding-bottom: 3rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  margin: 0 0 0.35rem;
}

h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.15; letter-spacing: -0.015em; font-weight: 780; margin: 0 0 0.5rem; }
.lede { color: var(--ink-soft); max-width: 46rem; margin: 0 0 1.5rem; }
h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 2.25rem 0 0.6rem; }
h3 { font-size: 1.02rem; margin: 1.4rem 0 0.4rem; }
p { margin: 0.6rem 0; }
a { color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* ---------- Tool panel ---------- */

.tool-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1.25rem; }

/* ---------- Readout strip (house signature, folded since PR1) ---------- */

.readout {
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.4rem; align-items: baseline;
  background: var(--readout-bg); color: var(--readout-ink); font-family: var(--mono);
  font-size: 0.85rem; border-radius: var(--radius); padding: 0.6rem 0.85rem; margin: 0 0 1rem; min-height: 2.4rem;
}
.readout .r-item { white-space: normal; }
.readout .r-label { white-space: nowrap; color: var(--readout-dim); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; margin-right: 0.45rem; }
.readout .r-value { font-weight: 600; overflow-wrap: anywhere; }
.readout .r-value.pass { color: var(--pass); }
.readout .r-value.fail { color: var(--fail); }

/* ---------- Buttons & controls ---------- */

.btn {
  appearance: none; font: inherit; font-weight: 600; font-size: 1rem; color: var(--panel);
  background: var(--ink); border: 1px solid var(--ink); border-radius: var(--radius); padding: 0.6rem 1rem; cursor: pointer;
}
.btn:hover { filter: brightness(1.2); }
.btn.secondary { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--ink-soft); filter: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.controls { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0.75rem 0; }
.site-nav a, .site-footer a, .related li a { display: inline-flex; align-items: center; min-height: var(--tap); }
select, input[type="text"], input[type="number"] {
  font: inherit; font-size: 1rem; padding: 0.45rem 0.6rem; min-height: var(--tap);
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--ink); max-width: 100%;
}
label.inline { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- Status notes ---------- */

.note { border: 1px solid var(--line); border-left: 3px solid var(--ink); background: var(--panel); border-radius: var(--radius); padding: 0.6rem 0.85rem; font-size: 0.9rem; color: var(--ink-soft); margin: 0.75rem 0; }
.note.error { border-left-color: var(--fail); background: var(--fail-soft); color: var(--ink); }
.note.warn { border-left-color: var(--warn); }

/* ---------- Prose ---------- */

.prose { max-width: 46rem; }
.prose code { font-family: var(--mono); font-size: 0.86em; background: var(--accent-soft); padding: 0.08em 0.3em; border-radius: 2px; }

.faq details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: 0.5rem 0; max-width: 46rem; }
.faq summary { cursor: pointer; font-weight: 620; padding: 0.65rem 0.9rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; font-family: var(--mono); color: var(--ink); margin-right: 0.6rem; }
.faq details[open] summary::before { content: "\2013"; }
.faq details > div { padding: 0 0.9rem 0.8rem; color: var(--ink-soft); font-size: 0.94rem; }

.table-wrap { overflow-x: auto; margin: 1rem 0; max-width: 46rem; }
.prose table { border-collapse: collapse; width: 100%; min-width: 34rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); font-size: 0.88rem; }
.prose th, .prose td { border-top: 1px solid var(--line); padding: 0.5rem 0.7rem; text-align: left; vertical-align: top; }
.prose thead th { border-top: 0; font-family: var(--mono); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft); }

.related { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; list-style: none; }
.related li a { border: 1px solid var(--line-strong); border-radius: 999px; padding: 0.3rem 0.9rem; color: var(--ink); text-decoration: none; background: var(--panel); }
.related li a:hover { border-color: var(--fail); color: var(--fail); }

/* ---------- Ad slots (inert; see dates.css / revenue-model) ---------- */

.ad-slot { display: none; }
.ad-slot.active { display: flex; align-items: center; justify-content: center; background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius); margin: 1.25rem auto; }
.ad-slot.leaderboard { min-height: 90px; max-width: 728px; }
.ad-slot.rectangle { min-height: 250px; max-width: 336px; }

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

.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; background: var(--panel); }
.site-footer .inner { max-width: var(--maxw); margin: 0 auto; padding: 1.1rem 1rem 1.4rem; font-size: 0.83rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; align-items: baseline; }
.site-footer a { color: var(--ink-soft); }
.site-footer a:hover { color: var(--ink); }
.site-footer .promise { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* ---------- Motion & accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Print: ink on white whatever the screen theme. */
@media print {
  :root { color-scheme: light; --paper: #fff; --panel: #fff; --ink: #000; --ink-soft: #333; --accent: #000; --accent-soft: #efe2c4; --line: #bbb; --line-strong: #888;
    --fail: #a3231a; --pass: #2e6a2a; --warn: #7a4f00; --weekend: #eadcbb; --weekend-hol: #f4ead2; --brass: #7d5b12; --readout-bg: #2b2118; --readout-ink: #f6eedb;
    --leaf: #fff; --grain: transparent; --shadow: transparent; --moon-lit: #fff; --moon-shade: #555; --moon-hatch: #000; --moon-stipple: #bbb; }
  /* Backgrounds do not print by default. */
  .readout { background: none; color: var(--ink); border: 1px solid var(--line); }
  .readout .r-label { color: var(--ink-soft); }
}
