/* Приглашение на свадьбу — Николай и Мария Сосновски. Прототип по видео-референсу. */

:root {
  --cream: #f6f0e4;
  --cream-2: #efe6d5;
  --sand: #d9cfc0;
  --sand-2: #c4b7a5;
  --ink: #2f2822;
  --ink-soft: #4a4038;
  --gold: #b99a6b;
  --gold-dark: #8f7247;
  --blush: #f0c3c9;
  --blush-line: #e2adb5;
  --maxw: 560px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Montserrat", system-ui, sans-serif;
  font-weight: 300;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

body.is-locked { overflow: hidden; }

/* ---------- Общая типографика ---------- */

.script {
  font-family: "Marck Script", cursive;
  font-weight: 400;
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 1.4rem;
  color: var(--ink);
}

.script--sm { font-size: clamp(1.6rem, 5.9vw, 2.2rem); margin: 0 0 .2rem; }
.script--light { color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.25); }

.lead {
  font-size: clamp(1rem, 4.1vw, 1.12rem);
  line-height: 1.55;
  margin: 0 auto;
  max-width: 26em;
  color: var(--ink-soft);
}

.lead--sm { font-size: clamp(.95rem, 3.8vw, 1.05rem); }

/* ---------- Конверт-заставка ----------
   Слои: back → letter → sides → front → flap → wax.
   Открытие: печать откалывается → клапан отходит → письмо выезжает → уход в страницу. */

.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% 18%, #f7efe2 0%, #ece0cd 45%, #d5c7b4 100%);
  transition: opacity .8s ease, transform .8s ease;
}

.intro.is-done { opacity: 0; transform: scale(1.04); pointer-events: none; }

.intro__stage {
  perspective: 1500px;
  perspective-origin: 50% 42%;
  width: min(84vw, 380px);
}

.env {
  position: relative;
  width: 100%;
  aspect-ratio: 1.44 / 1;
  transform-style: preserve-3d;
  transform: rotateX(7deg);
  transition: transform 1s cubic-bezier(.5,.05,.2,1);
  filter: drop-shadow(0 26px 34px rgba(96,74,50,.28));
}

.env.is-flat { transform: rotateX(0deg); }

.env__back,
.env__front,
.env__flap {
  position: absolute;
  left: 0;
  width: 100%;
}

.env__back {
  top: 0;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(168deg, #ede1cf 0%, #e2d3bd 60%, #d6c4ab 100%);
  z-index: 1;
}

/* письмо внутри конверта */
.env__letter {
  position: absolute;
  left: 4.5%;
  top: 6%;
  width: 91%;
  height: 90%;
  z-index: 2;
  border-radius: 3px;
  background: linear-gradient(178deg, #fdf8ee 0%, #f6efe0 70%, #efe6d4 100%);
  box-shadow: 0 2px 10px rgba(90,70,45,.14);
  padding: 8% 7% 0;
  text-align: center;
  transform: translateY(0);
  transition: transform 1s cubic-bezier(.34,.02,.24,1);
}

.env.is-pulled .env__letter { transform: translateY(-86%); }
.env.is-zoomed .env__letter { transform: translateY(-86%) scale(1.05); }

.env__letter-top {
  font-family: "Marck Script", cursive;
  font-size: clamp(1.25rem, 5.2vw, 1.7rem);
  line-height: 1.25;
  color: #3d3227;
  margin: 0;
}

.env__letter-top span { display: inline-block; padding-left: 1.4em; }

.env__letter-rule {
  width: 42%;
  height: 1px;
  margin: 7% auto 6%;
  background: linear-gradient(90deg, transparent, rgba(120,95,60,.55), transparent);
}

.env__letter-names {
  font-family: "Marck Script", cursive;
  font-size: clamp(1.05rem, 4.4vw, 1.4rem);
  color: #4a3d30;
  margin: 0 0 .35em;
}

.env__letter-names span { color: var(--gold-dark); }

.env__letter-date {
  font-size: clamp(.62rem, 2.5vw, .76rem);
  letter-spacing: .28em;
  color: #7a6a56;
  margin: 0;
}

/* передний карман с V-образным швом */
.env__front {
  bottom: 0;
  height: 100%;
  z-index: 4;
  border-radius: 4px;
  background: linear-gradient(172deg, #ece0cd 0%, #e4d5bf 55%, #d9c8ae 100%);
  clip-path: polygon(0 0, 50% 44%, 100% 0, 100% 100%, 0 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}

/* боковые клапаны — лёгкий объём по краям */
.env__side {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  z-index: 3;
  background: linear-gradient(180deg, rgba(190,166,133,.22), rgba(190,166,133,.05));
}

.env__side--l { left: 0; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.env__side--r { right: 0; clip-path: polygon(100% 0, 0 50%, 100% 100%); }

/* верхний клапан */
.env__flap {
  top: 0;
  height: 56%;
  z-index: 5;
  transform-origin: top center;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
  transition: transform 1.05s cubic-bezier(.6,.02,.2,1), z-index 0s linear .5s;
}

.env.is-opened .env__flap { transform: rotateX(-172deg); z-index: 0; }

.env__flap-inner {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(176deg, #eee2d0 0%, #e3d3bb 62%, #d3c0a4 100%);
  box-shadow: 0 8px 14px rgba(110,88,60,.16);
}

/* сургучная печать */
.wax {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 108px;
  height: 108px;
  margin: -54px 0 0 -54px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 6;
  transition: transform .35s cubic-bezier(.34,1.4,.5,1), opacity .5s ease;
  animation: waxBreathe 3.2s ease-in-out infinite;
}

.wax:hover { transform: scale(1.06); }
.wax:active { transform: scale(.96); }

.wax__svg { width: 100%; height: 100%; display: block; }

.wax__mono {
  font-family: "Marck Script", cursive;
  font-size: 30px;
  text-anchor: middle;
}

.wax__mono--dark  { fill: #4c3618; fill-opacity: .55; }
.wax__mono--light { fill: #e6c896; fill-opacity: .35; }

.wax__hint {
  position: absolute;
  left: 50%;
  top: 118%;
  transform: translateX(-50%);
  font-size: .64rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: #7d6b52;
  white-space: nowrap;
  opacity: .75;
}

/* печать откалывается и падает */
.env.is-cracked .wax {
  animation: none;
  transform: translate(6px, 74px) rotate(-19deg);
  opacity: 0;
  transition: transform .65s cubic-bezier(.42,.02,.72,.5), opacity .5s ease .18s;
  pointer-events: none;
}

@keyframes waxBreathe {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(185,154,107,0)); }
  50%      { filter: drop-shadow(0 0 14px rgba(185,154,107,.45)); }
}

/* ---------- Страница ---------- */

.page {
  opacity: 0;
  transition: opacity 1s ease .25s;
}

.page.is-visible { opacity: 1; }

.section {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3.5rem, 12vw, 5.5rem) 1.5rem;
  text-align: center;
}

/* Плейсхолдеры под фото — заменить на реальные снимки */
.photo-ph {
  background:
    linear-gradient(135deg, #cdbfae 0%, #b6a695 40%, #9d8d7c 100%);
  position: relative;
}

.photo-ph::after {
  content: attr(data-ph);
  position: absolute;
  bottom: .7rem;
  right: .9rem;
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  height: 100svh;
  min-height: 480px;
  overflow: hidden;
}

.hero__photo { position: absolute; inset: 0; }

.hero__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22%;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0,0,0,.35);
}

.hero__names {
  font-family: "Marck Script", cursive;
  font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 4rem);
  margin: 0;
  line-height: 1;
}

.hero__names span { font-size: .8em; padding: 0 .1em; }

.hero__date {
  font-size: clamp(2.2rem, 9vw, 3.2rem);
  font-weight: 300;
  letter-spacing: .04em;
  margin: .2rem 0 0;
}

/* рваный край как в референсе */
.hero__edge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 46px;
  background: var(--cream);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 46' preserveAspectRatio='none'%3E%3Cpath d='M0,46 L0,20 C60,8 90,26 150,16 C215,5 250,24 320,14 C390,4 420,25 490,15 C560,5 600,27 670,17 C740,7 780,26 850,15 C920,4 950,24 1020,15 C1090,6 1140,22 1200,12 L1200,46 Z' fill='%23000'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 46' preserveAspectRatio='none'%3E%3Cpath d='M0,46 L0,20 C60,8 90,26 150,16 C215,5 250,24 320,14 C390,4 420,25 490,15 C560,5 600,27 670,17 C740,7 780,26 850,15 C920,4 950,24 1020,15 C1090,6 1140,22 1200,12 L1200,46 Z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

/* ---------- Музыка ---------- */

.music { display: grid; place-items: center; padding: 2.5rem 0 .5rem; }

.music__btn {
  position: relative;
  width: 120px;
  height: 120px;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.music__ring {
  position: absolute;
  inset: 0;
  width: 120px;
  height: 120px;
  animation: spin 22s linear infinite;
}

.music__btn[aria-pressed="true"] .music__ring { animation-duration: 11s; }

.music__ring text {
  font-family: "Montserrat", sans-serif;
  font-size: 9.5px;
  letter-spacing: .16em;
  fill: var(--ink-soft);
  text-anchor: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.music__icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ink);
  display: grid;
  place-items: center;
  position: relative;
}

.music__icon::before {
  content: "";
  width: 12px;
  height: 12px;
  background: var(--cream);
}

.music__btn[aria-pressed="true"] .music__icon::before {
  clip-path: polygon(15% 0, 100% 50%, 15% 100%);
  width: 13px;
  height: 14px;
}

/* ---------- Календарь ---------- */

.calendar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 400px;
  margin: 2.8rem auto 0;
  border: 1px solid rgba(60,48,36,.5);
}

.calendar__day {
  position: relative;
  padding: .55rem .3rem 1rem;
  border-right: 1px solid rgba(60,48,36,.5);
}

.calendar__day:last-child { border-right: 0; }

.calendar__wd {
  display: block;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding-bottom: .4rem;
  border-bottom: 1px solid rgba(60,48,36,.35);
}

.calendar__mo { display: block; font-size: .8rem; padding: .4rem 0 .1rem; color: var(--ink-soft); }
.calendar__num { display: block; font-size: clamp(2.4rem, 11vw, 3.2rem); font-weight: 300; line-height: 1.05; }

.calendar__circle {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 96%;
  transform: translate(-50%, -42%);
  pointer-events: none;
}

.calendar__circle ellipse {
  fill: none;
  stroke: rgba(185,154,107,.75);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 350;
  stroke-dashoffset: 350;
}

.calendar.is-drawn .calendar__circle ellipse {
  animation: drawCircle 1.4s ease forwards .3s;
}

@keyframes drawCircle { to { stroke-dashoffset: 0; } }

/* ---------- Тайминг ---------- */

.section--timing { padding-top: 1rem; }

.timeline { position: relative; padding: 2rem 0; }

.timeline__wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.timeline__wave path {
  fill: none;
  stroke: var(--blush-line);
  stroke-width: .7;
  vector-effect: non-scaling-stroke;
}

.timeline__list { list-style: none; margin: 0; padding: 0; position: relative; }

.timeline__item {
  padding: 2.4rem .5rem;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.3,.7,.3,1);
}

.timeline__item.is-in { opacity: 1; transform: none; }

.timeline__item--left { text-align: left; padding-right: 38%; }
.timeline__item--right { text-align: right; padding-left: 38%; }

.timeline__time { font-size: clamp(1.6rem, 6.5vw, 2.1rem); font-weight: 300; margin: 0; }

/* сердце, едущее по волне: позиция и поворот задаются из JS */
.wave-heart {
  position: fixed;
  left: 0;
  top: 0;
  width: 39px;
  height: 39px;
  margin: -19.5px 0 0 -19.5px;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease;
  will-change: transform;
}

.wave-heart.is-on { opacity: 1; }

.wave-heart svg { width: 100%; height: 100%; display: block; }

.wave-heart path {
  fill: var(--blush);
  stroke: var(--blush-line);
  stroke-width: .6;
}

/* ---------- Кнопки ---------- */

.btn-round {
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
  margin: 2.4rem auto 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #e8d8c4 0%, #dcc6ad 65%, #d0b79b 100%);
  box-shadow: 0 0 0 12px rgba(220,198,173,.28);
  color: var(--ink);
  text-decoration: none;
  font-size: .98rem;
  line-height: 1.35;
  text-align: center;
  transition: transform .3s ease, box-shadow .3s ease;
}

.btn-round:hover { transform: scale(1.04); box-shadow: 0 0 0 18px rgba(220,198,173,.22); }

.btn-pill {
  margin: 2rem auto 0;
  display: block;
  padding: .95rem 3.2rem;
  border: 1px solid rgba(60,48,36,.55);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: .82rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .3s ease, color .3s ease;
}

.btn-pill:hover { background: var(--ink); color: var(--cream); }

/* ---------- Дресс-код ---------- */

.palette {
  list-style: none;
  display: flex;
  gap: .5rem;
  justify-content: center;
  padding: 0;
  margin: 2.2rem 0 0;
}

.palette li {
  width: clamp(46px, 13vw, 62px);
  aspect-ratio: 1;
  background: var(--c);
  box-shadow: 0 3px 10px rgba(80,65,50,.18);
}

/* ---------- Details / Countdown (секции с фото) ---------- */

.section--details,
.section--countdown {
  max-width: none;
  padding: 0;
  min-height: 78svh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.details__photo,
.countdown__photo { position: absolute; inset: 0; }

.details__photo::before,
.countdown__photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(40,32,25,.45), rgba(40,32,25,.3));
}

.details__inner,
.countdown__inner {
  position: relative;
  z-index: 1;
  padding: 3rem 1.5rem;
  text-align: center;
  max-width: var(--maxw);
}

.details__text {
  color: rgba(255,255,255,.95);
  font-size: clamp(.95rem, 3.9vw, 1.05rem);
  line-height: 1.6;
  margin: 0 0 1.2rem;
  text-shadow: 0 1px 10px rgba(0,0,0,.3);
}

/* ---------- Форма ---------- */

.form { max-width: 420px; margin: 2.4rem auto 0; text-align: left; }

.field { display: block; margin-bottom: 1.8rem; }

.field__label {
  display: block;
  font-size: .95rem;
  color: var(--ink-soft);
  margin-bottom: .7rem;
}

.field__input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(60,48,36,.55);
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink);
  padding: .35rem 0 .5rem;
  outline: none;
}

.field__input::placeholder { color: rgba(60,48,36,.35); }
.field__input:focus { border-bottom-color: var(--gold-dark); }

.group { border: 0; padding: 0; margin: 0 0 1.8rem; }

.opt {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .32rem 0;
  cursor: pointer;
  font-size: 1rem;
}

.opt input {
  appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid rgba(60,48,36,.6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.opt--box input { border-radius: 3px; }

.opt input:checked::after {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold-dark);
}

.opt--box input:checked::after { border-radius: 1px; }

.form__note {
  margin: 1.2rem 0 0;
  text-align: center;
  font-size: .92rem;
  color: var(--gold-dark);
  min-height: 1.3em;
}

/* ---------- Отсчёт ---------- */

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
  margin-top: 1.6rem;
}

.countdown__num {
  display: block;
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  font-weight: 300;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0,0,0,.3);
}

.countdown__cap {
  display: block;
  font-size: .72rem;
  letter-spacing: .06em;
  color: rgba(255,255,255,.8);
}

/* ---------- Подвал ---------- */

.footer {
  text-align: center;
  padding: 3rem 1.5rem 3.5rem;
  font-size: .82rem;
  letter-spacing: .06em;
  color: var(--ink-soft);
  background: var(--cream-2);
}

.footer p { margin: 0 0 .4rem; }
.footer__dom { color: var(--gold-dark); letter-spacing: .14em; }

/* ---------- Появление при скролле ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .9s ease, transform .9s ease;
}

.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .music__ring, .seal { animation: none; }
  html { scroll-behavior: auto; }
}
