/* ============================================================
   ESTANTE INFINITA — TEMA V2 (design system "biblioteca premium")
   Paleta e tipografia da referência oficial:
   verde-biblioteca #0B2F28 · verde-escuro #07211C · dourado #D6B16A
   pergaminho #F5EEDB · texto-escuro #1B1B1B
   Títulos: Cormorant Garamond semibold · Corpo: Lora (22px/1.9 no leitor)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Lora:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --verde-biblioteca: #0B2F28;
  --verde-escuro: #07211C;
  --verde-painel: #0E3A31;
  --verde-hover: #12463B;
  --dourado: #D6B16A;
  --dourado-claro: #EBD9AC;
  --dourado-escuro: #A8843F;
  --pergaminho: #F5EEDB;
  --pergaminho-suave: #EFE5CC;
  --texto-escuro: #1B1B1B;
  --texto-claro: #F5EEDB;
  --texto-suave: #C9BC9C;
  --borda-ouro: rgba(214, 177, 106, .28);
  --borda-ouro-forte: rgba(214, 177, 106, .55);
  --sombra-card: 0 6px 16px rgba(0, 0, 0, .45), 0 2px 5px rgba(0, 0, 0, .35);
  --sombra-card-hover: 0 18px 40px rgba(0, 0, 0, .6), 0 0 0 2px var(--dourado), 0 0 26px rgba(214, 177, 106, .35);
  --sombra-painel: 0 10px 34px rgba(0, 0, 0, .5);
  --raio: 12px;
  --raio-g: 18px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --corpo: "Lora", Georgia, serif;
  --ui: system-ui, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, input, select, textarea, summary, [role="button"] { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--verde-escuro);
  color: var(--texto-claro);
  font-family: var(--corpo);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; }
.ui { font-family: var(--ui); }
a { color: var(--dourado); text-decoration: none; }
a:hover { color: var(--dourado-claro); }

/* ---------- botões ---------- */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, var(--dourado-claro), var(--dourado) 55%, var(--dourado-escuro));
  color: var(--texto-escuro);
  font-family: var(--ui); font-weight: 700; font-size: .95rem;
  border: none; border-radius: 10px; padding: 12px 22px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.botao:hover { transform: translateY(-1px); filter: brightness(1.06);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5), 0 0 18px rgba(214, 177, 106, .35), inset 0 1px 0 rgba(255, 255, 255, .35); }
.botao:active { transform: translateY(0); filter: brightness(.97); }
.botao.fantasma {
  background: transparent; color: var(--dourado);
  border: 1px solid var(--borda-ouro-forte); box-shadow: none;
}
.botao.fantasma:hover { background: rgba(214, 177, 106, .08); }

/* ---------- painéis ---------- */
.painel {
  background: linear-gradient(180deg, var(--verde-painel), var(--verde-biblioteca));
  border: 1px solid var(--borda-ouro);
  border-radius: var(--raio-g);
  box-shadow: var(--sombra-painel);
}
.painel-pergaminho {
  background: linear-gradient(180deg, var(--pergaminho), var(--pergaminho-suave));
  color: var(--texto-escuro);
  border-radius: var(--raio-g);
  box-shadow: var(--sombra-painel);
}

/* ---------- sidebar (desktop) ---------- */
.lateral {
  position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 40;
  background: linear-gradient(180deg, var(--verde-biblioteca), var(--verde-escuro));
  border-right: 1px solid var(--borda-ouro);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.lateral .marca { display: flex; align-items: center; gap: 10px; padding: 8px 10px 22px; }
.lateral .marca img { width: 42px; }
.lateral .marca b {
  font-family: var(--serif); font-size: 1.06rem; line-height: 1.15;
  color: var(--texto-claro); letter-spacing: .12em; font-weight: 600;
}
.lateral .marca b span { color: var(--dourado); display: block; letter-spacing: .22em; font-size: .82rem; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--ui); font-size: .95rem; color: var(--texto-suave);
  padding: 11px 14px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--verde-hover); color: var(--texto-claro); }
.nav-item.ativo {
  background: var(--verde-hover); color: var(--dourado-claro);
  border-color: var(--borda-ouro);
}
.nav-item .ic { width: 20px; text-align: center; }
.conteudo-com-lateral { margin-left: 232px; }

/* ---------- barra inferior (mobile) ---------- */
.nav-mobile { display: none; }
@media (max-width: 900px) {
  .lateral { display: none; }
  .conteudo-com-lateral { margin-left: 0; }
  .nav-mobile {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(7, 33, 28, .97); backdrop-filter: blur(8px);
    border-top: 1px solid var(--borda-ouro);
    justify-content: space-around; padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .nav-mobile a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-family: var(--ui); font-size: .66rem; color: var(--texto-suave);
    min-width: 56px; min-height: 44px; padding: 3px 6px; border-radius: 10px;
  }
  .nav-mobile a.ativo { color: var(--dourado); }
  .nav-mobile .ic { font-size: 1.15rem; }
  body.tem-nav-mobile { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ---------- card de livro (proporção 2:3, hover scale 1.04) ---------- */
.fileira {
  display: flex; gap: 16px; overflow-x: auto; padding: 14px 4px 22px;
  scroll-snap-type: x proximity; scrollbar-width: thin;
  scrollbar-color: var(--dourado-escuro) transparent;
}
.fileira::-webkit-scrollbar { height: 8px; }
.fileira::-webkit-scrollbar-thumb { background: var(--verde-hover); border-radius: 8px; }
.card-livro {
  flex: 0 0 auto; width: 160px; scroll-snap-align: start;
  cursor: pointer; position: relative;
  transition: transform .22s cubic-bezier(.2, .7, .2, 1);
}
.card-livro .capa {
  width: 160px; height: 240px; border-radius: var(--raio);
  overflow: hidden; position: relative;
  background: linear-gradient(160deg, #123c33, var(--verde-biblioteca));
  border: 1px solid var(--borda-ouro);
  box-shadow: var(--sombra-card);
  transition: box-shadow .22s ease, border-color .22s ease;
}
.card-livro .capa img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-livro:hover { transform: scale(1.04) translateY(-4px); z-index: 2; }
.card-livro:hover .capa { box-shadow: var(--sombra-card-hover); border-color: var(--dourado); }
.card-livro .brilho-capa {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, .16) 50%, transparent 58%);
  transform: translateX(-130%); transition: transform .6s ease;
}
.card-livro:hover .brilho-capa { transform: translateX(130%); }
.card-livro .titulo {
  font-family: var(--ui); font-size: .84rem; font-weight: 600;
  color: var(--texto-claro); margin: 10px 2px 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-livro .autor {
  font-family: var(--ui); font-size: .76rem; color: var(--texto-suave);
  margin: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-livro .progresso {
  height: 4px; border-radius: 4px; background: rgba(0, 0, 0, .45);
  margin-top: 8px; overflow: hidden;
}
.card-livro .progresso i {
  display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--dourado-escuro), var(--dourado-claro));
}
/* capa-placeholder elegante (livro sem capa real) */
.capa-tipografica {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 14px; gap: 10px;
  background:
    radial-gradient(circle at 50% 0%, rgba(214, 177, 106, .22), transparent 60%),
    linear-gradient(165deg, #0F3B31, var(--verde-escuro));
}
.capa-tipografica::before { content: "❦"; color: var(--dourado); font-size: 1.3rem; }
.capa-tipografica b {
  font-family: var(--serif); font-weight: 600; font-size: .98rem;
  color: var(--pergaminho); line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.capa-tipografica i { font-family: var(--serif); font-size: .8rem; color: var(--dourado); }
.capa-tipografica::after { content: ""; width: 46px; height: 1px; background: var(--borda-ouro-forte); }

/* ---------- modal de detalhe do livro ---------- */
.modal-fundo {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 16, 13, .78); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.modal-fundo.aberto { opacity: 1; pointer-events: auto; }
.modal-livro {
  width: min(880px, 96vw); max-height: 92vh; overflow: auto;
  display: grid; grid-template-columns: 300px 1fr;
  background: linear-gradient(160deg, var(--verde-painel), var(--verde-escuro) 70%);
  border: 1px solid var(--borda-ouro-forte); border-radius: var(--raio-g);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  transform: translateY(14px) scale(.98); transition: transform .25s ease;
}
.modal-fundo.aberto .modal-livro { transform: none; }
.modal-livro .lado-capa {
  padding: 26px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: radial-gradient(circle at 50% 18%, rgba(214, 177, 106, .14), transparent 65%);
}
.modal-livro .lado-capa .moldura {
  width: 230px; height: 345px; border-radius: var(--raio); overflow: hidden;
  border: 1px solid var(--borda-ouro-forte); box-shadow: var(--sombra-card);
}
.modal-livro .lado-capa .moldura img { width: 100%; height: 100%; object-fit: cover; }
.modal-livro .lado-info { padding: 30px 30px 26px 6px; }
.modal-livro h2 { margin: 4px 0 2px; font-size: 2rem; color: var(--pergaminho); }
.modal-livro .metadados {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px;
}
.chip {
  font-family: var(--ui); font-size: .74rem; letter-spacing: .04em;
  color: var(--dourado-claro); background: rgba(214, 177, 106, .1);
  border: 1px solid var(--borda-ouro); border-radius: 999px; padding: 5px 12px;
}
.chip.premio { color: var(--texto-escuro); background: linear-gradient(180deg, var(--dourado-claro), var(--dourado)); border: none; font-weight: 700; }
.modal-livro .sinopse {
  font-size: 1.02rem; line-height: 1.85; color: var(--texto-claro);
  border-left: 2px solid var(--dourado); padding-left: 16px; font-style: italic;
}
.modal-livro .acoes { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.modal-fechar {
  position: sticky; top: 12px; float: right; margin: 12px;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--borda-ouro);
  background: rgba(7, 33, 28, .8); color: var(--texto-claro); font-size: 1rem; cursor: pointer;
}
@media (max-width: 700px) {
  .modal-livro { grid-template-columns: 1fr; }
  .modal-livro .lado-info { padding: 0 22px 24px; }
  .modal-livro .lado-capa { padding: 14px 22px 6px; }
  .modal-livro .lado-capa .moldura { width: 156px; height: 234px; }
  .modal-livro h2 { font-size: clamp(1.45rem, 5.8vw, 1.9rem); }
  .modal-livro .sinopse { font-size: .98rem; line-height: 1.75; padding-left: 14px; }
  .modal-livro .acoes { gap: 10px; }
  .modal-livro .acoes .botao { flex: 1 1 auto; }

  /* bottom-sheet: ancorado embaixo, cantos superiores arredondados, alça decorativa */
  .modal-fundo:has(.modal-livro) { align-items: flex-end; padding: 0; }
  .modal-fundo:has(.modal-livro) .modal-livro {
    width: 100%; max-width: 100%; max-height: 92vh; max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    box-shadow: 0 -20px 60px rgba(0, 0, 0, .65);
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    transform: translateY(100%);
    transition: transform .34s cubic-bezier(.2, .7, .2, 1);
  }
  .modal-fundo:has(.modal-livro) .modal-livro::before {
    content: ""; width: 44px; height: 5px; flex: 0 0 auto;
    justify-self: center; margin: 10px auto 0;
    border-radius: 999px; background: var(--borda-ouro-forte);
  }
  .modal-fundo.aberto .modal-livro { transform: none; }
}

/* ---------- hero "continue de onde parou" ---------- */
.hero-continuar {
  display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center;
  padding: 24px; border-radius: var(--raio-g);
}
.hero-continuar .capa-hero {
  width: 150px; height: 225px; border-radius: var(--raio); overflow: hidden;
  border: 1px solid var(--borda-ouro-forte); box-shadow: var(--sombra-card);
}
.hero-continuar .capa-hero img { width: 100%; height: 100%; object-fit: cover; }
.hero-continuar h2 { font-size: 2.1rem; margin: 0 0 4px; color: var(--pergaminho); }
.barra-progresso {
  height: 8px; background: rgba(0, 0, 0, .5); border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(214, 177, 106, .18);
}
.barra-progresso i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--dourado-escuro), var(--dourado-claro));
}

/* ---------- cabeçalhos de seção ---------- */
.secao-cabeca { display: flex; align-items: baseline; justify-content: space-between; margin-top: 26px; }
.secao-cabeca h3 { font-size: 1.5rem; margin: 0; color: var(--pergaminho); }
.secao-cabeca h3::before { content: "❧ "; color: var(--dourado); font-size: 1.1rem; }
.secao-cabeca a { font-family: var(--ui); font-size: .82rem; letter-spacing: .06em; }

/* ---------- topo (mobile / páginas simples) ---------- */
.topo-v2 {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--borda-ouro);
  background: linear-gradient(180deg, var(--verde-biblioteca), rgba(11, 47, 40, .92));
  position: sticky; top: 0; z-index: 30; backdrop-filter: blur(8px);
}
.topo-v2 .marca { display: flex; align-items: center; gap: 10px; }
.topo-v2 .marca img { width: 34px; }
.topo-v2 .marca b { font-family: var(--serif); letter-spacing: .14em; font-size: .95rem; }
.topo-v2 .marca b span { color: var(--dourado); }

/* ---------- utilidades ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 26px; }
.suave { color: var(--texto-suave); }
.ouro { color: var(--dourado); }
.centrado { text-align: center; }
.divisor-ouro {
  border: none; height: 1px; margin: 26px auto; width: 120px;
  background: linear-gradient(90deg, transparent, var(--dourado), transparent);
}
.aparecer { animation: v2aparecer .5s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes v2aparecer { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ============================================================
   REFINAMENTO MOBILE (foco 360–430px; desktop permanece intacto)
   ============================================================ */
@media (max-width: 900px) {
  /* alvos de toque confortáveis */
  .botao { min-height: 44px; }
  .nav-item { min-height: 44px; }
  .modal-fechar { width: 40px; height: 40px; }

  /* respiro lateral consistente */
  .container { padding: 0 18px; }
  .topo-v2 { padding: 12px 18px; }

  /* fileiras de livros: cards compactos, rolagem limpa e sem barra */
  .fileira { gap: 12px; padding: 12px 2px 18px; scrollbar-width: none; }
  .fileira::-webkit-scrollbar { display: none; height: 0; }
  .card-livro { width: 132px; }
  .card-livro .capa { width: 132px; height: 198px; }
  .card-livro .titulo { font-size: .8rem; margin: 8px 2px 2px; }
  .card-livro .autor { font-size: .72rem; }

  /* tipografia fluida das seções */
  .secao-cabeca { margin-top: 22px; gap: 4px 14px; flex-wrap: wrap; }
  .secao-cabeca h3 { font-size: clamp(1.18rem, 4.6vw, 1.5rem); }
  .hero-continuar h2 { font-size: clamp(1.35rem, 5.5vw, 2.1rem); line-height: 1.15; }

  /* hero "continue de onde parou": grade compacta de duas colunas */
  .painel.hero-continuar {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px 16px; align-items: center;
    padding: 18px 16px; text-align: left;
  }
  .painel.hero-continuar .capa-hero { width: 96px; height: 144px; }
  .painel.hero-continuar .hero-prog { margin-left: 0; margin-right: 0; }
  .painel.hero-continuar .hero-acoes { justify-content: flex-start; }
}
