/* ==========================================================
   Biblioteca de e-books
   ========================================================== */
.pagina-ebooks { background: var(--paper); }
.pagina-ebooks .site-header { background: var(--graphite); }
.eb-hero { background: var(--graphite); color: #fff; padding: 170px 0 70px; position: relative; overflow: hidden; }
.eb-hero::after { content: ""; position: absolute; right: -8%; top: -30%; width: 60vw; height: 160%; background: radial-gradient(closest-side, rgba(220,182,81,.16), transparent); pointer-events: none; }
.eb-hero .eyebrow { color: var(--gold-light); display: inline-flex; align-items: center; gap: 12px; }
.eb-hero .eyebrow::before { content: ""; width: 34px; height: 1px; background: currentColor; }
.eb-hero h1 { color: #fff; font-family: var(--serif); font-weight: 500; font-size: clamp(2.4rem, 5vw, 4.2rem); line-height: 1.04; margin: 0 0 .4em; max-width: 820px; text-wrap: balance; }
.eb-hero h1 em { color: var(--gold-light); }
.eb-hero .lead { color: rgba(255,255,255,.74); max-width: 640px; }

.eb-biblioteca { padding: 56px 0 110px; }
.eb-filtros { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 56px; }
.eb-filtros button { font: inherit; font-size: .8rem; letter-spacing: .04em; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--heading); cursor: pointer; transition: background .3s, color .3s, border-color .3s; }
.eb-filtros button small { color: var(--text-muted); margin-left: 4px; }
.eb-filtros button:hover { border-color: var(--gold); }
.eb-filtros button.is-on { background: var(--graphite); border-color: var(--graphite); color: #fff; }
.eb-filtros button.is-on small { color: var(--gold-light); }

.eb-estante { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 64px 40px; }
.eb-item { text-align: center; opacity: 0; transform: translateY(26px); transition: opacity .8s ease, transform 1s var(--ease); transition-delay: calc(min(var(--i, 0), 12) * 60ms); }
.eb-item.is-entrou { opacity: 1; transform: none; }
.eb-item[hidden] { display: none; }

/* ---------- o livro: capa real, lombada colorida e bloco de folhas ---------- */
.eb-livro { --w: 168px; --h: 238px; --esp: 40px; --ry: 30deg; --rx: 0deg;
  position: relative; display: block; width: var(--w); height: var(--h); margin: 0 auto 26px; padding: 0; border: 0; background: none; cursor: pointer; perspective: 1100px; }
.eb-3d { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(var(--rx)) rotateY(var(--ry)); transition: transform .7s var(--ease); }
.eb-livro:hover .eb-3d, .eb-livro:focus-visible .eb-3d { --ry: 16deg; transform: rotateX(var(--rx)) rotateY(var(--ry)) translateZ(10px); }
.eb-capa, .eb-verso, .eb-lombada, .eb-folhas { position: absolute; display: block; }
.eb-capa { inset: 0; transform: translateZ(calc(var(--esp) / 2)); border-radius: 2px 5px 5px 2px; overflow: hidden; background: #fff;
  box-shadow: inset 4px 0 6px -2px rgba(0,0,0,.25); }
.eb-capa img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* brilho e vinco da capa dura */
.eb-capa::after { content: ""; position: absolute; inset: 0; background:
  linear-gradient(90deg, rgba(0,0,0,.28) 0, rgba(255,255,255,.18) 3%, rgba(0,0,0,.06) 5%, transparent 9%),
  linear-gradient(115deg, rgba(255,255,255,.22), transparent 35%, transparent 70%, rgba(0,0,0,.08)); pointer-events: none; }
.eb-verso { inset: 0; transform: translateZ(calc(var(--esp) / -2)) rotateY(180deg); background: var(--cor); border-radius: 5px 2px 2px 5px; }
.eb-lombada { left: 0; top: 0; width: var(--esp); height: 100%; transform-origin: left center; transform: translateZ(calc(var(--esp) / -2)) rotateY(-90deg);
  background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(255,255,255,.12) 30%, rgba(0,0,0,.05) 55%, rgba(0,0,0,.4)), var(--cor);
  display: flex; align-items: center; justify-content: center; overflow: hidden; }
.eb-lombada i { font-style: normal; writing-mode: vertical-rl; transform: rotate(180deg); color: rgba(255,255,255,.88); font-family: var(--serif); font-size: .8rem; letter-spacing: .04em; white-space: nowrap; max-height: 88%; overflow: hidden; text-overflow: ellipsis; }
.eb-lombada::before, .eb-lombada::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: rgba(226,196,126,.8); }
.eb-lombada::before { top: 14px; } .eb-lombada::after { bottom: 14px; }
.eb-folhas { right: 0; top: 4px; width: var(--esp); height: calc(100% - 8px); transform-origin: right center; transform: translateZ(calc(var(--esp) / -2)) rotateY(90deg);
  background: repeating-linear-gradient(90deg, #f4efe4 0 2px, #ddd5c4 2px 3px); box-shadow: inset 0 0 10px rgba(0,0,0,.18); }
.eb-sombra { position: absolute; left: -10%; right: 4%; bottom: -16px; height: 22px; background: radial-gradient(closest-side, rgba(30,34,39,.38), transparent); filter: blur(4px); transition: transform .7s var(--ease), opacity .7s; }
.eb-livro:hover .eb-sombra { transform: scale(1.08) translateY(4px); opacity: .7; }
.eb-livro:focus-visible { outline: none; }
.eb-livro:focus-visible .eb-capa { outline: 2px solid var(--gold); outline-offset: 4px; }

.eb-grupo { margin: 0 0 6px; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-dark); font-weight: 600; }
.eb-nome { font-family: var(--serif); font-weight: 500; font-size: 1.32rem; line-height: 1.15; color: var(--heading); margin: 0 auto 14px; max-width: 230px; text-wrap: balance; }
.eb-baixar { font: inherit; display: inline-flex; gap: 8px; align-items: center; padding: 10px 20px; background: transparent; border: 1px solid var(--heading); color: var(--heading); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; cursor: pointer; transition: background .3s, color .3s, border-color .3s; }
.eb-baixar:hover, .eb-baixar:focus-visible { background: var(--gold); border-color: var(--gold); color: #16181b; }
.eb-aviso { margin: 80px 0 0; font-size: .8rem; color: var(--text-muted); text-align: center; }

/* ---------- janela de download ---------- */
body.eb-travado { overflow: hidden; }
.eb-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.eb-modal[hidden] { display: none; }
.eb-modal-fundo { position: absolute; inset: 0; background: rgba(15,16,18,.72); backdrop-filter: blur(4px); opacity: 0; transition: opacity .3s; }
.eb-modal-caixa { position: relative; width: min(820px, 100%); max-height: calc(100svh - 40px); overflow: auto; background: var(--paper); display: grid; grid-template-columns: 250px 1fr; opacity: 0; transform: translateY(20px) scale(.98); transition: opacity .3s, transform .45s var(--ease); }
.eb-modal.is-aberto .eb-modal-fundo, .eb-modal.is-aberto .eb-modal-caixa { opacity: 1; transform: none; }
.eb-modal-livro { background: var(--graphite); display: grid; place-items: center; padding: 34px 24px; }
.eb-modal-livro img { width: 100%; max-width: 190px; box-shadow: 0 24px 40px rgba(0,0,0,.45), -6px 0 0 -2px rgba(0,0,0,.4); transform: perspective(900px) rotateY(-12deg); }
.eb-form, .eb-ok { padding: 38px 38px 30px; }
.eb-form h2, .eb-ok h2 { font-family: var(--serif); font-weight: 500; font-size: 1.9rem; line-height: 1.1; margin: 0 0 22px; }
.eb-fechar { position: absolute; right: 12px; top: 8px; z-index: 2; width: 38px; height: 38px; font-size: 1.6rem; line-height: 1; background: none; border: 0; color: var(--text-muted); cursor: pointer; }
.eb-fechar:hover { color: var(--heading); }
.eb-campo { display: block; margin-bottom: 16px; }
.eb-campo span { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.eb-campo small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.eb-campo input { width: 100%; font: inherit; padding: 13px 14px; border: 1px solid var(--line); background: #fff; color: var(--heading); }
.eb-campo input:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.eb-perfil { border: 0; padding: 0; margin: 4px 0 18px; }
.eb-perfil legend { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; font-weight: 600; }
.eb-perfil label { display: inline-block; margin: 0 6px 8px 0; cursor: pointer; }
.eb-perfil input { position: absolute; opacity: 0; pointer-events: none; }
.eb-perfil span { display: inline-block; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; color: var(--heading); background: #fff; transition: background .25s, color .25s, border-color .25s; }
.eb-perfil label:hover span { border-color: var(--gold); }
.eb-perfil input:checked + span { background: var(--graphite); border-color: var(--graphite); color: #fff; }
.eb-perfil input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.eb-consent { display: flex; gap: 12px; align-items: flex-start; font-size: .8rem; line-height: 1.5; color: var(--text-muted); margin-bottom: 18px; cursor: pointer; }
.eb-consent input { flex: none; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--gold-dark); }
.eb-erro { margin: 0 0 14px; padding: 10px 12px; background: #fbeeee; color: #8a2a2a; font-size: .84rem; border-left: 3px solid #b23b3b; }
.eb-priv { margin: 14px 0 0; font-size: .72rem; color: var(--text-muted); }
.eb-ok p { color: var(--text-muted); }
.eb-ok a { color: var(--gold-dark); border-bottom: 1px solid var(--gold); }
.btn-ghost-escuro { border: 1px solid var(--heading); color: var(--heading); margin-top: 18px; }
.btn-ghost-escuro::before { background: var(--heading); }
.btn-ghost-escuro:hover { color: #fff; }

@media (max-width: 760px) {
  .eb-hero { padding: 130px 0 48px; }
  .eb-filtros { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px 40px; padding: 0 20px 6px; scrollbar-width: none; }
  .eb-filtros::-webkit-scrollbar { display: none; }
  .eb-filtros button { flex: none; }
  .eb-estante { grid-template-columns: repeat(2, 1fr); gap: 44px 16px; }
  .eb-livro { --w: 128px; --h: 181px; }
  .eb-nome { font-size: 1.08rem; }
  .eb-baixar { padding: 9px 14px; font-size: .68rem; }
  .eb-modal { padding: 0; place-items: end stretch; }
  .eb-modal-caixa { grid-template-columns: 1fr; max-height: 92svh; width: 100%; }
  .eb-modal-livro { display: none; }
  .eb-form, .eb-ok { padding: 30px 22px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .eb-item { opacity: 1; transform: none; transition: none; }
  .eb-3d, .eb-modal-caixa, .eb-modal-fundo { transition: none; }
}

/* ---------- vitrine na página inicial ---------- */
.eb-vitrine { background: var(--cream); }
.eb-vitrine-estante { display: grid; grid-template-columns: repeat(5, 1fr); gap: 30px; align-items: start; margin-top: 10px; }
.eb-vitrine-item { display: block; text-align: center; opacity: 1; transform: none; }
.eb-vitrine-item .eb-nome { display: block; font-size: 1.12rem; }
.eb-vitrine-item:hover .eb-3d { --ry: 16deg; transform: rotateX(0deg) rotateY(var(--ry)) translateZ(10px); }
.eb-vitrine-acao { text-align: center; margin-top: 46px; }
@media (max-width: 900px) {
  .eb-vitrine-estante { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 22px; margin: 0 -20px; padding: 10px 20px 14px; scrollbar-width: none; }
  .eb-vitrine-estante::-webkit-scrollbar { display: none; }
  .eb-vitrine-item { flex: 0 0 46%; scroll-snap-align: start; }
  .eb-vitrine-item .eb-livro { --w: 128px; --h: 181px; }
}

/* ---------- páginas de texto (política de privacidade) ---------- */
.texto-legal { max-width: 820px; padding-top: 64px; padding-bottom: 110px; }
.texto-legal h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 2.2em 0 .6em; }
.texto-legal h2:first-child { margin-top: 0; }
.texto-legal h3 { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; margin: 1.6em 0 .4em; color: var(--heading); }
.texto-legal p, .texto-legal li { color: var(--text); line-height: 1.75; }
.texto-legal ul { list-style: disc; padding-left: 1.3em; margin: 0 0 1em; }
.texto-legal li { margin-bottom: .4em; }
.texto-legal a { color: var(--gold-dark); border-bottom: 1px solid var(--gold); }
.eb-desc { margin: -6px auto 14px; max-width: 240px; font-size: .84rem; line-height: 1.45; color: var(--text-muted); }
