@font-face {
  font-family: "Noto Nastaliq Urdu";
  src:
    url("assets/fonts/noto-nastaliq-urdu-arabic-400-normal.woff2") format("woff2"),
    url("assets/fonts/NotoNastaliqUrdu.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("assets/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("assets/fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Great Vibes";
  src: url("assets/fonts/GreatVibes-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("assets/fonts/CormorantGaramond-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #1a1612;
  --ink-soft: #3a322a;
  --paper: #e7dcc8;
  --paper-deep: #d4c4a8;
  --paper-light: #f4ebe0;
  --gold: #c4a35a;
  --gold-soft: rgba(196, 163, 90, 0.35);
  --stage: #171411;
  --script: "Noto Nastaliq Urdu", "Segoe UI Historic", serif;
  --body: "Vazirmatn", Tahoma, sans-serif;
  --card-ratio: 711 / 1024;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--stage);
  -webkit-tap-highlight-color: transparent;
}

.theatre {
  position: relative;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem 0.85rem 1.75rem;
  gap: 0.85rem;
}

.theatre__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 40% at 50% 18%, rgba(196, 163, 90, 0.18), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(80, 55, 30, 0.25), transparent 55%),
    radial-gradient(circle at 50% 45%, #2a231c, var(--stage) 68%);
  animation: glow-breathe 8s ease-in-out infinite;
}

.theatre__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.45) 100%);
}

/* Fixed invitation card — same size for all scenes */
.frame {
  position: relative;
  z-index: 1;
  width: min(92vw, calc(86dvh * 711 / 1024), 380px);
  aspect-ratio: var(--card-ratio);
  flex-shrink: 0;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.55));
  animation: frame-settle 1.4s var(--ease) both;
}

.frame__paper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    linear-gradient(165deg, var(--paper-light) 0%, var(--paper) 48%, var(--paper-deep) 100%);
  clip-path: polygon(
    1% 1.4%,
    5% 0.4%,
    10% 1.5%,
    16% 0.3%,
    22% 1.3%,
    29% 0.35%,
    36% 1.4%,
    43% 0.3%,
    50% 1.35%,
    57% 0.35%,
    64% 1.4%,
    71% 0.3%,
    78% 1.35%,
    85% 0.4%,
    92% 1.3%,
    97% 0.5%,
    99% 1.5%,
    98.7% 7%,
    99.4% 16%,
    98.6% 28%,
    99.4% 42%,
    98.6% 56%,
    99.4% 70%,
    98.6% 84%,
    99.1% 93%,
    99% 98%,
    93% 99.4%,
    84% 98.6%,
    72% 99.4%,
    60% 98.6%,
    48% 99.4%,
    36% 98.6%,
    24% 99.4%,
    12% 98.6%,
    4% 99.2%,
    1% 98%,
    0.7% 90%,
    1.4% 76%,
    0.6% 62%,
    1.4% 48%,
    0.6% 34%,
    1.4% 20%,
    0.7% 8%
  );
}

.frame__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  z-index: 3;
}

.frame__shine {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 255, 255, 0.14) 48%,
    transparent 62%
  );
  transform: translateX(-120%);
  animation: paper-shine 7s ease-in-out 1.5s infinite;
}

.scene {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 9% 8% 11%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.03);
  filter: blur(6px);
  transition:
    opacity 1.1s var(--ease),
    transform 1.25s var(--ease),
    filter 1.1s var(--ease),
    visibility 0s linear 1.1s;
}

.scene.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  filter: blur(0);
  transition:
    opacity 1.1s var(--ease),
    transform 1.25s var(--ease),
    filter 1.1s var(--ease),
    visibility 0s;
}

.scene.is-leaving {
  opacity: 0;
  transform: scale(0.96) translateY(-10px);
  filter: blur(5px);
}

.bit {
  opacity: 0;
  will-change: transform, opacity, filter;
}

.scene.is-active .bit[data-anim="fade-down"] {
  animation: fade-down 1.6s var(--ease) both;
}
.scene.is-active .bit[data-anim="fade-up"] {
  animation: fade-up 1.6s var(--ease) both;
}
.scene.is-active .bit[data-anim="bloom"] {
  animation: bloom 2s var(--ease) both;
}
.scene.is-active .bit[data-anim="ink"] {
  animation: ink-in 1.9s var(--ease) both;
}
.scene.is-active .bit[data-anim="write"] {
  animation: write-in 2.1s var(--ease) both;
}
.scene.is-active .bit[data-anim="rise"] {
  animation: rise-in 1.75s var(--ease) both;
}

/* stagger per scene — slower pop-in cadence */
.scene[data-scene="0"].is-active .blessing { animation-delay: 0.35s; }
.scene[data-scene="0"].is-active .emblem { animation-delay: 0.9s; }
.scene[data-scene="0"].is-active .names { animation-delay: 1.7s; }
.scene[data-scene="0"].is-active .surnames { animation-delay: 2.5s; }

.scene[data-scene="1"].is-active .poem { animation-delay: 0.45s; }
.scene[data-scene="1"].is-active .when { animation-delay: 1.6s; }

.scene[data-scene="2"].is-active .memory { animation-delay: 0.35s; }
.scene[data-scene="2"].is-active .address { animation-delay: 1.1s; }
.scene[data-scene="2"].is-active .rsvp { animation-delay: 1.8s; }
.scene[data-scene="2"].is-active .host { animation-delay: 2.45s; }
.scene[data-scene="2"].is-active .finale { animation-delay: 3.1s; }

.blessing {
  margin: 0 0 0.35rem;
  width: 100%;
  font-family: var(--script);
  font-size: clamp(0.95rem, 3.8vw, 1.1rem);
  line-height: 2.1;
  color: var(--ink-soft);
  text-align: right;
}

.emblem {
  position: relative;
  width: clamp(118px, 34%, 152px);
  aspect-ratio: 1;
  margin: 0.15rem auto 0.55rem;
  display: grid;
  place-items: center;
}

.scene.is-active .emblem__wreath {
  animation: gold-pulse 3.6s ease-in-out 1.5s infinite;
}

.emblem__wreath {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(120, 80, 20, 0.28));
}

.emblem__text {
  position: relative;
  z-index: 1;
  max-width: 58%;
  display: grid;
  gap: 0.05rem;
  place-items: center;
}

.emblem__title {
  margin: 0;
  font-family: "Great Vibes", cursive;
  font-size: clamp(0.95rem, 3.6vw, 1.18rem);
  line-height: 1.05;
  color: #5a4630;
  direction: ltr;
}

.emblem__wish {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(0.42rem, 1.6vw, 0.5rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6a5538;
  direction: ltr;
}

.names {
  margin: 0.1rem 0 0;
  font-family: var(--script);
  font-size: clamp(2rem, 9.5vw, 2.85rem);
  font-weight: 400;
  line-height: 2;
}

.surnames {
  margin: -0.2rem 0 0;
  font-family: var(--script);
  font-size: clamp(1.05rem, 4.5vw, 1.35rem);
  line-height: 2;
  color: var(--ink-soft);
}

.poem {
  margin: 0 0 1.4rem;
  font-family: var(--script);
  font-size: clamp(1.05rem, 4.4vw, 1.28rem);
  line-height: 2.3;
  color: var(--ink-soft);
  max-width: 18em;
}

.when {
  width: 100%;
}

.when__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-family: var(--script);
  font-size: clamp(0.95rem, 3.8vw, 1.08rem);
  line-height: 2;
}

.when__day {
  font-size: 1.45em;
}

.when__rule {
  width: 1.25rem;
  height: 1px;
  background: var(--ink);
  opacity: 0.7;
}

.ornament {
  margin: 0.45rem 0 0.55rem;
  opacity: 0.85;
  line-height: 1;
  color: var(--ink);
}

.when__meta {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0 0.15rem;
  font-family: var(--script);
  font-size: clamp(0.88rem, 3.5vw, 1rem);
  line-height: 2;
}

.memory {
  margin: 0 0 0.75rem;
  font-family: var(--script);
  font-size: clamp(1rem, 4vw, 1.15rem);
  line-height: 2.15;
}

.address {
  margin: 0 0 0.65rem;
  font-family: var(--script);
  font-size: clamp(0.82rem, 3.3vw, 0.95rem);
  line-height: 2.15;
}

.address a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(26, 22, 18, 0.35);
}

.rsvp {
  margin: 0 0 0.65rem;
  font-family: var(--body);
  font-size: clamp(0.68rem, 2.8vw, 0.76rem);
  line-height: 1.8;
  color: var(--ink-soft);
}

.host {
  margin: 0 0 0.85rem;
  font-family: var(--script);
  font-size: clamp(0.9rem, 3.6vw, 1rem);
  line-height: 2;
}

.host a {
  color: inherit;
  text-decoration: none;
  margin-right: 0.25rem;
  font-family: var(--body);
  font-size: 0.86em;
}

.finale {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
  width: 100%;
}

.qr {
  display: block;
  padding: 3px;
  background: #111;
  line-height: 0;
}

.qr img {
  display: block;
  width: 58px;
  height: 58px;
  background: #fff;
}

.actions {
  display: flex;
  gap: 0.4rem;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.actions__btn {
  flex: 1 1 110px;
  text-align: center;
  text-decoration: none;
  font-family: var(--body);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.55rem 0.7rem;
  border-radius: 999px;
  color: #1c1c1c;
  background: linear-gradient(180deg, #f3e8d4, #d7c19a);
  border: 1px solid rgba(90, 70, 40, 0.15);
}

.actions__btn--soft {
  background: transparent;
  border-color: rgba(26, 22, 18, 0.28);
}

.progress {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 3.5%;
  height: 2px;
  z-index: 5;
  background: rgba(26, 22, 18, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.progress__bar {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a8843a, #e0c888);
  border-radius: inherit;
  transform-origin: right center;
}

.film-dots {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 0.4rem;
}

.film-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(238, 230, 216, 0.25);
  transition:
    width 0.5s var(--ease),
    background 0.5s ease;
}

.film-dot.is-on {
  width: 18px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold-soft);
}

@keyframes frame-settle {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes glow-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.82;
  }
}

@keyframes paper-shine {
  0%,
  70%,
  100% {
    transform: translateX(-120%);
  }
  85% {
    transform: translateX(120%);
  }
}

@keyframes fade-down {
  from {
    opacity: 0;
    transform: translateY(-16px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes bloom {
  from {
    opacity: 0;
    transform: scale(0.82);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes ink-in {
  from {
    opacity: 0;
    letter-spacing: 0.08em;
    filter: blur(6px);
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    letter-spacing: 0;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes write-in {
  from {
    opacity: 0;
    clip-path: inset(0 0 0 100%);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    filter: blur(0);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes gold-pulse {
  0%,
  100% {
    filter: drop-shadow(0 2px 6px rgba(120, 80, 20, 0.28));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(196, 163, 90, 0.45));
  }
}

@media (max-width: 360px) {
  .when__meta {
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theatre__glow,
  .frame,
  .frame__shine,
  .scene.is-active .emblem__wreath,
  .scene.is-active .bit {
    animation: none !important;
  }

  .bit {
    opacity: 1;
  }

  .scene {
    transition: opacity 0.01s linear;
    filter: none;
    transform: none;
  }
}
