/* ==========================================================================
   My Small Library
   ========================================================================== */
.lb-stats { display: flex; gap: 12px; }
.lb-stats li {
  min-width: 96px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  background: var(--blue-soft);
  display: flex;
  flex-direction: column;
}
.lb-stats strong { font-size: 34px; font-weight: 500; letter-spacing: var(--track-display); line-height: 1.1; color: var(--blue-text); }
.lb-stats span { font-size: 14px; }

.lb-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.lb-bar__hint { font-size: 15px; color: rgba(0,0,0,.6); }
.lb-arrange { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lb-arrange__label { font-size: 14px; color: rgba(0,0,0,.5); margin-right: 4px; }

/* --------------------------------------------------------------------------
   Bookcase
   -------------------------------------------------------------------------- */
.lb-case {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 18px;
  border-radius: var(--r-xl);
  background: #080ca8;
}
.lb-shelf {
  position: relative;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,.9), rgba(255,255,255,0) 70%),
    var(--blue-soft);
  box-shadow: inset 0 14px 30px -18px rgba(10,31,92,.5);
  padding: 22px 26px 0;
  overflow: hidden;
}
.lb-shelf__label {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--blue-text);
  height: 22px;
}
.lb-shelf__label small { font-size: 12px; opacity: .6; font-weight: 400; }
.lb-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 330px;
  padding: 0 6px;
}
.lb-board {
  height: 18px;
  margin: 0 -26px;
  background: linear-gradient(#d9c2a0, #b8966a);
  box-shadow: 0 -2px 0 rgba(255,255,255,.4) inset, 0 10px 20px -6px rgba(0,0,0,.35);
}

/* Spines */
.lb-spine {
  position: relative;
  flex: 0 0 auto;
  width: var(--w);
  height: var(--h);
  border: 0;
  padding: 0;
  border-radius: 3px 3px 1px 1px;
  background: var(--c);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transform-origin: 50% 100%;
  box-shadow:
    inset 3px 0 0 rgba(255,255,255,.18),
    inset -4px 0 6px rgba(0,0,0,.18),
    0 0 0 1px rgba(0,0,0,.06);
  transition: translate .5s var(--ease-out), box-shadow .5s;
}
.lb-spine::before,
.lb-spine::after {
  /* printed bands near the top and bottom */
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  background: currentColor;
  opacity: .5;
}
.lb-spine::before { top: 14px; }
.lb-spine::after { bottom: 38px; }
.lb-spine__title {
  position: absolute;
  top: 24px; bottom: 46px;
  left: 50%;
  translate: -50% 0;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: clamp(12px, calc(var(--w) * .3), 15px);
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}
.lb-spine__author {
  position: absolute;
  bottom: 12px; left: 0; right: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
}
.lb-spine:hover,
.lb-spine:focus-visible {
  translate: 0 -16px;
  box-shadow: inset 3px 0 0 rgba(255,255,255,.18), inset -4px 0 6px rgba(0,0,0,.18), 0 16px 24px -10px rgba(10,31,92,.5);
  outline: none;
}
.lb-spine:focus-visible { box-shadow: 0 0 0 3px var(--blue), 0 16px 24px -10px rgba(10,31,92,.5); }
.lb-spine.is-out { visibility: hidden; }

/* Tooltip */
.lb-tip {
  position: fixed;
  top: 0; left: 0;
  z-index: 45;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: #000;
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
}
.lb-tip b { display: block; font-weight: 500; font-size: 14px; }

/* Decorations */
.lb-decor { flex: 0 0 auto; margin-left: auto; align-self: flex-end; pointer-events: none; }
.lb-decor svg { display: block; }

/* --------------------------------------------------------------------------
   Reader
   -------------------------------------------------------------------------- */
.lb-reader { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; }
.lb-reader[hidden] { display: none; }
.lb-reader__backdrop { position: absolute; inset: 0; background: rgba(10,31,92,.4); backdrop-filter: blur(8px); }
.lb-reader__panel {
  position: relative;
  width: min(1100px, 100%);
  height: min(720px, calc(100vh - 32px));
  border-radius: var(--r-xl);
  background: #fff;
  overflow: hidden;
  display: grid;
  grid-template-columns: 44% 1fr;
  outline: none;
}
.lb-reader__close {
  position: absolute;
  top: 18px; right: 18px;
  z-index: 3;
  width: 46px; height: 46px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 20px -8px rgba(0,0,0,.3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .5s var(--ease-out);
}
.lb-reader__close:hover { transform: rotate(90deg); }

.lb-reader__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 64px;
  background:
    radial-gradient(60% 50% at 50% 45%, rgba(255,255,255,.55), rgba(255,255,255,0)),
    color-mix(in srgb, var(--c, #dfe0ff) 35%, #f4f6fb);
  perspective: 1400px;
  transition: background-color .6s;
}
.lb-book { --t: 44px; position: relative; width: 230px; height: 340px; }
.lb-book__inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: rotateY(-28deg) rotateX(4deg);
}
.lb-book__inner > div { position: absolute; top: 0; height: 100%; backface-visibility: hidden; }
.lb-book__front {
  left: 0; width: 100%;
  transform: translateZ(calc(var(--t) / 2));
  border-radius: 2px 8px 8px 2px;
  overflow: hidden;
  background: var(--c);
  color: var(--ink);
  box-shadow: inset 6px 0 10px -4px rgba(0,0,0,.3);
  display: flex;
  flex-direction: column;
  padding: 26px 22px 22px 26px;
}
.lb-book__art { position: absolute; inset: 0; opacity: .32; mix-blend-mode: multiply; }
.lb-book__art svg rect:first-child { fill: transparent; }
.lb-book__title {
  position: relative;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: var(--track-heading);
}
.lb-book__author { position: relative; font-size: 14px; margin-top: auto; font-weight: 500; opacity: .85; }
.lb-book__spine {
  left: 0; width: var(--t);
  transform-origin: 0 50%;
  transform: rotateY(-90deg) translateX(calc(var(--t) / -2));
  background: var(--c);
  filter: brightness(.82);
}
.lb-book__pages {
  right: 0; width: var(--t);
  transform-origin: 100% 50%;
  transform: rotateY(90deg) translateX(calc(var(--t) / 2));
  top: 3px !important; height: calc(100% - 6px) !important;
  background: repeating-linear-gradient(90deg, #fbf8f1 0 2px, #e8e1d2 2px 3px);
}
.lb-book__back {
  left: 0; width: 100%;
  transform: rotateY(180deg) translateZ(calc(var(--t) / 2));
  background: var(--c);
  filter: brightness(.7);
  border-radius: 8px 2px 2px 8px;
}
.lb-book::after {
  /* shadow on the "table" */
  content: "";
  position: absolute;
  left: 10%;
  bottom: -34px;
  width: 80%;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(rgba(10,31,92,.35), rgba(10,31,92,0) 70%);
}

.lb-reader__nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.lb-nav {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.2);
  background: rgba(255,255,255,.7);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
  transition: background-color .3s, color .3s, border-color .3s;
}
.lb-nav:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.lb-reader__pos { font-variant-numeric: tabular-nums; min-width: 5ch; text-align: center; }

.lb-reader__content {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 56px 48px 48px;
}
.lb-r__shelf { font-size: 14px; color: var(--blue-text); margin-bottom: 10px; }
.lb-r__title { font-size: clamp(32px, 3.6vw, 48px); font-weight: 500; letter-spacing: var(--track-display); line-height: 1.04; padding-right: 50px; }
.lb-r__author { font-size: 17px; color: rgba(0,0,0,.6); margin-top: 8px; }
.lb-r__meta { display: flex; align-items: center; gap: 14px; margin-top: 18px; font-size: 14px; color: rgba(0,0,0,.55); flex-wrap: wrap; }
.lb-r__stars { color: #f2a900; letter-spacing: 2px; font-size: 17px; }
.lb-r__stars i { font-style: normal; color: rgba(0,0,0,.15); }
.lb-r__h { font-size: 14px; color: rgba(0,0,0,.5); margin: 30px 0 10px; }
.lb-r__summary { font-size: 18px; line-height: 1.6; }
.lb-r__points { counter-reset: n; }
.lb-r__points li {
  counter-increment: n;
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: baseline;
  font-size: 17px;
  line-height: 1.5;
  padding: 11px 0;
  border-top: 1px solid rgba(0,0,0,.08);
}
.lb-r__points li::before {
  content: counter(n, decimal-leading-zero);
  font-size: 13px;
  font-weight: 500;
  color: var(--blue-text);
}
.lb-r__buy { margin-top: 30px; display: flex; gap: 10px; flex-wrap: wrap; }
.lb-r__buy .btn svg { margin-left: 10px; }

@media (max-width: 960px) {
  .lb-case { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .lb-stats li { min-width: 0; }
  .lb-row { min-height: 300px; overflow-x: auto; scrollbar-width: none; }
  .lb-reader { padding: 0; }
  .lb-reader__panel {
    height: 100%;
    border-radius: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow-y: auto;
  }
  .lb-reader__stage { padding: 60px 0 24px; gap: 48px; }
  .lb-book { width: 170px; height: 250px; --t: 34px; }
  .lb-book__title { font-size: 22px; }
  .lb-reader__content { overflow: visible; padding: 32px 22px 44px; }
}
@media (max-width: 600px) {
  .lb-shelf { padding: 18px 16px 0; }
  .lb-board { margin: 0 -16px; }
  .lb-decor { display: none; }
}
