/* article-codex.css — Scroll & Stone
   Illuminated-Codex framing for article-family pages (Task 8, Living Codex
   programme). Three jobs:
     1. Unify the two historic standfirst spellings (.standfirst / .dek) so
        older and newer articles read identically.
     2. Give the article opening one static (non-animated) manuscript rule.
     3. Style the colophon (.endmatter) and its read-next plates.
   Read-next plate imagery is classified by image-grammar.css's own
   .folio-plate / .evidence-figure contract (a parallel lane, wired at
   integration) — this file only lays plates out in a grid and never
   touches that grammar's filters, masks or object-fit on evidence images.
   Loads after style.css; the color-mix() fallbacks below let this sheet
   still read correctly if ever loaded stand-alone. */

:root {
  --codex-malachite: #1E7B4F;
  --codex-tyrian: #6E2B6B;
  --codex-vermilion: #C8401F;
}

/* ---------- 1. unify .standfirst and .dek ---------- */
.article-hero .standfirst,
.article-hero .dek {
  position: relative;
  margin-top: 1.2rem;
  max-width: 52ch;
  font-size: clamp(1.08rem, 1.9vw, 1.3rem);
  font-weight: 500;
  color: color-mix(in srgb, var(--ink, #2A2419) 94%, transparent);
}

/* ---------- 2. a static manuscript rule beneath the opening ---------- */
/* Deliberately static (no transition/animation): "a world, not a page" light
   effects are reserved for main screens, not reading copy. */
.article-hero::after {
  content: "";
  display: block;
  margin-top: clamp(1.4rem, 3vw, 2.4rem);
  height: 1px;
  background: linear-gradient(90deg, var(--gold, #C7A24B) 0%, transparent 72%);
}

/* ---------- 3. the colophon (.endmatter) and its read-next plates ---------- */
/* .endmatter is a flex row (signature + hand-authored .next, space-between).
   read-next always takes its own full-width row underneath. */
.endmatter .read-next {
  flex-basis: 100%;
  margin-top: 2rem;
  padding-top: 1.6rem;
  border-top: 1px solid color-mix(in srgb, var(--ink, #2A2419) 15%, transparent);
}
.read-next-rubric {
  margin: 0;
  font-family: var(--utility, inherit);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--codex-tyrian);
}
.read-next #read-next-title {
  margin: 0.35rem 0 1.2rem;
  font-family: var(--display, inherit);
  font-weight: 700;
  font-size: 1.4rem;
}
.read-next-plates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.4rem;
}
.read-next-plate {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
}
/* Folio plates keep a consistent crop for grid rhythm — their mask/filter
   already implies a deliberate crop. Evidence figures never get one: keep
   object-fit: contain (set by image-grammar.css) so nothing is cut off. */
.read-next-plate .folio-plate {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 2px;
}
.read-next-plate .folio-plate img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.read-next-plate .evidence-figure {
  overflow: hidden;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ink, #2A2419) 6%, transparent);
}
.read-next-relation {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--codex-malachite);
}
.read-next-plate-title {
  font-family: var(--display, inherit);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.25;
}
.read-next-plate:hover .read-next-plate-title,
.read-next-plate:focus-visible .read-next-plate-title {
  color: var(--codex-vermilion);
}
.read-next-plate:focus-visible {
  outline: 2px solid var(--gold, #C7A24B);
  outline-offset: 3px;
}

/* ---------- reading-progress filament (mounted by article-codex.js) ---------- */
/* transform-only movement, per the site's light-is-alive rule; collapses
   under prefers-reduced-motion instead of continuing to track scroll. */
.article-progress-filament {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: 100%;
  height: 3px;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--gold, #C7A24B);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .article-progress-filament { display: none; }
}
