@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #fff7fb;
  --ink-soft: rgba(255, 240, 248, 0.74);
  --pink: #ff5fa2;
  --rose: #ff8fc0;
  --violet: #9b6bff;
  --gold: #ffd36e;
  --night: #12061f;
  --glass: linear-gradient(140deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 55%, rgba(255, 255, 255, 0.1));
  --edge: rgba(255, 255, 255, 0.26);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--night);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body:not(.open) { overflow: hidden; height: 100dvh; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- پس‌زمینهٔ زنده ---------- */
.bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(120% 80% at 80% 0%, #3a1257 0%, transparent 60%),
    radial-gradient(100% 70% at 0% 100%, #4a0f3c 0%, transparent 60%),
    linear-gradient(160deg, #170828, #0c0416 70%);
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.75;
  will-change: transform; animation: drift 22s ease-in-out infinite alternate;
}
.b1 { width: 62vmax; height: 62vmax; background: #ff4f93; top: -24vmax; right: -18vmax; opacity: 0.55; }
.b2 { width: 54vmax; height: 54vmax; background: #7c4dff; bottom: -22vmax; left: -16vmax; animation-duration: 27s; animation-delay: -6s; opacity: 0.55; }
.b3 { width: 34vmax; height: 34vmax; background: #ffb65c; top: 38%; left: 52%; animation-duration: 31s; animation-delay: -12s; opacity: 0.32; }
.b4 { width: 30vmax; height: 30vmax; background: #3fd0ff; top: 12%; left: -8vmax; animation-duration: 25s; animation-delay: -3s; opacity: 0.22; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-7vmax, 6vmax, 0) scale(1.15); }
  100% { transform: translate3d(6vmax, -5vmax, 0) scale(0.92); }
}
.grain {
  position: absolute; inset: 0; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; }

/* ---------- شیشه ---------- */
.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--edge);
  border-radius: 30px;
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  backdrop-filter: blur(26px) saturate(170%);
  box-shadow:
    0 30px 80px -20px rgba(8, 0, 20, 0.7),
    0 2px 0 rgba(255, 255, 255, 0.28) inset,
    0 -1px 0 rgba(255, 255, 255, 0.06) inset;
  overflow: hidden;
  isolation: isolate;
}
.glass::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background:
    radial-gradient(90% 60% at 85% 0%, rgba(255, 255, 255, 0.3), transparent 60%),
    radial-gradient(70% 50% at 0% 100%, rgba(255, 95, 162, 0.22), transparent 70%);
  pointer-events: none;
}
.glass::after {
  content: ""; position: absolute; top: -60%; bottom: -60%; width: 38%; right: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: rotate(12deg); pointer-events: none;
  animation: sheen 7s var(--ease) infinite;
}
@keyframes sheen {
  0%, 55% { right: -60%; }
  100% { right: 140%; }
}

/* ---------- دکمه ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 0 34px; border-radius: 999px;
  font-weight: 800; font-size: 1.05rem; color: #2a0a2e;
  background: linear-gradient(135deg, #ffe3a3, #ffb8d6 55%, #d6b3ff);
  box-shadow: 0 14px 34px -10px rgba(255, 95, 162, 0.8), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transition: transform 0.35s var(--spring), box-shadow 0.35s var(--ease);
  animation: breathe 2.6s ease-in-out infinite;
}
.btn:hover { transform: translateY(-2px) scale(1.04); }
.btn:active { transform: scale(0.95); }
.btn:focus-visible, .cake:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.btn.ghost {
  color: var(--ink); background: rgba(255, 255, 255, 0.12); border: 1px solid var(--edge);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset; animation: none;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 14px 34px -10px rgba(255, 95, 162, 0.8), 0 0 0 0 rgba(255, 211, 110, 0.5), 0 1px 0 rgba(255, 255, 255, 0.8) inset; }
  50% { box-shadow: 0 14px 34px -10px rgba(255, 95, 162, 0.8), 0 0 0 14px rgba(255, 211, 110, 0), 0 1px 0 rgba(255, 255, 255, 0.8) inset; }
}

/* ---------- دروازه ---------- */
#gate {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 24px;
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), filter 0.9s var(--ease), visibility 0s 0.9s;
}
.open #gate { opacity: 0; transform: scale(1.25); filter: blur(18px); visibility: hidden; pointer-events: none; }
.gate-card {
  width: min(100%, 380px); padding: 44px 28px 40px; text-align: center;
  animation: rise 1.1s var(--ease) both, float 6s ease-in-out 1.1s infinite;
}
.gate-kicker { color: var(--gold); font-weight: 600; letter-spacing: 0; margin-top: 22px; }
.gate-title { font-size: clamp(2rem, 9vw, 2.7rem); font-weight: 900; line-height: 1.4; margin-bottom: 26px; }
@keyframes rise { from { opacity: 0; transform: translateY(40px) scale(0.92); filter: blur(12px); } }
@keyframes float { 50% { transform: translateY(-10px); } }

.gift { position: relative; width: 120px; height: 118px; margin: 0 auto; animation: wiggle 2.8s ease-in-out infinite; }
.gift .box {
  position: absolute; bottom: 0; left: 10px; right: 10px; height: 70px; border-radius: 8px 8px 14px 14px;
  background: linear-gradient(160deg, #ff7fb5, #e23d86);
  box-shadow: inset 0 -10px 20px rgba(120, 0, 70, 0.35), 0 16px 30px -10px rgba(255, 60, 140, 0.7);
}
.gift .lid {
  position: absolute; bottom: 66px; left: 0; right: 0; height: 26px; border-radius: 9px; z-index: 2;
  background: linear-gradient(160deg, #ffa3cb, #f0509a);
  box-shadow: 0 6px 12px rgba(80, 0, 50, 0.35);
  transform-origin: 0 100%; transition: transform 0.7s var(--spring);
}
.gift .ribbon {
  position: absolute; bottom: 0; left: 50%; width: 20px; height: 92px; margin-left: -10px; z-index: 3;
  background: linear-gradient(90deg, #ffe7a8, #ffc94d); border-radius: 3px;
}
.gift .bow { position: absolute; bottom: 88px; left: 50%; width: 0; height: 0; z-index: 4; }
.gift .bow::before, .gift .bow::after {
  content: ""; position: absolute; bottom: 0; width: 34px; height: 26px;
  background: linear-gradient(160deg, #fff0bf, #ffc233); border-radius: 60% 60% 12% 60%;
}
.gift .bow::before { right: 0; transform: rotate(-18deg); transform-origin: 100% 100%; }
.gift .bow::after { left: 0; transform: scaleX(-1) rotate(-18deg); transform-origin: 0 100%; }
@keyframes wiggle {
  0%, 60%, 100% { transform: rotate(0); }
  68% { transform: rotate(-7deg) scale(1.04); }
  76% { transform: rotate(6deg) scale(1.04); }
  84% { transform: rotate(-4deg); }
  92% { transform: rotate(2deg); }
}
.opening .gift { animation: none; }
.opening .gift .lid { transform: translate(-26px, -46px) rotate(-28deg); }
.opening .gift .bow { transform: translate(-26px, -46px) rotate(-28deg); transition: transform 0.7s var(--spring); }

/* ---------- ساختار ---------- */
main { position: relative; z-index: 2; opacity: 0; transition: opacity 1.2s var(--ease) 0.3s; }
.open main { opacity: 1; }
.sec {
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(56px, 10vh, 110px) clamp(18px, 5vw, 40px); gap: 26px; text-align: center;
}
.card { width: min(100%, 620px); padding: clamp(28px, 6vw, 48px) clamp(22px, 5vw, 44px); }
.card-title { font-size: clamp(1.25rem, 4.6vw, 1.6rem); font-weight: 800; color: var(--gold); margin-bottom: 18px; }
.sec-title {
  font-size: clamp(1.5rem, 6vw, 2.3rem); font-weight: 900; line-height: 1.5;
  background: linear-gradient(100deg, #fff, #ffd9ea 40%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ظهور با اسکرول */
.rv { opacity: 0; transform: translateY(46px) scale(0.96); filter: blur(10px); transition: opacity 1s var(--ease), transform 1.1s var(--ease), filter 1s var(--ease); transition-delay: var(--d, 0s); }
.rv.in { opacity: 1; transform: none; filter: none; }

/* ---------- تبریک ---------- */
.kicker {
  display: inline-block; padding: 6px 20px; border-radius: 999px; font-weight: 600; font-size: 0.98rem; color: var(--gold);
  background: rgba(255, 255, 255, 0.1); border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.title { font-size: clamp(3rem, 15vw, 7.4rem); font-weight: 900; line-height: 1.35; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 0.28em; }
.title .w {
  display: inline-block; opacity: 0; transform: translateY(0.6em) rotate(6deg) scale(0.7); filter: blur(14px);
  background: linear-gradient(120deg, #fff 10%, #ffc1dc 45%, #ffd36e 70%, #fff 95%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 10px 50px rgba(255, 95, 162, 0.45);
  padding: 0 0.04em;
}
.open .title .w { animation: pop 1.2s var(--spring) forwards, shine 5s linear 1.4s infinite; animation-delay: calc(0.7s + var(--i) * 0.28s), calc(2s + var(--i) * 0.28s); }
@keyframes pop { to { opacity: 1; transform: none; filter: none; } }
@keyframes shine { to { background-position: -220% 0; } }
.name {
  font-size: clamp(2rem, 9.5vw, 4.2rem); font-weight: 800; line-height: 1.5; color: var(--rose);
  text-shadow: 0 0 34px rgba(255, 95, 162, 0.75); --d: 1.5s;
}
.open .name.in { animation: glow 3.2s ease-in-out 2.6s infinite; }
@keyframes glow { 50% { text-shadow: 0 0 60px rgba(255, 143, 192, 1), 0 0 18px rgba(255, 211, 110, 0.6); } }
.scroll-hint { --d: 2.4s; margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 0.9rem; }
.scroll-hint i { width: 26px; height: 42px; border: 2px solid var(--edge); border-radius: 14px; position: relative; }
.scroll-hint i::after { content: ""; position: absolute; top: 7px; left: 50%; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--gold); animation: wheel 1.8s var(--ease) infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(16px); } }

/* ---------- کیک ---------- */
.cake-card { transform-style: preserve-3d; }
.cake { position: relative; display: block; width: 230px; height: 220px; margin: 34px auto 8px; transition: transform 0.4s var(--spring); }
.cake:active { transform: scale(0.96); }
.plate { position: absolute; bottom: 0; left: -14px; right: -14px; height: 18px; border-radius: 50%; background: linear-gradient(#fff, #d9c8ea); box-shadow: 0 18px 30px -6px rgba(0, 0, 0, 0.55); }
.tier { position: absolute; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 10px 10px; overflow: hidden; }
.tier::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 30px;
  background:
    linear-gradient(#fff7fb, #fff7fb) 0 0 / 100% 10px no-repeat,
    radial-gradient(circle at 50% 0, #fff7fb 62%, transparent 64%) 0 9px / 24px 22px repeat-x;
}
.tier::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 30%, transparent 70%, rgba(60, 0, 50, 0.3)); }
.t1 { bottom: 9px; width: 230px; height: 82px; background: repeating-linear-gradient(90deg, #ff6aa9 0 23px, #ff87ba 23px 46px); }
.t2 { bottom: 91px; width: 164px; height: 66px; background: linear-gradient(#c79bff, #9b6bff); }
.candles { position: absolute; bottom: 157px; left: 50%; transform: translateX(-50%); width: 130px; display: flex; justify-content: space-between; z-index: 3; }
.candle { position: relative; width: 9px; height: 36px; border-radius: 3px; background: repeating-linear-gradient(-35deg, #fff 0 5px, #ffd36e 5px 10px); box-shadow: inset -2px 0 3px rgba(0, 0, 0, 0.2); }
.candle:nth-child(even) { height: 44px; margin-top: -8px; background: repeating-linear-gradient(-35deg, #fff 0 5px, #7dd3fc 5px 10px); }
.flame {
  position: absolute; left: 50%; bottom: 100%; width: 13px; height: 22px; margin-left: -6.5px; margin-bottom: 2px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 78%, #fff 0 16%, #ffe27a 34%, #ff9a3c 68%, rgba(255, 90, 40, 0) 100%);
  box-shadow: 0 0 18px 6px rgba(255, 190, 80, 0.75), 0 0 46px 16px rgba(255, 140, 60, 0.35);
  transform-origin: 50% 100%; animation: flicker 0.9s ease-in-out infinite alternate;
  transition: opacity 0.35s, transform 0.35s var(--ease);
}
.candle:nth-child(2) .flame { animation-duration: 0.7s; }
.candle:nth-child(3) .flame { animation-duration: 1.1s; }
.candle:nth-child(4) .flame { animation-duration: 0.8s; }
@keyframes flicker {
  0% { transform: scale(1) rotate(-3deg); }
  50% { transform: scale(1.1, 0.93) rotate(3deg); }
  100% { transform: scale(0.94, 1.1) rotate(-1deg); }
}
.candle.out .flame { opacity: 0; transform: scale(0.2) translateY(-14px) skewX(30deg); animation: none; }
.candle.out::after {
  content: ""; position: absolute; left: 50%; bottom: 100%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.55); filter: blur(3px); animation: smoke 1.6s ease-out forwards;
}
@keyframes smoke { to { transform: translate(8px, -46px) scale(4); opacity: 0; } }
.hint { color: var(--ink-soft); font-size: 0.98rem; min-height: 3.8em; display: flex; align-items: center; justify-content: center; transition: color 0.5s; }
.hint.wish { color: var(--gold); font-weight: 700; font-size: 1.1rem; animation: rise 0.9s var(--ease) both; }

/* ---------- نامه ---------- */
.letter { text-align: right; }
.letter .card-title { text-align: center; }
.letter-body p { font-size: clamp(1.02rem, 4vw, 1.2rem); margin-bottom: 0.85em; color: var(--ink); min-height: 1.9em; }
.letter-body p:first-child { font-weight: 800; color: var(--rose); font-size: clamp(1.15rem, 4.6vw, 1.4rem); }
.letter-body p:last-child { font-weight: 800; color: var(--gold); }
.letter-body .caret::after { content: ""; display: inline-block; width: 2px; height: 1.1em; margin-right: 3px; vertical-align: -0.18em; background: var(--gold); animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.sign { margin-top: 18px; text-align: left; font-weight: 700; color: var(--rose); opacity: 0; transform: translateY(12px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.sign.in { opacity: 1; transform: none; }

/* ---------- دلیل‌ها ---------- */
.grid { width: min(100%, 880px); display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(12px, 3vw, 22px); perspective: 1000px; }
.reason { padding: clamp(18px, 4vw, 30px) clamp(12px, 3vw, 22px); border-radius: 24px; transform-style: preserve-3d; transition: opacity 1s var(--ease), transform 0.6s var(--ease), filter 1s var(--ease); }
.reason.in { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.reason .ic { display: block; font-size: clamp(2rem, 8vw, 2.8rem); line-height: 1.3; animation: bob 4s ease-in-out infinite; animation-delay: calc(var(--n) * -0.6s); }
.reason h4 { font-size: clamp(1.05rem, 4.2vw, 1.3rem); font-weight: 800; color: var(--gold); }
.reason p { font-size: clamp(0.88rem, 3.4vw, 1rem); color: var(--ink-soft); line-height: 1.8; }
@keyframes bob { 50% { transform: translateY(-7px) rotate(4deg); } }

/* ---------- گالری ---------- */
.gallery { width: min(100%, 980px); display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(12px, 3vw, 22px); }
.photo { padding: 8px; border-radius: 24px; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 17px; }
.photo:nth-child(odd).in { transform: rotate(-1.6deg); }
.photo:nth-child(even).in { transform: rotate(1.6deg) translateY(14px); }

/* ---------- پایان ---------- */
.finale-card { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.heart { width: clamp(110px, 34vw, 170px); filter: drop-shadow(0 16px 40px rgba(255, 79, 147, 0.75)); animation: beat 1.25s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.16); } 28% { transform: scale(1); } 42% { transform: scale(1.1); } 56% { transform: scale(1); } }
.finale-title { font-size: clamp(2.2rem, 11vw, 4rem); font-weight: 900; line-height: 1.5; background: linear-gradient(100deg, #fff, #ffb8d6, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.finale-sub { color: var(--ink-soft); margin-bottom: 16px; }

/* ---------- صفحه‌های بزرگ ---------- */
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .gallery { grid-template-columns: repeat(3, 1fr); }
  .cake { transform: scale(1.15); margin: 50px auto 24px; }
  .cake:active { transform: scale(1.1); }
}
@media (max-height: 560px) and (orientation: landscape) {
  .gate-card { padding: 20px 28px; }
  .gift { transform: scale(0.7); margin: -16px auto; }
}

/* ---------- کاهش حرکت ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.2s !important; }
  .blob, .glass::after { animation: none !important; }
  .rv { transform: none; filter: none; }
}

/* مرورگر بدون backdrop-filter */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(60, 26, 84, 0.86); }
}
