/* Leitor da revista — visual no padrão do FlipHTML5 (topo escuro, palco cinza,
   setas laterais, ferramentas embaixo), sem propaganda. */
:root {
  --topo: #1f2023;
  --palco: #595c61;
  --barra: #2b2d31;
  --icone: #e8eaed;
  --icone-fraco: #8d9298;
  --destaque: #3a9be0;
  --alt-topo: 52px;
  --alt-barra: 52px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body.leitor {
  height: 100dvh; overflow: hidden; background: var(--palco); color: var(--icone);
  display: grid; grid-template-rows: var(--alt-topo) 1fr calc(var(--alt-barra) + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:disabled { cursor: default; }
svg { display: block; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- topo ---------- */
.barra-topo { background: var(--topo); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 12px 0 16px; z-index: 20; }
.barra-topo__marca { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.barra-topo__marca svg { width: 26px; height: 26px; flex: none; fill: none; stroke: #fff; stroke-width: 1.6; stroke-linejoin: round; }
.barra-topo__marca > span { display: grid; min-width: 0; line-height: 1.2; }
.barra-topo__marca b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-topo__titulo { font-size: .78rem; color: #b9bdc3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.busca { position: relative; display: flex; width: min(290px, 42vw); flex: none; }
.busca input { width: 100%; height: 32px; border: 0; border-radius: 3px 0 0 3px; padding: 0 10px; background: #3a3c41; color: #fff; font: inherit; font-size: .88rem; }
.busca input::placeholder { color: #9aa0a6; }
.busca input:focus { outline: 2px solid var(--destaque); outline-offset: -2px; }
.busca > button { width: 36px; height: 32px; background: #3a3c41; border-radius: 0 3px 3px 0; display: grid; place-items: center; }
.busca > button svg { width: 18px; height: 18px; fill: none; stroke: #cfd3d8; stroke-width: 2; stroke-linecap: round; }
.busca__resultados {
  position: absolute; top: calc(100% + 6px); right: 0; width: min(380px, 92vw); max-height: 60vh; overflow: auto;
  list-style: none; margin: 0; padding: 6px; background: #fff; color: #222; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.busca__resultados button { display: grid; gap: 2px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 4px; font-size: .86rem; line-height: 1.35; }
.busca__resultados button:hover, .busca__resultados button:focus-visible { background: #eef5fc; }
.busca__resultados b { color: var(--destaque); font-size: .78rem; }
.busca__resultados mark { background: #ffe58a; color: inherit; padding: 0 1px; }
.busca__nada { padding: 10px; color: #666; font-size: .88rem; }

/* ---------- palco ---------- */
/* linha fixa: sem ela, as páginas ainda empilhadas (antes do StPageFlip montar) esticam a área */
.palco { position: relative; min-height: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; grid-template-rows: minmax(0, 1fr); align-items: center; }
.seta--ant { grid-column: 1; grid-row: 1; }
.seta--prox { grid-column: 3; grid-row: 1; }
.livro-area { grid-column: 2; grid-row: 1; position: relative; width: 100%; height: 100%; padding: 28px 0; min-width: 0; overflow: hidden; }
.livro:not(.stf__parent) .pagina { display: none; }
.livro { width: 100% !important; height: 100% !important; min-width: 0 !important; min-height: 0 !important; opacity: 0; transition: opacity .35s; }
.pronto .livro { opacity: 1; }
.livro .stf__wrapper { height: 100%; }
.pagina { background: #fff; overflow: hidden; }
.pagina img { width: 100%; height: 100%; object-fit: fill; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.carregando { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #d6d9dd; pointer-events: none; transition: opacity .3s; }
.pronto .carregando { opacity: 0; }

.seta { height: 120px; display: grid; place-items: center; opacity: .85; transition: opacity .2s; z-index: 5; }
.seta svg { width: 26px; height: 52px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.seta:hover { opacity: 1; }
.seta:disabled { opacity: 0; pointer-events: none; }

/* ---------- ferramentas ---------- */
.ferramentas {
  background: var(--barra); display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 10px env(safe-area-inset-bottom); z-index: 20;
}
.ferramentas__grupo { display: flex; align-items: center; gap: 4px; flex: 1; }
.ferramentas__grupo:last-child { justify-content: flex-end; }
.ferramentas__navegar { justify-content: center; flex: none; gap: 6px; }
.ferramentas button, .ferramentas a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 4px; color: var(--icone); }
.ferramentas button:hover:not(:disabled), .ferramentas a:hover { background: rgba(255,255,255,.08); }
.ferramentas button:disabled { color: var(--icone-fraco); opacity: .5; }
.ferramentas svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.contador { display: flex; align-items: center; height: 32px; background: #fff; color: #222; border-radius: 2px; padding: 0 10px 0 4px; font-size: .9rem; }
.contador input { width: 4.2ch; border: 0; text-align: right; font: inherit; color: inherit; background: transparent; padding: 0; }
.contador input:focus { outline: none; }
.contador:focus-within { outline: 2px solid var(--destaque); }
:focus-visible { outline: 2px solid var(--destaque); outline-offset: 2px; }

/* ---------- miniaturas ---------- */
.miniaturas {
  position: fixed; left: 0; top: var(--alt-topo); bottom: calc(var(--alt-barra) + env(safe-area-inset-bottom)); width: 300px; z-index: 30;
  background: rgba(31,32,35,.97); display: flex; flex-direction: column; box-shadow: 4px 0 20px rgba(0,0,0,.3);
}
.miniaturas__topo { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #3a3c41; }
.miniaturas__topo button { font-size: 1.6rem; line-height: 1; width: 32px; height: 32px; }
.miniaturas__lista { list-style: none; margin: 0; padding: 14px; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; align-content: start; }
.miniaturas__lista button { display: grid; gap: 6px; justify-items: center; font-size: .8rem; color: #c8ccd1; width: 100%; }
.miniaturas__lista img { width: 100%; height: auto; background: #fff; outline: 3px solid transparent; transition: outline-color .15s; }
.miniaturas__lista button:hover img { outline-color: rgba(255,255,255,.35); }
.miniaturas__lista button.ativa img { outline-color: var(--destaque); }
.miniaturas__lista button.ativa span { color: #fff; font-weight: 600; }

/* ---------- janela compartilhar ---------- */
.janela { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; }
.janela__caixa { position: relative; width: min(440px, 100%); background: #fff; color: #222; border-radius: 8px; padding: 24px; display: grid; gap: 14px; }
.janela__caixa h2 { margin: 0; font-size: 1.15rem; }
.janela__fechar { position: absolute; top: 8px; right: 10px; font-size: 1.6rem; width: 36px; height: 36px; color: #666; }
.compartilhar__link { display: flex; }
.compartilhar__link input { flex: 1; min-width: 0; border: 1px solid #ccd2d9; border-right: 0; border-radius: 4px 0 0 4px; padding: 8px 10px; font: inherit; font-size: .88rem; }
.compartilhar__link button { background: var(--destaque); color: #fff; padding: 0 16px; border-radius: 0 4px 4px 0; font-weight: 600; }
.compartilhar__pagina { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.compartilhar__redes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.compartilhar__redes a { text-align: center; padding: 10px; border-radius: 4px; color: #fff; text-decoration: none; font-weight: 600; font-size: .9rem; }
#rede-whatsapp { background: #1fa855; }
#rede-facebook { background: #1877f2; }
#rede-email { background: #5f6368; }

/* ---------- zoom ---------- */
.zoom { position: fixed; inset: 0 0 calc(var(--alt-barra) + env(safe-area-inset-bottom)); z-index: 40; background: #3d4044; overflow: auto; cursor: grab; touch-action: pan-x pan-y pinch-zoom; }
.zoom.arrastando { cursor: grabbing; }
.zoom__conteudo { --altura: 1000px; display: flex; justify-content: center; width: max-content; min-width: 100%; padding: 20px; }
.zoom__conteudo img { height: var(--altura); width: auto; display: block; background: #fff; box-shadow: 0 4px 20px rgba(0,0,0,.4); user-select: none; }
.zoom__controles { position: fixed; top: 12px; right: 16px; display: flex; gap: 6px; z-index: 41; }
.zoom__controles button { width: 44px; height: 44px; border-radius: 50%; background: rgba(20,20,22,.85); color: #fff; font-size: 1.5rem; line-height: 1; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.zoom__controles button:disabled { opacity: .4; }

.sem-js { display: grid; gap: 16px; justify-items: center; padding: 16px; overflow: auto; position: fixed; inset: var(--alt-topo) 0 0; background: var(--palco); }
.sem-js img { max-width: 100%; height: auto; }

/* ---------- celular ---------- */
@media (max-width: 700px) {
  :root { --alt-topo: 50px; }
  .palco { grid-template-columns: 0 1fr 0; }
  .seta { display: none; }
  .livro-area { padding: 12px 8px; }
  .so-largo { display: none !important; }
  .barra-topo { padding: 0 8px 0 10px; }
  .barra-topo__marca svg { display: none; }
  .busca { width: 40vw; }
  .ferramentas { padding-left: 4px; padding-right: 4px; gap: 2px; }
  .ferramentas__grupo { gap: 0; }
  .ferramentas button, .ferramentas a { width: 38px; }
  .miniaturas { width: 100%; }
  .miniaturas__lista { grid-template-columns: repeat(3, 1fr); }
}
