/* ============================================================
   THE SEEKER'S JOURNEY — Style Sheet
   Google Cardboard VR Experience (Stereoscopic split-screen)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 8px; /* Shaves off another 20% globally (8px baseline instead of 10px) */
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Playfair Display', serif;
  color: #f0ead8;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
}

/* ── Split-Screen VR Container ────────────────────────────── */
#vr-container {
  position: fixed;
  inset: 0;
  display: block; /* Always visible for split-screen from first moment */
  z-index: 100;
  background: #000;
}

/* Default: PORTRAIT VIEWPORT
   Split screen top/bottom. Typically used when phone is held landscape,
   but browser orientation lock is disabled so viewport remains portrait. */
.eye {
  position: absolute;
  width: 100%;
  height: 50%;
  overflow: hidden;
}
#eye-left  { top: 0; left: 0; }
#eye-right { bottom: 0; left: 0; }

/* Separator line for Cardboard alignment */
.eye::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: rgba(255,255,255,0.08);
  pointer-events: none;
  z-index: 10;
}

/* A-Frame scenes fill their eye viewport */
html.a-fullscreen .eye a-scene,
.eye a-scene {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  left: auto !important;
  top: auto !important;
}
.eye a-scene .a-canvas {
  position: absolute !important;
  width: 100% !important;
  height: 100% !important;
  top: 0 !important;
  left: 0 !important;
}

/* ── Eye UI Viewport Duplication ──────────────────────────── */
/* Everything rendered on top of the VR scenes must be duplicated
   once in the top half (left eye) and once in the bottom half (right eye). */
.eye-ui {
  position: absolute;
  width: 100%;
  height: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  overflow: hidden;
}
.top-eye-ui { top: 0; left: 0; }
.bottom-eye-ui { bottom: 0; left: 0; }


/* LANDSCAPE VIEWPORT
   Split screen left/right. Used when device rotates and viewport rotates to landscape. */
@media (orientation: landscape) {
  .eye {
    width: 50%;
    height: 100%;
  }
  #eye-left  { top: 0; left: 0; }
  #eye-right { top: 0; left: 50%; }

  .eye::after {
    bottom: 0; top: 0; left: auto; right: 0;
    width: 1px;
    height: 100%;
    background: rgba(255,255,255,0.08);
  }

  .eye-ui {
    width: 50%;
    height: 100%;
  }
  .top-eye-ui { top: 0; left: 0; }
  .bottom-eye-ui { top: 0; left: 50%; }
}

.flex-center {
  justify-content: center !important;
}
.flex-end {
  justify-content: flex-end !important;
}

/* ── Narration Overlays ────────────────────────────────────── */
#narration-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}

.narration-block {
  width: 85%;
  max-width: 500px;
  margin-bottom: 5vh; /* position relative to eye height */
  padding: 1rem 1.6rem;
  background: linear-gradient(135deg,
    rgba(0,0,0,0.88) 0%,
    rgba(15,5,5,0.82) 100%);
  border: 1px solid rgba(229,57,53,0.22);
  border-radius: 4px;
  backdrop-filter: blur(6px);
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.narration-block.visible {
  opacity: 1;
  transform: translateY(0);
}

.narration-text {
  font-family: 'Playfair Display', serif;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(0.9rem, 3vw, 1.25rem);
  line-height: 1.6;
  color: #f5ead6;
  letter-spacing: 0.02em;
}

/* ── Hotspot Popups ───────────────────────────────────────── */
#hotspot-popup {
  position: fixed;
  inset: 0;
  z-index: 220;
  pointer-events: none;
}

.hotspot-popup {
  width: min(70vw, 300px);
  padding: 1.1rem 1.5rem;
  background: linear-gradient(145deg,
    rgba(10,2,2,0.96) 0%,
    rgba(20,4,4,0.92) 100%);
  border: 1px solid rgba(229,57,53,0.35);
  border-radius: 6px;
  backdrop-filter: blur(12px);
  text-align: center;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.hotspot-popup.visible {
  opacity: 1;
  transform: scale(1);
}
.hotspot-popup .popup-icon {
  margin-bottom: 0.35rem;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hotspot-popup .popup-icon svg {
  width: 26px;
  height: 26px;
  stroke: #ff5252;
  stroke-width: 2px;
  fill: none;
}
.hotspot-popup .popup-label {
  font-family: 'Playfair Display', serif;
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,138,128,0.7);
  margin-bottom: 0.25rem;
}
.hotspot-popup .popup-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: #f5ead6;
  line-height: 1.5;
}

/* ── Gaze Progress Ring ──────────────────────────────────── */
#gaze-ring-container {
  position: fixed;
  inset: 0;
  z-index: 210;
  pointer-events: none;
}

.gaze-ring-wrapper {
  position: relative;
  width: 48px;
  height: 48px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.gaze-ring-wrapper.active { opacity: 1; }

.gaze-ring {
  width: 100%;
  height: 100%;
}

.gaze-ring circle {
  fill: none;
  stroke: rgba(229,57,53,0.85);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 138;
  stroke-dashoffset: 138;
  transform-origin: center;
  transform: rotate(-90deg);
  transition: stroke-dashoffset 0.05s linear;
}

.gaze-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 5px; height: 5px;
  background: rgba(229,57,53,0.85);
  border-radius: 50%;
}

/* ── Gameplay UI (Scene 7A) ──────────────────────────────── */
#gameplay-ui {
  position: fixed;
  inset: 0;
  z-index: 190;
  pointer-events: none;
  display: none;
}
#gameplay-ui.active { display: block; }

.challenge-banner {
  margin-top: 4vh;
  text-align: center;
  padding: 0.4rem 1.2rem;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(229,57,53,0.25);
  border-radius: 20px;
  backdrop-filter: blur(6px);
  width: fit-content;
}
.challenge-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.5rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,138,128,0.75);
}
.challenge-subtitle {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: #f5ead6;
  margin-top: 0.1rem;
}

.progress-bar-wrap {
  margin-bottom: 5vh;
  width: min(60vw, 240px);
  text-align: center;
}
.progress-label {
  font-family: 'Playfair Display', serif;
  font-size: 0.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,138,128,0.55);
  margin-bottom: 0.35rem;
}
.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 1px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #d32f2f, #ff5252);
  transition: width 0.1s linear;
}

/* Snowstorm overlay for Challenge 2 */
#storm-overlay {
  position: fixed;
  inset: 0;
  z-index: 185;
  background: radial-gradient(ellipse at center,
    rgba(200,220,255,0.0) 0%,
    rgba(180,200,255,0.55) 100%);
  backdrop-filter: blur(0px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease, backdrop-filter 1s ease;
  display: none;
}
#storm-overlay.active {
  display: block;
  opacity: 1;
  backdrop-filter: blur(3px);
}

/* ── Fade Overlay ────────────────────────────────────────── */
#fade-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
#fade-overlay.fading { opacity: 1; pointer-events: all; }
#fade-overlay.fade-white { background: #fff; }

/* ── Ending Layer ────────────────────────────────────────── */
#ending-layer {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  background: #000;
}
#ending-layer.active { display: block; }

.timeline-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

.timeline-item {
  font-family: 'Playfair Display', serif;
  font-size: clamp(0.95rem, 3.2vw, 1.45rem);
  color: rgba(240,232,210,0);
  text-align: center;
  margin: 0.12rem 0;
  letter-spacing: 0.03em;
  transition: color 1.2s ease, transform 1.2s ease;
  transform: scale(0.92);
}
.timeline-item.lit {
  color: #f0e8d2;
  transform: scale(1);
}
.timeline-arrow {
  font-size: 0.85rem;
  color: rgba(229,57,53,0.4);
  margin: 0.03rem 0;
}
.timeline-role {
  font-family: 'Playfair Display', serif;
  font-size: 0.45rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,138,128,0.6);
  display: block;
  margin-top: 0.05rem;
}

.final-quote {
  margin-top: 4vh;
  width: 80%;
  max-width: 450px;
  text-align: center;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(0.85rem, 2.8vw, 1.15rem);
  color: rgba(240,232,210,0);
  line-height: 1.6;
  transition: color 1.5s ease;
}
.final-quote.visible { color: #f0e8d2; }

/* ── Credits Layer ───────────────────────────────────────── */
#credits-layer {
  position: fixed;
  inset: 0;
  z-index: 420;
  background: #000;
  display: none;
}
#credits-layer.active { display: block; }

.credits-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.3rem;
}

.credit-line {
  font-family: 'Playfair Display', serif;
  font-weight: 300;
  font-size: clamp(0.75rem, 2.2vw, 1rem);
  color: rgba(240,232,210,0.7);
  letter-spacing: 0.04em;
  text-align: center;
}
.credit-title {
  font-family: 'Playfair Display', serif;
  font-size: 0.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(229,57,53,0.45);
  margin-bottom: 0.6rem;
}

/* ── Journal Entry Popup ─────────────────────────────────── */
#journal-popup {
  position: fixed;
  inset: 0;
  z-index: 220;
  pointer-events: none;
}

.journal-popup {
  width: min(75vw, 300px);
  padding: 1.1rem 1.5rem;
  background: linear-gradient(145deg,
    rgba(8,1,1,0.96) 0%,
    rgba(18,3,3,0.92) 100%);
  border: 1px solid rgba(229,57,53,0.32);
  border-radius: 4px;
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.5s ease, transform 0.5s ease;
  text-align: center;
}
.journal-popup.visible {
  opacity: 1;
  transform: scale(1);
}
.journal-number {
  font-family: 'Playfair Display', serif;
  font-size: 0.45rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,138,128,0.55);
  margin-bottom: 0.4rem;
}
.journal-text {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: #f5ead6;
  line-height: 1.6;
}

/* ── Scene Number Badge ──────────────────────────────────── */
#scene-badge {
  position: fixed;
  inset: 0;
  z-index: 195;
  pointer-events: none;
}

.scene-badge {
  margin-top: 2.5vh;
  font-family: 'Playfair Display', serif;
  font-size: 0.45rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,138,128,0.45);
  padding: 0.2rem 0.6rem;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.scene-badge.visible { opacity: 1; }

/* ── Fire Particle Canvas (Scene 6) ──────────────────────── */
.particle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 140;
  display: none;
}
.particle-canvas.active { display: block; }

/* ── Transparent Tap-To-Begin Gesture Overlay ────────────── */
#tap-overlay {
  position: fixed;
  inset: 0;
  z-index: 700;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.5s ease;
}
#tap-overlay.hidden {
  display: none;
  pointer-events: none;
}
.tap-prompt {
  font-family: 'Playfair Display', serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ff5252;
  border: 1px solid rgba(229,57,53,0.5);
  padding: 0.85rem 1.6rem;
  background: rgba(15,5,5,0.92);
  border-radius: 3px;
  animation: pulse-border 2.5s infinite ease-in-out;
  text-align: center;
  max-width: 80vw;
  line-height: 1.5;
}

@keyframes pulse-border {
  0%, 100% {
    border-color: rgba(229,57,53,0.35);
    box-shadow: 0 0 0 0 rgba(229,57,53,0);
  }
  50% {
    border-color: rgba(229,57,53,0.95);
    box-shadow: 0 0 10px 2px rgba(229,57,53,0.25);
  }
}

/* ── Responsive Adjustment ───────────────────────────────── */
@media (max-width: 480px) {
  .narration-text { font-size: 0.85rem; }
  .tap-prompt { font-size: 0.6rem; padding: 0.7rem 1.3rem; }
}

/* ── 2D Hamburger Menu Button ────────────────────────────── */
.menu-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(18, 9, 8, 0.85);
  border: 1px solid rgba(255, 138, 128, 0.4);
  border-radius: 50%;
  width: 4rem;
  height: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  padding: 0;
}
.menu-btn:hover {
  background: rgba(255, 138, 128, 0.15);
  border-color: rgba(255, 138, 128, 0.85);
  box-shadow: 0 0 12px rgba(255, 138, 128, 0.3);
  transform: scale(1.05);
}
.menu-btn:active {
  transform: scale(0.95);
}
.menu-btn .bar {
  display: block;
  width: 1.8rem;
  height: 0.18rem;
  background-color: #ff8a80;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Transform Hamburger to X when expanded */
.navbar-expanded .menu-btn {
  border-color: #ff5252;
  box-shadow: 0 0 12px rgba(255, 82, 82, 0.4);
}
.navbar-expanded .menu-btn .bar:nth-child(1) {
  transform: translateY(0.58rem) rotate(45deg);
}
.navbar-expanded .menu-btn .bar:nth-child(2) {
  opacity: 0;
}
.navbar-expanded .menu-btn .bar:nth-child(3) {
  transform: translateY(-0.58rem) rotate(-45deg);
}
