@font-face {
  font-family: "Nastaliq";
  src: url("../font-nastaliq.ttf?v=20261008") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #e8dcc8;
  --paper-dark: #d4c4a8;
  --ink: #4a3f35;
  --ink-soft: #6b5d50;
  --gold: #c9a227;
  --card: #faf8f5;
  --accent: #7a8f7a;
  --shadow: rgba(40, 30, 20, 0.25);
  --font: "Vazirmatn", system-ui, sans-serif;
  /* اگر font-nastaliq.ttf نباشد، مرورگر به Vazirmatn برمی‌گردد (نه serif سیستم) */
  --font-nastaliq: "Nastaliq", var(--font);
}

.nastaliq {
  font-family: var(--font-nastaliq);
  font-weight: 400;
  font-style: normal;
  line-height: 2.15;
  font-feature-settings: "liga" 1, "calt" 1;
}

/* صفحه اول: پاکت بسته — متن فارسی */
.envelope__hint {
  font-family: var(--font-nastaliq);
}

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

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: #f3ece3;
  overflow: hidden;
}

.scene {
  position: relative;
  height: 100svh;
  max-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.5rem, env(safe-area-inset-right))
    max(5.5rem, calc(env(safe-area-inset-bottom) + 4.5rem))
    max(0.5rem, env(safe-area-inset-left));
  overflow: hidden;
  overscroll-behavior: none;
}

.scene::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(12, 8, 6, 0);
  pointer-events: none;
  z-index: 0;
  transition: background 0.45s ease;
}

.scene--focus::after {
  background: rgba(12, 8, 6, 0.72);
}

.scene--focus {
  padding-top: max(0.25rem, env(safe-area-inset-top));
  padding-bottom: max(4.5rem, calc(env(safe-area-inset-bottom) + 3.5rem));
  overflow: hidden;
}

.scene--focus .stage {
  transform: scale(var(--focus-scale, 1.1));
  z-index: 2;
}

.scene__bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 48% at 50% 22%, rgba(255, 252, 247, 0.92), transparent 70%),
    radial-gradient(ellipse 42% 32% at 88% 96%, rgba(214, 196, 168, 0.45), transparent 72%),
    linear-gradient(165deg, #f7f1e8 0%, #ebe3d6 46%, #e3d5c3 100%);
  z-index: 0;
}

.stage {
  --card-y: -8%;
  --card-tuck-y: 24%;
  --card-tuck-scale: 0.46;
  --card-out-y: -72%;
  --env-x: 4%;
  --env-bottom: 10%;
  --env-h: 62%;
  --fold-l: #e7d8c2;
  --fold-r: #dccbb4;
  --fold-b: #eadcc8;
  position: relative;
  z-index: 1;
  width: min(96vw, 520px);
  max-height: min(82dvh, 82svh, 720px);
  aspect-ratio: 3 / 4.2;
  flex-shrink: 0;
  transform-origin: center center;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.envelope-hit {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

.envelope-hit:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 4px;
}

/* —— Envelope: one static pocket + one 3D flap. Only transform/opacity animate. —— */
.mail {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.mail__inside,
.mail__pocket,
.mail__flap-space {
  position: absolute;
  left: var(--env-x);
  right: var(--env-x);
  bottom: var(--env-bottom);
  height: var(--env-h);
}

.mail__inside {
  z-index: 1;
  border-radius: 3px;
  background: linear-gradient(180deg, #b9a588 0%, #d4c1a6 100%);
  box-shadow: 0 18px 36px rgba(40, 30, 20, 0.26);
}

.mail__pocket {
  z-index: 3;
  display: block;
  overflow: visible;
}

.mail__pocket polygon:nth-child(1) {
  fill: var(--fold-l);
}

.mail__pocket polygon:nth-child(2) {
  fill: var(--fold-r);
}

.mail__pocket polygon:nth-child(3) {
  fill: var(--fold-b);
}

.mail__flap-space {
  z-index: 5;
  perspective: none;
  perspective-origin: 50% 0;
}

.stage[data-state="opening"] .mail__flap-space,
.stage[data-state="open"] .mail__flap-space {
  perspective: 980px;
}

.mail__flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 50%;
  transform-origin: center top;
  transform: rotateX(0deg);
}

.mail__flap-face {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(180deg, #f3e6d0 0%, #e4d1b4 100%);
}

.envelope__stamp-area {
  position: absolute;
  top: 0.65rem;
  left: 0;
  right: 0;
  width: 3.6rem;
  height: 3.6rem;
  margin-inline: auto;
}

.seal {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 38%, #fffaf0 0 46%, transparent 47%),
    radial-gradient(circle at 50% 42%, #f6e3a4 0%, #d4af37 46%, #9a7418 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 248, 226, 0.85),
    inset 0 0 0 5px rgba(154, 116, 24, 0.55),
    0 6px 12px rgba(80, 55, 15, 0.16);
}

.seal__rings {
  width: 58%;
  height: auto;
  display: block;
}

.envelope__hint {
  position: absolute;
  left: var(--env-x);
  right: var(--env-x);
  bottom: calc(var(--env-bottom) + var(--env-h) * 0.1);
  z-index: 4;
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  color: var(--ink-soft);
  pointer-events: none;
}

.stage[data-state="closed"] .envelope__hint {
  animation: pulse-hint 2.5s ease-in-out 1s infinite;
}

@keyframes pulse-hint {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.75;
  }
}

/* —— Invitation card: tucked inside the pocket, then rises to center —— */
.invite-card {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: 78%;
  min-height: 72%;
  z-index: 2;
  opacity: 0;
  visibility: hidden;
  background: var(--card);
  border-radius: 3px;
  box-shadow: 0 12px 40px var(--shadow);
  padding: 2rem 1.5rem 1.75rem;
  text-align: center;
  overflow: hidden;
  pointer-events: none;
  transform: translate3d(-50%, var(--card-tuck-y), 0) rotate(0deg) scale(var(--card-tuck-scale));
}

.invite-card__fold {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.06) 20%, rgba(0, 0, 0, 0.06) 80%, transparent);
  box-shadow: -8px 0 16px rgba(0, 0, 0, 0.04);
  pointer-events: none;
}

.invite-card__arch {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: 72%;
  height: 5.25rem;
  border: 2px solid var(--ink);
  border-bottom: none;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  opacity: 0.35;
}

.invite-card__rings {
  position: absolute;
  top: 2.65rem;
  left: 50%;
  transform: translateX(-50%);
  width: 4.5rem;
  height: auto;
  pointer-events: none;
}

.invite-card__floral {
  position: absolute;
  pointer-events: none;
  object-fit: contain;
}

.invite-card__floral--left {
  bottom: 0;
  left: 0;
  width: 7.25rem;
  height: auto;
  opacity: 1;
}

.invite-card__floral--right {
  bottom: 0;
  right: 0;
  width: 7.25rem;
  height: auto;
  transform: scaleX(-1);
  opacity: 1;
}

.invite-card__floral--arch-l {
  top: 0;
  left: 0;
  width: 4.6rem;
  opacity: 0.96;
}

.invite-card__floral--arch-r {
  top: 0;
  right: 0;
  width: 4.6rem;
  opacity: 0.96;
  transform: scaleX(-1);
}

.invite-card__floral--top-l {
  top: 0;
  left: 26%;
  width: 2.7rem;
  opacity: 0.92;
  transform: rotate(180deg);
}

.invite-card__floral--top-r {
  top: 0;
  right: 26%;
  width: 2.7rem;
  opacity: 0.92;
  transform: scaleX(-1) rotate(180deg);
}

.invite-card__floral--side-l {
  top: 46%;
  left: 0;
  width: 2.85rem;
  opacity: 0.9;
}

.invite-card__floral--side-r {
  top: 46%;
  right: 0;
  width: 2.85rem;
  opacity: 0.9;
  transform: scaleX(-1);
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
  background: transparent;
}

.invite-card__opening {
  margin: 4.25rem 0 0.65rem;
  font-size: clamp(1.2rem, 5vw, 1.55rem);
  color: var(--ink-soft);
  line-height: 2.3;
}

.invite-card__names {
  margin: 0 0 0.35rem;
  font-size: clamp(2.1rem, 8.5vw, 2.85rem);
  line-height: 2;
  color: var(--ink);
}

.invite-card__and {
  display: inline-block;
  margin: 0 0.2em;
  font-size: 0.75em;
  color: var(--ink-soft);
}

.invite-card__families {
  margin: 0 0 1rem;
  font-size: clamp(1.15rem, 4.5vw, 1.4rem);
  color: var(--ink-soft);
  line-height: 2.1;
}

.invite-card__dash {
  font-family: var(--font);
  font-weight: 500;
  display: inline-block;
  margin-inline: 0.35em;
  line-height: 1;
}

.invite-card__poem {
  position: relative;
  z-index: 1;
  margin: 0 auto 1.35rem;
  max-width: 19rem;
  font-size: clamp(1.15rem, 4.8vw, 1.45rem);
  line-height: 2.25;
  color: var(--ink);
}

.invite-card__footer {
  margin-top: auto;
  padding: 0.85rem 3.8rem 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.75;
  text-align: center;
  color: #2c2118;
  position: relative;
  z-index: 1;
}

.invite-card__footer p {
  margin: 0;
}

.invite-card__footer p + p {
  margin-top: 0.15rem;
  font-size: 0.92em;
}

/* Stage states — compositor-only (transform + opacity) */
@keyframes flap-open {
  from {
    transform: rotateX(0deg);
  }
  to {
    transform: rotateX(70deg);
  }
}

@keyframes card-emerge {
  0% {
    opacity: 0;
    transform: translate3d(-50%, var(--card-tuck-y), 0) rotate(0deg) scale(var(--card-tuck-scale));
  }
  10% {
    opacity: 1;
  }
  42%,
  60% {
    transform: translate3d(-50%, var(--card-out-y), 0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 1;
    transform: translate3d(-50%, var(--card-y), 0) rotate(-1deg) scale(1);
  }
}

.stage[data-state="opening"] .mail__flap {
  animation: flap-open 0.7s cubic-bezier(0.4, 0.05, 0.2, 1) both;
  will-change: transform;
  backface-visibility: hidden;
}

.stage[data-state="open"] .mail__flap {
  transform: rotateX(70deg);
}

.stage[data-state="opening"] .invite-card {
  visibility: visible;
  z-index: 6;
  box-shadow: none;
  animation: card-emerge 1.7s cubic-bezier(0.45, 0.02, 0.2, 1) 0.72s both;
  will-change: transform;
}

.stage[data-state="open"] .invite-card {
  visibility: visible;
  opacity: 1;
  z-index: 6;
  pointer-events: auto;
  transform: translate3d(-50%, var(--card-y), 0) rotate(-1deg) scale(1);
  will-change: auto;
}

@media (min-width: 481px) and (min-height: 501px) {
  .stage[data-state="open"] .invite-card__rings {
    filter: drop-shadow(0 2px 4px rgba(120, 90, 20, 0.25));
  }

  .stage[data-state="open"] .invite-card__floral {
    filter: drop-shadow(0 3px 8px rgba(80, 40, 50, 0.12));
  }
}

.stage[data-state="opening"] .envelope__hint,
.stage[data-state="open"] .envelope__hint,
.stage[data-state="opening"] .envelope__stamp-area,
.stage[data-state="open"] .envelope__stamp-area {
  opacity: 0;
  animation: none;
  transition: opacity 0.2s linear;
}

.stage[data-state="open"] .envelope-hit {
  cursor: default;
  pointer-events: none;
}

@media (max-width: 480px) {
  .stage[data-state="opening"] .mail__flap-space,
  .stage[data-state="open"] .mail__flap-space {
    perspective: 1100px;
  }

  .stage[data-state="opening"] .invite-card {
    animation-duration: 1.55s;
    animation-delay: 0.7s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .envelope__hint,
  .mail__flap,
  .invite-card,
  .toolbar__pill--callout,
  .toolbar__pill--callout::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Toolbar */
.toolbar {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  z-index: 10;
  width: fit-content;
  max-width: calc(100vw - 1.25rem);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-radius: 999px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.toolbar[hidden] {
  display: none;
}

.toolbar.toolbar--enter {
  animation: toolbar-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes toolbar-rise {
  from {
    opacity: 0;
    transform: translateY(1.5rem) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toolbar__pill--callout {
  position: relative;
  z-index: 1;
  border: 2px solid var(--gold);
  animation: ceremony-callout 1.5s ease-in-out infinite;
}

.toolbar__pill--callout::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: inherit;
  border: 2px solid var(--gold);
  pointer-events: none;
  animation: ceremony-halo 1.5s ease-in-out infinite;
}

@keyframes ceremony-callout {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes ceremony-halo {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.08);
  }
}

.toolbar__btn {
  width: 3rem;
  height: 3rem;
  border: none;
  border-radius: 50%;
  background: #f0ebe3;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.toolbar__btn--muted {
  opacity: 0.45;
  cursor: default;
}

.toolbar__pill {
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.icon {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.icon-play {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M8 5v14l11-7z'/%3E%3C/svg%3E");
}

.icon-pause {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M6 19h4V5H6v14zm8-14v14h4V5h-4z'/%3E%3C/svg%3E");
}

.icon-focus {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M15 3l2.5 2.5-2.4 2.4 1.4 1.4L19 4.9 21.5 7.4 19 9.9l-1.4-1.4-2.4 2.4L15 13V3zM9 21l-2.5-2.5 2.4-2.4-1.4-1.4L5 19.1 2.5 16.6 5 14.1l1.4 1.4 2.4-2.4L9 11v10z'/%3E%3C/svg%3E");
}

.icon-focus-exit {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M5 16h3v3H5v-3zm11 0h3v3h-3v-3zM5 5h3v3H5V5zm11 0h3v3h-3V5z'/%3E%3C/svg%3E");
}

.toolbar__btn[aria-pressed="true"] {
  background: #e8dfd0;
}

/* Modal */
.modal {
  border: none;
  border-radius: 16px 16px 0 0;
  padding: 0;
  max-width: 100%;
  width: min(100%, 480px);
  max-height: min(92dvh, 92svh);
  margin: auto auto 0;
  font-family: var(--font);
  color: var(--ink);
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(20, 15, 10, 0.45);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #eee;
}

.modal__header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.modal__close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0.25rem;
}

.modal__body {
  padding: 1.25rem 1.5rem max(1.5rem, env(safe-area-inset-bottom));
  text-align: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  max-height: calc(min(92dvh, 92svh) - 3.5rem);
}

.modal__poem,
.modal__closing {
  color: #b08a14;
  text-shadow: 0.35px 0 0 #b08a14, -0.35px 0 0 #b08a14;
}

.modal__poem {
  margin: 0;
  font-size: clamp(1.28rem, 5.2vw, 1.55rem);
  line-height: 2.35;
}

.modal__closing {
  margin: 0.85rem 0 0;
  font-size: clamp(1.22rem, 4.8vw, 1.5rem);
  line-height: 2.35;
  word-spacing: 0.55em;
}

.modal__divider {
  height: 1px;
  margin: 1.15rem auto 1rem;
  max-width: 12rem;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  position: relative;
}

.modal__divider::after {
  content: "♥";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 0 0.5rem;
  font-size: 0.65rem;
  color: var(--gold);
}

.modal__section-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.modal__section-title--countdown {
  margin-top: 0.85rem;
  padding-top: 0.7rem;
  border-top: 1px solid #eee;
  font-size: 0.88rem;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  margin-bottom: 0;
}

.countdown div {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.countdown strong {
  font-size: 1.2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.countdown span {
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.modal__location {
  margin: 0;
  padding: 0;
  text-align: center;
}

.modal__location .modal__section-title {
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.modal__location-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.85rem 1rem;
}

.modal__address {
  margin: 0;
  flex: 1 1 11rem;
  font-size: clamp(1.15rem, 4.2vw, 1.4rem);
  font-weight: 600;
  line-height: 1.9;
  color: var(--ink);
  max-width: 16rem;
  text-align: center;
}

.modal__maps {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.65rem;
  margin: 0;
  flex: 0 0 auto;
}

.modal__map-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 4.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  background: #f8f5f0;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.modal__map-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.modal__map-link img {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
}

.modal__maps:empty,
.modal__maps:not(:has(a:not([hidden]))) {
  display: none;
}

@media (min-width: 520px) {
  .modal {
    border-radius: 16px;
    margin: auto;
  }
}

/* —— موبایل: پاکت + کارت (فلو جدا از دسکتاپ) —— */
@media (max-width: 480px) {
  html {
    font-size: 17px;
  }

  .scene {
    justify-content: center;
    padding-top: max(0.35rem, env(safe-area-inset-top));
    padding-bottom: max(5rem, calc(env(safe-area-inset-bottom) + 4rem));
  }

  .stage {
    --card-y: 0%;
    --card-tuck-y: 22%;
    --card-tuck-scale: 0.44;
    --card-out-y: -84%;
    --stage-pad: calc(env(safe-area-inset-top) + env(safe-area-inset-bottom) + 5.25rem);
    --stage-max-h: calc(100svh - var(--stage-pad));
    --stage-w: min(94vw, calc(var(--stage-max-h) * 3 / 4.2));
    --stage-h: min(calc(var(--stage-w) * 4.2 / 3), var(--stage-max-h));
    width: var(--stage-w);
    height: var(--stage-h);
    max-height: var(--stage-max-h);
    aspect-ratio: unset;
    flex-shrink: 1;
  }

  .envelope__stamp-area {
    top: 0.45rem;
    width: clamp(3rem, 16vw, 3.35rem);
    height: clamp(3rem, 16vw, 3.35rem);
  }

  .envelope__hint {
    font-size: clamp(0.95rem, 3.9vw, 1.15rem);
  }

  .mail__inside {
    box-shadow: 0 8px 16px rgba(40, 30, 20, 0.18);
  }

  .invite-card {
    width: 84%;
    bottom: 14%;
    min-height: 66%;
    box-shadow: 0 8px 16px rgba(40, 30, 20, 0.16);
    padding: clamp(1.15rem, 3.6vw, 1.45rem) clamp(0.65rem, 2.4vw, 0.85rem) clamp(0.95rem, 3vw, 1.2rem)
      clamp(2.35rem, 10vw, 2.85rem);
  }


  .invite-card__rings {
    width: clamp(3.5rem, 14vw, 4.75rem);
    top: clamp(2rem, 8vw, 2.65rem);
  }

  .invite-card__arch {
    width: 74%;
    height: clamp(4rem, 16vw, 5.25rem);
  }

  .invite-card__floral--left,
  .invite-card__floral--right {
    width: clamp(4.8rem, 22vw, 6.6rem);
    bottom: 0;
  }

  .invite-card__floral--arch-l,
  .invite-card__floral--arch-r {
    width: clamp(3.1rem, 14vw, 4.2rem);
    top: 0;
  }

  .invite-card__floral--top-l,
  .invite-card__floral--top-r {
    width: clamp(2.05rem, 9vw, 2.55rem);
    top: 0;
  }

  .invite-card__floral--side-l,
  .invite-card__floral--side-r {
    width: clamp(2.4rem, 11vw, 3.15rem);
  }

  .invite-card__opening {
    margin-top: clamp(2.75rem, 13vmin, 3.75rem);
    font-size: clamp(1.2rem, 4.8vmin, 1.65rem);
  }

  .invite-card__names {
    font-size: clamp(1.9rem, 9vmin, 3rem);
  }

  .invite-card__families {
    font-size: clamp(1.1rem, 4.8vmin, 1.5rem);
  }

  .invite-card__poem {
    max-width: 100%;
    font-size: clamp(1.1rem, 4.6vmin, 1.55rem);
  }

  .invite-card__footer {
    font-size: clamp(0.82rem, 3.3vmin, 0.95rem);
    padding-inline: 2.85rem;
  }


  .toolbar {
    max-width: min(24rem, calc(100vw - 1.25rem));
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: none;
  }

  .toolbar__btn {
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
  }

  .toolbar__pill {
    padding: 0.7rem 0.95rem;
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .scene--focus {
    --focus-scale: 1.14;
  }

  .scene--focus .stage {
    width: min(98vw, calc((100svh - 4.5rem) * 3 / 4.2));
    height: min(calc(min(98vw, 520px) * 4.2 / 3), calc(100svh - 4.5rem));
    max-height: calc(100svh - 4.5rem);
  }

  .modal__poem {
    font-size: clamp(1.38rem, 5.7vw, 1.62rem);
  }

  .modal__closing {
    font-size: clamp(1.28rem, 5.2vw, 1.5rem);
  }

  .modal__section-title {
    font-size: 1.05rem;
  }

  .modal__location .modal__section-title {
    font-size: 0.95rem;
  }

  .modal__address {
    font-size: clamp(1.28rem, 5.5vw, 1.5rem);
    font-weight: 700;
    line-height: 2;
    max-width: 100%;
    flex: 1 1 100%;
  }

  .modal__location-row {
    flex-direction: column;
    gap: 1rem;
  }

  .modal__maps {
    width: 100%;
    justify-content: center;
  }

  .countdown strong {
    font-size: 1.05rem;
  }

  .countdown span {
    font-size: 0.68rem;
  }

  .modal__section-title--countdown {
    font-size: 0.82rem;
  }

  .modal__body {
    padding-inline: 1rem;
  }

  .modal__map-link {
    font-size: 0.92rem;
  }
}

@media (max-width: 360px) {
  html {
    font-size: 16px;
  }


  .invite-card__floral--left,
  .invite-card__floral--right {
    width: 5.4rem;
  }

  .invite-card__floral--arch-l,
  .invite-card__floral--arch-r {
    width: 3.5rem;
  }

  .invite-card__floral--top-l,
  .invite-card__floral--top-r,
  .invite-card__floral--side-l,
  .invite-card__floral--side-r {
    width: 2.35rem;
  }
}

@media (max-width: 480px) and (max-height: 700px) {
  .stage {
    --card-tuck-y: 18%;
    --card-tuck-scale: 0.4;
    --card-out-y: -90%;
    --stage-pad: calc(env(safe-area-inset-top) + env(safe-area-inset-bottom) + 4.75rem);
    --stage-max-h: calc(100svh - var(--stage-pad));
    --stage-w: min(92vw, calc(var(--stage-max-h) * 3 / 4.2));
    --stage-h: min(calc(var(--stage-w) * 4.2 / 3), var(--stage-max-h));
    width: var(--stage-w);
    height: var(--stage-h);
  }

  .invite-card__opening {
    margin-top: clamp(2.25rem, 11vmin, 3rem);
  }

  .invite-card__names {
    font-size: clamp(1.75rem, 8vmin, 2.65rem);
  }

  .invite-card {
    bottom: 12%;
    min-height: 62%;
  }
}

/* —— دسکتاپ: ابعاد بزرگ‌تر (فلو جدا از موبایل) —— */
@media (min-width: 481px) {
  html {
    font-size: 18px;
  }

  .scene {
    padding-bottom: max(6rem, calc(env(safe-area-inset-bottom) + 5rem));
  }

  .stage {
    --card-y: -4%;
    --card-tuck-y: 26%;
    --card-tuck-scale: 0.42;
    --card-out-y: -70%;
    width: min(72vw, 680px);
    height: min(calc(min(72vw, 680px) * 4.2 / 3), min(86svh, 920px));
    max-height: min(86svh, 920px);
    aspect-ratio: unset;
  }

  .envelope__stamp-area {
    top: 0.85rem;
    width: 4.15rem;
    height: 4.15rem;
  }

  .envelope__hint {
    font-size: 1.3rem;
  }

  .invite-card {
    width: 76%;
    padding: 2.5rem 2rem 2.25rem;
    min-height: 74%;
    bottom: 16%;
  }

  .invite-card__rings {
    width: 5.5rem;
    top: 3rem;
  }

  .invite-card__arch {
    height: 6.25rem;
    width: 70%;
  }

  .invite-card__floral--left,
  .invite-card__floral--right {
    width: 8.75rem;
    bottom: 0;
  }

  .invite-card__floral--arch-l,
  .invite-card__floral--arch-r {
    width: 5.6rem;
    top: 0;
  }

  .invite-card__floral--top-l,
  .invite-card__floral--top-r {
    width: 3.35rem;
    top: 0;
  }

  .invite-card__floral--side-l,
  .invite-card__floral--side-r {
    width: 4.25rem;
  }

  .invite-card__opening {
    margin-top: 4.75rem;
    font-size: clamp(1.45rem, 1.6vw, 1.85rem);
  }

  .invite-card__names {
    font-size: clamp(2.65rem, 3.8vw, 3.45rem);
  }

  .invite-card__families {
    font-size: clamp(1.3rem, 1.5vw, 1.55rem);
  }

  .invite-card__poem {
    font-size: clamp(1.3rem, 1.45vw, 1.6rem);
    max-width: 21rem;
  }

  .invite-card__footer {
    padding-inline: 5.25rem;
    font-size: 1rem;
  }


  .toolbar__btn {
    width: 3.35rem;
    height: 3.35rem;
  }

  .toolbar__pill {
    font-size: 1.08rem;
    padding: 0.85rem 1.75rem;
  }

  .scene--focus {
    --focus-scale: 1.16;
  }
}

@media (min-width: 481px) and (max-height: 860px) {
  .stage {
    --card-y: 4%;
  }
}

@media (min-width: 900px) {
  .stage {
    width: min(680px, 42vw);
    height: min(calc(min(680px, 42vw) * 4.2 / 3), 920px);
  }
}

/* گوشی افقی و صفحه‌های کوتاه: کارت نباید از قاب بیرون بزند */
@media (max-height: 500px) {
  html {
    font-size: 15px;
  }

  .scene {
    padding-top: max(0.2rem, env(safe-area-inset-top));
    padding-bottom: max(3.8rem, calc(env(safe-area-inset-bottom) + 3.2rem));
  }

  .stage {
    --card-y: 6%;
    --card-tuck-y: 14%;
    --card-tuck-scale: 0.36;
    --card-out-y: -58%;
    --stage-max-h: calc(100svh - 4rem);
    width: min(calc(var(--stage-max-h) * 3 / 4.2), 68vw, 340px);
    height: var(--stage-max-h);
    max-height: var(--stage-max-h);
  }

  .invite-card {
    width: 86%;
    min-height: 0;
    max-height: 72%;
    bottom: 12%;
    padding: 0.75rem 0.55rem 0.6rem 1.85rem;
    overflow: hidden;
    box-shadow: 0 6px 14px rgba(40, 30, 20, 0.16);
  }


  .invite-card__arch {
    height: 2.6rem;
    top: 0.45rem;
  }

  .invite-card__rings {
    width: 2.4rem;
    top: 1.15rem;
  }

  .invite-card__floral--left,
  .invite-card__floral--right {
    width: 3.1rem;
    bottom: 0;
  }

  .invite-card__floral--arch-l,
  .invite-card__floral--arch-r {
    width: 2rem;
    top: 0.15rem;
  }

  .invite-card__floral--top-l,
  .invite-card__floral--top-r,
  .invite-card__floral--side-l,
  .invite-card__floral--side-r {
    display: none;
  }

  .invite-card__opening {
    margin-top: 1.7rem;
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .invite-card__names {
    font-size: 1.35rem;
    line-height: 1.55;
  }

  .invite-card__families {
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 0.35rem;
  }

  .invite-card__poem {
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 0.35rem;
  }

  .invite-card__footer {
    font-size: 0.78rem;
    padding: 0.25rem 1.7rem 0.15rem;
    line-height: 1.4;
  }
}
