:root {
  --bg-color: #fdf0e2;
  --text-dark: #3a2c27;
  --text-muted: #7e6b63;
  --accent-orange: #ea7a1e;
  --accent-orange-hover: #d96910;
  --font-heading: 'Fredoka', 'Outfit', sans-serif;
  --font-body: 'Outfit', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-dark);
}

/* Sticky Showcase Section */
.sticky-showcase-wrapper {
  position: relative;
  height: 250vh;
}

.sticky-pin-container {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  padding: 2rem 3rem;
  overflow: hidden;
  background-color: #fcf1e5; /* Background polos jernih & crisp */
}

/* 4 Corner Parallax Assets */
.parallax-asset {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  image-rendering: -webkit-optimize-contrast;
  transition: transform 0.15s cubic-bezier(0.2, 0, 0.2, 1);
  will-change: transform;
}

.asset-top-left {
  top: -15px;
  left: -15px;
  max-width: 170px;
}

.asset-top-right {
  top: -15px;
  right: -15px;
  max-width: 145px;
}

.asset-bottom-left {
  bottom: -20px;
  left: -25px;
  max-width: 190px;
}

.asset-bottom-right {
  bottom: -20px;
  right: -25px;
  max-width: 200px;
}


/* Header Title — CENTERED */
.magazine-header-info {
  text-align: center;
  width: 100%;
  z-index: 1;
}

.category-label {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 600;
  color: #4a3b34;
  display: block;
  margin-bottom: 0.2rem;
}

.magazine-main-title {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--accent-orange);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Fade-out state triggered via JS */
.magazine-main-title.fading {
  opacity: 0;
  transform: translateY(-8px);
}

/* Carousel Stage */
.carousel-stage-container {
  position: relative;
  width: 100%;
  max-width: 1080px;
  height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* Track holding containers */
.cards-track {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Book Container (Card + Caption Outside) */
.book-card-container {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease;
  cursor: pointer;
  user-select: none;
}

/* Hover zoom on side books */
.book-card-container.left-1:hover,
.book-card-container.right-1:hover {
  z-index: 8;
}

.book-card-container.left-1:hover .book-card,
.book-card-container.right-1:hover .book-card {
  transform: scale(1.06);
  box-shadow: 0 16px 36px rgba(180, 90, 20, 0.32);
}

/* Info Badge Overlay — appears on hover of side books */
.book-hover-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(58, 30, 10, 0.82) 0%, transparent 100%);
  color: #fff;
  padding: 1rem 0.75rem 0.6rem;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  border-radius: 0 0 6px 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-card-container.left-1:hover .book-hover-badge,
.book-card-container.right-1:hover .book-hover-badge {
  opacity: 1;
  transform: translateY(0);
}

/* Flat Simple Book Card — no spine effects */
.book-card {
  position: relative;
  width: 210px;
  height: 300px;
  background-color: var(--accent-orange);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(180, 90, 20, 0.25);
  overflow: hidden;
  transition: width 0.5s ease, height 0.5s ease, box-shadow 0.5s ease, transform 0.3s ease;
}

.book-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Caption text below book */
.book-card-caption {
  margin-top: 12px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
  white-space: nowrap;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Positioning States ---- */

/* Center (active) — bigger */
.book-card-container.center {
  transform: translateX(0) scale(1);
  opacity: 1;
  z-index: 10;
  perspective: 2500px;
}
.book-card-container.center .book-card {
  width: 370px;
  height: 515px;
  box-shadow: 0 28px 60px rgba(180, 90, 20, 0.38);
  transform-style: preserve-3d;
  overflow: visible;
  will-change: transform;
  transition: width 0.5s ease, height 0.5s ease, box-shadow 0.5s ease, transform 0.12s ease-out;
}

.book-card-container.center .book-card img {
  transform: translateZ(65px);
  position: relative;
  z-index: 2;
  box-shadow: 0 15px 35px rgba(0,0,0,0.25);
}

/* 3D Spine (Punggung Majalah Sisi Kiri) */
.book-card-container.center .book-3d-spine {
  position: absolute;
  top: 0;
  left: 0;
  width: 65px;
  height: 100%;
  background: linear-gradient(to left, #783400, #c8610d);
  transform: rotateY(-90deg);
  transform-origin: left center;
  border-radius: 4px 0 0 4px;
  z-index: 1;
}

/* 3D Pages (Tumpukan Halaman Kertas Sisi Kanan) */
.book-card-container.center .book-3d-pages {
  position: absolute;
  top: 2px;
  right: 0;
  width: 65px;
  height: calc(100% - 4px);
  background: repeating-linear-gradient(
    to right,
    #fcf8f2,
    #fcf8f2 3px,
    #b8a58d 3px,
    #b8a58d 6px
  );
  transform: rotateY(90deg);
  transform-origin: right center;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.4);
  border-radius: 0 2px 2px 0;
  z-index: 1;
}

/* 3D Top (Sisi Atas Tumpukan Kertas) */
.book-card-container.center .book-3d-top {
  position: absolute;
  top: 0;
  left: 2px;
  width: calc(100% - 4px);
  height: 65px;
  background: repeating-linear-gradient(
    to bottom,
    #fcf8f2,
    #fcf8f2 3px,
    #b8a58d 3px,
    #b8a58d 6px
  );
  transform: rotateX(90deg);
  transform-origin: top center;
  box-shadow: inset 0 0 14px rgba(0,0,0,0.35);
  z-index: 1;
}

/* 3D Bottom (Sisi Bawah Tumpukan Kertas) */
.book-card-container.center .book-3d-bottom {
  position: absolute;
  bottom: 0;
  left: 2px;
  width: calc(100% - 4px);
  height: 65px;
  background: repeating-linear-gradient(
    to top,
    #fcf8f2,
    #fcf8f2 3px,
    #b8a58d 3px,
    #b8a58d 6px
  );
  transform: rotateX(-90deg);
  transform-origin: bottom center;
  box-shadow: inset 0 0 14px rgba(0,0,0,0.4);
  z-index: 1;
}

.book-card-container.center .book-card-caption {
  display: none; /* hide caption under center card to keep it clean */
}

/* Left-1 */
.book-card-container.left-1 {
  transform: translateX(-410px) scale(0.78);
  opacity: 1;
  z-index: 5;
}

/* Right-1 */
.book-card-container.right-1 {
  transform: translateX(410px) scale(0.78);
  opacity: 1;
  z-index: 5;
}

/* Left-2 */
.book-card-container.left-2 {
  transform: translateX(-680px) scale(0.55);
  opacity: 0.3;
  z-index: 2;
}

/* Right-2 */
.book-card-container.right-2 {
  transform: translateX(680px) scale(0.55);
  opacity: 0.3;
  z-index: 2;
}

/* Hidden */
.book-card-container.hidden {
  transform: translateX(0) scale(0.3);
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

/* Sticky Navigation Buttons — glassmorphism style */
.nav-btn {
  position: absolute;
  top: 45%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--accent-orange);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-btn:hover {
  background: rgba(234, 122, 30, 0.88);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(234, 122, 30, 0.4);
  transform: translateY(-50%) scale(1.12);
}

.prev-btn {
  left: -20px;
}

.next-btn {
  right: -20px;
}

/* Action Footer & Read Button */
.action-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  z-index: 1;
}

.read-btn {
  background: rgba(234, 122, 30, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  padding: 0.65rem 4rem;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(234, 122, 30, 0.38);
  letter-spacing: 0.03em;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.read-btn:hover {
  background: rgba(217, 105, 16, 0.95);
  box-shadow: 0 12px 30px rgba(234, 122, 30, 0.5);
  transform: translateY(-3px) scale(1.04);
}

/* Carousel Dots */
.carousel-dots {
  display: flex;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: rgba(234, 122, 30, 0.35);
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot.active {
  width: 24px;
  border-radius: 10px;
  background-color: var(--accent-orange);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Fullscreen 3D Flipbook Reader Container */
.flipbook-modal-container {
  width: 95vw;
  height: 92vh;
  background: #1e1e24;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}

.flipbook-toolbar {
  height: 56px;
  background: #141418;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  color: #ffffff;
}

.toolbar-info {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--accent-orange);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.tb-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.tb-btn:hover {
  background: var(--accent-orange);
  border-color: transparent;
}

.tb-btn.btn-close {
  font-size: 1.5rem;
  margin-left: 0.5rem;
  background: rgba(235, 64, 52, 0.2);
  color: #ff6b6b;
  border-color: rgba(235, 64, 52, 0.3);
}

.tb-btn.btn-close:hover {
  background: #eb4034;
  color: #ffffff;
}

.page-num-indicator {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  padding: 0 0.4rem;
}

.flipbook-stage {
  flex: 1;
  width: 100%;
  height: calc(100% - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #18181c;
  overflow: hidden;
  padding: 1rem;
}

.flipbook-book {
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}

.page-element {
  background-color: #ffffff !important;
  color: #111111 !important;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.page-element * {
  box-sizing: border-box;
}

.flipbook-error {
  width: min(440px, 90%);
  padding: 2rem;
  border: 1px solid rgba(255, 107, 107, 0.45);
  border-radius: 12px;
  background: #2a1d20;
  color: #ffffff;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.flipbook-error i {
  color: #ff6b6b;
  font-size: 2rem;
}

.flipbook-error span {
  color: rgba(255,255,255,0.72);
  line-height: 1.5;
}

/* Responsive Mobile Optimization */
@media (max-width: 768px) {
  .sticky-pin-container {
    padding: 1.2rem 0.5rem;
  }

  .magazine-main-title {
    font-size: 1.8rem;
  }

  .category-label {
    font-size: 1.1rem;
  }

  .carousel-stage-container {
    height: 420px;
    max-width: 100%;
  }

  /* Ukuran Buku Utama di HP */
  .book-card-container.center .book-card {
    width: 250px;
    height: 350px;
  }

  .book-card-container.center .book-card img {
    transform: translateZ(28px);
  }

  .book-card-container.center .book-3d-spine,
  .book-card-container.center .book-3d-pages,
  .book-card-container.center .book-3d-top,
  .book-card-container.center .book-3d-bottom {
    width: 28px;
    height: 28px;
  }

  /* Sembunyikan buku samping & hanya tampilkan buku tengah aktif di HP */
  .book-card-container.left-1,
  .book-card-container.right-1,
  .book-card-container.left-2,
  .book-card-container.right-2 {
    opacity: 0;
    pointer-events: none;
  }

  /* Tombol Panah Navigasi di HP (Di Kiri & Kanan Layar HP) */
  .carousel-stage-container {
    position: relative;
  }

  .prev-btn {
    position: absolute !important;
    top: 50% !important;
    left: 8px !important;
    right: auto !important;
    transform: translateY(-50%) !important;
    width: 44px;
    height: 44px;
    font-size: 1rem;
    z-index: 50;
  }

  .next-btn {
    position: absolute !important;
    top: 50% !important;
    right: 8px !important;
    left: auto !important;
    transform: translateY(-50%) !important;
    width: 44px;
    height: 44px;
    font-size: 1rem;
    z-index: 50;
  }

  .prev-btn:hover,
  .next-btn:hover {
    transform: translateY(-50%) scale(1.08) !important;
  }

  .carousel-dots {
    width: 100%;
    justify-content: center;
    order: 4;
  }

  /* Skala Dekorasi Sudut di HP (Sangat Mungil & Mepet Ujung) */
  .asset-top-left { max-width: 80px; top: -10px; left: -10px; }
  .asset-top-right { max-width: 75px; top: -10px; right: -10px; }
  .asset-bottom-left { max-width: 90px; bottom: -10px; left: -15px; }
  .asset-bottom-right { max-width: 95px; bottom: -10px; right: -15px; }

  .modal-body {
    flex-direction: column;
    text-align: center;
  }

  .modal-cover img {
    width: 140px;
    height: 200px;
  }
}
