.book-scroller {
  display: flex;
  flex-wrap: nowrap;
  gap: 1.5rem;
  overflow-x: auto;
  padding: 2rem calc(50% - 100px) 2.5rem;  /* lets the first and last cards reach the center */
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.book-scroller::-webkit-scrollbar {
  display: none;
}

.book-scroller .book-card {
  flex: 0 0 200px;
  scroll-snap-align: center;
  text-align: center;
  text-decoration: none;
  border-bottom: none;
  opacity: 0.55;
  transform: scale(0.92);
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.book-scroller .book-card.in-focus {
  opacity: 1;
  transform: scale(1.1);
}

.book-scroller .book-card.in-focus img {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
}

.book-card {
  flex: 0 0 200px;
  scroll-snap-align: start;
  text-align: center;
  text-decoration: none;
  border-bottom: none;
  transition: transform 0.2s ease;
}

.book-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.book-card h3 {
  font-size: 1rem;
  margin: 0.9rem 0 0.2rem;
}

.book-card .book-meta {
  font-size: 0.75rem;
  opacity: 0.7;
  margin: 0;
}

.catalog-page {
  background: #1b1f22;
  color: #fff;
}

.catalog-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 2rem 1.5rem;
  margin: 2rem 0;
}

.book-grid .book-card {
  flex: none;
}

input.book-search[type="search"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 100%;
  max-width: 400px;
  margin: 1.5rem 0 0;
  padding: 0.7rem 1rem;
  height: auto !important;
  background: #2a2f33 !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  border-radius: 4px;
  color: #fff !important;
  caret-color: #fff;
  font-size: 1rem;
}

input.book-search[type="search"]::placeholder {
  color: rgba(255, 255, 255, 0.55);
  opacity: 1;
}

input.book-search[type="search"]:focus {
  outline: none;
  border-color: #fff !important;
  background: #2a2f33 !important;
}

.no-results {
  margin-top: 1rem;
  opacity: 0.7;
}

.slideshow {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  margin: 0 0 2rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.slideshow .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.slideshow .slide.active {
  opacity: 1;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin: 0 0 1.5rem;
}

button.sub-tab {
  height: auto !important;
  line-height: 1.2 !important;
  padding: 0.4rem 0 !important;
  font-size: 0.75rem;
  letter-spacing: 0.15rem;
  text-transform: uppercase;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.6) !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

button.sub-tab:hover {
  color: #fff !important;
  background: transparent !important;
  border-bottom-color: rgba(255, 255, 255, 0.4) !important;
}

button.sub-tab.active {
  color: #fff !important;
  background: transparent !important;
  border-bottom-color: #fff !important;
}

.sub-panel {
  display: none;
}

.sub-panel.active {
  display: block;
  animation: subPanelFade 0.5s ease;
}

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

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 0 2rem;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.book-scroller {
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* old Edge/IE */
}

.book-scroller::-webkit-scrollbar {
  display: none;               /* Chrome, Safari, newer Edge */
}

.book-grid .book-card {
  animation: bookFadeIn 0.6s ease both;
  animation-delay: calc(min(var(--i, 0), 12) * 80ms);
}

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

.top-actions {
  margin-bottom: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .book-grid .book-card {
    animation: none;
  }
}

button.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 3rem;
  height: 3rem;
  padding: 0 !important;
  line-height: 3rem !important;
  font-size: 1.2rem;
  letter-spacing: 0;
  text-align: center;
  background: rgba(27, 31, 34, 0.9) !important;
  color: #fff !important;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px #fff;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease, background-color 0.2s ease;
  z-index: 100;
}

button.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

button.back-to-top:hover {
  background: rgba(255, 255, 255, 0.15) !important;
}