/* ==========================================================================
   The Warpriest - illuminated codex stylesheet
   Obsidian ground, ember crimson rubrics, bone vellum text, brass leaf.
   Single dark scheme. All text pairs checked for WCAG AA (4.5:1 / 3:1 large).
   ========================================================================== */

:root {
  color-scheme: dark;

  /* palette */
  --obsidian: #0F0A0A;
  --ink: #120C0C;
  --panel: #1A1212;
  --panel-2: #221717;
  --panel-3: #2B1C1C;
  --ember: #E0414C;          /* ember on dark (large text, art) */
  --ember-text: #F0646D;     /* ember lightened for body-size text on panels */
  --crimson: #B3202A;        /* art, fills with bone text */
  --crimson-deep: #8A1720;
  --bone: #E8DCC2;
  --bone-2: #D2C6AD;
  --brass: #B08D3E;
  --brass-hi: #CBA552;
  --brass-dark: #6B5120;
  --ash: #A79A92;
  --focus: #F2D98B;
  --line: rgba(176, 141, 62, 0.5);
  --line-soft: rgba(176, 141, 62, 0.24);

  /* type */
  --font-display: "Big Caslon", "Caslon", "Adobe Caslon Pro", "Book Antiqua", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: Georgia, "Times New Roman", Times, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4.5rem;

  --wrap: 78rem;
  --radius: 3px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, dl, dd, figure, fieldset, pre { margin: 0; }
ul, ol { padding: 0; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ---------- base ---------- */
body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  line-height: 1.65;
  color: var(--bone);
  background-color: var(--obsidian);
  background-image:
    radial-gradient(ellipse 90% 38% at 50% 0%, rgba(179, 32, 42, 0.24), transparent 72%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .91 0 0 0 0 .8 0 0 0 0 .6 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  overflow-wrap: break-word;
}

::selection { background: var(--crimson); color: var(--bone); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

a { color: var(--brass-hi); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { color: var(--bone); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px var(--obsidian);
}

.skip-link {
  position: absolute; left: 1rem; top: -5rem; z-index: 200;
  padding: 0.8rem 1.1rem; min-height: 44px;
  background: var(--bone); color: var(--obsidian);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

main:focus { outline: none; }

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

/* ---------- typography ---------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; line-height: 1.12; color: var(--bone); }

h1 {
  font-size: clamp(2.5rem, 1.3rem + 5.2vw, 5.6rem);
  font-variant: small-caps;
  letter-spacing: 0.035em;
  text-shadow: 0 2px 0 #000, 0 0 44px rgba(224, 65, 76, 0.38);
  margin-block: 0.25em 0.3em;
  overflow-wrap: anywhere;
}
h2 {
  font-size: clamp(1.65rem, 1.05rem + 1.9vw, 2.65rem);
  font-variant: small-caps;
  letter-spacing: 0.045em;
  margin-top: 0.15em;
}
h3 { font-size: clamp(1.2rem, 1.05rem + 0.5vw, 1.5rem); letter-spacing: 0.02em; }
h4 { font-size: 1.1rem; font-variant: small-caps; letter-spacing: 0.08em; }

p + p { margin-top: 0.9em; }
em { color: var(--bone); }
strong { color: var(--bone); }

.rubric {
  display: flex; align-items: center; gap: 0.7rem;
  font-family: var(--font-display);
  font-size: 0.86rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ember-text);
}
.rubric::before {
  content: ""; flex: none; width: 0.55rem; height: 0.55rem;
  background: var(--crimson); border: 1px solid var(--brass);
  transform: rotate(45deg);
}
.rubric::after {
  content: ""; flex: 1 1 2rem; height: 1px; max-width: 12rem;
  background: linear-gradient(90deg, var(--line), transparent);
}

.hero-lead {
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem);
  font-style: italic; line-height: 1.45; max-width: 44ch;
  color: var(--bone); margin-bottom: 1rem;
}
.leaf-intro { max-width: 62ch; font-style: italic; margin-bottom: var(--sp-5); color: var(--bone); }

.text-link { display: inline-flex; align-items: center; min-height: 40px; font-style: normal; }

/* ---------- ribbon header ---------- */
.site-header {
  position: relative; z-index: 30;
  background: linear-gradient(180deg, #140D0D, var(--obsidian));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.9);
}
.header-inner {
  width: min(100% - 2rem, var(--wrap));
  margin-inline: auto;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
  min-height: 4.75rem;
}
.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 4.75rem; padding-block: 0.4rem;
  color: var(--bone); text-decoration: none; align-self: center;
}
.brand:hover { color: var(--bone); }
.brand-sigil { width: 2.7rem; height: 2.7rem; flex: none; filter: drop-shadow(0 0 10px rgba(224, 65, 76, 0.45)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--font-display); font-variant: small-caps;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.8rem); letter-spacing: 0.07em;
}
.brand-sub { font-size: 0.78rem; font-style: italic; color: var(--ash); letter-spacing: 0.03em; }

.nav-toggle { display: none; }

.ribbon-nav ul { list-style: none; display: flex; gap: 0.5rem; margin: 0; padding: 0 0 0 0; }
.ribbon-nav li { filter: drop-shadow(0 6px 5px rgba(0, 0, 0, 0.55)); }
.ribbon {
  display: flex; justify-content: center; align-items: flex-start;
  width: 5.4rem; height: 5.9rem; padding-top: 1.35rem;
  background: var(--crimson); color: var(--bone);
  font-family: var(--font-display); font-variant: small-caps; font-size: 1.02rem; font-weight: 700; letter-spacing: 0.07em;
  text-decoration: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 0.95rem), 0 100%);
  transition: height 0.25s ease, background-color 0.2s ease;
}
.ribbon:hover { background: var(--crimson-deep); color: var(--bone); height: 6.6rem; text-decoration: none; }
.ribbon[aria-current="page"] { background: var(--bone); color: var(--obsidian); height: 7.1rem; }
.ribbon[aria-current="page"]:hover { background: var(--bone); color: var(--obsidian); }
.ribbon:focus-visible {
  outline: none; box-shadow: none;
  background: var(--focus); color: var(--obsidian); text-decoration: underline; text-underline-offset: 0.2em;
}

/* ---------- folio (the page) ---------- */
.folio {
  position: relative;
  width: min(100% - 2rem, var(--wrap));
  margin: clamp(3.25rem, 6vw, 4.5rem) auto clamp(3rem, 6vw, 5rem);
  padding: clamp(1.25rem, 3.6vw, 3.5rem);
  background-color: #1B1313;
  overflow-x: clip;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .91 0 0 0 0 .8 0 0 0 0 .6 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #201616 0%, #1A1212 38%, #161010 100%);
  border: 1px solid var(--line);
  box-shadow:
    0 0 0 5px #120C0C,
    0 0 0 6px var(--line-soft),
    0 44px 80px -34px rgba(0, 0, 0, 0.95),
    0 14px 26px -14px rgba(0, 0, 0, 0.7),
    inset 0 0 130px rgba(0, 0, 0, 0.4);
}
.folio::before, .folio::after {
  content: ""; position: absolute; inset: 9px; pointer-events: none;
  background-repeat: no-repeat; background-size: 58px 58px;
}
.folio::before {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cpath d='M3 52V3h49' fill='none' stroke='%23B08D3E' stroke-width='2'/%3E%3Cpath d='M11 52V11h41' fill='none' stroke='%23B08D3E' stroke-opacity='.5'/%3E%3Ccircle cx='11' cy='11' r='4' fill='%23B3202A' stroke='%23B08D3E'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cg transform='rotate(180 28 28)'%3E%3Cpath d='M3 52V3h49' fill='none' stroke='%23B08D3E' stroke-width='2'/%3E%3Cpath d='M11 52V11h41' fill='none' stroke='%23B08D3E' stroke-opacity='.5'/%3E%3Ccircle cx='11' cy='11' r='4' fill='%23B3202A' stroke='%23B08D3E'/%3E%3C/g%3E%3C/svg%3E");
  background-position: left top, right bottom;
}
.folio::after {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cg transform='translate(56 0) scale(-1 1)'%3E%3Cpath d='M3 52V3h49' fill='none' stroke='%23B08D3E' stroke-width='2'/%3E%3Cpath d='M11 52V11h41' fill='none' stroke='%23B08D3E' stroke-opacity='.5'/%3E%3Ccircle cx='11' cy='11' r='4' fill='%23B3202A' stroke='%23B08D3E'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 56'%3E%3Cg transform='translate(0 56) scale(1 -1)'%3E%3Cpath d='M3 52V3h49' fill='none' stroke='%23B08D3E' stroke-width='2'/%3E%3Cpath d='M11 52V11h41' fill='none' stroke='%23B08D3E' stroke-opacity='.5'/%3E%3Ccircle cx='11' cy='11' r='4' fill='%23B3202A' stroke='%23B08D3E'/%3E%3C/g%3E%3C/svg%3E");
  background-position: right top, left bottom;
}

.leaf { padding-block: clamp(1.25rem, 2.6vw, 2.25rem); position: relative; }
.leaf-head { margin-bottom: var(--sp-5); }
.leaf-head h2 { margin-top: 0.3rem; }

.divider { display: block; width: min(100%, 36rem); height: auto; margin: 0.5rem auto; color: var(--brass); }

.leaf-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(12rem, 22%, 16rem);
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
}

/* two-column manuscript */
.manuscript {
  columns: 2 17rem;
  column-gap: 2.5rem;
  column-rule: 1px solid var(--line-soft);
  text-align: justify; hyphens: auto; -webkit-hyphens: auto;
}
.manuscript p { orphans: 3; widows: 3; }
.manuscript .counsel-h { break-after: avoid; margin-top: 1.1rem; margin-bottom: 0.3rem; color: var(--brass-hi); font-style: italic; }
.manuscript .counsel-h:first-child { margin-top: 0; }
.manuscript .marginal { break-inside: avoid; margin-top: 1rem; }

/* illuminated drop cap */
.dropcap-first > p:first-of-type::first-letter {
  float: left;
  font-family: var(--font-display);
  font-size: 4.3em; line-height: 0.82;
  color: var(--bone); background: var(--crimson);
  border: 2px solid var(--brass);
  padding: 0.06em 0.12em 0.02em;
  margin: 0.08em 0.14em 0 0;
}

/* marginalia */
.marginalia { display: grid; gap: var(--sp-4); }
.marginal {
  position: relative; margin: 0;
  padding: 0.85rem 1rem 0.95rem 1.1rem;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--brass);
  font-size: 0.93rem; line-height: 1.5; font-style: italic;
  color: var(--bone-2); text-align: left; hyphens: manual;
}
.marginal p + p { margin-top: 0.5em; }
.marginal-label {
  font-style: normal; font-family: var(--font-display); font-variant: small-caps;
  font-size: 1.02rem; letter-spacing: 0.1em; color: var(--brass-hi); margin-bottom: 0.2rem;
}
.marginal-wide { margin-top: var(--sp-5); max-width: 52rem; }

/* ---------- buttons & form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 46px; padding: 0.6rem 1.35rem;
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; letter-spacing: 0.05em;
  text-decoration: none; text-align: center;
  border: 1px solid var(--brass); border-radius: var(--radius);
  background: transparent; color: var(--bone);
  transition: background-color 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--crimson); border-color: var(--brass); color: var(--bone);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 14px -6px rgba(0, 0, 0, 0.8);
}
.btn-primary:hover { background: var(--crimson-deep); color: var(--bone); }
.btn-ghost:hover { background: rgba(176, 141, 62, 0.2); color: var(--bone); border-color: var(--bone); }
.btn-small { min-height: 40px; padding: 0.3rem 0.9rem; font-size: 0.95rem; }
.btn[aria-disabled="true"], .btn.btn-primary[aria-disabled="true"] {
  border-style: dashed; background: var(--ink); color: var(--bone-2); cursor: not-allowed; box-shadow: none; transform: none;
}

.cta-row, .btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }
.cta-center { justify-content: center; }

label, .filter-label, legend {
  display: block; margin-bottom: 0.3rem;
  font-family: var(--font-display); font-variant: small-caps; font-size: 1.02rem; letter-spacing: 0.08em; color: var(--bone);
}
legend { padding: 0; }
.opt { font-variant: normal; font-style: italic; letter-spacing: 0; color: var(--ash); font-size: 0.9rem; }
fieldset { border: 0; padding: 0; min-width: 0; }

input[type="text"], input[type="search"], select, textarea {
  width: 100%; min-height: 46px; padding: 0.55rem 0.75rem;
  background: var(--ink); color: var(--bone);
  border: 1px solid var(--brass); border-radius: var(--radius);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55);
}
textarea { resize: vertical; line-height: 1.5; }
::placeholder { color: var(--ash); opacity: 1; }
select { cursor: pointer; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 2px; }

.field { min-width: 0; }
.field + .field { margin-top: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--sp-4); margin-top: var(--sp-4); }
.field-row:first-child { margin-top: 0; }
.field-grow { grid-column: span 2; }
.hint { font-size: 0.9rem; font-style: italic; color: var(--ash); margin-top: 0.4rem; }
.form-error {
  margin-top: var(--sp-4); padding: 0.7rem 0.9rem;
  border: 1px solid var(--ember-text); border-left-width: 5px;
  background: rgba(179, 32, 42, 0.18); color: var(--bone); font-style: normal;
}
.form-error::before { content: "Not yet: "; font-weight: 700; color: var(--ember-text); }

.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0.4rem 1rem;
  border: 1px solid var(--brass); border-radius: 999px;
  background: transparent; color: var(--bone);
  font-family: var(--font-display); font-size: 1rem; letter-spacing: 0.03em; line-height: 1.2; text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.chip:hover { background: rgba(176, 141, 62, 0.22); }
.chip[aria-pressed="true"] { background: var(--bone); color: var(--obsidian); border-color: var(--bone); font-weight: 700; }
.chip[aria-pressed="true"]::before {
  content: ""; width: 0.55rem; height: 0.55rem; margin-right: 0.5rem; border-radius: 50%; background: currentColor;
}

/* ---------- footer ---------- */
.site-footer {
  width: min(100% - 2rem, var(--wrap)); margin: 0 auto; padding: 0 0 var(--sp-7);
}
.footer-grid {
  display: grid; grid-template-columns: 1.5fr 1fr 1.1fr; gap: var(--sp-6); padding-block: var(--sp-5);
}
.foot-name { font-family: var(--font-display); font-variant: small-caps; font-size: 1.6rem; letter-spacing: 0.06em; color: var(--bone); }
.foot-brand p:not(.foot-name), .foot-mail p { font-size: 0.95rem; color: var(--bone-2); margin-top: 0.4rem; }
.foot-h { font-size: 1.05rem; font-variant: small-caps; letter-spacing: 0.1em; color: var(--brass-hi); margin-bottom: 0.4rem; }
.foot-nav ul { list-style: none; display: grid; gap: 0; }
.foot-nav a, .mail-link {
  display: inline-flex; align-items: center; min-height: 40px; color: var(--bone); text-decoration-color: var(--brass);
}
.foot-nav a[aria-current="page"] { font-weight: 700; text-decoration-thickness: 2px; }
.foot-nav a:hover, .mail-link:hover { color: var(--focus); }
.foot-honest {
  text-align: center; font-style: italic; color: var(--bone-2); font-size: 0.95rem;
  padding-top: var(--sp-4); border-top: 1px solid var(--line-soft);
}
.site-footer .divider { margin-bottom: 0; }

/* ---------- page titles (sub pages) ---------- */
.page-title { padding-top: clamp(1rem, 3vw, 2rem); }
.page-title::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  right: -4%; top: -20%; width: min(34rem, 80%); aspect-ratio: 1;
  background: radial-gradient(closest-side, rgba(224, 65, 76, 0.2), transparent 72%);
  animation: flicker 4.4s ease-in-out infinite;
}
.page-title::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  right: 1%; top: 4%; width: clamp(9rem, 22vw, 17rem); aspect-ratio: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cg fill='none' stroke='%23B08D3E' stroke-opacity='.5' stroke-width='1.5'%3E%3Ccircle cx='100' cy='100' r='96'/%3E%3Ccircle cx='100' cy='100' r='70'/%3E%3Ccircle cx='100' cy='100' r='40'/%3E%3Cpath d='M100 4V196M4 100H196M32 32L168 168M168 32L32 168'/%3E%3Ccircle cx='100' cy='100' r='18' fill='%23B3202A' fill-opacity='.45'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.page-title > * { position: relative; z-index: 1; }
body[data-page="litanies"] .page-title::after { right: auto; left: 0; opacity: 0.55; }
body[data-page="litanies"] .page-title > * { padding-left: 0; }
body[data-page="contact"] .page-title::after { right: 4%; top: 10%; opacity: 0.7; }
body[data-page="forge"] .page-title::after { right: 3%; top: 2%; }

.jump-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: var(--sp-4); }
.jump {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0.4rem 1.1rem;
  font-family: var(--font-display); font-variant: small-caps; letter-spacing: 0.08em; font-size: 1.05rem;
  color: var(--bone); border: 1px solid var(--brass); border-bottom-width: 3px; text-decoration: none; background: var(--panel-2);
}
.jump:hover { background: var(--panel-3); color: var(--focus); }

/* ---------- home ---------- */
.hero { padding-top: clamp(0.5rem, 2vw, 1.5rem); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(1.5rem, 4vw, 4rem); align-items: center;
}
.hero-text { animation: rise 0.8s ease both; }
.hero-text > p:not(.rubric):not(.hero-lead) { max-width: 54ch; }
.hero-text .marginal { margin-top: var(--sp-5); max-width: 36rem; }
.hero-art { position: relative; justify-self: center; width: min(100%, 26rem); animation: rise 1s ease 0.1s both; }
.hero-svg { position: relative; z-index: 1; display: block; width: 100%; height: auto; filter: drop-shadow(0 24px 30px rgba(0, 0, 0, 0.65)); }
.candle-glow {
  position: absolute; z-index: 0; inset: -10% -10%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(224, 65, 76, 0.4), rgba(224, 65, 76, 0.14) 55%, transparent 76%);
  animation: flicker 4.2s ease-in-out infinite;
}
.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flame 2.6s ease-in-out infinite; }
.flame-small { animation-duration: 1.9s; }
.flame-alt { animation-delay: -1.1s; animation-duration: 2.3s; }

.folio-cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: var(--sp-5); }
.folio-card {
  position: relative; display: flex; flex-direction: column; gap: 0.6rem; height: 100%;
  padding: 1.6rem 1.5rem 1.4rem;
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2));
  border: 1px solid var(--line); border-top: 3px solid var(--crimson);
  color: var(--bone); text-decoration: none;
  box-shadow: 0 14px 28px -16px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.folio-card:hover { transform: translateY(-4px); border-color: var(--bone); box-shadow: 0 22px 34px -16px rgba(0, 0, 0, 0.95), 0 0 30px rgba(224, 65, 76, 0.2); color: var(--bone); }
.folio-num { position: absolute; top: 0.8rem; right: 1.1rem; font-family: var(--font-display); font-size: 2.2rem; line-height: 1; color: var(--brass); }
.folio-ico { width: 3rem; height: 3rem; color: var(--brass-hi); }
.folio-title { font-family: var(--font-display); font-size: 1.6rem; font-variant: small-caps; letter-spacing: 0.05em; line-height: 1.1; }
.folio-text { color: var(--bone-2); font-size: 0.98rem; }
.folio-go { margin-top: auto; padding-top: 0.5rem; font-family: var(--font-display); font-variant: small-caps; letter-spacing: 0.1em; color: var(--ember-text); font-weight: 700; }
.folio-go::after { content: " \2192"; }

.office-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 3rem); align-items: stretch; }
.office-intro { max-width: 52ch; }
.office-card {
  position: relative; min-height: 15rem; padding: 1.5rem 1.5rem 1.4rem;
  background: var(--panel-3); border: 1px solid var(--brass);
  box-shadow: inset 0 0 0 5px var(--panel-3), inset 0 0 0 6px var(--line-soft), 0 20px 30px -20px #000;
  display: flex; flex-direction: column; justify-content: center;
}
.office-empty { font-style: italic; color: var(--bone-2); text-align: center; padding: 0.5rem 1rem; }
.office-card .oc-top { display: flex; gap: 0.9rem; align-items: center; }
.office-card h3 { font-size: 1.45rem; }
.oc-verse { margin-top: 0.9rem; font-style: italic; font-size: 1.1rem; }
.oc-gist { margin-top: 0.6rem; color: var(--bone-2); }
.oc-link { margin-top: 0.6rem; }
.office-card.is-drawn { animation: rise 0.45s ease both; }

.vow-tiles { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--sp-5); margin-top: var(--sp-4); }
.vow-tile { padding: 1.3rem 1.25rem; background: var(--panel-2); border: 1px solid var(--line-soft); border-bottom: 3px solid var(--crimson); }
.vow-tile .vow-ico { width: 3rem; height: 3rem; color: var(--brass-hi); margin-bottom: 0.5rem; }
.vow-tile h3 { font-size: 1.35rem; }
.vow-boon { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.82rem; color: var(--ember-text); margin-block: 0.15rem 0.5rem; }
.vow-tile p:last-child { color: var(--bone-2); font-size: 0.98rem; }

.closing { text-align: center; }
.closing p { max-width: 46ch; margin-inline: auto; margin-top: 0.6rem; }
.close-ico { width: 3.5rem; height: 3.5rem; margin-bottom: 0.5rem; filter: drop-shadow(0 0 14px rgba(224, 65, 76, 0.5)); }

/* ---------- codex ---------- */
.codex-layout { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 2.75rem); align-items: start; }
.leaves { position: sticky; top: 1rem; padding: 1rem 0.5rem 1rem 0; border-right: 1px solid var(--line-soft); }
.leaves-h { font-size: 1rem; letter-spacing: 0.14em; color: var(--ember-text); margin-bottom: 0.5rem; }
.leaves ol { list-style: none; counter-reset: leaf; display: grid; }
.leaves li { counter-increment: leaf; }
.leaves a {
  display: flex; align-items: center; gap: 0.6rem; min-height: 42px; padding-block: 0.2rem;
  color: var(--bone); text-decoration: none; font-family: var(--font-display); font-size: 1.02rem;
  border-bottom: 1px dotted var(--line-soft);
}
.leaves a::before { content: counter(leaf, upper-roman); min-width: 1.7rem; color: var(--brass-hi); font-size: 0.85rem; letter-spacing: 0.05em; }
.leaves a:hover { color: var(--focus); }
.codex-body .leaf:first-child { padding-top: 0; }

.formula-plate {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1px;
  margin-top: var(--sp-5); background: var(--line-soft); border: 1px solid var(--line);
}
.formula { padding: 1rem 1.25rem 1.1rem; background: var(--panel-2); }
.formula dt { font-family: var(--font-display); font-variant: small-caps; letter-spacing: 0.1em; font-size: 1.25rem; color: var(--brass-hi); }
.formula .eq { display: block; margin-top: 0.15rem; color: var(--bone); }
.formula .eg { display: block; margin-top: 0.35rem; font-size: 0.9rem; font-style: italic; color: var(--ash); }

.features-cols { column-rule: 1px solid var(--line-soft); text-align: left; }
.feature { break-inside: avoid; margin-bottom: 1.4rem; padding-bottom: 1.2rem; border-bottom: 1px dotted var(--line-soft); }
.feature h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.6rem; margin-bottom: 0.35rem; color: var(--bone); }
.lvl {
  font-family: var(--font-body); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ember-text); border: 1px solid currentColor; padding: 0.08rem 0.5rem; white-space: nowrap;
}

.vow-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); gap: var(--sp-5); }
.vow-panel {
  position: relative; padding: 1.4rem 1.4rem 1.3rem 1.4rem;
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2)); border: 1px solid var(--line-soft); border-top: 3px solid var(--crimson);
}
.vow-panel .vow-ico { position: absolute; top: 1rem; right: 1rem; width: 3.2rem; height: 3.2rem; color: var(--brass-hi); }
.vow-panel h3 { padding-right: 4rem; }
.epithet { display: block; font-family: var(--font-body); font-style: italic; font-size: 0.95rem; color: var(--ash); margin-top: 0.15rem; letter-spacing: 0.02em; }
.boons { list-style: none; counter-reset: b; margin-top: 0.9rem; display: grid; gap: 0.7rem; }
.boons li { counter-increment: b; position: relative; padding-left: 2.6rem; font-size: 0.98rem; }
.boons li::before {
  content: counter(b, upper-roman); position: absolute; left: 0; top: 0.05rem;
  display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border: 1px solid var(--brass);
  border-radius: 50%; font-family: var(--font-display); font-size: 0.8rem; color: var(--brass-hi);
}

.degree-picker { display: flex; flex-wrap: wrap; align-items: end; gap: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-4); }
.degree-picker .field-pick, .degree-picker select { max-width: 16rem; }
.degree-picker label { flex-basis: 100%; margin-bottom: 0; }
.degree-picker select { flex: 0 1 16rem; }
.degree-summary { flex: 1 1 18rem; font-style: italic; color: var(--bone-2); min-height: 2.7em; }

.table-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); background: var(--panel-2); box-shadow: 0 16px 30px -22px #000; }
.table-scroll:focus-visible { outline-offset: 2px; }
.degree-table { width: 100%; min-width: 46rem; border-collapse: collapse; font-size: 0.98rem; }
.degree-table caption { text-align: left; padding: 0.7rem 1rem; font-style: italic; color: var(--bone-2); caption-side: top; border-bottom: 1px solid var(--line-soft); }
.degree-table th, .degree-table td { padding: 0.65rem 0.9rem; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.degree-table thead th { background: var(--crimson-deep); color: var(--bone); font-variant: small-caps; letter-spacing: 0.07em; font-weight: 700; font-size: 1.02rem; border-bottom: 2px solid var(--brass); }
.degree-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.03); }
.degree-table tbody th { font-family: var(--font-display); font-size: 1.3rem; color: var(--brass-hi); width: 4.5rem; }
.degree-table tbody tr.is-marked { background: rgba(176, 141, 62, 0.2); }
.degree-table tbody tr.is-marked th { box-shadow: inset 5px 0 0 var(--focus); color: var(--bone); }
.degree-table tbody tr.is-marked td { font-weight: 700; color: var(--bone); border-bottom: 2px solid var(--focus); }
.degree-table tbody tr.is-marked th { border-bottom: 2px solid var(--focus); }

.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1.1rem 2.5rem; }
.glossary > div { padding-bottom: 0.8rem; border-bottom: 1px dotted var(--line-soft); break-inside: avoid; }
.glossary dt { font-family: var(--font-display); font-variant: small-caps; letter-spacing: 0.08em; font-size: 1.2rem; color: var(--brass-hi); }
.glossary dd { color: var(--bone); font-size: 0.98rem; }

/* ---------- litanies ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-4) var(--sp-5);
  padding: 1.1rem 1.25rem 1.2rem; background: var(--panel-2); border: 1px solid var(--line);
  box-shadow: 0 14px 26px -20px #000, inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.filter-group { flex: 1 1 24rem; }
.chip-row, .preset-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-bar .field { flex: 0 1 11rem; }
.filter-bar .field-grow { flex: 1 1 14rem; grid-column: auto; }
.filter-status { margin-block: var(--sp-4); font-style: italic; color: var(--bone-2); min-height: 1.6em; }

.litany-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: var(--sp-5); }
.litany-item { display: flex; min-width: 0; }
.litany {
  display: flex; flex-direction: column; gap: 0.75rem; width: 100%;
  padding: 1.25rem 1.3rem 1.3rem;
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2) 45%);
  border: 1px solid var(--line-soft); border-top: 3px solid var(--crimson);
  box-shadow: 0 16px 28px -20px #000, inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.litany:hover { border-color: var(--brass); transform: translateY(-2px); }
.litany:target { border-color: var(--focus); }
.litany-head { display: flex; gap: 0.9rem; align-items: center; }
.litany-head h3 { font-size: 1.28rem; line-height: 1.2; }
.rank-roundel {
  flex: none; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--crimson); color: var(--bone); border: 2px solid var(--brass);
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em;
  box-shadow: 0 0 0 3px var(--panel-2), 0 0 0 4px var(--line-soft);
}
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.tag {
  display: inline-flex; align-items: center; padding: 0.05rem 0.55rem; min-height: 1.5rem;
  border: 1px solid var(--brass); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone);
}
.tag-rank { color: var(--brass-hi); border-color: var(--line); }
.tag-ward::before, .tag-rebuke::before, .tag-mercy::before, .tag-command::before {
  content: ""; width: 0.7em; height: 0.7em; margin-right: 0.45em; background: var(--ember-text);
}
.tag-ward::before { clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); }
.tag-rebuke::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.tag-mercy::before { clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%); }
.tag-command::before { clip-path: polygon(0 0, 100% 0, 72% 50%, 100% 100%, 0 100%); }
.verse { font-style: italic; color: var(--bone); padding-left: 0.9rem; border-left: 2px solid var(--ember-text); }
.effect { font-size: 0.98rem; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; padding-top: 0.75rem; border-top: 1px dotted var(--line); margin-top: auto; }
.specs dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ash); }
.specs dd { font-size: 0.93rem; color: var(--bone); }
.gm-aside { font-style: italic; font-size: 0.92rem; color: var(--bone-2); padding-top: 0.6rem; border-top: 1px dashed var(--line-soft); }
.gm-label { font-style: normal; font-variant: small-caps; letter-spacing: 0.08em; color: var(--brass-hi); font-family: var(--font-display); }

.empty-state {
  margin-top: var(--sp-5); padding: 2rem 1.5rem; text-align: center;
  border: 2px dashed var(--line); background: var(--panel-2);
}
.empty-state p { max-width: 44ch; margin-inline: auto; margin-block: 0.5rem 1rem; }
.empty-ico { width: 3.5rem; height: 3.5rem; color: var(--brass-hi); }

/* ---------- forge: panels ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2) 30%);
  border: 1px solid var(--line); padding: 1.25rem 1.4rem 1.4rem;
  box-shadow: 0 14px 28px -20px #000, inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* dice bench */
.bench-grid { display: grid; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
.die-fieldset { margin-bottom: var(--sp-4); }
.die-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.die-radio { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.die-label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
  min-height: 62px; margin: 0; padding: 0.4rem 0.2rem; cursor: pointer;
  border: 1px solid var(--brass); background: var(--ink); color: var(--bone);
  font-variant: normal; letter-spacing: 0.04em; font-family: var(--font-mono); font-size: 1rem; font-weight: 700;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.die-label svg { width: 1.7rem; height: 1.7rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.die-label:hover { background: var(--panel-3); }
.die-radio:checked + .die-label { background: var(--bone); color: var(--obsidian); border-color: var(--bone); box-shadow: inset 0 0 0 2px var(--obsidian); }
.die-radio:checked + .die-label svg { fill: currentColor; fill-opacity: 0.22; stroke-width: 2.2; }
.die-radio:focus-visible + .die-label { outline: 3px solid var(--focus); outline-offset: 3px; }

.presets { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px dotted var(--line); }
.presets-label { font-family: var(--font-display); font-variant: small-caps; letter-spacing: 0.08em; color: var(--brass-hi); margin-bottom: 0.5rem; }
.preset-row .chip { font-size: 0.95rem; }

.tray {
  display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 0.6rem 0.8rem;
  min-height: 14rem; padding: 1.25rem 1rem;
  background: radial-gradient(ellipse at 50% 30%, #3A1519, #25100F 55%, #1B0C0C);
  border: 1px solid var(--brass);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.7), inset 0 0 0 6px #1B0C0C, inset 0 0 0 7px var(--line-soft);
}
.tray-empty { align-self: center; max-width: 30ch; text-align: center; font-style: italic; color: var(--bone); }
.die { display: flex; flex-direction: column; align-items: center; width: 5rem; }
.die-svg { width: 4.5rem; height: 4.5rem; overflow: visible; }
.die-shape { fill: var(--panel); stroke: var(--brass-hi); stroke-width: 2.4; stroke-linejoin: round; }
.die-face { fill: var(--bone); font-family: var(--font-display); font-weight: 700; font-size: 24px; text-anchor: middle; dominant-baseline: central; }
.die-face.small { font-size: 18px; }
.die-cap { min-height: 1.1rem; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; color: var(--bone); text-align: center; line-height: 1.2; }
.die.is-aside .die-shape { stroke-dasharray: 5 4; fill: #160D0D; stroke: var(--ash); }
.die.is-aside .die-face { fill: var(--ash); text-decoration: line-through; }
.die.is-aside .die-cap { color: var(--ash); }
.die.is-kept .die-shape { fill: var(--crimson-deep); stroke: var(--focus); stroke-width: 3.2; }
.die.is-crit .die-shape { stroke: var(--focus); stroke-width: 4; }
.die.tumbling .die-svg { animation: tumble 0.85s cubic-bezier(0.25, 0.8, 0.35, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }

.result { margin-top: var(--sp-4); padding: 1rem 1.25rem 1.1rem; background: var(--panel-3); border: 1px solid var(--line); min-height: 6.5rem; }
.result-note { font-style: italic; color: var(--bone-2); }
.result-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; }
.result-num { font-family: var(--font-display); font-size: clamp(2.6rem, 6vw, 4rem); line-height: 1; color: var(--bone); }
.result-label { font-variant: small-caps; letter-spacing: 0.12em; font-family: var(--font-display); color: var(--brass-hi); font-size: 1.1rem; }
.result-math { margin-top: 0.4rem; font-family: var(--font-mono); font-size: 0.95rem; color: var(--bone); overflow-wrap: anywhere; }
.result-verdict { margin-top: 0.5rem; font-weight: 700; padding: 0.35rem 0.7rem; display: inline-block; border: 1px solid var(--bone); }
.result-verdict.met::before { content: "Difficulty met. "; }
.result-verdict.missed::before { content: "Difficulty missed. "; }
.result-flag { margin-top: 0.4rem; font-style: italic; color: var(--focus); }

.history { margin-top: var(--sp-5); }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.history-empty { font-style: italic; color: var(--bone-2); padding: 0.75rem 0; }
.history-scroll { max-height: 22rem; overflow: auto; border: 1px solid var(--line-soft); background: var(--ink); }
.history-scroll:focus-visible { outline-offset: 2px; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 1rem; padding: 0.55rem 0.9rem;
  border-bottom: 1px dotted var(--line-soft);
}
.h-note { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; color: var(--bone); }
.h-detail { grid-column: 1; font-family: var(--font-mono); font-size: 0.82rem; color: var(--bone-2); overflow-wrap: anywhere; }
.h-total { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-family: var(--font-display); font-size: 1.6rem; color: var(--bone); }
.h-total small { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ash); margin-left: 0.3rem; }
.notes-grid { margin-top: var(--sp-6); grid-template-columns: 1fr 1fr; align-items: start; }
.notes-grid .manuscript { columns: 1; column-rule: none; }

/* forge steps */
.forge-steps { list-style: none; display: grid; gap: var(--sp-5); }
.step-h { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.8rem; }
.step-num {
  flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 2px solid var(--brass); border-radius: 50%;
  font-size: 1rem; color: var(--brass-hi); background: var(--ink); font-family: var(--font-display);
}
.step p + .hint, .step .btn-row + .hint { margin-top: 0.6rem; }
.empty-note { margin-top: var(--sp-4); padding: 0.9rem 1rem; border: 1px dashed var(--line); font-style: italic; color: var(--bone-2); }

.stones { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; margin-top: var(--sp-4); }
.stone { padding: 0.7rem 0.8rem 0.8rem; background: var(--ink); border: 1px solid var(--brass); display: grid; gap: 0.35rem; }
.stone-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ash); }
.stone-dice { display: flex; gap: 0.3rem; }
.sd {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border: 1px solid var(--brass-hi);
  font-family: var(--font-mono); font-weight: 700; color: var(--bone); background: var(--panel-2);
}
.sd.dropped { border-style: dashed; border-color: var(--ash); color: var(--ash); text-decoration: line-through; }
.stone-total { font-family: var(--font-display); font-size: 1.9rem; line-height: 1; color: var(--bone); }
.stone-total small { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ash); margin-left: 0.4rem; font-family: var(--font-body); }
.stone-use { font-size: 0.82rem; font-style: italic; color: var(--bone-2); }
.stone.is-used { border-style: dashed; }

.growth-line { margin-top: var(--sp-4); padding: 0.6rem 0.9rem; border-left: 4px solid var(--focus); background: rgba(176, 141, 62, 0.12); }
.assign-list { list-style: none; margin-top: var(--sp-4); display: grid; gap: 0.6rem; }
.assign-row {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto 5.5rem; gap: 0.75rem 1rem; align-items: center;
  padding: 0.7rem 0.9rem; background: var(--ink); border: 1px solid var(--line-soft);
}
.ab-name label { margin: 0; font-size: 1.2rem; }
.ab-desc { display: block; font-size: 0.85rem; font-style: italic; color: var(--ash); line-height: 1.3; }
.growth-ctl { display: flex; align-items: center; gap: 0.2rem; }
.no-growth .growth-ctl { display: none; }
.no-growth .assign-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 5.5rem; }
.step-btn { width: 44px; height: 44px; border: 1px solid var(--brass); background: transparent; color: var(--bone); font-size: 1.4rem; line-height: 1; border-radius: var(--radius); }
.step-btn:hover { background: rgba(176, 141, 62, 0.25); }
.growth-ctl output { min-width: 1.7rem; text-align: center; font-family: var(--font-mono); font-weight: 700; }
.ab-score { text-align: center; line-height: 1.1; }
.ab-total { display: block; font-family: var(--font-display); font-size: 1.9rem; color: var(--bone); }
.ab-mod { display: block; font-family: var(--font-mono); font-size: 0.9rem; color: var(--brass-hi); min-height: 1.2em; }

.vow-radios { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: 0.75rem; }
.vow-radio { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.vow-choice {
  position: relative; display: flex; flex-direction: column; gap: 0.25rem; margin: 0; height: 100%;
  padding: 1rem 1rem 1.05rem; cursor: pointer; font-variant: normal; letter-spacing: 0;
  background: var(--ink); border: 1px solid var(--brass); font-family: var(--font-body); font-size: 1rem; color: var(--bone);
  transition: background-color 0.2s ease;
}
.vow-choice svg { width: 2.6rem; height: 2.6rem; color: var(--brass-hi); margin-bottom: 0.2rem; }
.vow-choice:hover { background: var(--panel-3); }
.vc-name { font-family: var(--font-display); font-size: 1.3rem; font-variant: small-caps; letter-spacing: 0.05em; }
.vc-boon { font-weight: 700; font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ember-text); }
.vc-text { font-size: 0.93rem; font-style: italic; color: var(--bone-2); }
.vow-radio:checked + .vow-choice { background: var(--panel-3); border-color: var(--bone); box-shadow: inset 0 0 0 2px var(--bone); }
.vow-radio:checked + .vow-choice::after {
  content: "Sworn"; position: absolute; top: 0.6rem; right: 0.7rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--obsidian); background: var(--bone); padding: 0.1rem 0.5rem;
}
.vow-radio:focus-visible + .vow-choice { outline: 3px solid var(--focus); outline-offset: 3px; }

/* the sheet: a parchment leaf */
.sheet {
  margin-top: var(--sp-6); padding: clamp(1.25rem, 3vw, 2.25rem);
  background-color: var(--bone); color: var(--obsidian);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .15 0 0 0 .08 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  border: 2px solid var(--brass-dark); outline: 1px solid var(--crimson-deep); outline-offset: -8px;
  box-shadow: 0 30px 50px -28px #000, 0 10px 18px -10px rgba(0, 0, 0, 0.8);
}
.sheet h3, .sheet h4, .sheet strong { color: var(--obsidian); }
.sheet-head { display: flex; align-items: center; gap: 1rem; padding-bottom: 0.8rem; border-bottom: 2px solid var(--obsidian); }
.sheet-sigil { width: 3.4rem; height: 3.4rem; flex: none; }
.sheet-kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--crimson-deep); }
.sheet-name { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem); overflow-wrap: anywhere; }
.sheet-incomplete { margin-top: 1rem; padding: 0.7rem 0.9rem; border: 1px dashed var(--crimson-deep); color: #3B1010; font-style: italic; }
.sheet-id { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.5rem 1rem; margin-top: 1rem; }
.sheet-id dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #5A3A1A; }
.sheet-id dd { font-family: var(--font-display); font-size: 1.35rem; }
.sheet-h { margin-top: 1.3rem; margin-bottom: 0.6rem; padding-bottom: 0.2rem; color: var(--crimson-deep); border-bottom: 1px solid var(--brass-dark); }
.sheet .sheet-h { color: var(--crimson-deep); }
.sheet-abs { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(6.2rem, 1fr)); gap: 0.6rem; }
.sheet-abs li { text-align: center; padding: 0.5rem 0.3rem 0.55rem; border: 1.5px solid var(--obsidian); background: rgba(255, 255, 255, 0.35); }
.sa-name { display: block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #3B2A22; }
.sa-score { display: block; font-family: var(--font-display); font-size: 1.9rem; line-height: 1.1; }
.sa-mod { display: block; font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem; color: var(--crimson-deep); }
.sheet-stats { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.6rem; }
.sheet-stats li { padding: 0.55rem 0.8rem 0.65rem; border: 1.5px solid var(--obsidian); background: rgba(255, 255, 255, 0.35); }
.ss-name { display: block; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #3B2A22; }
.ss-val { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1.1; }
.ss-math { display: block; font-size: 0.82rem; font-style: italic; color: #3B2A22; line-height: 1.35; }
.pip-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin-top: 0.4rem; }
.pip-label { font-size: 0.92rem; }
.pips { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.pip { width: 1.15rem; height: 1.15rem; border: 1.5px solid var(--obsidian); border-radius: 50%; background: transparent; }
.write-line { display: inline-block; width: 9rem; max-width: 100%; height: 1.2rem; border-bottom: 1.5px solid var(--obsidian); }
.sheet-lit, .sheet-feat { margin-left: 1.2rem; display: grid; gap: 0.25rem; }
.sheet-feat { list-style: square; }
.sheet-lit li, .sheet-feat li { font-size: 0.96rem; }
.sheet-lit .sl-meta { color: #3B2A22; font-style: italic; font-size: 0.88rem; }
.notes-lines { height: 6rem; background-image: repeating-linear-gradient(transparent 0, transparent 1.7rem, rgba(15, 10, 10, 0.55) 1.7rem, rgba(15, 10, 10, 0.55) calc(1.7rem + 1px)); }
.sheet-foot { margin-top: 1rem; font-size: 0.78rem; font-style: italic; color: #3B2A22; text-align: center; }

/* ---------- contact ---------- */
.letter-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 2.75rem); align-items: start; }
.letter {
  position: relative; padding: 2rem clamp(1.1rem, 3vw, 2rem) 1.6rem;
  background: linear-gradient(180deg, var(--panel-3), var(--panel-2) 28%); border: 1px solid var(--line);
  box-shadow: 0 22px 36px -24px #000, inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 0 0 6px var(--panel-2), inset 0 0 0 7px var(--line-soft);
}
.letter form { display: grid; gap: var(--sp-4); }
.wax-seal { position: absolute; top: -1.4rem; right: 1.4rem; width: 5rem; height: 5rem; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6)); }
.letter-preview { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px dashed var(--line); }
.letter-text {
  margin-top: 0.6rem; padding: 1rem; max-height: 20rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: var(--font-mono); font-size: 0.92rem; line-height: 1.5; background: var(--ink); border: 1px dashed var(--brass); color: var(--bone);
}
.letter-text:focus-visible { outline-offset: 2px; }
.letter-side { display: grid; gap: var(--sp-4); }

.faq { display: grid; gap: 0.6rem; max-width: 54rem; }
.faq details { background: var(--panel-2); border: 1px solid var(--line-soft); }
.faq details[open] { border-color: var(--brass); background: var(--panel-3); }
.faq summary {
  position: relative; display: flex; align-items: center; min-height: 52px; padding: 0.7rem 3rem 0.7rem 1.1rem;
  font-family: var(--font-display); font-size: 1.2rem; list-style: none; cursor: pointer; color: var(--bone);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 1.2rem; top: 50%; width: 0.6rem; height: 0.6rem;
  border-right: 2px solid var(--brass-hi); border-bottom: 2px solid var(--brass-hi);
  transform: translateY(-70%) rotate(45deg); transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details p { padding: 0 1.1rem 1.1rem; max-width: 62ch; }
.faq summary:focus-visible { outline-offset: -3px; }

/* ---------- animation ---------- */
@keyframes flicker {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  14% { opacity: 1; transform: scale(1.04); }
  31% { opacity: 0.7; transform: scale(0.97); }
  47% { opacity: 0.95; transform: scale(1.02); }
  63% { opacity: 0.75; transform: scale(0.985); }
  82% { opacity: 1; transform: scale(1.03); }
}
@keyframes flame {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  22% { transform: scale(0.95, 1.06) rotate(-1.4deg); }
  48% { transform: scale(1.04, 0.96) rotate(1.1deg); }
  74% { transform: scale(0.98, 1.05) rotate(-0.7deg); }
}
@keyframes rise {
  from { transform: translateY(12px); }
  to { transform: none; }
}
@keyframes tumble {
  0% { transform: translateY(-46px) rotate(0deg) scale(0.7); }
  38% { transform: translateY(0) rotate(250deg) scale(1.08); }
  58% { transform: translateY(-16px) rotate(440deg) scale(1); }
  80% { transform: translateY(0) rotate(660deg) scale(1.03); }
  100% { transform: translateY(0) rotate(720deg) scale(1); }
}
@keyframes drop {
  from { transform: translateY(-1.2rem); }
  to { transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .ribbon-nav li { animation: drop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
  .ribbon-nav li:nth-child(2) { animation-delay: 0.05s; }
  .ribbon-nav li:nth-child(3) { animation-delay: 0.1s; }
  .ribbon-nav li:nth-child(4) { animation-delay: 0.15s; }
  .ribbon-nav li:nth-child(5) { animation-delay: 0.2s; }
}

/* ---------- responsive ---------- */
@media (max-width: 64rem) {
  .codex-layout { grid-template-columns: minmax(0, 1fr); }
  .leaves { position: static; padding: 0 0 var(--sp-4); border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .leaves ol { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1.5rem; }
  .bench-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 56rem) {
  .leaf-grid { grid-template-columns: minmax(0, 1fr); }
  .marginalia { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-art { width: min(100%, 22rem); order: -1; margin-bottom: var(--sp-4); }
  .office-grid { grid-template-columns: minmax(0, 1fr); }
  .letter-grid { grid-template-columns: minmax(0, 1fr); }
  .notes-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
  .page-title::after { opacity: 0.4; }
}
@media (max-width: 49.9rem) {
  .header-inner { align-items: center; }
  .brand-sub { display: none; }
  .nav-toggle {
    display: none; align-items: center; gap: 0.6rem; min-height: 46px; padding: 0.4rem 1rem;
    background: var(--crimson); color: var(--bone); border: 1px solid var(--brass);
    font-family: var(--font-display); font-variant: small-caps; font-size: 1.1rem; font-weight: 700; letter-spacing: 0.08em;
  }
  .js .nav-toggle { display: inline-flex; }
  .nav-toggle::before {
    content: ""; width: 1rem; height: 0.8rem;
    background: linear-gradient(currentColor 0 2px, transparent 2px 6px, currentColor 6px 8px, transparent 8px 12px, currentColor 12px 14px) center / 100% 14px no-repeat;
    height: 14px;
  }
  .nav-toggle[aria-expanded="true"] { background: var(--bone); color: var(--obsidian); }
  .ribbon-nav { flex-basis: 100%; }
  .js .ribbon-nav { display: none; }
  .js .ribbon-nav.is-open { display: block; }
  .ribbon-nav ul { flex-direction: column; gap: 0.4rem; padding: 0.25rem 0 1.1rem; }
  .ribbon {
    width: 100%; height: auto !important; min-height: 48px; padding: 0.7rem 1.2rem; justify-content: flex-start; align-items: center;
    clip-path: polygon(0 0, 100% 0, calc(100% - 16px) 50%, 100% 100%, 0 100%);
    font-size: 1.15rem;
  }
  .folio { margin-top: 1.75rem; }
}
@media (max-width: 40rem) {
  .manuscript { text-align: left; hyphens: manual; -webkit-hyphens: manual; }
  .die-picker { grid-template-columns: repeat(4, 1fr); }
  .assign-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name score" "select select" "growth growth"; }
  .assign-row .ab-name { grid-area: name; }
  .assign-row select { grid-area: select; }
  .assign-row .growth-ctl { grid-area: growth; }
  .assign-row .ab-score { grid-area: score; }
  .no-growth .assign-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name score" "select select"; }
  .field-grow { grid-column: auto; }
  .specs { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .page-title::after { width: 7rem; top: 1%; opacity: 0.3; }
  .wax-seal { width: 4rem; height: 4rem; top: -1rem; right: 1rem; }
  .sheet-abs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sa-name { font-size: 0.66rem; letter-spacing: 0.06em; }
}
@media (min-width: 120rem) {
  body { font-size: 1.2rem; }
}

/* ---------- reduced motion: static, final state everywhere ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    animation-delay: 0s !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .candle-glow, .page-title::before { opacity: 0.9; transform: none; }
  .btn:hover, .btn:active, .folio-card:hover, .litany:hover { transform: none; }
}

/* ---------- print: the sheet, plainly ---------- */
@page { margin: 12mm; }
@media print {
  :root { color-scheme: light; }
  html, body { background: #fff !important; color: #000 !important; }
  body { font-size: 11pt; }
  .site-header, .site-footer, .skip-link, .no-print, .sprite + .no-print { display: none !important; }
  .folio {
    width: 100%; margin: 0; padding: 0; background: #fff !important; border: 0; box-shadow: none;
  }
  .folio::before, .folio::after { display: none; }
  .leaf { padding: 0; }
  .sheet {
    margin: 0; padding: 0.6cm; background: #fff !important; color: #000; border: 2px solid #000; outline: 0; box-shadow: none;
    break-inside: avoid;
  }
  .sheet *, .sheet h3, .sheet h4 { color: #000 !important; }
  .sheet-abs li, .sheet-stats li { background: #fff !important; border: 1.5px solid #000; break-inside: avoid; }
  .sheet-h { border-bottom: 1px solid #000; }
  .sheet-incomplete { border-color: #000; }
  .sheet-sigil { filter: grayscale(1); }
  a { color: #000; }
}

/* disabled select: still legible, clearly inert */
select:disabled { color: var(--ash); opacity: 1; border-style: dashed; cursor: not-allowed; }
