/* ============================================================
   PROSE — the note-page reading column. Serif body on a literary
   measure; mono for marginal registers only. Muted tone from the
   ink ramp only.
   ============================================================ */

.kg-prose {
  max-width: var(--measure-prose);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  color: var(--text-body);
}

.kg-prose > * + * { margin-top: 1.15rem; }
.kg-prose > p { text-wrap: pretty; }

.kg-prose h2 { font-size: var(--step-2); margin-top: var(--space-xl); color: var(--text-strong); }
.kg-prose h3 { font-size: var(--step-1); margin-top: var(--space-lg); color: var(--text-strong); }
.kg-prose h4 {
  font-size: var(--step--1);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--text-strong);
  margin-top: var(--space-lg);
}

/* the rule under the word is a RULE — pigment, no glyph depends on it — so it
   keeps --accent; the word itself takes --accent-text when hover colours it */
.kg-prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: var(--hair); }
.kg-prose a:hover { color: var(--accent-text); }

.kg-prose ul, .kg-prose ol { padding-left: var(--space-md); }
.kg-prose li + li { margin-top: var(--space-2xs); }
.kg-prose ol { list-style: decimal; }
.kg-prose ul { list-style: square; }
.kg-prose li::marker { color: var(--text-faint); font-family: var(--font-mono); }

/* pull-quote: serif italic, hanging 1px left rule at --space-md, no quote-mark art.
   The bare element selector covers Koenig's alt variant too (it renders as
   <blockquote class="kg-blockquote-alt">) — there is no .kg-blockquote class. */
.kg-prose blockquote {
  font-style: italic;
  font-size: var(--step-1);
  line-height: 1.4;
  color: var(--text-strong);
  padding-left: var(--space-md);
  border-left: var(--line) solid var(--rule-strong);
  border-radius: var(--radius);
}

/* inline code + mark */
.kg-prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-well);
  padding: 0.1em 0.3em;
  border-radius: var(--radius);
}
.kg-prose mark { background: var(--surface-well); color: inherit; padding: 0 0.15em; }

hr {
  border: 0;
  height: var(--hair);
  background: var(--rule);
  margin: var(--space-xl) 0;
}

/* ---------- footnotes ----------
   Ghost's Markdown card ships markdown-it-footnote, so [^1] works today and
   emits: sup.footnote-ref > a (inline), then hr.footnotes-sep + section.footnotes
   holding ol.footnotes-list > li.footnote-item with a.footnote-backref (↩︎, text-
   presentation arrow — in register with the theme's other typographic arrows).
   Named in 01-ghost-theme-spec ("also style: … footnotes …") but never built
   until now. Everything below inherits the ink ramp, so schemes follow. */

/* sup/sub must never disturb the line's leading — kill the UA's line-box
   contribution once, here (covers footnote refs and Markdown ^sup^/~sub~) */
.kg-prose sup, .kg-prose sub { line-height: 0; }

/* the reference: a mono mark raised by position, not vertical-align:super */
.kg-prose .footnote-ref {
  position: relative;
  top: -0.5em;
  vertical-align: baseline;
  font-size: var(--step--2);
}
.kg-prose .footnote-ref a {
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-decoration: none;
}
.kg-prose .footnote-ref a:hover { color: var(--accent-text); }

/* the book's short footnote rule — not a full section break */
.kg-prose .footnotes-sep {
  width: 8rem;
  margin: var(--space-lg) 0 var(--space-md);
}

/* The notes: a subordinate register — smaller serif, one ramp step below
   the body's ink. Subordination comes from SIZE; the ink must stay
   readable (owner, 2026-08-13). This block asked for ink-80 by hand back
   then, because --text-muted was ink-60 and measured 3.6–4.1:1 on the light
   schemes' papers, under the floor. On 2026-08-14 the whole muted register
   moved to that same ink-80 (tokens/colors.css), so the exception folds
   back into the token it was avoiding — one value, not two spellings of it,
   and 6.1–7.5:1 across all five schemes either way. The mono numerals step
   down to faint, a register below their note's text, and clear it too. */
.kg-prose .footnotes {
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--text-muted);
}
.kg-prose .footnotes li::marker { color: var(--text-faint); }
.kg-prose .footnote-item p + p { margin-top: var(--space-2xs); }

.kg-prose .footnote-backref {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--text-faint);
  text-decoration: none;
  margin-left: 0.3em;
}
.kg-prose .footnote-backref:hover { color: var(--accent-text); }

/* the jump lands with air above it, and the landing note is pressed into the
   sheet so the reader sees which line the leap answered */
.kg-prose .footnote-item,
.kg-prose .footnote-ref a { scroll-margin-top: var(--space-lg); }
.kg-prose .footnote-item:target,
.kg-prose .footnote-ref a:target {
  background: var(--surface-well);
  outline: 0.3rem solid var(--surface-well); /* air inside the press, no layout shift */
}
/* A landed note is washed with the well, and the label register's entire
   margin over the floor is that one step: --text-faint reads 4.62:1 on
   sanguine chalk's paper and 4.16:1 on its --paper-lo. So the marks sitting
   INSIDE the wash lift with the ground (list markers don't — they render in
   the marker box, outside the wash's 0.3rem reach, still on the sheet). */
.kg-prose .footnote-item:target .footnote-backref { color: var(--text-muted); }

/* ---------- sidenotes (marginalia proper) ----------
   specs/2026-08-sidenotes.md. On a post tagged #sidenotes (post_class prints
   tag-hash-sidenotes on the article), theme.js lifts EVERY note out of the
   unified register — the apparatus never mixes (owner, 2026-08-13) — and
   seats each beside its first reference: a single-paragraph note as a
   <span class="sidenote" role="note"> inside the citing paragraph, a
   multi-block (or table-cited) note as an <aside class="sidenote"> after
   the citing block; the rules below float both into the right rail —
   16rem wide, 2.5rem off the 47.5rem text column, hanging in the margin
   --content-max leaves free. Screen-only and width-gated: theme.js demotes
   back to the register below 76rem and before any print, so paper never
   meets a float and no-JS never sees one. Voice: a sidenote is still the
   author's prose — serif --step--2 in muted ink; only the numeral mark is
   mono/faint. No frames, no wells, no rules per note: the margin stays air. */
@media screen and (min-width: 76rem) {
  .kg-prose .sidenote {
    float: right;
    clear: right;              /* successive notes stack, never overlap: a
                                  crowded note sits LOWER than its reference —
                                  normal book behavior, no measured layout */
    width: 16rem;
    margin-right: -18.5rem;    /* 16rem rail + 2.5rem gap */
    margin-bottom: var(--space-xs);
    /* The note is seated INSIDE whatever held its reference — an h4 (mono,
       uppercase, tracked), a blockquote (italic), an em. A sidenote is the
       author's prose wherever it was cited from: restate the voice, never
       inherit the citing context's. (Emphasis/code INSIDE the note still
       style themselves.) */
    font-family: var(--font-serif);
    font-weight: 400;
    font-style: normal;
    text-transform: none;
    letter-spacing: normal;
    text-align: left;
    font-size: var(--step--2);
    line-height: 1.45;
    /* --text-muted, which IS ink-80 since 2026-08-14 (it was spelled out by
       hand here while muted still meant ink-60 and fell under the floor —
       see the register's note above): size subordinates, ink reads */
    color: var(--text-muted);
    /* the jump target travels with the note — same landing manners as the
       register's items */
    scroll-margin-top: var(--space-lg);
  }
  .kg-prose .sidenote:target {
    background: var(--surface-well);
    outline: 0.3rem solid var(--surface-well);
  }
  /* the mark is inline inside that wash — same one-step lift as the register's
     back-jump above, for the same measured reason */
  .kg-prose .sidenote:target .sidenote__mark { color: var(--text-muted); }
  .kg-prose .sidenote__mark {
    font-family: var(--font-mono);
    color: var(--text-faint);   /* one register below its note's ink */
    margin-right: 0.5em;
  }
  /* a long note's further paragraphs step down from the hoisted first line
     (the first line itself is anonymous inline content after the mark) */
  .kg-prose .sidenote p { margin-top: var(--space-2xs); }
  /* A trailing note must not poke into the subscribe plate or comments.
     A clearing ::after, deliberately not display:flow-root — a new
     formatting context would also stop .note-body's top margin collapsing
     with a leading heading's, shifting tagged posts ~45px past 76rem only. */
  .tag-hash-sidenotes .note-body.kg-prose::after {
    content: "";
    display: block;
    clear: right;
  }
  /* full-width cards span the rail's lane — never share a line with a float
     (wide cards stop at 50.5rem, inside the column: no conflict) */
  .tag-hash-sidenotes .kg-prose .kg-width-full { clear: right; }
}

/* figcaptions: one home — the `figure figcaption` register in koenig.css
   (identical declarations lived here too; every figcaption sits in a figure) */
