:root {
  --bg-dark: #2a1416;
  --bg-dark-2: #221012;
  --card: #f2ece0;
  --card-2: #ffffff;
  --ink: #3a2a24;
  --maroon: #7c2430;
  --cream: #f3ece1;
  --gold: #b08d57;
  --font-script: 'Dancing Script', cursive;
  --font-serif: 'Cormorant Garamond', serif;
  --font-caps: 'Playfair Display', serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-dark);
  color: var(--cream);
  font-family: var(--font-serif);
  overflow-x: hidden;
}

body.locked { position: fixed; inset: 0; width: 100%; overflow: hidden; }

.label {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--cream);
}

.names-script {
  font-family: var(--font-script);
  font-size: 3rem;
  line-height: 1.15;
  color: var(--cream);
  margin: 0.2em 0;
}

.names-script.small { font-size: 2.2rem; }

/* ---------- Cover / Envelope ---------- */

#cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at center, #331a1c 0%, var(--bg-dark) 70%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 2rem;
  text-align: center;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

#cover.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes coverFadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.cover-eyebrow {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: clamp(0.8rem, 1.1vw, 1rem);
  letter-spacing: 0.3em;
  color: var(--gold);
  animation: coverFadeUp 0.9s ease both;
  animation-delay: 0.2s;
}

.cover-names {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(3.4rem, 10vw, 6.4rem);
  margin: 0;
  animation: coverFadeUp 1s ease both;
  animation-delay: 0.5s;
}

.cover-hint {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: clamp(0.72rem, 1vw, 0.9rem);
  letter-spacing: 0.2em;
  color: var(--gold);
  margin-top: 0.5rem;
  animation: coverFadeUp 0.9s ease both;
  animation-delay: 1.3s;
}

.envelope {
  position: relative;
  width: clamp(340px, 30vw, 480px);
  aspect-ratio: 260 / 175;
  perspective: 32vw;
  cursor: pointer;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.45));
  animation: coverFadeUp 1s ease both;
  animation-delay: 0.9s;
}

.envelope-backmost {
  position: absolute;
  inset: 0;
  background: url('../images/envelop_back.png') center / cover no-repeat;
  z-index: -3;
}

.envelope-back {
  position: absolute;
  inset: 0;
  background: url('../images/envelop_body.png') center / cover no-repeat;
  z-index: 0;
}

.envelope-letter {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 4%;
  height: 78%;
  background: #fffdf8;
  border: 1px solid #e6ddcb;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transform: translateY(0);
  transition: transform 0.9s ease 0.55s;
  z-index: -1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14%;
}

.envelope-letter-text {
  margin: 0;
  text-align: center;
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: clamp(0.78rem, 1.9vw, 1.05rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 1.6;
  color: var(--maroon);
}

.envelope-flap {
  position: absolute;
  inset: 0;
  background: url('../images/envelop_flap.png') center / cover no-repeat;
  transform-origin: top center;
  transition: transform 1.1s cubic-bezier(.45,0,.3,1), filter 1.1s ease, z-index 0s linear 0.5s;
  z-index: 2;
}

.wax-seal {
  position: absolute;
  left: 50%;
  top: 72%;
  transform: translate(-50%, -50%);
  width: clamp(76px, 7vw, 110px);
  height: clamp(76px, 7vw, 110px);
  background: url('../images/stamp.png') center / contain no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-script);
  font-size: 1rem;
  color: var(--maroon);
  z-index: 3;
  transition: opacity 0.4s ease;
}

.envelope.open .envelope-flap {
  transform: rotateX(-175deg);
  filter: brightness(0.9) sepia(0.15);
  z-index: -2;
}

.envelope.open .wax-seal {
  opacity: 0;
}

.envelope.open .envelope-letter {
  transform: translateY(-55%);
}

/* ---------- Shared section layout ---------- */

section, footer {
  position: relative;
  padding: 5rem 1.5rem;
  text-align: center;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.bg-photo {
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.bg-hero {
  background-image: url('../images/hero.jpg'), linear-gradient(160deg, #3c4a3c 0%, #24302a 55%, #1b2620 100%);
}

#hero {
  position: relative;
  overflow: hidden;
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem 1.5rem;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  animation: heroKenBurns 20s ease-in-out infinite alternate;
}

@keyframes heroKenBurns {
  from { transform: scale(1.18); transform-origin: 32% 36%; }
  to { transform: scale(1.02); transform-origin: 32% 36%; }
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bg-rsvp {
  background-image: url('../images/rsvp.jpg'), linear-gradient(160deg, #4a3d34 0%, #2f2620 100%);
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Hero ---------- */

.hero-pattern {
  position: absolute;
  left: 50%;
  width: 75%;
  height: auto;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.45)) drop-shadow(0 3px 8px rgba(0,0,0,0.35));
  opacity: 0;
  transform: translateX(-50%) translateY(24px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.hero-pattern.in-view { opacity: 0.55; transform: translateX(-50%) translateY(0); }

.hero-pattern-top { top: 20px; }

.hero-pattern-bottom {
  bottom: 20px;
  transform: translateX(-50%) rotate(180deg) translateY(24px);
}

.hero-pattern-bottom.in-view { transform: translateX(-50%) rotate(180deg) translateY(0); }

.reveal-1 { transition-delay: 0.1s; }
.reveal-2 { transition-delay: 0.65s; }
.reveal-2b { transition-delay: 1s; }
.reveal-3 { transition-delay: 0.8s; }

.hero-plaque {
  background: url('../images/cloud.png') center / contain no-repeat;
  aspect-ratio: 799 / 561;
  width: min(640px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4% 22%;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.3));
  color: var(--ink);
  position: relative;
  opacity: 0;
  transform: translateY(90px) scale(0.94);
  transition: opacity 1.1s cubic-bezier(.2,.7,.3,1) 0.1s, transform 1.1s cubic-bezier(.2,.7,.3,1) 0.1s;
}

.hero-plaque.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-plaque .names-script {
  color: var(--maroon);
  font-size: clamp(2.6rem, 7.5vw, 4.2rem);
  white-space: normal;
  word-break: break-word;
}
.hero-plaque .label {
  color: var(--maroon);
  margin: 0.2em 0;
}
.hero-plaque .label-date {
  font-size: clamp(1.05rem, 2.1vw, 1.35rem);
}
.hero-plaque .label-place {
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
}

/* ---------- Welcome ---------- */

#welcome { background: var(--bg-dark); }

.framed-photo {
  position: relative;
  width: min(380px, 82vw);
  aspect-ratio: 799 / 795;
  margin: 0 auto 2.5rem;
}

.framed-photo-clip-svg {
  position: absolute;
  top: 14%;
  left: 14%;
  width: 72%;
  height: 72%;
  z-index: 2;
  overflow: visible;
}

.framed-photo-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.welcome-text {
  max-width: 620px;
  margin: 0 auto 1.2rem;
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--cream);
}

.welcome-text.italic { font-style: italic; opacity: 0.85; }

/* ---------- Countdown ---------- */

#countdown { background: var(--bg-dark); padding-top: 1rem; }

.timer {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}

.timer-unit { display: flex; flex-direction: column; align-items: center; min-width: 64px; }

.timer-unit span {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: 500;
}

.timer-unit small {
  font-family: var(--font-caps);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  opacity: 0.75;
  margin-top: 0.3rem;
}

.timer-colon { font-size: 2rem; opacity: 0.6; align-self: flex-start; margin-top: 0.1em; }

/* ---------- RSVP ---------- */

.envelope-card {
  position: relative;
  width: min(360px, 86vw);
  aspect-ratio: 800 / 569;
  cursor: pointer;
  filter: drop-shadow(0 18px 32px rgba(0,0,0,0.4));
  transition: transform 0.3s ease;
}

.envelope-card:hover { transform: translateY(-4px); }

.envelope-card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.envelope-card-title {
  position: absolute;
  left: 0;
  right: 0;
  top: 15%;
  margin: 0;
  text-align: center;
  color: var(--maroon);
  font-size: clamp(1.5rem, 4.4vw, 2rem);
  line-height: 1.15;
}

.envelope-card-seal {
  position: absolute;
  left: 50%;
  top: 68%;
  transform: translate(-50%, -50%);
  width: clamp(56px, 9vw, 72px);
  height: clamp(56px, 9vw, 72px);
  background: url('../images/stamp.png') center / contain no-repeat;
}

.envelope-card-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  margin: 0;
  text-align: center;
  color: var(--maroon);
}

/* ---------- Details ---------- */

#details { background: var(--bg-dark); }

.section-title {
  font-family: var(--font-script);
  font-size: 2.4rem;
  margin-bottom: 2.5rem;
  color: var(--cream);
}

.details-cards {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
  max-width: 440px;
  margin: 0 auto;
}

.detail-card {
  background: var(--card);
  color: var(--ink);
  width: 100%;
  padding: 2.4rem 1.7rem 2rem;
  position: relative;
  box-shadow: 0 20px 45px rgba(0,0,0,0.4);
}

.detail-card::before {
  content: '';
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(124,36,48,0.28);
  pointer-events: none;
}

.detail-card-main {
  background: var(--maroon);
  color: var(--cream);
}

.detail-card-main::before { border-color: rgba(243,236,225,0.35); }
.detail-card-main .detail-label { color: var(--gold); }
.detail-card-main .detail-addr { color: rgba(243,236,225,0.72); }
.detail-card-main .btn-outline { border-color: var(--cream); color: var(--cream); }
.detail-card-main .btn-outline:hover { background: var(--cream); color: var(--maroon); }

.detail-label {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--maroon);
  margin: 0 0 0.9rem;
}

.detail-venue {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
}

.detail-when {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin: 0 0 0.3rem;
}

.detail-addr {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: #6b5b4f;
  margin: 0 0 1.5rem;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}

.qr-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.qr-inline img {
  width: 60px;
  height: 60px;
}

.qr-inline span {
  font-family: var(--font-caps);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b5b4f;
}

.detail-card-main .qr-inline span { color: rgba(243,236,225,0.72); }

.btn-outline {
  display: inline-block;
  padding: 0.6rem 1.6rem;
  border: 1px solid var(--maroon);
  color: var(--maroon);
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.25s ease, color 0.25s ease;
}

.btn-outline:hover { background: var(--maroon); color: var(--cream); }

/* ---------- Our Story ---------- */

#story { background: var(--bg-dark-2); }

.dove { color: var(--maroon); font-size: 1.4rem; margin: 0.6rem 0 2.8rem; }

.story-content {
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}

.story-text {
  font-size: 1.08rem;
  line-height: 1.95;
  color: var(--cream);
  opacity: 0.92;
  margin: 0 0 1.5rem;
}

.story-text.center { text-align: center; }
.story-text.italic { font-style: italic; opacity: 0.8; }

.story-beat {
  text-align: center;
  font-family: var(--font-caps);
  font-style: italic;
  font-weight: 600;
  color: var(--gold);
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin: 2.4rem 0;
}

.story-code {
  text-align: center;
  font-style: italic;
  color: rgba(243,236,225,0.55);
  line-height: 1.9;
  margin: 2.4rem 0;
}

.story-quote {
  text-align: center;
  color: var(--gold);
  font-size: clamp(2.2rem, 6vw, 3rem);
  margin: 0.6rem 0 2.4rem;
}

.story-signature {
  text-align: center;
  color: var(--cream);
  font-size: clamp(2.4rem, 6vw, 3.2rem);
  margin: 2.6rem 0 0.6rem;
}

.story-closing {
  text-align: center;
  display: block;
  color: var(--gold);
}

/* ---------- Album ---------- */

#album { background: var(--bg-dark); }

.gallery-grid {
  column-count: 2;
  column-gap: 10px;
  max-width: 900px;
  margin: 0 auto;
}

.gallery-grid img {
  width: 100%;
  display: block;
  margin-bottom: 10px;
  break-inside: avoid;
  box-shadow: 0 10px 25px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: transform 0.3s ease;
}

.gallery-grid img:hover { transform: scale(1.03); }

@media (min-width: 700px) {
  .gallery-grid { column-count: 3; column-gap: 14px; max-width: 1100px; }
  .gallery-grid img { margin-bottom: 14px; }
}

/* ---------- Lightbox ---------- */

body.lightbox-open { overflow: hidden; }

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,4,5,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.visible { opacity: 1; visibility: visible; }

.lightbox-overlay img {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.lightbox-close {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Gift ---------- */

#gift { background: var(--bg-dark-2); }

.gift-note {
  max-width: 560px;
  margin: 0 auto 2.6rem;
  color: var(--cream);
  opacity: 0.85;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.75;
}

.gift-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.gift-card {
  background: var(--card);
  padding: 1.8rem 1.6rem 1.6rem;
  width: 230px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.35);
}

.gift-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  margin-bottom: 1.1rem;
}

.gift-who {
  color: var(--maroon);
  font-size: 1.6rem;
  margin: 0 0 0.3rem;
}

.gift-bank {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  margin: 0;
}

.gift-name {
  font-family: var(--font-caps);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: #6b5b4f;
  margin: 0.2rem 0 0;
}

/* ---------- Wishes ---------- */

#wishes { background: var(--bg-dark); }

.wishes-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
}

.wish-item {
  border-left: 2px solid var(--gold);
  padding: 0.1rem 0 0.1rem 1.1rem;
}

.wish-name {
  font-family: var(--font-caps);
  font-style: italic;
  font-weight: 600;
  color: var(--gold);
  font-size: 1rem;
  margin: 0 0 0.3rem;
}

.wish-msg {
  color: var(--cream);
  opacity: 0.9;
  font-size: 0.98rem;
  line-height: 1.65;
  margin: 0;
}

.wishes-empty {
  text-align: center;
  color: var(--cream);
  opacity: 0.7;
  font-style: italic;
  margin: 0;
}

/* ---------- Footer ---------- */

footer {
  background: var(--bg-dark-2);
  padding-bottom: 3.5rem;
}

.monogram {
  font-family: var(--font-script);
  font-size: 4rem;
  margin: 0 0 1.5rem;
}

.footer-text { margin: 0.2em 0; }
.footer-text a { color: var(--cream); }

.back-link {
  display: inline-block;
  margin-top: 2rem;
  font-family: var(--font-caps);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.back-link:hover { border-bottom-color: var(--gold); }

/* ---------- RSVP Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,8,9,0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.modal-overlay.visible { opacity: 1; visibility: visible; }

.modal-card {
  background: var(--card);
  color: var(--ink);
  max-width: 420px;
  width: 100%;
  padding: 2.4rem 2rem;
  position: relative;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5);
  text-align: center;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-card .names-script { color: var(--maroon); font-size: 2rem; margin-bottom: 1rem; }

.modal-close {
  position: absolute;
  top: 0.6rem; right: 0.9rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}

#rsvp-form { display: flex; flex-direction: column; gap: 1rem; text-align: left; }

#rsvp-form label {
  font-family: var(--font-caps);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#rsvp-form input,
#rsvp-form select,
#rsvp-form textarea {
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cbbfa8;
  background: #fffdf9;
  color: var(--ink);
  border-radius: 2px;
}

.btn {
  margin-top: 0.5rem;
  align-self: center;
  background: var(--maroon);
  color: var(--cream);
  border: none;
  padding: 0.75rem 2.2rem;
  font-family: var(--font-caps);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: background 0.25s ease;
}

.btn:hover { background: #5f1c25; }

.hidden { display: none; }

/* ---------- Music toggle ---------- */

.music-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(176,141,87,0.5);
  background: rgba(42,20,22,0.85);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.music-toggle svg { width: 20px; height: 20px; }

.music-toggle.is-paused { color: rgba(243,236,225,0.4); }

.music-toggle:hover { transform: scale(1.06); }

@media (min-width: 700px) {
  .section-title { font-size: 2.9rem; }
  .details-cards { max-width: 620px; gap: 2.6rem; }
  .detail-card { padding: 3.4rem 3.2rem 2.8rem; }
  .detail-label { font-size: 0.82rem; margin-bottom: 1.1rem; }
  .detail-venue { font-size: 1.8rem; margin-bottom: 0.7rem; }
  .detail-when { font-size: 1.3rem; margin-bottom: 0.4rem; }
  .detail-addr { font-size: 1.15rem; margin-bottom: 2rem; }
  .detail-actions { gap: 2rem; }
  .qr-inline img { width: 78px; height: 78px; }
  .qr-inline span { font-size: 0.68rem; }
  .btn-outline { padding: 0.8rem 2.1rem; font-size: 0.76rem; }
}

@media (max-width: 560px) {
  .timer-unit span { font-size: 2rem; }
  .hero-plaque { padding: 2rem 1.8rem; }
}
