body {
  background: #e9d8b4;
}

.masthead { background: var(--paper); }
.reader { max-width: 1130px; margin: auto; padding: clamp(1rem, 4vw, 3rem) 1rem 3rem; }
.binding {
  display: grid;
  grid-template-columns: minmax(245px, 40%) minmax(0, 1fr);
  align-items: stretch;
  background: #fffaeb;
  border: 1px solid #887750;
  border-radius: 8px 12px 12px 8px;
  box-shadow: 0 4px #f9eed2, 0 5px #b3a681, 0 8px #f9eed2, 0 9px #b3a681, 0 20px 36px #392c252b;
  overflow: hidden;
}

.cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
  min-height: 550px;
  padding: clamp(1.3rem, 4vw, 3rem);
  color: #fff6df;
  background: #0f3f35 url("assets/capa-livro.webp") center 52% / cover no-repeat;
  border-left: 8px solid #15372e;
}

.cover::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, #082e27 0%, #082e27df 13%, #082e2755 44%, transparent 58%, #082e27e8 100%);
}

.cover h1 { font-size: clamp(2.8rem, 5.6vw, 5.3rem); line-height: .92; }
.cover .eyebrow { color: #ffe19a; margin-bottom: 1.1rem; }
.cover-caption { width: fit-content; max-width: 24ch; margin: 2rem 0 0; padding-top: .65rem; border-top: 1px solid #ffe19a; }
.chapters { min-width: 0; }
.toc { padding: clamp(1.5rem, 5vw, 4rem); }
.toc h2 { font-size: clamp(2rem, 5vw, 3.7rem); }
.toc ol { list-style: none; padding: 0; margin: 1.4rem 0; counter-reset: chapter; }
.toc li { counter-increment: chapter; }
.toc li a { display: flex; align-items: center; gap: .8rem; min-height: 48px; padding: .6rem 0; border-bottom: 1px solid #b7a882; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.toc li a::before { content: counter(chapter, decimal-leading-zero); color: var(--rust); font-size: .75rem; font-weight: 850; letter-spacing: .1em; }
.toc li a[aria-current="page"] { font-weight: 850; }
.toc-cover { display: inline-flex; align-items: center; min-height: 44px; font-weight: 850; }
.cover-open .toc-cover { display: none; }
.cover-open article { display: none; }
.reading .binding { display: block; }
.reading .chapters { display: grid; grid-template-columns: minmax(195px, 29%) minmax(0, 1fr); min-height: 500px; }
.reading .toc {
  padding: clamp(1.25rem, 4vw, 2.5rem);
  background: linear-gradient(90deg, #faf0d9 0%, #f8edd5 94%, #dbcca9 100%);
}
.reading .toc h2 { font-size: 2rem; }
article { padding: clamp(1.5rem, 5vw, 4.1rem); min-width: 0; }
article section { max-width: 65ch; }
article section + section { margin-top: 2rem; }
article h2 { font-size: clamp(2.15rem, 5vw, 3.8rem); text-wrap: balance; margin: .5rem 0 1.2rem; }
article p { font: 1.12rem/1.64 Georgia, serif; }
article p.eyebrow { font: 850 .76rem/1.55 Nunito, sans-serif; }
article a { color: #215845; font-weight: 850; text-underline-offset: .18em; overflow-wrap: anywhere; }
article .alert { background: #f9e4b4; border-left: 5px solid var(--rust); padding: .85rem 1rem; }
.channels { padding: 0; list-style: none; }
.channels li { padding: .8rem 0; border-bottom: 1px solid #b7a882; }
.pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .45rem; margin: 1.55rem 0 0; }
.pagination a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 850; text-underline-offset: .2em; }
.next { justify-self: end; }
.folio { padding: .25rem .6rem; border: 1px solid #887750; border-radius: 3px; font-size: .8rem; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.pagination [hidden] { display: inline-flex !important; visibility: hidden; }
.turn { animation: turn-in .24s cubic-bezier(.23, 1, .32, 1) both; }
@keyframes turn-in {
  from { transform: translateX(9px); opacity: .45; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 690px) {
  .binding, .reading .chapters { display: block; }
  .cover { min-height: clamp(440px, 116vw, 550px); background-position: center; }
  .cover h1 { font-size: clamp(2.8rem, 11vw, 4.6rem); }
  .reading .toc { background: #f4e8cd; padding: 1rem; }
  .reading .toc h2, .reading .toc .eyebrow { display: none; }
  .reading .toc ol { display: flex; flex-wrap: wrap; gap: .25rem; margin: 0; }
  .reading .toc li a { width: 44px; justify-content: center; border: 1px solid #9b825a; border-radius: 4px; font-size: 0; gap: 0; text-decoration: none; }
  .reading .toc li a[aria-current="page"] { background: var(--leaf); }
  .reading .toc li a[aria-current="page"]::before { color: white; }
  .reading .toc-cover { font-size: .85rem; min-height: 44px; }
  article { padding: 1.35rem 1rem 1.8rem; }
  .pagination a { font-size: .85rem; }
}

@media print {
  .masthead, .toc, .pagination { display: none !important; }
  .reader { padding: 0; }
  .binding, .chapters, article, article section[hidden], .cover[hidden] { display: block !important; box-shadow: none; border: 0; }
  .cover { break-after: page; print-color-adjust: exact; }
  article section { break-inside: avoid; }
}
