/* ============================================================= */
/* A Gamer's Road to Damascus, site stylesheet                   */
/* Body: Georgia. Headers/labels: Arial. Site palette: warm,     */
/* parchment-toned, ornamented (the docx canon stays austere).   */
/* ============================================================= */

:root {
  --ink:        #1f1813;   /* body text */
  --ink-soft:   #4a4036;   /* secondary text */
  --paper:      #f4ecd8;   /* warm parchment ground */
  --paper-deep: #e7d9b8;   /* deeper parchment for scroll faces */
  --edge:       #b8a273;   /* aged edge / rules */
  --roll:       #6e5a3a;   /* rolled scroll ends */
  --roll-dark:  #4a3b24;   /* shadow of the roll */
  --gold:       #b08d57;   /* restrained accent */
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-bottom: 3px double var(--roll);
}

.hero-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: cover;
  object-position: center 38%;
}

.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
              rgba(20,14,8,0.05) 0%,
              rgba(20,14,8,0.15) 55%,
              rgba(20,14,8,0.78) 100%);
  pointer-events: none;
}

.hero-text {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  text-align: center;
  padding: 0 24px 6vh;
  color: #f7f1e2;
  text-shadow: 0 2px 14px rgba(0,0,0,0.6);
}

.hero-eyebrow {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #e8dcc0;
  margin-bottom: 0.9rem;
}

.hero-title {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 5.2vw, 3.6rem);
  letter-spacing: 0.04em;
  line-height: 1.15;
  margin-bottom: 0.8rem;
}

.hero-author {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  color: #efe6cf;
}

/* ---------- OPENING ---------- */
.opening {
  max-width: 620px;
  margin: 0 auto;
  padding: 9vh 28px 6vh;
  text-align: center;
}

.opening p { margin-bottom: 1.5rem; }

.opening-lead {
  font-size: 1.5rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink);
}

.opening p:not(.opening-lead):not(.opening-invite) {
  font-size: 1.12rem;
  text-align: left;
  color: var(--ink-soft);
}

.opening-invite {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 2.5rem;
}

/* ---------- SCROLLS ---------- */
.scrolls {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 22px 14vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.scroll { width: 100%; }

/* The closed scroll: a rolled parchment bar with rolled ends */
.scroll-handle {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.scroll-cap { display: none; }

.scroll-label {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(0.85rem, 2.4vw, 1.05rem);
  letter-spacing: 0.12em;
  color: #3a2c18;
  text-shadow: 0 1px 1px rgba(255,248,225,0.6);
  min-height: 130px;
  border-image: url("scroll_bar.png") 44 64 96 64 fill / 20px 29px 44px 29px stretch;
  border-width: 20px 29px 44px 29px;
  border-style: solid;
  transition: filter 0.2s ease;
}

.scroll-handle:hover .scroll-label { filter: brightness(1.04); }

/* small "pull to open" affordance */
.scroll-label::after {
  content: "\25BC";
  font-size: 0.6rem;
  color: var(--roll);
  margin-left: 0.7em;
  transition: transform 0.3s ease;
}
.scroll.is-open .scroll-label::after { transform: rotate(180deg); }

/* seal sits on the bar, centered as a unit just to the left of the title text */
.scroll-handle .wax-seal {
  left: calc(50% - 232px);
}
.scroll-label {
  justify-content: center;
  text-align: center;
  padding-left: 108px;
  padding-right: 84px;
}

/* The unrolled body: collapsed by default, expands on open */
.scroll-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s ease;
}
.scroll.is-open .scroll-body { grid-template-rows: 1fr; }

.scroll-parchment {
  overflow: hidden;
  min-height: 0;
}

.scroll.is-open .scroll-parchment {
  margin: -6px 0 0;
  padding: 30px clamp(28px, 6vw, 64px) 56px;
  border-image: url("scroll_panel.png") 30 60 90 60 fill / 30px 56px 70px 56px stretch;
  border-width: 30px 56px 70px 56px;
  border-style: solid;
}

.scroll-title {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 1.55rem;
  text-align: center;
  color: var(--ink);
  margin-bottom: 1.6rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--edge);
}

.scroll-subtitle {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  text-align: center;
  color: var(--ink-soft);
  margin-top: -1rem;
  margin-bottom: 1.8rem;
}

.scroll-parchment p {
  font-size: 1.08rem;
  line-height: 1.85;
  text-align: justify;
  color: var(--ink);
  margin-bottom: 1.2rem;
}

.scroll-signoff {
  text-align: right !important;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 2rem !important;
  margin-bottom: 0 !important;
}

.scroll-subhead {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 2.4rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--edge);
  text-transform: uppercase;
}

.scroll-pull {
  border-left: 3px solid var(--roll);
  padding: 0.2rem 0 0.2rem 1.2rem;
  margin: 1.8rem 0 1.8rem 0.4rem;
  font-style: italic;
  font-size: 1.22rem !important;
  line-height: 1.55 !important;
  text-align: left !important;
  color: var(--ink);
}

/* ---------- NAVIGATION: floating button + command menu ---------- */
.nav-fab {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #e7d9b8;
  background: radial-gradient(circle at 35% 30%, #8a7048, var(--roll) 55%, var(--roll-dark));
  color: #f4ecd8;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 9px 22px rgba(0,0,0,0.42); }
.nav-fab-glyph { width: 24px; height: 24px; color: #f4ecd8; }

.nav-menu {
  position: fixed;
  left: 24px;
  bottom: 96px;
  width: 250px;
  max-width: 80vw;
  background: linear-gradient(180deg, #faf3df 0%, var(--paper) 60%, #efe3c7 100%);
  border: 1px solid var(--roll);
  border-radius: 6px;
  z-index: 65;
  padding: 8px;
  box-shadow: 0 10px 28px -10px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.nav-menu.is-open { opacity: 1; transform: translateY(0); }

.nav-head {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--roll-dark);
  padding: 6px 10px 10px;
}

.nav-cmd { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; cursor: pointer; font-family: Arial, Helvetica, sans-serif; font-size: 0.92rem; color: var(--ink); padding: 10px; border-radius: 4px; transition: background 0.15s ease; }
.nav-cmd[hidden] { display: none; }
.nav-cmd:hover { background: rgba(110,90,58,0.12); }

.nav-cmd-ico {
  flex: 0 0 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--roll-dark);
  border: 1px solid var(--edge);
  border-radius: 50%;
}

.nav-divider {
  height: 1px;
  background: var(--edge);
  margin: 6px 10px;
}

.nav-scroll-list { max-height: 40vh; overflow-y: auto; }

/* ---------- VOLUME TABS ---------- */
.volumes {
  display: flex;
  width: 100%;
  gap: 8px;
  padding: 10px 8px;
  background: transparent;
}
.vol {
  flex: 1 1 0;
  position: relative;
}

.vol-handle {
  width: 100%;
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.vol-face {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  /* realistic scroll bar as a 9-slice background: roller ends fixed, parchment stretches */
  border-image: url("scroll_bar.png") 44 64 96 64 fill / 18px 27px 40px 27px stretch;
  border-width: 18px 27px 40px 27px;
  border-style: solid;
}
.vol-name {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(0.8rem, 2vw, 1.05rem);
  letter-spacing: 0.14em;
  color: #3a2c18;
  text-transform: uppercase;
  margin-left: 54px;
  text-shadow: 0 1px 1px rgba(255,248,225,0.6);
}

/* Wax seal, positioned just left of center on each scroll face */
.wax-seal {
  position: absolute;
  left: calc(50% - 110px);
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 52px;
  font-size: 0;
  color: transparent;
  z-index: 5;
  overflow: visible;
}
.wax-seal .seal-svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.45)); overflow: visible; }

/* Both halves transition smoothly */
.wax-seal .seal-half { transition: transform 0.42s cubic-bezier(0.4,0,0.2,1), opacity 0.42s ease; }

/* BREAK OPEN: top half stays, bottom half drops and fades slightly */
.is-open .wax-seal .seal-top { transform: translateY(0); }
.is-open .wax-seal .seal-bot { transform: translateY(22px); opacity: 0.72; }

/* CRACKED (re-closed after being opened): crack line visible, halves hairline-misaligned */
.wax-seal.is-cracked .seal-top  { transform: translateY(-1px); }
.wax-seal.is-cracked .seal-bot  { transform: translateY(1px); }
.wax-seal.is-cracked .seal-crack { opacity: 1; }
.wax-seal .seal-crack { transition: opacity 0.3s ease; }

.vol-list {
  position: absolute;
  left: 0; right: 0;
  z-index: 30;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.42s ease, opacity 0.3s ease;
  filter: drop-shadow(0 16px 22px rgba(60,40,20,0.42));
}
.vol.is-open .vol-list {
  max-height: 660px;
  opacity: 1;
}
.vol-list-inner {
  /* realistic unrolled parchment panel: sides fixed, middle and bottom stretch */
  border-image: url("scroll_panel.png") 30 60 80 60 fill / 30px 60px 80px 60px stretch;
  border-width: 30px 60px 80px 60px;
  border-style: solid;
  max-height: 660px;
  overflow-y: auto;
}

.vol-chapter {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 13px 22px;
  font-family: Georgia, serif;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--edge);
  transition: background 0.15s ease;
}
.vol-chapter:last-child { border-bottom: none; }
.vol-chapter:not(.is-pending):hover { background: rgba(110,90,58,0.1); }
.vol-ch-num {
  flex: 0 0 28px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--roll);
  border: 1px solid var(--edge);
  border-radius: 50%;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
}
.vol-chapter.is-pending { color: #9a8c74; cursor: default; }
.vol-ch-soon { font-style: italic; font-size: 0.9rem; }

/* ---------- QUICK ANSWERS: floating button + drawer ---------- */
.qa-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #e7d9b8;
  background: radial-gradient(circle at 35% 30%, #8a7048, var(--roll) 55%, var(--roll-dark));
  color: #f4ecd8;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qa-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 9px 22px rgba(0,0,0,0.42); }
.qa-fab-glyph {
  width: 22px;
  height: 28px;
  color: #f4ecd8;
}

.qa-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 70;
}
.qa-overlay.is-open { opacity: 1; pointer-events: auto; }

.qa-drawer {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: 300px;
  max-width: 80vw;
  max-height: 70vh;
  background: linear-gradient(180deg, #faf3df 0%, var(--paper) 60%, #efe3c7 100%);
  border: 1px solid var(--roll);
  border-radius: 6px;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 80;
  overflow-y: auto;
  box-shadow: 0 10px 28px -10px rgba(0,0,0,0.5);
}
.qa-drawer.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }

.qa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--edge);
}
.qa-head-label {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--roll-dark);
}
.qa-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.5rem; line-height: 1; color: var(--roll);
}

.qa-list { padding: 6px 16px 16px; }

.qa-item { border-bottom: 1px solid var(--edge); }

.qa-q {
  width: 100%;
  text-align: left;
  background: none; border: none; cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  padding: 15px 0;
  position: relative;
}
.qa-q::after {
  content: "+";
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--gold);
}
.qa-item.is-open .qa-q::after { content: "\2013"; }

.qa-a {
  display: none;
  font-family: Georgia, serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-soft);
  padding: 0 0 16px;
}
.qa-item.is-open .qa-a { display: block; }

/* ============================================================= */
/* CHAPTER PAGES: text lives inside a centred scroll             */
/* ============================================================= */
.chapter-page {
  background-color: #e8dfc8;
  padding: 0 0 6vh;
}

/* Full-width nav bar at top and bottom (click to return) */
.scroll-end {
  display: block;
  position: relative;
  width: 100%;
  text-decoration: none;
  cursor: pointer;
  background: none;
  transition: filter 0.2s ease;
}
.scroll-end:hover { filter: brightness(1.06); }
.scroll-end-roll {
  display: block;
  min-height: 90px;
  border-image: url("scroll_bar.png") 44 64 96 64 fill / 14px 20px 30px 20px stretch;
  border-width: 14px 20px 30px 20px;
  border-style: solid;
}
.scroll-end-hint {
  position: absolute;
  left: 0; right: 0;
  top: 50%; transform: translateY(-50%);
  text-align: center;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5a4326;
  text-shadow: 0 1px 1px rgba(255,248,225,0.7);
  pointer-events: none;
  z-index: 2;
}
.scroll-end-top .wax-seal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 64px;
  z-index: 6;
}

/* Static broken seal on chapter page */
.wax-seal.is-broken-static .seal-top  { transform: translateY(-4px); }
.wax-seal.is-broken-static .seal-bot  { transform: translateY(20px); opacity: 0.62; }
.wax-seal.is-broken-static .seal-crack { opacity: 0; }

/* The chapter scroll: centred, with visible side margins */
.ch-scroll-outer {
  max-width: 860px;
  margin: 5vh auto 0;
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  box-shadow: -10px 0 24px -14px rgba(0,0,0,0.3), 10px 0 24px -14px rgba(0,0,0,0.3);
}

/* Rolled cap ends inside the chapter scroll */
.ch-scroll-cap {
  min-height: 70px;
  border-image: url("scroll_bar.png") 44 64 96 64 fill / 11px 16px 24px 16px stretch;
  border-width: 11px 16px 24px 16px;
  border-style: solid;
}
.ch-scroll-cap-bot {
  border-image: url("scroll_bar.png") 96 64 44 64 fill / 24px 16px 11px 16px stretch;
}

.chapter-header {
  background-image: url("body_parchment.png");
  background-size: 100% auto;
  background-repeat: repeat-y;
  padding: 4vh 12% 3vh;
  text-align: center;
  border-bottom: 3px double var(--roll);
}
.chapter-eyebrow {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}
.chapter-h1 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-style: italic;
  color: var(--ink);
  line-height: 1.2;
}

.chapter-body {
  background-image: url("body_parchment.png");
  background-size: 100% auto;
  background-repeat: repeat-y;
  padding: 5vh 12% 6vh;
}

.chapter-note {
  text-align: center !important;
  font-style: italic;
  font-size: 0.95rem !important;
  color: var(--ink-soft);
  margin-bottom: 2.5rem !important;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--edge);
}

.chapter-subhead {
  text-align: center !important;
  font-style: italic;
  font-size: 1.2rem !important;
  color: var(--ink-soft);
  margin: -0.6rem 0 1.6rem !important;
}

.ch-section { margin-bottom: 3.5rem; }

.chapter-body h2 {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 2.5rem 0 1.3rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--roll);
}
.chapter-body h3 {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--ink);
  margin: 2rem 0 0.9rem;
}
.chapter-body h4 {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 1.6rem 0 0.8rem;
}
.chapter-body p {
  font-size: 1.08rem;
  line-height: 1.85;
  text-align: justify;
  color: var(--ink);
  margin-bottom: 1.2rem;
}
.ch-list, .ch-list-num { margin: 0 0 1.3rem 1.6rem; }
.ch-list li, .ch-list-num li {
  font-size: 1.06rem;
  line-height: 1.7;
  margin-bottom: 0.5rem;
}
.ch-list { list-style: none; }
.ch-list li::before {
  content: "\2014";
  color: var(--gold);
  margin-left: -1.4rem;
  margin-right: 0.5rem;
}
.ch-list-num { list-style: decimal; }

.ch-pull {
  border-left: 3px solid var(--roll);
  padding-left: 1.2rem;
  margin: 1.8rem 0;
  font-style: italic;
  font-size: 1.2rem !important;
  line-height: 1.55 !important;
  text-align: left !important;
  color: var(--ink);
}

.ch-axiom {
  background: rgba(176,141,87,0.09);
  border-left: 3px solid var(--gold);
  border-radius: 0;
  padding: 1rem 1.2rem !important;
  margin: 1.6rem 0;
  font-size: 1.04rem !important;
  text-align: left !important;
}
.ch-axiom-label {
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--roll-dark);
  margin-bottom: 0.4rem;
}

.ch-corr {
  border-left: 2px solid var(--edge);
  padding-left: 1.2rem !important;
  margin: 1.5rem 0;
  font-size: 1rem !important;
  color: var(--ink-soft);
  text-align: left !important;
}
.ch-corr-label {
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.ch-guard, .ch-note {
  background: rgba(110,90,58,0.07);
  padding: 0.9rem 1.2rem !important;
  margin: 1.4rem 0;
  font-size: 1rem !important;
  text-align: left !important;
}
.ch-guard-label, .ch-note-label {
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--roll-dark);
  margin-bottom: 0.35rem;
}

.ch-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.8rem 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}

/* Equation display blocks for the math addendum */
.ch-eq {
  margin: 1.4rem 0 !important;
  padding: 0.6rem 1rem;
  text-align: center;
  overflow-x: auto;
  background: rgba(110,90,58,0.05);
  border-left: 2px solid var(--edge);
}

/* Personal first-person closing (Epilogue) */
.ch-personal {
  border-top: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
  margin: 2.5rem 0;
  padding: 2rem 0;
}
.ch-personal p {
  font-style: italic;
  color: #3a2c1c;
}
.ch-personal p:last-child {
  font-size: 1.1rem;
  text-align: center;
  margin-top: 1.6rem;
}

/* Bridge passage: a reflective interlude before the math addendum */
.ch-bridge {
  border-top: 3px double var(--roll);
  margin-top: 3rem;
  padding-top: 2.5rem;
}
.ch-bridge p { font-size: 1.04rem; }

/* Mathematical addendum: set apart as a formal supplement */
.ch-addendum {
  border-top: 3px double var(--roll);
  margin-top: 3rem;
  padding-top: 2.5rem;
}
.ch-addendum h4 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.95rem;
  color: var(--roll);
  margin: 1.6rem 0 0.6rem;
}

.ch-table th {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink);
  border-bottom: 2px solid var(--roll);
  padding: 0.6rem 0.8rem;
  vertical-align: bottom;
}
.ch-table td {
  border-bottom: 1px solid var(--edge);
  padding: 0.7rem 0.8rem;
  line-height: 1.55;
  vertical-align: top;
  color: var(--ink);
}

.ch-compress {
  list-style: none;
  margin: 0 0 1.5rem 0;
  padding: 1.2rem 1.4rem;
  background: rgba(176,141,87,0.08);
  border-top: 2px solid var(--roll);
  border-bottom: 2px solid var(--roll);
}
.ch-compress li {
  font-size: 1.08rem;
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 0.6rem;
  padding-left: 1.2rem;
  position: relative;
}
.ch-compress li::before { content: "\00B7"; position: absolute; left: 0; color: var(--gold); font-weight: bold; }

.ch-end {
  text-align: center !important;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.82rem !important;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--roll);
  margin: 2.5rem 0 1rem !important;
}

.ch-reduction {
  border-top: 1px solid var(--edge);
  padding-top: 2rem;
}
.ch-reduction p { font-size: 1.02rem; color: var(--ink-soft); }

/* ---------- FOOTER ---------- */
.site-footer {
  text-align: center;
  padding: 3rem 20px;
  border-top: 3px double var(--roll);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

/* ---- 768px: large phones — proportional scroll scaling ---- */


/* ---- 520px: small phones — compact proportional scroll ---- */


/* ============================================================
   Chapter podcast / audio player
   ============================================================ */
.ch-podcast {
  max-width: 760px;
  margin: 28px auto 8px;
  padding: 18px 22px;
  background: linear-gradient(180deg, #faf3df 0%, var(--paper) 55%, #efe3c7 100%);
  border: 1px solid var(--roll);
  border-radius: 8px;
  box-shadow: 0 8px 22px -12px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.4);
}
.ch-podcast-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.ch-podcast-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--roll);
}
.ch-podcast-titles { line-height: 1.25; }
.ch-podcast-label {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--roll-dark);
}
.ch-podcast-sub {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.ch-podcast audio {
  width: 100%;
  height: 40px;
  display: block;
}


/* ============================================================
   Contents (front-matter) floating menu - stacked above nav-fab
   ============================================================ */
.toc-fab {
  position: fixed;
  left: 24px;
  bottom: 96px;            /* one fab height + gap above the nav-fab */
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid #e7d9b8;
  background: radial-gradient(circle at 35% 30%, #8a7048, var(--roll) 55%, var(--roll-dark));
  color: #f4ecd8;
  cursor: pointer;
  z-index: 60;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toc-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 9px 22px rgba(0,0,0,0.42); }
.toc-fab-glyph { width: 24px; height: 24px; color: #f4ecd8; }

.toc-menu {
  position: fixed;
  left: 24px;
  bottom: 168px;           /* above the toc-fab */
  width: 280px;
  max-width: 80vw;
  max-height: 64vh;
  overflow-y: auto;
  background: linear-gradient(180deg, #faf3df 0%, var(--paper) 60%, #efe3c7 100%);
  border: 1px solid var(--roll);
  border-radius: 6px;
  z-index: 65;
  padding: 8px;
  box-shadow: 0 10px 28px -10px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toc-menu.is-open { opacity: 1; transform: translateY(0); }
.toc-group-head {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--roll-dark);
  padding: 10px 10px 4px;
  border-top: 1px solid var(--edge);
  margin-top: 4px;
}
.toc-group-head.first { border-top: none; margin-top: 0; }
.toc-cmd {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.92rem;
  color: var(--ink);
  padding: 7px 10px;
  border-radius: 4px;
  line-height: 1.3;
}
.toc-cmd:hover { background: rgba(110,90,58,0.12); color: var(--roll-dark); }

/* Act dividers for Volume II three-act chapters */
.ch-act {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  color: var(--roll-dark);
  margin: 48px auto 8px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--edge);
  max-width: 60%;
}

/* Theorem box and numbered-condition list for the formal chapters (Vol II) */
.ch-theorem {
  margin: 2rem 0;
  padding: 1.4rem 1.6rem;
  background: linear-gradient(180deg, #faf3df 0%, var(--paper) 60%, #efe3c7 100%);
  border: 1px solid var(--roll);
  border-left: 4px solid var(--roll);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}
.ch-theorem-label {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--roll-dark);
  display: block;
  margin-bottom: 0.6rem;
}
.ch-conditions {
  margin: 1.2rem 0;
  padding-left: 1.4rem;
}
.ch-conditions li {
  margin-bottom: 0.7rem;
  padding-left: 0.3rem;
}
.ch-conditions .cond-name {
  font-weight: bold;
  color: var(--roll-dark);
}

/* Pass/Fail criteria test blocks (Vol II Chapter VIII) */
.ch-test {
  margin: 1.6rem 0;
  padding: 1rem 1.3rem;
  background: rgba(110,90,58,0.05);
  border-left: 3px solid var(--edge);
  border-radius: 4px;
}
.ch-test-crit { margin-bottom: 0.7rem; }
.ch-test-crit:last-child { margin-bottom: 0; }
.ch-mark {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 1px 8px;
  border-radius: 3px;
  margin-left: 4px;
  white-space: nowrap;
}
.ch-mark.fail { background: #8a2e22; color: #f4ecd8; }
.ch-mark.pass { background: #3c5a32; color: #f4ecd8; }
.ch-verdict {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.86rem;
  font-weight: bold;
  color: var(--roll-dark);
  margin-top: 1rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--edge);
}

/* Three-tier epistemic register labels (Vol II Cosmological Note) */
.ch-tier {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.68rem;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  margin: 1.4rem 0 0.5rem;
}
.ch-tier.established { background: #3c5a32; color: #f4ecd8; }
.ch-tier.plausible { background: #6e5a3a; color: #f4ecd8; }
.ch-tier.speculative { background: #8a6d3a; color: #f4ecd8; border: 1px dashed #f4ecd8; }

/* RC condition heading marker */
.ch-rc {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: var(--roll-dark);
  background: rgba(110,90,58,0.1);
  padding: 1px 7px;
  border-radius: 3px;
  margin-right: 6px;
}

/* Two-model comparison block (Vol II Epilogue empirical apparatus) */
.ch-model {
  margin: 1.4rem 0;
  padding: 1rem 1.3rem;
  background: rgba(110,90,58,0.05);
  border-left: 3px solid var(--roll);
  border-radius: 4px;
}
.ch-model-name {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--roll-dark);
  display: block;
  margin-bottom: 0.4rem;
}
.ch-falsify {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.74rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--roll-dark);
  margin-bottom: 0.3rem;
}

/* Closing colophon for the end of a volume */
.ch-colophon {
  border-top: 3px double var(--roll);
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  text-align: center;
}
.ch-colophon .ch-colophon-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--roll-dark);
  margin-bottom: 0.4rem;
}
.ch-colophon .ch-colophon-sub {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 1.4rem;
}
.ch-colophon .ch-colophon-range {
  font-size: 1.05rem;
  color: var(--ink);
}

/* ============================================================= */
/* THE CODEX — hero link, chat launcher panel (added)            */
/* ============================================================= */
.hero-codex-link{
  display:inline-block; margin-top:1.1rem; padding:.55em 1.3em;
  font-family:Arial,Helvetica,sans-serif; font-size:.9rem; letter-spacing:.04em;
  color:#f4ecd8; text-decoration:none;
  background:rgba(124,45,45,.85); border:1px solid var(--gold,#b08d57); border-radius:4px;
  box-shadow:0 2px 8px rgba(0,0,0,.35); transition:.18s;
}
.hero-codex-link:hover{ background:#7c2d2d; box-shadow:0 3px 12px rgba(0,0,0,.5); }

/* The Codex drawer hosts the chat in an iframe; make it tall enough to chat in */
.codex-drawer{ display:flex; flex-direction:column; width:min(420px,94vw); }
.codex-drawer .qa-head{ display:flex; align-items:center; gap:10px; }
.codex-full-link{
  margin-left:auto; font-family:Arial,Helvetica,sans-serif; font-size:.74rem; letter-spacing:.03em;
  color:var(--gold,#b08d57); text-decoration:none;
}
.codex-full-link:hover{ text-decoration:underline; }
.codex-drawer{
  display:flex; flex-direction:column;
  width:min(420px,94vw);
  height:min(620px,72vh);
  max-height:72vh;
}
.codex-frame{
  flex:1 1 auto; width:100%; border:none; background:#0f1011;
  height:0; min-height:0;
}

/* ============================================================= */
/* MOBILE RESPONSIVE — comprehensive breakpoints                  */
/* Primary: 480px (small phones), Secondary: 768px (large phones) */
/* ============================================================= */

/* ---- 768px: large phones / small tablets ---- */


/* ---- 480px: small phones (primary mobile target) ---- */


/* ---- Touch: remove hover effects that feel wrong on mobile ---- */


/* ============================================================= */
/* CODEX LANDING — full-screen AI chat as the front door         */
/* ============================================================= */
/* ── Codex chat button under the author name ── */
.hero-codex-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 1.4rem;
  padding: 0.6em 1.4em;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.06em;
  color: #f4ecd8;
  text-decoration: none;
  background: rgba(124,45,45,0.88);
  border: 1px solid var(--gold, #b08d57);
  border-radius: 30px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.4);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  cursor: pointer;
}
.hero-codex-btn:hover {
  background: #7c2d2d;
  box-shadow: 0 5px 20px rgba(0,0,0,0.55);
  transform: translateY(-1px);
}
.hero-codex-btn-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}
.hero-codex-btn-icon svg { width: 100%; height: 100%; }
.hero-codex-btn-label { white-space: nowrap; }


/* =============================================================
   MOBILE RESPONSIVE — complete layout system
   Fits the page edge-to-edge on phones, keeps scrolls readable.
   Breakpoints: 700px (tablet/large phone), 480px (standard phone),
   360px (small phone).
   ============================================================= */

/* Universal overflow guard — never let anything push past the screen edge */
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, iframe, table { max-width: 100%; }

/* ── 700px: tablets & large phones ── */
@media (max-width: 700px) {

  body { padding: 4vh 5% 5vh; }

  /* Hero */
  .hero-title   { font-size: clamp(1.6rem, 6.5vw, 2.6rem); }
  .hero-author  { font-size: 0.9rem; }

  /* Volume nav: stack the three volumes vertically instead of cramming side-by-side */
  .volumes { flex-direction: column; gap: 14px; padding: 12px 4px; }
  .vol { width: 100%; }
  .vol-face { min-height: 92px; }
  .vol-name { font-size: clamp(0.78rem, 3vw, 1rem); margin-left: 48px; }
  .wax-seal { left: calc(50% - 130px); }

  /* Opening section */
  .opening { padding: 6vh 18px 4vh; }
  .opening-lead { font-size: 1.3rem; }

  /* Scrolls list — pull close to screen edges for max reading width */
  .scrolls { padding: 0 6px 12vh; gap: 22px; }

  /* Scroll handle bar — readable label */
  .scroll-label {
    font-size: clamp(0.8rem, 3vw, 1rem);
    letter-spacing: 0.06em;
    padding-left: 64px;
    padding-right: 40px;
    min-height: 64px;
    white-space: normal;
    line-height: 1.3;
  }
  .scroll-handle .wax-seal { width: 40px; height: 46px; }

  /* Open parchment — thin side frame so text spans nearly full width */
  .scroll.is-open .scroll-parchment {
    padding: 24px clamp(12px, 3vw, 22px) 44px;
    border-image: url("scroll_panel.png") 30 60 90 60 fill / 22px 22px 52px 22px stretch;
    border-width: 22px 22px 52px 22px;
  }
  .scroll-title    { font-size: 1.3rem; margin-bottom: 1.2rem; }
  .scroll-subtitle { font-size: 1.05rem; }
  .scroll-parchment p { font-size: 1rem; line-height: 1.75; text-align: left; }
  .scroll-pull     { font-size: 1.05rem; }
  .scroll-subhead  { font-size: 1rem; }

  /* Tables scroll horizontally inside their own box */
  .scroll-parchment .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .scroll-parchment table { font-size: 0.85rem; }
}

/* ── 480px: standard phones ── */
@media (max-width: 480px) {

  body { padding: 3vh 4% 4vh; }

  .hero-title  { font-size: clamp(1.4rem, 8vw, 2rem); line-height: 1.18; }
  .hero-eyebrow { font-size: 0.64rem; letter-spacing: 0.16em; }
  .hero-author { font-size: 0.8rem; }

  /* Volumes stacked, compact */
  .volumes { gap: 11px; padding: 10px 2px; }
  .vol-face { min-height: 78px; }
  .vol-name { font-size: clamp(0.72rem, 3.6vw, 0.9rem); margin-left: 40px; letter-spacing: 0.08em; }
  .wax-seal { left: calc(50% - 110px); width: 36px; height: 42px; }
  .vol-chapter { padding: 11px 16px; font-size: 0.92rem; }

  /* Opening */
  .opening { padding: 5vh 14px 3.5vh; }
  .opening-lead { font-size: 1.15rem; line-height: 1.5; }
  .opening p:not(.opening-lead):not(.opening-invite) { font-size: 0.95rem; }
  .opening-invite { font-size: 0.72rem; }

  /* Scrolls */
  .scrolls { padding: 0 4px 10vh; gap: 18px; }
  .scroll-label {
    font-size: clamp(0.74rem, 3.8vw, 0.9rem);
    padding-left: 52px;
    padding-right: 32px;
    min-height: 58px;
  }
  .scroll-handle .wax-seal { width: 32px; height: 38px; }

  /* Open parchment — minimal side frame, text spans nearly edge to edge */
  .scroll.is-open .scroll-parchment {
    padding: 18px clamp(10px, 2.5vw, 16px) 34px;
    border-image: url("scroll_panel.png") 30 60 90 60 fill / 16px 16px 40px 16px stretch;
    border-width: 16px 16px 40px 16px;
  }
  .scroll-title    { font-size: 1.12rem; margin-bottom: 1rem; padding-bottom: 0.6rem; }
  .scroll-subtitle { font-size: 0.95rem; margin-bottom: 1.2rem; }
  .scroll-parchment p { font-size: 0.94rem; line-height: 1.72; margin-bottom: 1rem; }
  .scroll-pull     { font-size: 0.95rem; padding: 0.6rem 1rem; }
  .scroll-subhead  { font-size: 0.92rem; margin-top: 1.6rem; }
  .scroll-signoff  { font-size: 0.82rem; }
  .scroll-parchment table { font-size: 0.78rem; }

  /* FABs smaller */
  .nav-fab, .qa-fab { width: 50px; height: 50px; }
}

/* ── 360px: small phones ── */
@media (max-width: 360px) {

  .hero-title { font-size: clamp(1.2rem, 9vw, 1.7rem); }
  .vol-name { font-size: 0.72rem; margin-left: 34px; }
  .wax-seal { left: calc(50% - 95px); }
  .scroll-label { font-size: 0.72rem; padding-left: 46px; padding-right: 28px; }
  .scroll-title { font-size: 1.02rem; }
  .scroll-parchment p { font-size: 0.9rem; }
}

/* ── Touch devices: remove hover effects that feel wrong on mobile ── */
@media (hover: none) and (pointer: coarse) {
  .nav-fab:hover, .qa-fab:hover {
    transform: none;
    box-shadow: 0 6px 18px rgba(0,0,0,.35);
  }
  .scroll-handle:hover .scroll-label { filter: none; }
  .hero-codex-link:hover {
    background: rgba(124,45,45,.85);
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
  }
  /* Prevent iOS zoom on input focus */
  textarea, input { font-size: 1rem !important; }
}
