/* ═══════════════════════════════════════════════════
   XEBB'S TRAVELS — Volume 1 Flipbook
   Custom CSS 3D page-flip comic book reader
   ═══════════════════════════════════════════════════ */

/* ─── Flipbook Main Layout ─── */
.flipbook-page { overflow-x: hidden; }

.flipbook-main {
  min-height: 100dvh;
  padding-top: var(--space-20);
  padding-bottom: var(--space-16);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}

.flipbook-header { text-align: center; padding: 0 var(--space-6); }
.flipbook-title {
  font-size: var(--text-xl);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--accent-orange);
  margin-bottom: var(--space-2);
}
.flipbook-sub { font-size: var(--text-sm); color: var(--color-text-muted); }

/* ─── Flipbook Stage ─── */
.flipbook-stage {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: var(--space-4);
  perspective: 1800px;
  touch-action: pan-y;
}

.book {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  min-height: 520px;
}

/* ─── Page Base ─── */
.page {
  position: absolute;
  inset: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: left center;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  box-shadow: var(--shadow-md);
  backface-visibility: hidden;
}

/* ─── Page States ─── */
.page.active {
  transform: rotateY(0deg);
  z-index: 10;
  opacity: 1;
}

.page.prev {
  transform: rotateY(-160deg);
  z-index: 5;
  opacity: 0;
  pointer-events: none;
}

.page.next {
  transform: rotateY(0deg);
  z-index: 1;
  opacity: 0;
  pointer-events: none;
}

.page.flipping-next {
  animation: flipNext 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 20;
}

.page.flipping-prev {
  animation: flipPrev 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 20;
}

@keyframes flipNext {
  0% { transform: rotateY(0deg); box-shadow: var(--shadow-md); }
  50% { box-shadow: var(--shadow-lg), -8px 0 20px rgba(0,0,0,0.2); }
  100% { transform: rotateY(-160deg); box-shadow: var(--shadow-md); }
}

@keyframes flipPrev {
  0% { transform: rotateY(-160deg); opacity: 0; }
  50% { opacity: 1; box-shadow: var(--shadow-lg), -8px 0 20px rgba(0,0,0,0.2); }
  100% { transform: rotateY(0deg); opacity: 1; box-shadow: var(--shadow-md); }
}

/* ─── Cover Page ─── */
.page--cover {
  background: #0D0B0F;
  justify-content: flex-end;
}

.cover-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.5) contrast(1.1);
}

.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13,11,15,0.95) 0%, rgba(13,11,15,0.3) 50%, rgba(13,11,15,0.6) 100%);
}

.cover-content {
  position: relative;
  z-index: 1;
  padding: var(--space-8);
  text-align: center;
}

.cover-label {
  display: inline-block;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.15em;
  color: var(--accent-blue);
  background: rgba(0,180,255,0.15);
  border: 1px solid var(--accent-blue);
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
}

.cover-title {
  font-size: var(--text-2xl);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--accent-orange);
  text-shadow: 0 0 40px rgba(255,107,26,0.4);
  margin-bottom: var(--space-4);
}

.cover-tagline {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--color-text-muted);
}

/* ─── Comic Script Pages ─── */
.page--comic { padding: 0; background: var(--color-surface); }
.page--comic::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 8px 8px;
  pointer-events: none;
  z-index: 0;
}
.page--comic > * { position: relative; z-index: 1; }

.page--comic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  border-bottom: 2px solid var(--accent-orange);
  flex-shrink: 0;
}

.page-num-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--accent-blue);
}

.page-section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-orange);
}

.panel-count {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 500;
}

.page--comic-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: var(--accent-orange-dim) var(--color-surface-2);
}
.page--comic-body::-webkit-scrollbar { width: 4px; }
.page--comic-body::-webkit-scrollbar-track { background: var(--color-surface-2); }
.page--comic-body::-webkit-scrollbar-thumb { background: var(--accent-orange-dim); border-radius: var(--radius-full); }

.page--comic-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-border);
  font-size: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text-faint);
  flex-shrink: 0;
}

/* ─── Comic Panel ─── */
.comic-panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  position: relative;
  border-left: 3px solid var(--accent-orange-dim);
}

.panel-num {
  position: absolute;
  top: var(--space-2);
  right: var(--space-3);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 900;
  color: var(--color-text-faint);
  background: var(--color-surface-2);
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
}

.panel-desc {
  font-size: var(--text-xs);
  line-height: 1.55;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  padding-right: var(--space-6);
  font-style: italic;
}

.panel-caption {
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--accent-gold);
  background: rgba(255,215,0,0.06);
  border-left: 2px solid var(--accent-gold);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  font-weight: 500;
}

.panel-sfx {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 900;
  color: var(--accent-orange);
  text-align: center;
  padding: var(--space-2) var(--space-3);
  background: rgba(255,107,26,0.08);
  border: 1px dashed var(--accent-orange-dim);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  letter-spacing: 0.05em;
}

.panel-dialogue {
  font-size: var(--text-xs);
  line-height: 1.55;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.panel-dialogue .speaker {
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--accent-blue);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.panel-dialogue--thought {
  background: rgba(0,180,255,0.05);
  border-color: var(--accent-blue-dim);
  font-style: italic;
}
.panel-dialogue--thought .speaker { color: var(--accent-purple); }

/* ─── Interior Splash Page ─── */
.page--splash {
  background: #0D0B0F;
  padding: 0;
}
.splash-img-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}
.splash-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.splash-caption-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(to top, rgba(13,11,15,0.92), transparent);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.splash-caption-bar .page-num-label { color: var(--accent-orange); }
.splash-caption-bar .splash-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #F5F3EF;
  text-transform: uppercase;
}

/* ─── Cliffhanger Page ─── */
.page--cliffhanger {
  background: #0D0B0F;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-10);
  position: relative;
}
.page--cliffhanger::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(155,77,202,0.12), transparent 70%);
  pointer-events: none;
}
.cliffhanger-content { position: relative; z-index: 1; max-width: 320px; }
.cliffhanger-desc {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  font-style: italic;
}
.cliffhanger-dialogue {
  margin-bottom: var(--space-10);
  padding: var(--space-6);
  background: rgba(155,77,202,0.08);
  border: 1px solid var(--accent-purple);
  border-radius: var(--radius-lg);
}
.cliffhanger-dialogue p {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: #F5F3EF;
}
.speaker--rug {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--accent-purple);
  margin-bottom: var(--space-2);
}
.cliffhanger-next {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--accent-orange);
  text-transform: uppercase;
}

/* ─── Back Cover ─── */
.page--back-cover {
  background: #0D0B0F;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: var(--space-8);
}
.back-cover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}
.back-cover-title {
  font-size: var(--text-xl);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--accent-orange);
}
.back-cover-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 280px;
}
.back-cover-img {
  width: 100%;
  max-width: 240px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.back-cover-img img { width: 100%; }
.back-cover-link {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.back-cover-link:hover { color: var(--accent-orange); }

/* ─── Controls ─── */
.flipbook-controls {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.btn--flip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  transition: all var(--transition-interactive);
}
.btn--flip:hover {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
  transform: translateY(-2px);
}
.page-counter {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-muted);
  min-width: 60px;
  text-align: center;
}
.flipbook-footer-nav { margin-top: var(--space-4); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-4); }
.back-link {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: color var(--transition-interactive);
}
.back-link:hover { color: var(--accent-orange); }

/* ─── Volume Themes ─── */
/* Vol 2: Atlantis-Net — cyan/aqua accent */
.theme-vol2 .flipbook-title,
.theme-vol2 .cover-title { color: #22D3C9; text-shadow: 0 0 40px rgba(34,211,201,0.4); }
.theme-vol2 .page-section-title,
.theme-vol2 .page--comic-header,
.theme-vol2 .comic-panel { border-color: #22D3C9; }
.theme-vol2 .page--comic-header { border-bottom-color: #22D3C9; }
.theme-vol2 .comic-panel { border-left-color: rgba(34,211,201,0.5); }
.theme-vol2 .cliffhanger-next { color: #22D3C9; }

/* Vol 3: Kingdom — royal gold/purple accent */
.theme-vol3 .flipbook-title,
.theme-vol3 .cover-title { color: #E8B94A; text-shadow: 0 0 40px rgba(232,185,74,0.4); }
.theme-vol3 .page-section-title { color: #E8B94A; }
.theme-vol3 .page--comic-header { border-bottom-color: #E8B94A; }
.theme-vol3 .comic-panel { border-left-color: rgba(232,185,74,0.5); }
.theme-vol3 .cliffhanger-next { color: #E8B94A; }

/* Vol 4: Airdrop Paradox — neon magenta/electric blue accent */
.theme-vol4 .flipbook-title,
.theme-vol4 .cover-title { color: #E94FD8; text-shadow: 0 0 40px rgba(233,79,216,0.4); }
.theme-vol4 .page-section-title { color: #E94FD8; }
.theme-vol4 .page--comic-header { border-bottom-color: #E94FD8; }
.theme-vol4 .comic-panel { border-left-color: rgba(233,79,216,0.5); }
.theme-vol4 .cliffhanger-next { color: #E94FD8; }

/* Vol 5: The Chrono-Rug — dark purple/burnt orange accent */
.theme-vol5 .flipbook-title,
.theme-vol5 .cover-title { color: #9B4DCA; text-shadow: 0 0 40px rgba(155,77,202,0.5); }
.theme-vol5 .page-section-title { color: #9B4DCA; }
.theme-vol5 .page--comic-header { border-bottom-color: #9B4DCA; }
.theme-vol5 .comic-panel { border-left-color: rgba(155,77,202,0.5); }
.theme-vol5 .cliffhanger-next { color: #9B4DCA; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .flipbook-main { padding-top: var(--space-16); gap: var(--space-4); }
  .flipbook-title { font-size: var(--text-lg); }
  .flipbook-sub { font-size: var(--text-xs); }
  .flipbook-controls { gap: var(--space-3); flex-wrap: wrap; justify-content: center; }
  .btn--flip span { display: none; }
  .btn--flip { padding: var(--space-3); }
  .page--comic-body { padding: var(--space-3); gap: var(--space-3); }
  .panel-desc { font-size: 11px; }
  .panel-dialogue { font-size: 11px; }
  .book { min-height: 480px; }
}
