/***********
*************** INTERACTIVE BOOK COMPONENT
*****************************************/

/*************************************************************         BOOK STAGE          ********************/

/* #region BOOK STAGE */

.book-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 40px 20px;
  perspective: 2400px;
  overflow-x: hidden;
}



/* #endregion BOOK STAGE */


/*************************************************************         BOOK SHELL          ********************/

/* #region BOOK SHELL */

.book {
  position: relative;
  width: 380px;
  max-width: 46vw;
  aspect-ratio: 176 / 250;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Closed state: show front cover face-on, centred */
.book.is-closed {
  cursor: pointer;
  transform: translateX(0);
}

/* Open state: shift right so spine sits at centre, both spreads visible */
.book.is-open {
  transform: translateX(50%);
}



/* #endregion BOOK SHELL */


/*************************************************************         HARDBACK COVER          ********************/

/* #region HARDBACK COVER */

/*==========================================================================
|                               FRONT COVER                                |
==========================================================================*/

.book-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
  z-index: 100;
  cursor: pointer;
}

.book-cover-front {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 40px 32px;

  background:
    linear-gradient(135deg,
      #1a0a2e 0%,
      #0d0618 25%,
      #1a0a2e 50%,
      #0d0618 75%,
      #1a0a2e 100%
    );
  border-radius: 4px 16px 16px 4px;
  border: 1px solid rgba(191, 125, 217, 0.25);

  /* Leather/cloth texture */
  box-shadow:
    inset 0 0 80px rgba(0, 0, 0, 0.5),
    inset 0 0 4px rgba(191, 125, 217, 0.15),
    0 4px 24px rgba(0, 0, 0, 0.6),
    0 0 1px rgba(191, 125, 217, 0.3);

  /* Explicit translateZ so the browser tracks this face in 3D space
     — required for backface-visibility to work reliably */
  transform: translateZ(1px);
  backface-visibility: hidden;
}

/* Spine edge effect on cover */
.book-cover-front::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 40px;
  background:
    linear-gradient(90deg,
      rgba(0, 0, 0, 0.6) 0%,
      rgba(0, 0, 0, 0.3) 40%,
      rgba(191, 125, 217, 0.08) 60%,
      transparent 100%
    );
  border-radius: 4px 0 0 4px;
}

/* Gilt edge shimmer */
.book-cover-front::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(191, 125, 217, 0.15);
  border-radius: 2px 12px 12px 2px;
  pointer-events: none;
}

/*==========================================================================
|                               COVER TYPOGRAPHY                           |
==========================================================================*/

.book-cover-title {
  font-size: clamp(1.3rem, 3.5vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--accent-trance);
  text-shadow: 0 0 30px rgba(191, 125, 217, 0.4);
  margin: 0;
  position: relative;
}

.book-cover-subtitle {
  font-size: clamp(0.85rem, 2vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  position: relative;
}

.book-cover-ornament {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-trance), transparent);
  position: relative;
}

.book-cover-prompt {
  position: absolute;
  bottom: 36px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  animation: pulse-prompt 2.4s ease-in-out infinite;
}

@keyframes pulse-prompt {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

/*==========================================================================
|                               COVER BACK FACE                            |
==========================================================================*/

.book-cover-back {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, #1a0a2e, #0d0618);
  border-radius: 16px 4px 4px 16px;
  backface-visibility: hidden;
  transform: rotateY(180deg);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6);
}

/*==========================================================================
|                               COVER OPEN STATE                           |
==========================================================================*/

.book.is-open .book-cover {
  transform: rotateY(-180deg);
  z-index: 0;
}



/* #endregion HARDBACK COVER */


/*************************************************************         SPINE          ********************/

/* #region SPINE */

.book-spine {
  position: absolute;
  left: -20px;
  top: -2px;
  bottom: -2px;
  width: 40px;
  transform: rotateY(-90deg) translateZ(-20px);
  transform-style: preserve-3d;

  background:
    linear-gradient(90deg,
      #0d0618 0%,
      #1a0a2e 30%,
      #1a0a2e 70%,
      #0d0618 100%
    );
  border: 1px solid rgba(191, 125, 217, 0.12);
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.7),
    0 0 8px rgba(0, 0, 0, 0.5);
}

/* Spine ridges */
.book-spine::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    transparent 0px,
    transparent 28px,
    rgba(191, 125, 217, 0.08) 28px,
    rgba(191, 125, 217, 0.08) 30px
  );
}



/* #endregion SPINE */


/*************************************************************         PAGE BLOCK          ********************/

/* #region PAGE BLOCK */

.book-pages {
  position: absolute;
  inset: 6px 6px 6px 6px;
  transform-style: preserve-3d;
}

/*==========================================================================
|                               PAGE EDGES (GILT)                          |
==========================================================================*/

.book-page-edges {
  position: absolute;
  right: -3px;
  top: 2px;
  bottom: 2px;
  width: 6px;
  background: repeating-linear-gradient(
    180deg,
    rgba(191, 125, 217, 0.06) 0px,
    rgba(255, 255, 255, 0.08) 1px,
    rgba(191, 125, 217, 0.04) 2px
  );
  border-radius: 0 2px 2px 0;
}

/* Bottom page edge */
.book-page-edges::before {
  content: "";
  position: absolute;
  left: -100%;
  right: 0;
  bottom: -3px;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    rgba(191, 125, 217, 0.06) 0px,
    rgba(255, 255, 255, 0.08) 1px,
    rgba(191, 125, 217, 0.04) 2px
  );
  border-radius: 0 0 2px 2px;
}



/* #endregion PAGE BLOCK */


/*************************************************************         INDIVIDUAL PAGES          ********************/

/* #region INDIVIDUAL PAGES */

.book-page {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
  cursor: pointer;
}

/* Each page is a leaf with two sides */
.book-page-front,
.book-page-back {
  position: absolute;
  inset: 0;
  padding: 36px 28px 36px 40px;
  overflow-y: auto;
  backface-visibility: hidden;

  background:
    linear-gradient(135deg,
      #f5f0e8 0%,
      #ece5d8 40%,
      #f0ead9 100%
    );
  color: #2a2420;
  border-radius: 2px 10px 10px 2px;

  /* Aged paper shadow */
  box-shadow:
    inset 3px 0 12px rgba(0, 0, 0, 0.08),
    inset 0 0 40px rgba(139, 119, 91, 0.06);
}

.book-page-back {
  transform: rotateY(180deg);
  padding: 36px 40px 36px 28px;
  border-radius: 10px 2px 2px 10px;
  box-shadow:
    inset -3px 0 12px rgba(0, 0, 0, 0.08),
    inset 0 0 40px rgba(139, 119, 91, 0.06);
}

/* Paper grain texture */
.book-page-front::before,
.book-page-back::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='1' height='1' x='1' y='1' fill='%23b8a88a' fill-opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: inherit;
}

/* Gutter shadow (inner spine edge) */
.book-page-front::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.1), transparent);
  pointer-events: none;
  border-radius: 2px 0 0 2px;
}

.book-page-back::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 30px;
  background: linear-gradient(-90deg, rgba(0, 0, 0, 0.1), transparent);
  pointer-events: none;
  border-radius: 0 2px 2px 0;
}

/* Stacking: later pages sit beneath earlier ones */
.book-page { z-index: 50; }
.book-page:nth-child(2) { z-index: 49; }
.book-page:nth-child(3) { z-index: 48; }
.book-page:nth-child(4) { z-index: 47; }
.book-page:nth-child(5) { z-index: 46; }
.book-page:nth-child(6) { z-index: 45; }
.book-page:nth-child(7) { z-index: 44; }
.book-page:nth-child(8) { z-index: 43; }
.book-page:nth-child(9) { z-index: 42; }
.book-page:nth-child(10) { z-index: 41; }

/* Turned pages flip to the left */
.book-page.is-turned {
  transform: rotateY(-180deg);
  z-index: 60;
}



/* #endregion INDIVIDUAL PAGES */


/*************************************************************         PAGE CONTENT TYPOGRAPHY          ********************/

/* #region PAGE CONTENT TYPOGRAPHY */

.page-chapter {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(42, 36, 32, 0.45);
  margin-bottom: 6px;
}

.page-title {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  color: #1a0a2e;
  margin: 0 0 16px;
  line-height: 1.25;
}

.page-text {
  font-size: 0.84rem;
  line-height: 1.7;
  color: #3d342c;
  margin: 0 0 12px;
}

.page-text:last-child {
  margin-bottom: 0;
}

.page-quote {
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #1a0a2e;
  border-left: 3px solid var(--accent-trance);
  padding-left: 16px;
  margin: 20px 0;
}

.page-divider {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(42, 36, 32, 0.3), transparent);
  margin: 24px auto;
  border: none;
}

/*==========================================================================
|                               RELEASE PAGE STYLES                        |
==========================================================================*/

.page-release-artwork {
  display: block;
  width: min(160px, 55%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.page-release-meta {
  text-align: center;
  margin-bottom: 20px;
}

.page-release-meta .page-chapter {
  margin-bottom: 4px;
}

.page-release-meta .page-title {
  margin-bottom: 4px;
}

.page-release-artist {
  font-size: 0.9rem;
  color: rgba(42, 36, 32, 0.65);
  margin: 0 0 4px;
}

.page-release-date {
  font-size: 0.8rem;
  color: rgba(42, 36, 32, 0.45);
  margin: 0;
}

.page-release-link {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fff;
  background: #1a0a2e;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.page-release-link:hover {
  background: #2d1248;
  text-decoration: none;
}



/* #endregion PAGE CONTENT TYPOGRAPHY */


/*************************************************************         NAVIGATION          ********************/

/* #region NAVIGATION */

.book-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 24px;
}

.book-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  font-family: var(--font);
}

.book-nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
}

.book-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.book-nav-btn:disabled:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border-color: var(--line);
}

.book-nav-indicator {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.04em;
  min-width: 60px;
  text-align: center;
}

/* Hide nav when book is closed */
.book.is-closed ~ .book-nav {
  opacity: 0;
  pointer-events: none;
}



/* #endregion NAVIGATION */


/*************************************************************         RESPONSIVE          ********************/

/* #region RESPONSIVE */

@media (max-width: 720px) {
  .book-stage {
    padding: 24px 10px;
    min-height: calc(100vh - 100px);
  }

  .book {
    width: 280px;
    max-width: 70vw;
  }

  .book.is-open {
    transform: translateX(40%);
  }

  .book-page-front,
  .book-page-back {
    padding: 32px 24px 32px 36px;
  }

  .book-page-back {
    padding: 32px 36px 32px 24px;
  }

  .book-cover-front {
    padding: 36px 28px;
  }

  .page-release-artwork {
    width: min(120px, 50%);
  }
}

@media (max-width: 480px) {
  .book {
    width: 240px;
    max-width: 65vw;
  }

  .book.is-open {
    transform: translateX(35%);
  }

  .book-page-front,
  .book-page-back {
    padding: 24px 16px 24px 26px;
  }

  .book-page-back {
    padding: 24px 26px 24px 16px;
  }

  .book-cover-front {
    padding: 28px 20px;
  }

  .page-title {
    font-size: 1.05rem;
  }

  .page-text {
    font-size: 0.85rem;
  }
}



/* #endregion RESPONSIVE */
