/* ============================================
   Sound of Scripture — Library / Study Guides
   ============================================ */

.page-library .library-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.library-intro {
  text-align: center;
  margin-bottom: 2.5rem;
}

.library-title {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.library-lead {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.55;
}

/* ---- Year section ---- */
.year-section {
  margin-bottom: 3.5rem;
  animation: yearFadeIn 0.7s ease both;
}

.year-section + .year-section {
  margin-top: 1rem;
}

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

/* Large semi-transparent year */
.year-label {
  font-family: var(--font-sans);
  font-size: clamp(3.5rem, 12vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.08);
  text-align: center;
  margin-bottom: 1.75rem;
  user-select: none;
  pointer-events: none;
}

/* ---- Books grid: 4 in a row ---- */
.books-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.75rem 1.5rem;
  justify-items: center;
}

.book-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  width: 100%;
  max-width: 180px;
  transition: transform 0.35s ease;
}

.book-card:hover {
  transform: translateY(-6px);
}

/* Cover 3:4 */
.book-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.3),
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(139, 92, 246, 0.15);
  transition: box-shadow 0.4s ease;
}

.book-card:hover .book-cover {
  box-shadow:
    0 0 0 1px rgba(183, 148, 246, 0.5),
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(139, 92, 246, 0.3);
}

.book-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  /* Duotone base: grayscale */
  filter: grayscale(1) contrast(1.12) brightness(0.95);
  transition: filter 0.55s ease;
}

/* Purple colorization layer */
.book-duotone {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(183, 148, 246, 0.85) 0%,
    rgba(139, 92, 246, 0.72) 45%,
    rgba(76, 29, 149, 0.9) 100%
  );
  mix-blend-mode: color;
  opacity: 1;
  transition: opacity 0.55s ease;
  pointer-events: none;
}

/* Soft dark edge so covers feel consistent */
.book-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.25) 0%,
    transparent 40%
  );
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.55s ease;
}

/* Hover → full color, no duotone */
.book-card:hover .book-cover img {
  filter: none;
}

.book-card:hover .book-duotone {
  opacity: 0;
}

.book-card:hover .book-shade {
  opacity: 0.4;
}

/* Caption under the book */
.book-caption {
  margin-top: 0.9rem;
  text-align: center;
  width: 100%;
}

.book-caption-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-top: 0.9rem;
  margin-bottom: 0.25rem;
  text-align: center;
}

.book-caption-sub {
  font-size: 0.75rem;
  font-weight: 400;
  color: #b8c7dc;
  line-height: 1.4;
}

/* ---- Action buttons ---- */
.library-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  min-height: 3rem;
}

.btn-load-more,
.btn-show-all {
  appearance: none;
  border: 1px solid rgba(139, 92, 246, 0.45);
  background: rgba(139, 92, 246, 0.12);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.75rem 1.75rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, transform 0.2s, box-shadow 0.25s;
}

.btn-load-more:hover,
.btn-show-all:hover {
  background: rgba(139, 92, 246, 0.28);
  border-color: rgba(183, 148, 246, 0.7);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
}

.btn-load-more:active,
.btn-show-all:active {
  transform: translateY(0);
}

.btn-show-all {
  border-color: rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
}

.btn-show-all:hover {
  background: rgba(34, 211, 238, 0.18);
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.2);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .books-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem 1.25rem;
  }

  .book-card {
    max-width: 200px;
  }

  .year-label {
    margin-bottom: 1.4rem;
  }
}

@media (max-width: 520px) {
  .page-library .library-main {
    padding: 1.75rem 1rem 3rem;
  }

  .books-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.4rem 1rem;
  }

  .book-card {
    max-width: 160px;
  }

  .book-caption-title {
    font-size: 0.82rem;
  }

  .book-caption-sub {
    font-size: 0.7rem;
  }

  .year-label {
    font-size: clamp(2.8rem, 18vw, 4.5rem);
  }
}
