:root {
  --envelope: #EFEBE3;
  --envelope-deep: #e4dccf;
  --ink: #3a2e28;
  --wax: #7e1f2c;
  --wax-dark: #550f18;
  --gold: #f3e0cf;
  --muted: #8a7d70;
}

@font-face {
  font-family: 'Aullia';
  src: url('19046.ttf?v=2') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 50% -10%, #faf6ee 0%, #efece3 55%, #e5dfd2 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- ЭКРАНЫ ---------- */

.screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.screen--envelope {
  z-index: 2;
  transition: opacity 0.6s ease, transform 0.6s ease, visibility 0.6s ease;
}

.screen--envelope.is-fading {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.screen--envelope.is-gone {
  visibility: hidden;
}

.screen--invite {
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 0 5vh;
  overflow-y: auto;
  background:
    linear-gradient(rgba(30, 22, 16, 0.45), rgba(30, 22, 16, 0.55)),
    url('1788092119.png') center / cover no-repeat;
  transition: opacity 0.9s ease 0.1s;
}

.screen--invite.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.screen--invite.is-visible .invite > * {
  animation: rise 0.9s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.screen--invite.is-visible .invite > *:nth-child(1) { animation-delay: 0.15s; }
.screen--invite.is-visible .invite > *:nth-child(2) { animation-delay: 0.28s; }
.screen--invite.is-visible .invite > *:nth-child(3) { animation-delay: 0.4s; }
.screen--invite.is-visible .invite > *:nth-child(4) { animation-delay: 0.5s; }
.screen--invite.is-visible .invite > *:nth-child(5) { animation-delay: 0.62s; }
.screen--invite.is-visible .invite > *:nth-child(6) { animation-delay: 0.75s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- ЭКРАН 1: КОНВЕРТ ---------- */

.envelope-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding-top: 4vh;
}

.hint {
  font-style: italic;
  letter-spacing: 0.06em;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  color: var(--muted);
  animation: hint-breathe 2.8s ease-in-out infinite;
}

@keyframes hint-breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.envelope {
  position: relative;
  width: min(840px, 96vw);
  aspect-ratio: 52 / 32;
  background: var(--envelope);
  border-radius: 12px;
  box-shadow: 0 42px 70px -24px rgba(58, 46, 40, 0.42), 0 12px 26px rgba(58, 46, 40, 0.14);
  perspective: 1400px;
  animation: envelope-drop 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes envelope-drop {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
}

.envelope__letter {
  position: absolute;
  left: 7%;
  top: 12%;
  width: 86%;
  height: 70%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fffdf8, #f6f0e4);
  border: 1px solid #e8e0d0;
  border-radius: 8px;
  box-shadow: 0 8px 16px -6px rgba(90, 58, 30, 0.25);
  transition: transform 0.8s cubic-bezier(0.22, 0.9, 0.34, 1.05);
  will-change: transform;
}

.envelope__letter-initials {
  font-style: italic;
  font-size: clamp(2.4rem, 7.5vw, 3.75rem);
  letter-spacing: 0.05em;
  line-height: 1;
  color: rgba(126, 31, 44, 0.55);
}

.envelope__letter-date {
  margin-top: 12px;
  font-style: italic;
  letter-spacing: 0.12em;
  font-size: clamp(1.2rem, 3.75vw, 1.875rem);
  color: rgba(126, 31, 44, 0.32);
}

.envelope__pocket {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(160deg, var(--envelope) 0%, var(--envelope-deep) 100%);
  -webkit-clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0, 50% 50%);
  clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0, 50% 50%);
}

.envelope__seams {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.envelope__seams path {
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.envelope__flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  z-index: 3;
  transform-origin: top center;
  transition: transform 0.75s cubic-bezier(0.65, -0.1, 0.35, 1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.envelope__flap-piece {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #f6f2e8 0%, var(--envelope) 100%);
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  box-shadow: 0 2px 6px rgba(58, 46, 40, 0.1);
}

.envelope.is-open .envelope__flap {
  transform: rotateX(-178deg);
}

.envelope.is-letter-out .envelope__letter {
  transform: translateY(-52%) rotate(-2deg);
  transition-delay: 0.15s;
}

/* ---------- СУРГУЧНАЯ ПЕЧАТЬ ---------- */

.seal {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: clamp(76px, 17vw, 108px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border: none;
  cursor: pointer;
  font: inherit;
  color: var(--gold);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.28), transparent 42%),
    radial-gradient(circle at 68% 72%, rgba(0, 0, 0, 0.35), transparent 46%),
    radial-gradient(circle at 50% 45%, #93313f 0%, var(--wax) 55%, var(--wax-dark) 100%);
  border-radius: 47% 53% 52% 48% / 51% 46% 54% 49%;
  box-shadow:
    0 12px 24px -8px rgba(51, 12, 18, 0.55),
    inset 0 -4px 8px rgba(0, 0, 0, 0.35),
    inset 0 4px 8px rgba(255, 255, 255, 0.22);
  transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.4, 1), opacity 0.35s ease;
}

.seal::before {
  content: "";
  position: absolute;
  inset: -16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(126, 31, 44, 0.2), transparent 68%);
  animation: seal-pulse 2.6s ease-in-out infinite;
}

.seal::after {
  content: "";
  position: absolute;
  inset: 9%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

@keyframes seal-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.seal:hover {
  transform: translate(-50%, -50%) scale(1.06);
}

.seal:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.seal:focus-visible {
  outline: 2px dashed var(--wax);
  outline-offset: 6px;
}

.seal.is-popped {
  transform: translate(-50%, -50%) scale(1.35);
  opacity: 0;
  pointer-events: none;
}

.seal__heart {
  position: relative;
  z-index: 1;
  display: block;
  width: clamp(34px, 8vw, 54px);
  height: auto;
  color: #7a1c29;
  filter:
    drop-shadow(-1px 0 1px rgba(0, 0, 0, 0.38))
    drop-shadow(0 -1px 1px rgba(0, 0, 0, 0.45))
    drop-shadow(1px 0 1px rgba(255, 235, 215, 0.4))
    drop-shadow(0 1px 1px rgba(255, 235, 215, 0.48));
}

.seal__heart path {
  fill: currentColor;
}

/* ---------- ЭКРАН 2: ПРИГЛАШЕНИЕ ---------- */

.invite {
  margin: 0 auto;
  width: min(660px, calc(100% - 28px));
  padding: 46px 34px 54px;
  text-align: center;
  background: rgba(253, 249, 241, 0.94);
  border: 1px solid rgba(58, 46, 40, 0.22);
  border-radius: 16px;
  box-shadow: 0 30px 60px -20px rgba(24, 16, 12, 0.55);
}

.invite__kicker {
  font-family: 'Aullia', 'Caveat', 'Snell Roundhand', 'Apple Chancery', cursive;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.01em;
  font-size: clamp(5.2rem, 14vw, 6.8rem);
  line-height: 1.1;
  color: var(--wax);
}

.invite__message {
  margin: 18px auto 0;
  max-width: 480px;
  font-size: clamp(1.15rem, 3.2vw, 1.5rem);
  line-height: 1.55;
  color: var(--ink);
}

.invite__date-intro {
  margin-top: 30px;
  font-size: clamp(0.95rem, 2.6vw, 1.1rem);
  letter-spacing: 0.03em;
  color: var(--muted);
}

.invite__date {
  margin-top: 8px;
  font-style: italic;
  font-size: clamp(2rem, 6.5vw, 3rem);
  color: var(--ink);
  white-space: nowrap;
}

.invite__divider {
  width: min(220px, 62%);
  height: 1px;
  margin: 30px auto;
  background: linear-gradient(90deg, transparent, rgba(126, 31, 44, 0.5), transparent);
  position: relative;
}

/* ---------- РАСПИСАНИЕ ДНЯ ---------- */

.invite__timeline {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.timeline-sep {
  display: block;
  margin: 0 auto;
  width: 14px;
  height: 14px;
  fill: var(--wax);
  opacity: 0.55;
}

.timeline-item__time {
  font-style: italic;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  letter-spacing: 0.06em;
  color: var(--wax);
}

.timeline-item__title {
  margin-top: 6px;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  color: var(--ink);
}

.timeline-item__text {
  margin: 8px auto 0;
  max-width: 420px;
  font-size: clamp(0.9rem, 2.6vw, 1rem);
  line-height: 1.6;
  color: #6d5f52;
}

/* ---------- ДРЕСС-КОД ---------- */

.invite__dresscode-title {
  font-style: italic;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  color: var(--wax);
}

.invite__dresscode-text {
  margin: 12px auto 0;
  max-width: 460px;
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  line-height: 1.6;
  color: #6d5f52;
}

/* ---------- АНКЕТА ГОСТЯ ---------- */

.rsvp {
  max-width: 460px;
  margin: 0 auto;
}

.rsvp__lead {
  font-size: clamp(1rem, 2.9vw, 1.15rem);
  line-height: 1.6;
  color: #6d5f52;
}

.rsvp__form {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.rsvp__field {
  font-size: clamp(0.95rem, 2.6vw, 1.05rem);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.rsvp__input {
  width: 100%;
  max-width: 320px;
  padding: 14px 16px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1rem, 2.8vw, 1.1rem);
  color: var(--ink);
  text-align: center;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(58, 46, 40, 0.3);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rsvp__input::placeholder {
  color: rgba(138, 125, 112, 0.6);
}

.rsvp__input:focus {
  border-color: var(--wax);
  box-shadow: 0 0 0 3px rgba(126, 31, 44, 0.12);
}

.rsvp__submit {
  margin-top: 6px;
  padding: 15px 44px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.1rem, 3.2vw, 1.3rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--gold);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(160deg, #93313f 0%, var(--wax) 60%, var(--wax-dark) 100%);
  border: none;
  border-radius: 10px;
  box-shadow: 0 10px 20px -8px rgba(51, 12, 18, 0.5), inset 0 -3px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.3, 1.4, 0.4, 1), box-shadow 0.25s ease;
}

.rsvp__submit:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 16px 28px -10px rgba(51, 12, 18, 0.55), inset 0 -3px 6px rgba(0, 0, 0, 0.3);
}

.rsvp__submit:active {
  transform: scale(0.96);
}

.rsvp__submit:focus-visible {
  outline: 2px dashed var(--wax);
  outline-offset: 6px;
}

.rsvp__status {
  min-height: 1.4em;
  font-size: clamp(0.95rem, 2.6vw, 1.1rem);
  font-style: italic;
  color: var(--wax);
}

.rsvp__status.is-error {
  color: #a03a3a;
}

.rsvp__decline {
  margin-top: 2px;
  padding: 12px 40px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1rem, 3vw, 1.15rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(58, 46, 40, 0.35);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.rsvp__decline:hover {
  border-color: var(--muted);
  background: rgba(58, 46, 40, 0.05);
}

.rsvp__decline:focus-visible {
  outline: 2px dashed var(--wax);
  outline-offset: 4px;
}

/* ---------- МЕНЮ ---------- */

.menu-gate {
  display: none;
}

.menu-gate.is-visible {
  display: block;
}

.menu {
  max-width: 520px;
  margin: 0 auto;
}

.menu__title {
  font-family: 'Aullia', 'Caveat', 'Snell Roundhand', 'Apple Chancery', cursive;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.01em;
  font-size: clamp(3rem, 10vw, 4.2rem);
  line-height: 1.1;
  color: var(--wax);
}

.menu__note {
  margin: 16px auto 0;
  max-width: 460px;
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  line-height: 1.6;
  color: #6d5f52;
}

.menu__section-title {
  margin-top: 34px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.14em;
  font-size: clamp(1.1rem, 3vw, 1.3rem);
  color: var(--wax);
}

.menu__section-hint {
  margin: 6px 0 18px;
  font-size: clamp(0.9rem, 2.6vw, 1rem);
  color: var(--muted);
}

.menu__error {
  margin: 6px 0 0;
  grid-column: 1 / -1;
  min-height: 1.3em;
  font-size: clamp(1.275rem, 3.75vw, 1.425rem);
  font-style: italic;
  color: #a03a3a;
  visibility: hidden;
}

.menu__error.is-shown {
  visibility: visible;
}

.menu__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 18px;
}

.menu__list--single {
  grid-template-columns: 1fr;
}

@media (max-width: 520px) {
  .menu__list {
    grid-template-columns: 1fr;
  }
}

.menu-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.menu-item:hover {
  background: rgba(126, 31, 44, 0.06);
}

.menu-item__check {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.menu-item__box {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(58, 46, 40, 0.4);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.8);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.menu-item__box::after {
  content: "";
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s ease;
}

.menu-item__check:checked + .menu-item__box {
  background: var(--wax);
  border-color: var(--wax);
}

.menu-item__check:checked + .menu-item__box::after {
  transform: rotate(45deg) scale(1);
}

.menu-item__check:focus-visible + .menu-item__box {
  outline: 2px dashed var(--wax);
  outline-offset: 3px;
}

.menu-item__text {
  font-size: clamp(0.95rem, 2.7vw, 1.05rem);
  line-height: 1.45;
  color: var(--ink);
}

.menu-item__check:checked ~ .menu-item__text {
  color: var(--wax);
}

.menu__submit {
  margin: 30px auto 0;
  display: block;
  padding: 15px 52px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(1.1rem, 3.2vw, 1.3rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--gold);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.2), transparent 42%),
    linear-gradient(160deg, #93313f 0%, var(--wax) 60%, var(--wax-dark) 100%);
  border: none;
  border-radius: 10px;
  box-shadow: 0 10px 20px -8px rgba(51, 12, 18, 0.5), inset 0 -3px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.3, 1.4, 0.4, 1), box-shadow 0.25s ease;
}

.menu__submit:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 16px 28px -10px rgba(51, 12, 18, 0.55), inset 0 -3px 6px rgba(0, 0, 0, 0.3);
}

.menu__submit:active {
  transform: scale(0.96);
}

.menu__submit:focus-visible {
  outline: 2px dashed var(--wax);
  outline-offset: 6px;
}

.menu__status {
  margin-top: 14px;
  min-height: 1.4em;
  font-size: clamp(0.95rem, 2.6vw, 1.1rem);
  font-style: italic;
  color: var(--wax);
}

.menu__status.is-error {
  color: #a03a3a;
}

.menu__farewell {
  margin-top: 30px;
  font-style: italic;
  font-family: 'Aullia', 'Caveat', 'Snell Roundhand', 'Apple Chancery', cursive;
  font-size: clamp(2rem, 7vw, 2.8rem);
  line-height: 1.2;
  color: var(--wax);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}