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

html { scroll-behavior: smooth; }

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

/* ==== Pilha de capas do hero ==== */
.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;
}
.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 ==== */
.livro-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.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); }

.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.85rem;
  line-height: 1.2;
  background: linear-gradient(135deg, #fdf4f3, #f6cac6);
}

.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: empilha cover+infos no mobile e usa toda a tela ==== */
@media (max-width: 768px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-content {
    max-height: 95vh;
    border-radius: 20px 20px 0 0;
    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);
}
