/* ==========================================================================
   CSS ARCHITECTURE: MOBILE-FIRST RESPONSIVE SYSTEM
   ========================================================================== */

/* --- 1. VARIABLES & RESETS --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --font-display: "Cormorant Garamond", serif;
  --font-body: "Cormorant Garamond", serif;
  --font-script: "Great Vibes", cursive;
  
  --paper: #f7f1e7;
  --ink: #4f4134;
  --accent: #9f7c53;
  
  --section-space: clamp(40px, 8vw, 80px);
  --element-gap: clamp(16px, 4vw, 32px);
  --border-radius-lg: 28px;
  --border-radius-md: 18px;
}

html {
  scroll-behavior: smooth;
}

html, body {
  width: 100%;
  overflow-x: hidden;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Typography Base */
h1, h2, h3, h4, .quote, .rsvp-modal-card h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.04em;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Fixes the blue tap highlight on mobile devices */
button, input, a, label {
  font-family: inherit;
  outline: none;
  -webkit-tap-highlight-color: transparent; 
}

/* --- 2. ENVELOPE COMPONENT --- */
.envelope {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh; /* Fallback */
  height: 100dvh; /* Bypasses mobile URL bars */
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 2500px;
  background: url("assets/cover.webp") center / cover no-repeat; 
  z-index: 50;
  overflow: hidden;
}

.flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 65%; 
  background: url("assets/flap.webp") center top / cover no-repeat; 
  transform-origin: top center;
  transition: transform 2.2s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden; 
  backface-visibility: hidden;
}

.envelope.open .flap {
  transform: rotateX(75deg) translateZ(100px);
}

.seal {
  position: absolute;
  /* Updated to stretch across the entire screen */
  top: 0; 
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  z-index: 51;
  touch-action: manipulation;
}

/* TAP HINT */
.tap-hint-wrapper {
  position: absolute;
  top: 59%; 
  left: 50%;
  transform: translateX(-50%);
  z-index: 51;
  pointer-events: none; /* Allows clicks to pass through if they tap exactly here */
  opacity: 0;
  transition: opacity 1s ease;
}

.tap-hint-wrapper.show {
  opacity: 1;
}

.tap-hint {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #7a5c39; /* Elegant ink/accent matching color */
  text-shadow: 0 2px 4px rgba(255, 255, 255, 0.5); /* Helps legibility over the textured background */
  animation: tapBlink 1.2s ease-in-out infinite alternate;
}

@keyframes tapBlink {
  0% { opacity: 0.2; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(-3px); } /* Gentle floating and blinking effect */
}

/* --- 3. LAYOUT & SECTIONS (Mobile Base) --- */
.hero {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100svh;
  overflow: hidden;
  text-align: center;
}

.hero-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate(-50%, -50%);
  z-index: 0;
}

.hero-main::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(40, 26, 10, 0.44), rgba(53, 34, 13, 0.6)), radial-gradient(circle at center, rgba(255, 247, 236, 0.1), transparent 48%);
  z-index: 1;
}

.overlay {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  width: 100%;
  max-width: 600px;
  min-height: 100svh;
  padding: 24px 16px;
}

.hero-top, .hero-center, .hero-rsvp-jump {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-quote {
  font-size: clamp(18px, 4vw, 24px);
  color: #fff9f1;
  margin-bottom: 6px;
}

.hero-quote-source {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 243, 227, 0.78);
}

.script {
  font-size: clamp(12px, 3vw, 16px);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #fff9f0;
}

/* Couple Names Sizing & Line breaks */
.names {
  font-family: var(--font-script);
  font-size: clamp(38px, 9vw, 90px);
  line-height: 1;
  color: #fffaf3;
  margin: 16px 0;
}

.names span {
  display: block;
}

.names span:nth-child(2) {
  font-family: var(--font-display);
  font-size: clamp(20px, 4vw, 36px);
  margin: 4px 0;
}

.hero-date {
  font-size: clamp(11px, 2.5vw, 14px);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255, 249, 240, 0.9);
}

.hero-rsvp-jump {
  text-decoration: none;
  color: #fff8ed;
  gap: 8px;
  padding-top: 10px;
  cursor: pointer; 
}

.hero-rsvp-arrow {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 248, 238, 0.15);
  backdrop-filter: blur(4px);
  animation: float 2.5s ease-in-out infinite;
  font-size: 18px;
  border: 1px solid rgba(255, 243, 226, 0.3);
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* Sections Global */
.section {
  padding: var(--section-space) 16px;
}

.section-shell {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 16px;
  border-radius: var(--border-radius-lg);
  background: linear-gradient(180deg, rgba(255, 254, 251, 0.94), rgba(248, 240, 229, 0.86));
  box-shadow: 0 20px 50px rgba(120, 91, 54, 0.08);
  border: 1px solid rgba(199, 173, 136, 0.24);
  text-align: center;
}

.section-heading h3 {
  font-family: var(--font-script);
  font-size: clamp(42px, 10vw, 72px);
  color: #8c6b3f;
  margin-bottom: 12px;
  line-height: 1;
}

.section-copy {
  font-size: clamp(15px, 3vw, 18px);
  color: #71563a;
}

/* Countdown */
.hero-countdown {
  min-height: auto; 
  padding-top: var(--section-space);
  padding-bottom: calc(var(--section-space) / 2);
}

.countdown-card {
  width: 100%;
  max-width: 560px;
  padding: 40px 16px;
  margin: 0 auto;
}

.countdown-title {
  font-family: var(--font-script);
  font-size: clamp(48px, 12vw, 84px);
  color: #976737;
  line-height: 1;
}

.date {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #ba9a67;
  margin: 10px 0 24px;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto 24px;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.countdown-unit:not(:last-child) {
  border-right: 1px solid rgba(198, 170, 130, 0.45);
}

.countdown-number {
  font-family: var(--font-display);
  font-size: clamp(26px, 6vw, 48px);
  color: #9d6d35;
  line-height: 1;
}

.countdown-label {
  font-size: clamp(8px, 2vw, 10px);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #c5a26a;
  margin-top: 8px;
}

/* Accelerated & Perfect Loop Slider */
.moments-slider {
  overflow: hidden;
  width: 100%;
  display: flex;
  margin-top: 24px;
  mask-image: linear-gradient(90deg, transparent 0, rgba(0,0,0,1) 10%, rgba(0,0,0,1) 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, rgba(0,0,0,1) 10%, rgba(0,0,0,1) 90%, transparent 100%);
}

.moments-track {
  display: flex;
  gap: 16px;
  width: max-content;
  animation: scrollMarquee 15s linear infinite;
  will-change: transform;
}

/* Fixes touch freeze: Only pause on devices with a real mouse pointer */
@media (hover: hover) and (pointer: fine) {
  .moments-track:hover {
    animation-play-state: paused;
  }
}

.moments-group {
  display: flex;
  gap: 16px;
}

@keyframes scrollMarquee {
  0% { transform: translateX(0); }
  /* Translate exactly 50% of the entire track minus half of one gap to stay perfectly seamless */
  100% { transform: translateX(calc(-50% - 8px)); }
}

.moment-card {
  width: clamp(200px, 60vw, 280px);
  padding: 8px;
  background: #fff;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.moment-card img {
  border-radius: var(--border-radius-md);
  aspect-ratio: 4/5;
  object-fit: cover;
}

/* Venue Cards */
.venue-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 24px;
}

.venue-photo {
  border-radius: var(--border-radius-lg);
  aspect-ratio: 4/5;
  object-fit: cover;
}

/* Venue H4 */
.venue-content h4 {
  font-family: var(--font-display);
  font-size: clamp(10px, 2.9vw, 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #8c6b3f;
}

.venue-link {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 24px;
  border-radius: 50px;
  border: 1px solid rgba(166, 128, 76, 0.4);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #b28b56;
  text-decoration: none;
  background: rgba(255, 252, 246, 0.9);
  transition: all 0.3s ease;
}

.venue-link:hover {
  background: #fdfaf3;
  color: #8d6838;
}

/* Vertical Timeline Update */
.programme-header {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto 28px;
  text-align: center; 
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px; 
  position: relative;
  padding-left: 32px;
  margin-top: 24px;
}

.timeline::after {
  content: "";
  position: absolute;
  top: 0; 
  bottom: 0; 
  left: 10px;
  width: 1px;
  background: rgba(180, 145, 97, 0.4);
}

.timeline-item {
  position: relative;
  width: 100%;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 12px;
  left: -26px; 
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b59263;
}

.timeline-item.left {
  text-align: right;
  padding-left: 10%;
}

.timeline-item.right {
  text-align: left;
  padding-right: 10%;
}

.programme-time {
  font-family: var(--font-display);
  font-size: clamp(20px, 5vw, 26px);
  color: #1a1a1a;
  font-weight: 500;
  margin-bottom: 2px;
}

.programme-label {
  font-family: var(--font-display);
  font-size: clamp(16px, 4vw, 20px);
  color: #333;
  text-transform: none; 
  letter-spacing: normal;
  line-height: 1.4;
}

/* RSVP Form */
.rsvp form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
  margin: 24px auto 0;
  text-align: left;
}

.rsvp input[type="text"], .rsvp input[type="email"], .rsvp input[type="tel"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #d9c7a3;
  border-radius: var(--border-radius-md);
  background: #fffdf9;
  font-size: 16px;
}

.attendance label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(202, 177, 139, 0.24);
  border-radius: var(--border-radius-md);
  margin-top: 10px;
  background: rgba(255, 252, 246, 0.7);
  cursor: pointer;
}

.counter {
  display: grid;
  grid-template-columns: 1fr 40px auto 40px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fffdf9;
  border: 1px solid #e4d6b7;
  border-radius: var(--border-radius-md);
}

.counter button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(122, 92, 57, 0.1);
  color: #7a5c39;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.counter button:hover {
  background: rgba(122, 92, 57, 0.2);
}

.rsvp-submit {
  align-self: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid rgba(122, 92, 57, 0.4);
  background: rgba(122, 92, 57, 0.05);
  color: #7a5c39;
  font-size: 24px;
  cursor: pointer;
  margin-top: 16px;
  transition: transform 0.2s, background 0.2s;
}

.rsvp-submit:hover {
  background: rgba(122, 92, 57, 0.15);
  transform: translateY(-2px);
}

.count-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* Modals & Footer */
.rsvp-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.rsvp-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 20, 10, 0.6);
  backdrop-filter: blur(5px);
}

.rsvp-modal-card {
  position: relative;
  z-index: 101;
  width: 100%;
  max-width: 480px;
  padding: 32px 24px;
  background: linear-gradient(180deg, rgba(255, 254, 250, 0.98), rgba(246, 236, 220, 0.96));
  border-radius: var(--border-radius-lg);
  text-align: center;
  border: 1px solid rgba(220, 199, 169, 0.5);
}

.rsvp-modal-button {
  margin-top: 24px;
  padding: 12px 32px;
  border-radius: 50px;
  border: 1px solid rgba(122, 92, 57, 0.4);
  background: transparent;
  color: #7a5c39;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.2s;
}

.rsvp-modal-button:hover {
  background: rgba(122, 92, 57, 0.1);
}

.site-footer {
  padding: 40px 20px;
  text-align: center;
  color: #8c6b3f;
  background: linear-gradient(180deg, transparent, #efe1cb);
}

.site-footer p {
  opacity: 0; 
}

.site-footer .brand {
  font-family: var(--font-script);
  font-size: 28px;
  color: #7a5c39;
  text-decoration: none;
}

/* Closing Section */
.closing-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.closing-photo {
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 280px; 
  box-shadow: 0 15px 35px rgba(90, 65, 33, 0.1);
}

.closing-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px; 
  text-align: center;
}

.closing-copy h3 {
  font-family: "Coneria Script", "Great Vibes", cursive;
  font-size: clamp(42px, 10vw, 72px);
  color: #8b6234;
  margin: 4px 0;
  font-weight: normal; 
}

.closing-copy p {
  margin: 0;
}

.closing-ampersand {
  font-family: "Coneria Script", "Great Vibes", cursive;
  font-size: clamp(32px, 6vw, 48px);
  color: #9f7c53;
  margin: 0;
  font-weight: normal; 
}

.closing-compliments {
  margin-top: 36px !important;
}

/* --- 4. TABLET BREAKPOINT (769px and up) --- */
@media (min-width: 769px) {
  .section-shell {
    padding: 48px 32px;
  }
  
  .timeline {
    padding-left: 0;
    max-width: 700px;
    margin: 48px auto 0;
    gap: 24px; 
  }

  .timeline::after {
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
  }

  .timeline-item {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    align-items: center;
    width: 100%;
  }

  .timeline-item::before {
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    transform: translateX(-50%) translateY(-50%);
  }

  .timeline-item.left .programme-card {
    grid-column: 1;
    text-align: right;
    padding-right: 24px;
  }

  .timeline-item.right .programme-card {
    grid-column: 3;
    text-align: left;
    padding-left: 24px;
  }
  
  .contact-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .form-subtitle {
    grid-column: span 2;
  }
}

/* --- 5. DESKTOP BREAKPOINT (1025px and up) --- */
@media (min-width: 1025px) {
  .venue-card {
    grid-template-columns: 1fr 1.2fr;
    align-items: center;
    max-width: 800px;
    margin: 32px auto 0;
    text-align: left;
  }
  
  .section-heading-left {
    text-align: center; 
  }
  
  .venue-content h4 {
    font-size: 23px;
  }

  .count-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}