/* Aba History (site/history.py). Cores da marca: Rebirth Branding/ (vinho #681C28, vermelho #A02E32, dourado
   #C6A05A, carvão #22201F, pergaminho #E8D8B6). */

/* ---------- lista de capítulos (/history) ---------- */
.hist-cover { text-align: center; margin-bottom: 1.2rem; }
.hist-emblem { width: 72px; height: auto; filter: drop-shadow(0 0 8px rgba(198, 160, 90, .45)); }
.hist-book { font-family: inherit; letter-spacing: .04em; color: #681C28; margin: .3rem 0 .1rem; }
.hist-narrator { font-style: italic; opacity: .8; margin: 0 0 .6rem; }

.hist-chapters { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.hist-chapter { display: grid; grid-template-columns: 7.5rem 1fr auto; align-items: center; gap: .2rem .8rem;
  padding: .55rem .8rem; border: 1px solid rgba(104, 28, 40, .35); border-left: 4px solid #A02E32;
  background: rgba(255, 248, 230, .45); }
.hist-chapter small { grid-column: 2 / -1; }
.hist-chapter.sealed { border-left-color: #4A3326; opacity: .72; }
.hist-num { text-transform: uppercase; font-size: .78rem; letter-spacing: .08em; color: #4A3326; }
.hist-title { font-weight: bold; font-size: 1.05rem; }
.hist-read, .hist-seal { font-size: .85rem; padding: .2rem .6rem; border-radius: 3px; white-space: nowrap; }
.hist-read { background: #A02E32; color: #fff !important; text-decoration: none; }
.hist-seal { border: 1px dashed #4A3326; color: #4A3326; }

/* ---------- a mesa de leitura (/history/<capítulo>/<página>, docs/planos/livro-leitor.md) ---------- */
html.book-open, html.book-open body, body:has(.book-stage) { overflow: hidden; }

.book-stage { position: fixed; inset: 0; z-index: 1000; display: grid; grid-template-rows: auto 1fr auto;
  color: #E8D8B6; font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(160, 46, 50, .28), transparent 70%),
    radial-gradient(ellipse at 50% 120%, rgba(198, 120, 40, .25), transparent 55%),
    radial-gradient(ellipse at center, #2c1a1c 0%, #1a1312 60%, #0e0b0a 100%); }
/* brasas subindo da mesa (só enfeite) */
.book-stage::before, .book-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(2px 2px at 12% 90%, #f0a24a, transparent), radial-gradient(1.5px 1.5px at 30% 80%, #C6A05A, transparent),
    radial-gradient(2px 2px at 55% 95%, #e0703a, transparent), radial-gradient(1.5px 1.5px at 72% 85%, #C6A05A, transparent),
    radial-gradient(2px 2px at 88% 92%, #f0a24a, transparent), radial-gradient(1px 1px at 44% 70%, #e8c27a, transparent);
  animation: book-embers 14s linear infinite; opacity: .55; }
.book-stage::after { animation-duration: 21s; animation-delay: -7s; transform: scaleX(-1); opacity: .35; }
@keyframes book-embers { from { transform: translateY(0); opacity: 0; } 15% { opacity: .6; } to { transform: translateY(-85vh); opacity: 0; } }

.book-bar { position: relative; z-index: 1; display: flex; align-items: center; gap: .8rem; padding: .55rem 1.2rem;
  border-bottom: 1px solid rgba(198, 160, 90, .35); background: linear-gradient(#1a1211ee, #1a121199); }
.book-close { font-size: 1.9rem; line-height: 1; color: #C6A05A !important; text-decoration: none; padding: 0 .3rem; }
.book-close:hover { color: #f3d58f !important; }
.book-emblem { width: 38px; height: auto; filter: drop-shadow(0 0 6px rgba(198, 160, 90, .5)); }
.book-titles { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.book-name { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: #C6A05A; }
.book-chapter { font-size: 1.1rem; color: #f1e3c4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-num { color: #c98a6a; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin-right: .3rem; }
.book-langs { margin-left: auto; display: flex; gap: .2rem; }
.book-lang { font: inherit; font-size: .68rem; letter-spacing: .08em; padding: .12rem .35rem; cursor: pointer;
  color: #cdb98f; background: transparent; border: 1px solid #C6A05A44; border-radius: 3px; }
.book-lang.selected, .book-lang:hover { color: #1a1211; background: #C6A05A; }
.book-count { font-size: .85rem; color: #cdb98f; white-space: nowrap; }
.book-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.book-desk { position: relative; z-index: 1; display: grid; grid-template-columns: 4rem minmax(0, 1fr) 4rem;
  align-items: center; padding: 1.2rem .6rem; min-height: 0; }
.book-arrow { display: flex; align-items: center; justify-content: center; height: 100%; max-height: 60vh;
  font-size: 3.4rem; color: rgba(198, 160, 90, .55) !important; text-decoration: none; transition: color .15s, transform .15s; }
.book-arrow:hover { color: #f3d58f !important; transform: scale(1.12); }

/* o livro aberto: duas folhas de pergaminho e a lombada no meio */
.book { position: relative; margin: 0 auto; width: min(100%, 1240px, calc((100vh - 170px) * 1.75));
  height: min(calc(100vh - 170px), 760px); display: grid; grid-template-columns: 1fr 1fr;
  padding: 14px; border-radius: 6px;
  background: linear-gradient(90deg, #4a1a20, #681C28 6%, #681C28 94%, #4a1a20); /* capa vinho por trás das folhas */
  box-shadow: 0 30px 60px rgba(0, 0, 0, .65), 0 0 0 1px #C6A05A55, inset 0 0 0 2px #2a0d11;
  perspective: 2000px; }
.book::after { content: ""; position: absolute; top: 14px; bottom: 14px; left: 50%; width: 46px; transform: translateX(-50%);
  pointer-events: none; background: linear-gradient(90deg, transparent, rgba(60, 35, 20, .28) 40%, rgba(40, 22, 12, .45) 50%, rgba(60, 35, 20, .28) 60%, transparent); }
.book-leaf { position: relative; min-height: 0; overflow: auto; color: #2b1d14; scrollbar-width: thin;
  background: radial-gradient(ellipse at 50% 40%, #f3e6c8 0%, #E8D8B6 55%, #d9c49b 100%); }
.book-leaf:first-child { border-radius: 4px 0 0 4px; box-shadow: inset -18px 0 30px -18px rgba(70, 40, 20, .5); }
.book-leaf:last-child { border-radius: 0 4px 4px 0; box-shadow: inset 18px 0 30px -18px rgba(70, 40, 20, .5); }
.book-folio { position: sticky; top: 100%; display: block; text-align: center; font-size: .78rem; color: #8a6d4a;
  padding: .3rem 0 .45rem; }

/* folha da arte */
.book-art { padding: 1.4rem 1.6rem .2rem 1.4rem; display: grid; gap: .8rem; align-content: start;
  grid-template-columns: repeat(2, minmax(0, 1fr)); }
.book-art.layout-splash, .book-art.panels-1 { grid-template-columns: 1fr; align-content: center; }
.book-art.panels-3 .book-figure:first-child, .book-art.panels-5 .book-figure:first-child { grid-column: 1 / -1; }
.book-figure { position: relative; margin: 0; border: 2px solid #3a2416; box-shadow: 0 0 0 4px #C6A05A33, 0 6px 14px rgba(40, 20, 10, .35);
  background: #22201F; }
.book-figure img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.layout-splash .book-figure img, .panels-1 .book-figure img { aspect-ratio: auto; object-fit: contain;
  max-height: calc(100vh - 260px); }
.book-placeholder { min-height: 150px; height: 100%; display: flex; flex-direction: column; justify-content: center;
  padding: 1rem 1.1rem; text-align: center; color: #5a4632;
  background: repeating-linear-gradient(135deg, #efe2c4 0 6px, #e6d6b2 6px 12px); }
.layout-splash .book-placeholder, .panels-1 .book-placeholder { min-height: 380px; }
.book-ph-tag { align-self: center; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
  color: #f3e6c8; background: #681C28; padding: .12rem .55rem; margin-bottom: .55rem; }
.book-placeholder p { margin: 0; font-style: italic; font-size: .95rem; }
.book-mark { position: absolute; top: -.55rem; left: -.55rem; width: 1.45rem; height: 1.45rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: bold;
  color: #f3e6c8; background: #A02E32; border: 1px solid #C6A05A; }

/* folha do texto */
.book-text { padding: 2rem 2.2rem .2rem 2.6rem; display: flex; flex-direction: column; gap: 1.05rem; }
.book-passage { position: relative; display: flex; flex-direction: column; gap: .55rem; padding-left: .2rem; }
.book-passage .book-mark { position: absolute; top: .05rem; left: -1.75rem; }
.book-line { margin: 0; font-size: 1.14rem; line-height: 1.6; }
.book-line.narration .say { display: block; } /* ::first-letter (a capitular) só vale em bloco */
.book-line.narration .say { font-style: italic; }
.book-text .book-passage:first-child .book-line.narration:first-of-type .say::first-letter {
  float: left; font-size: 3.1rem; line-height: .9; padding: .2rem .45rem 0 0; color: #A02E32; font-style: normal;
  font-weight: bold; text-shadow: 1px 1px 0 #C6A05A; }
.book-line.speech .say::before { content: "\201C"; color: #A02E32; }
.book-line.speech .say::after { content: "\201D"; color: #A02E32; }
.book-line .who { display: block; font-size: .74rem; font-variant: small-caps; letter-spacing: .12em; text-transform: uppercase;
  color: #A02E32; font-weight: bold; margin-bottom: .05rem; }
.book-line.whisper .say { font-style: italic; color: #6b5a4a; letter-spacing: .02em; }
.book-line.whisper .who { color: #6b5a4a; }
.book-line.sfx { font-weight: 900; font-size: 1.6rem; letter-spacing: .14em; color: #A02E32; text-shadow: 2px 2px 0 #C6A05A66;
  transform: rotate(-2deg); align-self: flex-start; font-family: Impact, "Arial Black", sans-serif; }

.book-nav { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .5rem 1.4rem .8rem; }
.book-nav small { color: #a99572; }
.book-btn { padding: .4rem .95rem; border: 1px solid #C6A05A88; color: #f1e3c4 !important; text-decoration: none;
  border-radius: 3px; background: #2a1a18; }
.book-btn-main { background: #681C28; border-color: #C6A05A; }
.book-btn:hover { background: #A02E32; }

/* virar a folha (o history.js põe turn-next/turn-prev na troca) */
.book.turn-next .book-leaf:last-child, .book.turn-next .book-leaf:first-child { animation: book-in-next .38s ease-out; }
.book.turn-prev .book-leaf:first-child, .book.turn-prev .book-leaf:last-child { animation: book-in-prev .38s ease-out; }
.book.turn-next .book-leaf:last-child { transform-origin: left center; }
.book.turn-prev .book-leaf:first-child { transform-origin: right center; }
@keyframes book-in-next { from { opacity: .25; transform: rotateY(-14deg) translateX(10px); } to { opacity: 1; transform: none; } }
@keyframes book-in-prev { from { opacity: .25; transform: rotateY(14deg) translateX(-10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .book-stage::before, .book-stage::after { animation: none; display: none; }
  .book.turn-next .book-leaf, .book.turn-prev .book-leaf { animation: none; }
}

/* celular e tela estreita: uma folha só, arte em cima e texto embaixo, rolando dentro do livro */
@media (max-width: 900px) {
  .book-desk { grid-template-columns: 1fr; padding: .5rem; }
  .book-arrow { display: none; }
  .book { width: 100%; height: calc(100vh - 130px); height: calc(100dvh - 130px); grid-template-columns: 1fr;
    padding: 8px; overflow: auto; display: block; }
  .book::after { display: none; }
  .book-leaf { overflow: visible; border-radius: 4px !important; box-shadow: none !important; }
  .book-art { padding: 1rem 1rem .2rem; }
  .book-text { padding: 1rem 1.2rem .4rem 2rem; }
  .book-folio { position: static; }
  .book-bar { padding: .45rem .7rem; }
  .book-count { font-size: .75rem; }
  .book-name, .book-num { display: none; }
  .book-lang { padding: .1rem .25rem; }
  .book-nav small { display: none; }
  .layout-splash .book-placeholder, .panels-1 .book-placeholder { min-height: 220px; }
}
