:root {
  --linen: #efe3df;
  --ivory: #faf6f1;
  --paper: #fffcf8;
  --blush: #f5e8e5;
  --blush-deep: #ecd6d2;
  --envelope: #f3e4e0;
  --rose: #a9727b;
  --ink: #4e2430;
  --ink-soft: #86606a;
  --hair: rgba(78, 36, 48, .16);
  --hair-strong: rgba(78, 36, 48, .34);
  --foil: linear-gradient(110deg, #82504a 0%, #b9806f 18%, #dcae9c 32%, #96615a 48%, #c9947f 64%, #e0b4a2 78%, #82504a 100%);
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --script: 'Pinyon Script', cursive;
  --arabic: 'Amiri', serif;
  --calligraphy: 'Aref Ruqaa', serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .18 0 0 0 0 .2 0 0 0 .055 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--linen) var(--grain);
  color: var(--ink);
  font-family: var(--arabic);
  font-size: 1rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.is-sealed { overflow: hidden; }

button, input, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
h1, h2, p { margin: 0; }

.eyebrow {
  font-family: var(--serif);
  font-weight: 500;
  font-size: .7rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.eyebrow--light { color: rgba(255, 248, 244, .85); }

.foil-text {
  background: var(--foil);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: foil-sweep 9s linear infinite;
}

@keyframes foil-sweep { to { background-position: 260% 0; } }

.stage {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 24px 24px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(90% 60% at 50% 45%, rgba(255, 250, 246, .9), transparent 75%),
    var(--linen) var(--grain);
  transition: opacity 1s var(--ease-in-out), visibility 0s 1s;
}

.stage-head { text-align: center; }

.stage-eyebrow {
  font-family: var(--serif);
  font-weight: 500;
  font-size: .68rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stage-names {
  margin-top: 6px;
  font-family: var(--script);
  font-size: clamp(2.2rem, 11vw, 2.8rem);
  line-height: 1.2;
  background: var(--foil);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: foil-sweep 9s linear infinite;
}

.stage-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
  opacity: 0;
  animation: rise .9s var(--ease) 1.4s forwards;
}

.stage-hint span:first-child { font-family: var(--serif); font-size: .68rem; letter-spacing: .32em; text-transform: uppercase; color: var(--ink-soft); }
.stage-hint span:last-child { font-size: .85rem; color: var(--ink-soft); }

.stage, .env { opacity: 0; }
body.fonts-ready .stage { opacity: 1; }
body.fonts-ready .env { animation: env-arrive 1.3s var(--ease) .15s forwards; }

@keyframes env-arrive {
  from { opacity: 0; transform: translateY(24px) rotate(-1.5deg); }
  to { opacity: 1; transform: none; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.env {
  position: relative;
  width: min(86vw, 360px);
  aspect-ratio: 1.42;
  perspective: 1200px;
  filter: drop-shadow(0 28px 30px rgba(78, 36, 48, .16)) drop-shadow(0 4px 6px rgba(78, 36, 48, .08));
}

.env-back {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: linear-gradient(180deg, #d9b9b6, #e6cfcb 55%);
}

.env-card {
  position: absolute;
  inset: 5% 5% 6%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 9%;
  background: var(--paper) var(--grain);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(78, 36, 48, .08);
  transition: transform 1.1s var(--ease);
}

.env-card-crest { width: 30%; }
.env-card-names { margin-top: 4px; font-family: var(--script); font-size: 1.5rem; color: var(--ink); }

.env-pocket {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: 0 0 3px 3px;
  background: var(--env-pocket) center / 100% 100% no-repeat;
  clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
}

.env-flap-shadow {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  height: 68%;
  background: var(--env-shadow) center / 100% 100% no-repeat;
  pointer-events: none;
  transition: opacity .35s ease;
}

.env-flap {
  position: absolute;
  inset: 0 0 auto;
  z-index: 4;
  height: 60%;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 1s var(--ease-in-out);
}

.env-flap-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.env-flap-face--out {
  background: var(--env-flap) center / 100% 100% no-repeat;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.env-flap-face--in {
  transform: rotateX(180deg);
  background: var(--liner) center / 24px 36px, linear-gradient(180deg, #e2b9bd, #d6a5ab);
  clip-path: polygon(3% 0, 97% 0, 50% 94%);
}

.env-seal {
  position: absolute;
  top: calc(60% - 36px);
  left: calc(50% - 36px);
  z-index: 5;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 4px 5px rgba(60, 20, 30, .3));
}

.env-seal::after {
  content: '';
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(169, 114, 123, .5);
  border-radius: 50%;
  animation: halo 2.6s var(--ease) 1.8s infinite;
  opacity: 0;
}

@keyframes halo {
  0% { opacity: .9; transform: scale(.85); }
  100% { opacity: 0; transform: scale(1.35); }
}

.env-seal:focus-visible { outline: 1px solid var(--ink); outline-offset: 8px; }

.seal-half {
  position: absolute;
  inset: 0;
  transition: transform .7s var(--ease), opacity .6s ease;
}

.seal-half--a { clip-path: polygon(0 0, 54% 0, 46% 38%, 56% 62%, 47% 100%, 0 100%); }
.seal-half--b { clip-path: polygon(54% 0, 100% 0, 100% 100%, 47% 100%, 56% 62%, 46% 38%); }

.stage.is-breaking .env-seal::after { display: none; }
.stage.is-breaking .seal-half--a { transform: translate(-16px, 26px) rotate(-22deg); opacity: 0; }
.stage.is-breaking .seal-half--b { transform: translate(16px, 30px) rotate(18deg); opacity: 0; }
.stage.is-breaking .stage-hint { animation: none; opacity: 0; transition: opacity .4s ease; }
.stage.is-breaking .stage-head { opacity: 0; transform: translateY(-8px); transition: opacity .5s ease, transform .6s var(--ease); }
.stage.is-breaking .env-flap-shadow { opacity: 0; }
.stage.is-flap-open .env-flap { transform: rotateX(180deg); }
.stage.is-flap-back .env-flap { z-index: 1; }
.stage.is-card-out .env-card { transform: translateY(-58%); }
.stage.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.stage.is-done .env { transform: translateY(-4%) scale(1.04); transition: transform 1s var(--ease-in-out); }

.page {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  background: var(--ivory) var(--grain);
}

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: 104px 28px 96px;
  text-align: center;
  background: radial-gradient(110% 55% at 50% 0%, var(--blush), transparent 70%);
}

.hero-sprigs span {
  position: absolute;
  top: 10px;
  width: 40%;
  opacity: 0;
}

.hero-sprigs span:first-child { left: -6%; rotate: 32deg; }
.hero-sprigs span:last-child { right: -6%; rotate: -32deg; }
body.is-open .hero-sprigs span { animation: rise 1.6s var(--ease) .2s forwards; }

.hero-crest { width: 104px; margin: 22px 0 26px; }

.hero-names {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(3.3rem, 17vw, 4.4rem);
  line-height: .98;
  letter-spacing: .01em;
  color: var(--ink);
}

.hero-names em {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: .62em;
  line-height: 1.05;
}

.hero-sub { margin-top: 22px; font-size: 1rem; color: var(--ink-soft); }

.hero-date {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 330px;
  margin-top: 26px;
}

.hero-date .rule { flex: 1; height: 1px; background: var(--hair-strong); }

.hero-date p {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--serif);
  line-height: 1.3;
}

.hero-date p span { font-size: .66rem; font-weight: 500; letter-spacing: .32em; text-transform: uppercase; color: var(--ink-soft); }
.hero-date p b { font-weight: 400; font-size: 1.55rem; letter-spacing: .06em; }

.hero-photo {
  width: 72%;
  margin: 40px 0 0;
  padding: 7px;
  border: 1px solid var(--hair-strong);
  border-radius: 999px 999px 2px 2px;
}

.hero-photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 999px 999px 0 0; }

.scroll-cue {
  position: absolute;
  bottom: calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: .6rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.scroll-cue span {
  position: relative;
  width: 1px;
  height: 36px;
  overflow: hidden;
  background: var(--hair);
}

.scroll-cue span::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ink-soft);
  animation: cue 2.2s var(--ease-in-out) infinite;
}

@keyframes cue {
  0% { transform: translateY(-100%); }
  60%, 100% { transform: translateY(100%); }
}

.hero-in { opacity: 0; }

body.is-open .hero-in { animation: hero-rise 1.4s var(--ease) var(--d, 0s) forwards; }

@keyframes hero-rise {
  from { opacity: 0; transform: translateY(16px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}

.countdown { padding: 8px 24px 96px; }

.countdown-panel {
  padding: 30px 12px 26px;
  border: 1px solid var(--hair-strong);
  outline: 1px solid var(--hair);
  outline-offset: -7px;
  text-align: center;
  background: rgba(255, 252, 248, .6);
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 16px;
  font-family: var(--serif);
}

.countdown-grid div { display: flex; flex-direction: column; align-items: center; }
.countdown-grid div + div { border-left: 1px solid var(--hair); }
.countdown-grid span { font-size: 2.35rem; font-weight: 300; line-height: 1.05; font-variant-numeric: lining-nums tabular-nums; }
.countdown-grid small { margin-top: 6px; font-size: .56rem; font-weight: 500; letter-spacing: .26em; text-transform: uppercase; color: var(--ink-soft); }

.invite {
  position: relative;
  padding: 64px 0 104px;
  text-align: center;
  background: var(--ogee) center top / 48px 72px, linear-gradient(180deg, #b47d85, var(--rose) 60%, #a06a73);
}

.invite::before, .invite::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 11px;
  background: var(--scallop-rose) repeat-x center / 22px 11px;
}

.invite::before { top: -10px; transform: scaleY(-1); }
.invite::after { bottom: -10px; }

.card {
  position: relative;
  width: calc(100% - 44px);
  max-width: 390px;
  margin: 48px auto 0;
  padding: 9px;
  border-radius: 999px 999px 3px 3px;
  background: var(--paper) var(--grain);
  box-shadow: 0 1px 2px rgba(60, 20, 30, .12), 0 40px 70px -28px rgba(60, 20, 30, .55);
}

.card-inner {
  position: relative;
  z-index: 1;
  padding: 72px 18px 96px;
  border: 1px solid rgba(169, 114, 123, .38);
  border-radius: 999px 999px 2px 2px;
}

.card-seal {
  position: absolute;
  z-index: 2;
  top: -34px;
  left: 50%;
  width: 72px;
  translate: -50% 0;
  filter: drop-shadow(0 5px 6px rgba(60, 20, 30, .35));
}

.card-basmala { margin-bottom: 18px; font-size: .9rem; color: var(--ink-soft); }
.card-verses p { margin-bottom: 14px; font-size: 1.02rem; line-height: 1.95; }

.card-names {
  margin-top: 16px;
  padding: 0 4px;
  font-family: var(--calligraphy);
  font-weight: 700;
  font-size: clamp(2.7rem, 13.5vw, 3.4rem);
  line-height: 1.35;
}

.card-divider { width: 130px; margin: 8px auto 10px; }
.card-date { font-family: var(--serif); font-size: 1.05rem; letter-spacing: .34em; color: var(--ink-soft); }
.card-blessing { margin: 10px 0 26px; font-weight: 700; }

.card-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 28px;
  padding: 18px 0;
  list-style: none;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}

.card-details li { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0 4px; line-height: 1.35; }
.card-details li + li { border-right: 1px solid var(--hair); }
.card-details span { width: 30px; height: 30px; margin-bottom: 6px; color: var(--rose); }
.card-details b { font-size: .84rem; }
.card-details small { font-family: var(--serif); font-size: .78rem; letter-spacing: .06em; color: var(--ink-soft); }

.card-closing { font-weight: 700; }

.card-lace {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  height: 60px;
  background: var(--lace) repeat-x center bottom / 80px 60px;
  opacity: .9;
}

.location { padding: 104px 28px 24px; text-align: center; }

.section-title { margin-top: 10px; font-size: 1.65rem; font-weight: 700; line-height: 1.5; }

.venue-frame {
  width: 80%;
  margin: 28px auto 24px;
  padding: 44px 18px 22px;
  border: 1px solid var(--hair-strong);
  outline: 1px solid var(--hair);
  outline-offset: 5px;
  border-radius: 999px 999px 2px 2px;
  background: linear-gradient(180deg, var(--blush), transparent 85%);
}

.gazebo { color: var(--rose); }

.venue-name { font-size: 1.3rem; font-weight: 700; }

.venue-address {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 2px;
  font-size: .92rem;
  color: var(--ink-soft);
}

.venue-address > span:first-child { width: 17px; flex: none; }

.btn-outline {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 210px;
  min-height: 54px;
  margin-top: 26px;
  padding: 9px 28px 8px;
  border: 1px solid var(--hair-strong);
  color: var(--ink);
  line-height: 1.35;
  text-decoration: none;
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease);
}

.btn-outline small { font-family: var(--serif); font-size: .6rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ink-soft); transition: color .35s var(--ease); }
.btn-outline:active, .btn-outline:focus-visible { background: var(--ink); border-color: var(--ink); color: var(--ivory); outline: none; }
.btn-outline:active small, .btn-outline:focus-visible small { color: rgba(250, 246, 241, .7); }

.ornament { width: 150px; margin: 64px auto 56px; }

.rsvp { padding: 0 28px 104px; text-align: center; }
.rsvp-by { margin-top: 4px; font-size: .92rem; color: var(--ink-soft); }

.rsvp-form { margin-top: 36px; text-align: right; }

.field { display: block; margin: 0 0 28px; padding: 0; border: 0; min-width: 0; }

.field > span, .field > legend {
  display: block;
  margin-bottom: 4px;
  padding: 0;
  font-size: .9rem;
  color: var(--ink-soft);
}

.field small { font-size: .8rem; opacity: .8; }

.field input[type="text"], .field textarea {
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid var(--hair-strong);
  border-radius: 0;
  background: transparent;
  font-size: 1.1rem;
  transition: border-color .3s var(--ease);
}

.field textarea { resize: none; min-height: 88px; line-height: 1.7; }
.field ::placeholder { color: rgba(134, 96, 106, .5); }
.field input[type="text"]:focus, .field textarea:focus { outline: none; border-bottom-color: var(--ink); }

.choices { display: grid; gap: 10px; margin-top: 10px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }

.choice span {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 12px 18px;
  border: 1px solid var(--hair-strong);
  font-size: 1rem;
  transition: background-color .35s var(--ease), border-color .35s var(--ease);
}

.choice i {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--hair-strong);
  border-radius: 50%;
  transition: border-color .35s var(--ease);
}

.choice i::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
  transition: transform .35s var(--ease);
}

.choice input:checked + span { border-color: var(--ink); background: var(--blush); }
.choice input:checked + span i { border-color: var(--ink); }
.choice input:checked + span i::after { transform: scale(1); }
.choice input:focus-visible + span { outline: 1px solid var(--ink); outline-offset: 3px; }

.form-error { min-height: 1.5em; margin: -10px 0 10px; font-size: .88rem; color: #9b2c43; }

.btn-solid {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  color: var(--ivory);
  font-size: 1.05rem;
  letter-spacing: .02em;
  cursor: pointer;
  transition: opacity .3s ease, transform .2s var(--ease);
}

.btn-solid:active { transform: scale(.985); }
.btn-solid:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.btn-solid:disabled { opacity: .55; cursor: default; }

.rsvp-done { margin-top: 40px; animation: rise .9s var(--ease); }
.rsvp-done-icon { width: 60px; margin: 0 auto 16px; }
.rsvp-done-title { font-size: 1.45rem; font-weight: 700; }
.rsvp-done-text { margin-top: 2px; color: var(--ink-soft); }

.btn-link {
  margin-top: 18px;
  padding: 8px 4px;
  border: 0;
  background: none;
  font-size: .9rem;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--hair-strong);
  cursor: pointer;
}

.footer {
  position: relative;
  padding: 64px 24px calc(88px + var(--safe-bottom));
  text-align: center;
  background: var(--blush) var(--grain);
}

.footer::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 11px;
  background: var(--scallop-blush) repeat-x center / 22px 11px;
  transform: scaleY(-1);
}

.footer-crest { width: 76px; margin: 0 auto 14px; }
.footer-names { font-family: var(--script); font-size: 2.3rem; line-height: 1.3; }
.footer-date { font-family: var(--serif); font-size: .8rem; letter-spacing: .34em; color: var(--ink-soft); }
.footer-note { margin-top: 18px; font-size: .92rem; color: var(--ink-soft); }

.music {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: max(16px, calc(50% - 224px));
  z-index: 20;
  display: flex;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--hair);
  border-radius: 999px;
  background: rgba(255, 252, 248, .82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px -8px rgba(78, 36, 48, .25);
  direction: ltr;
  cursor: pointer;
  animation: rise .8s var(--ease);
}

.music[hidden] { display: none; }
.music-disc { width: 34px; height: 34px; }
.music:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.vinyl-spin { transform-origin: 20px 20px; transform-box: view-box; }
.is-playing .vinyl-spin { animation: spin 3.2s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
}

[data-reveal].is-in { opacity: 1; transform: none; }

@media (min-width: 481px) {
  body { background: var(--linen-pattern), var(--linen) var(--grain); }
  .page { box-shadow: 0 0 0 1px var(--hair), 0 30px 80px -20px rgba(78, 36, 48, .25); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; }
  .foil-text, .stage-names { animation: none !important; }
}
