/* ==========================================================================
   UltraMythos: homepage styles
   One stylesheet, no framework. Palette, type and spacing are tokens in :root.
   ========================================================================== */

/* Fonts (self-hosted, Latin subset). Cormorant Garamond for display, Source Sans 3 for text. */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../assets/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("../assets/fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../assets/fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
}

:root {
  --paper: #F5F0E6;
  --paper-2: #E8E0D2;
  --ink: #25251F;
  --gold: #A47C42;
  --green: #465744;
  --line: #D5CCBD;
  --dark: #292A25;

  /* Tints of the palette used for secondary text and controls */
  --ink-soft: #5A5A4F;        /* 6:1 on --paper */
  --on-dark: #F5F0E6;
  --on-dark-soft: #CFC8B8;    /* 8:1 on --dark */
  --dark-line: #8D8A7C;       /* 4:1 on --dark, for control borders */
  --dark-field: #33342E;

  --serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --gutter: 1.25rem;
  --max: 78rem;
  --section-pad: clamp(3.5rem, 7vw, 7rem);
  --radius: 2px;
}

@media (min-width: 700px) {
  :root { --gutter: 2rem; }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5.5rem;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
html:has(dialog[open]) { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  overflow-x: clip;
}

img, svg { display: block; max-width: 100%; height: auto; }
button, input, select { font: inherit; color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Focus: always visible, never removed */
:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: 1px;
}
.section--dark :focus-visible { outline-color: var(--on-dark); }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 100;
  padding: .75rem 1rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: .75rem; }

/* --------------------------------------------------------------------------
   Type
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.75rem, 1.4rem + 5.4vw, 5.4rem); line-height: 1.02; letter-spacing: -.02em; }
h2 { font-size: clamp(2.2rem, 1.5rem + 2.6vw, 3.7rem); line-height: 1.04; }
h3 { font-size: clamp(1.55rem, 1.25rem + 1vw, 2.15rem); line-height: 1.12; }
h4 { font-size: 1.35rem; line-height: 1.2; }
p { text-wrap: pretty; }
i, em { font-style: italic; }

.meta {
  font-size: .9375rem;
  color: var(--ink-soft);
  line-height: 1.45;
}
.section--dark .meta { color: var(--on-dark-soft); }

.kicker {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--green);
  margin-bottom: .9rem;
}
.kicker .numeral {
  font-style: normal;
  font-weight: 600;
  color: var(--gold);
  font-size: 1.6rem;
  letter-spacing: .02em;
}
.section--dark .kicker { color: var(--on-dark-soft); }

.section-lede {
  font-size: 1.1875rem;
  line-height: 1.55;
  max-width: 36rem;
}

/* Links and buttons */
a { color: inherit; }
.text-link {
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
  text-underline-offset: .28em;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.text-link::after { content: " \2192" / ""; }
.text-link:hover { color: var(--green); text-decoration-color: currentColor; }
.section--dark .text-link:hover { color: var(--on-dark); }

.row-link { text-decoration: none; }
.row-link:hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: .2em; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 3rem;
  padding: .7rem 1.4rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--green); border-color: var(--green); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.btn--small { min-height: 2.75rem; padding: .55rem 1.1rem; font-size: 1rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover { background: transparent; color: var(--ink); border-color: var(--ink); }

.section--dark .btn { border-color: var(--on-dark); color: var(--on-dark); }
.section--dark .btn--primary { background: var(--on-dark); color: var(--ink); }
.section--dark .btn--primary:hover { background: var(--paper-2); border-color: var(--paper-2); }
.section--dark .btn--ghost:hover { background: var(--on-dark); color: var(--ink); }
.section--dark .btn[disabled]:hover { background: transparent; color: var(--on-dark); border-color: var(--on-dark); }

/* Form controls */
.field { display: grid; gap: .4rem; min-width: 0; }
.field label { font-weight: 600; font-size: .9375rem; }
input[type="text"], input[type="search"], input[type="number"], select {
  width: 100%;
  min-height: 3rem;
  padding: .6rem .85rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%2325251F' stroke-width='2'/></svg>");
  background-repeat: no-repeat;
  background-position: right .9rem center;
  padding-right: 2.5rem;
}
input::placeholder { color: var(--ink-soft); opacity: 1; }
.section--tint input[type="text"], .section--tint input[type="number"], .section--tint select { background: var(--paper); }
.section--dark input, .section--dark select {
  background-color: var(--dark-field);
  border-color: var(--dark-line);
  color: var(--on-dark);
}
.section--dark select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'><path d='M1 1l6 6 6-6' fill='none' stroke='%23F5F0E6' stroke-width='2'/></svg>");
}
.section--dark input::placeholder { color: var(--on-dark-soft); }

.field-help { font-size: .9375rem; color: var(--ink-soft); margin-top: .5rem; }
.field-error { color: #8A2B1F; font-weight: 600; min-height: 1.5em; margin-top: .35rem; font-size: .9375rem; }

/* --------------------------------------------------------------------------
   Header and navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.header-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 1rem;
  min-height: 4.25rem;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--serif);
  font-size: 1.85rem;
  line-height: 1;
  letter-spacing: -.01em;
  text-decoration: none;
}
.wordmark span { font-weight: 600; }
.wordmark em { font-weight: 500; color: var(--green); }
.wordmark--large { font-size: clamp(2.4rem, 2rem + 2vw, 3.4rem); }

.header-actions { display: flex; align-items: center; gap: .5rem; }

.search-btn, .menu-btn, .icon-btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.75rem;
  padding: .45rem .8rem;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.search-btn:hover, .menu-btn:hover, .icon-btn:hover { background: var(--ink); color: var(--paper); }
.search-btn__key {
  display: none;
  min-width: 1.5rem;
  padding: 0 .35rem;
  border: 1px solid currentColor;
  border-radius: 3px;
  font: 600 .8125rem/1.45 var(--sans);
  text-align: center;
  opacity: .8;
}
.search-btn__label { display: none; }

.menu-btn__icon { position: relative; width: 18px; height: 12px; }
.menu-btn__icon i {
  position: absolute; left: 0; right: 0; height: 2px; background: currentColor;
  transition: transform .2s ease, top .2s ease;
}
.menu-btn__icon i:first-child { top: 1px; }
.menu-btn__icon i:last-child { top: 9px; }
.menu-btn[aria-expanded="true"] .menu-btn__icon i:first-child { top: 5px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-btn__icon i:last-child { top: 5px; transform: rotate(-45deg); }

.site-nav { grid-column: 1 / -1; }
.nav-list { display: grid; }
.nav-list a {
  display: block;
  padding: .95rem 0;
  border-top: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 1.6rem;
  line-height: 1.1;
  text-decoration: none;
}
.nav-list a:hover { color: var(--green); }

/* With JS, the mobile nav collapses behind the Menu button */
.js .site-nav { display: none; padding-bottom: .75rem; }
.js .site-nav.is-open { display: block; }

@media (min-width: 62rem) {
  .header-bar { grid-template-columns: auto 1fr auto; column-gap: 2.5rem; min-height: 4.75rem; }
  .wordmark { grid-column: 1; }
  .site-nav { grid-column: 2; grid-row: 1; display: block !important; padding: 0; justify-self: center; }
  .header-actions { grid-column: 3; grid-row: 1; }
  .menu-btn { display: none; }
  .nav-list { display: flex; gap: 2rem; }
  .nav-list a {
    padding: .4rem 0;
    border: 0;
    font-family: var(--sans);
    font-size: 1rem;
    font-weight: 600;
  }
  .nav-list a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: .35em; }
  .search-btn__label { display: inline; }
  .search-btn__key { display: inline-block; }
}

/* Search dialog */
.search-dialog {
  width: min(42rem, 100% - 2rem);
  max-height: min(40rem, 88vh);
  margin: 6vh auto auto;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
.search-dialog::backdrop { background: rgba(37, 37, 31, .6); }
.search-dialog__inner { padding: 1.25rem; display: grid; gap: .75rem; max-height: inherit; grid-template-rows: auto auto auto 1fr; }
.search-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.search-dialog__head h2 { font-size: 1.75rem; }
.icon-btn { padding: .45rem; width: 2.75rem; justify-content: center; }
.search-status { min-height: 1.5em; font-size: .9375rem; color: var(--ink-soft); }
.search-results { overflow-y: auto; margin-inline: -1.25rem; padding-inline: 1.25rem; }
.search-results li { border-top: 1px solid var(--line); }
.search-results a { display: block; padding: .85rem .5rem; text-decoration: none; }
.search-results a:hover, .search-results a:focus-visible { background: var(--paper-2); }
.search-results .r-title { display: block; font-family: var(--serif); font-size: 1.4rem; line-height: 1.15; }
.search-results .r-tags { display: block; font-size: .875rem; color: var(--ink-soft); margin-bottom: .15rem; }
.search-results .r-sum { display: block; font-size: .9375rem; color: var(--ink); }
.search-results mark { background: var(--paper-2); box-shadow: inset 0 -2px 0 var(--gold); color: inherit; }

/* --------------------------------------------------------------------------
   Sections: shared
   -------------------------------------------------------------------------- */
.section { padding-block: var(--section-pad); }
.section--ruled { border-top: 1px solid var(--line); }
.section--tint { background: var(--paper-2); }
.section--dark { background: var(--dark); color: var(--on-dark); }

.section-head { display: grid; gap: 1rem; align-content: start; }
.section-head .text-link { justify-self: start; }
.section-head--split { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
@media (min-width: 62rem) {
  .section-head--split { grid-template-columns: minmax(0, 1fr) minmax(0, 28rem); align-items: end; gap: 4rem; }
  .section-head--split .section-lede { padding-bottom: .4rem; }
}

/* Plates: every illustration shares this treatment */
.plate img, .plate-card img { width: 100%; height: auto; border: 1px solid var(--ink); background: var(--paper-2); }
.plate figcaption, .plate-card figcaption { font-size: .9375rem; color: var(--ink-soft); }
.plate__no { font-family: var(--serif); font-style: italic; color: var(--green); font-size: 1.1rem; margin-right: .35rem; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero { padding-block: clamp(2rem, 5vw, 4.5rem) clamp(3rem, 6vw, 6rem); }
.hero-grid { display: grid; gap: 2.75rem; }

.strap {
  display: inline-block;
  margin-bottom: 1.5rem;
  padding-top: .9rem;
  border-top: 2px solid var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--green);
}
.hero-copy h1 { max-width: 14ch; }
.lede { margin-top: 1.5rem; max-width: 33rem; font-size: clamp(1.15rem, 1.05rem + .5vw, 1.4rem); line-height: 1.5; }
.cta-row { display: grid; gap: .75rem; margin-top: 2rem; }
.cta-row .btn { width: 100%; }

.start-here { margin-top: 2.75rem; padding-top: 1.1rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; align-items: baseline; }
.start-here__label { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--green); }
.start-here ul { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }

.plate--hero { position: relative; margin-right: 14px; }
.plate--hero::before {
  content: "";
  position: absolute;
  inset: 14px -14px -14px 14px;
  border: 1px solid var(--gold);
  z-index: 0;
}
.plate--hero img { position: relative; z-index: 1; }
.plate--hero figcaption { position: relative; z-index: 1; padding-top: .8rem; max-width: 24rem; }

@media (min-width: 62rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: end; gap: clamp(3rem, 6vw, 6rem); }
  .cta-row { display: flex; flex-wrap: wrap; }
  .cta-row .btn { width: auto; }
  .plate--hero { margin-right: 14px; margin-bottom: 14px; }
}
@media (min-width: 62rem) and (min-height: 1px) {
  .hero-copy { padding-bottom: 1.5rem; }
}

/* --------------------------------------------------------------------------
   Mythologies: lead panel plus an indexed table of traditions
   -------------------------------------------------------------------------- */
.myth-top { display: grid; gap: 2.5rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.myth-feature {
  display: grid;
  gap: 1.5rem;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--ink);
}
.myth-feature__art { width: 7.5rem; }
.myth-feature__body { display: grid; gap: .9rem; align-content: start; }
.myth-feature__body p:not(.meta) { max-width: 38rem; }
.link-row { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: .4rem; }

@media (min-width: 62rem) {
  .myth-top { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(2.5rem, 5vw, 5rem); align-items: start; }
  .myth-feature { grid-template-columns: 11rem minmax(0, 1fr); gap: 2rem; }
  .myth-feature__art { width: 11rem; }
}

.myth-index { border-bottom: 1px solid var(--line); }
.myth-row {
  position: relative;
  display: grid;
  grid-template-columns: 2.25rem 3.25rem minmax(0, 1fr);
  column-gap: .85rem;
  row-gap: .6rem;
  align-items: center;
  padding: 1.15rem .5rem;
  border-top: 1px solid var(--line);
  transition: background-color .15s ease;
}
.myth-row:hover { background: var(--paper-2); }
.myth-row__num { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--gold); line-height: 1; }
.myth-row__emblem { width: 3.25rem; height: 3.25rem; }
.myth-row__body h3 { font-size: 1.75rem; }
.myth-row__hook { grid-column: 3; font-size: 1rem; }
.myth-row .row-link::after { content: ""; position: absolute; inset: 0; }

@media (min-width: 62rem) {
  .myth-row {
    grid-template-columns: 3rem 3.5rem minmax(0, 22rem) minmax(0, 1fr);
    column-gap: 1.5rem;
    padding: 1.25rem 1rem;
  }
  .myth-row__hook { grid-column: auto; font-size: 1.0625rem; max-width: 30rem; }
}

/* --------------------------------------------------------------------------
   Creatures: staggered plates, then the finder
   -------------------------------------------------------------------------- */
.plates { display: grid; gap: 3rem; }
.plate-card figcaption { display: grid; gap: .5rem; padding-top: 1rem; color: var(--ink); }
.plate-card figcaption .meta { margin-top: -.25rem; }
.plate-card figcaption .text-link { justify-self: start; margin-top: .25rem; }
.plate-card p:not(.meta) { max-width: 34rem; }

@media (min-width: 62rem) {
  .plates { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 2.5rem; row-gap: 4rem; align-items: start; }
  .plate-card--a { grid-column: 1 / span 7; }
  .plate-card--b { grid-column: 8 / span 5; margin-top: 5rem; }
  .plate-card--c { grid-column: 1 / span 5; }
  .plate-card--d { grid-column: 6 / span 7; margin-top: 3rem; }
}
@media (min-width: 44rem) and (max-width: 61.99rem) {
  .plates { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; align-items: start; }
  .plate-card--a, .plate-card--d { grid-column: 1 / -1; }
}

.finder {
  display: grid;
  gap: 2rem;
  margin-top: clamp(3.5rem, 7vw, 6rem);
  padding-block: clamp(1.75rem, 4vw, 3rem);
  border-block: 1.5px solid var(--ink);
}
.finder__intro { display: grid; gap: 1rem; align-content: start; }
.finder__intro > p { max-width: 32rem; }
.finder__form { display: grid; gap: 1rem; margin-top: .5rem; }
.finder__form .btn { justify-self: start; }
.finder__status { font-size: .9375rem; color: var(--ink-soft); margin-bottom: .5rem; min-height: 1.5em; }
.finder__list li { padding: 1rem 0; border-top: 1px solid var(--line); }
.finder__list li:last-child { border-bottom: 1px solid var(--line); }
.finder__name { font-family: var(--serif); font-size: 1.6rem; line-height: 1.1; }
.finder__tags { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .25rem; font-size: .9375rem; color: var(--ink-soft); }
.finder__tags b { font-weight: 600; color: var(--ink); }
.finder__sum { margin-top: .35rem; font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@media (min-width: 62rem) {
  .finder { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(2.5rem, 5vw, 5rem); }
  .finder__form { grid-template-columns: 1fr 1fr; }
  .field--wide { grid-column: 1 / -1; }
}

/* --------------------------------------------------------------------------
   Folklore: one primary story, supporting sources alongside
   -------------------------------------------------------------------------- */
.folklore-grid { display: grid; gap: 2.5rem; grid-template-areas: "head" "story" "sources"; }
.folklore-head { grid-area: head; }
.story { grid-area: story; display: grid; gap: 1.1rem; align-content: start; max-width: 42rem; }
.story h3 { font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4rem); line-height: 1; margin-bottom: .35rem; }
.story > p:not(.meta) { font-size: 1.1875rem; line-height: 1.7; }
.story > p:nth-of-type(2)::first-letter {
  float: left;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 4.6rem;
  line-height: .8;
  padding: .4rem .65rem 0 0;
  color: var(--green);
}
.story .text-link { justify-self: start; margin-top: .5rem; }

.ledger { margin-block: 1rem; padding: 1.25rem 1.25rem 1.1rem; border-left: 3px solid var(--gold); background: var(--paper); }
.ledger h4 { margin-bottom: .75rem; }
.ledger ol { counter-reset: six; }
.ledger li { counter-increment: six; display: grid; grid-template-columns: 2.5rem 1fr; padding: .5rem 0; border-top: 1px solid var(--line); }
.ledger li::before { content: counter(six, upper-roman); font-family: var(--serif); font-weight: 600; font-size: 1.25rem; color: var(--green); }
.ledger__note { margin-top: .75rem; font-size: .9375rem; color: var(--ink-soft); }

.sources { grid-area: sources; }
.sources h3 { font-size: 1.75rem; padding-bottom: .9rem; border-bottom: 2px solid var(--ink); }
.sources li { padding: 1.1rem 0; border-bottom: 1px solid var(--line); display: grid; gap: .25rem; }
.sources li > a { font-family: var(--serif); font-size: 1.45rem; line-height: 1.15; }
.sources p:not(.meta) { font-size: 1rem; }

@media (min-width: 62rem) {
  .folklore-grid {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    grid-template-areas: "head story" "sources story";
    column-gap: clamp(3rem, 6vw, 6rem);
    row-gap: 3rem;
    align-items: start;
  }
  .story { max-width: none; }
  .story > p:not(.meta), .story .meta { max-width: 40rem; }
  .ledger { max-width: 34rem; }
}

/* --------------------------------------------------------------------------
   Worldbuilding Studio (charcoal)
   -------------------------------------------------------------------------- */
.studio-grid { display: grid; gap: 3rem; }
.studio-side { display: grid; gap: 2.5rem; align-content: start; }
.studio-side .section-lede { color: var(--on-dark); }
.plate--dark img { border-color: var(--on-dark-soft); background: var(--dark); }
.plate--dark figcaption { padding-top: .75rem; color: var(--on-dark-soft); }
.plate--dark .plate__no { color: var(--on-dark); }

.tool { padding-block: 2rem; border-top: 1px solid var(--dark-line); display: grid; gap: 1rem; align-content: start; }
.tool:first-child { border-top: 2px solid var(--on-dark); }
.tool__intro { color: var(--on-dark-soft); max-width: 34rem; }
.tool__form { display: grid; gap: 1rem; }
.tool__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.copy-note { font-size: .9375rem; color: var(--on-dark-soft); min-height: 1.5em; }

.forge-output { display: grid; gap: 0; counter-reset: n; }
.forge-output li { counter-increment: n; display: grid; grid-template-columns: 2rem minmax(0, 1fr); align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--dark-line); font-family: var(--serif); font-size: 1.65rem; line-height: 1.15; overflow-wrap: anywhere; }
.forge-output li::before { content: counter(n); font-family: var(--sans); font-size: .875rem; color: var(--on-dark-soft); }
.forge-output:empty { display: none; }

.seed-list { display: grid; }
.seed-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1rem; padding: .85rem 0; border-top: 1px solid var(--dark-line); align-items: start; }
.seed-list dt { grid-column: 1 / -1; font-size: .9375rem; color: var(--on-dark-soft); font-weight: 600; }
.seed-list dd { font-family: var(--serif); font-size: 1.4rem; line-height: 1.25; }
.seed-reroll { min-height: 2.5rem; padding: .3rem .8rem; border: 1.5px solid var(--dark-line); border-radius: var(--radius); background: transparent; color: var(--on-dark); font-weight: 600; font-size: .9375rem; cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.seed-reroll:hover { background: var(--on-dark); color: var(--ink); }

@media (min-width: 62rem) {
  .studio-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(3rem, 6vw, 6rem); align-items: start; }
  .tool__form { grid-template-columns: 1fr 1fr auto; align-items: end; }
  .forge-output { grid-template-columns: 1fr 1fr; column-gap: 2rem; }
  .studio-side { position: sticky; top: 6rem; }
}

/* --------------------------------------------------------------------------
   Learning Center
   -------------------------------------------------------------------------- */
.learning-grid { display: grid; gap: 3rem; }
.quiz { padding: clamp(1.25rem, 3vw, 2.25rem); background: var(--paper-2); border: 1.5px solid var(--ink); }
.quiz h3 { margin-bottom: 1.25rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.quiz__progress { font-size: .9375rem; color: var(--ink-soft); margin-bottom: .75rem; }
.quiz fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.quiz legend { padding: 0; font-family: var(--serif); font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); line-height: 1.15; margin-bottom: 1.1rem; }
.quiz__options { display: grid; gap: .6rem; }
.quiz__option { position: relative; }
.quiz__option input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.quiz__option label {
  display: grid; grid-template-columns: 1.5rem 1fr; gap: .75rem; align-items: start;
  padding: .85rem 1rem; border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: var(--paper); cursor: pointer; font-weight: 600;
}
.quiz__option label::before { content: ""; width: 1.1rem; height: 1.1rem; margin-top: .2rem; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--paper); }
.quiz__option input:checked + label { background: var(--ink); color: var(--paper); }
.quiz__option input:checked + label::before { background: var(--paper); border-color: var(--paper); box-shadow: inset 0 0 0 3px var(--ink); }
.quiz__option input:focus-visible + label { outline: 3px solid var(--green); outline-offset: 3px; }
.quiz__option input:disabled { cursor: default; }
.quiz__option.is-correct label { background: var(--green); border-color: var(--green); color: var(--paper); }
.quiz__option.is-correct label::before { background: var(--paper); border-color: var(--paper); box-shadow: inset 0 0 0 3px var(--green); }
.quiz__option.is-wrong label { background: var(--paper); border-style: dashed; border-width: 2px; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.quiz__feedback { margin-top: 1.25rem; padding: 1rem 1.1rem; background: var(--paper); border-left: 4px solid var(--ink); }
.quiz__feedback strong { display: block; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; margin-bottom: .25rem; }
.quiz__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.quiz__score { font-family: var(--serif); font-size: clamp(3rem, 2rem + 4vw, 5rem); line-height: 1; margin-block: .5rem 1rem; }

.reference { display: grid; gap: 3rem; align-content: start; }
.reference h3 { font-size: 1.85rem; padding-bottom: .9rem; border-bottom: 2px solid var(--ink); margin-bottom: 0; }
.guide li { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: .5rem 1rem; padding: 1.15rem 0; border-bottom: 1px solid var(--line); }
.guide__n { font-family: var(--serif); font-weight: 600; font-size: 3rem; line-height: .9; color: var(--gold); }
.guide h4 { margin-bottom: .25rem; }
.guide p { font-size: 1rem; }
.glossary { margin-bottom: 1.25rem; }
.glossary > div { display: grid; gap: .15rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.glossary dt { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; line-height: 1.15; }
.glossary dd { font-size: 1rem; }

@media (min-width: 62rem) {
  .learning-grid { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(3rem, 6vw, 6rem); align-items: start; }
}

/* --------------------------------------------------------------------------
   RPG Toolkit
   -------------------------------------------------------------------------- */
.workbench { display: grid; border-top: 2px solid var(--ink); }
.bench { padding-block: 2rem; display: grid; gap: 1rem; align-content: start; }
.bench + .bench { border-top: 1px solid var(--ink); }

.dice-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.dice-quick button {
  min-height: 3rem; border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: var(--paper); font-weight: 700; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.dice-quick button:hover { background: var(--ink); color: var(--paper); }
.dice-form, .init-form { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.init-form { grid-template-columns: minmax(0, 1fr) 6.5rem auto; }
.dice-result { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.25rem; align-items: center; padding: 1rem 0; border-block: 1px solid var(--ink); }
.dice-result__total { min-width: 5.5rem; font-family: var(--serif); font-weight: 600; font-size: clamp(3.5rem, 2.5rem + 4vw, 5.5rem); line-height: 1; text-align: center; }
.dice-result__detail { overflow-wrap: anywhere; font-size: 1.0625rem; }
.dice-history h4 { font-size: 1.2rem; margin-bottom: .4rem; }
.dice-history ol { font-size: .9375rem; }
.dice-history li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-top: 1px solid var(--line); }
.dice-history li span:last-child { font-weight: 700; }
.dice-history__empty { font-size: .9375rem; color: var(--ink-soft); }
.dice-history ol:not(:empty) + .dice-history__empty { display: none; }

.init-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.init-round { font-family: var(--serif); font-size: 1.75rem; font-weight: 600; }
.init-controls { display: flex; gap: .5rem; flex-wrap: wrap; }
.init-list li { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .6rem .5rem .6rem .75rem; border-top: 1px solid var(--ink); border-left: 4px solid transparent; }
.init-list li:last-child { border-bottom: 1px solid var(--ink); }
.init-list li[aria-current="true"] { background: var(--paper); border-left-color: var(--green); }
.init-list__value { font-family: var(--serif); font-weight: 600; font-size: 1.7rem; line-height: 1; }
.init-list__name { overflow-wrap: anywhere; font-weight: 600; }
.init-list__name small { display: block; font-weight: 400; color: var(--green); font-size: .875rem; }
.init-remove { min-height: 2.5rem; padding: .25rem .7rem; border: 1.5px solid var(--ink); border-radius: var(--radius); background: transparent; font-weight: 600; font-size: .9375rem; cursor: pointer; }
.init-remove:hover { background: var(--ink); color: var(--paper); }
.init-empty { color: var(--ink-soft); }
.init-list:not(:empty) ~ .init-empty { display: none; }

@media (min-width: 62rem) {
  .workbench { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bench { padding: 2.5rem 0; }
  .bench:first-child { padding-right: clamp(2rem, 4vw, 4rem); }
  .bench + .bench { border-top: 0; border-left: 1px solid var(--ink); padding-left: clamp(2rem, 4vw, 4rem); }
  .dice-quick { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   Latest Discoveries
   -------------------------------------------------------------------------- */
.articles { display: grid; gap: 2.5rem; }
.article { display: grid; gap: .45rem; }
.article h3 { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); }
.article p:not(.meta) { max-width: 36rem; }
.article--lead { padding-top: 1.5rem; border-top: 3px solid var(--ink); align-content: start; gap: .9rem; }
.article--lead h3 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.9rem); line-height: 1.02; }
.article--lead p:not(.meta) { font-size: 1.1875rem; }
.articles__list .article { padding: 1.25rem 0; border-top: 1px solid var(--line); }
.articles__list .article:first-child { border-top: 3px solid var(--ink); }
.articles__list .article:last-child { border-bottom: 1px solid var(--line); }
.dev-note { margin-top: 2rem; font-size: .9375rem; font-style: italic; color: var(--ink-soft); }

@media (min-width: 62rem) {
  .articles { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(3rem, 6vw, 6rem); align-items: start; }
  .article--lead { padding-top: 2.25rem; padding-bottom: 1rem; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer { background: var(--paper-2); border-top: 3px solid var(--ink); padding-block: clamp(3rem, 6vw, 5rem) 1.75rem; }
.footer-top { display: grid; gap: 2.5rem; }
.footer-brand { display: grid; gap: 1rem; align-content: start; max-width: 24rem; }
.footer-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.5rem; }
.footer-nav h2 { font-family: var(--sans); font-size: 1rem; font-weight: 700; letter-spacing: 0; margin-bottom: .75rem; }
.footer-nav li + li { margin-top: .15rem; }
.footer-nav a { display: inline-block; padding: .3rem 0; text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: .2em; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--ink); font-size: .9375rem; color: var(--ink-soft); }
.footer-base a { color: var(--ink); }

@media (min-width: 62rem) {
  .footer-top { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 4rem; }
  .footer-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* --------------------------------------------------------------------------
   Pending page
   -------------------------------------------------------------------------- */
.pending { min-height: 60vh; padding-block: clamp(3rem, 8vw, 7rem); }
.pending .wrap { display: grid; gap: 1.25rem; max-width: 44rem; }
.pending code { padding: .1rem .4rem; background: var(--paper-2); border: 1px solid var(--line); font-size: .95em; }

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .search-dialog { display: none; }
}
