/* Thresholds — Departures Across Cultures */
:root {
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --bg-deep: #05070a;
  --bg-card: rgba(8, 11, 16, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.09);
  --bg-pill: rgba(255, 255, 255, 0.07);
  --bg-pill-hover: rgba(255, 255, 255, 0.14);
  
  --text-primary: #f0f3f8;
  --text-muted: #a2acbd;
  --text-dim: #687387;
  
  --accent-gold: #dfb572;
  --accent-amber: #d88939;
  --accent-glow: rgba(223, 181, 114, 0.28);
  
  --ease-cinematic: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-sans);
  user-select: none;
}

/* App Shell */
.app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Visual Stage: Image & Video Layering */
.visual-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
  background-color: #030406;
}

.stage-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s var(--ease-cinematic), transform 1.2s var(--ease-cinematic);
}

.stage-media.visible {
  opacity: 1;
}

.stage-image {
  z-index: 1;
  transform: scale(1.0);
}

.stage-video {
  z-index: 2;
}

/* Fade-to-Black Cinema Curtain */
.fade-curtain {
  position: absolute;
  inset: 0;
  background: #000000;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: opacity 1.4s var(--ease-cinematic);
}

.fade-curtain.faded-out {
  opacity: 1;
}

/* Vignette & Cinematic Grain Overlay */
.vignette-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 45%, rgba(4, 5, 8, 0.45) 80%, rgba(2, 3, 5, 0.85) 100%);
}

/* Top Bar */
.top-bar {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 36px;
  transition: opacity 0.8s var(--ease-cinematic), transform 0.8s var(--ease-cinematic);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  letter-spacing: 0.28em;
  font-weight: 400;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.brand-subtitle {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.pill-btn {
  background: var(--bg-pill);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 8px 16px;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.3s var(--ease-cinematic);
}

.pill-btn:hover {
  background: var(--bg-pill-hover);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.audio-btn.active {
  background: rgba(223, 181, 114, 0.16);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  box-shadow: 0 0 16px var(--accent-glow);
}

.drawer-counter {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Narrative Card — Lower-Left Cinema Plaque */
.narrative-wrapper {
  position: absolute;
  bottom: 96px;
  left: 42px;
  z-index: 10;
  max-width: 520px;
  width: calc(100% - 84px);
  pointer-events: none;
  transition: opacity 0.9s var(--ease-cinematic), transform 0.9s var(--ease-cinematic);
}

.narrative-card {
  pointer-events: auto;
  background: var(--bg-card);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--bg-card-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 26px 30px;
  text-align: left;
  transition: opacity 0.6s var(--ease-cinematic), transform 0.6s var(--ease-cinematic);
}

.narrative-card.fading {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
}

.scene-culture {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 8px;
  opacity: 0.95;
}

.scene-title {
  font-family: var(--font-serif);
  font-size: 2.05rem;
  font-weight: 300;
  line-height: 1.15;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  color: #ffffff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.6);
}

.scene-prose {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.6;
  color: #d6dbe6;
  font-style: italic;
  font-weight: 300;
  margin-bottom: 18px;
}

.scene-sensory-meta {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-tag {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--text-muted);
}

.meta-tag.badge-live-video {
  border-color: rgba(223, 181, 114, 0.5);
  color: var(--accent-gold);
  background: rgba(223, 181, 114, 0.12);
}

/* Bottom Control Deck */
.bottom-deck {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 24px 42px 30px;
  transition: opacity 0.8s var(--ease-cinematic), transform 0.8s var(--ease-cinematic);
}

.deck-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--bg-card-border);
  padding: 8px 18px;
  border-radius: 9999px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.control-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s var(--ease-cinematic);
}

.control-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.06);
}

.play-pause-btn {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.play-pause-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.timer-track {
  width: 120px;
  height: 4px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.timer-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-gold));
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* Zen / Pure Contemplation Mode */
body.zen-mode .narrative-wrapper {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

body.zen-mode .top-bar {
  opacity: 0.12;
}

body.zen-mode .bottom-deck {
  opacity: 0.2;
}

body.zen-mode:hover .top-bar,
body.zen-mode:hover .bottom-deck {
  opacity: 1;
}

/* Side Drawer */
.scenes-drawer {
  position: fixed;
  top: 0;
  right: -420px;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: rgba(8, 11, 16, 0.96);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border-left: 1px solid var(--bg-card-border);
  z-index: 100;
  transition: right 0.5s var(--ease-cinematic);
  display: flex;
  flex-direction: column;
}

.scenes-drawer.open {
  right: 0;
  box-shadow: -12px 0 50px rgba(0, 0, 0, 0.8);
}

.drawer-header {
  padding: 28px 24px;
  border-bottom: 1px solid var(--bg-card-border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.drawer-title-group h2 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 300;
  color: #fff;
  letter-spacing: 0.05em;
}

.drawer-title-group p {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  font-size: 1.7rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.drawer-close-btn:hover {
  color: #fff;
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drawer-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.25s var(--ease-cinematic);
  text-align: left;
  color: inherit;
  font-family: inherit;
}

.drawer-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(-3px);
}

.drawer-item.active {
  background: rgba(223, 181, 114, 0.14);
  border-color: var(--accent-gold);
}

.drawer-item-idx {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--accent-gold);
  width: 28px;
  flex-shrink: 0;
  line-height: 1.2;
}

.drawer-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.drawer-item-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: #fff;
  font-weight: 400;
}

.drawer-item-culture {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Audio Prompt Banner */
.audio-prompt-banner {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: all 0.6s var(--ease-cinematic);
}

.audio-prompt-banner.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.prompt-content {
  background: rgba(14, 18, 26, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(223, 181, 114, 0.4);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(223, 181, 114, 0.2);
  border-radius: 9999px;
  padding: 10px 18px 10px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 90vw;
}

.prompt-icon {
  color: var(--accent-gold);
  font-size: 1.2rem;
  animation: pulse-glow 2s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.6; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.1); }
}

.prompt-text {
  display: flex;
  flex-direction: column;
}

.prompt-text strong {
  font-size: 0.84rem;
  color: #fff;
}

.prompt-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-prompt-act {
  background: var(--accent-gold);
  border: none;
  color: #111;
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  padding: 6px 14px;
  border-radius: 9999px;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  white-space: nowrap;
}

.btn-prompt-act:hover {
  background: #f1cf99;
  transform: scale(1.05);
}

.btn-prompt-dismiss {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.btn-prompt-dismiss:hover {
  color: #fff;
}

.hidden {
  display: none !important;
}

/* Custom scrollbar for drawer */
.drawer-list::-webkit-scrollbar {
  width: 6px;
}
.drawer-list::-webkit-scrollbar-track {
  background: transparent;
}
.drawer-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Mobile responsive */
@media (max-width: 860px) {
  .top-bar {
    padding: 16px 20px;
  }
  
  .narrative-wrapper {
    left: 20px;
    bottom: 96px;
    width: calc(100% - 40px);
  }

  .narrative-card {
    padding: 20px 22px;
  }
  
  .scene-title {
    font-size: 1.65rem;
  }
  
  .scene-prose {
    font-size: 0.95rem;
    line-height: 1.5;
  }
  
  .bottom-deck {
    padding: 16px 20px 24px;
    justify-content: center;
  }
  
  .timer-track {
    width: 80px;
  }

  .audio-prompt-banner {
    top: 74px;
    width: 94vw;
  }
  
  .prompt-content {
    border-radius: 16px;
    padding: 10px 14px;
  }
}
