:root {
  --bg: #eee9dc;
  --paper: #f8f1df;
  --dark: #3d3127;
  --text: #5c5248;
  --accent: #9b8f7d;
  --muted: #b7ad9d;
  --envelope: #3a3026;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Montserrat', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  letter-spacing: .08em;
  text-transform: uppercase;
  overflow-x: hidden;
}
body.opened { overflow-y: auto; }
body:not(.opened) { overflow: hidden; }
a { color: inherit; }
button, input, textarea { font: inherit; }

.preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--text);
  transition: opacity .6s ease, visibility .6s ease;
}
.preloader.hide { opacity: 0; visibility: hidden; }

.hidden { display: none; }
.intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 30px 18px;
  overflow: hidden;
  background: var(--bg);
  transition: opacity .9s ease, visibility .9s ease, transform .9s ease, filter .9s ease;
}
.intro.opening { pointer-events: none; }
.intro.gone { opacity: 0; visibility: hidden; transform: translateY(-18px) scale(1.02); filter: blur(8px); }
.intro-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 58% 71%, rgba(255,255,255,.75), transparent 30%), linear-gradient(rgba(238,233,220,.72), rgba(238,233,220,.92));
}
.intro::after {
  content: '';
  position: absolute;
  left: -20%; right: -20%; bottom: -18%;
  height: 38%;
  border-radius: 50% 50% 0 0;
  background: rgba(255,255,255,.28);
  filter: blur(10px);
}
.intro-sparkles span {
  position: absolute;
  z-index: 1;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  box-shadow: 0 0 18px rgba(255,255,255,.8);
  animation: sparkle 4.5s ease-in-out infinite;
}
.intro-sparkles span:nth-child(1) { left: 20%; top: 24%; animation-delay: .2s; }
.intro-sparkles span:nth-child(2) { right: 18%; top: 31%; animation-delay: 1.2s; }
.intro-sparkles span:nth-child(3) { left: 25%; bottom: 24%; animation-delay: 2.1s; }
.intro-sparkles span:nth-child(4) { right: 26%; bottom: 20%; animation-delay: 3s; }
@keyframes sparkle { 0%, 100% { opacity: .15; transform: translateY(0) scale(.7); } 50% { opacity: 1; transform: translateY(-14px) scale(1); } }

.envelope-button {
  position: relative;
  z-index: 2;
  width: min(76vw, 620px);
  max-width: 620px;
  aspect-ratio: 1.82;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  color: var(--paper);
  transition: transform .5s ease;
}
.envelope-button:hover { transform: translateY(-4px); }
.envelope {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  perspective: 1200px;
  filter: drop-shadow(0 22px 35px rgba(41,32,24,.22));
}
.env-back, .env-left, .env-right, .env-bottom, .env-top, .env-letter, .env-seal, .env-title, .env-script, .env-letter-line {
  position: absolute;
  display: block;
}
.env-back {
  inset: 0;
  background: color-mix(in srgb, var(--envelope), black 4%);
  border-radius: 2px;
}
.env-left { inset: 0; background: linear-gradient(35deg, color-mix(in srgb, var(--envelope), black 20%) 0 50%, transparent 50%); }
.env-right { inset: 0; background: linear-gradient(-35deg, color-mix(in srgb, var(--envelope), black 12%) 0 50%, transparent 50%); }
.env-bottom {
  inset: 0;
  background: linear-gradient(0deg, color-mix(in srgb, var(--envelope), white 8%) 0 52%, transparent 52%);
  clip-path: polygon(0 100%, 50% 50%, 100% 100%);
  z-index: 4;
}
.env-top {
  left: 0; top: 0;
  width: 100%; height: 58%;
  background: color-mix(in srgb, var(--envelope), white 5%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: 50% 0%;
  transition: transform 1.15s cubic-bezier(.2,.75,.2,1), filter .5s ease;
  z-index: 7;
}
.env-letter {
  left: 7%; right: 7%; bottom: 10%;
  height: 68%;
  z-index: 1;
  background: var(--paper);
  border-radius: 3px;
  transform: translateY(22%) scale(.98);
  transition: transform 1.2s cubic-bezier(.2,.7,.1,1) .35s, opacity .8s ease .5s;
}
.env-letter-line {
  left: 12%; right: 12%; bottom: 20%;
  height: 1px;
  background: rgba(61,49,39,.22);
}
.env-script {
  inset: 19% 0 auto 0;
  font-family: var(--serif);
  font-size: clamp(44px, 12vw, 116px);
  line-height: 1;
  color: var(--dark);
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  opacity: .48;
}
.env-seal {
  left: 50%; top: 47%;
  z-index: 9;
  width: clamp(58px, 12vw, 100px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #fff8df, #d9be78 70%);
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.28), 0 8px 22px rgba(0,0,0,.18);
  transition: opacity .5s ease .3s, transform .65s ease;
}
.env-seal::before {
  content: '✧';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8d7141;
  font-size: clamp(22px, 5vw, 42px);
}
.env-title {
  left: 0; right: 0; bottom: 13%;
  z-index: 10;
  font-family: var(--serif);
  color: var(--paper);
  font-size: clamp(18px, 3.4vw, 30px);
  font-weight: 600;
  letter-spacing: .08em;
  text-align: center;
  transition: opacity .4s ease;
}
.intro.opening .envelope { animation: envelopeLift 1.6s cubic-bezier(.2,.75,.2,1) both; }
.intro.opening .env-top { transform: rotateX(172deg); filter: brightness(1.14); }
.intro.opening .env-letter { transform: translateY(-86%) scale(1.04); opacity: .98; }
.intro.opening .env-seal { opacity: 0; transform: translate(-50%, -50%) scale(.72) rotate(18deg); }
.intro.opening .env-title { opacity: 0; }
@keyframes envelopeLift { 0% { transform: translateY(0); } 65% { transform: translateY(-12px); } 100% { transform: translateY(18px) scale(.96); } }
.intro-hint {
  position: relative;
  z-index: 2;
  margin: 0;
  color: var(--text);
  font-size: clamp(14px, 2.4vw, 22px);
  line-height: 1.5;
  text-align: center;
}

.invite { width: min(100%, 920px); margin: 0 auto; background: var(--bg); scroll-snap-type: y proximity; }
.screen {
  position: relative;
  min-height: 100svh;
  padding: clamp(46px, 8vh, 78px) clamp(22px, 7vw, 86px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  scroll-snap-align: start;
}
.screen::before {
  content: '';
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(61,49,39,.08);
  pointer-events: none;
}
h1, h2 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--dark);
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: .03em;
  line-height: .96;
  text-align: center;
}
h1 { font-size: clamp(62px, 18vw, 142px); max-width: 760px; }
h2 { font-size: clamp(54px, 15vw, 118px); }
h3 {
  margin: 0;
  color: var(--dark);
  font-family: var(--serif);
  font-size: clamp(34px, 8vw, 64px);
  font-weight: 500;
  letter-spacing: .04em;
  text-align: center;
}
.place-mini { font-size: clamp(26px, 6vw, 42px); }
.ornament, .script-label {
  font-family: 'Great Vibes', var(--serif);
  font-style: normal;
  text-transform: none;
  letter-spacing: .12em;
  color: var(--accent);
  font-size: clamp(26px, 7vw, 54px);
}
.ornament { margin-bottom: -4px; }
.main-photo-wrap {
  position: relative;
  z-index: 2;
  width: min(76vw, 430px);
  aspect-ratio: 3 / 4;
  margin: 34px 0 24px;
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 20px 45px rgba(61,49,39,.18);
}
.main-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.arch {
  position: absolute;
  width: 145%;
  height: 40%;
  left: -22%;
  top: 45%;
  background: var(--dark);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  z-index: 0;
  opacity: .98;
}
.first-screen .lead, .first-screen .date, .first-screen .script-label, .first-screen .countdown { color: var(--paper); z-index: 2; }
.lead {
  position: relative;
  z-index: 1;
  margin: 18px auto 0;
  max-width: 660px;
  font-size: clamp(16px, 3.2vw, 23px);
  line-height: 1.74;
  text-align: center;
}
.lead.small { font-size: clamp(14px, 2.8vw, 20px); max-width: 660px; }
.date {
  position: relative;
  z-index: 2;
  margin-top: 30px;
  font-family: var(--serif);
  font-size: clamp(56px, 17vw, 126px);
  line-height: 1;
  letter-spacing: .04em;
  text-transform: none;
}
.countdown {
  margin-top: 18px;
  display: grid;
  gap: 6px;
  text-align: center;
  line-height: 1.45;
}
.countdown span { font-size: 12px; letter-spacing: .22em; color: rgba(248,241,223,.82); }
.countdown strong { font-size: clamp(16px, 3vw, 22px); font-weight: 500; color: var(--paper); }
.section-label, .small-title, .mini-heading {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .22em;
  text-align: center;
}
.card, .transfer-card { position: relative; z-index: 1; width: min(100%, 620px); margin-top: 34px; padding: 28px 22px; text-align: center; }
.soft-card { background: rgba(248,241,223,.5); border: 1px solid rgba(61,49,39,.12); border-radius: 28px; box-shadow: 0 20px 46px rgba(61,49,39,.08); }
.card p, .transfer-card p { margin: 12px auto 0; line-height: 1.7; }
.compact { margin-top: 18px; }
.map-buttons { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; margin-top: 22px; }
.pill-link, .submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  margin-top: 0;
  padding: 0 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: .12em;
  transition: transform .25s ease, filter .25s ease, background .25s ease;
}
.pill-link:hover, .submit-btn:hover { transform: translateY(-2px); filter: brightness(.97); }
.submit-btn { margin-top: 10px; width: 100%; }
.line-art { margin-top: 28px; color: var(--dark); font-size: 46px; letter-spacing: .08em; }
.timeline { position: relative; z-index: 1; width: min(100%, 680px); margin-top: 42px; }
.timeline::before { content: ''; position: absolute; left: 68px; top: 10px; bottom: 10px; width: 1px; background: rgba(61,49,39,.22); }
.timeline-item { position: relative; display: grid; grid-template-columns: 110px 1fr; gap: 18px; padding: 0 0 34px; }
.timeline-item:last-child { padding-bottom: 0; }
.time { color: var(--dark); font-family: var(--serif); font-size: 44px; line-height: 1; text-transform: none; }
.timeline-content { padding: 0 0 0 18px; }
.timeline-content::before { content: ''; position: absolute; left: 62px; top: 13px; width: 13px; height: 13px; border-radius: 50%; background: var(--dark); box-shadow: 0 0 0 8px var(--bg); }
.timeline-title { margin: 0; color: var(--dark); font-size: 17px; font-weight: 600; line-height: 1.45; }
.timeline-text { margin: 8px 0 0; font-size: 13px; line-height: 1.85; letter-spacing: .08em; text-transform: none; }
.timeline-link { display: inline-flex; margin-top: 10px; color: var(--dark); font-size: 12px; text-decoration: underline; text-underline-offset: 5px; background: transparent; min-height: auto; padding: 0; }
.text-list { position: relative; z-index: 1; width: min(100%, 700px); margin-top: 34px; display: grid; gap: 18px; }
.small-list { margin-top: 18px; }
.text-list p { margin: 0; padding: 20px 18px; background: rgba(248,241,223,.35); border-left: 2px solid var(--accent); line-height: 1.8; text-transform: none; letter-spacing: .05em; }
.transfer-time { font-family: var(--serif); color: var(--dark); font-size: clamp(56px, 13vw, 92px); line-height: 1; text-transform: none; }
.transfer-place { color: var(--dark); font-weight: 600; }
.palette { position: relative; z-index: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 34px; }
.color-swatch { display: block; width: clamp(58px, 15vw, 100px); aspect-ratio: 1; box-shadow: 0 12px 26px rgba(61,49,39,.08); }
.dress-grid-wrap { position: relative; z-index: 1; width: min(100%, 720px); margin-top: 38px; }
.dress-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 28px; }
.dress-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--paper); }
.rsvp-form { position: relative; z-index: 1; width: min(100%, 680px); margin-top: 30px; display: grid; gap: 18px; }
.field { display: grid; gap: 10px; color: var(--dark); font-size: 14px; }
input[type="text"], input:not([type]), textarea { width: 100%; border: 0; border-bottom: 1px solid var(--dark); border-radius: 0; padding: 12px 2px; background: transparent; color: var(--dark); outline: none; text-transform: none; letter-spacing: .03em; }
textarea { resize: vertical; min-height: 92px; }
fieldset { margin: 0; padding: 18px; border: 1px solid rgba(61,49,39,.16); border-radius: 22px; display: grid; gap: 14px; }
legend { padding: 0 8px; color: var(--dark); font-size: 14px; font-weight: 500; }
fieldset label, .checkboxes label { display: flex; align-items: center; gap: 12px; text-transform: none; letter-spacing: .04em; line-height: 1.5; }
input[type="radio"], input[type="checkbox"] { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--dark); }
.checkboxes { display: grid; gap: 12px; }
.form-note { min-height: 24px; margin: 0; color: var(--dark); text-align: center; text-transform: none; letter-spacing: .04em; line-height: 1.5; }
.final-screen .hands { margin: 44px 0 28px; color: var(--dark); font-size: clamp(110px, 30vw, 220px); line-height: .7; }
.thanks-screen .pill-link { margin-top: 26px; }
.music-player { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 15; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border: 1px solid rgba(61,49,39,.22); border-radius: 999px; background: rgba(248,241,223,.86); color: var(--dark); backdrop-filter: blur(14px); box-shadow: 0 16px 34px rgba(61,49,39,.12); }
.music-player[hidden] { display: none; }
.music-player span { max-width: 140px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; letter-spacing: .12em; }
.music-player button { width: 58px; height: 58px; border: 0; border-radius: 50%; background: var(--paper); color: var(--dark); font-weight: 700; font-size: 22px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(61,49,39,.12); }
.reveal { opacity: 0; transform: translateY(28px) scale(.985); filter: blur(4px); transition: opacity .85s ease, transform .85s ease, filter .85s ease; }
.reveal.visible { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }

@media (max-width: 640px) {
  .screen { padding-left: 20px; padding-right: 20px; }
  .screen::before { inset: 12px; }
  .timeline::before { left: 56px; }
  .timeline-item { grid-template-columns: 86px 1fr; gap: 12px; }
  .timeline-content::before { left: 50px; }
  .time { font-size: 34px; }
  .dress-grid { grid-template-columns: repeat(2, 1fr); }
  .map-buttons { align-items: stretch; }
  .map-buttons .pill-link { width: 100%; }
  .music-player span { display: none; }
  .music-player { padding: 6px; }
}

.guest-greeting {
  position: relative;
  z-index: 2;
  margin: 0 auto 12px;
  max-width: 680px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(24px, 7vw, 48px);
  line-height: 1.15;
  text-align: center;
  letter-spacing: .04em;
  text-transform: none;
}
.gallery-grid {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 34px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--paper);
  box-shadow: 0 18px 38px rgba(61,49,39,.10);
}
.gallery-grid img:nth-child(2n) { transform-origin: center; }
.contact-buttons {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 30px;
}
@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* v6 fixes: cleaner envelope animation, readable countdown, mobile final screen */
.envelope {
  perspective: 1500px;
  transform-style: preserve-3d;
}
.envelope::before {
  content: '';
  position: absolute;
  inset: -10% -8%;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.34), transparent 62%);
  opacity: .75;
  z-index: -1;
  transform: scale(.92);
  transition: opacity .8s ease, transform .8s ease;
}
.env-back { z-index: 1; }
.env-letter {
  z-index: 2;
  bottom: 3%;
  height: 64%;
  transform: translateY(48%) scale(.96);
  opacity: .96;
  box-shadow: 0 8px 24px rgba(38,31,24,.08);
  transition: none;
}
.env-left { z-index: 4; }
.env-right { z-index: 4; }
.env-bottom {
  z-index: 5;
  background: linear-gradient(0deg, color-mix(in srgb, var(--envelope), white 9%) 0 58%, transparent 58%);
}
.env-top {
  z-index: 8;
  height: 60%;
  transform-origin: 50% 0%;
  backface-visibility: visible;
  transform-style: preserve-3d;
  box-shadow: 0 8px 14px rgba(0,0,0,.08);
  transition: none;
}
.env-seal { z-index: 10; }
.env-title { z-index: 11; }
.intro.opening .envelope {
  animation: envelopeLiftV6 2.2s cubic-bezier(.18,.76,.22,1) both;
}
.intro.opening .envelope::before {
  opacity: 1;
  transform: scale(1.12);
}
.intro.opening .env-top {
  z-index: 3;
  animation: envelopeFlapOpenV6 1.15s cubic-bezier(.18,.78,.22,1) forwards;
  filter: brightness(1.08);
}
.intro.opening .env-letter {
  z-index: 7;
  opacity: 1;
  animation: letterRevealV6 1.25s cubic-bezier(.19,.72,.18,1) .62s forwards;
}
.intro.opening .env-seal {
  animation: sealPopV6 .72s cubic-bezier(.18,.75,.25,1) forwards;
}
.intro.opening .env-title { opacity: 0; transform: translateY(10px); }
@keyframes envelopeFlapOpenV6 {
  0% { transform: rotateX(0deg) translateY(0); }
  42% { transform: rotateX(-112deg) translateY(-2px); }
  100% { transform: rotateX(-178deg) translateY(-3px); }
}
@keyframes letterRevealV6 {
  0% { transform: translateY(48%) scale(.96); }
  35% { transform: translateY(2%) scale(.985); }
  74% { transform: translateY(-66%) scale(1.02); }
  100% { transform: translateY(-58%) scale(1.02); }
}
@keyframes sealPopV6 {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  45% { opacity: .9; transform: translate(-50%, -50%) scale(1.18) rotate(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.52) rotate(22deg); }
}
@keyframes envelopeLiftV6 {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-12px) scale(1.015); }
  100% { transform: translateY(20px) scale(.94); opacity: .96; }
}

.ornament[hidden] { display: none !important; }
.first-screen .lead,
.first-screen .date { color: var(--paper); z-index: 2; }
.first-screen .script-label {
  color: var(--accent);
  z-index: 2;
  text-shadow: none;
}
.first-screen .countdown {
  position: relative;
  z-index: 3;
  width: min(100%, 560px);
  margin-top: 18px;
  padding: 14px 18px 16px;
  border: 1px solid rgba(61,49,39,.11);
  border-radius: 999px;
  background: rgba(248,241,223,.62);
  color: var(--dark);
  box-shadow: 0 14px 32px rgba(61,49,39,.07);
  backdrop-filter: blur(6px);
}
.countdown span {
  color: color-mix(in srgb, var(--dark), transparent 16%);
}
.countdown strong {
  color: var(--dark);
  font-size: clamp(15px, 3.3vw, 23px);
}

.final-screen {
  min-height: 100svh;
  justify-content: center;
  padding-top: clamp(34px, 6vh, 64px);
  padding-bottom: clamp(34px, 6vh, 64px);
}
.final-screen h2 {
  max-width: 100%;
  font-size: clamp(40px, 10.8vw, 86px);
  line-height: 1.04;
  letter-spacing: .025em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.final-screen .lead {
  max-width: 680px;
  margin-top: 22px;
  font-size: clamp(14px, 3.1vw, 22px);
  line-height: 1.72;
}
.final-screen .hands {
  margin: 30px 0 22px;
  font-size: clamp(86px, 22vw, 170px);
}
.final-screen .script-label {
  max-width: 100%;
  font-size: clamp(26px, 7vw, 56px);
  line-height: 1.25;
}

@media (max-width: 640px) {
  .envelope-button { width: min(78vw, 360px); }
  .env-letter { left: 8%; right: 8%; }
  .intro.opening .env-letter { animation-name: letterRevealMobileV6; }
  @keyframes letterRevealMobileV6 {
    0% { transform: translateY(48%) scale(.96); }
    38% { transform: translateY(3%) scale(.985); }
    100% { transform: translateY(-48%) scale(1.015); }
  }
  .first-screen { padding-top: 36px; padding-bottom: 36px; }
  .first-screen h1 { font-size: clamp(52px, 16.5vw, 92px); }
  .first-screen .lead { font-size: clamp(13px, 3.3vw, 17px); line-height: 1.62; }
  .date { font-size: clamp(52px, 16vw, 92px); }
  .first-screen .script-label { font-size: clamp(28px, 8vw, 42px); }
  .first-screen .countdown {
    border-radius: 26px;
    padding: 12px 14px 14px;
  }
  .countdown span { font-size: 10px; letter-spacing: .16em; }
  .countdown strong { font-size: clamp(15px, 4.4vw, 18px); line-height: 1.45; }
  .final-screen { padding: 32px 18px 34px; }
  .final-screen h2 { font-size: clamp(32px, 9.4vw, 44px); line-height: 1.08; letter-spacing: .018em; }
  .final-screen .lead { font-size: clamp(12px, 3.45vw, 15px); line-height: 1.62; margin-top: 18px; }
  .final-screen .hands { margin: 22px 0 18px; font-size: clamp(70px, 20vw, 100px); }
  .final-screen .script-label { font-size: clamp(25px, 7.7vw, 38px); letter-spacing: .05em; }
}

/* v8: SVG envelope, selectable animations, mobile section tuning */
:root {
  --envelope-light: color-mix(in srgb, var(--envelope), white 14%);
  --envelope-mid: color-mix(in srgb, var(--envelope), white 4%);
  --envelope-dark: color-mix(in srgb, var(--envelope), black 20%);
}
.envelope-svg { display:block; width:100%; height:100%; perspective:1600px; }
.env-svg { width:100%; height:100%; overflow:visible; }
.svg-envelope-stage { transform-origin: 50% 58%; transform-box: fill-box; }
.svg-letter { transform-origin: 50% 80%; transform-box: fill-box; transform: translateY(92px) scale(.965); }
.svg-env-flap { transform-origin: 50% 0%; transform-box: fill-box; backface-visibility: visible; }
.svg-monogram { font-family: 'Great Vibes', cursive; font-size: 96px; fill: color-mix(in srgb, var(--dark), transparent 30%); opacity:.7; }
.svg-env-title { font-family: var(--serif); font-size: 28px; letter-spacing: .08em; fill: var(--paper); font-weight: 600; }
.svg-seal { transform-origin: 50% 59%; transform-box: view-box; }
.intro.opening .svg-seal { animation: svgSealPop .75s cubic-bezier(.2,.8,.2,1) forwards; }
.intro.opening .svg-env-title { animation: svgTitleFade .45s ease forwards; }
.intro.opening .svg-env-flap { animation: svgFlapCeremony 1.25s cubic-bezier(.18,.76,.18,1) forwards; }
.intro.opening .svg-letter { animation: svgLetterCeremony 1.45s cubic-bezier(.18,.76,.18,1) .58s forwards; }
.intro.opening .svg-envelope-stage { animation: svgEnvelopeExit 2.4s cubic-bezier(.18,.76,.18,1) both; }

.intro.animation-classic.opening .svg-env-flap { animation-name: svgFlapClassic; animation-duration: 1.05s; }
.intro.animation-classic.opening .svg-letter { animation-name: svgLetterClassic; animation-delay: .46s; }
.intro.animation-soft.opening .svg-env-flap { animation-name: svgFlapSoft; animation-duration: 1.55s; }
.intro.animation-soft.opening .svg-letter { animation-name: svgLetterSoft; animation-duration: 1.75s; animation-delay: .72s; }
.intro.animation-quick.opening .svg-env-flap { animation-name: svgFlapClassic; animation-duration: .72s; }
.intro.animation-quick.opening .svg-letter { animation-name: svgLetterClassic; animation-duration: .88s; animation-delay: .28s; }
.intro.animation-quick.opening .svg-envelope-stage { animation-duration: 1.5s; }

@keyframes svgSealPop { 0%{opacity:1;transform:scale(1) rotate(0)} 45%{opacity:.96;transform:scale(1.16) rotate(-8deg)} 100%{opacity:0;transform:scale(.35) rotate(24deg)} }
@keyframes svgTitleFade { to { opacity:0; transform: translateY(10px); } }
@keyframes svgFlapCeremony { 0%{transform:rotateX(0deg)} 38%{transform:rotateX(-116deg)} 100%{transform:rotateX(-178deg)} }
@keyframes svgLetterCeremony { 0%{transform:translateY(92px) scale(.965)} 36%{transform:translateY(18px) scale(.99)} 78%{transform:translateY(-108px) scale(1.015)} 100%{transform:translateY(-92px) scale(1.015)} }
@keyframes svgEnvelopeExit { 0%{transform:translateY(0) scale(1)} 48%{transform:translateY(-10px) scale(1.012)} 100%{transform:translateY(24px) scale(.94); opacity:.97} }
@keyframes svgFlapClassic { from{transform:rotateX(0deg)} to{transform:rotateX(-176deg)} }
@keyframes svgLetterClassic { from{transform:translateY(92px) scale(.965)} to{transform:translateY(-84px) scale(1.01)} }
@keyframes svgFlapSoft { 0%{transform:rotateX(0deg)} 60%{transform:rotateX(-130deg)} 100%{transform:rotateX(-170deg)} }
@keyframes svgLetterSoft { 0%{transform:translateY(92px) scale(.965);opacity:.92} 100%{transform:translateY(-72px) scale(1.005);opacity:1} }

@media (max-width: 640px) {
  .screen { min-height: var(--mobile-min-height, 100svh); }
  .screen h1, .screen h2 { font-size: calc(var(--base-mobile-title, 1em) * var(--mobile-title-scale, 1)); }
  .screen .lead, .screen p, .screen li, .screen label { font-size: calc(1em * var(--mobile-body-scale, 1)); }
  .svg-monogram { font-size: 82px; }
  .svg-env-title { font-size: 25px; }
}

@media (max-width: 640px) {
  .screen h1 { font-size: calc(clamp(48px, 15vw, 92px) * var(--mobile-title-scale, 1)); }
  .screen h2 { font-size: calc(clamp(38px, 10vw, 70px) * var(--mobile-title-scale, 1)); }
  .first-screen h1 { font-size: calc(clamp(52px, 16.5vw, 92px) * var(--mobile-title-scale, 1)); }
  .final-screen h2 { font-size: calc(clamp(32px, 9.4vw, 44px) * var(--mobile-title-scale, 1)); }
}


/* v9: corrected SVG envelope pocket and card layering.
   The card now starts completely inside the envelope and comes out above it,
   without a strange bottom piece sticking out below the pocket. */
.svg-letter {
  transform: translateY(18px) scale(.965);
}
.svg-env-flap {
  transform-origin: 50% 0%;
}
.intro.opening .svg-env-flap {
  animation: svgFlapCeremonyV9 1.12s cubic-bezier(.18,.76,.18,1) forwards;
}
.intro.opening .svg-letter {
  animation: svgLetterCeremonyV9 1.45s cubic-bezier(.18,.76,.18,1) .62s forwards;
}
.intro.animation-classic.opening .svg-env-flap {
  animation-name: svgFlapClassicV9;
  animation-duration: .98s;
}
.intro.animation-classic.opening .svg-letter {
  animation-name: svgLetterClassicV9;
  animation-delay: .5s;
}
.intro.animation-soft.opening .svg-env-flap {
  animation-name: svgFlapSoftV9;
  animation-duration: 1.42s;
}
.intro.animation-soft.opening .svg-letter {
  animation-name: svgLetterSoftV9;
  animation-duration: 1.72s;
  animation-delay: .7s;
}
.intro.animation-quick.opening .svg-env-flap {
  animation-name: svgFlapClassicV9;
  animation-duration: .68s;
}
.intro.animation-quick.opening .svg-letter {
  animation-name: svgLetterClassicV9;
  animation-duration: .92s;
  animation-delay: .3s;
}
@keyframes svgFlapCeremonyV9 {
  0% { transform: rotateX(0deg); opacity: 1; }
  42% { transform: rotateX(-138deg); opacity: .98; }
  72% { transform: rotateX(-178deg); opacity: .72; }
  100% { transform: rotateX(-184deg); opacity: .34; }
}
@keyframes svgLetterCeremonyV9 {
  0% { transform: translateY(18px) scale(.965); }
  28% { transform: translateY(10px) scale(.98); }
  74% { transform: translateY(-132px) scale(1.012); }
  100% { transform: translateY(-152px) scale(1.015); }
}
@keyframes svgFlapClassicV9 {
  from { transform: rotateX(0deg); opacity: 1; }
  to { transform: rotateX(-184deg); opacity: .38; }
}
@keyframes svgLetterClassicV9 {
  from { transform: translateY(18px) scale(.965); }
  to { transform: translateY(-140px) scale(1.01); }
}
@keyframes svgFlapSoftV9 {
  0% { transform: rotateX(0deg); opacity: 1; }
  65% { transform: rotateX(-148deg); opacity: .82; }
  100% { transform: rotateX(-180deg); opacity: .42; }
}
@keyframes svgLetterSoftV9 {
  0% { transform: translateY(18px) scale(.965); opacity: .92; }
  100% { transform: translateY(-122px) scale(1.005); opacity: 1; }
}

/* v11: date label spacing and mobile timeline marker fix */
.first-screen .date {
  margin-bottom: clamp(14px, 2.6vw, 26px);
}
.first-screen .script-label {
  display: block;
  position: relative;
  z-index: 3;
  margin-top: 0;
  margin-bottom: clamp(16px, 2.8vw, 28px);
  line-height: .92;
  color: color-mix(in srgb, var(--accent), var(--dark) 16%);
  text-shadow: 0 1px 0 rgba(255,255,255,.22);
}
.first-screen .countdown {
  margin-top: clamp(18px, 3vw, 30px);
}
.timeline {
  width: min(100%, 740px);
}
.timeline::before {
  left: 122px;
}
.timeline-item {
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 46px;
  align-items: start;
}
.time {
  text-align: right;
  white-space: nowrap;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}
.timeline-content {
  min-width: 0;
  padding-left: 0;
}
.timeline-content::before {
  left: 116px;
  top: 14px;
}

@media (max-width: 640px) {
  .first-screen .date {
    margin-bottom: clamp(16px, 4vw, 24px);
  }
  .first-screen .script-label {
    margin-top: 0;
    margin-bottom: clamp(18px, 4.4vw, 28px);
    line-height: .96;
    font-size: clamp(26px, 7.4vw, 38px);
  }
  .first-screen .countdown {
    margin-top: clamp(18px, 4.4vw, 28px);
  }
  .timeline {
    width: 100%;
    margin-top: 34px;
  }
  .timeline::before {
    left: 94px;
    top: 9px;
    bottom: 8px;
  }
  .timeline-item {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 36px;
    padding-bottom: 32px;
  }
  .timeline-content {
    padding-left: 0;
  }
  .timeline-content::before {
    left: 88px;
    top: 10px;
    width: 13px;
    height: 13px;
    box-shadow: 0 0 0 7px var(--bg);
  }
  .time {
    font-size: 32px;
    line-height: 1;
    letter-spacing: 0;
  }
  .timeline-title {
    font-size: 15px;
    line-height: 1.35;
    letter-spacing: .08em;
  }
  .timeline-text {
    font-size: 12.5px;
    line-height: 1.75;
    letter-spacing: .045em;
  }
}

@media (max-width: 380px) {
  .timeline::before { left: 90px; }
  .timeline-item { grid-template-columns: 72px minmax(0, 1fr); gap: 34px; }
  .timeline-content::before { left: 84px; }
  .time { font-size: 30px; }
  .timeline-title { font-size: 14px; }
  .timeline-text { font-size: 12px; }
}


/* v12: fix first-screen subtitle overlap and refine envelope layering */
.svg-env-left, .svg-env-right, .svg-env-bottom { opacity: 1 !important; }
.svg-letter { transform: translateY(30px) scale(.955); }
.intro.opening .svg-letter { animation: svgLetterCeremonyV12 1.42s cubic-bezier(.18,.76,.18,1) .62s forwards; }
.intro.animation-classic.opening .svg-letter { animation-name: svgLetterClassicV12; }
.intro.animation-soft.opening .svg-letter { animation-name: svgLetterSoftV12; }
.intro.animation-quick.opening .svg-letter { animation-name: svgLetterClassicV12; }
.intro.opening .svg-env-flap { animation: svgFlapCeremonyV12 1.12s cubic-bezier(.18,.76,.18,1) forwards; }
.intro.animation-classic.opening .svg-env-flap { animation-name: svgFlapClassicV12; }
.intro.animation-soft.opening .svg-env-flap { animation-name: svgFlapSoftV12; }
.intro.animation-quick.opening .svg-env-flap { animation-name: svgFlapClassicV12; }
@keyframes svgFlapCeremonyV12 { 0% { transform: rotateX(0deg); opacity: 1; } 42% { transform: rotateX(-138deg); opacity: 1; } 72% { transform: rotateX(-178deg); opacity: .98; } 100% { transform: rotateX(-184deg); opacity: .96; } }
@keyframes svgFlapClassicV12 { from { transform: rotateX(0deg); opacity: 1; } to { transform: rotateX(-184deg); opacity: .96; } }
@keyframes svgFlapSoftV12 { 0% { transform: rotateX(0deg); opacity: 1; } 65% { transform: rotateX(-148deg); opacity: 1; } 100% { transform: rotateX(-180deg); opacity: .96; } }
@keyframes svgLetterCeremonyV12 { 0% { transform: translateY(30px) scale(.955); } 28% { transform: translateY(20px) scale(.97); } 74% { transform: translateY(-128px) scale(1.01); } 100% { transform: translateY(-148px) scale(1.012); } }
@keyframes svgLetterClassicV12 { from { transform: translateY(30px) scale(.955); } to { transform: translateY(-136px) scale(1.008); } }
@keyframes svgLetterSoftV12 { 0% { transform: translateY(30px) scale(.955); opacity: .96; } 100% { transform: translateY(-118px) scale(1.003); opacity: 1; } }
.first-screen .script-label { margin-top: clamp(18px, 3.2vw, 28px) !important; margin-bottom: clamp(18px, 3vw, 30px); line-height: 1.08 !important; font-size: clamp(30px, 5.4vw, 50px); }
.first-screen .countdown { margin-top: clamp(16px, 2.8vw, 28px) !important; }
@media (max-width: 640px) { .first-screen .script-label { margin-top: 14px !important; margin-bottom: 18px; line-height: 1.08 !important; font-size: clamp(24px, 6vw, 34px); } .svg-monogram { font-size: 76px; } }


/* v13: letter should sit in front of the top flap and date label should straddle the color boundary cleanly */
.svg-letter { transform: translateY(34px) scale(.952); }
.svg-env-flap { opacity: 1 !important; }
.intro.opening .svg-letter { animation: svgLetterCeremonyV13 1.42s cubic-bezier(.18,.76,.18,1) .62s forwards; }
.intro.animation-classic.opening .svg-letter { animation-name: svgLetterClassicV13; }
.intro.animation-soft.opening .svg-letter { animation-name: svgLetterSoftV13; }
.intro.animation-quick.opening .svg-letter { animation-name: svgLetterClassicV13; }
@keyframes svgLetterCeremonyV13 { 0% { transform: translateY(34px) scale(.952); } 28% { transform: translateY(26px) scale(.968); } 74% { transform: translateY(-118px) scale(1.008); } 100% { transform: translateY(-140px) scale(1.01); } }
@keyframes svgLetterClassicV13 { from { transform: translateY(34px) scale(.952); } to { transform: translateY(-130px) scale(1.006); } }
@keyframes svgLetterSoftV13 { 0% { transform: translateY(34px) scale(.952); opacity: .96; } 100% { transform: translateY(-112px) scale(1.002); opacity: 1; } }
.first-screen .script-label { margin-top: 0 !important; transform: translateY(16px); margin-bottom: clamp(28px, 4vw, 42px); line-height: .98 !important; font-size: clamp(28px, 5vw, 46px); }
.first-screen .countdown { margin-top: clamp(26px, 4vw, 38px) !important; }
@media (max-width: 640px) { .first-screen .script-label { transform: translateY(14px); margin-bottom: 24px; font-size: clamp(24px, 6vw, 32px); } .first-screen .countdown { margin-top: 24px !important; } }


/* v14: elevated opening transition, decorative details, improved timeline, micro-animations, RSVP wizard */
.open-veil {
  position: fixed; inset: 0; pointer-events: none; z-index: 12;
  background: radial-gradient(circle at 50% 35%, rgba(255,248,232,.96), rgba(238,233,220,.78) 45%, rgba(238,233,220,0) 80%);
  opacity: 0; transition: opacity .9s ease;
}
.open-veil.active { opacity: 1; }
.invite.entering { display: block; opacity: 0; transform: translateY(24px) scale(.992); filter: blur(8px); }
.invite.entered { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); transition: opacity .95s ease, transform .95s ease, filter .95s ease; }

.reveal-left { transform: translateX(-26px); }
.reveal-scale { transform: translateY(18px) scale(.96); }
.reveal.visible.reveal-left, .reveal.visible.reveal-scale { transform: translate(0,0) scale(1); }

[data-section="places"] .section-label::after,
[data-section="plan"] .section-label::after,
[data-section="wishes"] .section-label::after,
[data-section="transfer"] .section-label::after,
[data-section="dress"] .section-label::after,
[data-section="gallery"] .section-label::after,
[data-section="contacts"] .section-label::after,
[data-section="rsvp"] .section-label::after,
[data-section="final"] h2::after {
  display:block; margin-top:10px; font-size: 18px; letter-spacing: .18em; color: rgba(61,49,39,.38);
}
[data-section="places"] .section-label::after { content:'✦'; }
[data-section="plan"] .section-label::after { content:'✦ ✦'; }
[data-section="wishes"] .section-label::after { content:'♡'; }
[data-section="transfer"] .section-label::after { content:'⌁'; }
[data-section="dress"] .section-label::after { content:'❦'; }
[data-section="gallery"] .section-label::after { content:'✦'; }
[data-section="contacts"] .section-label::after { content:'✉'; }
[data-section="rsvp"] .section-label::after { content:'✦'; }
[data-section="final"] h2::after { content:'♡'; font-size:22px; }

.timeline { width: min(100%, 760px); margin-top: 38px; }
.timeline-item { align-items: stretch; }
.timeline-content {
  background: rgba(248,241,223,.42); border: 1px solid rgba(61,49,39,.10); border-radius: 26px;
  padding: 18px 18px 16px 60px; box-shadow: 0 16px 34px rgba(61,49,39,.06);
}
.timeline-content::before { top: 24px; }
.timeline-icon {
  position: absolute; left: 18px; top: 14px; width: 30px; height: 30px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center; background: rgba(61,49,39,.08); color: var(--dark); font-size: 16px;
}
.timeline-title { text-align:left; padding-right: 8px; }
.timeline-text { text-align:left; line-height:1.72; letter-spacing:.045em; }
.timeline-link { margin-top: 12px; }

.rsvp-progress { display:flex; justify-content:center; gap:12px; margin-bottom: 6px; }
.rsvp-progress span { width: 34px; height: 34px; border-radius: 999px; display:grid; place-items:center; border:1px solid rgba(61,49,39,.18); color: var(--muted); background: rgba(255,255,255,.32); font-size: 13px; }
.rsvp-progress span.is-active { background: var(--dark); color: var(--paper); border-color: var(--dark); }
.rsvp-progress span.is-done { background: rgba(61,49,39,.10); color: var(--dark); }
.rsvp-step-card { background: rgba(248,241,223,.42); border: 1px solid rgba(61,49,39,.12); border-radius: 28px; padding: 18px; box-shadow: 0 16px 38px rgba(61,49,39,.07); }
.rsvp-step-card[hidden] { display:none; }
.rsvp-nav { display:flex; justify-content:space-between; gap:12px; margin-top: 8px; }
.pill-link.ghost { background: transparent; border:1px solid rgba(61,49,39,.2); color: var(--dark); box-shadow:none; }
.choice-chip { position:relative; padding: 14px 16px; border:1px solid rgba(61,49,39,.14); border-radius: 18px; background: rgba(255,255,255,.45); transition: transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; cursor:pointer; }
.choice-chip:hover { transform: translateY(-1px); }
.choice-chip input { accent-color: var(--dark); }
.choice-chip:has(input:checked) { background: rgba(61,49,39,.10); border-color: rgba(61,49,39,.34); box-shadow: 0 10px 18px rgba(61,49,39,.08); }
.rsvp-form fieldset { background: rgba(255,255,255,.18); }

@media (max-width: 640px) {
  .timeline { margin-top: 30px; }
  .timeline-content { padding: 16px 14px 14px 52px; border-radius: 22px; }
  .timeline-icon { width: 28px; height: 28px; font-size: 14px; left: 14px; top: 12px; }
  .timeline-item { gap: 24px !important; grid-template-columns: 74px minmax(0, 1fr) !important; }
  .timeline::before { left: 88px !important; }
  .timeline-content::before { left: 82px !important; top: 18px !important; }
  .time { font-size: 28px !important; }
  .rsvp-step-card { padding: 16px; border-radius: 24px; }
  .rsvp-nav { flex-direction: column; }
  .rsvp-nav .pill-link, .rsvp-nav .submit-btn { width:100%; }
}


/* v15: timeline icons must stay inside event cards, not over the time column */
.timeline-content { position: relative; }
.timeline-icon { pointer-events: none; }


/* v16: remove overlapping timeline marker dots from event titles */
.timeline-content::before { content: none !important; display: none !important; }
.timeline::before { opacity: .9; }
@media (max-width: 640px) { .timeline-content::before { content: none !important; display: none !important; } }
