/* ====================== VARIABILI & SETUP ========================= */
:root {
  --font-main: 'Inter', sans-serif;
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --text-primary: #111827;
  --text-secondary: #7c7c7c;
  --border-color: #e5e7eb;
  --radius-card: 16px;
  --radius-img: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 10px 20px -5px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ====================== GRIGLIA (MAX 5 COLONNE IDENTICHE) ========================= */
.grid {
  display: grid;
  /* Forza colonne identiche: 2 su mobile, fino a 5 su desktop */
  grid-template-columns: repeat(2, 1fr); 
  gap: 1.5rem;
  margin: 20px auto;
  width: 100%;
  max-width: 1600px; /* Evita che su schermi enormi diventino giganti */
  box-sizing: border-box;
}

@media (min-width: 768px)  { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(5, 1fr); } }

/* ====================== CARD & EFFETTI (IL CUORE) ========================= */
.nooutline {
  text-decoration: none;
  color: inherit;
  display: block;
  outline: none;
  height: 100%;
  min-width: 0; /* Impedisce al testo di allargare la colonna */
}

.grid-item {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition); /* Transizione fluida per tutto */
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* Effetto Hover sulla Card: Micro-zoom e Bordo */
.nooutline:hover .grid-item {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: #d1d5db; /* Bordo leggermente più scuro */
}

/* ====================== COPERTINE (HEIGHT UNIFORME) ========================= */
.container_biblyic {
  width: 100%;
  margin-bottom: 1rem;
}

.book__cover {
  width: 100%;
  aspect-ratio: 2 / 3; /* Tutte le immagini alte uguali */
  border-radius: var(--radius-img);
  overflow: hidden;
  background-color: #f3f4f6;
  position: relative;
}

.book__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease; /* Zoom più morbido */
}

/* Effetto Zoom Immagine al passaggio del mouse */
.nooutline:hover .book__cover img {
  transform: scale(1.08);
}

/* ====================== TESTO & DETTAGLI ========================= */
.book-details {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex-grow: 1;
}

.book-details h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.linktitolo {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* Taglio pulito se il titolo è lungo */
}

.altri_det p {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.altri_det strong {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-right: 4px;
}