/* ==========================================================
   THE ANGEL ARCHIVE
   THE CELESTIAL LIBRARY

   library.css

   IMPORTANT:
   The Celestial Library intentionally inherits the finished
   visual system of the Celestial TBR.

   TBR owns the shared visual language:
   - celestial hero
   - floating book
   - divider
   - collection background
   - filters
   - count row
   - six-column grid
   - cover frames
   - plaques
   - ribbons
   - Load More
   - sign-off
   - responsive behavior

   Library adds only what is actually unique to Library.
   ========================================================== */


/* ==========================================================
   00. IMPORT THE ACTUAL FINISHED TBR VISUAL SYSTEM
   ========================================================== */

@import url("../tbr/tbr.css");


/* ==========================================================
   01. LIBRARY FOUNDATION

   tbr.css scopes a few foundation rules specifically to
   body.tbr-page.

   The Library needs the exact same foundation without
   pretending to actually be the TBR page.
   ========================================================== */

body.library-page {
  overflow-x: hidden;

  background:
    radial-gradient(
      circle at 78% 7%,
      rgba(246, 214, 217, 0.32),
      transparent 23%
    ),
    radial-gradient(
      circle at 13% 36%,
      rgba(255, 255, 255, 0.95),
      transparent 29%
    ),
    linear-gradient(
      180deg,
      #fffafa 0%,
      #fffdfd 48%,
      #fff8f9 100%
    );

  color: var(--ink-rose);
}


.library-page button,
.library-page input,
.library-page select {
  font: inherit;
}


.library-page button,
.library-page select {
  cursor: pointer;
}


.library-page button {
  color: inherit;
}


.library-page img {
  display: block;
  max-width: 100%;
}



/* ==========================================================
   02. LIBRARY INTRO

   The HTML deliberately uses the real TBR classes, so almost
   everything already comes directly from tbr.css.

   These are Library-only safety rules for the decorative
   sanctuary elements used in our Library markup.
   ========================================================== */

.library-intro {
  position: relative;
}


.tbr-book-sanctuary {
  position: absolute;
  z-index: 2;

  left: 50%;
  top: 50%;

  width: min(94%, 650px);
  aspect-ratio: 1 / 0.72;

  transform: translate(-50%, -50%);

  pointer-events: none;
}


.tbr-book-sanctuary__ring {
  position: absolute;

  left: 50%;
  top: 50%;

  transform: translate(-50%, -50%);

  border-radius: 50%;

  pointer-events: none;
}


.tbr-book-sanctuary__ring--outer {
  width: 92%;
  height: 92%;

  border:
    1px solid
    rgba(200, 121, 133, 0.12);

  box-shadow:
    0 0 50px rgba(246, 214, 217, 0.34),
    inset 0 0 45px rgba(255, 255, 255, 0.55);
}


.tbr-book-sanctuary__ring--inner {
  width: 70%;
  height: 70%;

  border:
    1px solid
    rgba(200, 121, 133, 0.10);

  box-shadow:
    0 0 35px rgba(255, 255, 255, 0.70);
}


.tbr-book-star,
.tbr-book-dust {
  position: absolute;

  color:
    rgba(200, 121, 133, 0.60);

  font-family: var(--font-display);

  line-height: 1;

  text-shadow:
    0 0 8px rgba(255, 255, 255, 1),
    0 0 18px rgba(246, 214, 217, 0.60);

  animation:
    libraryCelestialTwinkle
    4s
    ease-in-out
    infinite;
}


.tbr-book-star--one {
  left: 4%;
  top: 18%;
}


.tbr-book-star--two {
  left: 18%;
  top: 4%;

  font-size: 0.72rem;

  animation-delay: -1.4s;
}


.tbr-book-star--three {
  left: 37%;
  top: 10%;

  font-size: 0.78rem;

  animation-delay: -2.3s;
}


.tbr-book-star--four {
  right: 25%;
  top: 5%;

  animation-delay: -0.8s;
}


.tbr-book-star--five {
  right: 5%;
  top: 22%;

  font-size: 0.72rem;

  animation-delay: -2.8s;
}


.tbr-book-star--six {
  right: 2%;
  bottom: 25%;

  animation-delay: -1.1s;
}


.tbr-book-star--seven {
  right: 20%;
  bottom: 5%;

  font-size: 0.68rem;

  animation-delay: -3.1s;
}


.tbr-book-star--eight {
  left: 38%;
  bottom: 2%;

  animation-delay: -1.7s;
}


.tbr-book-star--nine {
  left: 16%;
  bottom: 10%;

  font-size: 0.72rem;

  animation-delay: -2.4s;
}


.tbr-book-star--ten {
  left: 1%;
  bottom: 31%;

  animation-delay: -0.5s;
}


@keyframes libraryCelestialTwinkle {

  0%,
  100% {
    opacity: 0.26;

    transform:
      translateY(2px)
      scale(0.78);
  }

  50% {
    opacity: 0.92;

    transform:
      translateY(-3px)
      scale(1.14);
  }

}



/* ==========================================================
   03. LIBRARY TOOLBAR

   TBR has:
   Search + Genre + Length + Sort

   Library has:
   Search + Year + Genre + Rating + Format + Sort

   We preserve the exact TBR control components and only
   expand the grid so the additional Library filters fit.
   ========================================================== */

.library-toolbar {
  width: min(1080px, 100%);

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 12px;
}

/* Search — wide first row */
.library-toolbar .tbr-search {
  grid-column: 1 / 4;
}

/* Sort — end of first row */
.library-toolbar .tbr-filter:has(#librarySort) {
  grid-column: 4;
}



/* ==========================================================
   04. LOADING STATE
   ========================================================== */

.library-loading {
  min-height: 270px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  gap: 10px;

  text-align: center;
}


.library-loading[hidden] {
  display: none;
}


.library-loading span {
  color: var(--archive-rose);

  font-family: var(--font-display);
  font-size: 1rem;

  animation:
    libraryLoadingStar
    1.4s
    ease-in-out
    infinite;
}


.library-loading p {
  margin: 0;

  color: var(--dusty-ink);

  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;
}


@keyframes libraryLoadingStar {

  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.8) rotate(-8deg);
  }

  50% {
    opacity: 1;
    transform: scale(1.2) rotate(8deg);
  }

}



/* ==========================================================
   05. LIBRARY BOOK INTERACTION

   Cards retain the REAL TBR visual components.

   Library cards are clickable because they open an
   Archive Entry.
   ========================================================== */

.library-page .tbr-book {
  cursor: pointer;
}


.library-page .tbr-book:focus-visible {
  outline:
    2px solid
    rgba(200, 121, 133, 0.58);

  outline-offset: 7px;

  border-radius: 10px;
}



/* ==========================================================
   06. LIBRARY PLAQUE EXTRAS

   The normal TBR plaque remains untouched.

   Library JS may add:
   - rating
   - Archive Label

   These sit inside the existing plaque rather than replacing
   its design.
   ========================================================== */

.library-book__rating {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: 2px;

  margin-top: 7px;

  color: var(--archive-rose);

  font-family: var(--font-display);
  font-size: 0.66rem;

  line-height: 1;
}


.library-book__rating-star {
  display: inline-block;
}


.library-book__rating-star.is-empty {
  opacity: 0.25;
}


.library-book__label {
  display: block;

  margin-top: 5px;

  overflow: hidden;

  color:
    rgba(200, 121, 133, 0.82);

  font-family: var(--font-body);
  font-size: 0.38rem;
  font-weight: 700;

  line-height: 1.35;

  letter-spacing: 0.11em;
  text-overflow: ellipsis;
  text-transform: uppercase;

  white-space: nowrap;
}

/* ==========================================================
   08. EXPANDED SERIES PANEL
   ========================================================== */

.library-series-panel {
  grid-column: 1 / -1;

  width: 100%;

  margin:
    4px
    0
    22px;

  padding:
    24px
    clamp(16px, 3vw, 34px)
    28px;

  border:
    1px solid
    rgba(200, 121, 133, 0.24);

  border-radius: 18px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 249, 250, 0.92),
      rgba(250, 229, 230, 0.64)
    );

  box-shadow:
    0 18px 45px
    rgba(94, 61, 69, 0.09);
}


.library-series-panel__head {
  display: flex;
  align-items: end;
  justify-content: space-between;

  gap: 18px;

  margin-bottom: 20px;
  padding-bottom: 13px;

  border-bottom:
    1px solid
    rgba(200, 121, 133, 0.18);
}


.library-series-panel__head small {
  display: block;

  margin-bottom: 5px;

  color: var(--archive-rose);

  font-family: var(--font-body);
  font-size: 0.56rem;
  font-weight: 700;

  line-height: 1;

  letter-spacing: 0.18em;
  text-transform: uppercase;
}


.library-series-panel__head h3 {
  margin: 0;

  color: var(--ink-rose);

  font-family: var(--font-display);
  font-size:
    clamp(1.45rem, 3vw, 2.15rem);

  font-weight: 400;
}


.library-series-panel__close {
  padding:
    8px
    12px;

  border:
    1px solid
    rgba(200, 121, 133, 0.30);

  border-radius: 999px;

  background:
    rgba(255, 249, 250, 0.78);

  color: var(--dusty-ink);

  font-family: var(--font-body);
  font-size: 0.56rem;
  font-weight: 700;

  line-height: 1;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}


.library-series-panel__books {
  display: grid;

  grid-template-columns:
    repeat(
      auto-fill,
      minmax(165px, 1fr)
    );

  gap: 22px;
}


.library-series-panel__books
.tbr-book {
  min-width: 0;
}



/* ==========================================================
   09. EMPTY STATE
   ========================================================== */

.library-empty {
  width: min(520px, 100%);

  margin:
    34px
    auto
    20px;

  padding:
    42px
    24px;

  text-align: center;
}


.library-empty[hidden] {
  display: none;
}


.library-empty > span {
  display: block;

  margin-bottom: 10px;

  color: var(--archive-rose);

  font-family: var(--font-display);
  font-size: 1rem;
}


.library-empty h3 {
  margin:
    0
    0
    5px;

  color: var(--ink-rose);

  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
}


.library-empty p {
  margin: 0;

  color: var(--dusty-ink);

  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;
}



/* ==========================================================
   10. ARCHIVE ENTRY MODAL
   ========================================================== */

.library-modal {
  position: fixed;
  z-index: 9999;

  inset: 0;

  display: none;
  place-items: center;

  padding: 30px;

  overflow-y: auto;
}


.library-modal.is-open {
  display: grid;
}


.library-modal__backdrop {
  position: fixed;

  inset: 0;

  background:
    rgba(94, 61, 69, 0.27);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}


.library-modal__window {
  position: relative;
  z-index: 2;

  width: min(920px, 100%);

  max-height:
    calc(100vh - 60px);

  overflow-y: auto;

  padding:
    36px
    clamp(22px, 4vw, 46px)
    42px;

  border:
    1px solid
    rgba(200, 121, 133, 0.28);

  border-radius: 24px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 253, 253, 0.98),
      rgba(255, 249, 250, 0.97) 50%,
      rgba(250, 229, 230, 0.92)
    );

  box-shadow:
    0 32px 90px
    rgba(94, 61, 69, 0.22),
    0 0 50px
    rgba(246, 214, 217, 0.50),
    inset 0 0 0 1px
    rgba(255, 255, 255, 0.72);
}


.library-modal__window::before {
  content: "";

  position: absolute;

  inset: 7px;

  border:
    1px solid
    rgba(200, 121, 133, 0.09);

  border-radius: 18px;

  pointer-events: none;
}


.library-modal__close {
  position: absolute;
  z-index: 5;

  right: 18px;
  top: 16px;

  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  padding: 0;

  border:
    1px solid
    rgba(200, 121, 133, 0.24);

  border-radius: 50%;

  background:
    rgba(255, 255, 255, 0.72);

  color: var(--archive-rose);

  font-family: var(--font-display);
  font-size: 1.35rem;

  line-height: 1;

  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}


.library-modal__close:hover {
  transform:
    rotate(8deg)
    scale(1.06);

  background: #ffffff;

  box-shadow:
    0 7px 20px
    rgba(200, 121, 133, 0.14);
}


.library-modal__ornament {
  width: min(360px, 70%);

  margin:
    0
    auto
    27px;

  display: grid;
  grid-template-columns:
    1fr
    auto
    1fr;

  align-items: center;

  gap: 13px;
}


.library-modal__ornament span {
  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(200, 121, 133, 0.24)
    );
}


.library-modal__ornament span:last-child {
  background:
    linear-gradient(
      90deg,
      rgba(200, 121, 133, 0.24),
      transparent
    );
}


.library-modal__ornament b {
  color:
    rgba(200, 121, 133, 0.68);

  font-family: var(--font-display);
  font-size: 0.56rem;
  font-weight: 400;

  letter-spacing: 0.12em;
}



/* ==========================================================
   11. ARCHIVE ENTRY CONTENT
   Generated by library.js
   ========================================================== */

.library-entry {
  display: grid;

  grid-template-columns:
    minmax(190px, 250px)
    minmax(0, 1fr);

  align-items: start;

  gap:
    clamp(24px, 4vw, 44px);
}


.library-entry__cover {
  position: relative;

  padding: 7px;

  border:
    1px solid
    rgba(200, 121, 133, 0.28);

  border-radius: 12px;

  background:
    rgba(255, 255, 255, 0.60);

  box-shadow:
    0 18px 38px
    rgba(94, 61, 69, 0.12);
}


.library-entry__cover img {
  width: 100%;

  aspect-ratio: 2 / 3;

  object-fit: cover;

  border-radius: 7px;
}


.library-entry__placeholder {
  width: 100%;

  aspect-ratio: 2 / 3;

  display: grid;
  place-items: center;

  padding: 24px;

  border-radius: 7px;

  background:
    linear-gradient(
      145deg,
      #fffdfd,
      #fae5e6
    );

  color: var(--archive-rose);

  text-align: center;
}


.library-entry__placeholder span {
  font-family: var(--font-display);
  font-size: 2rem;
}


.library-entry__eyebrow {
  margin:
    0
    0
    7px;

  color: var(--archive-rose);

  font-family: var(--font-body);
  font-size: 0.56rem;
  font-weight: 700;

  letter-spacing: 0.18em;
  text-transform: uppercase;
}


.library-entry__title {
  margin: 0;

  color: var(--ink-rose);

  font-family: var(--font-display);
  font-size:
    clamp(2.2rem, 5vw, 3.5rem);

  font-weight: 400;

  line-height: 0.96;

  letter-spacing: -0.035em;
}


.library-entry__author {
  margin:
    8px
    0
    0;

  color: var(--dusty-ink);

  font-family: var(--font-display);
  font-size: 1.12rem;
  font-style: italic;
}


.library-entry__rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;

  gap: 9px;

  margin-top: 15px;
}


.library-entry__stars {
  color: var(--archive-rose);

  font-family: var(--font-display);
  font-size: 0.86rem;

  letter-spacing: 0.06em;
}


.library-entry__archive-label {
  padding:
    6px
    10px;

  border:
    1px solid
    rgba(200, 121, 133, 0.22);

  border-radius: 999px;

  background:
    rgba(250, 229, 230, 0.48);

  color: var(--archive-rose);

  font-family: var(--font-body);
  font-size: 0.48rem;
  font-weight: 700;

  letter-spacing: 0.12em;
  text-transform: uppercase;
}


.library-entry__facts {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap:
    10px
    18px;

  margin-top: 22px;
}


.library-entry__fact {
  padding:
    9px
    0;

  border-bottom:
    1px solid
    rgba(200, 121, 133, 0.13);
}


.library-entry__fact small {
  display: block;

  margin-bottom: 3px;

  color:
    rgba(200, 121, 133, 0.76);

  font-family: var(--font-body);
  font-size: 0.43rem;
  font-weight: 700;

  letter-spacing: 0.14em;
  text-transform: uppercase;
}


.library-entry__fact span {
  color: var(--ink-rose);

  font-family: var(--font-display);
  font-size: 0.94rem;
}


.library-entry__section {
  margin-top: 25px;
}


.library-entry__section h3 {
  margin:
    0
    0
    8px;

  color: var(--archive-rose);

  font-family: var(--font-body);
  font-size: 0.52rem;
  font-weight: 700;

  letter-spacing: 0.16em;
  text-transform: uppercase;
}


.library-entry__section p {
  margin: 0;

  color: var(--dusty-ink);

  font-family: var(--font-display);
  font-size: 1rem;

  line-height: 1.65;
}


.library-entry__verdict p {
  color: var(--ink-rose);

  font-size: 1.18rem;
  font-style: italic;
}


.library-entry__quote {
  position: relative;

  padding:
    18px
    20px;

  border-left:
    2px solid
    rgba(200, 121, 133, 0.48);

  background:
    rgba(250, 229, 230, 0.28);
}


.library-entry__quote p {
  font-style: italic;
}


.library-entry__actions {
  display: flex;
  flex-wrap: wrap;

  gap: 10px;

  margin-top: 28px;
}


.library-entry__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 42px;

  padding:
    0
    18px;

  border:
    1px solid
    rgba(200, 121, 133, 0.28);

  border-radius: 999px;

  background:
    rgba(255, 255, 255, 0.68);

  color: var(--archive-rose);

  font-family: var(--font-body);
  font-size: 0.52rem;
  font-weight: 700;

  letter-spacing: 0.11em;
  text-decoration: none;
  text-transform: uppercase;

  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}


.library-entry__link:hover {
  transform: translateY(-2px);

  background: #ffffff;

  box-shadow:
    0 9px 22px
    rgba(200, 121, 133, 0.13);
}



/* ==========================================================
   12. BODY LOCK WHEN ARCHIVE ENTRY IS OPEN
   ========================================================== */

body.library-modal-open {
  overflow: hidden;
}



/* ==========================================================
   13. RESPONSIVE — LIBRARY-SPECIFIC

   The imported TBR CSS still controls all shared TBR
   components.

   These rules only account for Library's additional filters
   and Archive Entry modal.
   ========================================================== */



@media (max-width: 900px) {

  .library-toolbar {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }


  .library-toolbar .tbr-search {
    grid-column:
      1 / -1;
  }


  .library-entry {
    grid-template-columns:
      180px
      minmax(0, 1fr);

    gap: 25px;
  }

}



@media (max-width: 640px) {

  .library-toolbar {
    grid-template-columns: 1fr;
  }


  .library-toolbar .tbr-search {
    grid-column: auto;
  }


  .library-series-panel__head {
    align-items: flex-start;
    flex-direction: column;
  }


  .library-series-panel__books {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 14px;
  }


  .library-modal {
    padding: 14px;
  }


  .library-modal__window {
    max-height:
      calc(100vh - 28px);

    padding:
      48px
      18px
      28px;

    border-radius: 19px;
  }


  .library-entry {
    grid-template-columns: 1fr;
  }


  .library-entry__cover {
    width: min(210px, 72%);

    margin: 0 auto;
  }


  .library-entry__details {
    text-align: center;
  }


  .library-entry__rating,
  .library-entry__actions {
    justify-content: center;
  }


  .library-entry__facts {
    grid-template-columns: 1fr;

    text-align: left;
  }


  .library-entry__section {
    text-align: left;
  }

}



/* ==========================================================
   14. REDUCED MOTION
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

  .tbr-book-star,
  .library-loading span,
  .library-series__cover {
    animation: none;
    transition: none;
  }


  .library-modal__close,
  .library-entry__link {
    transition: none;
  }

}


/* ✦ END — THE CELESTIAL LIBRARY ✦ */

/* ==========================================================
   07. SERIES STACKS

   LITERAL TBR SERIES COMPONENT
   ========================================================== */

.tbr-series {
  position: relative;
  min-width: 0;
}


.tbr-series__button {
  appearance: none;

  display: block;

  width: 100%;

  border: 0;
  padding: 0;
  margin: 0;

  background: transparent;

  color: inherit;

  font: inherit;

  text-align: inherit;

  cursor: pointer;
}


.tbr-series__cover-wrap {
  overflow: visible;
}


.tbr-series__covers {
  position: absolute;

  inset: 6px;

  z-index: 1;
}


.tbr-series__cover {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;

  border-radius: 6px;

  background: #fff9fa;

  box-shadow:
    0 12px 24px
    rgba(94, 61, 69, 0.14);

  transition:
    transform 0.25s ease,
    filter 0.25s ease;
}


.tbr-series__cover--1 {
  z-index: 1;

  transform:
    translateX(-10px)
    rotate(-4deg)
    scale(0.94);
}


.tbr-series__cover--2 {
  z-index: 2;

  transform:
    translateX(10px)
    rotate(4deg)
    scale(0.97);
}


.tbr-series__cover--3 {
  z-index: 3;

  transform:
    translateX(0)
    rotate(0)
    scale(1);
}


/* Two-book stacks */

.tbr-series--two
.tbr-series__cover--1 {
  z-index: 1;

  transform:
    translateX(7px)
    rotate(2.6deg)
    scale(0.965);
}


.tbr-series--two
.tbr-series__cover--2 {
  z-index: 2;

  transform:
    translateX(0)
    rotate(0)
    scale(1);
}


/* Hover */

.tbr-series:hover
.tbr-series__cover--1 {
  transform:
    translateX(-15px)
    rotate(-6deg)
    scale(0.95);
}


.tbr-series:hover
.tbr-series__cover--2 {
  transform:
    translateX(15px)
    rotate(6deg)
    scale(0.98);
}


.tbr-series:hover
.tbr-series__cover--3 {
  transform:
    translateY(-4px);
}


.tbr-series--two:hover
.tbr-series__cover--1 {
  transform:
    translateX(10px)
    rotate(3.5deg)
    scale(0.97);
}


.tbr-series--two:hover
.tbr-series__cover--2 {
  transform:
    translateY(-4px)
    scale(1.005);
}


.tbr-series__ribbon {
  z-index: 12;
}


.tbr-series__plaque
.tbr-series__view {
  font-style: normal;
}

/* ==========================================================
   INDIVIDUAL BOOK PLAQUE VERDICT
   ========================================================== */

.library-book__verdict {
  margin-top: 5px;
}


.library-book__stars {
  color: var(--archive-rose);

  font-size: 0.48rem;

  letter-spacing: 0.04em;
}


.library-book__archive-label {
  color: var(--archive-rose);

  font-weight: 700;

  letter-spacing: 0.07em;
}

/* ==========================================================
   ARCHIVE ENTRY SCROLLBAR
   Exact treatment from Relics
   ========================================================== */

.library-modal__window {
  scrollbar-width: thin;
  scrollbar-color:
    rgba(200, 121, 133, 0.25)
    transparent;
}

.library-modal__window::-webkit-scrollbar {
  width: 4px;
}

.library-modal__window::-webkit-scrollbar-track {
  background: transparent;
}

.library-modal__window::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background:
    rgba(200, 121, 133, 0.25);
}

/* ==========================================================
   ARCHIVE SCALE SCROLLBAR
   Matches Archive Entry
   ========================================================== */

.archive-scale__window {
  scrollbar-width: thin;
  scrollbar-color:
    rgba(200, 121, 133, 0.25)
    transparent;
}

.archive-scale__window::-webkit-scrollbar {
  width: 4px;
}

.archive-scale__window::-webkit-scrollbar-track {
  background: transparent;
}

.archive-scale__window::-webkit-scrollbar-thumb {
  border-radius: 999px;

  background:
    rgba(200, 121, 133, 0.25);
}

/* ==========================================================
   ARCHIVE ENTRY — REVIEW GIFS + IMAGES
   ========================================================== */

.library-entry__review img {
  display: block;

  width: auto;
  max-width: min(360px, 100%);
  height: auto;

  margin:
    22px
    auto;

  border-radius: 10px;

  box-shadow:
    0 12px 30px
    rgba(94, 61, 69, 0.10);
}


.library-entry__review s,
.library-entry__review strike {
  opacity: 0.72;
}


.library-entry__review blockquote {
  margin:
    26px
    clamp(10px, 4vw, 34px);

  color: var(--ink-rose);

  font-style: italic;
  font-weight: 600;

  line-height: 1.65;
}

/* ==========================================================
   15. THE ARCHIVE SCALE
   ========================================================== */

.archive-scale {
  position: fixed;
  z-index: 10000;

  inset: 0;

  display: none;
  place-items: center;

  padding: 30px;

  overflow-y: auto;
}


.archive-scale.is-open {
  display: grid;
}


.archive-scale__backdrop {
  position: fixed;

  inset: 0;

  background:
    rgba(94, 61, 69, 0.27);

  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}


.archive-scale__window {
  position: relative;
  z-index: 2;

  width: min(720px, 100%);

  max-height:
    calc(100vh - 60px);

  overflow-y: auto;

  padding:
    42px
    clamp(24px, 5vw, 58px)
    38px;

  border:
    1px solid
    rgba(200, 121, 133, 0.28);

  border-radius: 24px;

  background:
    radial-gradient(
      circle at 50% 0%,
      rgba(246, 214, 217, 0.48),
      transparent 34%
    ),
    linear-gradient(
      145deg,
      rgba(255, 253, 253, 0.99),
      rgba(255, 249, 250, 0.98) 52%,
      rgba(250, 229, 230, 0.94)
    );

  box-shadow:
    0 32px 90px
    rgba(94, 61, 69, 0.22),
    0 0 55px
    rgba(246, 214, 217, 0.55),
    inset 0 0 0 1px
    rgba(255, 255, 255, 0.78);

  text-align: center;
}


.archive-scale__window::before {
  content: "";

  position: absolute;

  inset: 7px;

  border:
    1px solid
    rgba(200, 121, 133, 0.10);

  border-radius: 18px;

  pointer-events: none;
}


/* Close */

.archive-scale__close {
  position: absolute;
  z-index: 5;

  right: 18px;
  top: 16px;

  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  padding: 0;

  border:
    1px solid
    rgba(200, 121, 133, 0.24);

  border-radius: 50%;

  background:
    rgba(255, 255, 255, 0.72);

  color: var(--archive-rose);

  font-family: var(--font-display);
  font-size: 1.35rem;

  line-height: 1;

  transition:
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}


.archive-scale__close:hover {
  transform:
    rotate(8deg)
    scale(1.06);

  background: #ffffff;

  box-shadow:
    0 7px 20px
    rgba(200, 121, 133, 0.14);
}


/* Floating celestial details */

.archive-scale__celestial {
  position: absolute;

  inset: 0;

  overflow: hidden;

  pointer-events: none;
}


.archive-scale__celestial span {
  position: absolute;

  color:
    rgba(200, 121, 133, 0.34);

  font-family: var(--font-display);

  text-shadow:
    0 0 12px
    rgba(246, 214, 217, 0.9);

  animation:
    archiveScaleTwinkle
    3.8s
    ease-in-out
    infinite;
}


.archive-scale__celestial span:nth-child(1) {
  left: 8%;
  top: 13%;
}


.archive-scale__celestial span:nth-child(2) {
  right: 11%;
  top: 22%;

  animation-delay: -1.2s;
}


.archive-scale__celestial span:nth-child(3) {
  left: 7%;
  bottom: 19%;

  animation-delay: -2.2s;
}


.archive-scale__celestial span:nth-child(4) {
  right: 8%;
  bottom: 13%;

  animation-delay: -0.7s;
}


.archive-scale__celestial span:nth-child(5) {
  right: 25%;
  top: 7%;

  font-size: 0.65rem;

  animation-delay: -2.8s;
}


@keyframes archiveScaleTwinkle {

  0%,
  100% {
    opacity: 0.28;
    transform: scale(0.82);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.15);
  }

}


/* Header */

.archive-scale__header {
  position: relative;
  z-index: 2;

  width: min(540px, 100%);

  margin: 0 auto;
}


.archive-scale__eyebrow {
  margin:
    0
    0
    8px;

  color: var(--archive-rose);

  font-family: var(--font-body);
  font-size: 0.54rem;
  font-weight: 700;

  letter-spacing: 0.19em;
  text-transform: uppercase;
}


.archive-scale__header h2 {
  margin: 0;

  color: var(--ink-rose);

  font-family: var(--font-display);
  font-size:
    clamp(2.7rem, 7vw, 4.5rem);

  font-weight: 400;

  line-height: 0.95;

  letter-spacing: -0.04em;
}


.archive-scale__header h2 em {
  color: var(--archive-rose);

  font-family: "Allura", cursive;
  font-size: 1.12em;
  font-weight: 400;
}


.archive-scale__header > p:last-child {
  width: min(450px, 100%);

  margin:
    16px
    auto
    0;

  color: var(--dusty-ink);

  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;

  line-height: 1.55;
}


/* Rating selector */

.archive-scale__ratings {
  position: relative;
  z-index: 2;

  display: flex;
  align-items: flex-start;
  justify-content: center;

  gap:
    clamp(8px, 2vw, 18px);

  margin:
    30px
    auto
    27px;
}


.archive-scale__rating {
  appearance: none;

  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 7px;

  padding: 0;

  border: 0;

  background: transparent;

  color:
    rgba(200, 121, 133, 0.24);

  transition:
    color 180ms ease,
    transform 180ms ease,
    filter 180ms ease;
}


.archive-scale__rating span {
  font-family: var(--font-display);
  font-size:
    clamp(1.7rem, 5vw, 2.5rem);

  line-height: 1;
}


.archive-scale__rating small {
  color:
    rgba(94, 61, 69, 0.54);

  font-family: var(--font-body);
  font-size: 0.46rem;
  font-weight: 700;

  letter-spacing: 0.12em;
}


.archive-scale__rating.is-lit,
.archive-scale__rating.is-selected {
  color: var(--archive-rose);

  filter:
    drop-shadow(
      0 0 8px
      rgba(246, 214, 217, 0.95)
    );
}


.archive-scale__rating.is-selected {
  transform:
    translateY(-4px)
    scale(1.08);
}


/* Selected record */

.archive-scale__record {
  position: relative;
  z-index: 2;

  width: min(500px, 100%);

  min-height: 190px;

  margin: 0 auto;

  padding:
    27px
    clamp(20px, 5vw, 38px);

  border:
    1px solid
    rgba(200, 121, 133, 0.20);

  border-radius: 18px;

  background:
    rgba(255, 255, 255, 0.54);

  box-shadow:
    0 16px 38px
    rgba(94, 61, 69, 0.07),
    inset 0 0 24px
    rgba(246, 214, 217, 0.18);

  transition:
    transform 220ms ease,
    box-shadow 220ms ease;
}


.archive-scale__record.is-changing {
  transform: scale(0.985);
}


.archive-scale__record-star {
  display: block;

  margin-bottom: 7px;

  color: var(--archive-rose);

  font-size: 0.72rem;
}


.archive-scale__record-eyebrow {
  margin:
    0
    0
    5px;

  color:
    rgba(200, 121, 133, 0.72);

  font-family: var(--font-body);
  font-size: 0.45rem;
  font-weight: 700;

  letter-spacing: 0.16em;
  text-transform: uppercase;
}


.archive-scale__record h3 {
  margin: 0;

  color: var(--ink-rose);

  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
}


.archive-scale__record-stars {
  margin-top: 7px;

  color: var(--archive-rose);

  font-family: var(--font-display);
  font-size: 0.8rem;

  letter-spacing: 0.08em;
}


.archive-scale__record > p:last-child {
  margin:
    13px
    auto
    0;

  color: var(--dusty-ink);

  font-family: var(--font-display);
  font-size: 0.98rem;

  line-height: 1.55;
}


.archive-scale__philosophy {
  position: relative;
  z-index: 2;

  width: min(500px, 100%);

  margin:
    17px
    auto
    0;
}


.archive-scale__note {
  appearance: none;

  width: auto;

  padding:
    4px
    8px;

  border: 0;

  background: transparent;

  color:
    rgba(94, 61, 69, 0.56);

  font-family: var(--font-display);
  font-size: 0.82rem;
  font-style: italic;

  line-height: 1.4;

  transition:
    color 180ms ease,
    transform 180ms ease,
    text-shadow 180ms ease;
}


.archive-scale__note:hover,
.archive-scale__note[aria-expanded="true"] {
  color: var(--archive-rose);

  transform:
    translateY(-1px);

  text-shadow:
    0 0 12px
    rgba(246, 214, 217, 0.72);
}


.archive-scale__note span {
  display: inline-block;

  margin:
    0
    4px;

  color:
    rgba(200, 121, 133, 0.66);
}


.archive-scale__note-panel {
  margin-top: 14px;

  padding:
    17px
    20px;

  border-top:
    1px solid
    rgba(200, 121, 133, 0.14);

  animation:
    archiveScaleNoteReveal
    220ms
    ease
    both;
}


.archive-scale__note-panel[hidden] {
  display: none;
}


.archive-scale__note-eyebrow {
  margin:
    0
    0
    7px;

  color: var(--archive-rose);

  font-family: var(--font-body);
  font-size: 0.43rem;
  font-weight: 700;

  letter-spacing: 0.15em;
  text-transform: uppercase;
}


.archive-scale__note-panel
p:not(.archive-scale__note-eyebrow) {
  width: min(440px, 100%);

  margin: 0 auto;

  color: var(--dusty-ink);

  font-family: var(--font-display);
  font-size: 0.88rem;

  line-height: 1.55;
}


.archive-scale__note-panel strong {
  color: var(--ink-rose);

  font-weight: 600;
}


@keyframes archiveScaleNoteReveal {

  from {
    opacity: 0;

    transform:
      translateY(-5px);
  }

  to {
    opacity: 1;

    transform:
      translateY(0);
  }

}


/* Open body lock */

body.archive-scale-open {
  overflow: hidden;
}


/* Mobile */

@media (max-width: 640px) {

  .archive-scale {
    padding: 14px;
  }


  .archive-scale__window {
    max-height:
      calc(100vh - 28px);

    padding:
      50px
      18px
      28px;

    border-radius: 19px;
  }


  .archive-scale__ratings {
    gap: 9px;
  }


  .archive-scale__rating span {
    font-size: 1.65rem;
  }


  .archive-scale__record {
    min-height: 0;
  }

}


/* Reduced motion */

@media (prefers-reduced-motion: reduce) {

  .archive-scale__celestial span,
  .archive-scale__rating,
  .archive-scale__record,
  .archive-scale__close {
    animation: none;
    transition: none;
  }

}

/* ==========================================================
   ARCHIVE SCALE — READABILITY POLISH
   ========================================================== */

/* Main five rating stars */

.archive-scale__rating span {
  font-size:
    clamp(2.15rem, 5vw, 3rem);
}


/* Numbers underneath stars */

.archive-scale__rating small {
  margin-top: 2px;

  font-size: 0.58rem;

  letter-spacing: 0.10em;
}


/* Selected classification name */

.archive-scale__record h3 {
  font-size: 2rem;
}


/* Stars inside classification record */

.archive-scale__record-stars {
  margin-top: 9px;

  font-size: 0.95rem;

  letter-spacing: 0.09em;
}


/* Actual rating description */

.archive-scale__record > p:last-child {
  width: min(440px, 100%);

  margin:
    15px
    auto
    0;

  font-size: 1.08rem;

  line-height: 1.65;
}


/* Clickable "don't take my reviews..." line */

.archive-scale__note {
  font-size: 0.94rem;

  line-height: 1.5;
}


/* Archivist's Note heading */

.archive-scale__note-eyebrow {
  font-size: 0.52rem;

  letter-spacing: 0.16em;
}


/* Archivist's Note body */

.archive-scale__note-panel
p:not(.archive-scale__note-eyebrow) {
  width: min(460px, 100%);

  font-size: 1rem;

  line-height: 1.65;
}
/* ==========================================================
   16. LIBRARY ATMOSPHERE PASS — HERO + COLLECTION TRANSITION
   ========================================================== */

/*
  Swap only this URL whenever you want a different Library hero
  background. The pearl overlays below stay in place so the copy
  and floating book remain readable regardless of the image.
*/
.library-intro {
  isolation: isolate;
  overflow: hidden;

  background-image:
    linear-gradient(
      90deg,
      rgba(255, 251, 251, 0.94) 0%,
      rgba(255, 250, 251, 0.82) 34%,
      rgba(255, 249, 250, 0.48) 62%,
      rgba(255, 248, 249, 0.36) 100%
    ),
    radial-gradient(
      circle at 73% 42%,
      rgba(255, 255, 255, 0.86),
      rgba(246, 214, 217, 0.18) 34%,
      transparent 62%
    ),
    url("../assets/images/shelf-arches.jpg");

  background-position:
    center,
    center,
    center 44%;

  background-size:
    cover,
    cover,
    cover;

  background-repeat: no-repeat;
}

/* soft pearl veil keeps the hero dreamy instead of busy */
.library-intro::before {
  content: "";

  position: absolute;
  z-index: -1;

  inset: 0;

  pointer-events: none;

  background:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(255, 255, 255, 0.82),
      transparent 52%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.16) 0%,
      rgba(255, 250, 251, 0.05) 58%,
      rgba(255, 246, 248, 0.78) 100%
    );
}

/* the actual glowing handoff into Choose Your Story */
.library-intro::after {
  content: "";

  position: absolute;
  z-index: 4;

  left: -5%;
  right: -5%;
  bottom: -48px;

  height: 112px;

  pointer-events: none;

  background:
    radial-gradient(
      ellipse at center,
      rgba(255, 255, 255, 0.98) 0%,
      rgba(255, 244, 247, 0.90) 24%,
      rgba(246, 214, 217, 0.46) 50%,
      rgba(246, 214, 217, 0.10) 70%,
      transparent 82%
    );

  filter: blur(10px);

  opacity: 0.96;
}

/* let the ornamental divider sit inside the bloom rather than
   reading as a hard section break */
.library-page .tbr-divider {
  position: relative;
  z-index: 7;

  margin-top: -26px;
  margin-bottom: -18px;

  filter:
    drop-shadow(0 0 11px rgba(255, 255, 255, 0.98))
    drop-shadow(0 0 16px rgba(246, 214, 217, 0.62));
}

/*
  The decorative collection artwork now continues with the Library.
  As Load More makes the section taller, the celestial environment
  repeats vertically instead of stopping midway through the shelves.
*/
.library-collection {
  position: relative;
  isolation: isolate;

  background-color: #fff7f8;
  background-repeat: repeat-y !important;
  background-position: top center !important;
  background-size: 100% auto !important;
}

/* soft veil keeps repeated artwork from becoming too busy */
.library-collection::before {
  content: "";

  position: absolute;
  z-index: -1;

  inset: 0;

  pointer-events: none;

  background:
    linear-gradient(
      180deg,
      rgba(255, 247, 249, 0.04) 0%,
      rgba(255, 247, 249, 0.12) 34rem,
      rgba(255, 247, 249, 0.78) 62rem,
      rgba(255, 249, 250, 0.94) 100%
    ),
    radial-gradient(
      circle at 18% 42%,
      rgba(255, 255, 255, 0.36),
      transparent 28rem
    ),
    radial-gradient(
      circle at 84% 68%,
      rgba(246, 214, 217, 0.22),
      transparent 30rem
    );
}

/* a little pearl light at the collection entrance so the hero
   bloom dissolves into the existing collection world */
.library-collection::after {
  content: "";

  position: absolute;
  z-index: -1;

  left: 0;
  right: 0;
  top: 0;

  height: 150px;

  pointer-events: none;

  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.78),
      rgba(255, 248, 249, 0.28) 42%,
      transparent 100%
    );
}

@media (max-width: 900px) {
  .library-intro {
    background-position:
      center,
      center,
      62% center;
  }

  .library-page .tbr-divider {
    margin-top: -18px;
    margin-bottom: -12px;
  }
}

@media (max-width: 640px) {
  .library-intro {
    background-image:
      linear-gradient(
        180deg,
        rgba(255, 251, 251, 0.92),
        rgba(255, 248, 250, 0.68)
      ),
      url("../assets/images/shelf-arches.jpg");

    background-position:
      center,
      center;
  }

  .library-intro::after {
    bottom: -34px;
    height: 84px;
  }

  .library-collection {
    background-size: auto 760px !important;
  }
}

/* ✦ END — LIBRARY ATMOSPHERE PASS ✦ */


/* ==========================================================
   LIBRARY PLAQUE + CONTINUOUS SHELVES POLISH
   ========================================================== */

/* Give every plaque enough room for title, author and verdict. */
.library-page .tbr-book__plaque {
  min-height: 104px;
  height: auto;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* The verdict is the single rating treatment on normal books. */
.library-book__verdict {
  min-height: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 3px 6px;
  margin-top: 6px;
}

.library-book__verdict b {
  font-size: 0.70rem;
  font-weight: 400;
  opacity: 0.72;
}

/* Series plaques get a true average of the rated books in the stack. */
.library-series__average {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 6px;
  font-style: normal;
}

.library-series__average-score {
  color: var(--archive-rose);
  font-family: var(--font-body);
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.library-series__view {
  margin-top: 4px;
}

@media (max-width: 640px) {
  .library-page .tbr-book__plaque {
    min-height: 98px;
  }
}

/* ✦ END — LIBRARY PLAQUE + CONTINUOUS SHELVES POLISH ✦ */


/* ==========================================================
   18. LIBRARY CONTINUOUS CELESTIAL FIELD + PLAQUE READABILITY
   ========================================================== */

/*
  IMPORTANT: the artwork is its own repeating background layer.
  Do not stretch it to the full collection height; that was what
  made the celestial field appear to fade away after the first row.
*/
.library-collection {
  background-color: #fff7f8 !important;
  background-image:
    linear-gradient(
      rgba(255, 249, 250, 0.08),
      rgba(255, 249, 250, 0.08)
    ),
    url("../assets/tbr/tbr-vault-bg.png") !important;
  background-size:
    100% 100%,
    100% auto !important;
  background-position:
    center top,
    center top !important;
  background-repeat:
    no-repeat,
    repeat-y !important;
}

/* Keep the veil even from top to bottom instead of whitening out. */
.library-collection::before {
  background:
    linear-gradient(
      180deg,
      rgba(255, 247, 249, 0.05),
      rgba(255, 247, 249, 0.10)
    ),
    radial-gradient(
      circle at 18% 42%,
      rgba(255, 255, 255, 0.18),
      transparent 28rem
    ),
    radial-gradient(
      circle at 84% 68%,
      rgba(246, 214, 217, 0.12),
      transparent 30rem
    ) !important;
}

/* More readable plaques without making them giant. */
.library-page .tbr-book__plaque {
  min-height: 94px;
  padding: 9px 8px 8px;
}

.library-page .tbr-book__title,
.library-page .tbr-series__plaque .tbr-book__title {
  font-size: 0.96rem;
  line-height: 1.12;
}

.library-page .tbr-book__author,
.library-page .tbr-series__plaque .tbr-book__author {
  margin-top: 5px;
  font-size: 0.72rem;
  line-height: 1.15;
}

.library-book__verdict,
.library-series__average {
  margin-top: 6px;
}

.library-book__stars,
.library-series__average .library-book__stars {
  font-size: 0.72rem;
}

.library-book__verdict b,
.library-series__average-score {
  font-size: 0.66rem;
  line-height: 1.1;
}

.library-book__view,
.library-series__view {
  margin-top: 6px;
  font-size: 0.64rem;
  line-height: 1;
  letter-spacing: 0.08em;
  font-style: normal;
}

@media (max-width: 640px) {
  .library-collection {
    background-size:
      100% 100%,
      auto 760px !important;
  }

  .library-page .tbr-book__plaque {
    min-height: 90px;
  }
}

/* ✦ END — LIBRARY CONTINUITY + PLAQUE READABILITY ✦ */


/* ==========================================================
   19. FINAL PLAQUE TYPOGRAPHY — AUTHORITATIVE
   Keep this LAST so TBR inheritance + older Library passes
   cannot make standalone and series plaques drift apart.
   ========================================================== */

.library-page .tbr-book__plaque {
  min-height: 98px;
  padding: 10px 9px 9px;
}

/* Titles */
.library-page .tbr-book__plaque .tbr-book__title,
.library-page .tbr-series__plaque .tbr-book__title {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.12;
}

/* Authors — deliberately readable, not whisper-sized */
.library-page .tbr-book__plaque .tbr-book__author,
.library-page .tbr-series__plaque .tbr-book__author {
  margin-top: 6px;
  font-size: 0.82rem;
  line-height: 1.15;
  opacity: 0.82;
}

/* Standalone + series rating rows share the same rhythm */
.library-page .library-book__verdict,
.library-page .library-series__average {
  min-height: 17px;
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1;
}

/* Stars are identical on both plaque types */
.library-page .library-book__stars,
.library-page .library-series__average .library-book__stars {
  font-size: 0.74rem;
  line-height: 1;
  letter-spacing: 0.04em;
}

/* HEAVENLY / ASCENDED and 5.00 AVG / 4.67 AVG */
.library-page .library-book__verdict b,
.library-page .library-series__average-score {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 1;
}

/* VIEW ENTRY and VIEW SERIES are now truly synonymous */
.library-page .library-book__view,
.library-page .library-series__view,
.library-page .tbr-series__plaque .tbr-series__view {
  margin-top: 7px;
  font-family: var(--font-body);
  font-size: 0.64rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-style: normal;
  opacity: 0.78;
}

@media (max-width: 640px) {
  .library-page .tbr-book__plaque {
    min-height: 94px;
  }

  .library-page .tbr-book__plaque .tbr-book__author,
  .library-page .tbr-series__plaque .tbr-book__author {
    font-size: 0.76rem;
  }
}

/* ✦ END — FINAL PLAQUE TYPOGRAPHY ✦ */

/* ==========================================================
   LIBRARY FILTER TYPOGRAPHY — MATCH TBR
   ========================================================== */

.library-toolbar .tbr-search input {
  font-family: "DM Sans", sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
}

.library-toolbar .tbr-search input::placeholder {
  font-size: 0.72rem;
}

.library-toolbar .tbr-filter > span {
  font-family: "DM Sans", sans-serif;
  font-size: 0.48rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.library-toolbar .tbr-filter select {
  font-family: "Cormorant Garamond", serif;
  font-size: 0.82rem;
  font-weight: 500;
}