/* ============================================================
   Lenny's Podcast Bookshelf
   Aesthetic: "Warm Literary Haven"
   Bookshelf technique: ekfuhrmann (CodePen OJmRVPj)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=Libre+Franklin:wght@400;500;600&display=swap');

:root {
  --cream: #faf6f0;
  --cream-dark: #f0ebe2;
  --walnut: #5c3d2e;
  --walnut-light: #7a5a48;
  --walnut-dark: #3e2518;
  --amber: #c8922c;
  --amber-glow: #e8a83e;
  --ink: #2c1810;
  --ink-soft: #5a4a3e;
  --ink-muted: #8a7a6e;
  --shelf-face: #f5f0e8;
  --shelf-edge: #e8dfd4;
  --paper-white: #fffdf8;

  /* Custom easing curves */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  font-family: 'Libre Franklin', sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  /* Subtle linen texture */
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(200,146,44,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(92,61,46,0.03) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg width='40' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.015'/%3E%3C/svg%3E");
}

/* ================================================================
   Header
   ================================================================ */
.header {
  padding: 4.5rem 2rem 3rem;
  text-align: center;
  position: relative;
}
.header::after { display: none; }
.header__inner { max-width: 1100px; margin: 0 auto; }

.header__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--walnut);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.header__subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ink-muted);
  margin-top: 0.5rem;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

/* ---- Content Tabs ---- */
.content-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}
.content-tab {
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: 10px;
  background: var(--paper-white);
  color: var(--ink-soft);
  font-family: 'Libre Franklin', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 160ms var(--ease-out);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.content-tab:active {
  transform: scale(0.97);
}
.content-tab.active {
  background: var(--walnut);
  border-color: var(--walnut);
  color: var(--cream);
}
.content-tab svg { stroke: var(--ink-muted); transition: stroke 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .content-tab:hover {
    border-color: var(--walnut-light);
    color: var(--walnut);
  }
  .content-tab.active:hover {
    color: var(--cream);
    border-color: var(--walnut);
  }
}
.content-tab.active svg,
.content-tab.active:hover svg { stroke: var(--cream); }
@media (hover: hover) and (pointer: fine) {
  .content-tab:hover svg { stroke: var(--walnut); }
}
.content-tab__count {
  font-size: 0.7rem;
  opacity: 0.65;
}

/* ---- Controls ---- */
.header__controls {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

/* Search */
.search-box { position: relative; width: 100%; max-width: 506px; }
.search-box__icon {
  position: absolute; left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted); pointer-events: none;
}
.search-box__input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.8rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: 8px;
  background: var(--paper-white);
  color: var(--ink);
  font-size: 0.9rem;
  font-family: 'Libre Franklin', sans-serif;
  outline: none;
  transition: border-color 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.search-box__input::placeholder {
  color: var(--ink-muted); opacity: 0.7;
  font-style: italic;
}
.search-box__input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(200,146,44,0.1);
}

/* Filter pills */
.filter-bar {
  display: flex; flex-wrap: nowrap; gap: 0.45rem;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
  padding-bottom: 2px;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  padding: 0.35rem 0.85rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: 6px;
  background: var(--paper-white);
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 180ms var(--ease-out), border-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 160ms var(--ease-out);
  white-space: nowrap;
}
.filter-btn:active {
  transform: scale(0.97);
}
.filter-btn.active {
  background: var(--walnut);
  border-color: var(--walnut);
  color: var(--cream);
  font-weight: 600;
}
@media (hover: hover) and (pointer: fine) {
  .filter-btn:hover {
    border-color: var(--walnut-light);
    color: var(--walnut);
  }
  .filter-btn.active:hover {
    color: var(--cream);
    border-color: var(--walnut);
  }
}

/* ================================================================
   Shelves Container
   ================================================================ */
.shelves-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 2rem 4rem;
  min-height: 80vh;
}

/* ================================================================
   Bookshelf — ekfuhrmann technique
   ================================================================ */
.bookshelf {
  width: 100%;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  height: 0px;
  border-bottom: 16px solid var(--shelf-face);
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  margin-top: 440px;
  margin-bottom: 60px;
}
.bookshelf:first-child { margin-top: 240px; }

/* Front shelf edge — warm wood feel */
.bookshelf::before {
  content: "";
  position: absolute;
  top: 16px;
  background: linear-gradient(180deg, var(--shelf-face) 0%, var(--shelf-edge) 100%);
  height: 28px;
  width: calc(100% + 40px);
  box-shadow:
    0px -1px 4px rgba(92,61,46,0.06),
    0px 4px 16px rgba(92,61,46,0.12),
    0px 8px 30px rgba(92,61,46,0.06);
  z-index: 2;
  border-radius: 0 0 2px 2px;
}

/* Soft shadow below shelf */
.bookshelf::after {
  content: "";
  height: 60px;
  width: calc(100% + 40px);
  position: absolute;
  top: 44px;
  display: block;
  background: linear-gradient(180deg, rgba(92,61,46,0.06) 0%, rgba(92,61,46,0) 100%);
  clip-path: polygon(1% 0%, 99% 0%, 96% 100%, 4% 100%);
  z-index: -1;
}

/* ================================================================
   Books Row
   ================================================================ */
.books {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  padding: 0 10px 2px;
  transform: translateY(-100%);
  position: relative;
  top: 10px;
  z-index: 3;
}

/* ================================================================
   Book — ekfuhrmann hover (whole element transforms)
   ================================================================ */
.book {
  width: var(--book-width, 120px);
  border-radius: 3px 0.5px 0.5px 3px;
  aspect-ratio: 115 / 180;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 200ms var(--ease-out), z-index 0ms;
}
@media (hover: hover) and (pointer: fine) {
  .book:hover {
    transform: translateY(-8px) scale(1.05);
    z-index: 100;
  }
}

/* Cover and shadow layers */
.book::before,
.book::after {
  position: absolute;
  width: 100%;
  display: block;
  content: "";
  background: var(--bg-image) center center / cover no-repeat, var(--cream-dark);
  border-radius: 3px 0.5px 0.5px 3px;
}
.book::before {
  height: 100%;
  box-shadow:
    0px 1px 2px rgba(44,24,16,0.2),
    inset 2px 0px 3px 0px rgba(44,24,16,0.15),
    inset -1px 0 1px rgba(255,255,255,0.1);
}
.book::after {
  height: 102%;
  filter: blur(12px);
  z-index: -1;
  opacity: 0.5;
}
.book:hover::after { opacity: 0.3; }

/* ---- Badge ---- */
.book__badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--amber);
  color: var(--paper-white);
  font-size: 0.58rem;
  font-weight: 700;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(200,146,44,0.4);
  pointer-events: none;
  white-space: nowrap;
}

/* ================================================================
   Poster (Movies & TV) — same shelf, 2:3 aspect ratio
   ================================================================ */
.poster {
  width: var(--book-width, 130px);
  border-radius: 6px;
  aspect-ratio: 2 / 3;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 250ms var(--ease-out), z-index 0ms;
}
@media (hover: hover) and (pointer: fine) {
  .poster:hover {
    transform: translateY(-8px) scale(1.05);
    z-index: 100;
  }
}
.poster::before,
.poster::after {
  position: absolute;
  width: 100%;
  display: block;
  content: "";
  background: var(--bg-image) center center / cover no-repeat, var(--cream-dark);
  border-radius: 6px;
}
.poster::before {
  height: 100%;
  box-shadow:
    0px 2px 8px rgba(44,24,16,0.25),
    inset 0 0 0 1px rgba(255,255,255,0.05);
}
.poster::after {
  height: 102%;
  filter: blur(12px);
  z-index: -1;
  opacity: 0.5;
}
.poster:hover::after { opacity: 0.3; }
.poster .book__badge { border-radius: 50%; }
.poster .book__tooltip { bottom: calc(100% + 20px); }

/* ================================================================
   Product Item — icon on shelf
   ================================================================ */
.product-item {
  width: var(--book-width, 100px);
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 250ms var(--ease-out), z-index 0ms;
}
@media (hover: hover) and (pointer: fine) {
  .product-item:hover {
    transform: translateY(-6px) scale(1.05);
    z-index: 100;
  }
}
.product-item::before {
  position: absolute;
  width: 100%;
  height: 100%;
  display: block;
  content: "";
  background: var(--bg-image) center center / cover no-repeat, var(--cream-dark);
  border-radius: 14px;
  box-shadow:
    0px 2px 8px rgba(44,24,16,0.15),
    inset 0 0 0 1px rgba(0,0,0,0.04);
}
.product-item::after {
  position: absolute;
  width: 100%;
  height: 102%;
  display: block;
  content: "";
  background: var(--bg-image) center center / cover no-repeat;
  border-radius: 14px;
  filter: blur(12px);
  z-index: -1;
  opacity: 0.4;
}
.product-item:hover::after { opacity: 0.2; }
.product-item .book__badge { border-radius: 50%; }
.product-item .book__tooltip { bottom: calc(100% + 15px); }

/* ---- Tooltip ---- */
.book__tooltip {
  position: absolute;
  bottom: calc(100% + 40px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--walnut-dark);
  color: var(--cream);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms var(--ease-out), transform 150ms var(--ease-out);
  z-index: 200;
  box-shadow: 0 8px 24px rgba(44,24,16,0.25);
  font-family: 'Libre Franklin', sans-serif;
}
.book__tooltip strong {
  color: var(--amber-glow);
  font-weight: 600;
}
/* Tooltip arrow */
.book__tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--walnut-dark);
}
@media (hover: hover) and (pointer: fine) {
  .book:hover .book__tooltip,
  .poster:hover .book__tooltip,
  .product-item:hover .book__tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ================================================================
   No Results
   ================================================================ */
.no-results {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--ink-muted);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.2rem;
}

/* ================================================================
   Modal
   ================================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(44,24,16,0.4);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0; visibility: hidden;
  transition: opacity 200ms var(--ease-out), visibility 200ms;
}
.modal-overlay.open {
  opacity: 1; visibility: visible;
  transition: opacity 300ms var(--ease-out), visibility 300ms;
}

.modal {
  background: var(--paper-white);
  border-radius: 20px;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-shadow:
    0 30px 80px rgba(44,24,16,0.18),
    0 0 0 1px rgba(92,61,46,0.06);
  transform: translateY(20px) scale(0.97);
  transition: transform 200ms var(--ease-out);
  position: relative;
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
  transition: transform 350ms var(--ease-bounce);
}

.modal__close {
  position: absolute; top: 24px; right: 28px;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  color: var(--ink-muted);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; cursor: pointer;
  z-index: 5; line-height: 1;
  transition: background 160ms var(--ease-out), color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.modal__close:active {
  transform: scale(0.93);
}
@media (hover: hover) and (pointer: fine) {
  .modal__close:hover {
    color: var(--ink);
    background: var(--cream-dark);
  }
}

.modal__content {
  display: flex;
  gap: 2.5rem;
  padding: 3rem 3.5rem;
}

.modal__cover { flex-shrink: 0; width: 200px; }
.modal__cover img {
  width: 100%; border-radius: 6px;
  box-shadow:
    0 8px 30px rgba(44,24,16,0.15),
    0 2px 8px rgba(44,24,16,0.1);
}
.modal__cover-placeholder {
  width: 100%;
  aspect-ratio: 115/180;
  background: var(--cream-dark);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.9rem;
  text-align: center;
  padding: 1rem;
}

.modal__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}
.modal__title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--walnut);
  line-height: 1.2;
}
.modal__author {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--ink-muted);
  margin-top: 0.5rem;
  font-size: 1.15rem;
}
.modal__category {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.3rem 0.85rem;
  background: rgba(200,146,44,0.08);
  color: var(--walnut-light);
  border: 1px solid rgba(200,146,44,0.15);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  width: fit-content;
}
.modal__rating {
  margin-top: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--amber);
}
.modal__rating-count {
  color: var(--ink-muted);
  font-size: 0.78rem;
}
.modal__description {
  margin-top: 1.2rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}
.modal__description.expanded {
  -webkit-line-clamp: unset;
}
.modal__read-more {
  margin-top: 0.4rem;
  background: none;
  border: none;
  color: var(--walnut-light);
  font-size: 0.78rem;
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: color 180ms var(--ease-out);
  align-self: flex-start;
}
@media (hover: hover) and (pointer: fine) {
  .modal__read-more:hover {
    color: var(--walnut);
  }
}
.modal__meta {
  margin-top: 1rem;
  display: flex; gap: 0.75rem;
  align-items: center;
  color: var(--ink-muted);
  font-size: 0.88rem;
}
.modal__meta span:empty { display: none; }
.modal__meta span + span:not(:empty)::before {
  content: "·";
  margin-right: 0.75rem;
  opacity: 0.5;
}
.modal__section { margin-top: 1.8rem; }
.modal__section h3 {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin-bottom: 0.7rem;
  font-weight: 600;
}
.modal__recommenders { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.modal__recommender-tag {
  padding: 0.4rem 0.85rem;
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.modal__actions {
  margin-top: 2rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.modal__btn {
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 180ms var(--ease-out), transform 160ms var(--ease-out), box-shadow 180ms var(--ease-out);
  background: var(--walnut);
  color: var(--cream);
  font-family: 'Libre Franklin', sans-serif;
}
.modal__btn:active {
  transform: scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
  .modal__btn:hover {
    background: var(--walnut-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(44,24,16,0.2);
  }
}
.modal__btn--secondary {
  background: transparent;
  color: var(--walnut);
  border: 1.5px solid var(--cream-dark);
}
@media (hover: hover) and (pointer: fine) {
  .modal__btn--secondary:hover {
    border-color: var(--walnut-light);
    background: var(--cream);
    transform: translateY(-1px);
  }
}

/* ================================================================
   Footer
   ================================================================ */
.footer {
  text-align: center;
  padding: 2.5rem 2rem;
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  border-top: 1px solid var(--cream-dark);
  max-width: 600px;
  margin: 0 auto;
}

/* ================================================================
   Back to Top
   ================================================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--cream-dark);
  background: var(--paper-white);
  color: var(--walnut);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(44,24,16,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 250ms var(--ease-out), visibility 250ms, transform 250ms var(--ease-out), background 180ms var(--ease-out), color 180ms var(--ease-out), border-color 180ms var(--ease-out);
  z-index: 500;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:active {
  transform: scale(0.93);
}
@media (hover: hover) and (pointer: fine) {
  .back-to-top:hover {
    background: var(--walnut);
    color: var(--cream);
    border-color: var(--walnut);
  }
}

/* ================================================================
   Responsive
   ================================================================ */

/* ---- Small tablet / phone landscape (≤768px) ---- */
@media (max-width: 768px) {
  .header { padding: 3rem 1.5rem 2rem; }
  .header__title { font-size: 2.4rem; }
  .header__subtitle { font-size: 1rem; }
  .header__controls { margin-top: 1.8rem; gap: 1.2rem; }

  .filter-bar {
    justify-content: flex-start;
    align-self: stretch;
    padding: 0 0.5rem 2px;
  }

  .content-tabs { gap: 0.35rem; }
  .content-tab { font-size: 0.78rem; padding: 0.45rem 0.85rem; }
  .content-tab svg { width: 14px; height: 14px; }

  .shelves-container { padding: 0.5rem 1rem 3rem; }

  .bookshelf { margin-top: 280px; margin-bottom: 45px; }
  .bookshelf:first-child { margin-top: 180px; }

  .books { gap: 5px; }

  .modal__content {
    flex-direction: column;
    align-items: center;
    padding: 2rem 2.5rem;
    gap: 1.5rem;
  }
  .modal__cover { width: 160px; }
  .modal__info { text-align: center; align-items: center; }
  .modal__meta { justify-content: center; }
  .modal__recommenders { justify-content: center; }
  .modal__actions { justify-content: center; }
  .modal__title { font-size: 1.7rem; }
}

/* ---- Phone (≤480px) ---- */
@media (max-width: 480px) {
  .header { padding: 2rem 1rem 1.5rem; }
  .header__title { font-size: 1.75rem; }
  .header__subtitle { font-size: 0.88rem; margin-top: 0.5rem; }
  .header__controls { margin-top: 1.2rem; gap: 0.8rem; }

  .content-tabs { gap: 0.25rem; flex-wrap: wrap; }
  .content-tab { font-size: 0.72rem; padding: 0.4rem 0.7rem; gap: 0.3rem; }
  .content-tab svg { width: 12px; height: 12px; }

  .search-box__input {
    font-size: 0.85rem;
    padding: 0.6rem 0.9rem 0.6rem 2.4rem;
  }
  .filter-btn { padding: 0.3rem 0.65rem; font-size: 0.72rem; }

  .shelves-container { padding: 0.5rem 0.5rem 2rem; }

  .bookshelf {
    margin-top: 180px;
    margin-bottom: 30px;
    border-bottom-width: 12px;
    border-left-width: 14px;
    border-right-width: 14px;
  }
  .bookshelf:first-child { margin-top: 140px; }
  .bookshelf::before {
    height: 22px;
    width: calc(100% + 28px);
  }
  .bookshelf::after {
    width: calc(100% + 28px);
    top: 34px;
    height: 40px;
  }

  .books { gap: 4px; padding: 0 6px 2px; }

  @media (hover: hover) and (pointer: fine) {
    .book:hover {
      transform: translateY(-6px) scale(1.04);
    }
  }

  .book__tooltip {
    white-space: normal;
    max-width: 180px;
    font-size: 0.68rem;
    bottom: calc(100% + 25px);
  }
  .book__badge {
    height: 16px;
    padding: 0 5px;
    font-size: 0.5rem;
    top: -6px; right: -6px;
  }

  .modal-overlay { padding: 0.75rem; }
  .modal { border-radius: 16px; max-height: 92vh; }
  .modal__close { top: 14px; right: 16px; width: 32px; height: 32px; font-size: 1rem; }
  .modal__content {
    padding: 1.5rem 1.25rem;
    gap: 1rem;
  }
  .modal__cover { width: 130px; }
  .modal__title { font-size: 1.35rem; }
  .modal__author { font-size: 0.95rem; }
  .modal__category { font-size: 0.72rem; }
  .modal__rating { font-size: 0.82rem; }
  .modal__meta { font-size: 0.82rem; }
  .modal__description { font-size: 0.82rem; }
  .modal__section h3 { font-size: 0.65rem; }
  .modal__recommender-tag { font-size: 0.78rem; padding: 0.3rem 0.65rem; }
  .modal__btn { padding: 0.6rem 1.1rem; font-size: 0.82rem; }

  .footer { padding: 1.5rem 1rem; font-size: 0.72rem; }
}

/* ================================================================
   Stagger animation for shelf items
   ================================================================ */
.book,
.poster,
.product-item {
  opacity: 0;
  animation: shelfFadeIn 300ms var(--ease-out) forwards;
}

@keyframes shelfFadeIn {
  from {
    opacity: 0;
    filter: blur(2px);
  }
  to {
    opacity: 1;
    filter: blur(0px);
  }
}

/* ================================================================
   Reduced motion
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .book,
  .poster,
  .product-item {
    opacity: 1;
    animation: none;
  }
}
