/* ==========================================================================
   The Obscura Files — main stylesheet
   Mobile-first. One file, no build step. Sections:
   1. Fonts  2. Tokens  3. Base  4. Layout  5. Header & nav  6. Buttons
   7. Section furniture  8. Hero  9. Prints & cards  10. Featured
   11. Parchment / editorial  12. Library tools  13. Callouts & notices
   14. Footer  15. Utilities & motion
   ========================================================================== */

/* 1. Fonts (self-hosted, SIL OFL — licenses in /assets/fonts) ------------- */
@font-face {
  font-family: "Libre Caslon Display";
  src: url("/assets/fonts/libre-caslon-display-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* 2. Tokens --------------------------------------------------------------- */
:root {
  /* Ink: warm near-blacks and charcoals */
  --ink-950: #0c0b0a;
  --ink-900: #13110f;
  --ink-850: #191613;
  --ink-800: #201c18;
  --ink-700: #2c2722;
  /* Paper: archival parchment */
  --paper-100: #f1e8d6;
  --paper-200: #e8dcc3;
  --paper-300: #d9c9a8;
  --paper-ink: #251e16;
  --paper-ink-soft: #54473a;
  /* Text on dark */
  --text: #e6dcc8;
  --text-soft: #b9ad97;
  --text-faint: #8f846f;
  /* Accents */
  --gold: #c6a465;
  --gold-bright: #e2c48a;
  --gold-deep: #8a6d3b;
  --oxblood: #9b2f24;
  --oxblood-bright: #d9604f;
  /* Lines */
  --rule: rgba(198, 164, 101, 0.22);
  --rule-strong: rgba(198, 164, 101, 0.45);
  --rule-paper: rgba(37, 30, 22, 0.22);

  --font-display: "Libre Caslon Display", "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --font-text: "Source Serif 4", Georgia, Cambria, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0: clamp(1.02rem, 0.98rem + 0.2vw, 1.13rem);
  --step-1: clamp(1.22rem, 1.13rem + 0.45vw, 1.5rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 2.1rem);
  --step-3: clamp(1.95rem, 1.6rem + 1.7vw, 3.05rem);
  --step-4: clamp(2.45rem, 1.8rem + 3.2vw, 4.6rem);

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1200px;
  --measure: 66ch;
  --radius: 3px;
  --header-h: 68px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: dark;
}

/* 3. Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--ink-950);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Film-grain overlay: one tiny SVG, fixed, non-interactive */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background-image: url("/assets/img/texture/grain.svg");
  background-size: 240px 240px;
  opacity: 0.07;
  mix-blend-mode: overlay;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--gold-bright); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--paper-100); }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--gold); color: var(--ink-950); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--paper-100);
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p { margin: 0 0 1.1em; text-wrap: pretty; }
ul, ol { padding-left: 1.2em; }
li { margin-bottom: 0.45em; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
code { font-family: var(--font-mono); font-size: 0.86em; background: rgba(198,164,101,0.1); padding: 0.1em 0.35em; border-radius: 2px; overflow-wrap: anywhere; }
abbr[title] { text-decoration: underline dotted; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--gold); color: var(--ink-950);
  padding: 10px 16px; font-family: var(--font-mono); font-size: 0.85rem; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* 4. Layout --------------------------------------------------------------- */
.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: 820px; }
.section { padding-block: clamp(64px, 9vw, 120px); position: relative; }
.section--tight { padding-block: clamp(44px, 6vw, 72px); }
.section--ink { background: var(--ink-900); }
.section + .section--ink, .section--ink + .section { border-top: 1px solid var(--rule); }
main { display: block; }

/* 5. Header & nav --------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 11, 10, 0.86);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: var(--header-h);
}
.brand {
  display: inline-flex; align-items: center; gap: 12px;
  color: var(--paper-100); text-decoration: none;
}
.brand:hover { color: var(--gold-bright); }
.brand__mark { width: 40px; height: 40px; border-radius: 50%; box-shadow: 0 0 0 1px var(--rule-strong); }
.brand__name { font-family: var(--font-display); font-size: 1.22rem; letter-spacing: 0.01em; line-height: 1; white-space: nowrap; }
.brand__name small { display: block; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-faint); margin-top: 5px; }

.nav-toggle {
  display: none;
  align-items: center; gap: 10px;
  background: transparent; color: var(--paper-100);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 9px 12px; font: 500 0.72rem/1 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase;
  cursor: pointer;
}
.nav-toggle__bars { position: relative; width: 16px; height: 10px; }
.nav-toggle__bars::before, .nav-toggle__bars::after {
  content: ""; position: absolute; left: 0; right: 0; height: 1.5px; background: currentColor;
  transition: transform 0.25s var(--ease), top 0.25s var(--ease);
}
.nav-toggle__bars::before { top: 1px; }
.nav-toggle__bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { top: 4px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { top: 4px; transform: rotate(-45deg); }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.site-nav li { margin: 0; }
.site-nav a {
  display: inline-block; padding: 8px 12px;
  color: var(--text-soft); text-decoration: none;
  font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--paper-100); }
.site-nav a[aria-current="page"] { color: var(--gold-bright); border-bottom-color: var(--gold); }
.site-nav .btn { margin-left: 6px; }

/* JS-enhanced mobile menu. Without JS the links simply wrap below the brand. */
@media (max-width: 859px) {
  .site-header__inner { flex-wrap: wrap; padding-block: 10px; }
  .js .site-header__inner { flex-wrap: nowrap; padding-block: 0; }
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    background: var(--ink-900);
    border-bottom: 1px solid var(--rule-strong);
    box-shadow: 0 30px 60px rgba(0,0,0,0.55);
    padding: 12px var(--gutter) 28px;
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), visibility 0s linear 0.22s;
  }
  .js .site-nav.is-open { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  .js .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .js .site-nav a { display: block; padding: 16px 2px; font-size: 0.82rem; border-bottom: 1px solid var(--rule); }
  .js .site-nav a[aria-current="page"] { border-bottom-color: var(--rule); }
  .js .site-nav .btn { margin: 20px 0 0; display: flex; justify-content: center; border-bottom: 1px solid var(--gold); }
}

/* 6. Buttons -------------------------------------------------------------- */
.btn {
  --btn-bg: transparent; --btn-fg: var(--paper-100); --btn-bd: var(--rule-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 22px; min-height: 48px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1px solid var(--btn-bd); border-radius: var(--radius);
  font: 500 0.78rem/1.2 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase;
  text-decoration: none; cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn:hover { --btn-bd: var(--gold-bright); color: var(--paper-100); transform: translateY(-1px); }
.btn--primary { --btn-bg: var(--gold); --btn-fg: var(--ink-950); --btn-bd: var(--gold); }
.btn--primary:hover { --btn-bg: var(--gold-bright); --btn-bd: var(--gold-bright); color: var(--ink-950); }
.btn--small { padding: 10px 14px; min-height: 40px; font-size: 0.7rem; }
.site-nav a.btn { display: inline-flex; gap: 8px; color: var(--ink-950); padding: 10px 14px; border-bottom: 1px solid var(--gold); }
.site-nav .btn:hover { color: var(--ink-950); }
.btn__icon { width: 1.05em; height: 1.05em; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* 7. Section furniture ---------------------------------------------------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 18px;
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; opacity: 0.8; }
.section-head { display: grid; gap: 8px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head h2 { margin: 0; }
.section-head p { color: var(--text-soft); max-width: 58ch; margin: 6px 0 0; }
.section-head--split { align-items: end; }
@media (min-width: 860px) {
  .section-head--split { grid-template-columns: 1fr auto; column-gap: 40px; }
  .section-head--split > :last-child:not(:first-child) { grid-row: 1 / span 3; grid-column: 2; align-self: end; }
}
.rule-ornament {
  display: flex; align-items: center; gap: 14px; color: var(--gold-deep);
  margin: 0 auto; max-width: 320px;
}
.rule-ornament::before, .rule-ornament::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: 0.6; }
.rule-ornament span { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid currentColor; }

.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  font: 500 0.7rem/1.5 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-faint);
}
.meta > * + *::before { content: "·"; margin-right: 14px; color: var(--gold-deep); }

/* 8. Hero ----------------------------------------------------------------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  padding-block: clamp(56px, 10vw, 128px) clamp(64px, 10vw, 120px);
  border-bottom: 1px solid var(--rule);
}
/* Lamp light + faint survey grid, all CSS */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(ellipse 60% 55% at 22% 18%, rgba(198,164,101,0.16), transparent 70%),
    radial-gradient(ellipse 70% 60% at 85% 70%, rgba(155,47,36,0.10), transparent 70%),
    linear-gradient(180deg, var(--ink-900), var(--ink-950));
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(198,164,101,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(198,164,101,0.06) 1px, transparent 1px);
  background-size: 88px 88px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 45%, #000 20%, transparent 75%);
}
.hero__grid { display: grid; gap: clamp(48px, 7vw, 72px); align-items: center; }
@media (min-width: 980px) { .hero__grid { grid-template-columns: 1.08fr 0.92fr; } }
.hero h1 { font-size: clamp(2.6rem, 1.6rem + 4.4vw, 5.3rem); line-height: 1.02; margin-bottom: 0.38em; }
.hero h1 em { font-style: normal; color: var(--gold-bright); }
.hero__lead { font-size: var(--step-1); line-height: 1.55; color: var(--text-soft); max-width: 34em; margin-bottom: 2rem; }
.hero__sign {
  margin: 2.2rem 0 0; display: flex; align-items: center; gap: 14px;
  font-style: italic; color: var(--text-faint); font-size: var(--step-0);
}
.hero__sign::before { content: ""; width: 40px; height: 1px; background: var(--oxblood-bright); }

/* The evidence board: three mounted prints joined by a red thread */
.board { position: relative; aspect-ratio: 5 / 4; max-width: 560px; width: 100%; margin-inline: auto; }
.board__thread { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.board__thread path { fill: none; stroke: var(--oxblood-bright); stroke-width: 1.4; opacity: 0.85; }
.board__thread circle { fill: var(--oxblood-bright); stroke: rgba(0,0,0,0.5); stroke-width: 1; }
.board .print { position: absolute; width: 62%; }
.board .print:nth-of-type(1) { left: 0; top: 4%; transform: rotate(-4deg); z-index: 1; }
.board .print:nth-of-type(2) { right: 0; top: 22%; transform: rotate(3deg); z-index: 1; }
.board .print:nth-of-type(3) { left: 14%; bottom: 0; transform: rotate(-1.2deg); z-index: 1; }
@media (prefers-reduced-motion: no-preference) {
  .board .print { animation: settle 1.1s var(--ease) both; }
  .board .print:nth-of-type(2) { animation-delay: 0.12s; }
  .board .print:nth-of-type(3) { animation-delay: 0.24s; }
  .board__thread { animation: fade 1.2s ease 0.7s both; }
}
@keyframes settle { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Interior page hero */
.page-hero {
  position: relative; isolation: isolate;
  padding-block: clamp(56px, 9vw, 110px) clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--rule);
}
.page-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 55% 80% at 15% 0%, rgba(198,164,101,0.13), transparent 70%), var(--ink-950);
}
.page-hero h1 { max-width: 16em; }
.page-hero__lead { font-size: var(--step-1); color: var(--text-soft); max-width: 40em; margin: 0; }

/* 9. Prints & cards ------------------------------------------------------- */
/* A "print" is a thumbnail mounted on a paper mat with photo corners */
.print {
  position: relative; margin: 0;
  background: var(--paper-200);
  padding: clamp(6px, 1.2vw, 10px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 18px 40px -12px rgba(0,0,0,0.75), 0 2px 6px rgba(0,0,0,0.5);
}
.print img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--ink-800); }
.print::before, .print::after {
  content: ""; position: absolute; width: 18px; height: 18px; z-index: 1;
  border: 9px solid transparent;
}
.print::before { left: -1px; top: -1px; border-top-color: var(--ink-850); border-left-color: var(--ink-850); }
.print::after { right: -1px; bottom: -1px; border-bottom-color: var(--ink-850); border-right-color: var(--ink-850); }

.card-grid { display: grid; gap: clamp(28px, 4vw, 40px) clamp(20px, 3vw, 32px); grid-template-columns: 1fr; list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card-grid > li { margin: 0; }

.doc-card { position: relative; display: flex; flex-direction: column; height: 100%; }
.doc-card .print { transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease); }
.doc-card .print img { filter: saturate(0.92) contrast(1.02); transition: filter 0.35s var(--ease); }
.doc-card:hover .print, .doc-card:focus-within .print { transform: translateY(-4px) rotate(-0.4deg); box-shadow: 0 1px 0 rgba(255,255,255,0.08) inset, 0 28px 50px -14px rgba(0,0,0,0.85), 0 2px 6px rgba(0,0,0,0.5); }
.doc-card:hover .print img { filter: saturate(1.05) contrast(1.04); }
.doc-card__body { display: flex; flex-direction: column; flex: 1; padding-top: 20px; }
.doc-card__era { font: 500 0.68rem/1.4 var(--font-mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin: 0 0 10px; }
.doc-card__no { color: var(--text-faint); margin-right: 10px; padding-right: 10px; border-right: 1px solid var(--rule-strong); }
.doc-card__no:last-child { margin-right: 0; padding-right: 0; border-right: 0; }
.doc-card h3 { font-size: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem); line-height: 1.2; margin: 0 0 10px; }
.doc-card h3 a { color: var(--paper-100); text-decoration: none; }
.doc-card h3 a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.doc-card h3 a:hover { color: var(--gold-bright); }
.doc-card h3 a:focus-visible { outline: none; }
.doc-card:focus-within { outline: 2px solid var(--gold-bright); outline-offset: 8px; }
.doc-card__summary { color: var(--text-soft); font-size: 0.98rem; line-height: 1.6; margin-bottom: 16px; }
.doc-card__foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--rule); }
.doc-card__watch { color: var(--gold-bright); margin-left: auto; }
.doc-card__watch::before { display: none; }

.badge {
  display: inline-block; padding: 3px 8px;
  font: 500 0.64rem/1.3 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase;
  border: 1px solid currentColor; border-radius: 2px;
}
.badge--placeholder { color: #ffb347; background: rgba(255,179,71,0.08); }

/* 10. Featured ------------------------------------------------------------ */
.featured {
  position: relative;
  display: grid; gap: clamp(28px, 4vw, 56px); align-items: center;
  padding: clamp(18px, 3vw, 40px);
  background: linear-gradient(135deg, var(--ink-850), var(--ink-900));
  border: 1px solid var(--rule);
}
@media (min-width: 900px) { .featured { grid-template-columns: 1.25fr 1fr; } }
.featured .print { transform: rotate(-0.8deg); }
.featured h3 { font-size: var(--step-3); line-height: 1.08; margin-bottom: 18px; }
.featured__summary { color: var(--text-soft); font-size: var(--step-0); margin-bottom: 24px; }
.featured .meta { margin-bottom: 26px; }
.stamp {
  display: inline-block; margin-bottom: 20px;
  padding: 6px 12px 5px;
  color: var(--oxblood-bright);
  border: 2px solid currentColor; border-radius: 2px;
  font: 500 0.7rem/1 var(--font-mono); letter-spacing: 0.24em; text-transform: uppercase;
  transform: rotate(-2deg);
  box-shadow: 0 0 0 1px rgba(196,71,58,0.25) inset;
}

/* 11. Parchment / editorial ---------------------------------------------- */
.parchment {
  position: relative; isolation: isolate;
  background-color: var(--paper-200);
  background-image:
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(120,90,50,0.28) 100%),
    url("/assets/img/texture/grain.svg");
  background-size: auto, 240px 240px;
  color: var(--paper-ink);
  --rule: var(--rule-paper);
}
.parchment h1, .parchment h2, .parchment h3, .parchment h4 { color: var(--paper-ink); }
.parchment p, .parchment li { color: var(--paper-ink); }
.parchment .eyebrow { color: var(--oxblood); }
.parchment a { color: var(--oxblood); }
.parchment a:hover { color: var(--paper-ink); }
.parchment .lede { color: var(--paper-ink-soft); }
.parchment a.btn { --btn-fg: var(--paper-ink); --btn-bd: rgba(37,30,22,0.45); color: var(--btn-fg); }
.parchment a.btn:hover { --btn-bd: var(--paper-ink); }
.parchment a.btn--primary { --btn-bg: var(--paper-ink); --btn-fg: var(--paper-100); --btn-bd: var(--paper-ink); }
.parchment a.btn--primary:hover { --btn-bg: var(--oxblood); --btn-bd: var(--oxblood); }
.parchment :focus-visible { outline-color: var(--oxblood); }

.mission { display: grid; gap: clamp(36px, 6vw, 72px); }
@media (min-width: 960px) { .mission { grid-template-columns: 0.9fr 1.1fr; } }
.mission__statement { font-family: var(--font-display); font-size: var(--step-3); line-height: 1.12; margin: 0; }
.principles { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: p; }
.principles li { counter-increment: p; display: grid; grid-template-columns: 56px 1fr; gap: 4px 12px; padding: 22px 0; border-top: 1px solid var(--rule-paper); margin: 0; }
.principles li:last-child { border-bottom: 1px solid var(--rule-paper); }
.principles li::before { content: counter(p, upper-roman) "."; font-family: var(--font-display); font-size: 1.4rem; color: var(--oxblood); grid-row: span 2; line-height: 1.2; }
.principles h3 { font-size: var(--step-1); margin: 0; }
.principles p { margin: 0; color: var(--paper-ink-soft); }

.prose { max-width: var(--measure); }
.prose h2 { font-size: var(--step-2); margin-top: 2.2em; }
.prose h3 { font-size: var(--step-1); margin-top: 1.8em; }
.prose > :first-child { margin-top: 0; }
.prose ul li::marker { color: var(--gold); }
.parchment .prose ul li::marker { color: var(--oxblood); }
.dropcap::first-letter {
  float: left; font-family: var(--font-display); font-size: 4.6em; line-height: 0.82;
  padding: 0.06em 0.1em 0 0; color: var(--oxblood);
}
.lede { font-size: var(--step-1); line-height: 1.55; color: var(--text-soft); }

.editorial { display: grid; gap: clamp(32px, 5vw, 64px); }
@media (min-width: 960px) { .editorial { grid-template-columns: 220px minmax(0, 1fr); } }
.editorial__aside { font: 500 0.72rem/1.7 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-ink-soft); }
.editorial__aside nav ul { list-style: none; padding: 0; margin: 0; }
.editorial__aside nav a { text-decoration: none; color: inherit; display: block; padding: 6px 0; border-bottom: 1px solid var(--rule-paper); }
.editorial__aside nav a:hover { color: var(--oxblood); }
@media (min-width: 960px) { .editorial__aside nav { position: sticky; top: calc(var(--header-h) + 32px); } }

/* Definition-style table used on Orgo pages */
.spec { width: 100%; border-collapse: collapse; margin: 1.5rem 0 2rem; font-size: 0.98rem; }
.spec caption { text-align: left; font: 500 0.72rem/1.5 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); padding-bottom: 10px; }
.spec th, .spec td { text-align: left; vertical-align: top; padding: 14px 16px 14px 0; border-top: 1px solid var(--rule); }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: 1px solid var(--rule); }
.spec th { font-weight: 600; color: var(--paper-100); width: 40%; }
.spec td { color: var(--text-soft); }
@media (max-width: 640px) {
  .spec, .spec tbody, .spec tr, .spec th, .spec td { display: block; width: 100%; }
  .spec th { padding-bottom: 4px; }
  .spec td { border-top: 0; padding-top: 0; }
}

.panel-grid { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); list-style: none; padding: 0; margin: 0; }
@media (min-width: 760px) { .panel-grid { grid-template-columns: repeat(3, 1fr); } }
.panel-grid > li { background: var(--ink-900); padding: clamp(22px, 3vw, 34px); margin: 0; }
.panel-grid h3 { font-size: var(--step-1); margin-bottom: 10px; }
.panel-grid p { color: var(--text-soft); margin: 0; font-size: 0.98rem; }
.panel-grid .panel__no { display: block; font: 500 0.68rem/1 var(--font-mono); letter-spacing: 0.2em; color: var(--gold); margin-bottom: 18px; }

/* 12. Library tools ------------------------------------------------------- */
.library-tools {
  display: grid; gap: 14px; align-items: end;
  padding: 18px; margin-bottom: clamp(32px, 5vw, 48px);
  border: 1px solid var(--rule); background: var(--ink-900);
}
@media (min-width: 720px) { .library-tools { grid-template-columns: 1fr auto auto; } }
.field { display: grid; gap: 6px; }
.field label { font: 500 0.68rem/1 var(--font-mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-faint); }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: var(--ink-950); color: var(--paper-100);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  font: 400 1rem/1.3 var(--font-text);
}
.field select { padding-right: 36px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field input::placeholder { color: var(--text-faint); }
.field input:focus, .field select:focus { border-color: var(--gold-bright); outline: none; box-shadow: 0 0 0 3px rgba(198,164,101,0.22); }
.library-count { font: 500 0.72rem/1.3 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-soft); padding-bottom: 14px; white-space: nowrap; }
.library-empty { padding: 40px 0; text-align: center; color: var(--text-soft); }
.no-js-only { display: block; }
.js .no-js-only { display: none; }
.js-only { display: none !important; }
.js .js-only { display: grid !important; }

/* 13. Callouts & notices -------------------------------------------------- */
.callout {
  border: 1px solid var(--rule-strong); border-left: 3px solid var(--gold);
  background: rgba(198,164,101,0.06);
  padding: 18px 20px; margin: 1.5rem 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout__title { display: block; font: 500 0.7rem/1.4 var(--font-mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }

/* Owner-confirmation markers: deliberately loud so nothing ships by accident.
   `node scripts/check.mjs` fails while any [data-owner-confirm] remains. */
.tbc {
  display: block;
  border: 1px dashed #ffb347; background: rgba(255,179,71,0.08);
  color: #ffd9a3; padding: 14px 16px; margin: 1rem 0 1.3rem;
  font-size: 0.95rem; line-height: 1.55;
}
.tbc::before {
  content: "Owner confirmation required";
  display: block; margin-bottom: 6px;
  font: 500 0.66rem/1.3 var(--font-mono); letter-spacing: 0.18em; text-transform: uppercase; color: #ffb347;
}
.tbc--inline { display: inline; padding: 1px 6px; margin: 0; }
.tbc--inline::before { display: inline; content: "TO CONFIRM: "; margin: 0; }
.draft-banner {
  background: #2a1d0b; color: #ffd9a3;
  border-bottom: 1px solid #6b4a1a;
  font: 500 0.74rem/1.5 var(--font-mono); letter-spacing: 0.08em;
  padding: 12px 0;
}
.draft-banner strong { color: #ffb347; letter-spacing: 0.16em; text-transform: uppercase; margin-right: 8px; }

/* 14. Footer -------------------------------------------------------------- */
.site-footer { background: var(--ink-950); border-top: 1px solid var(--rule); padding-block: clamp(56px, 7vw, 88px) 32px; font-size: 0.95rem; }
.footer-grid { display: grid; gap: 40px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.4fr repeat(3, 1fr); } }
.footer-brand p { color: var(--text-faint); max-width: 30ch; margin-top: 16px; font-style: italic; }
.footer-col h2 { font: 500 0.7rem/1.4 var(--font-mono); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); margin: 0 0 16px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin: 0 0 10px; }
.footer-col a { color: var(--text-soft); text-decoration: none; }
.footer-col a:hover { color: var(--paper-100); text-decoration: underline; }
.footer-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  margin-top: clamp(48px, 6vw, 72px); padding-top: 24px; border-top: 1px solid var(--rule);
  font: 500 0.68rem/1.6 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint);
}
.ext::after { content: "↗"; display: inline-block; margin-left: 0.3em; font-family: var(--font-text); font-size: 0.85em; }

/* 15. Utilities & motion -------------------------------------------------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-lg { margin-top: clamp(32px, 5vw, 56px); }
.support { text-align: center; max-width: 720px; margin-inline: auto; }
.support h2 { margin-bottom: 0.4em; }
.support p:not(.eyebrow) { color: var(--text-soft); font-size: var(--step-1); line-height: 1.55; }
.support .btn-row { justify-content: center; margin-top: 28px; }
.support p.support__note { margin: 28px auto 0; padding-top: 22px; max-width: 34em; border-top: 1px solid var(--rule); font-size: var(--step-0); color: var(--text-faint); font-style: italic; }
.support__note a { font-style: normal; }

.reveal { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; translate: 0 18px; transition: opacity 0.8s var(--ease), translate 0.8s var(--ease); }
  .js .reveal.is-visible { opacity: 1; translate: 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

@media print {
  body::before, .site-header, .site-footer, .nav-toggle, .btn-row { display: none !important; }
  body { background: #fff; color: #000; }
  .parchment, .section--ink, .page-hero::before { background: #fff !important; }
  h1, h2, h3, p, li, td, th { color: #000 !important; }
}
