/* -------------------------------------------------------------
 * Theme: Modern Monochrome & Velvet Maroon Wedding Aesthetic
 * ------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400;1,600&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --color-bg: #FAF9F6;
  --color-surface: #FFFFFF;
  --color-text-main: #141414;
  --color-text-muted: #666666;
  --color-maroon: #6B1724;
  --color-maroon-hover: #520F1A;
  --color-maroon-light: #F7EBEF;
  --color-gold: #C5A880;
  --color-gold-light: #F4EFE6;
  --color-border: #E8E5DF;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

html {
  scroll-behavior: smooth;
  background-color: var(--color-bg);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
}

.font-serif {
  font-family: var(--font-serif);
}

.font-sans {
  font-family: var(--font-sans);
}

/* Touch & Tap Optimization across Mobile Safari and Android Chrome */
button, a, input, select, textarea, .btn-maroon, .concept-tab-btn, .deck-card, .story-progress-bar-bg {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Velvet Maroon Buttons & Badges */
.btn-maroon {
  background-color: var(--color-maroon);
  color: #FFFFFF;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.btn-maroon:hover {
  background-color: var(--color-maroon-hover);
  -webkit-transform: translateY(-1px);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -4px rgba(107, 23, 36, 0.35);
}

.btn-outline-dark {
  border: 1px solid var(--color-text-main);
  color: var(--color-text-main);
  transition: all 0.25s ease;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.btn-outline-dark:hover {
  background-color: var(--color-text-main);
  color: #FFFFFF;
}

.border-gold {
  border-color: var(--color-gold);
}

.bg-maroon-light {
  background-color: var(--color-maroon-light);
}

.text-maroon {
  color: var(--color-maroon);
}

/* Glassmorphism Header with iOS Safe Area support */
.glass-header {
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(232, 229, 223, 0.8);
  padding-top: env(safe-area-inset-top, 0px);
}

/* -------------------------------------------------------------
 * FULLSCREEN STORY SLIDESHOW STAGE
 * Dynamic Viewport Height (100dvh) with fallback for older browsers
 * ------------------------------------------------------------- */
#story-slideshow-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
  min-height: 100dvh;
  overflow: hidden;
  background-color: #0A0A0A;
  -webkit-user-select: none;
  user-select: none;
}

.story-slide {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.7s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.7s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.story-slide.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 10;
}

.story-slide.is-hidden {
  display: none !important;
}

/* Cinematic Photo Background & Subtle Smooth Zoom
 * Safari-Safe: Avoids keyframe transform loops on object-fit: cover images which cause blank screens */
.story-bg-media {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-transform: scale(1.08);
  transform: scale(1.08);
  transition: transform 6s cubic-bezier(0.15, 0.9, 0.25, 1), -webkit-transform 6s cubic-bezier(0.15, 0.9, 0.25, 1);
}

.story-slide.active .story-bg-media {
  -webkit-transform: scale(1.0);
  transform: scale(1.0);
}

/* Story Typography & Content: STRICTLY PREVENTS ANY TEXT OVERLAP */
.story-slide .story-content {
  opacity: 0;
  -webkit-transform: translateY(16px);
  transform: translateY(16px);
  transition: opacity 0.4s ease 0.1s, -webkit-transform 0.4s ease 0.1s, transform 0.4s ease 0.1s;
}

.story-slide.active .story-content {
  opacity: 1;
  -webkit-transform: translateY(0);
  transform: translateY(0);
}

/* Story Progress Bars (Instagram / Google Photos Style) */
.story-progress-bar-bg {
  background: rgba(255, 255, 255, 0.3);
  height: 3px;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}
.story-progress-bar-bg:hover {
  background: rgba(255, 255, 255, 0.65);
}

.story-progress-fill {
  background: #FFFFFF;
  height: 100%;
  width: 0%;
  border-radius: 2px;
}

.story-progress-fill.completed {
  width: 100% !important;
  background: #FFFFFF;
}

.story-progress-fill.current-active {
  background: #E5B842; /* Warm Gold */
}

/* Story Controls */
.story-control-btn {
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  transition: all 0.2s ease;
}
.story-control-btn:hover {
  background: rgba(107, 23, 36, 0.85); /* Velvet Maroon */
  border-color: rgba(255, 255, 255, 0.45);
}

/* Subtle Floating Scroll Cue */
.scroll-wheel-indicator {
  animation: floatBounce 2.2s infinite ease-in-out;
  -webkit-animation: floatBounce 2.2s infinite ease-in-out;
}

@-webkit-keyframes floatBounce {
  0%, 100% {
    -webkit-transform: translateY(0);
  }
  50% {
    -webkit-transform: translateY(6px);
  }
}

@keyframes floatBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
  background: #D5D1C8;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-maroon);
}

/* -------------------------------------------------------------
 * OUR 4-YEAR STORY: STICKY ARCHIVAL MUSEUM GALLERY
 * ------------------------------------------------------------- */
/* Cross-browser Sticky Viewport */
.sticky-viewport,
.lg\:sticky {
  position: -webkit-sticky;
  position: sticky;
}

/* Archival Museum Frame:
 * Constrained so it always fits comfortably above the macOS Dock in Chrome/Safari */
.archival-frame {
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(197, 168, 128, 0.35);
  max-height: calc(100vh - 7rem);
  max-height: calc(100dvh - 7rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Sticky Photo Container: Never exceeds viewport height, leaving >100px breathing room above Mac dock */
.sticky-photo-container {
  max-height: min(440px, calc(100vh - 13.5rem), calc(100dvh - 13.5rem));
  width: 100%;
}

#sticky-photo {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
              filter 0.45s cubic-bezier(0.16, 1, 0.3, 1), 
              -webkit-filter 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              -webkit-transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.narrative-milestone {
  border-left: 3px solid transparent;
}
.narrative-milestone.active {
  background: #FFFFFF !important;
  border-color: var(--color-maroon) !important;
  border-left: 3px solid var(--color-maroon);
  box-shadow: 0 10px 25px -5px rgba(107, 23, 36, 0.08);
}

/* -------------------------------------------------------------
 * MOBILE SCROLL-SNAP STORY CAROUSEL (< lg)
 * ------------------------------------------------------------- */
.story-mobile-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  gap: 1rem;
  padding: 0.5rem 0.75rem 1.25rem 0.75rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.story-mobile-carousel::-webkit-scrollbar {
  display: none;
}

.story-mobile-card {
  scroll-snap-align: center;
  flex: 0 0 88%;
  max-width: 380px;
}

.story-tab-pill {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

.story-dot {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}

/* Accessibility: Respect Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    -webkit-animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .story-slide.active .story-bg-media {
    animation: none !important;
    -webkit-animation: none !important;
  }
  .scroll-wheel-indicator {
    animation: none !important;
    -webkit-animation: none !important;
  }
}

/* -------------------------------------------------------------
 * Floating Sticky Soundtrack Button & Micro Equalizer
 * ------------------------------------------------------------- */
.sound-pill {
  position: fixed;
  bottom: max(1.25rem, env(safe-area-inset-bottom, 1.25rem));
  right: max(1.25rem, env(safe-area-inset-right, 1.25rem));
  z-index: 50;
  background: rgba(255, 255, 255, 0.90);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(197, 168, 128, 0.55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  -webkit-user-select: none;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
}

@media (max-width: 640px) {
  .sound-pill {
    bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
    right: max(1rem, env(safe-area-inset-right, 1rem));
  }
}

.sound-pill:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(197, 168, 128, 0.9);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  transform: translateY(-2px);
}

.sound-pill:active {
  transform: translateY(0) scale(0.97);
}

/* Collapsible text container for auto-minimize */
.sound-pill-text {
  max-width: 240px;
  opacity: 1;
  margin-left: 0.625rem;
  transition: max-width 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, margin 0.3s ease;
}

.sound-pill.is-minimized {
  padding-left: 0.85rem;
  padding-right: 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.sound-pill.is-minimized .sound-pill-text {
  max-width: 0;
  opacity: 0;
  margin-left: 0;
  margin-right: 0;
  pointer-events: none;
}

.sound-pill.sound-awaiting-gesture {
  animation: soundPulse 2.5s infinite ease-in-out;
}

@keyframes soundPulse {
  0%, 100% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10), 0 0 0 0 rgba(197, 168, 128, 0.45);
  }
  50% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10), 0 0 0 8px rgba(197, 168, 128, 0);
  }
}

.eq-bar {
  display: inline-block;
  width: 2.5px;
  background-color: #6B1724;
  border-radius: 9999px;
  transition: height 0.25s ease, background-color 0.3s ease;
}

.sound-pill.is-playing .eq-bar:nth-child(1) {
  animation: eqBounce1 0.8s ease-in-out infinite alternate;
}
.sound-pill.is-playing .eq-bar:nth-child(2) {
  animation: eqBounce2 1.1s ease-in-out infinite alternate 0.15s;
}
.sound-pill.is-playing .eq-bar:nth-child(3) {
  animation: eqBounce3 0.9s ease-in-out infinite alternate 0.3s;
}

@keyframes eqBounce1 {
  0% { height: 4px; }
  100% { height: 13px; }
}

@keyframes eqBounce2 {
  0% { height: 3px; }
  100% { height: 16px; }
}

@keyframes eqBounce3 {
  0% { height: 5px; }
  100% { height: 11px; }
}

.sound-pill.is-paused .eq-bar {
  animation: none !important;
  background-color: #9CA3AF;
  height: 3px !important;
}

/* -------------------------------------------------------------
 * Clear Memory Background Translucency (Zero Blur / No Smudge)
 * ------------------------------------------------------------- */
.dream-backdrop {
  background: rgba(250, 249, 246, 0.72);
}

.dream-backdrop-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(197, 168, 128, 0.45);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.dream-backdrop-card-subtle {
  background: rgba(250, 249, 246, 0.65);
  border: 1px solid rgba(197, 168, 128, 0.35);
}

/* -------------------------------------------------------------
 * Moments of Us Lightbox Modal (WebKit Safe & Accessible)
 * ------------------------------------------------------------- */
.is-hidden {
  display: none !important;
  visibility: hidden !important;
}

#moments-lightbox {
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#moments-lightbox.opacity-100 {
  opacity: 1;
}

#lightbox-img {
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

/* -------------------------------------------------------------
 * Infinite Scroll Moments Carousel
 * ------------------------------------------------------------- */
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scrollbar-none::-webkit-scrollbar {
  display: none;
}

#moments-carousel-viewport {
  -webkit-overflow-scrolling: touch;
}
