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

:root {
  --paper: #FFF4E4;
  --paper-2: #FFE9CC;
  --card: #FFFDF8;
  --ink: #2A1840;
  --ink-soft: #5B4A70;
  --pink: #FF4F8B;
  --orange: #FF9A3C;
  --yellow: #FFD23F;
  --teal: #1FC8B5;
  --violet: #7B5CFF;
  --line: #2A1840;
  --radius: 22px;
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --gutter: clamp(16px, 4vw, 48px);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-feature-settings: "ss01";
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(42, 24, 64, .09) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  line-height: 1.8;
  overflow-x: clip;
}

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

:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 8px; }

/* ---------- Shared ---------- */
.eyebrow {
  display: inline-block;
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: 0;
  padding: .15rem .75rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 52px;
  padding: .6rem 1.5rem;
  font-weight: 800;
  font-size: 1.05rem;
  text-decoration: none;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn[disabled] { opacity: .6; cursor: wait; transform: none; }
.btn--ink { background: var(--ink); color: var(--paper); box-shadow: 5px 5px 0 var(--pink); }
.btn--ink:hover { box-shadow: 7px 7px 0 var(--pink); }
.btn--ghost { background: var(--card); color: var(--ink); }
.btn--pink { background: var(--pink); color: #fff; }

.input {
  width: 100%;
  min-height: 50px;
  padding: .65rem 1rem;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  outline: none;
  transition: box-shadow .15s ease;
}
.input:focus { box-shadow: var(--shadow-sm); }
.input::placeholder { color: #9b8fa8; }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.9; }

.shake { animation: shake .4s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(56px, 8vw, 104px);
}

.hero__text { position: relative; z-index: 1; }

.hero__title {
  margin: 1.1rem 0 1.25rem;
  font-size: clamp(2.6rem, 7.4vw, 5.6rem);
  font-weight: 900;
  line-height: 1.25;
}

.mark {
  display: inline-block;
  padding: 0 .3em;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.mark--pink { background: var(--pink); color: #fff; transform: rotate(-2deg); margin-top: .2em; }
.mark--yellow { background: var(--yellow); transform: rotate(2.5deg); }

.hero__lead {
  max-width: 34ch;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--ink-soft);
  font-weight: 500;
}

.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 2rem; }

.hero__people {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2.5vw, 28px);
  padding-top: 28px;
}

.polaroid {
  position: relative;
  margin: 0;
  padding: 12px 12px 16px;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 8px 8px 0 var(--ink);
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.4);
}
.polaroid--a { transform: rotate(-5deg); }
.polaroid--b { transform: rotate(4deg) translateY(36px); }
.polaroid:hover { transform: rotate(0) scale(1.03); z-index: 2; }
.polaroid--b:hover { transform: rotate(0) translateY(36px) scale(1.03); }

.polaroid img {
  aspect-ratio: 1;
  width: 100%;
  height: auto;
  object-fit: cover;
  border: 2px solid var(--ink);
  border-radius: 4px;
}

.polaroid figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding-top: 12px;
}
.polaroid strong { width: 100%; font-size: clamp(1.05rem, 1.8vw, 1.35rem); font-weight: 900; line-height: 1.4; }

.date-chip, .countdown {
  font-size: .82rem;
  font-weight: 800;
  padding: .05rem .6rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  white-space: nowrap;
}
.date-chip { background: var(--teal); }
.countdown { background: var(--yellow); }
.countdown:empty { display: none; }

.tape {
  position: absolute;
  top: -14px;
  inset-inline-start: 50%;
  width: 92px;
  height: 28px;
  translate: 50% 0;
  background: rgba(255, 210, 63, .78);
  border: 1.5px dashed rgba(42, 24, 64, .35);
  transform: rotate(-4deg);
}

.hat {
  position: absolute;
  width: clamp(44px, 6vw, 64px);
  top: clamp(-52px, -5vw, -36px);
  inset-inline-start: -12px;
  transform: rotate(22deg);
  filter: drop-shadow(3px 3px 0 var(--ink));
  z-index: 2;
}
.polaroid--b .hat { inset-inline-start: auto; inset-inline-end: -12px; transform: rotate(-20deg); }

/* decorative shapes */
.hero__deco { position: absolute; inset: 0; pointer-events: none; }
.shape { position: absolute; display: block; }
.shape--star {
  top: 9%; inset-inline-start: 46%;
  width: 42px; height: 42px;
  background: var(--orange);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  animation: spin 14s linear infinite;
}
.shape--ring {
  bottom: 10%; inset-inline-start: 4%;
  width: 54px; height: 54px;
  border: 7px solid var(--teal);
  border-radius: 50%;
}
.shape--zig {
  top: 14%; inset-inline-end: 3%;
  width: 90px; height: 18px;
  background:
    linear-gradient(135deg, var(--pink) 25%, transparent 25%) -9px 0 / 18px 18px,
    linear-gradient(225deg, var(--pink) 25%, transparent 25%) -9px 0 / 18px 18px;
}
.shape--dot {
  bottom: 18%; inset-inline-end: 47%;
  width: 18px; height: 18px;
  background: var(--violet);
  border-radius: 50%;
  box-shadow: 34px -22px 0 -4px var(--yellow), -40px 12px 0 -6px var(--pink);
}
@keyframes spin { to { rotate: 360deg; } }

/* ---------- Ribbon ---------- */
.ribbon {
  overflow: hidden;
  background: var(--pink);
  color: #fff;
  border-block: 3px solid var(--ink);
  transform: rotate(-1.5deg);
  margin: 0 -20px;
}
.ribbon__track {
  display: flex;
  width: max-content;
  align-items: center;
  padding: .7rem 0;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 900;
  white-space: nowrap;
  animation: marquee 28s linear infinite;
}
.ribbon__track > * { margin-inline: .7rem; }
.ribbon__track i { font-style: normal; color: var(--yellow); }
@keyframes marquee { to { transform: translateX(50%); } }

/* ---------- Sections ---------- */
.section {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(64px, 9vw, 120px) var(--gutter) 0;
}
.section__head { max-width: 640px; margin-bottom: 2rem; }
.section__head h2 {
  margin: .9rem 0 .6rem;
  font-size: clamp(1.9rem, 4.6vw, 3.2rem);
  font-weight: 900;
  line-height: 1.3;
}
.section__lead { color: var(--ink-soft); font-size: 1.08rem; }

.retry {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin-inline-start: 12px;
  padding: .1rem .9rem;
  font-size: .9rem;
  font-weight: 800;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  vertical-align: middle;
}
.retry:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- Wishes ---------- */
.wish-form {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 820px;
}
.wish-form__row { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end; }
.field { position: relative; display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field label, .field legend { font-weight: 800; padding: 0; }

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  padding: .45rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease;
}
.segmented label:hover { background: var(--paper-2); }
.segmented input:checked + label { background: var(--ink); color: var(--paper); }
.segmented input:focus-visible + label { outline: 3px solid var(--violet); outline-offset: 2px; }

.counter {
  position: absolute;
  bottom: 10px;
  inset-inline-end: 14px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-soft);
  pointer-events: none;
}

.wish-form__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.form-msg { font-weight: 700; min-height: 1.8em; }
.form-msg.is-error { color: #D02565; }
.form-msg.is-ok { color: #0E8A7C; }

.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.wall-filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 48px 0 24px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: .3rem 1.1rem;
  font-weight: 800;
  background: var(--card);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
}
.chip b {
  min-width: 1.6em;
  padding: 0 .4em;
  font-size: .8rem;
  border-radius: 999px;
  background: var(--paper-2);
  text-align: center;
}
.chip b:empty { display: none; }
.chip.is-active { background: var(--ink); color: var(--paper); }
.chip.is-active b { background: var(--pink); color: #fff; }

.wall { columns: 3 260px; column-gap: 22px; }

.note {
  --bg: var(--yellow);
  break-inside: avoid;
  position: relative;
  margin: 0 0 24px;
  padding: 26px 20px 16px;
  background: var(--bg);
  border: 2.5px solid var(--ink);
  border-radius: 6px 6px 18px 6px;
  box-shadow: var(--shadow-sm);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .2s ease;
}
.note:hover { transform: rotate(0) scale(1.02); }
.note::before {
  content: "";
  position: absolute;
  top: -11px;
  inset-inline-start: 50%;
  translate: 50% 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset -4px -4px 0 rgba(255, 255, 255, .25);
}
.note[data-color="0"] { --bg: #FFE27A; }
.note[data-color="1"] { --bg: #FFB3CF; }
.note[data-color="2"] { --bg: #9EEBDD; }
.note[data-color="3"] { --bg: #C9BCFF; }
.note[data-color="4"] { --bg: #FFC48A; }
.note[data-color="5"] { --bg: #FFFDF8; }
.note.is-new { animation: pop .5s cubic-bezier(.2, .9, .3, 1.5); }
@keyframes pop { from { transform: scale(.6) rotate(-8deg); opacity: 0; } }

.note__to {
  display: inline-block;
  margin-bottom: 8px;
  padding: 0 .55rem;
  font-size: .78rem;
  font-weight: 800;
  background: rgba(255, 255, 255, .7);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
}
.note__body { font-size: 1.05rem; font-weight: 500; white-space: pre-wrap; overflow-wrap: anywhere; }
.note__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 2px dashed rgba(42, 24, 64, .35);
  font-size: .85rem;
}
.note__author { font-weight: 900; overflow-wrap: anywhere; }
.note__time { color: var(--ink-soft); white-space: nowrap; }

.wall-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  border: 2.5px dashed rgba(42, 24, 64, .4);
  border-radius: var(--radius);
}

/* ---------- Footer & FAB ---------- */
.footer {
  margin-top: clamp(72px, 10vw, 128px);
  padding: 28px var(--gutter);
  text-align: center;
  font-weight: 700;
  background: var(--ink);
  color: var(--paper);
}

.fab {
  position: fixed;
  bottom: 20px;
  inset-inline-end: 20px;
  z-index: 20;
  width: 60px; height: 60px;
  font-size: 1.7rem;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .2s ease;
}
.fab:hover { transform: rotate(-15deg) scale(1.08); }
.fab:active { transform: scale(.92); }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero__lead { max-width: none; }
  .hero__people { max-width: 560px; width: 100%; margin: 0 auto; padding-bottom: 36px; }
}

@media (max-width: 600px) {
  .wish-form__row { grid-template-columns: 1fr; }
  .segmented { display: flex; }
  .segmented label { flex: 1; text-align: center; padding-inline: .5rem; }
  .hero__actions .btn { flex: 1 1 auto; }
  .polaroid { padding: 8px 8px 12px; box-shadow: 5px 5px 0 var(--ink); }
  .polaroid--b { transform: rotate(4deg) translateY(24px); }
  .tape { width: 64px; height: 22px; }
  .shape--zig, .shape--star { display: none; }
  .fab { width: 54px; height: 54px; bottom: 16px; inset-inline-end: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
