:root {
  --bg: #F7F2E8; --surface: #EFE7D5; --rule: #E4D8BC;
  --ink: #3D2A0E; --ink-body: #2C1F0B; --ink-2: #6B5436;
  --accent: #7A5C12; --accent-2: #b69648;
  --rubric: #7A2020;
  --shadow: 0 2px 6px rgba(61,42,14,0.08), 0 1px 2px rgba(61,42,14,0.06);
  --shadow-lg: 0 4px 16px rgba(61,42,14,0.10), 0 2px 4px rgba(61,42,14,0.06);
  --focus-ring: 0 0 0 3px rgba(139,105,20,0.45);
}
[data-theme="night"] {
  --bg: #1A1410; --surface: #221B14; --rule: #3A2E1F;
  --ink: #E8D9B8; --ink-body: #D9C99F; --ink-2: #9C8862;
  --accent: #C9A14A; --accent-2: #b69348;
  --rubric: #e8736e;
  --shadow: 0 2px 6px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.6), 0 2px 4px rgba(0,0,0,0.4);
  --focus-ring: 0 0 0 3px rgba(201,161,74,0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; padding: 0;
  font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
  font-size: 19px; line-height: 1.65;
  color: var(--ink-body); background: var(--bg);
  transition: background-color 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: 0.035;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(139,105,20,0.6) 0, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(122,32,32,0.4) 0, transparent 40%),
    repeating-linear-gradient(0deg, transparent 0, transparent 2px, rgba(61,42,14,0.06) 2px, rgba(61,42,14,0.06) 3px);
  z-index: 0;
}
.skip-link {
  position: absolute; top: -40px; left: 1rem;
  background: var(--ink); color: var(--bg);
  padding: 0.5rem 1rem; text-decoration: none; border-radius: 4px; z-index: 100;
}
.skip-link:focus { top: 1rem; outline: none; box-shadow: var(--focus-ring); }

.page { position: relative; z-index: 1; max-width: 880px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-bottom: 2.25rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-family: 'Cinzel', Georgia, serif; font-weight: 600; font-size: 0.85rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); text-decoration: none;
}
.brand:hover, .brand:focus { color: var(--ink); outline: none; }
.brand:focus-visible { box-shadow: var(--focus-ring); border-radius: 2px; }
.theme-toggle {
  background: transparent; border: 1px solid var(--rule); color: var(--ink-2);
  font-family: 'Cinzel', Georgia, serif; font-size: 0.7rem; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 0.5rem 0.9rem; border-radius: 3px; cursor: pointer;
  transition: all 0.25s ease; display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 44px; min-width: 44px; justify-content: center;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: none; box-shadow: var(--focus-ring); color: var(--accent); border-color: var(--accent); }
.theme-toggle .icon { font-size: 0.95rem; line-height: 1; }

.crumb {
  font-size: 0.85rem; color: var(--ink-2); margin: 0 0 2rem; text-align: center;
}
.crumb a { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted var(--ink-2); }
.crumb a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.crumb a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 2px; }
.crumb .sep { color: var(--accent); margin: 0 0.45rem; }

.eyebrow {
  font-family: 'Cinzel', Georgia, serif; font-weight: 500; font-size: 0.78rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--rubric);
  margin: 0 0 0.9rem; text-align: center;
}
h1 {
  font-family: 'Cinzel', Georgia, serif; font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.2;
  color: var(--ink); text-align: center; margin: 0 0 1.25rem; letter-spacing: 0.01em;
}
.subtitle {
  font-family: 'IM Fell English', Georgia, serif; font-style: italic; font-size: 1.15rem;
  color: var(--ink-2); text-align: center; margin: 0 0 2.5rem; font-weight: 400;
}
.rule {
  display: flex; align-items: center; justify-content: center; margin: 2.25rem 0; gap: 1rem; color: var(--accent);
}
.rule::before, .rule::after {
  content: ""; flex: 1; max-width: 140px; height: 1px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
}
/* No opacity here. At .85 the gold composited to #8d7332 on parchment —
   4.09:1, under the 4.5 floor. At full strength var(--accent) measures
   5.58:1 and the glyph looks the same at this size. */
.rule .glyph { font-size: 0.95rem; }
.preface {
  background: var(--surface); border-left: 3px solid var(--accent);
  padding: 1.25rem 1.5rem; margin: 0 0 2.5rem;
  font-style: italic; color: var(--ink-2); font-size: 1.02rem; line-height: 1.6;
  border-radius: 0 4px 4px 0;
}
.preface p { margin: 0; }
.lead::first-letter {
  font-family: 'Cinzel', Georgia, serif; font-weight: 700; font-size: 3.6em;
  float: left; line-height: 0.88; padding: 0.08em 0.12em 0 0; color: var(--accent);
}
p { margin: 0 0 1.15rem; }

h2 {
  font-family: 'Cinzel', Georgia, serif; font-weight: 600; font-size: 1.2rem;
  color: var(--ink); margin: 0 0 0.85rem; letter-spacing: 0.03em;
  scroll-margin-top: 1rem;
}
.section-head {
  font-family: 'Cinzel', Georgia, serif; font-weight: 600; font-size: 1.35rem;
  color: var(--ink); margin: 3.5rem 0 1rem; letter-spacing: 0.03em;
  border-bottom: 1px solid var(--rule); padding-bottom: 0.5rem;
  scroll-margin-top: 1rem;
}
h2 .ord {
  font-family: 'IM Fell English', Georgia, serif; font-style: italic;
  font-size: 0.85em; color: var(--accent); font-weight: 400; margin-right: 0.5rem;
}
h3 {
  font-family: 'Cinzel', Georgia, serif; font-weight: 600; font-size: 0.68rem;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 0.5rem;
}
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--rubric); }
a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 2px; }

.toc {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 4px; padding: 1.25rem 1.5rem; margin: 0 0 3rem;
}
.toc h2 {
  font-family: 'Cinzel', Georgia, serif; font-size: 0.78rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); border: none; padding: 0; margin: 0 0 0.85rem; font-weight: 600;
}
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc;
  columns: 2; column-gap: 2rem; }
.toc li {
  counter-increment: toc; font-size: 0.95rem; line-height: 1.5;
  padding: 0.22rem 0 0.22rem 2.6rem; position: relative;
  break-inside: avoid;
}
.toc li::before {
  content: counter(toc, lower-roman) ".";
  position: absolute; left: 0; width: 2.2rem; text-align: right;
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic; color: var(--accent); font-size: 0.92rem;
}

.toc a { color: var(--ink-body); text-decoration: none; border-bottom: 1px dotted var(--rule); }
.toc a:hover, .toc a:focus { color: var(--rubric); border-bottom-color: var(--rubric); }
.toc a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 2px; }

.source {
  margin-top: 2rem; padding: 1.25rem 1.5rem;
  background: var(--surface); border: 1px dashed var(--rule); border-radius: 3px;
  font-size: 0.92rem; color: var(--ink-2);
}
.source strong {
  font-family: 'Cinzel', Georgia, serif; font-size: 0.74rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
  display: block; margin-bottom: 0.6rem; font-weight: 600;
}
.source ol { margin: 0; padding-left: 1.3rem; }
.source li { margin-bottom: 0.5rem; line-height: 1.5; overflow-wrap: anywhere; }
.source li:last-child { margin-bottom: 0; }

.related {
  margin-top: 2rem; font-size: 0.95rem; color: var(--ink-2); font-style: italic;
  text-align: center;
}

footer {
  margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--rule);
  text-align: center; font-size: 0.85rem; color: var(--ink-2); font-style: italic;
}
footer a { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted var(--ink-2); }
footer a:hover { color: var(--accent); border-bottom-color: var(--accent); }
footer a:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 2px; }

@media (max-width: 720px) {
  .toc ol { columns: 1; }
}
@media (max-width: 540px) {
  .page { padding: 2rem 1.1rem 3.5rem; }
  body { font-size: 18px; }
  .topbar { margin-bottom: 1.5rem; }
  .preface, .toc, .source { padding: 1rem 1.2rem; }
  .toc li { padding-left: 2.2rem; font-size: 0.92rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}

@media print {
  body { background: white; color: black; font-size: 11pt; }
  body::before { display: none; }
  .topbar, .theme-toggle, .skip-link, footer { display: none; }
  .page { max-width: 100%; padding: 0; }
  h1, h2, h3, .section-head { color: black; }
  .eyebrow { color: #444; }
  a { color: black; text-decoration: underline; }
  .preface, .toc, .source { background: #f5f5f5; border-color: #999; color: #333; }
  .rule::before, .rule::after { background: #888; }
  .rule .glyph { color: #444; }
  .toc a { border-bottom: none; }
}

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin: 1.6rem 0 2rem; }
.compare .side {
  background: var(--surface); border: 1px solid var(--rule);
  border-left: 4px solid var(--accent); border-radius: 3px;
  padding: 1.1rem 1.3rem; box-shadow: var(--shadow); min-width: 0;
}
.compare .side:last-child { border-left-color: var(--rubric); }
.compare h3 {
  font-family: 'Cinzel', Georgia, serif; font-weight: 600; font-size: 0.7rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 0.6rem;
}
.compare .side:last-child h3 { color: var(--rubric); }
.compare p { margin: 0; font-size: 0.95rem; line-height: 1.6; }
.source p { margin: 0; line-height: 1.6; }
.source ul { margin: 0; padding-left: 1.2rem; }
.source li { margin-bottom: 0.45rem; line-height: 1.5; }
.source li:last-child { margin-bottom: 0; }
.source + .source { margin-top: 1.5rem; }

@media (max-width: 720px) {
  .compare { grid-template-columns: 1fr; gap: 1rem; }
}
@media (max-width: 540px) {
  .compare .side { padding: 0.95rem 1.1rem; }
}
@media print {
  .compare .side { background: white; border: 1px solid #999; border-left: 3px solid #000;
    box-shadow: none; page-break-inside: avoid; }
  .compare h3, .compare .side:last-child h3 { color: #444; }
}


/* skip-link:begin */
.skip-link{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0}
.skip-link:focus{position:fixed;top:.75rem;left:.75rem;z-index:1000;width:auto;height:auto;margin:0;padding:.6rem 1rem;overflow:visible;clip:auto;clip-path:none;background:#2a1a08!important;color:#FAF5EB!important;font-family:'Cinzel',Georgia,serif;font-size:.8rem;letter-spacing:.08em;text-decoration:none;border-radius:3px;outline:2px solid #FAF5EB;outline-offset:-4px;box-shadow:0 0 0 2px #2a1a08,0 0 0 4px #FAF5EB}
/* skip-link:end */
