/* css/book-3d.css — Precision 3D Book Models with Grounded Shadows & Rich Aesthetics */

:root {
  --book-w: 220px;
  --book-h: 298px;
}

/* Ensure hero container has ample room for copy and 3D stage */
.ebook-hero-split {
  max-width: 1160px;
  gap: 24px;
}

.ebook-hero-copy {
  flex: 1;
  max-width: 460px;
}

/* ==========================================================================
   Stage Wrapper & Container
   ========================================================================== */
.ebook-3d-stage-wrapper {
  position: relative;
  flex: 1.35;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  isolation: isolate;
  padding: 8px 0;
  overflow: visible;
}

/* Dynamic Graphic Motion Canvas (kinetic orbit rings & ambient particles) */
.book-motion-canvas {
  position: absolute;
  inset: -20px -30px;
  width: calc(100% + 60px);
  height: calc(100% + 40px);
  pointer-events: none;
  z-index: 1;
  opacity: 0.95;
}

/* ==========================================================================
   Floating HUD Graphic Badges (Sleek Anchors)
   ========================================================================== */
.hud-badges-bar {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 20;
}

.hud-badge {
  position: relative;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 15px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f8fafc;
  background: rgba(15, 30, 61, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38), 0 0 16px rgba(59, 130, 246, 0.16);
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
  animation: hudFloat 5.2s ease-in-out infinite alternate;
  white-space: nowrap;
}

.hud-badge .hud-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.hud-badge-top-left {
  animation-delay: 0s;
  border-left: 2px solid #ffd166;
}

.hud-badge-top-right {
  animation-delay: -1.8s;
  border-left: 2px solid #38bdf8;
}

@keyframes hudFloat {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(1deg); }
  100% { transform: translateY(3px) rotate(-1deg); }
}

/* ==========================================================================
   3D WebGL Viewport & Ground
   ========================================================================== */
.book-3d-viewport {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 5;
  margin: 10px 0 6px;
  touch-action: pan-y;
}

.book-3d-viewport:active {
  cursor: grabbing;
}

.book-3d-webgl-canvas {
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

/* Floating Sample Preview Button */
.webgl-sample-hover-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 209, 102, 0.85);
  color: #ffd166;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 9999px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55), 0 0 20px rgba(255, 209, 102, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease, color 0.2s ease;
  z-index: 35;
  white-space: nowrap;
  outline: none;
}

.webgl-sample-hover-badge.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.webgl-sample-hover-badge:hover {
  background: linear-gradient(135deg, #ffd166 0%, #f59e0b 100%);
  color: #0f1e3d;
  box-shadow: 0 8px 28px rgba(255, 209, 102, 0.6);
  transform: translateX(-50%) translateY(-1px);
}

/* ==========================================================================
   Clean Switcher Toolbar & Hint
   ========================================================================== */
.book-3d-toolbar {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 5px;
  background: rgba(15, 30, 61, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  margin-top: 4px;
}

.tbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: none;
  -webkit-user-select: none;
}

.tbar-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.tbar-btn.is-active {
  color: #0f1e3d;
  background: linear-gradient(135deg, #ffd166 0%, #f59e0b 100%);
  border-color: #ffd166;
  box-shadow: 0 4px 16px rgba(255, 209, 102, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

.tbar-btn-preview {
  color: #ffd166;
  background: rgba(255, 209, 102, 0.12);
  border-color: rgba(255, 209, 102, 0.4);
}

.tbar-btn-preview:hover {
  color: #0f1e3d;
  background: linear-gradient(135deg, #ffd166 0%, #f59e0b 100%);
  border-color: #ffd166;
  box-shadow: 0 4px 18px rgba(255, 209, 102, 0.5);
  transform: translateY(-1px);
}

.tbar-icon {
  font-size: 0.95rem;
  line-height: 1;
}

/* User interaction guide hint */
.book-3d-hint {
  position: relative;
  z-index: 25;
  margin-top: 10px;
  font-size: 0.74rem;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.01em;
  text-align: center;
}

/* ==========================================================================
   Responsive Adaptations Across Breakpoints
   ========================================================================== */
@media (max-width: 900px) {
  .ebook-3d-stage-wrapper {
    min-height: 480px;
    width: 100%;
    margin-top: 20px;
  }
  .book-3d-viewport {
    max-width: 480px;
    height: 360px;
  }
}

@media (max-width: 600px) {
  .info-hero {
    padding: 28px 16px 20px;
    overflow-x: hidden;
  }

  .ebook-hero-copy h1 {
    font-size: 1.75rem;
    line-height: 1.22;
    word-break: normal;
    overflow-wrap: break-word;
    margin-bottom: 10px;
  }

  .ebook-hero-copy p {
    font-size: 0.92rem;
    line-height: 1.45;
    margin-bottom: 18px;
  }

  .ebook-3d-stage-wrapper {
    min-height: 400px;
    padding: 4px 0 12px;
    margin-top: 10px;
  }

  .hud-badges-bar {
    top: 2px;
    left: 4px;
    right: 4px;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .hud-badge {
    padding: 3px 9px;
    font-size: 0.67rem;
    animation: none; /* Keep still for clean reading on mobile */
  }

  .book-3d-viewport {
    max-width: 100%;
    height: 310px;
    margin: 8px 0 4px;
  }

  .webgl-sample-hover-badge {
    top: 38px;
    font-size: 0.74rem;
    padding: 5px 14px;
  }

  .book-3d-toolbar {
    gap: 6px;
    padding: 4px 8px;
    max-width: 96%;
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 18px;
  }

  .tbar-btn {
    padding: 6px 12px;
    font-size: 0.78rem;
    gap: 6px;
  }

  .book-3d-hint {
    font-size: 0.68rem;
    padding: 0 10px;
    margin-top: 8px;
    line-height: 1.4;
  }
}

@media (max-width: 380px) {
  .ebook-hero-copy h1 {
    font-size: 1.55rem;
  }

  .book-3d-viewport {
    height: 275px;
  }

  .hud-badge {
    padding: 3px 7px;
    font-size: 0.63rem;
    gap: 4px;
  }

  .tbar-btn {
    padding: 5px 8px;
    font-size: 0.72rem;
    gap: 4px;
  }

  .tbar-icon {
    font-size: 0.80rem;
  }
}
