/* ============================================
   SN27 — Sherrie & Nav Wedding
   Speakeasy Watercolor Storybook Theme
   ============================================ */

/* --- Parchment Paper Texture (SVG grain overlay) --- */
@property --grain-opacity {
  syntax: '<number>';
  inherits: false;
  initial-value: 0.04;
}

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

:root {
  /* Tuscan Palette */
  --warm-cream: #f5f0e8;
  --parchment: #ede4d3;
  --parchment-deep: #e0d4bc;
  --parchment-light: #f5edd6;
  --honey: #c9a96e;
  --terracotta: #b86f50;
  --olive: #6b7c4e;
  --deep-brown: #3d2b1f;
  --ink: #2a1f14;
  --sky-blue: #a8cce0;
  --dusty-rose: #c9938a;
  --gold: #c4a35a;

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Lora', Georgia, serif;

  /* Spacing */
  --section-pad: clamp(3rem, 8vw, 8rem);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--deep-brown);
  color: var(--ink);
  overflow: hidden; /* Locked during scenes, unlocked after */
  min-height: 100vh;
  min-height: 100dvh;
}

body.unlocked {
  overflow-y: auto;
  background: var(--parchment-light);
}

/* Parchment grain overlay — sits on top of everything, non-interactive */
body.unlocked::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
}

/* --- Scenes (fullscreen, stacked) --- */
.scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s ease;
  z-index: 10;
}

.scene--active {
  opacity: 1;
  visibility: visible;
}

/* --- SCENE 1: SPEAKEASY DOOR --- */
#scene-door {
  /* Warm stone color to blend with the door image edges */
  background: #c9b99a;
  z-index: 30;
}

.door-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Full-bleed door — you ARE at the villa entrance */
.door-image {
  position: absolute;
  /* contain ensures the FULL door (including knocker) is always visible */
  /* The surrounding background color fills the letterbox/pillarbox areas */
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  filter: brightness(0.95);
  transition: filter 0.8s ease, transform 0.8s ease;
  cursor: pointer;
}

.door-image:hover {
  filter: brightness(1);
}

.door-image.door--opened {
  filter: brightness(1.15);
  transform: scale(1.08);
}

/* On portrait screens (mobile), the door can fill more width */
@media (max-aspect-ratio: 3/4) {
  .door-image {
    object-fit: cover;
    object-position: center 30%;
  }
}

/* Vignette — deepens edges, focuses attention on door center */
.door-container::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center 45%, transparent 45%, rgba(42, 31, 20, 0.45) 100%);
  pointer-events: none;
  z-index: 1;
}

.peephole-area {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 60px;
  pointer-events: none;
  z-index: 2;
}

/* Password Gate */
.password-gate {
  position: absolute;
  bottom: 12%;
  z-index: 5;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease 0.3s, visibility 0.6s ease 0.3s;
}

.password-gate.visible {
  opacity: 1;
  visibility: visible;
}

.password-label {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--warm-cream);
  margin-bottom: 1rem;
  font-style: italic;
  background: rgba(42, 31, 20, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.5rem 1.4rem;
  border-radius: 30px;
  display: inline-block;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.password-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(42, 31, 20, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(196, 163, 90, 0.3);
  border-radius: 50px;
  padding: 0.5rem 0.5rem 0.5rem 1.5rem;
  max-width: 320px;
  margin: 0 auto;
}

.password-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--parchment);
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: 0.15em;
}

.password-input::placeholder {
  color: rgba(237, 228, 211, 0.4);
  font-style: italic;
}

.password-btn {
  background: var(--gold);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--deep-brown);
  transition: background 0.3s, transform 0.2s;
  flex-shrink: 0;
}

.password-btn:hover {
  background: var(--honey);
  transform: scale(1.05);
}

.password-error {
  color: var(--dusty-rose);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  opacity: 0;
  transition: opacity 0.3s;
  font-style: italic;
}

.password-error.visible {
  opacity: 1;
}

/* Knock prompt */
.knock-prompt {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  animation: pulse 2s ease-in-out infinite;
  z-index: 5;
}

.knock-prompt p {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: var(--warm-cream);
  font-style: italic;
  background: rgba(42, 31, 20, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.6rem 1.5rem;
  border-radius: 30px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.knock-prompt.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.9; transform: translateX(-50%) translateY(-4px); }
}

/* --- SCENE 2: MAP ZOOM --- */
#scene-map {
  background: var(--parchment-light);
  z-index: 20;
}

.map-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.map-image {
  max-height: 100vh;
  max-width: 100vw;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: 52% 38%; /* Approximate Tuscany location */
}

.map-pin {
  position: absolute;
  top: 38%;
  left: 52%;
  transform: translate(-50%, -50%);
  opacity: 0;
  z-index: 5;
}

.map-pin::before {
  content: '❤️';
  font-size: 2rem;
  display: block;
  text-align: center;
  animation: heartbeat 1.5s ease-in-out infinite;
}

.map-pin-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--deep-brown);
  background: rgba(245, 240, 232, 0.85);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  white-space: nowrap;
  margin-top: 0.25rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Map caption — floating text during zoom */
.map-caption {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.5vw, 2rem);
  font-style: italic;
  color: var(--deep-brown);
  background: rgba(245, 240, 232, 0.85);
  padding: 0.5rem 1.5rem;
  border-radius: 30px;
  white-space: nowrap;
  opacity: 0;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  letter-spacing: 0.05em;
}

/* Map overlay — white fade for crossfade transition */
.map-overlay {
  position: absolute;
  inset: 0;
  background: var(--parchment-light);
  opacity: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.villa-reveal {
  opacity: 0;
  max-width: 80%;
  max-height: 80%;
}

.villa-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}

video.villa-image {
  background: var(--parchment-light);
}

/* --- SCENE 3: SAVE THE DATE LANDING --- */
#scene-landing {
  background:
    radial-gradient(ellipse at 15% 15%, rgba(201,169,110,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(184,111,80,0.06) 0%, transparent 50%),
    var(--parchment-light);
  z-index: 10;
}

.landing-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 2rem;
  text-align: center;
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

/* Crest */
.landing-crest {
  margin-bottom: 1.5rem;
}

.crest-image {
  width: clamp(180px, 35vw, 280px);
  height: auto;
  filter: drop-shadow(0 4px 12px rgba(61, 43, 31, 0.1));
}

/* Ornamental accents */
.landing-ornament {
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.5em;
  opacity: 0.5;
}

.landing-ornament--top {
  margin-bottom: 1.5rem;
}

.landing-ornament--bottom {
  margin-top: 2rem;
}

/* Divider with key */
.landing-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
  width: 100%;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}

.divider-icon {
  font-size: 1.2rem;
}

/* Motto */
.landing-motto {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-style: italic;
  color: var(--olive);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

.landing-text {
  max-width: 600px;
}

.names {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.1;
  color: var(--deep-brown);
  margin-bottom: 0.5rem;
}

.name {
  display: inline-block;
}

.ampersand {
  display: inline-block;
  font-style: italic;
  color: var(--gold);
  margin: 0 0.3em;
  font-weight: 300;
}

.save-the-date {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.5rem);
  font-style: italic;
  color: var(--terracotta);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

.wedding-details {
  margin-bottom: 2.5rem;
}

.detail {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  color: var(--deep-brown);
  line-height: 1.8;
}

.detail--venue {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 600;
  color: var(--olive);
}

/* CTA Buttons */
.cta-section {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 2.5rem;
  border-radius: 50px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn--primary {
  background: var(--terracotta);
  color: var(--warm-cream);
  border: 2px solid var(--terracotta);
}

.btn--primary:hover {
  background: var(--deep-brown);
  border-color: var(--deep-brown);
}

.btn--secondary {
  background: transparent;
  color: var(--deep-brown);
  border: 2px solid var(--deep-brown);
}

.btn--secondary:hover {
  background: var(--deep-brown);
  color: var(--warm-cream);
}

/* Watercolor decorative borders */
.watercolor-border {
  position: absolute;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, rgba(168, 204, 224, 0.15), transparent);
  pointer-events: none;
}

.watercolor-border--top { top: 0; }
.watercolor-border--bottom {
  bottom: 0;
  transform: rotate(180deg);
}

/* --- SCROLLABLE SECTIONS --- */
.section {
  position: relative;
  padding: var(--section-pad) 2rem;
  z-index: 1;
}

.section--details {
  background:
    radial-gradient(ellipse at 10% 20%, rgba(201,169,110,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 90% 80%, rgba(184,111,80,0.05) 0%, transparent 60%),
    var(--parchment-light);
}

.section--rsvp {
  background:
    radial-gradient(ellipse at 80% 10%, rgba(107,124,78,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 90%, rgba(201,169,110,0.07) 0%, transparent 50%),
    var(--parchment);
}

.section-inner {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 300;
  color: var(--deep-brown);
  margin-bottom: 1rem;
}

.section-subtitle {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--terracotta);
  margin-bottom: 3rem;
}

/* Timeline */
.timeline {
  text-align: left;
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--gold), var(--dusty-rose));
}

.timeline-event {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 1.5rem;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.5rem;
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-radius: 50%;
  transform: translateX(-4px);
}

.timeline-date {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--terracotta);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.timeline-event h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--deep-brown);
  margin-bottom: 0.25rem;
}

.timeline-event p {
  font-size: 0.95rem;
  color: var(--ink);
  opacity: 0.8;
  line-height: 1.6;
}

/* RSVP */
.rsvp-embed {
  margin-top: 2rem;
}

.rsvp-placeholder {
  padding: 3rem 2rem;
  border: 2px dashed var(--honey);
  border-radius: 12px;
  color: var(--honey);
  font-style: italic;
}

/* Footer */
.footer {
  background: var(--deep-brown);
  color: var(--parchment);
  text-align: center;
  padding: 2rem;
}

.footer-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
}

.footer-loki {
  font-size: 0.8rem;
  margin-top: 0.5rem;
  opacity: 0.6;
}

/* --- RESPONSIVE --- */
@media (max-width: 600px) {
  .password-input-wrap {
    max-width: 280px;
    padding: 0.4rem 0.4rem 0.4rem 1.2rem;
  }

  .cta-section {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }

  .timeline {
    padding-left: 1.5rem;
  }

  .timeline-event {
    padding-left: 1rem;
  }
}

/* --- Loading state --- */
.loading {
  opacity: 0;
  animation: fadeIn 1s ease forwards;
  animation-delay: 0.3s;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* ============================================
   T2 — CINEMATIC INTRO SCENES (NYC → plane → Atlantic → villa → Loki)
   ============================================ */

/* Full-bleed SVG stages */
.scene--cinematic { background: var(--parchment-light); overflow: hidden; }

.svg-stage,
.svg-stage > svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.svg-stage > svg { display: block; }

/* Scene titles — Cormorant italic, lower third */
.scene-title {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(2rem, 5vw, 2.9rem);
  letter-spacing: 0.04em;
  color: #F5EDD8;
  text-shadow: 0 2px 24px rgba(42, 31, 20, 0.55);
  opacity: 0;
  white-space: nowrap;
  z-index: 4;
}

/* NYC star twinkle */
.star { animation: starTwinkle 2.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.star--2 { animation-delay: 0.9s; animation-duration: 3.2s; }
.star--3 { animation-delay: 1.5s; }
.star--4 { animation-delay: 0.4s; animation-duration: 3.6s; }
.star--5 { animation-delay: 2s; }
@keyframes starTwinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* Departure: plane + exhaust puffs */
.plane-wrap {
  position: absolute;
  left: 38%;
  top: 79vh;
  width: clamp(300px, 44vw, 640px);
  z-index: 3;
}
.plane-wrap svg { width: 100%; height: auto; display: block; }

.puff {
  position: absolute;
  width: clamp(60px, 8vw, 120px);
  left: 36%;
  top: 70%;
  opacity: 0;
  z-index: 2;
}
.puff svg { width: 100%; height: auto; }

.rwyLight { animation: rwyBlink 1.6s ease-in-out infinite; }
.rwyLight:nth-child(2n) { animation-delay: 0.8s; }
@keyframes rwyBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Atlantic */
.atlantic-cam { position: absolute; inset: 0; will-change: transform; }
.svg-stage--atlantic svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.flight-overlay { z-index: 2; }
.map-label {
  font-family: 'Lora', Georgia, serif;
  font-size: 30px;
  letter-spacing: 8px;
  fill: #3C3228;
  opacity: 0.85;
}
.marker-pulse { opacity: 0; transform-origin: center; transform-box: fill-box; }
.marker-pulse.pulsing { animation: markerPulse 1.6s ease-out infinite; }
@keyframes markerPulse {
  0%   { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0;   transform: scale(2.4); }
}

/* Villa banner — hand-lettered ribbon feel */
.scene-banner {
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.4rem, 3.4vw, 2.2rem);
  letter-spacing: 0.08em;
  color: var(--deep-brown);
  background: rgba(245, 237, 216, 0.92);
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  padding: 0.5em 1.6em;
  box-shadow: 0 4px 24px rgba(42, 31, 20, 0.18);
  opacity: 0;
  white-space: nowrap;
  z-index: 4;
}

/* Loki scene */
.scene--loki { background: var(--parchment-light); }
.loki-stage {
  position: relative;
  width: min(92vw, 80vh, 900px);
  margin: auto;
  will-change: transform;
}
.loki-video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  box-shadow: 0 20px 80px rgba(42, 31, 20, 0.28);
}
.speech-bubble {
  position: absolute;
  top: -9%;
  right: -4%;
  width: clamp(220px, 38%, 340px);
  opacity: 0;
  z-index: 3;
  transform: rotate(-2deg);
}
.speech-bubble svg { width: 100%; height: auto; display: block; }
.speech-text {
  position: absolute;
  top: 26%;
  left: 10%;
  width: 80%;
  text-align: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  line-height: 1.25;
  color: #3C3228;
}
.flash-overlay {
  position: absolute;
  inset: 0;
  background: var(--parchment-light);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}

/* Skip intro button */
.skip-intro {
  position: fixed;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 90;
  font-family: 'Lora', Georgia, serif;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--parchment-light);
  background: rgba(42, 31, 20, 0.45);
  border: 1px solid rgba(245, 237, 216, 0.5);
  border-radius: 999px;
  padding: 0.5em 1.1em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: background 0.25s;
}
.skip-intro:hover { background: rgba(42, 31, 20, 0.7); }

/* Inline icons */
.icon { display: inline-block; vertical-align: middle; }
.icon--key { width: 44px; height: 20px; }
.icon--paw { width: 18px; height: 17px; margin-right: 0.25em; transform: translateY(-1px); }
.map-caption .icon { width: 22px; height: 21px; margin-left: 0.3em; transform: translateY(-2px); }

/* Mobile tuning for cinematic scenes */
@media (max-width: 600px) {
  .scene-title { bottom: 22%; }
  .plane-wrap { width: min(78vw, 420px); }
  .speech-bubble { top: -14%; right: 0; }
  .map-label { font-size: 38px; letter-spacing: 6px; }
}

/* Reduced motion: no cinematics (app.js jumps straight to landing) */
@media (prefers-reduced-motion: reduce) {
  .star, .rwyLight, .marker-pulse.pulsing { animation: none; }
}

/* T3 raster stages */
.svg-stage > picture { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage-art { width: 100%; height: 100%; object-fit: cover; display: block; }
