:root {
  --ivory: #f6f2e9;
  --ivory-deep: #ece4d3;
  --sage: #8a9873;
  --sage-deep: #5f6b47;
  --sage-dark: #3f4630;
  --gold: #b89a5b;
  --ink: #3a3a32;
  --font-serif: 'Cormorant Garamond', serif;
  --font-script: 'Great Vibes', cursive;
}

/* Mobile browsers flash a default blue overlay on anything tappable
   (buttons, links) unless told not to — removed site-wide since every
   interactive element here already has its own hover/active feedback. */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--ivory);
  background-image: linear-gradient(rgba(246, 242, 233, 0.92), rgba(246, 242, 233, 0.5)), url('assets/background-wash.jpg');
  background-size: cover, cover;
  background-position: center, center;
  background-attachment: fixed, fixed;
  background-repeat: no-repeat, no-repeat;
  color: var(--ink);
  font-family: var(--font-serif);
  scroll-behavior: smooth;
}

.script-heading {
  font-family: var(--font-script);
  color: var(--sage-dark);
  font-size: 3.2rem;
  margin: 0.2em 0;
}
.script-heading.large { font-size: 4.5rem; }
.script-heading.small { font-size: 2.2rem; }

.eyebrow {
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--sage-deep);
  margin: 0;
}

.page {
  display: none;
  min-height: 100vh;
  padding: 4rem 1.5rem 3rem;
  text-align: center;
  position: relative;
}
.page.active { display: block; }

/* ---------- Envelope intro ---------- */
.envelope-page {
  background-color: var(--ivory-deep);
  background-image: linear-gradient(rgba(246, 242, 233, 0.55), rgba(246, 242, 233, 0.55)), url('assets/background-wash.jpg');
  background-size: cover;
  background-position: center;
}
.envelope-page.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.scene { max-width: 480px; }
.hint { color: var(--sage-deep); letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.8rem; margin-top: 1rem; }

/* ---------- Personal welcome messages (Diana's parents / Eduardo's family) ---------- */
.welcome-page .scene { margin: 4rem auto 0; }
.welcome-message { margin: 1.5rem 0 2rem; }
.welcome-heading-second {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--ivory-deep);
}
.welcome-signature {
  font-style: italic;
  text-align: right;
  color: var(--sage-deep);
  margin: -0.8rem 0 1.8rem;
}
.welcome-signature:last-child { margin-bottom: 0; }

.envelope {
  width: 220px;
  height: 150px;
  margin: 2rem auto 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  transition: transform 0.25s ease;
}
.envelope:hover { transform: translateY(-4px); }
.envelope-photo {
  width: 105%;
  height: 105%;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.envelope-seal {
  position: absolute;
  bottom: -4px; left: 53%;
  transform: translateX(-50%);
  width: 100px; height: 100px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
}

/* ---------- Home ---------- */
.home-page {
  background: linear-gradient(180deg, var(--ivory) 0%, #eef0e2 100%);
  overflow: hidden;
}
.home-page > *:not(.home-carousel) { position: relative; z-index: 1; }

.home-carousel {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.home-carousel .slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2.5s ease;
}
.home-carousel .slide.active { opacity: 0.25; }

.site-nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.nav-link {
  background: none;
  border: none;
  color: var(--sage-deep);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-size: 0.8rem;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  padding: 0.25rem 0;
}
.nav-link:hover { border-bottom-color: var(--sage-deep); }

.music-player { position: relative; z-index: 1; margin: 1rem auto 2rem; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.music-disc {
  width: 200px; height: 200px; border-radius: 50%;
  background: url('assets/vinyl.png') center/cover no-repeat;
  border: none;
  color: var(--sage-dark);
  font-size: 1.5rem;
  cursor: pointer;
  position: relative;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  will-change: transform;
}
#musicIcon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(255,255,255,0.7);
}
.music-disc.playing #musicIcon { display: none; }
.music-label { font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--sage-deep); }

.invite-card-wrap {
  position: relative;
  max-width: 480px;
  margin: 0 auto 2.5rem;
}
.invite-card {
  padding: 2.5rem 1.5rem;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: url('assets/stamp.jpg') center/cover;
  position: relative;
  overflow: visible;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.invite-card,
.music-player,
.countdown,
.cta-row {
  transition: opacity 0.4s ease;
}
.home-page.photos-visible .invite-card,
.home-page.photos-visible .music-player,
.home-page.photos-visible .countdown,
.home-page.photos-visible .cta-row {
  opacity: 0;
  pointer-events: none;
}
.card-opacity-toggle {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 3;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: #fffdf8;
  color: var(--sage-dark);
  font-family: var(--font-serif);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.corner {
  position: absolute;
  top: -140px;
  width: 450px; height: 550px;
  opacity: 0.85;
  pointer-events: none;
}
.corner-left { left: -230px; }
.corner-right { right: -221px; transform: scaleX(-1); }
.invite-date { letter-spacing: 0.2em; font-weight: 600; margin: 0.5rem 0 0.2rem; }
.invite-venue { letter-spacing: 0.1em; color: var(--sage-deep); line-height: 1.6; }

.countdown { max-width: 480px; margin: 0 auto 2.5rem; }
.countdown-grid {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  margin-top: 0.75rem;
}
.countdown-grid div { display: flex; flex-direction: column; align-items: center; }
.countdown-grid span { font-size: 2rem; font-weight: 600; color: var(--sage-dark); }
.countdown-grid label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--sage-deep); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}
.cta-card {
  background: #fffdf8;
  border: 1px solid var(--ivory-deep);
  border-radius: 10px;
  padding: 1.2rem 1.6rem;
  cursor: pointer;
  min-width: 150px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.cta-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }
.cta-eyebrow { display: block; font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--sage-deep); }
.cta-script { display: block; font-family: var(--font-script); font-size: 1.8rem; color: var(--sage-dark); }

.home-video {
  display: block;
  max-width: 480px;
  width: 100%;
  margin: 0 auto 2.5rem;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

/* ---------- Shared blocks ---------- */
.back-link {
  background: none; border: none; cursor: pointer;
  color: var(--sage-deep);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.75rem;
  position: absolute;
  top: 1.5rem; left: 1.5rem;
}

.detail-panel {
  max-width: 640px;
  margin: 0 auto 2rem;
  padding: 2.25rem 1.75rem;
  border-radius: 16px;
  border: 1px solid var(--ivory-deep);
  background-color: #fffdf8;
  background-image: linear-gradient(rgba(255, 253, 248, 0.85), rgba(255, 253, 248, 0.85)), url('assets/stamp.jpg');
  background-size: cover;
  background-position: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.detail-block { max-width: 560px; margin: 0 auto 2.5rem; text-align: left; }
.detail-block h2 { color: var(--sage-dark); margin-top: 0.3rem; }
.detail-cols { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 1rem; }
.detail-cols > div { flex: 1; min-width: 200px; }
.detail-cols h3 { margin: 0 0 0.3rem; color: var(--sage-deep); }

.timeline { list-style: none; padding: 0; margin-top: 1rem; }
.timeline li { padding: 0.5rem 0; border-bottom: 1px dashed var(--ivory-deep); }
.timeline li span { font-weight: 600; color: var(--sage-dark); display: inline-block; width: 90px; }

.gift-accounts { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.2rem; }
.gift-account {
  flex: 1;
  min-width: 220px;
  padding: 1.1rem 1.2rem;
  border-radius: 10px;
  border: 1px solid var(--gold);
  background: linear-gradient(rgba(255, 253, 248, 0.92), rgba(255, 253, 248, 0.92)), url('assets/stamp.jpg');
  background-size: cover;
}
.gift-account-name { font-weight: 600; color: var(--sage-dark); margin: 0; }
.gift-account-bank { font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--sage-deep); margin: 0.15rem 0 0.7rem; }
.gift-account-clabe {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px dashed var(--gold);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-family: var(--font-serif);
  text-align: left;
  transition: background 0.2s ease;
}
.gift-account-clabe:hover { background: var(--ivory-deep); }
.clabe-number { font-size: 1.05rem; font-weight: 600; letter-spacing: 0.03em; color: var(--sage-dark); }
.copy-hint { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sage-deep); }

.map-embed {
  margin-top: 1rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--ivory-deep);
  aspect-ratio: 16 / 10;
}
.map-embed iframe { width: 100%; height: 100%; border: 0; display: block; }

.faq details { border-bottom: 1px solid var(--ivory-deep); padding: 0.7rem 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--sage-dark); }
.faq p { color: var(--ink); margin: 0.5rem 0 0; }

/* ---------- Polaroid stack (Love Story photo carousel) ---------- */
.polaroid-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 2rem auto 2.5rem;
}
.polaroid-nav {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: #fffdf8;
  color: var(--sage-dark);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.polaroid-stack {
  position: relative;
  width: 260px;
  height: 243px;
}
/* The family stack can show taller portrait-frame photos, so it needs a
   taller box or the content below it (footer/story text) overlaps. */
#polaroidStackFamily {
  height: 410px;
}
.polaroid-slot {
  position: absolute;
  top: 50%; left: 50%;
  width: 260px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
}
/* Two physical polaroid shapes: the standard landscape frame and a taller
   portrait frame for antique photos that don't fit a landscape crop well.
   Each has its own aspect ratio and slightly different window position. */
.polaroid-slot.orient-landscape { aspect-ratio: 514 / 480; }
.polaroid-slot.orient-vertical { aspect-ratio: 436 / 664; }

.polaroid-photo { position: absolute; object-fit: cover; }
.polaroid-slot.orient-landscape .polaroid-photo { left: 7.39%; top: 7.71%; width: 84.8%; height: 70.4%; }
.polaroid-slot.orient-vertical .polaroid-photo { left: 7.57%; top: 7.83%; width: 84.63%; height: 70.18%; }

.polaroid-frame {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.polaroid-slot.role-center {
  transform: translate(-50%, -50%);
  opacity: 1;
  z-index: 3;
}
.polaroid-slot.role-behind-left {
  transform: translate(-50%, -50%) translate(-55px, 6px) rotate(-9deg) scale(0.86);
  opacity: 0.55;
  z-index: 1;
}
.polaroid-slot.role-behind-right {
  transform: translate(-50%, -50%) translate(55px, 6px) rotate(9deg) scale(0.86);
  opacity: 0.55;
  z-index: 1;
}
.polaroid-slot.role-exit-left {
  transform: translate(-50%, -50%) translate(-160px, 10px) rotate(-16deg) scale(0.7);
  opacity: 0;
  z-index: 0;
}
.polaroid-slot.role-exit-right {
  transform: translate(-50%, -50%) translate(160px, 10px) rotate(16deg) scale(0.7);
  opacity: 0;
  z-index: 0;
}
.story-text { max-width: 560px; margin: 0 auto 2.5rem; text-align: left; line-height: 1.8; }
.story-quote {
  font-style: italic;
  font-size: 1.25rem;
  text-align: center;
  color: var(--sage-dark);
  margin-top: 1.8rem;
}

.honor-link {
  display: block;
  max-width: 420px;
  margin: 0 auto 2.5rem;
  padding: 1rem 1.5rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: #fffdf8;
  color: var(--sage-dark);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.honor-link:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.12); transform: translateY(-2px); }

/* ---------- RSVP form ---------- */
.rsvp-intro { max-width: 480px; margin: 0.5rem auto 2rem; color: var(--sage-deep); }
.rsvp-form { max-width: 480px; margin: 0 auto; text-align: left; }
.form-block { background: #fffdf8; border: 1px solid var(--ivory-deep); border-radius: 10px; padding: 1.5rem; margin-bottom: 1.5rem; }
.rsvp-form label { display: block; font-weight: 600; margin: 0.9rem 0 0.4rem; color: var(--sage-dark); }
.rsvp-form input[type="text"],
.rsvp-form input[type="number"],
.rsvp-form select,
.rsvp-form textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--ivory-deep);
  border-radius: 6px;
  font-family: var(--font-serif);
  font-size: 1rem;
  background: #fff;
}
.rsvp-form textarea { resize: vertical; line-height: 1.5; }
.hint-small { font-size: 0.8rem; color: var(--sage-deep); margin: 0.2rem 0 0.6rem; }
.radio-row { display: flex; flex-direction: column; gap: 0.6rem; }
.radio-pill { background: var(--ivory-deep); padding: 0.7rem 0.9rem; border-radius: 8px; font-weight: 400; display: flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.btn {
  margin-top: 1rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  border: 1px solid var(--sage-deep);
  background: #fff;
  color: var(--sage-dark);
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 1rem;
}
.btn-primary { background: var(--sage-deep); color: #fff; border-color: var(--sage-deep); }
.form-error { color: #a4442f; font-size: 0.85rem; margin-top: 0.6rem; }
.form-success { color: var(--sage-deep); font-weight: 600; margin-top: 0.8rem; }
.greeting { font-style: italic; color: var(--sage-deep); }

.site-footer { margin-top: 3rem; }
.footer-sub { letter-spacing: 0.2em; font-size: 0.8rem; color: var(--sage-deep); margin: -0.5rem 0 0.8rem; }
.footer-contact { font-size: 0.85rem; }
.footer-contact a { color: var(--sage-dark); }

@media (max-width: 480px) {
  .script-heading.large { font-size: 3.2rem; }
  .cta-row { gap: 0.8rem; }

  /* The polaroid stack is sized for desktop; shrink it and pull the
     behind-slots in closer so the fan doesn't run into the nav buttons
     or off the edge of a phone screen. */
  .polaroid-row { gap: 0.75rem; }
  .polaroid-stack { width: 190px; height: 177px; }
  #polaroidStackFamily { height: 300px; }
  .polaroid-slot { width: 190px; }
  .polaroid-slot.role-behind-left { transform: translate(-50%, -50%) translate(-38px, 4px) rotate(-9deg) scale(0.86); }
  .polaroid-slot.role-behind-right { transform: translate(-50%, -50%) translate(38px, 4px) rotate(9deg) scale(0.86); }
  .polaroid-slot.role-exit-left { transform: translate(-50%, -50%) translate(-110px, 7px) rotate(-16deg) scale(0.7); }
  .polaroid-slot.role-exit-right { transform: translate(-50%, -50%) translate(110px, 7px) rotate(16deg) scale(0.7); }

  /* The vinyl disc is sized for desktop (200px) and dwarfs a phone screen,
     overlapping the "Ver fotos" button and card corner ornament below it. */
  .music-disc { width: 120px; height: 120px; }

  /* The floral corner bouquets are sized and bled for a 480px desktop
     card — shrinking/repositioning them for real phone widths still read
     as broken/disconnected fragments on an actual device, not a smaller
     version of the same ornament. Hidden here rather than risk another
     "looks like a mistake" result; the card stands on its own without
     them on mobile. */
  .corner { display: none; }

}

/* Both were sized for a mouse cursor's precision. On a phone they're
   small, low-contrast tap targets — bump size and padding for anyone
   with less-than-perfect aim (or vision). Kept as its own (pointer:coarse)
   query rather than folded into the max-width one above: "Ver fotos"
   deliberately forces a desktop-width viewport (see script.js) to fix the
   carousel photo cropping, which takes the page OUT of the max-width:480px
   range — pointer:coarse still matches because it reflects the actual
   touchscreen hardware, not the current (spoofed) viewport width, so these
   stay big in both modes. */
@media (max-width: 480px), (pointer: coarse) {
  .nav-link { font-size: 1rem; padding: 0.6rem 0.4rem; }
  .card-opacity-toggle { font-size: 0.9rem; padding: 0.55rem 1rem; }
}
