/* ==========================================================================
   site.css: the one stylesheet every Areactor page inherits
   --------------------------------------------------------------------------
   The look: direction B, "the editor's desk", on A's cream paper, with C,
   "evening edition", as its dark twin (chosen 2026-10-01). Caslon in both.
   The style guide at _lab/style-guide/ shows every part below, in both
   schemes; check it after any change here.

   HOW IT IS ORGANIZED
     1. Tokens: every color, size and space. Change the look here.
     2. Base: the page, type, links, pictures.
     3. Layout: the wrap, golden-ratio and column grids, sections, rules.
     4. Parts: panels, captions, buttons, forms, confirmations, entries,
        tool cards, margin notes, long-form prose.
     5. Site chrome: in drawer.css (see the note there).

   PROPORTIONS
     Spacing steps and type sizes follow the Fibonacci sequence
     (8, 13, 21, 34, 55, 89), and two-part layouts split at the golden
     ratio, 62 to 38.

   SCHEMES
     Light is the default. A page is dark when <body> carries the class
     "dark-mode", the same class the existing theme switches set, so
     pages keep working while they move over.

   FONTS
     Libre Caslon Text, from Google Fonts. A stylesheet cannot load it
     here: the site's security rules allow Google Fonts only when the
     link sits in the page's <head> (tools/apply-head-standard.py adds the
     matching rules when it finds it). Every page using this file carries:
       <link rel="preconnect" href="https://fonts.googleapis.com">
       <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
       <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Libre+Caslon+Text:ital,wght@0,400;0,700;1,400&display=swap">
   ========================================================================== */


/* 1. TOKENS ---------------------------------------------------------------- */

:root {
  /* Spacing: Fibonacci steps */
  --s1: 8px;  --s2: 13px;  --s3: 21px;  --s4: 34px;  --s5: 55px;  --s6: 89px;

  /* Type sizes: body, then Fibonacci steps up and down */
  --t-small: 13px;  --t-note: 15px;  --t-body: 17px;
  --t-lead: 21px;   --t-head: 34px;  --t-hero: 55px;

  /* Reading width for running text */
  --measure: 38em;
  --wrap: 1100px;

  --font: "Libre Caslon Text", "Big Caslon", Baskerville, Georgia, serif;
  --radius: 4px;

  /* Light: the editor's desk on cream paper */
  --page: #f3eee3;        /* the desk */
  --panel: #faf7f0;       /* paper laid on it */
  --field: #fffdf8;       /* where a visitor types */
  --edge: #ddd2bf;        /* the edge of the paper */
  --edge-soft: #e9e0cf;   /* light rules between entries */
  --ink: #1b1814;
  --muted: #6b5e4c;
  --accent: #1d3c6e;      /* ink blue */
  --on-accent: #ffffff;
  --rule: #1b1814;        /* the masthead's double rule */
  --ok: #2f6b45;
  --error: #9b2c1f;
  --veil: rgba(20, 16, 10, .35);
}

body.dark-mode {
  /* Dark: evening edition */
  --page: #16130f;
  --panel: #1d1a15;
  --field: #221e18;
  --edge: #3a342a;
  --edge-soft: #2b261f;
  --ink: #ece4d3;
  --muted: #b3a891;
  --accent: #c8a25c;      /* brass */
  --on-accent: #16130f;
  --rule: #4a4235;
  --ok: #7fb48e;
  --error: #e3897b;
  --veil: rgba(0, 0, 0, .5);
}


/* 2. BASE ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: var(--t-body)/1.6 var(--font);
  transition: background-color .3s, color .3s;
}
img, svg, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3, h4 { font-family: var(--font); font-weight: 400; letter-spacing: -.01em; line-height: 1.12; margin: 0; }
h1 { font-size: var(--t-hero); line-height: 1.08; }
h2 { font-size: var(--t-head); }
h3 { font-size: var(--t-lead); line-height: 1.2; }
h4 { font-size: var(--t-body); font-weight: 700; }
p { margin: 0 0 var(--s2); }

/* Labels: small capitals in the reading face. Never a sans. */
.sc { font-variant: small-caps; letter-spacing: .1em; font-size: var(--t-small); color: var(--accent); }
.muted { color: var(--muted); }
.lead { font-size: var(--t-lead); line-height: 1.45; font-style: italic; color: var(--muted); max-width: var(--measure); }
.measure { max-width: var(--measure); }

.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: var(--s2); top: var(--s2); z-index: 100; background: var(--panel); padding: var(--s1) var(--s2); border-radius: var(--radius); }

@media (max-width: 760px) {
  :root { --t-hero: 34px; --t-head: 28px; --t-lead: 19px; }
}


/* 3. LAYOUT ---------------------------------------------------------------- */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: var(--s5) var(--s3) var(--s6); }

/* Two parts at the golden ratio; .golden.flip puts the small part first. */
.golden { display: grid; grid-template-columns: 62fr 38fr; gap: var(--s4); align-items: end; }
.golden.flip { grid-template-columns: 38fr 62fr; }
.golden.top { align-items: start; }
.narrow { max-width: 680px; }      /* one form or one short page */
.center { margin-left: auto; margin-right: auto; }
.two   { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }

/* Short paragraphs in newspaper columns, as on the Rolls-Royce page */
.columns { columns: 3 16rem; column-gap: var(--s4); column-rule: 1px solid var(--edge-soft); }
.columns > * { break-inside: avoid; }

.section { margin-top: var(--s6); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); margin-bottom: var(--s3); }
.section-head p { margin: 0; font-style: italic; color: var(--muted); }

.rule        { border: none; border-top: 1px solid var(--edge); margin: var(--s4) 0; }
.rule-double { border: none; border-top: 3px double var(--rule); margin: var(--s2) 0 var(--s5); }

/* The five-bar mark, drawn with spans: <span class="mark"><i></i>…</span> */
.mark { display: inline-flex; gap: 5px; height: 34px; align-items: flex-end; }
.mark i { display: block; width: 5px; background: var(--accent); border-radius: 1px; }
.mark i:nth-child(1), .mark i:nth-child(5) { height: 62%; }
.mark i:nth-child(2), .mark i:nth-child(4) { height: 100%; }
.mark i:nth-child(3) { height: 80%; }

/* The 62/38 split needs room: below 900px the small part is too narrow
   to read beside a large headline, so it stacks earlier than the rest. */
@media (max-width: 900px) {
  .golden, .golden.flip { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .two, .three { grid-template-columns: minmax(0, 1fr); }
  .wrap { padding: var(--s4) var(--s2) var(--s5); }
}


/* 4. PARTS ----------------------------------------------------------------- */

/* Paper laid on the desk */
.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius); padding: var(--s4); }
@media (max-width: 760px) { .panel { padding: var(--s3); } }

/* Picture, then its one-line caption (Ogilvy: captions are read more
   than body copy) */
.figure { margin: 0; }
.figure img { border-radius: 3px; }
.caption { font-style: italic; font-size: var(--t-small); color: var(--muted); text-align: right; margin: var(--s1) 0 var(--s3); }

/* Buttons */
.btn, .btn-outline {
  display: inline-block; font: var(--t-note) var(--font); font-variant: small-caps; letter-spacing: .08em;
  padding: var(--s2) var(--s4); border-radius: 3px; text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); }
.btn:hover { color: var(--on-accent); filter: brightness(1.12); }
.btn-outline { background: none; color: var(--ink); border: 1px solid var(--edge); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled], .btn-outline[disabled] { opacity: .55; cursor: default; filter: none; }
.price { font-size: var(--t-lead); margin-right: var(--s3); }

/* Forms: the coupon, with labels in italics beside their fields */
.coupon { border: 2px dashed var(--edge); border-radius: var(--radius); padding: var(--s4); background: var(--panel); }
.field { display: grid; grid-template-columns: 144px minmax(0, 1fr); gap: var(--s2); align-items: center; margin-bottom: var(--s2); }
.field.top { align-items: start; }
.field > label { font-style: italic; color: var(--muted); }
.field .opt { font-size: var(--t-small); }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="search"], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--edge); border-radius: 3px; padding: var(--s1) var(--s2);
}
textarea { min-height: 89px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: var(--s3); margin-top: var(--s3); }
.form-note { font-size: var(--t-small); font-style: italic; color: var(--muted); margin: var(--s2) 0 0; }
.form-error { color: var(--error); font-size: var(--t-note); margin: var(--s2) 0 0; }
@media (max-width: 520px) { .field { grid-template-columns: minmax(0, 1fr); gap: 3px; } }

/* Confirmation after a form: a short signed note on the paper */
.received { overflow-wrap: anywhere; background: var(--panel); border: 1px solid var(--edge); border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; padding: var(--s3) var(--s4); }
.received h3 { margin: var(--s1) 0; }
.received .sign { font-style: italic; margin: var(--s2) 0 0; }

/* A tool card: picture, label, title, one line */
.tool img { border-radius: 3px; border: 1px solid var(--edge-soft); aspect-ratio: 760 / 392; object-fit: cover; width: 100%; }
.tool .sc { display: block; margin: var(--s2) 0 var(--s1); }
.tool p { font-size: var(--t-note); line-height: 1.55; margin: var(--s1) 0 0; color: var(--muted); }
.tool a { text-decoration: none; }

/* An entry in a list: small square picture, title, one line */
.entry { display: grid; grid-template-columns: 89px minmax(0, 1fr); gap: var(--s2); padding: var(--s2) 0; border-top: 1px solid var(--edge-soft); text-decoration: none; }
.entry img { aspect-ratio: 1; object-fit: cover; border-radius: 3px; width: 100%; }
.entry h3, .entry h4 { font-size: var(--t-body); font-weight: 700; line-height: 1.3; }
.entry p { margin: 3px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* A note in the margin, the way a careful reader annotates a book */
.note { border-left: 1px solid var(--edge); padding-left: var(--s2); font-size: var(--t-note); font-style: italic; color: var(--muted); }

/* Long-form writing: essays, guides */
.prose { max-width: var(--measure); }
.prose h2 { margin: var(--s5) 0 var(--s2); }
.prose h3 { margin: var(--s4) 0 var(--s1); }
.prose p, .prose ul, .prose ol { margin: 0 0 var(--s3); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: var(--s1) 0; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin: 0 0 var(--s3); padding-left: var(--s3); border-left: 2px solid var(--accent); font-style: italic; color: var(--muted); }
.prose figure { margin: var(--s4) 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--t-note); margin: 0 0 var(--s3); }
.prose th, .prose td { border-bottom: 1px solid var(--edge-soft); padding: var(--s1) var(--s2) var(--s1) 0; text-align: left; vertical-align: top; }
.prose th { font-variant: small-caps; letter-spacing: .08em; font-weight: 400; color: var(--accent); }
.prose code { font-size: .88em; background: var(--panel); border: 1px solid var(--edge-soft); border-radius: 3px; padding: 0 .25em; }
.prose > p:first-of-type::first-letter,
.article > .prose > section:first-child > p:first-of-type::first-letter { float: left; font-size: 3.4em; line-height: .82; margin: .06em .08em 0 0; color: var(--accent); }
.prose.no-dropcap > p:first-of-type::first-letter,
.article > .prose.no-dropcap > section:first-child > p:first-of-type::first-letter { float: none; font-size: inherit; margin: 0; color: inherit; }


/* Articles: essays and guides. A head, then the text with its contents in
   a narrow column beside it (the text gets 62 parts, the margin 38 on a
   wide screen; the contents move above the text on a narrow one).
     <header class="article-head">  .sc kicker, h1, .byline, .lead
     <div class="article">          <article class="prose"> + <aside class="contents">
   assets/js/article.js draws the reading line, marks the section being
   read in the contents, and works the back-to-top button. */
.article-head { max-width: 860px; }
.article-head > .sc { display: block; margin-bottom: var(--s2); }
.article-head h1 { margin-bottom: var(--s2); }
.byline { font-style: italic; color: var(--muted); margin: 0 0 var(--s3); }
.article { display: grid; grid-template-columns: minmax(0, 1fr) 233px; gap: var(--s5); align-items: start; }
.article > .prose { max-width: var(--measure); }
.article > .prose > section:first-child > h2:first-child,
.article > .prose > h2:first-child { margin-top: 0; }
.contents { position: sticky; top: 89px; font-size: var(--t-note); }
.contents .sc { display: block; margin-bottom: var(--s1); }
.contents ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--edge); }
.contents li { margin: 0; }
.contents a { display: block; padding: 5px 0 5px var(--s2); margin-left: -1px; border-left: 1px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.contents a:hover { color: var(--ink); }
.contents a[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); }
@media (max-width: 1000px) {
  .article { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .article > .contents { position: static; order: -1; }
  .contents ol { columns: 2 14rem; column-gap: var(--s4); }
}

/* Inside an article */
.aside { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius); padding: var(--s3); margin: 0 0 var(--s3); }
.aside > .sc:first-child { display: block; margin-bottom: var(--s1); }
.aside > :last-child { margin-bottom: 0; }
.aside p { font-size: var(--t-note); line-height: 1.6; }
.aside > h3:first-child, .aside > h4:first-child, .prose .aside h3 { margin-top: 0; }
.aside h3 .sc, .aside h4 .sc { display: block; margin-bottom: var(--s1); }
.aside.ruled { background: none; border: none; border-left: 2px solid var(--accent); border-radius: 0; padding: var(--s1) 0 var(--s1) var(--s3); font-style: italic; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); margin: 0 0 var(--s3); }
.pair > .aside { margin: 0; }
.prose ol.pair, .prose ul.pair { list-style: none; padding: 0; }
.prose .pair > li { margin: 0; }
.aside .note { margin-top: var(--s2); }
.aside ul { padding-left: 1.1em; font-size: var(--t-note); margin-bottom: 0; }
.aside li { margin: 4px 0; }
.byline .sc { margin-right: 4px; }
.prose .pull { margin: var(--s4) 0; padding: var(--s3) 0; border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge); font-size: var(--t-lead); line-height: 1.45; font-style: italic; color: var(--ink); }
.prose .pull cite, .prose .pull footer { display: block; margin-top: var(--s1); font-size: var(--t-small); font-style: normal; font-variant: small-caps; letter-spacing: .1em; color: var(--accent); }
.table-wrap { overflow-x: auto; margin: 0 0 var(--s3); }
.table-wrap table { margin: 0; }
.prose .table-wrap table { min-width: 560px; }
.prose figure img { border-radius: 3px; border: 1px solid var(--edge-soft); }
.prose figcaption { font-style: italic; font-size: var(--t-small); color: var(--muted); margin-top: var(--s1); }
.citation { font-size: .72em; vertical-align: super; line-height: 0; margin-left: 2px; }
.citation a { color: var(--accent); text-decoration: none; }
.citation a:hover { text-decoration: underline; }
.prose h2 .num { display: block; font-size: var(--t-small); margin-bottom: var(--s1); }
.prose sup { line-height: 0; }
.prose sup a { color: var(--accent); text-decoration: none; font-size: .8em; }
.sources .ref-desc, .sources .src-date { display: block; font-style: italic; }
.sources { font-size: var(--t-small); line-height: 1.55; color: var(--muted); }
.sources li { margin: var(--s1) 0; overflow-wrap: anywhere; }
.article-end { margin-top: var(--s6); }
.article-end h2, .article-end h4 { font-size: var(--t-body); font-weight: 400; margin-bottom: var(--s1); }
.article-end p, .article-end li { font-size: var(--t-note); color: var(--muted); }
.article-end ul { margin: 0; padding-left: 1.2em; }
.reading-line { position: fixed; left: 0; top: 64px; height: 2px; width: 0; background: var(--accent); z-index: 40; pointer-events: none; }
.to-top { position: fixed; right: var(--s3); bottom: var(--s3); width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: var(--panel); color: var(--ink); font: var(--t-lead)/1 var(--font); cursor: pointer; opacity: 0; visibility: hidden; transition: opacity .2s; z-index: 30; }
.to-top.show { opacity: 1; visibility: visible; }
.to-top:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 760px) {
  .pair { grid-template-columns: minmax(0, 1fr); }
  .reading-line { top: 56px; }
}

/* 5. SITE CHROME ----------------------------------------------------------
   The top bar, the menu, the footer and the Light and Dark switch live in
   assets/css/drawer.css, because older pages get them too and do not load
   this file. Pages built on this file carry <body class="site"> and load
   drawer.css and drawer.js after it. */
