:root {
  --ink: #2a1c12;
  --ink-soft: #6d5340;
  --paper: #f7eed8;
  --paper-2: #fff8ea;
  --seal: #c6452f;
  --gold: #e2b13a;
  --night: #15233f;
  --sky: #4eb7e6;
  --leaf: #7bc85a;
  --display: "Shantell Sans", "Segoe Script", system-ui, sans-serif;
  --text: "Nunito", system-ui, sans-serif;
  --radius: 22px;
  --shadow: 0 18px 40px rgba(20, 18, 12, 0.28);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--text);
  background: var(--night);
}

html:not(.is-open),
html:not(.is-open) body {
  height: 100%;
  overflow: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  cursor: pointer;
}

.party-bg {
  position: fixed;
  inset: 0;
  background:
    url("photos/party.jpg") center / cover no-repeat;
  transform: scale(1.06);
  filter: saturate(1.05);
  z-index: 0;
}

.party-dim {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(20, 32, 64, 0.15), rgba(10, 14, 28, 0.72) 70%);
  z-index: 1;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.is-open .gate {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-btn {
  position: relative;
  width: min(100%, 380px);
  height: min(78svh, 640px);
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 28px;
  isolation: isolate;
}

.doors {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border-radius: 28px;
  z-index: 2;
  pointer-events: none;
}

.gate-door {
  flex: 1;
  background: url("photos/hero.jpg") center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 232, 180, 0.35);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.gate-door-left { background-position: left center; transform-origin: left; }
.gate-door-right { background-position: right center; transform-origin: right; }

.is-opening .gate-door-left { transform: translateX(-102%); }
.is-opening .gate-door-right { transform: translateX(102%); }

.gate-card {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.gate-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
}

.gate-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(16, 22, 40, 0.05) 30%, rgba(16, 18, 32, 0.78) 100%);
}

.seal {
  position: absolute;
  z-index: 5;
  top: 18px;
  right: 18px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff8e6;
  font-family: var(--display);
  font-size: 34px;
  background:
    radial-gradient(circle at 30% 28%, #e36a4e, var(--seal) 62%, #8e2618);
  box-shadow:
    0 8px 18px rgba(120, 20, 12, 0.45),
    inset 0 0 0 4px rgba(255, 214, 140, 0.55);
}

.gate-copy {
  position: absolute;
  z-index: 5;
  left: 22px;
  right: 22px;
  bottom: 26px;
  color: #fff7e8;
  text-align: left;
  transition: opacity 0.35s ease;
}

.is-opening .gate-copy,
.is-opening .seal {
  opacity: 0;
}

.kicker {
  margin: 0 0 6px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
}

.gate-title,
h1,
h2 {
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}

.gate-title {
  display: block;
  font-size: clamp(34px, 10vw, 48px);
}

.hint {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 248, 230, 0.92);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
}

.mute {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 248, 230, 0.94);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.mute[hidden] { display: none; }

.mute.is-muted .mute-icon { opacity: 0.35; text-decoration: line-through; }

.letter {
  position: relative;
  z-index: 2;
  width: min(100%, 440px);
  margin: 0 auto;
  padding: 18px 14px calc(48px + env(safe-area-inset-bottom));
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
}

.is-open .letter {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.5s ease 0.35s, transform 0.5s ease 0.35s;
}

.sheet {
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
  border-radius: var(--radius);
  padding: 22px 18px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

h1 { font-size: 42px; margin: 4px 0 16px; }
h2 { font-size: 28px; margin: 0 0 14px; }

.lead,
.sheet p,
.sheet li {
  font-size: 17px;
  line-height: 1.45;
}

.muted { color: var(--ink-soft); font-size: 15px !important; }

.polaroid,
.round-shot,
.tall-shot,
.crown-shot {
  margin: 0 0 14px;
}

.polaroid {
  background: #fff;
  padding: 10px 10px 36px;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(40, 24, 12, 0.18);
}

.polaroid img,
.tall-shot img,
.crown-shot img {
  width: 100%;
  height: 420px;
  object-fit: cover;
}

.polaroid-hero img { object-position: 50% 38%; }
.polaroid.tilt-left { transform: rotate(-1.8deg); }
.polaroid.tilt-right { transform: rotate(1.6deg); }

.polaroid figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  text-align: center;
  font-family: var(--display);
  font-size: 15px;
}

.polaroid { position: relative; }

.round-shot {
  width: min(100%, 300px);
  margin: 0 auto 16px;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 8px solid #fff;
  box-shadow: var(--shadow);
}

.round-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 32% 72%;
}

.tall-shot img {
  height: 520px;
  object-position: 50% 62%;
  border-radius: 18px;
}

.crown-shot img {
  object-position: 50% 28%;
  border-radius: 18px 18px 40% 40% / 18px 18px 18px 18px;
  box-shadow: 0 0 0 6px #f3d37a, 0 12px 28px rgba(0, 0, 0, 0.22);
}

.date-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.date-card {
  background: #fff;
  border-radius: 16px;
  padding: 12px;
}

.date-card-main {
  background: #2a1c12;
  color: #fff6e4;
}

.date-label {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.date-num {
  margin: 6px 0 0;
  font-family: var(--display);
  font-size: 32px;
}

.date-dow,
.date-note {
  margin: 4px 0 0;
  font-size: 13px !important;
  line-height: 1.3 !important;
}

.calendar {
  background: #fff;
  border-radius: 16px;
  padding: 12px;
}

.calendar-title {
  margin: 0 0 8px;
  text-align: center;
  font-weight: 800;
  text-transform: lowercase;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  font-size: 12px;
}

.cal-grid span,
.cal-grid i {
  min-height: 28px;
  display: grid;
  place-items: center;
}

.cal-grid > span:nth-child(-n+7) {
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 10px;
  text-transform: uppercase;
}

.mark {
  border-radius: 999px;
  font-weight: 800;
}

.mark.family { outline: 2px solid var(--sky); }
.mark.party { background: var(--seal); color: #fff; }

.cal-legend {
  margin: 8px 0 0;
  font-size: 12px !important;
  color: var(--ink-soft);
  text-align: center;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot.family { background: var(--sky); }
.dot.party { background: var(--seal); }

.countdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.countdown span {
  background: #fff;
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
  font-family: var(--display);
  font-size: 28px;
}

.countdown span::after {
  display: block;
  margin-top: 2px;
  font-family: var(--text);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  content: "дней";
}

.countdown span[data-unit="hours"]::after { content: "часов"; }
.countdown span[data-unit="mins"]::after { content: "минут"; }

.estate {
  position: relative;
  height: 220px;
  margin-bottom: 12px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(#9ad2ef, #d7efe0);
  display: grid;
  place-items: end center;
}

.estate-house { position: relative; margin-bottom: 36px; }
.roof {
  width: 140px;
  height: 0;
  border-left: 70px solid transparent;
  border-right: 70px solid transparent;
  border-bottom: 54px solid #c6452f;
  margin: 0 auto;
}
.wall {
  width: 118px;
  height: 78px;
  margin: 0 auto;
  background: #f4e2c0;
  display: flex;
  justify-content: space-around;
  align-items: end;
  padding: 10px 8px 0;
}
.win {
  width: 22px;
  height: 22px;
  background: #7ec8ea;
  margin-bottom: 28px;
}
.wall .door {
  width: 24px;
  height: 38px;
  background: #8b5a2b;
}

.estate-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  margin: 0;
  text-align: center;
  font-family: var(--display);
  font-size: 14px;
  color: var(--ink);
}

.notes ul {
  margin: 0;
  padding: 0 0 0 18px;
}

.notes li { margin-bottom: 10px; }

.rsvp {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  background: var(--seal);
  color: #fff8e8;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 10px 0 #8e2618;
}

.rsvp:active { transform: translateY(2px); box-shadow: 0 8px 0 #8e2618; }

.rsvp.is-yes {
  background: var(--leaf);
  box-shadow: 0 10px 0 #3f8a2c;
}

.thanks {
  margin-top: 12px;
  text-align: center;
  font-family: var(--display);
}

.colophon {
  text-align: center;
  color: #f7eed8;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}

@media (min-width: 720px) {
  .letter { padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-door,
  .gate,
  .letter { transition: none; }
}
