/* ===== PREVIEW DE APOSTILA (/produtos/livro.html) ===== */

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

.livro-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff; padding: 48px 0 40px; text-align: center;
}
.livro-categoria {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .82rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .08em; color: #a5b4fc; margin-bottom: 14px;
}
.livro-header h1 {
  font-size: 1.9rem; font-weight: 800; line-height: 1.25;
  letter-spacing: -.02em; max-width: 820px; margin: 0 auto;
}
.livro-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-top: 20px;
}
.livro-tags span {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .15);
  color: #e2e8f0; font-size: .78rem; font-weight: 500;
  padding: 5px 12px; border-radius: 999px;
}

.livro-layout {
  display: grid; grid-template-columns: 260px 1fr;
  gap: 32px; padding-top: 32px; padding-bottom: 56px;
  align-items: start;
}
.livro-side { position: sticky; top: 90px; }
.livro-capa {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
  padding: 12px; box-shadow: 0 4px 20px rgba(15, 23, 42, .07);
  margin-bottom: 16px;
}
.livro-capa img {
  display: block; width: 100%; height: auto;
  border-radius: 10px; aspect-ratio: 298 / 396; object-fit: cover;
}

.btn-download, .btn-scribd {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px 18px; border-radius: 12px;
  font-size: .95rem; font-weight: 700; text-decoration: none;
  margin-bottom: 10px; transition: transform .2s, box-shadow .2s;
}
.btn-download {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff; box-shadow: 0 6px 18px rgba(220, 38, 38, .3);
}
.btn-scribd {
  background: #fff; color: #475569;
  border: 1px solid #cbd5e1; box-shadow: 0 2px 8px rgba(15, 23, 42, .05);
}
.btn-download:hover, .btn-scribd:hover {
  transform: translateY(-2px);
}
.btn-download:focus-visible, .btn-scribd:focus-visible {
  outline: 3px solid #6366f1; outline-offset: 2px;
}

.livro-embed {
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 16px;
  overflow: hidden; margin-bottom: 24px;
  /* Altura reservada: sem isso o iframe chega depois e a pagina sobe
     (CLS). Ver commentario no js/livro.js. */
  min-height: 720px;
}
.livro-embed iframe {
  display: block; width: 100%; height: 720px; border: 0;
}

.livro-sobre, .livro-relacionados {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 16px;
  padding: 28px; margin-bottom: 24px;
}
.livro-sobre h2, .livro-relacionados h2 {
  font-size: 1.25rem; font-weight: 800; color: #0f172a;
  margin-bottom: 14px; letter-spacing: -.01em;
}
.livro-sobre p { color: #475569; line-height: 1.7; margin-bottom: 18px; }
.livro-info { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.livro-info li {
  display: flex; align-items: center; gap: 10px;
  color: #334155; font-size: .92rem;
}
.livro-info i { color: #16a34a; }

.relacionados-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.relacionado {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border: 1px solid #e2e8f0; border-radius: 12px;
  text-decoration: none; background: #f8fafc;
  transition: border-color .2s, transform .2s;
}
.relacionado:hover {
  border-color: #a5b4fc; transform: translateY(-2px);
}
.relacionado:focus-visible { outline: 3px solid #6366f1; outline-offset: 2px; }
.relacionado img {
  width: 100%; height: auto; aspect-ratio: 298 / 396;
  object-fit: cover; border-radius: 8px;
}
.relacionado span {
  font-size: .85rem; font-weight: 600; color: #1e293b; line-height: 1.35;
}

.livro-erro {
  text-align: center; padding: 64px 24px; color: #475569;
}
.livro-erro i { font-size: 2.5rem; color: #cbd5e1; margin-bottom: 16px; }
.livro-erro h1 { font-size: 1.5rem; color: #0f172a; margin-bottom: 10px; }

@media (max-width: 900px) {
  .livro-layout { grid-template-columns: 1fr; }
  .livro-side { position: static; display: grid; gap: 12px; }
  .livro-capa { max-width: 220px; margin: 0 auto; }
  .relacionados-grid { grid-template-columns: repeat(2, 1fr); }
  .livro-header h1 { font-size: 1.45rem; }
  .livro-embed, .livro-embed iframe { height: 560px; min-height: 560px; }
}
@media (max-width: 560px) {
  .relacionados-grid { grid-template-columns: 1fr; }
  .livro-embed, .livro-embed iframe { height: 460px; min-height: 460px; }
}