@font-face {
  font-family: "CormorantCustom";
  src: url("/invites/garden/fonts/Cormorant-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
}

@font-face {
  font-family: "CormorantCustom";
  src: url("/invites/garden/fonts/Cormorant-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 700;
  font-style: italic;
}

@font-face {
  font-family: "CormorantInfantCustom";
  src: url("/invites/garden/fonts/CormorantInfant-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
}

@font-face {
  font-family: "CormorantInfantCustom";
  src: url("/invites/garden/fonts/CormorantInfant-Italic-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 700;
  font-style: italic;
}

:root {
  --sage: #7c8a6a;
  --sage-deep: #55604a;
  --ink: #4a4a42;
  --cream: #f7f3e8;
  --gold: #b99a5b;
  --line: #cfd3c2;
  --design-width: 393;
  --page-width: min(100vw, 430px);
  --scale: calc(var(--page-width) / 393);
  --serif: "CormorantCustom", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--cream);
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: clip;
  background: var(--cream);
}

body.envelope-locked {
  overflow: hidden;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

/* ---------- ENVELOPE ---------- */

.hero-envelope {
  position: fixed;
  inset: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  background: #e5e9dd;
  opacity: 1;
  filter: blur(0);
  transition: opacity 1.05s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-envelope:focus-visible {
  outline: none;
}

.hero-envelope.envelope-open {
  background: #e5e9dd;
}

.hero-envelope.fade-out {
  opacity: 0;
  pointer-events: none;
}

.hero-envelope.is-gone {
  display: none;
}

.envelope-scene {
  position: relative;
  width: min(calc(100dvh * var(--design-width) / 616), 100vw);
  height: 100dvh;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.envelope-scene.assets-ready {
  opacity: 1;
}

.envelope-base,
.envelope-flap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  max-width: none;
}

.envelope-base {
  z-index: 1;
  object-position: center bottom;
  filter: drop-shadow(0 40px 60px rgba(0, 0, 0, 0.16));
  transition: opacity 0.65s ease 1.18s;
}

.envelope-flap {
  z-index: 3;
  object-position: center 38%;
  transform-origin: top center;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  contain: paint;
  cursor: pointer;
  animation-fill-mode: forwards;
  transform: translateY(-12dvh) translateZ(0);
  transition: opacity 0.55s ease 1.18s;
}

.envelope-open .envelope-base {
  opacity: 0;
}

.envelope-open .envelope-flap {
  opacity: 0;
}

.envelope-flap.open {
  animation: flapOpen 1.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.open-note {
  position: absolute;
  left: 50%;
  bottom: 2.2rem;
  transform: translateX(-50%);
  z-index: 10;
  color: #6d5b3a;
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.5);
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
  animation: openNoteFloat 1.7s ease-in-out infinite;
}

.envelope-scene.opening ~ .open-note {
  opacity: 0;
  transform: translate(-50%, 10px);
}

.music-toggle {
  position: fixed;
  right: max(calc((100vw - var(--page-width)) / 2 + 14px), 14px);
  bottom: max(14px, calc(env(safe-area-inset-bottom) + 14px));
  z-index: 80;
  display: grid;
  width: 52px;
  height: 52px;
  padding: 13px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 22px rgba(74, 74, 66, 0.14);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.music-toggle img {
  width: 100%;
  height: 100%;
}

/* ---------- SITE ---------- */

.nikkah-site {
  width: var(--page-width);
  margin: 0 auto;
  overflow: hidden;
  background: var(--cream);
  box-shadow: 0 18px 80px rgba(74, 74, 66, 0.2);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.05s cubic-bezier(0.22, 1, 0.36, 1), transform 1.05s cubic-bezier(0.22, 1, 0.36, 1);
}

.nikkah-site.show {
  opacity: 1;
  transform: translateY(0);
}

.fold {
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* Reveal content, not the full fold: backgrounds stay joined while scrolling. */
.nikkah-site.reveal-enabled .fold:not(.hero-fold) > :not(.details-bg) {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.85s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.nikkah-site.reveal-enabled .fold:not(.hero-fold).is-visible > :not(.details-bg) {
  opacity: 1;
  transform: translateY(0);
}

.nikkah-site.reveal-enabled .fold.is-visible > :nth-child(3) {
  transition-delay: 0.12s;
}

.nikkah-site.reveal-enabled .fold.is-visible > :nth-child(4) {
  transition-delay: 0.2s;
}

/* ---------- FOLD 1 ---------- */

.hero-fold {
  padding: 0 0 calc(70 * var(--scale));
  background: #fbf8f0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
}

.leaves-top {
  position: relative;
  z-index: 2;
  width: 100%;
  margin-bottom: calc(-118 * var(--scale));
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(86%, 330px);
  margin: 0 auto;
  text-align: center;
}

.opening-verse {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(17px, calc(19 * var(--scale)), 21px);
  line-height: 1.34;
  color: var(--ink);
}

.opening-verse span {
  display: block;
}

.opening-verse + .opening-verse {
  margin-bottom: calc(26 * var(--scale));
}

.bismillah-mark {
  width: calc(150 * var(--scale));
  max-width: 170px;
  opacity: 0.85;
}

.bismillah-copy {
  width: min(250px, 92%);
  margin: 10px 0 calc(20 * var(--scale));
  font-family: var(--serif);
  font-size: 11.5px;
  line-height: 1.35;
  color: rgba(74, 74, 66, 0.82);
}

.couple-frame {
  width: calc(268 * var(--scale));
  max-width: 290px;
}

.couple-names {
  margin: calc(16 * var(--scale)) 0 0;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1;
  color: var(--sage-deep);
}

.couple-names span {
  display: block;
  font-size: clamp(40px, calc(46 * var(--scale)), 50px);
}

.couple-names em {
  display: block;
  margin: 2px 0;
  font-size: clamp(20px, calc(23 * var(--scale)), 25px);
  color: var(--gold);
}

.intro {
  width: min(250px, 92%);
  margin: calc(16 * var(--scale)) 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.4;
  color: rgba(74, 74, 66, 0.8);
}

.scroll-hint {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: calc(34 * var(--scale)) auto 0;
  color: var(--sage);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
}

.scroll-hint-arrow {
  width: 13px;
  height: 13px;
  border-right: 2.2px solid currentColor;
  border-bottom: 2.2px solid currentColor;
  transform: rotate(45deg);
  animation: scrollHintBounce 1.7s ease-in-out infinite;
}

/* ---------- FOLD 2 ---------- */

.details-fold {
  padding: calc(64 * var(--scale)) 0 0;
  background: #f6f0e2;
}

.details-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.details-copy {
  position: relative;
  z-index: 2;
  width: min(86%, 330px);
  margin: 0 auto;
  text-align: center;
}

.inshaa {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(26px, calc(30 * var(--scale)), 33px);
  color: var(--sage);
}

.script-on {
  margin: 2px 0 14px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--gold);
}

.event-date {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(28px, calc(32 * var(--scale)), 35px);
  letter-spacing: 0.01em;
  color: var(--sage-deep);
}

.event-time {
  margin: 6px 0 22px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: rgba(74, 74, 66, 0.82);
}

.venue {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: 16px;
  line-height 1.4;
  line-height: 1.4;
}

.venue strong {
  display: block;
  font-weight: 700;
  font-size: 19px;
  color: var(--sage-deep);
}

.venue span {
  display: block;
  color: rgba(74, 74, 66, 0.82);
}

.map-button {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--sage);
  color: #fff;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(124, 138, 106, 0.28);
}

.details-art {
  position: relative;
  z-index: 2;
  width: 100%;
  margin-top: calc(14 * var(--scale));
  mix-blend-mode: multiply;
}

/* ---------- FOLD 3: SCHEDULE ---------- */

.schedule-fold {
  padding: calc(48 * var(--scale)) 0 calc(54 * var(--scale));
  background: #fbf8f0;
  text-align: center;
}

.schedule-title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(30px, calc(34 * var(--scale)), 38px);
  color: var(--sage);
}

.schedule-subtitle {
  margin: 4px 0 calc(30 * var(--scale));
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--sage-deep);
}

.timeline {
  width: min(84%, 320px);
  margin: 0 auto;
  padding: 0;
  list-style: none;
  text-align: left;
}

.timeline li {
  position: relative;
  padding: 0 0 26px 26px;
  border-left: 1px solid var(--line);
}

.timeline li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 3px;
  left: -7px;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--line);
}

.timeline .time {
  display: block;
  font-family: var(--sans);
  font-size: 13px;
  color: rgba(74, 74, 66, 0.72);
}

.timeline strong {
  display: block;
  margin: 3px 0 4px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--sage-deep);
}

.timeline em {
  display: block;
  font-size: 13.5px;
  line-height: 1.4;
  color: rgba(74, 74, 66, 0.78);
}

/* ---------- FOLD 4: DRESS CODE ---------- */

.dress-fold {
  padding: calc(44 * var(--scale)) 0 0;
  background: #f6f0e2;
  text-align: center;
}

.dress-mark {
  width: calc(190 * var(--scale));
  max-width: 210px;
  margin: 0 auto calc(14 * var(--scale));
}

.dress-card {
  width: min(84%, 320px);
  margin: 0 auto;
}

.dress-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(28px, calc(32 * var(--scale)), 36px);
  color: var(--sage);
}

.dress-subtitle {
  margin: 4px 0 16px;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--sage-deep);
}

.dress-lines p {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.35;
}

.dress-lines strong {
  font-weight: 600;
  font-style: italic;
  color: rgba(74, 74, 66, 0.8);
}

.dress-lines span {
  font-weight: 700;
  color: var(--sage-deep);
}

.wardrobe {
  width: 100%;
  margin-top: calc(18 * var(--scale));
}

/* ---------- FOLD 5: RSVP ---------- */

.rsvp-fold {
  padding: calc(40 * var(--scale)) 0 0;
  background: #fbf8f0;
  text-align: center;
}

.gift-note-inline {
  margin: 0 auto calc(26 * var(--scale));
}

.gift-note-highlight {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--gold);
}

.rsvp-form {
  width: min(80%, 300px);
  margin: 0 auto;
}

.rsvp-form h2 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(28px, calc(32 * var(--scale)), 36px);
  color: var(--sage);
}

.attendance-options {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  text-align: left;
}

.attendance-options legend {
  padding: 0 0 8px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--sage-deep);
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
  font-family: var(--serif);
  font-size: 14.5px;
  color: rgba(74, 74, 66, 0.86);
  cursor: pointer;
}

.radio-option input {
  accent-color: var(--sage);
  width: 15px;
  height: 15px;
  margin: 0;
}

.rsvp-form input[type="text"],
.rsvp-form input[type="number"] {
  width: 100%;
  margin-bottom: 11px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
}

.rsvp-form input::placeholder {
  color: rgba(74, 74, 66, 0.45);
}

.rsvp-form input:disabled {
  background: #f1efe7;
  color: rgba(74, 74, 66, 0.5);
}

.submit-button {
  width: 100%;
  padding: 12px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--sage);
  color: #fff;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(124, 138, 106, 0.26);
}

.submit-button:disabled {
  opacity: 0.65;
  cursor: default;
}

.rsvp-status {
  min-height: 18px;
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 13.5px;
  color: var(--sage-deep);
}

.rsvp-status.is-error {
  color: #a4453c;
}

.thankyou {
  margin: calc(34 * var(--scale)) 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(30px, calc(34 * var(--scale)), 38px);
  color: rgba(124, 138, 106, 0.8);
}

.rsvp-bottom {
  width: 100%;
  margin-top: calc(10 * var(--scale));
  mix-blend-mode: multiply;
}

/* ---------- FOOTER ---------- */

.site-footer {
  width: var(--page-width);
  margin: 0 auto;
  padding: 16px 0 22px;
  background: var(--cream);
  text-align: center;
}

.invite-credit {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: rgba(74, 74, 66, 0.6);
}

/* ---------- KEYFRAMES ---------- */

@keyframes flapOpen {
  0% {
    transform: rotateX(0deg) translate3d(0, -12dvh, 0);
  }

  18% {
    transform: rotateX(8deg) translate3d(0, -14dvh, 6px);
  }

  100% {
    transform: rotateX(24deg) translate3d(0, -24dvh, 24px);
  }
}

@keyframes openNoteFloat {
  0%,
  100% {
    transform: translate(-50%, 0);
    opacity: 0.72;
  }

  50% {
    transform: translate(-50%, -6px);
    opacity: 1;
  }
}

@keyframes scrollHintBounce {
  0%,
  100% {
    transform: translateY(0) rotate(45deg);
  }

  50% {
    transform: translateY(6px) rotate(45deg);
  }
}

@media (max-width: 768px) {
  .envelope-base,
  .envelope-flap {
    width: 100%;
    height: 100%;
  }

  .envelope-base {
    transform: none;
  }

  .envelope-flap {
    transform: translate3d(0, -12dvh, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .envelope-scene {
    transition: opacity 0.16s ease;
  }

  .hero-envelope,
  .hero-envelope.fade-out {
    transition: opacity 0.16s ease;
  }

  .nikkah-site {
    transform: none;
    transition: opacity 0.16s ease;
  }

  .envelope-flap,
  .envelope-base {
    transition: opacity 0.16s ease;
  }

  .envelope-flap.open,
  .open-note {
    animation: none;
  }

  .scroll-hint-arrow {
    animation: none;
  }

  .nikkah-site.reveal-enabled .fold:not(.hero-fold) > :not(.details-bg) {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
