/* ===== GEMS & GEMOLOGY — LIBRARY PAGE ===== */

:root {
  --gold: #c9a45c;
  --gold-soft: #a98c4e;
  --ivory: #f1e9d8;
  --wood-dark: #2b1a10;
  --wood-mid: #4a2f1b;
  --wood-light: #6b4527;
  --pane: #f7f2e6;
  --ink: #241d14;
}

.bookshelf-page {
  padding-top: var(--nav-height);
  min-height: 100vh;
  padding-bottom: 80px;
}

/* ---------- Header ---------- */
.library-header {
  text-align: center;
  padding: 56px 20px 30px;
}

.library-header__tag {
  display: block;
  font-size: 12px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-soft);
  margin-bottom: 14px;
}

.library-header__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 5.5vw, 56px);
  color: var(--ivory);
  letter-spacing: 0.02em;
}

.library-header__title em {
  color: var(--gold);
  font-style: italic;
}

.library-header__desc {
  max-width: 560px;
  margin: 14px auto 0;
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.6;
  color: #cfc6ae;
  font-style: italic;
}

.library-header__divider {
  width: 70px;
  height: 1px;
  background: var(--gold-soft);
  margin: 22px auto 0;
  position: relative;
}

.library-header__divider::after {
  content: "◆";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 9px;
  color: var(--gold);
  background: var(--color-bg);
  padding: 0 8px;
}

/* ---------- Bookcase ---------- */
.bookcase {
  max-width: 860px;
  margin: 44px auto 0;
  padding: 0 16px;
}

.case-frame {
  background: linear-gradient(90deg, var(--wood-dark) 0%, var(--wood-mid) 8%, var(--wood-mid) 92%, var(--wood-dark) 100%);
  border-radius: 6px 6px 3px 3px;
  padding: 22px 22px 0;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.55),
    inset 0 2px 0 rgba(255, 255, 255, 0.06);
  border: 1px solid #1c110a;
}

.case-top {
  height: 14px;
  margin: -22px -22px 0;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, var(--wood-light), var(--wood-mid));
  border-bottom: 1px solid #1c110a;
}

/* ---------- Shelf ---------- */
.shelf {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding: 26px 14px 0;
  min-height: 200px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.15) 30%, rgba(0, 0, 0, 0) 100%),
    linear-gradient(180deg, #160d07, #241610);
}

.shelf-board {
  height: 16px;
  margin: 0 -22px;
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood-mid) 45%, var(--wood-dark) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid #120a05;
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.5);
}

.case-note {
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8d7b52;
  padding: 14px 0 16px;
}

/* ---------- Books ---------- */
.book {
  position: relative;
  border: none;
  cursor: pointer;
  font-family: var(--font-display);
  color: var(--ivory);
  writing-mode: vertical-rl;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 0;
  border-radius: 3px 3px 1px 1px;
  box-shadow:
    inset 3px 0 6px rgba(255, 255, 255, 0.14),
    inset -4px 0 8px rgba(0, 0, 0, 0.45),
    2px 0 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.book .spine-title {
  font-size: 15px;
  font-weight: 600;
  color: #e9d9ae;
}

.book .spine-vol {
  font-size: 11px;
  color: rgba(241, 233, 216, 0.65);
  margin-top: 10px;
  font-style: italic;
}

/* Gold decorative lines top & bottom */
.book::before,
.book::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(233, 217, 174, 0.75), transparent);
}

.book::before { top: 9px; }
.book::after { bottom: 9px; }

/* Hover */
.book:hover {
  transform: translateY(-10px);
}

.book:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* Selected / Active */
.book.selected {
  transform: translateY(-18px) rotate(-1.2deg);
  box-shadow:
    inset 3px 0 6px rgba(255, 255, 255, 0.16),
    inset -4px 0 8px rgba(0, 0, 0, 0.45),
    0 14px 22px rgba(0, 0, 0, 0.55),
    0 0 0 2px var(--gold),
    0 0 24px rgba(201, 164, 92, 0.35);
}

/* ---------- Leather Variants ---------- */
.leather-oxblood { background: linear-gradient(90deg, #4a1f1a, #6b2e24 45%, #3c1813); }
.leather-forest  { background: linear-gradient(90deg, #1f3a2a, #2f5a40 45%, #182e21); }
.leather-navy    { background: linear-gradient(90deg, #232f45, #33455f 45%, #1b2536); }
.leather-tan     { background: linear-gradient(90deg, #7a5a35, #9a7648 45%, #61452a); color: #2b1f10; }
.leather-plum    { background: linear-gradient(90deg, #3c2338, #573450 45%, #2e1a2b); }
.leather-teal    { background: linear-gradient(90deg, #1a3a3a, #2a5a5a 45%, #152e2e); }
.leather-slate   { background: linear-gradient(90deg, #2a3040, #3a4558 45%, #222834); }
.leather-bronze  { background: linear-gradient(90deg, #4a3a1a, #6a5428 45%, #3a2c12); }

.leather-tan .spine-title { color: #2e2210; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15); }
.leather-tan .spine-vol   { color: rgba(46, 34, 16, 0.7); }

/* Decorative bookend */
.bookend {
  width: 34px;
  height: 88px;
  align-self: flex-end;
  background: linear-gradient(180deg, #8f7b4f, #5e4d2c);
  clip-path: polygon(0 100%, 0 35%, 100% 0, 100% 100%);
  border-radius: 2px;
  opacity: 0.9;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

/* ---------- Reading Pane ---------- */
.reading-pane {
  max-width: 860px;
  margin: 34px auto 0;
  padding: 0 16px;
  display: none;
}

.reading-pane.open {
  display: block;
  animation: rise 0.35s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.pane-inner {
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border-radius: 6px;
  padding: 46px 52px 52px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
  border-top: 5px solid var(--gold);
  border: 1px solid var(--color-border);
  position: relative;
}

.pane-eyebrow {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.pane-inner h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: 6px;
  color: var(--color-text);
}

.pane-author {
  font-style: italic;
  color: var(--color-accent);
  margin-bottom: 26px;
  font-size: 15px;
}

.pane-inner p {
  font-size: 17.5px;
  line-height: 1.75;
  margin-bottom: 18px;
  max-width: 64ch;
  color: var(--color-text-muted);
}

.pane-read-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 12px 24px;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 3px;
  transition: background 0.2s ease;
}

.pane-read-more:hover {
  background: var(--gold-soft);
  color: var(--ink);
}

.pane-read-more::after {
  content: '→';
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.close-btn:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}

.close-btn:focus-visible {
  outline: 2px solid #7a6437;
  outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .shelf {
    gap: 4px;
    padding: 20px 6px 0;
  }

  .book .spine-title {
    font-size: 12.5px;
  }

  .book .spine-vol {
    display: none;
  }

  .pane-inner {
    padding: 32px 22px 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .book, .reading-pane.open {
    transition: none;
    animation: none;
  }
}

/* ===== Curio shelves (decor) ===== */
.shelf--decor {
  display: flex;
  align-items: flex-end;
  justify-content: space-evenly;
  padding: 30px 24px 0;
  min-height: 168px;
  background:
    radial-gradient(120% 95% at 50% 0%, rgba(255, 206, 130, 0.10), transparent 58%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.15) 30%, rgba(0, 0, 0, 0) 100%),
    linear-gradient(180deg, #160d07, #241610);
}

.decor {
  line-height: 0;
  flex-shrink: 1;
}

/* Warm lamp glow on the book shelf too */
.shelf {
  background:
    radial-gradient(120% 95% at 50% 0%, rgba(255, 206, 130, 0.08), transparent 58%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.15) 30%, rgba(0, 0, 0, 0) 100%),
    linear-gradient(180deg, #160d07, #241610);
}

/* Cabinet feet */
.case-frame {
  position: relative;
}

.case-frame::before,
.case-frame::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 30px;
  height: 10px;
  background: linear-gradient(180deg, var(--wood-mid), var(--wood-dark));
  border-radius: 0 0 3px 3px;
}

.case-frame::before { left: 20px; }
.case-frame::after  { right: 20px; }

/* Gem glint + sparkles under the cloche */
.gem-glint {
  opacity: 0;
  animation: gem-glint 7s ease-in-out infinite;
}

@keyframes gem-glint {
  0%, 80%  { opacity: 0; transform: translateX(-4px); }
  86%      { opacity: 0.85; }
  92%, 100% { opacity: 0; transform: translateX(14px); }
}

.sparkle {
  opacity: 0;
  transform-origin: center;
  animation: sparkle 7s ease-in-out infinite;
}

.sparkle--late { animation-delay: 0.45s; }

@keyframes sparkle {
  0%, 78%   { opacity: 0; transform: scale(0.4); }
  85%       { opacity: 1; transform: scale(1); }
  93%, 100% { opacity: 0; transform: scale(0.5); }
}

@media (max-width: 640px) {
  .shelf--decor {
    min-height: 120px;
    padding: 20px 8px 0;
  }

  .shelf--decor .decor svg {
    width: auto;
    max-width: 24vw;
    height: auto;
    max-height: 110px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gem-glint, .sparkle {
    animation: none;
  }
}
