:root {
  --bg: #070b14;
  --bg-alt: #0d1527;
  --fg: #f8fafc;
  --muted: #94a3b8;
  --rule: rgba(245, 197, 66, 0.2);
  --accent: #f5c542;
  --accent-soft: rgba(245, 197, 66, 0.12);
  --mark: rgba(245, 197, 66, 0.35);
  --panel: #0d1527;
  --gold-gradient: linear-gradient(135deg, #fef08a 0%, #f5c542 50%, #b48c3c 100%);
  --gold-glow: rgba(245, 197, 66, 0.25);
  --serif: 'Georgia', 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
  --display-serif: 'Cinzel', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 95ch;
  --sidebar: 21rem;
  --toc: 16rem;
}
:root:not([data-theme="light"]) {
  --bg: #070b14;
  --bg-alt: #0d1527;
  --fg: #f8fafc;
  --muted: #94a3b8;
  --rule: rgba(245, 197, 66, 0.2);
  --accent: #f5c542;
  --accent-soft: rgba(245, 197, 66, 0.12);
  --mark: rgba(245, 197, 66, 0.35);
  --panel: #0d1527;
}
:root[data-theme="dark"] {
  --bg: #070b14;
  --bg-alt: #0d1527;
  --fg: #f8fafc;
  --muted: #94a3b8;
  --rule: rgba(245, 197, 66, 0.2);
  --accent: #f5c542;
  --accent-soft: rgba(245, 197, 66, 0.12);
  --mark: rgba(245, 197, 66, 0.35);
  --panel: #0d1527;
}
:root[data-theme="light"] {
  --bg: #fdfdfb;
  --bg-alt: #f5f4ef;
  --fg: #1b1b19;
  --muted: #6b6b63;
  --rule: #e2e0d8;
  --accent: #b48c3c;
  --accent-soft: #fcf8ee;
  --mark: #f6e6a8;
  --panel: #ffffff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.muted { color: var(--muted); }
.skip {
  position: absolute; left: -999px; top: 0; background: var(--panel); padding: .5rem .75rem; z-index: 100;
}
.skip:focus { left: .5rem; top: .5rem; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem 1rem;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: baseline; gap: .45rem; color: var(--fg); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.brand-text { font-size: .95rem; letter-spacing: .01em; }
.searchbox { position: relative; flex: 1 1 auto; max-width: 46rem; }
#q {
  width: 100%; padding: .45rem .6rem;
  font: inherit; font-size: .9rem;
  color: var(--fg); background: var(--bg-alt);
  border: 1px solid var(--rule); border-radius: 6px;
}
#q::placeholder { color: var(--muted); }
.topbar-actions { display: flex; gap: .25rem; }
.icon-btn {
  font: inherit; font-size: 1rem; line-height: 1;
  padding: .4rem .5rem; color: var(--fg); background: transparent;
  border: 1px solid transparent; border-radius: 6px; cursor: pointer;
}
.icon-btn:hover { background: var(--bg-alt); border-color: var(--rule); }
#nav-toggle { display: none; }

/* search dropdown */
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + .35rem);
  max-height: 70vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 12px 32px rgb(0 0 0 / .12);
  padding: .25rem;
}
.sr-item {
  display: block; padding: .45rem .55rem; border-radius: 6px; color: var(--fg);
}
.sr-item[aria-selected="true"], .sr-item:hover { background: var(--accent-soft); text-decoration: none; }
.sr-title { font-weight: 600; font-size: .9rem; }
.sr-meta { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.sr-snip { font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.sr-snip mark, .hit mark { background: var(--mark); color: inherit; padding: 0 .1em; }
.sr-empty { padding: .6rem; color: var(--muted); font-size: .85rem; }

/* layout */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  border-right: 1px solid var(--rule);
  position: sticky; top: 3.1rem; height: calc(100vh - 3.1rem); overflow: auto;
  background: var(--bg);
}
.sidebar-inner { padding: .9rem .6rem 2rem; }
.sidebar-foot {
  padding: .6rem; border-top: 1px solid var(--rule);
  font-size: .75rem; display: flex; gap: .4rem; align-items: center;
}
.nav-group { margin-bottom: .15rem; }
.nav-group > summary {
  cursor: pointer; list-style: none; padding: .3rem .45rem;
  display: flex; justify-content: space-between; gap: .5rem;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  border-radius: 5px;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { background: var(--bg-alt); color: var(--fg); }
.nav-count { font-variant-numeric: tabular-nums; }
.nav-docs { margin: 0 0 .4rem; padding: 0; list-style: none; }
.nav-docs a {
  display: block; padding: .22rem .45rem; border-radius: 5px;
  font-size: .83rem; color: var(--fg); line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-docs a:hover { background: var(--bg-alt); text-decoration: none; }
.nav-docs a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.main { min-width: 0; padding: 2rem 2rem 5rem; }
.main-inner { max-width: var(--max); margin: 0 auto; }

/* home */
.page-title { font: 600 1.5rem/1.2 var(--sans); margin: 0 0 .3rem; }
.page-lede { color: var(--muted); max-width: 60ch; margin: 0 0 1.6rem; font-size: .95rem; }
.coll-list { list-style: none; margin: 0 0 2rem; padding: 0; border-top: 1px solid var(--rule); }
.coll-list li { border-bottom: 1px solid var(--rule); }
.coll-list a {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem;
  padding: .7rem .2rem; color: var(--fg);
}
.coll-list a:hover { background: var(--bg-alt); text-decoration: none; }
.coll-name { font-weight: 600; }
.coll-blurb { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; }
.coll-n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.continue {
  display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap;
  padding: .6rem .75rem; margin: 0 0 1.6rem;
  background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 8px;
  font-size: .9rem;
}
h2.section { font: 600 1rem/1.3 var(--sans); margin: 2rem 0 .6rem; letter-spacing: .01em; }
.doc-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.doc-list li { border-bottom: 1px solid var(--rule); }
.doc-list a { display: block; padding: .5rem .2rem; color: var(--fg); }
.doc-list a:hover { background: var(--bg-alt); text-decoration: none; }
.doc-list .meta { color: var(--muted); font-size: .78rem; }

/* reader */
.crumbs { font-size: .8rem; color: var(--muted); margin: 0 0 .6rem; }
.crumbs a { color: var(--muted); }
.crumbs span.sep { padding: 0 .35rem; }
.docmeta { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem .8rem; margin: .4rem 0 1.4rem; }
.prose {
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.8;
  max-width: var(--max);
  overflow-wrap: break-word;
  color: #f1f5f9;
  letter-spacing: normal;
  text-transform: none !important;
  font-variant: normal !important;
}
.prose p {
  margin: 0 0 1.35rem;
  text-align: justify;
}
.full-width-mode .prose {
  max-width: 100% !important;
}
.full-width-mode .shell {
  grid-template-columns: var(--sidebar) minmax(0, 1fr) !important;
}
.full-width-mode .toc {
  display: none !important;
}
.prose > :first-child { margin-top: 0; }
.prose h1 { font-size: 1.6rem; line-height: 1.25; margin: 2.2rem 0 .8rem; font-family: var(--sans); }
.prose h2 { font-size: 1.22rem; line-height: 1.3; margin: 2rem 0 .6rem; font-family: var(--sans); }
.prose h3 { font-size: 1.02rem; margin: 1.6rem 0 .5rem; font-family: var(--sans); }
.prose h4 { font-size: .95rem; margin: 1.4rem 0 .4rem; font-family: var(--sans); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.35rem; margin: 0 0 1rem; }
.prose li { margin: .15rem 0; }
.prose blockquote {
  margin: 1.2rem 0; padding: .1rem 0 .1rem 1rem;
  border-left: 2px solid var(--rule); color: var(--fg);
}
.prose blockquote p { margin: .5rem 0; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.prose code, .prose kbd { font-family: var(--mono); font-size: .88em; background: var(--bg-alt); padding: .05em .3em; border-radius: 4px; }
.prose pre { background: var(--bg-alt); padding: .8rem 1rem; overflow: auto; border-radius: 6px; font-size: .85rem; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: .85rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--rule); padding: .35rem .5rem; text-align: left; vertical-align: top; }
.prose th { background: var(--bg-alt); font-weight: 600; white-space: nowrap; }
.prose sup { font-size: .7em; }
.prose .footnotes { font-size: .85rem; color: var(--muted); border-top: 1px solid var(--rule); margin-top: 2.5rem; }
.prose .footnotes p { margin: .3rem 0; }
.prose a.ref {
  font: .66rem/1 var(--sans); vertical-align: super;
  padding: .05rem .2rem; margin-left: .05rem;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 3px; text-decoration: none; white-space: nowrap;
}
.prose a.ref:hover { text-decoration: underline; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin: 3rem 0 0; max-width: var(--max); border-top: 1px solid var(--rule); padding-top: .9rem; font-size: .9rem; }
.pager a { display: block; max-width: 48%; }
.pager .dir { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pager .next { text-align: right; margin-left: auto; }

/* toc */
.toc {
  border-left: 1px solid var(--rule); padding: 2rem 1rem; font-size: .8rem;
  position: sticky; top: 3.1rem; height: calc(100vh - 3.1rem); overflow: auto;
}
.toc h2 { font: 600 .72rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li a { display: block; padding: .18rem 0; color: var(--muted); line-height: 1.3; border-left: 2px solid transparent; padding-left: .5rem; }
.toc li a:hover { color: var(--fg); text-decoration: none; }
.toc li a.active { color: var(--accent); border-left-color: var(--accent); }
.toc .l3 a { padding-left: 1.2rem; font-size: .76rem; }

/* reference panel */
.panel {
  position: fixed; z-index: 60; right: 1rem; bottom: 1rem; width: min(26rem, calc(100vw - 2rem));
  max-height: min(70vh, 40rem); overflow: auto;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 18px 48px rgb(0 0 0 / .22); padding: 1rem 1.1rem;
  font-size: .88rem;
}
.panel h3 { margin: 0 1.5rem .35rem 0; font: 600 .78rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.panel .ref-cite { font-weight: 600; margin: 0 0 .5rem; }
.panel .ref-note { margin: 0 0 .7rem; }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .7rem; margin: 0; font-size: .82rem; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; }
.panel .close { position: absolute; right: .5rem; top: .45rem; }
.panel .more { margin-top: .8rem; display: flex; gap: .9rem; flex-wrap: wrap; font-size: .82rem; }

/* search page */
.hit { padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.hit h3 { margin: 0 0 .2rem; font: 600 1rem/1.35 var(--sans); }
.hit .meta { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hit .snip { font-size: .88rem; color: var(--muted); margin-top: .25rem; }
.count { color: var(--muted); font-size: .85rem; margin: 0 0 1rem; }

@media (max-width: 1200px) {
  .shell { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  #nav-toggle { display: inline-block; }
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 3.1rem; width: min(20rem, 85vw);
    transform: translateX(-102%); transition: transform .18s ease;
    box-shadow: 0 0 0 1px var(--rule);
  }
  .sidebar.open { transform: none; }
  .main { padding: 1.2rem 1rem 4rem; }
  .prose { font-size: 1.03rem; }
  .brand-text .muted { display: none; }
}
@media print {
  .topbar, .sidebar, .toc, .panel, .pager, .skip { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .prose { max-width: none; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
  .prose a.ref::after { content: " [" attr(data-ref) "]"; }
}

/* ---- link preview ------------------------------------------------------ */
.preview {
  position: fixed; z-index: 70; width: min(23rem, calc(100vw - 2rem));
  background: var(--panel); color: var(--fg);
  border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 14px 36px rgb(0 0 0 / .18);
  padding: .7rem .8rem; pointer-events: none;
  font-size: .82rem; line-height: 1.45;
}
.preview .pv-meta { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.preview .pv-title { font: 600 .9rem/1.3 var(--sans); margin: .1rem 0 .3rem; }
.preview .pv-excerpt { color: var(--muted); font-family: var(--serif); font-size: .84rem; }
.preview .pv-foot { margin-top: .35rem; color: var(--muted); font-size: .7rem; }

/* ---- sources dialog ---------------------------------------------------- */
.dialog { position: fixed; inset: 0; z-index: 80; background: rgb(0 0 0 / .35); display: flex; justify-content: center; align-items: flex-start; padding: 4rem 1rem 2rem; }
.dialog[hidden] { display: none; }
.dialog-box {
  width: min(56rem, 100%); max-height: min(78vh, 46rem);
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 24px 60px rgb(0 0 0 / .3); overflow: hidden;
}
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem .4rem; }
.dialog-head h2 { margin: 0; font: 600 .95rem/1.2 var(--sans); }
.dialog-filter { padding: .2rem 1rem .6rem; }
.dialog-filter input {
  width: 100%; padding: .45rem .6rem; font: inherit; font-size: .9rem; color: var(--fg);
  background: var(--bg-alt); border: 1px solid var(--rule); border-radius: 6px;
}
.dialog-list { overflow: auto; padding: .2rem .5rem .5rem; flex: 1 1 auto; }
.dlg-group { position: sticky; top: 0; background: var(--panel); padding: .45rem .5rem .25rem;
  font: 600 .7rem/1 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.dlg-item { display: grid; grid-template-columns: 1fr auto; gap: 0 .6rem; padding: .4rem .5rem; border-radius: 6px; color: var(--fg); }
.dlg-item:hover, .dlg-item[aria-selected="true"] { background: var(--accent-soft); text-decoration: none; }
.dlg-item .t { font-size: .9rem; }
.dlg-item .m { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.dlg-foot { border-top: 1px solid var(--rule); padding: .45rem 1rem; font-size: .74rem; color: var(--muted); display: flex; gap: 1rem; flex-wrap: wrap; }
.with-label { display: inline-flex; gap: .35rem; align-items: center; }
@media (max-width: 720px) { .btn-label { display: none; } }

/* ---- related sources at the foot of every document --------------------- */
.related { margin: 2.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--rule); max-width: var(--max); }
.related h2 { font: 600 .95rem/1.3 var(--sans); margin: 0 0 .25rem; }
.related p { margin: 0 0 .5rem; font-size: .78rem; color: var(--muted); }
.related ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .15rem .9rem; }
.related li a { display: block; padding: .18rem 0; font-size: .87rem; color: var(--fg); }
.related li a:hover { color: var(--accent); text-decoration: underline; }


/* === MARCO BROTTO ENTERPRISE BRANDING & TOPBAR === */
.mb-global-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem 1.75rem;
  background: rgba(7, 11, 20, 0.98);
  border-bottom: 1.5px solid rgba(245, 197, 66, 0.3);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  font-family: var(--sans);
  font-size: 0.85rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}
.mb-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-weight: 600;
}
.mb-topbar-link {
  color: #cbd5e1;
  text-decoration: none !important;
  transition: color 0.2s;
}
.mb-topbar-link:hover {
  color: #f5c542 !important;
}
.mb-sep {
  color: #64748b;
  font-weight: 400;
}
.mb-curr {
  color: #f5c542;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.mb-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.mb-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: all 0.25s ease;
}
.mb-btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(245, 197, 66, 0.4);
  color: #f5c542;
}
.mb-btn-outline:hover {
  background: rgba(245, 197, 66, 0.15);
  color: #ffffff;
  border-color: #f5c542;
  box-shadow: 0 0 15px rgba(245, 197, 66, 0.2);
}
.mb-btn-gold {
  background: linear-gradient(135deg, #fef08a 0%, #f5c542 50%, #b48c3c 100%);
  color: #070b14 !important;
  border: none;
  box-shadow: 0 0 15px rgba(245, 197, 66, 0.35);
}
.mb-btn-gold:hover {
  box-shadow: 0 0 25px rgba(245, 197, 66, 0.6);
  transform: translateY(-1px);
}
.topbar {
  top: 49px; /* offset for mb-global-topbar */
  background: rgba(13, 21, 39, 0.95);
  border-bottom: 1px solid rgba(245, 197, 66, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand-mark {
  color: #f5c542 !important;
}
.brand-text {
  font-weight: 800;
  letter-spacing: 0.02em;
}
.searchbox input {
  background: rgba(7, 11, 20, 0.9) !important;
  border-color: rgba(245, 197, 66, 0.35) !important;
  color: #ffffff !important;
}
.searchbox input:focus {
  border-color: #f5c542 !important;
  box-shadow: 0 0 12px rgba(245, 197, 66, 0.25) !important;
}
.sidebar {
  border-right-color: rgba(245, 197, 66, 0.15);
  background: rgba(7, 11, 20, 0.6);
}
.coll-list li a {
  border-color: rgba(245, 197, 66, 0.15);
  background: rgba(13, 21, 39, 0.6);
  border-radius: 8px;
  transition: all 0.2s ease;
}
.coll-list li a:hover {
  border-color: rgba(245, 197, 66, 0.45);
  background: rgba(245, 197, 66, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}
.coll-name {
  color: #f5c542;
  font-weight: 700;
}


/* === INTERACTIVE CHAPTER NAVIGATOR & READING TOOLBAR === */
.reading-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 1.5rem 0;
  padding: 0.6rem 0.85rem;
  background: rgba(13, 21, 39, 0.85);
  border: 1px solid rgba(245, 197, 66, 0.25);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}
.reading-tools-left, .reading-tools-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.reading-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.reading-tool-btn:hover, .reading-tool-btn.active {
  background: rgba(245, 197, 66, 0.18);
  border-color: #f5c542;
  color: #fef08a;
  box-shadow: 0 0 10px rgba(245, 197, 66, 0.2);
}
.chapter-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: rgba(7, 11, 20, 0.95);
  border: 1.5px solid rgba(245, 197, 66, 0.35);
  border-radius: 12px;
  margin: 1rem 0 2rem 0;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
  position: sticky;
  top: 96px;
  z-index: 90;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}
.chapter-nav-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: #f5c542;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 0.4rem;
}
.chapter-pills-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex: 1;
}
.chapter-pill {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(245, 197, 66, 0.2);
  color: #cbd5e1;
  text-decoration: none !important;
  transition: all 0.2s ease;
}
.chapter-pill:hover, .chapter-pill.active {
  background: linear-gradient(135deg, rgba(245,197,66,0.3), rgba(180,140,60,0.5));
  border-color: #f5c542;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(245, 197, 66, 0.3);
}
.verse-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  color: #f5c542;
  background: rgba(245, 197, 66, 0.12);
  border: 1px solid rgba(245, 197, 66, 0.3);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  margin-right: 0.4rem;
  font-family: var(--sans);
  vertical-align: baseline;
  user-select: none;
}

/* === FULL WIDTH & RESPONSIVE PROSE PERFECTION === */
.full-width-mode .shell {
  grid-template-columns: var(--sidebar) minmax(0, 1fr) !important;
}
.full-width-mode .main-inner,
.full-width-mode .prose,
.full-width-mode .pager,
.full-width-mode .related,
.full-width-mode .reading-toolbar,
.full-width-mode .chapter-nav-bar {
  max-width: 100% !important;
}
.full-width-mode .toc {
  display: none !important;
}

@keyframes chapterHighlight {
  0% { background: rgba(245, 197, 66, 0.35); color: #fff; padding-left: 0.5rem; border-radius: 6px; box-shadow: 0 0 15px rgba(245, 197, 66, 0.4); }
  100% { background: transparent; padding-left: 0; box-shadow: none; }
}
.chapter-glow {
  animation: chapterHighlight 2.5s ease-out;
}

.prose, .prose p, .prose li, .prose blockquote {
  text-transform: none !important;
  font-variant-caps: normal !important;
  font-variant: normal !important;
}


/* ---- SACRED & SCHOLARLY SIDEBAR 2026 ELEVATION ---- */
.sidebar {
  border-right: 1px solid rgba(212, 175, 55, 0.22);
  background: linear-gradient(180deg, #070c18 0%, #0a1122 50%, #070c18 100%);
  position: sticky;
  top: 3.1rem;
  height: calc(100vh - 3.1rem);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
}

/* Custom Sleek Scrollbar */
.sidebar::-webkit-scrollbar {
  width: 5px;
}
.sidebar::-webkit-scrollbar-track {
  background: rgba(7, 12, 24, 0.85);
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.35);
  border-radius: 999px;
  transition: background 0.2s ease;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 175, 55, 0.65);
}

.sidebar-inner {
  padding: 1.1rem 0.75rem 2.5rem;
}

/* Nav Group Cards */
.nav-group {
  margin-bottom: 0.65rem;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-group:hover {
  border-color: rgba(212, 175, 55, 0.25);
  background: rgba(15, 23, 42, 0.7);
}
.nav-group[open] {
  border-color: rgba(212, 175, 55, 0.35);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.06) 0%, rgba(13, 21, 39, 0.7) 100%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

/* Group Summary Header */
.nav-group > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.65rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  border-radius: 11px;
  user-select: none;
  transition: all 0.2s ease;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::marker { display: none; }

.nav-summary-main {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.nav-coll-icon {
  font-size: 1.05rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  flex-shrink: 0;
}
.nav-coll-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s ease;
}
.nav-group:hover .nav-coll-title {
  color: #fff;
}
.nav-group[open] .nav-coll-title {
  color: #f5c542;
}

.nav-summary-badges {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.nav-count {
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.28);
  color: #f5c542;
}
.nav-chevron {
  font-size: 0.65rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, color 0.2s ease;
}
.nav-group[open] .nav-chevron {
  transform: rotate(90deg);
  color: #f5c542;
}

/* Nav Docs List */
.nav-docs {
  margin: 0;
  padding: 0.35rem 0.5rem 0.65rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top: 1px solid rgba(212, 175, 55, 0.1);
}
.nav-docs a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.35;
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
}
.nav-doc-marker {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.nav-doc-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-docs a:hover {
  background: rgba(212, 175, 55, 0.08);
  color: #fff;
  transform: translateX(4px);
  border-left-color: rgba(212, 175, 55, 0.4);
}
.nav-docs a:hover .nav-doc-marker {
  background: #f5c542;
  box-shadow: 0 0 6px #f5c542;
}
.nav-docs a[aria-current="page"] {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.22) 0%, rgba(212, 175, 55, 0.05) 100%);
  color: #fef08a !important;
  font-weight: 600;
  border-left: 3px solid #f5c542;
  box-shadow: inset 0 0 14px rgba(212, 175, 55, 0.08);
}
.nav-docs a[aria-current="page"] .nav-doc-marker {
  background: #f5c542;
  box-shadow: 0 0 8px #f5c542;
  transform: scale(1.3);
}

/* More Link in Nav */
.nav-more-item {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}
.nav-more-link {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem !important;
  color: #f5c542 !important;
  font-weight: 600;
  padding: 0.4rem 0.6rem !important;
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.05);
}
.nav-more-link:hover {
  background: rgba(212, 175, 55, 0.15) !important;
  text-decoration: none;
}

/* Reference badge */
.ref-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  flex-shrink: 0;
}

/* ---- ELEVATED PREVIEW POPOVER ---- */
.preview {
  position: fixed;
  z-index: 120;
  width: min(25rem, calc(100vw - 2rem));
  background: rgba(10, 16, 32, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #f8fafc;
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 25px rgba(212, 175, 55, 0.15);
  padding: 1rem 1.15rem;
  pointer-events: none;
  font-size: 0.85rem;
  line-height: 1.55;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.pv-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.pv-meta {
  color: #f5c542;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}
.pv-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pv-badge-gold {
  background: linear-gradient(135deg, #d4af37, #f5c542);
  color: #0b132b;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.35);
}
.pv-badge-blue {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}
.pv-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.35;
  color: #fff;
  margin-bottom: 0.55rem;
  letter-spacing: 0.02em;
}
.pv-excerpt {
  color: #cbd5e1;
  font-family: 'Inter', sans-serif;
  font-size: 0.83rem;
  line-height: 1.5;
  font-style: italic;
  margin-bottom: 0.7rem;
  border-left: 2px solid rgba(212, 175, 55, 0.35);
  padding-left: 0.65rem;
}
.pv-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: #94a3b8;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.5rem;
  margin-top: 0.3rem;
}
.pv-words-pill {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 6px;
  color: #e2e8f0;
  font-weight: 600;
}
.pv-source-label {
  color: #f5c542;
  font-weight: 500;
}
