/* =========================
   Book Page
   ========================= */

/* ---- Hero ---- */
.book-hero {
  position: relative;
  min-height: 50vh;
  display: flex;
  align-items: flex-end;
  background: var(--primary);
}
.book-hero__media {
  position: absolute;
  inset: 0;
}
.book-hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}
.book-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.65) 100%);
}
.book-hero__content {
  position: relative;
  z-index: 10;
  padding-block: var(--space-3xl) var(--space-2xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}
.book-hero__sub {
  font-size: var(--text-l);
  color: rgba(255,255,255,.80);
  max-width: 60ch;
  line-height: 1.6;
}

/* ---- Section ---- */
.book-section {
  background: var(--bg-body);
  padding-block: var(--space-3xl);
}

/* ---- Grid ---- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-l);
}

/* ---- Card ---- */
.book-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.book-card__cover {
  position: relative;
  aspect-ratio: 2/3;
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: box-shadow .3s ease;
}
.book-card:hover .book-card__cover,
.book-card:focus .book-card__cover {
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.book-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}
.book-card:hover .book-card__cover img,
.book-card:focus .book-card__cover img {
  transform: scale(1.04);
}
.book-card__hover {
  position: absolute;
  inset: 0;
  background: rgba(14,58,90,.60);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s ease;
}
.book-card:hover .book-card__hover,
.book-card:focus .book-card__hover {
  opacity: 1;
}
.book-card__cta {
  color: #fff;
  font-size: var(--text-s);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  border: 1px solid rgba(255,255,255,.7);
  padding: .35em .9em;
}
.book-card__meta {
  padding: var(--space-s) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.book-card__dest {
  font-size: var(--text-xs, .7rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--secondary);
}
.book-card__title {
  font-family: var(--font-title);
  font-size: var(--text-m);
  font-weight: 700;
  color: var(--text-title);
  line-height: 1.3;
}
.book-card__autore {
  font-size: var(--text-s);
  color: var(--text-muted, rgba(0,0,0,.55));
}

/* ---- Modal ---- */
.book-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.book-modal[hidden] { display: none; }
.book-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.6);
  cursor: pointer;
}
.book-modal__dialog {
  position: relative;
  z-index: 1;
  background: #fff;
  max-width: 800px;
  width: calc(100% - 2rem);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 2px;
  box-shadow: 0 16px 48px rgba(0,0,0,.30);
}
.book-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  z-index: 10;
}
.book-modal__body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-2xl);
  padding: var(--space-2xl);
}
.book-modal__img-wrap { flex-shrink: 0; }
.book-modal__img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 4px 16px rgba(0,0,0,.20);
}
.book-modal__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}
.book-modal__dest {
  font-size: var(--text-xs, .7rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--secondary);
}
.book-modal__title {
  font-family: var(--font-title);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-title);
  line-height: 1.25;
}
.book-modal__autore {
  font-size: var(--text-m);
  font-weight: 600;
  color: var(--text-body);
}
.book-modal__editore {
  font-size: var(--text-s);
  color: var(--text-muted, rgba(0,0,0,.55));
}
.book-modal__testo {
  font-size: var(--text-m);
  line-height: 1.75;
  color: var(--text-body);
  white-space: pre-line;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .book-modal__body {
    grid-template-columns: 1fr;
    padding: var(--space-xl) var(--space-m);
  }
  .book-modal__img-wrap {
    max-width: 160px;
    margin: 0 auto;
  }
  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: var(--space-m);
  }
  .book-hero { min-height: 45vh; }
}
