/* ============================================
   history.css — "Solid" reading page (history.php)
   Loads after style.css; everything scoped to .book-wrap
   ============================================ */

.book-wrap {
  width: 90%;
  max-width: 44rem;
  margin: 1rem auto 5rem;
}

/* Sticky site header: keep anchor jumps clear of it */
.book-wrap [id] { scroll-margin-top: var(--book-offset, 170px); }

/* Title block */
.book-title {
  text-align: center;
  padding: 1rem 0 3rem;
  border-bottom: 1px solid #333;
}
.book-record svg {
  width: min(70vw, 300px);
  height: auto;
  display: block;
  margin: 0 auto 2rem;
  filter: grayscale(100%) drop-shadow(0 10px 24px rgba(201,168,76,.12));
  transition: filter 0.6s ease;
}
.book-record:hover svg { filter: grayscale(0%) drop-shadow(0 10px 24px rgba(201,168,76,.18)); }
.book-h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.6rem, 8vw, 4rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0.25rem 0 0.5rem;
}
.book-subtitle {
  font-family: 'Georgia', serif;
  font-style: italic;
  font-size: 1.3rem;
  color: #fff;
  margin: 0;
}

/* Eyebrows: same treatment as the curator note */
.book-wrap .book-eyebrow, .book-marks .book-eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.4;
  color: #c9a84c;
  margin: 0 0 0.75rem;
}

/* Sections */
.book-section { padding: 2.5rem 0 2.5rem; }
#contents { border-top: 1px solid #333; padding-top: 3rem; }
.book-opener {
  border-left: 1px solid #c9a84c;
  padding-left: 1.5rem;
  margin-bottom: 2.25rem;
}
.book-opener h2, .book-ch-title {
  font-family: 'Georgia', serif;
  font-weight: 400;
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  line-height: 1.15;
  margin: 0;
}
.book-sub {
  font-family: 'Georgia', serif;
  font-style: italic;
  color: #999;
  font-size: 1.1rem;
  margin: 0.75rem 0 0 !important;
}

/* Reading text */
.book-section p {
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  line-height: 1.8;
  color: #ccc;
  margin: 0 0 1.3rem;
}
.book-section strong { color: #fff; font-weight: 600; }
.book-section h3 {
  font-family: 'Georgia', serif;
  font-weight: 400;
  font-size: 1.45rem;
  margin: 2.5rem 0 1rem;
}
.book-section a { overflow-wrap: anywhere; }

/* Footnote markers */
.fn { font-family: 'Arial', sans-serif; font-size: 0.65em; line-height: 0; padding: 0 1px; }
.fn a { color: #c9a84c; }
.fn a:hover { color: #fff; }

/* Contents */
.book-toc { list-style: none; border-top: 1px solid #333; }
.book-toc li { border-bottom: 1px solid #333; }
.book-toc a {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.9rem 0.25rem;
  transition: background 0.15s ease;
}
.book-toc a:hover { background: #1a1610; }
.toc-label {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666;
}
.toc-name { font-family: 'Georgia', serif; font-size: 1.15rem; color: #c9a84c; }
.book-toc a:hover .toc-name { color: #fff; }

/* Notes */
.book-notes { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid #333; }
.book-notes h3 { font-family: 'Cinzel', serif; font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; margin: 0 0 1.5rem; }
.book-notes .note {
  font-family: 'Arial', sans-serif;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #999;
  padding-left: 2.25rem;
  text-indent: -2.25rem;
  margin-bottom: 0.85rem;
}
.note-num {
  display: inline-block;
  width: 1.75rem;
  margin-right: 0.5rem;
  text-indent: 0;
  text-align: right;
  font-family: 'Cinzel', serif;
  color: #c9a84c;
}
.note:target { background: #1a1610; outline: 1px solid #c9a84c; outline-offset: 4px; }

/* Back links */
.book-back {
  font-family: 'Cinzel', serif !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
  margin: 2rem 0 0 !important;
}
.book-top { text-align: center; margin-top: 3rem !important; }

@media (max-width: 768px) {
  .book-wrap { width: 92%; }
  .book-section p { font-size: 1.02rem; }
  .book-toc a { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* ============================================
   READING FEATURES (history.js)
   ============================================ */

/* Breadcrumb row with bookmarks button */
.book-crumbs { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.book-marks-toggle, .book-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c9a84c;
  background: transparent;
  border: 1px solid #333;
  border-radius: 999px;
  padding: 0.45rem 1.2rem;
  cursor: pointer;
  white-space: nowrap;
}
.book-marks-toggle:hover, .book-marks-toggle[aria-expanded="true"] { border-color: #c9a84c; }
.book-btn { display: inline-block; border-color: #c9a84c; padding: 0.6rem 1.75rem; transition: all 0.25s ease; }
.book-btn:hover, .book-btn:visited:hover { background: #c9a84c; color: #000; }
.book-start { margin: 2rem 0 0 !important; }

/* Bookmarks panel */
.book-marks {
  width: 75%;
  margin: 0 auto 1.5rem;
  border: 1px solid #333;
  background: #0a0a0a;
  padding: 1.5rem 1.75rem 1rem;
}
.book-marks-list { list-style: none; }
.book-marks-list li { display: flex; align-items: center; gap: 1rem; border-top: 1px solid #1e1e1e; }
.book-marks-list a { flex: 1; padding: 0.7rem 0; font-family: 'Georgia', serif; font-size: 1rem; }
.book-marks-chapter {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 0.15rem;
}
.book-marks-remove {
  width: 28px; height: 28px; flex: none;
  border: 1px solid #333; border-radius: 50%;
  background: transparent; color: #666; cursor: pointer; font-size: 1rem; line-height: 1;
}
.book-marks-remove:hover { border-color: #c9a84c; color: #c9a84c; }
.book-marks-empty { font-size: 0.9rem; color: #999; }

/* Continue reading */
.book-continue {
  display: block;
  margin: 2.5rem 0 0;
  border: 1px solid #333;
  border-left: 2px solid #c9a84c;
  background: #0a0a0a;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.book-continue[hidden] { display: none; }
.book-continue:hover { background: #1a1610; border-color: #c9a84c; }
.book-continue .book-eyebrow { display: block; margin-bottom: 0.35rem; }
.book-continue-name { font-family: 'Georgia', serif; font-size: 1.2rem; color: #fff; }

/* Progress strip, sticks under the site header */
.book-progress {
  position: sticky;
  top: var(--book-hh, 0px);
  z-index: 90;
  background: #000;
  border-bottom: 1px solid #222;
}
.book-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 90%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0.5rem 0;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #666;
}
.book-progress-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-progress-pct { color: #c9a84c; font-variant-numeric: tabular-nums; }
.book-progress-fill { height: 2px; width: 0; background: #c9a84c; transition: width 0.15s linear; }

/* Bookmark ribbons beside headings */
.book-ribbon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 0.6rem;
  vertical-align: middle;
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s ease;
}
.book-ribbon svg { fill: none; stroke: #c9a84c; stroke-width: 1.2; }
.book-ribbon:hover, .book-ribbon:focus-visible { opacity: 1; }
.book-ribbon.is-on { opacity: 1; }
.book-ribbon.is-on svg { fill: #c9a84c; }

/* Footnote popup */
.fn a[aria-expanded="true"] { color: #fff; }
.fn-pop {
  margin: -0.4rem 0 1.5rem;
  border: 1px solid #333;
  border-left: 2px solid #c9a84c;
  background: #0a0a0a;
  padding: 0.9rem 1.1rem 0.2rem;
  animation: fnIn 0.18s ease;
}
.fn-pop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.fn-pop-head .book-eyebrow { margin: 0; }
.fn-pop-close {
  width: 26px; height: 26px;
  border: 1px solid #333; border-radius: 50%;
  background: transparent; color: #666; cursor: pointer; font-size: 0.95rem; line-height: 1;
}
.fn-pop-close:hover { border-color: #c9a84c; color: #c9a84c; }
.book-section .fn-pop p {
  font-family: 'Arial', sans-serif;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #aaa;
  margin: 0 0 0.8rem;
}
@keyframes fnIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Previous / next chapter */
.book-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #333;
}
.book-pager a {
  display: block;
  border: 1px solid #333;
  padding: 1rem 1.25rem;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.book-pager a:hover { border-color: #c9a84c; background: #1a1610; }
.book-pager-next { text-align: right; grid-column: 2; }
.book-pager .book-eyebrow { display: block; margin-bottom: 0.3rem; }
.book-pager-name { font-family: 'Georgia', serif; font-size: 1.05rem; color: #fff; }
.book-missing { color: #c9a84c; text-align: center; margin: 1rem 0 0; }

@media (max-width: 768px) {
  .book-marks { width: 92%; padding: 1.25rem; }
  .book-crumbs { width: 92%; }
  .book-pager { grid-template-columns: 1fr; }
  .book-pager-next { grid-column: 1; }
}

/* Links from notes to collection items */
.coll-link { font-style: italic; border-bottom: 1px dotted #c9a84c; }
.coll-link:hover { border-bottom-color: #fff; }

/* Save for offline */
.book-offline { margin: 2.5rem 0 0; text-align: center; }
.book-offline[hidden] { display: none; }
.book-offline-btn:disabled { cursor: default; }
.book-offline-btn.is-saved { background: #c9a84c; color: #000; }
.book-wrap .book-offline-note { font-family: 'Arial', sans-serif; font-size: 0.85rem; color: #999; margin: 0.9rem auto 0; max-width: 30rem; }
.book-offline-remove {
  margin-top: 0.6rem; background: none; border: 0; padding: 0.4rem;
  font-family: 'Arial', sans-serif; font-size: 0.8rem; color: #666; text-decoration: underline; cursor: pointer;
}
.book-offline-remove:hover { color: #c9a84c; }

/* ============================================
   FIGURES
   ============================================ */
.book-fig { margin: 2.25rem 0 2.5rem; }
.fig-zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid #333;
  background: #0a0a0a;
  cursor: zoom-in;
  transition: border-color 0.25s ease;
}
.fig-zoom:hover, .fig-zoom:focus-visible { border-color: #c9a84c; }
.fig-zoom img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 70vh;
  min-height: 120px;
  object-fit: contain;
}
.book-fig figcaption {
  font-family: 'Georgia', serif;
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #999;
  margin-top: 0.75rem;
  padding-left: 1rem;
  border-left: 1px solid #c9a84c;
}
.book-fig figcaption em { font-style: normal; }
.fig-num {
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c9a84c;
  margin-right: 0.35rem;
}
.fig-credit {
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-left: 0.25rem;
}
.book-frontis { max-width: 30rem; margin: 3rem auto 0; }
.book-frontis figcaption { text-align: left; }

/* Lightbox */
body.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3.5rem 1rem 1.5rem;
  animation: fnIn 0.18s ease;
}
.lightbox img { max-width: 100%; max-height: calc(100vh - 10rem); object-fit: contain; cursor: zoom-out; }
.lightbox-cap {
  max-width: 44rem;
  font-family: 'Georgia', serif;
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #999;
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border: 1px solid #333;
  border-radius: 50%;
  background: #000;
  color: #c9a84c;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { border-color: #c9a84c; }
.book-illus { padding-top: 1rem; }
@media (prefers-reduced-motion: reduce) { .lightbox, .fn-pop { animation: none; } }


/* Cover */
.book-title:has(.cover) { border-bottom: 0; padding-top: 0.5rem; }
.cover { position: relative; aspect-ratio: 1590 / 2000; width: min(100%, 31rem); margin: 0 auto; overflow: hidden; background: #0a0a0a; border-radius: 1px 3px 3px 1px; box-shadow: 1px 1px 0 #d8d2c3, 2px 2px 0 #a9a394, 12px 18px 36px rgba(0,0,0,.6), 0 0 0 1px #1f1f1f; }
.cover::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(to right, rgba(0,0,0,.35) 0, rgba(255,255,255,.08) 1.2%, rgba(0,0,0,.12) 2.6%, rgba(0,0,0,0) 6%); }

.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; filter: grayscale(100%) contrast(1.05); }
.cover::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0,0,0,.25) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 45%, rgba(0,0,0,.8) 72%, #000 100%); }
.cover-text { position: absolute; left: 0; right: 0; bottom: 14%; z-index: 1; padding: 0 1.25rem; text-align: center; }
.book-wrap .cover-title { color: #c9a84c; font-size: clamp(3rem, 14vw, 4.75rem); letter-spacing: 0.22em; padding-left: 0.22em; line-height: 1; margin: 0 0 0.6rem; text-shadow: 0 2px 18px rgba(0,0,0,.6); }
.book-wrap .cover-sub { color: #f2efe8; font-size: clamp(1rem, 3.8vw, 1.2rem); line-height: 1.35; text-wrap: balance; }
.cover-imprint { position: absolute; left: 0; right: 0; bottom: 4.5%; z-index: 1; margin: 0; text-align: center; font-family: 'Cinzel', serif; font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(201,168,76,.85); padding: 0 1rem; }
.cover-credit { font-family: 'Georgia', serif; font-style: italic; font-size: 0.82rem; line-height: 1.5; color: #777; width: min(100%, 31rem); margin: 1.75rem auto 0; text-align: center; }
.cover-credit a { color: #c9a84c; }

/* Cover as a 3D book: front board, real page-block side, back board, floor shadow */
.book3d { position: relative; width: min(100%, 31rem); margin: 0 auto; perspective: 1400px; }
.book3d-inner { position: relative; transform-style: preserve-3d; transform: rotateY(-24deg); transform-origin: 40% 50%; }
.book3d .cover { width: 100%; border-radius: 1px 3px 3px 1px; box-shadow: 0 0 0 1px #1a1a1a, 18px 24px 40px rgba(0,0,0,.7); }
.cover::before {
  background:
    linear-gradient(to right,
      rgba(0,0,0,.6) 0, rgba(255,255,255,.14) .9%, rgba(0,0,0,.35) 1.8%,
      rgba(255,255,255,.06) 3%, rgba(0,0,0,.45) 3.9%, rgba(255,255,255,.12) 4.6%,
      rgba(0,0,0,.12) 6.5%, rgba(0,0,0,0) 11%),
    linear-gradient(to left, rgba(255,255,255,.16) 0, rgba(255,255,255,0) .8%),
    linear-gradient(to bottom, rgba(255,255,255,.12) 0, rgba(255,255,255,0) .6%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.book3d-pages {
  /* side of the book: front board edge | page block | back board edge (boards overhang the pages top and bottom) */
  position: absolute; top: 0; bottom: 0; left: 100%; width: 38px;
  transform-origin: left center; transform: rotateY(90deg);
  background:
    linear-gradient(to right, #1c1c1c 0 3px, transparent 3px calc(100% - 4px), #121212 calc(100% - 4px)),
    linear-gradient(to bottom, #0e0e0e 0 1.4%, transparent 1.4% 98.6%, #0e0e0e 98.6%),
    linear-gradient(to right, rgba(0,0,0,.28), rgba(0,0,0,0) 30%),
    repeating-linear-gradient(to right, #f1ece0 0 1px, #d9d3c4 1px 2px);
}
.book3d-back, .book3d-shadow { display: none; }
@media (max-width: 480px) { .book3d { width: 86%; } .book3d-pages { width: 28px; } }

/* Cover actions: keep Begin reading and Save for offline together, clear the Contents rule */
.book-title:has(.cover) { padding-bottom: 0.5rem; }
.book-start { margin: 2rem 0 0 !important; }
.book-offline { margin: 1rem 0 3rem; }
.book-offline-btn { border-color: #333; }
.book-offline-btn:hover { border-color: #c9a84c; }
.book-wrap .book-offline-note {
  font-family: 'Georgia', serif;
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #777;
  max-width: 24rem;
  margin: 0.75rem auto 0;
}
/* Offline explanation lives in the button's tooltip */
.book-wrap .book-offline-note { display: none; }

/* Safari: keep cover layers in a fixed order inside the 3D book (photo, shade, grain, text) */
.book3d .cover { isolation: isolate; transform: translateZ(0); }
.book3d .cover-img { z-index: 0; }
.book3d .cover::after { z-index: 1; }
.book3d .cover::before { z-index: 2; }
.book3d .cover-text, .book3d .cover-imprint { z-index: 3; transform: translateZ(0); }

/* Standard view: spine toward the reader */
.book3d-inner { transform: rotateY(14deg); transform-origin: 60% 50%; }
.book3d .cover { box-shadow: 0 0 0 1px #1a1a1a, -18px 24px 40px rgba(0,0,0,.7); }
.book3d-pages {
  left: auto; right: 100%; width: 58px;
  transform-origin: right center; transform: rotateY(-90deg);
  background:
    linear-gradient(to right, rgba(0,0,0,.35), rgba(255,255,255,.12) 30%, rgba(255,255,255,.04) 60%, rgba(0,0,0,.4)),
    #2b2925;
  box-shadow: inset 0 0 0 1px #111;
  display: flex; align-items: center; justify-content: center;
}
.book3d-pages::after {
  content: "SOLID";
  writing-mode: vertical-rl;
  font-family: 'Cinzel', serif; font-size: 16px; letter-spacing: .35em;
  color: #c9a84c;
}
@media (max-width: 480px) { .book3d-pages { width: 42px; } .book3d-pages::after { font-size: 12px; } }

/* Bring out the inscription (~20%): more contrast in the photo, lighter shade at the top */
.book3d .cover-img { filter: grayscale(100%) contrast(1.26) brightness(1.06); }
.book3d .cover::after { background: linear-gradient(to bottom, rgba(0,0,0,.08) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0) 45%, rgba(0,0,0,.8) 72%, #000 100%); }
.book3d { perspective: 2400px; perspective-origin: 0% 50%; }
