/* ==========================================================================
   OUR STORY — YASH & AYUSHI: MOBILE-FIRST RESPONSIVE REDESIGN
   Portrait native viewport: 400x700 viewBox canvas
   - Clean, minimalist, warm cream aesthetic
   - Single top-right play/pause control
   - Perfectly wrapped typography, zero horizontal overflow
   - Elegant, smooth scene transitions
   ========================================================================== */

:root {
  --bg-cream: #FBF8F2;
  --bg-stage: #F8F4EC;
  --charcoal: #231F20;
  --mustard: #E2A738;
  --mustard-dark: #C28619;
  --terracotta: #D36C52;
  --sage: #7D9D85;
  --deep-navy: #1D2434;
  --border-light: rgba(44, 38, 35, 0.1);
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-hand: 'Caveat', cursive, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-cream);
  color: var(--charcoal);
  font-family: var(--font-sans);
  position: fixed; /* prevent mobile bounce/scroll */
}

/* Subtle organic paper texture overlay */
.paper-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0.035;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* ==========================================
   1. OPENING SCREEN (PORTRAIT MOBILE FIRST)
   ========================================== */
#opening-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: var(--bg-cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 24px;
  text-align: center;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#opening-screen.hidden {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

.opening-badge {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mustard-dark);
  margin-bottom: 14px;
}

.opening-title {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 9vw, 3.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--charcoal);
  line-height: 1.15;
  margin-bottom: 10px;
}

.opening-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1rem, 3.8vw, 1.35rem);
  color: #6A6058;
  margin-bottom: 28px;
}

.opening-duo-stage {
  width: 260px;
  height: 180px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-begin-story {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--charcoal);
  color: #FFFFFF;
  border: none;
  border-radius: 9999px;
  padding: 15px 36px;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(44, 38, 35, 0.16);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-begin-story:hover, .btn-begin-story:active {
  background: #3B3330;
  transform: scale(0.98);
}

.btn-begin-story .play-triangle {
  font-size: 0.95rem;
  color: var(--mustard);
}

/* ==========================================
   2. MOBILE FILM VIEWPORT & HEADER
   ========================================== */
#film-viewport {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-stage);
  overflow: hidden;
}

/* Top Progress hairline */
.subtle-progress-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.05);
  z-index: 100;
}

.subtle-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mustard), var(--terracotta));
  transition: width 0.4s linear;
}

/* Fixed, Clean Mobile Header Bar */
.mobile-header-bar {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 150;
  pointer-events: none;
}

.scene-title-badge {
  display: flex;
  flex-direction: column;
  max-width: calc(100vw - 80px); /* Leave room for single play/pause button */
  pointer-events: auto;
}

.scene-chapter-tag {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--mustard-dark);
  line-height: 1;
  margin-bottom: 3px;
}

.scene-chapter-heading {
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 3.8vw, 1.25rem);
  font-weight: 600;
  color: var(--charcoal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Single Top-Right Play/Pause Button */
.floating-film-controls {
  pointer-events: auto;
  display: flex;
  align-items: center;
}

.single-play-btn {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(44, 38, 35, 0.15);
  color: var(--charcoal);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  font-size: 0.95rem;
  transition: transform 0.2s ease, background 0.2s ease;
}

.single-play-btn:active {
  transform: scale(0.92);
  background: #FFF;
}

/* Main Full-Screen Mobile Canvas Stage */
.scene-full-stage {
  width: 100vw;
  height: 100dvh;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 48px; /* Safe space beneath mobile header */
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scene-full-stage.scene-transitioning {
  opacity: 0;
  transform: scale(0.98);
}

.scene-svg-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scene-svg-wrapper svg {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: calc(100dvh - 50px);
  object-fit: contain;
}

/* ==========================================
   3. FINAL REPLAY SCREEN
   ========================================== */
#ending-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(251, 248, 242, 0.98);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 24px;
  text-align: center;
}

#ending-screen.active {
  opacity: 1;
  pointer-events: auto;
}

.ending-quote {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 4.5vw, 1.6rem);
  font-weight: 600;
  color: var(--charcoal);
  max-width: 340px;
  line-height: 1.45;
  margin-bottom: 18px;
}

.ending-signoff {
  font-family: var(--font-hand);
  font-size: 1.8rem;
  color: var(--terracotta);
  margin-bottom: 32px;
}

/* Subtle animations */
@keyframes walk-cycle-left {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-3px) rotate(3deg); }
  75% { transform: translateY(-1px) rotate(-2deg); }
}

@keyframes walk-cycle-right {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-1px) rotate(-2deg); }
  75% { transform: translateY(-3px) rotate(3deg); }
}

@keyframes anim-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes anim-package-flight {
  0% { transform: translate(0, 0); }
  50% { transform: translate(80px, -20px); }
  100% { transform: translate(160px, 0); }
}

.anim-walk-left { animation: walk-cycle-left 1.2s infinite ease-in-out; }
.anim-walk-right { animation: walk-cycle-right 1.2s infinite ease-in-out; }
.anim-gentle-breathe { animation: anim-breathe 3s infinite ease-in-out; }
.anim-package-fly { animation: anim-package-flight 2.8s infinite ease-in-out; }
