
:root {
  --parchment: #F4EDE4;
  --parchment-deep: #EDE3D5;
  --vellum: #FDFAF5;
  --ink: #2C1810;
  --ink-light: #5C3D2E;
  --ink-faded: #8B7355;
  --ink-ghost: #B8A48C;
  --rule: #D4C4AE;
  --rule-light: #E8DDD0;
  --gold: #C4973B;
  --gold-dim: #8B6D2F;
  --gold-pale: #F3E5C0;
  --vermillion: #A0522D;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: 'Crimson Text', Georgia, serif;
  background: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Parchment texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(139, 115, 85, 0.02) 3px,
      rgba(139, 115, 85, 0.02) 4px
    );
  pointer-events: none;
  z-index: 100;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

:focus-visible {
  outline: 2px solid var(--vermillion);
  outline-offset: 3px;
  border-radius: 4px;
}

a { color: var(--gold-dim); text-decoration: none; border-bottom: 1px dotted var(--rule); transition: color .2s, border-color .2s; }
a:hover { color: var(--vermillion); border-color: var(--vermillion); }

/* ---- HEADER ---- */
header {
  padding: 52px 0 10px;
  text-align: center;
}

.breadcrumb {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-faded);
  margin-bottom: 36px;
}
.breadcrumb a { color: var(--ink-ghost); border: none; }
.breadcrumb a:hover { color: var(--ink-light); }

.ornament {
  color: var(--vermillion);
  font-size: 28px;
  margin-bottom: 18px;
  opacity: 0.7;
}

.hero-initial {
  min-width: 88px;
  height: 88px;
  margin: 0 auto 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 5px;
  background: var(--gold-pale);
  border: 1px solid var(--gold);
  border-radius: 5px;
  box-shadow: inset 0 0 0 4px var(--vellum);
  font-family: 'Cormorant Garamond', serif;
  font-size: 40px;
  font-weight: 600;
  color: var(--vermillion);
  line-height: 1;
}

.rubric {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 16px;
}

h1.title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(30px, 6.5vw, 46px);
  font-weight: 600;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 14px;
  line-height: 1.1;
}

.subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px;
  font-weight: 500;
  font-style: italic;
  color: var(--ink-light);
  letter-spacing: 0.5px;
}

.dedication {
  margin-top: 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-faded);
}

/* ---- EPIGRAPH ---- */
.epigraph {
  text-align: center;
  padding: 36px 0 10px;
}
.epigraph .orn { color: var(--gold); font-size: 13px; opacity: 0.8; }
.epigraph blockquote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(20px, 4vw, 25px);
  line-height: 1.45;
  color: var(--ink-light);
  max-width: 30em;
  margin: 14px auto 12px;
}
.epigraph cite {
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-faded);
}

/* ---- SECTIONS ---- */
.content-section { padding: 32px 0 22px; }

.section-label {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.section-label .icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  flex-shrink: 0;
  color: var(--gold-dim);
}
.section-label h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink-light);
}
.section-label .count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--gold-dim);
  background: var(--gold-pale);
  padding: 2px 8px;
  border-radius: 999px;
}
.section-label .line { flex: 1; height: 1px; background: var(--rule); }

/* ---- PROSE ---- */
.prose p {
  font-size: 17.5px;
  line-height: 1.72;
  color: var(--ink-light);
  margin-bottom: 18px;
}
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose > p:first-of-type::first-letter {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3.4rem;
  font-weight: 600;
  float: left;
  line-height: 0.85;
  padding: 5px 10px 0 0;
  color: var(--vermillion);
}

/* ---- KEY VERSE ---- */
.ch-verse {
  border-left: 2px solid var(--gold);
  padding: 2px 0 2px 16px;
  margin: 18px 0 0;
}
.ch-verse blockquote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink);
}
.ch-verse cite {
  display: block;
  margin-top: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-faded);
}

/* ---- TRADITION VOICES ---- */
.trad {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-light);
}
.trad:last-child { border-bottom: none; }
.trad-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid var(--gold);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.trad blockquote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17.5px;
  line-height: 1.5;
  color: var(--ink);
  margin-top: 8px;
}
.trad cite {
  display: block;
  margin-top: 5px;
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faded);
}

/* ---- EXEGESIS ---- */
.exeg {
  padding: 15px 0;
  border-bottom: 1px solid var(--rule-light);
}
.exeg:last-child { border-bottom: none; }
.exeg-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px 12px;
}
.exeg-ref {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid var(--gold);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.heb {
  font-family: 'Noto Serif Hebrew', 'Times New Roman', serif;
  font-size: 21px;
  line-height: 1.75;
  color: var(--vermillion);
  direction: rtl;
  unicode-bidi: isolate;
}
.translit {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-faded);
  letter-spacing: 0.3px;
}
.exeg .gloss {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17px;
  color: var(--ink);
  margin-top: 5px;
}
.exeg .note {
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink-light);
  margin-top: 7px;
}
.exeg .note em { font-style: italic; color: var(--ink); }

/* ---- CROSS-REFERENCES ---- */
.xref { padding: 14px 0; border-bottom: 1px solid var(--rule-light); }
.xref:last-child { border-bottom: none; }
.xref-anchor {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17.5px;
  line-height: 1.45;
  color: var(--ink);
}
.xref-ref {
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dim);
  border: 1px solid var(--gold);
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
  margin-right: 9px;
}
.xref-list { list-style: none; margin-top: 9px; }
.xref-list li {
  position: relative;
  padding-left: 15px;
  font-size: 16.5px;
  line-height: 1.58;
  color: var(--ink-light);
  margin-bottom: 7px;
}
.xref-list li:last-child { margin-bottom: 0; }
.xref-list li::before {
  content: '\203B';
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 11px;
  color: var(--gold);
}
.xr {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--gold-dim);
  white-space: nowrap;
}
.xref-list q {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17px;
  color: var(--ink);
}
.xref-list q.wj { color: var(--vermillion); }

/* ---- ENCYCLICAL ---- */
.pope-lead {
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink-light);
  margin-bottom: 14px;
}
.pope { padding: 13px 0; border-bottom: 1px solid var(--rule-light); }
.pope:last-child { border-bottom: none; }
.pope blockquote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17.5px;
  line-height: 1.5;
  color: var(--ink);
  border-left: 2px solid var(--gold);
  padding-left: 14px;
}
.pope cite {
  display: block;
  margin-top: 5px;
  padding-left: 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faded);
}

/* ---- DISCUSSION ---- */
.discussion ol { list-style: none; counter-reset: dq; }
.discussion li {
  counter-increment: dq;
  position: relative;
  padding-left: 30px;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 17.5px;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 14px;
}
.discussion li:last-child { margin-bottom: 0; }
.discussion li::before {
  content: counter(dq, lower-roman) ".";
  position: absolute;
  left: 2px;
  top: 4px;
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--vermillion);
}
.ai-tag {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-style: normal;
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--vermillion);
  border: 1px dashed var(--vermillion);
  padding: 1px 8px;
  border-radius: 999px;
  margin-right: 8px;
  position: relative;
  top: -2px;
}

/* ---- CHAPTER LIST (index) ---- */
.chlist a.chrow {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 12px;
  margin: 0 -12px;
  border-bottom: 1px solid var(--rule-light);
  color: inherit;
  border-radius: 8px;
  transition: background 0.2s, transform 0.15s;
}
.chlist a.chrow:last-child { border-bottom: none; }
.chlist a.chrow:hover { background: var(--vellum); transform: translateX(4px); }
.chrow .num {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-pale);
  border: 1px solid var(--gold);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--vellum);
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--vermillion);
}
.chrow .body { flex: 1; min-width: 0; }
.chrow .name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}
.chrow .sub {
  font-size: 15px;
  font-style: italic;
  color: var(--ink-faded);
  margin-top: 2px;
}
.chrow .arrow {
  color: var(--ink-faded);
  font-size: 16px;
  flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
}
.chlist a.chrow:hover .arrow { color: var(--vermillion); transform: translateX(3px); }

/* ---- FOOTER / NAV ---- */
footer { padding: 36px 0 56px; }
.petal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.pn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-faded);
  border: none;
}
.pn:hover { color: var(--vermillion); }
.pn.up { color: var(--ink-ghost); }
.pn.up:hover { color: var(--ink); }
.foot-dedication {
  margin-top: 26px;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-ghost);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 620px) {
  .petal-nav { flex-direction: column; }
  .trad blockquote { font-size: 16.5px; }
}

/* ---- ENTRANCE ANIMATIONS ---- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
  header { animation: fadeUp 0.8s ease both; }
  .epigraph { animation: fadeUp 0.7s 0.1s ease both; }
  .content-section { animation: fadeUp 0.6s 0.2s ease both; }
  footer { animation: fadeUp 0.6s 0.3s ease both; }
}

/* ---- PRINT (one-page worksheet) ---- */
@media print {
  @page { margin: 10mm 12mm; }
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  body { background: #fff; }
  body::before { display: none; }
  .container { max-width: 100%; padding: 0; }
  a { color: inherit; border-bottom: none; }
  footer .petal-nav { display: none; }
  .breadcrumb, .hero-initial, .ornament { display: none; }
  header { padding: 0 0 2px; }
  .rubric { margin-bottom: 6px; font-size: 7.5pt; }
  h1.title { font-size: 17pt; margin-bottom: 5px; }
  .subtitle { font-size: 11pt; }
  .dedication { margin-top: 6px; font-size: 6.5pt; }
  .content-section { padding: 7px 0 3px; }
  .section-label { margin-bottom: 6px; }
  .section-label .icon { width: 20px; height: 20px; font-size: 12pt; }
  .prose p { font-size: 9pt; line-height: 1.4; margin-bottom: 5px; }
  .prose > p:first-of-type::first-letter { font-size: 2rem; padding: 2px 6px 0 0; }
  .ch-verse { margin: 8px 0 0; break-inside: avoid; }
  .ch-verse blockquote { font-size: 10pt; line-height: 1.35; }
  .ch-verse cite { margin-top: 3px; font-size: 6.5pt; }
  .trad { padding: 4px 0; break-inside: avoid; }
  .trad-tag { font-size: 6pt; padding: 1px 7px; }
  .trad blockquote { font-size: 8.5pt; line-height: 1.28; margin-top: 2px; }
  .trad cite { font-size: 6pt; margin-top: 2px; }
  .pagebreak { break-before: page; }
  .exeg { padding: 4px 0; break-inside: avoid; }
  .exeg-ref { font-size: 6pt; padding: 1px 7px; }
  .heb { font-size: 11pt; line-height: 1.4; }
  .translit { font-size: 9pt; }
  .exeg .gloss { font-size: 9pt; margin-top: 2px; }
  .exeg .note { font-size: 8pt; line-height: 1.28; margin-top: 2px; }
  .xref { padding: 4px 0; break-inside: avoid; }
  .xref-anchor { font-size: 9pt; line-height: 1.3; }
  .xref-ref { font-size: 6pt; padding: 1px 7px; margin-right: 6px; }
  .xref-list { margin-top: 4px; }
  .xref-list li { font-size: 8pt; line-height: 1.28; margin-bottom: 2px; padding-left: 11px; }
  .xref-list li::before { font-size: 7pt; }
  .xr { font-size: 6.5pt; }
  .xref-list q { font-size: 8.5pt; }
  .pope-lead { font-size: 8.5pt; line-height: 1.3; margin-bottom: 6px; }
  .pope { padding: 5px 0; break-inside: avoid; }
  .pope blockquote { font-size: 9pt; line-height: 1.3; padding-left: 10px; }
  .pope cite { font-size: 6pt; margin-top: 2px; padding-left: 12px; }
  .discussion li { font-size: 9.5pt; line-height: 1.35; margin-bottom: 6px; padding-left: 22px; break-inside: avoid; }
  .discussion li::before { font-size: 6.5pt; top: 2px; }
  .ai-tag { font-size: 6pt; }
  footer { padding: 6px 0 0; }
  .foot-dedication { display: none; }
  .epigraph, .chlist a.chrow { break-inside: avoid; }
}
