:root{
  --paper:#fbf6ea;
  --ink:#1a1a1a;
  --muted: rgba(0,0,0,.60);
  --line: rgba(0,0,0,.12);
  --bg:#0f1216;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: "EB Garamond", ui-serif, Georgia, "Times New Roman", Times, serif;
  color:var(--ink);
  background: radial-gradient(1200px 600px at 50% 20%, #1c2430 0%, var(--bg) 60%);
}

.topbar{
  display:flex;
  gap:16px;
  align-items:center;
  justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,.08);
  color:#fff;
}
.brand .book-title{ font-size:18px; font-weight:700; letter-spacing:.2px; }
.brand .book-subtitle{ font-size:12px; opacity:.8; margin-top:2px; }

.controls{ display:flex; align-items:center; gap:10px; }
.btn{
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color:#fff;
  padding:8px 10px;
  border-radius:10px;
  cursor:pointer;
}
.btn:hover{ background: rgba(255,255,255,.10); }
.btn:disabled{ opacity:.45; cursor:not-allowed; }
.indicator{
  min-width:86px;
  text-align:center;
  font-size:12px;
  opacity:.9;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  padding:7px 10px;
  border-radius:10px;
}

.stage{
  display:flex;
  justify-content:center;
  padding:18px 12px 28px;
}
.book{
  filter: drop-shadow(0 22px 55px rgba(0,0,0,.55));
}

.page{ background: var(--paper); }
.page-inner{
  height:100%;
  padding: 38px 34px;
  border: 1px solid var(--line);
  background:
    linear-gradient(to right, rgba(0,0,0,.06), transparent 18%, transparent 82%, rgba(0,0,0,.05)),
    var(--paper);
  overflow:hidden;
}

.page-inner h1{
  font-size: 28px;
  margin: 0 0 14px;
  font-weight: 600;
}
.page-inner p{
  font-size: 17px;
  line-height: 1.55;
  margin: 0 0 12px;
}
.page-inner em{ font-style: italic; }

.page-inner .dropcap::first-letter{
  float:left;
  font-size: 56px;
  line-height: .85;
  padding: 6px 10px 0 0;
  font-weight: 600;
}

.cover-img{
  padding: 0;
  background: var(--paper);
}
.cover-img img{
  width:100%;
  height:100%;
  object-fit: contain;
  display:block;
}

.centerpage{
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
}
.centerblock{
  width:100%;
  max-width: 90%;
}
.centerblock p{ margin:0; }

.copyright p{
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 10px;
}

.fm-title{
  font-size: 22px;
  margin-bottom: 10px;
  font-weight: 600;
}

.map .mapwrap{ width:100%; display:flex; justify-content:center; align-items:center; }
.map img{
  max-width: 100%;
  max-height: 70%;
  object-fit: contain;
  border: 1px solid rgba(0,0,0,.08);
}
.caption{ text-align:center; margin-top:14px; font-style:italic; opacity:.85; }

.epigraph{
  font-style: italic;
  font-size: 18px !important;
  line-height: 1.55 !important;
}
.epiauthor{
  margin-top: 16px !important;
  font-size: 15px !important;
  color: var(--muted);
}

.toc .tocline{
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.45;
}

.inline-image{
  display:flex;
  justify-content:center;
  align-items:center;
  margin: 10px 0 10px;
}
.inline-image img{
  max-width: 100%;
  max-height: 460px;
  object-fit: contain;
  border: 1px solid rgba(0,0,0,.10);
}

/* hide source */
.source{ display:none; }

/* Footnote refs */
.fnref{
  font-size: 0.75em;
  vertical-align: super;
  cursor: pointer;
  user-select:none;
}
.fnref:hover{ text-decoration: underline; }

/* Modal */
.modal{ position:fixed; inset:0; display:none; }
.modal.is-open{ display:block; }
.modal-backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.55);
}
.modal-card{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 28px));
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 25px 80px rgba(0,0,0,.45);
  overflow:hidden;
}
.modal-close{
  position:absolute;
  right: 10px;
  top: 8px;
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor:pointer;
}
.modal-body{
  padding: 18px 18px 16px;
  font-family: "EB Garamond", ui-serif, Georgia, serif;
}
.modal-title{
  font-weight: 600;
  margin-bottom: 10px;
  font-size: 18px;
}
.modal-text{
  font-size: 16px;
  line-height: 1.5;
}

@media (max-width: 520px){
  .page-inner{ padding: 28px 22px; }
  .page-inner h1{ font-size: 24px; }
  .page-inner p{ font-size: 16px; }
}

.page-inner.map{ text-align:center; }



/* Inline images extracted from docx placeholders */
.inline-figure{ margin:14px 0; display:flex; justify-content:center; }
.inline-img{ max-width:100%; max-height:360px; height:auto; border:1px solid rgba(0,0,0,.12); }

/* Map page: keep space for caption */
.mapwrap img{ max-width:100%; max-height:420px; height:auto; object-fit:contain; }
