/* ==== Biblioteca Virtual — styles ==== */

html { scroll-behavior: smooth; }

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ==== Pilha de capas do hero ==== */
/* Na landing vira <a> — clicar abre o funil de assinatura. */
.capa-hero {
  position: absolute;
  width: 200px;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: #eee;
  box-shadow:
    0 8px 16px -4px rgba(0,0,0,0.15),
    0 24px 48px -12px rgba(0,0,0,0.2);
  transition: transform 0.4s ease;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.capa-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.capa-hero:hover { transform: translateY(-6px) rotate(0deg) !important; z-index: 10; }

/* ==== Cards do catálogo ==== */
/* Na landing vira <a>. Reset de estilo de link + grid behavior preservado. */
.livro-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s ease;
  text-decoration: none;
  color: inherit;
}
.livro-card:hover { transform: translateY(-4px); }

.livro-card .capa {
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #e9e4dc, #d8d2c8);
  box-shadow: 0 4px 12px -2px rgba(0,0,0,0.1), 0 8px 24px -4px rgba(0,0,0,0.08);
  position: relative;
}
.livro-card .capa img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.livro-card:hover .capa img { transform: scale(1.04); }

/* Fade-in só para imagens da biblioteca (têm classe capa-img) */
.livro-card .capa img.capa-img {
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.3s ease;
}
.livro-card .capa img.capa-img.capa-carregada { opacity: 1; }

/* Overlay "Assinar pra ler" — só aparece no hover/focus na landing.
   Deixa explícito que clicar leva pro pagamento. */
.livro-card .capa-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(26,24,23,0) 40%, rgba(185,60,47,0.92) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  padding-bottom: 12px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.livro-card:hover .capa-overlay,
.livro-card:focus-visible .capa-overlay {
  opacity: 1;
}
@media (hover: none) {
  /* Em touch a gente deixa o overlay sempre visível, sutil — sem hover
     o usuário não tem como descobrir que é clicável. */
  .livro-card .capa-overlay { opacity: 0.92; }
}

.livro-card .placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 1rem;
  text-align: center;
  color: #7f2820;
  font-family: 'Playfair Display', serif;
  font-size: 0.82rem;
  line-height: 1.3;
  background: linear-gradient(160deg, #fdf4f3 0%, #f6cac6 60%, #eea198 100%);
}

.livro-card .titulo {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
  color: #1a1817;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.livro-card .autor {
  font-size: 0.75rem;
  color: rgba(26,24,23,0.55);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==== Badge de formato ==== */
.badge-formato {
  position: absolute;
  top: 8px; right: 8px;
  padding: 2px 7px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 999px;
  background: rgba(0,0,0,0.7);
  color: white;
  backdrop-filter: blur(4px);
}

/* ==== Scrollbar custom ==== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8d2c8; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #b93c2f; }

/* ==== Modal do livro ==== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(26,24,23,0.7);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: none;
  align-items: center; justify-content: center;
  padding: 2rem 1rem;
  animation: fadeIn 0.2s ease;
}
.modal-backdrop.aberto { display: flex; }

.modal-content {
  background: #fff;
  border-radius: 20px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  animation: slideUp 0.3s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ==== Loading skeletons ==== */
.skeleton {
  background: linear-gradient(90deg, #e9e4dc 0%, #f5f3ef 50%, #e9e4dc 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ==== Biblioteca grid ==== */
.biblioteca-grid {
  display: grid;
  /* Em telas bem pequenas (≤380px) → 2 colunas garantidas */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 0.75rem;
}
@media (min-width: 480px) {
  .biblioteca-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem 1rem;
  }
}
@media (min-width: 768px) {
  .biblioteca-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ==== Cards mais compactos no mobile ==== */
@media (max-width: 480px) {
  .livro-card .titulo { font-size: 0.8rem; }
  .livro-card .autor  { font-size: 0.7rem; }
  .btn-fav { width: 30px; height: 30px; top: 4px; right: 4px; }
  .btn-fav svg { width: 16px; height: 16px; }
}

/* ==== Modal no mobile ==== */
@media (max-width: 768px) {
  .modal-backdrop { padding: 1rem; }
  .modal-content {
    max-height: 90vh;
    border-radius: 20px;
    width: 100%;
  }
}

/* ==== Input limpo ==== */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e9e4dc;
  border-radius: 10px;
  background: #fff;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  outline: none;
  border-color: #cd5040;
  box-shadow: 0 0 0 3px rgba(205,80,64,0.15);
}
