/* ===== Палитры =====
   --c1..--c4  — цвета дресс-кода (показываются кружками)
   остальное    — производные для интерфейса */

[data-palette="sage"] {
  --c1: #B7C4A9; --c2: #E3C4BE; --c3: #F4EEE4; --c4: #A89A8C;
  --bg: #FAF7F2; --tint: #EEF1E8; --accent: #B7C4A9; --deep: #5E6B53;
  --text: #2B2F28; --muted: #5F625A; --line: #CFCABF;
}
[data-palette="lavender"] {
  --c1: #C9C1DA; --c2: #AFC3D3; --c3: #F5F1EA; --c4: #9C93A6;
  --bg: #FAF8F5; --tint: #EEEBF3; --accent: #C9C1DA; --deep: #665D7C;
  --text: #2B2735; --muted: #5F5B6B; --line: #CFCAD6;
}
[data-palette="peach"] {
  --c1: #EDCDB7; --c2: #E2B99B; --c3: #C3C59E; --c4: #EFE6D6;
  --bg: #FCF8F3; --tint: #F6EADF; --accent: #E2B99B; --deep: #6F734B;
  --text: #352B23; --muted: #695C51; --line: #DCCDBB;
}
[data-palette="latte"] {
  --c1: #D9C3AE; --c2: #EFE3CF; --c3: #E8CFC8; --c4: #9E8574;
  --bg: #FBF7F1; --tint: #F3EADF; --accent: #D9C3AE; --deep: #76604F;
  --text: #33281F; --muted: #685A4F; --line: #D8C9B8;
}

/* ===== База ===== */
:root {
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, sans-serif;
  --hand: "Caveat", cursive;
  --radius: 18px;
  --gutter: 20px;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--sans);
  transition: background-color .4s, color .4s;
}

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

h1, h2 { font-family: var(--serif); font-weight: 500; line-height: 1.1; margin: 0 0 .6em; }
h2 { font-size: 2.1rem; }
p { margin: 0 0 1em; }

.page {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 560px) {
  body { background: var(--tint); }
  .page { box-shadow: 0 0 60px rgb(0 0 0 / .06); }
}

.section { padding: 64px var(--gutter); text-align: center; }
.section--tinted { background: var(--tint); }
/* Две секции подряд на одном фоне: не складываем отступы */
.section:not(.section--tinted) + .section:not(.section--tinted) { padding-top: 8px; }
.section > :last-child, .location > :last-child { margin-bottom: 0; }
.muted { color: var(--muted); font-size: .92rem; }
.hand { font-family: var(--hand); font-weight: 500; }

/* Плейсхолдер вместо фото, пока их нет */
.ph {
  background:
    linear-gradient(135deg, var(--c1), var(--c2) 60%, var(--c3));
  background-size: cover;
  background-position: center;
}

/* ===== Меню «⋯» ===== */
.menu { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 20; }
.menu-toggle {
  display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: rgb(255 255 255 / .75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--text); fill: currentColor; cursor: pointer;
  box-shadow: 0 2px 12px rgb(0 0 0 / .06);
  transition: background .2s, transform .2s;
}
.menu-toggle:active { transform: scale(.94); }
.menu-toggle[aria-expanded="true"] { background: #fff; }

.menu-panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  display: grid; gap: 14px; min-width: 190px; padding: 14px 16px;
  background: rgb(255 255 255 / .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-radius: 16px; box-shadow: 0 10px 30px rgb(0 0 0 / .1);
  transform-origin: top right;
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.96);
  transition: opacity .25s ease, transform .25s ease, visibility 0s .25s;
}
.menu.is-open .menu-panel {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .25s ease, transform .25s ease;
}
.menu-group[hidden] { display: none; }
.menu-label {
  display: block; margin-bottom: 8px;
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}

.lang { display: flex; gap: 4px; }
.lang button {
  flex: 1; border: 1px solid var(--line); background: none; color: var(--muted);
  font: 500 12px var(--sans); letter-spacing: .05em;
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--text); }

/* ===== Hero ===== */
/* Первый экран на всю высоту, со вступительной анимацией */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 56px var(--gutter) 88px; text-align: center;
}

@keyframes intro-drop {
  from { opacity: 0; translate: 0 -36px; scale: 1.06; }
  to   { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes intro-fade {
  from { opacity: 0; translate: 0 16px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes hint-bob {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 6px; }
}
.hero .polaroid--left  { animation: intro-drop 1.1s cubic-bezier(.22, .61, .36, 1) .2s both; }
.hero .polaroid--right { animation: intro-drop 1.1s cubic-bezier(.22, .61, .36, 1) .6s both; }
.hero .kicker    { animation: intro-fade 1s ease 1.2s both; }
.hero .names     { animation: intro-fade 1.1s ease 1.45s both; }
.hero .hero-date { animation: intro-fade 1s ease 1.75s both; }

.scroll-hint {
  position: absolute; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom));
  width: max-content; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: .72rem; letter-spacing: .15em; text-transform: uppercase;
  text-decoration: none;
  animation: intro-fade 1s ease 2.4s both;
}
.scroll-hint svg { animation: hint-bob 2s ease-in-out 3.4s infinite; }

/* Эскизы-дудлы на фоне секций (раскладку считает main.js) */
@keyframes doodle-in {
  from { opacity: 0; scale: .6; }
  to   { opacity: .13; scale: 1; }
}
@keyframes doodle-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -5px; }
}
.doodles { position: absolute; inset: 0; pointer-events: none; color: var(--deep); }
.doodles svg {
  position: absolute; left: var(--x); top: var(--y);
  width: calc(var(--w) * 1.5); height: calc(var(--w) * 1.5); overflow: visible;
  rotate: var(--r);
  fill: none; stroke: currentColor; stroke-width: 1.2;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: .11;
  animation: doodle-float 6s ease-in-out infinite;
}
.doodles svg:nth-child(3n+1) { animation-delay: -2s; }
.doodles svg:nth-child(3n+2) { animation-delay: -4s; }
/* На первом экране эскизы проявляются после вступительной анимации */
.hero .doodles svg { opacity: .13; }
.hero .doodles--intro svg { animation: doodle-in .9s ease var(--intro-delay) both, doodle-float 6s ease-in-out calc(var(--intro-delay) + 1s) infinite; }
.hero .doodles--intro svg:nth-child(3n+1) { animation-delay: calc(var(--intro-delay) + .1s), calc(var(--intro-delay) + 1.4s); }
.hero .doodles--intro svg:nth-child(3n+2) { animation-delay: calc(var(--intro-delay) + .3s), calc(var(--intro-delay) + 2.2s); }
/* Замер раскладки эскизов: элементы в конечном положении */
.is-measuring .reveal, .is-measuring .hero * {
  transform: none !important; translate: none !important; scale: none !important; transition: none !important;
}
.finale .doodles { color: #fff; }
.finale .doodles svg { opacity: .07; }
.hero, .section, .finale-body { position: relative; }
.hero > :not(.doodles), .section > :not(.doodles), .finale-body > :not(.doodles) { position: relative; }
.hero > .scroll-hint { position: absolute; }

.polaroids { position: relative; aspect-ratio: 10 / 8; margin-bottom: 28px; }
.polaroid {
  position: absolute; margin: 0; width: 50%;
  padding: 10px 10px 4px; background: #fff;
  box-shadow: 0 8px 24px rgb(0 0 0 / .1);
}
.polaroid .ph { aspect-ratio: 1; }
.polaroid figcaption { font-size: 1.6rem; text-align: center; }
.polaroid--left  { left: 2%;  top: 0;    transform: rotate(-6deg); }
.polaroid--right { right: 2%; top: 40px; transform: rotate(5deg); }

.kicker { text-transform: uppercase; letter-spacing: .25em; font-size: .75rem; color: var(--muted); margin: 0 0 8px; }
.names { font-size: clamp(2.6rem, 12vw, 3.4rem); margin: 0; }
.names .amp { font-family: var(--hand); color: var(--deep); font-size: .8em; margin: 0 .4em 0 .3em; }
.hero-date { font-size: 1.8rem; color: var(--deep); margin: 8px 0 0; }

/* ===== Цитата и карусель ===== */
.quote { font: italic 400 1.35rem/1.45 var(--serif); margin-bottom: 28px; }

/* Слайды позиционируются абсолютно и двигаются через transform (см. renderCarousel) */
.carousel {
  position: relative; overflow: hidden;
  margin: 0 calc(-1 * var(--gutter));
  aspect-ratio: 1 / .96; /* = ширина слайда 72% × 4/3 */
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  cursor: grab; outline: none;
}
.carousel.is-dragging { cursor: grabbing; }
.carousel > * {
  position: absolute; top: 0; left: 14%;
  width: 72%; height: 100%;
  border-radius: var(--radius);
  object-fit: cover; will-change: transform;
  -webkit-user-drag: none; pointer-events: none;
}
.carousel-dots { display: flex; justify-content: center; gap: 6px; margin-top: 14px; }
.carousel-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); transition: background .3s, transform .3s; }
.carousel-dots span.is-active { background: var(--deep); transform: scale(1.3); }

/* ===== Календарь ===== */
.calendar { margin: 32px auto 24px; max-width: 340px; }
.calendar-month { font: 500 2rem var(--hand); color: var(--deep); margin-bottom: 8px; text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 6px; }
.calendar-grid .dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-bottom: 6px; }
.calendar-grid .day { font: 500 1.15rem/2.4 var(--serif); position: relative; }
.calendar-grid .day.is-wedding { color: var(--text); font-weight: 600; }
.calendar-grid .day.is-wedding::before {
  content: ""; position: absolute; inset: 50% auto auto 50%;
  width: 2.3em; height: 2.3em; translate: -50% -50%;
  border: 1.5px solid var(--deep); border-radius: 50% 45% 52% 48%;
  rotate: -8deg;
}

/* ===== План дня ===== */
/* Центральная линия с сердечками; пункты (время + событие) по очереди слева и справа */
.timeline { list-style: none; margin: 0 auto; padding: 0; max-width: 360px; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(transparent, var(--deep) 10%, var(--deep) 90%, transparent);
  opacity: .35;
}
.timeline li {
  display: grid; grid-template-columns: 1fr 44px 1fr; align-items: start;
  padding: 16px 0;
}
.timeline li::before {
  content: ""; grid-column: 2; grid-row: 1; justify-self: center;
  width: 16px; height: 16px; margin-top: 10px; background: var(--deep); /* на уровне времени */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.2 0 3.7 1.2 5.3 3.1 1.6-1.9 3.1-3.1 5.3-3.1 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7.5-4.6-9.6-9.2C.9 8.4 3 4.5 6.7 4.5c2.2 0 3.7 1.2 5.3 3.1 1.6-1.9 3.1-3.1 5.3-3.1 3.7 0 5.8 3.9 4.3 7.3C19.5 16.4 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.timeline .slot { grid-column: 1; grid-row: 1; text-align: right; }
.timeline time { display: block; font: 500 2rem/1.1 var(--serif); color: var(--deep); }
.timeline .event { display: block; line-height: 1.35; }
.timeline li:nth-child(even) .slot { grid-column: 3; text-align: left; }

/* ===== Локации ===== */
.location + .location { margin-top: 48px; }
.location-name { font: 500 1.3rem var(--serif); margin-bottom: 4px; }
.location-photo, .location-map {
  width: 100%; aspect-ratio: 4 / 3; border: 0;
  border-radius: var(--radius); margin: 24px 0 32px;
}

/* ===== Кнопки ===== */
.btn {
  display: inline-block; width: 100%; max-width: 320px;
  padding: 15px 24px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--text);
  font: 500 .95rem var(--sans); letter-spacing: .03em;
  text-decoration: none; cursor: pointer;
  transition: filter .2s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn:hover { filter: brightness(.96); }
/* Приглушаем цветом, а не opacity: opacity перебивает анимация появления */
.btn:disabled {
  background: color-mix(in srgb, var(--accent) 55%, var(--bg));
  color: color-mix(in srgb, var(--text) 55%, var(--bg));
  cursor: default; filter: none; transform: none;
}
.btn--ghost { background: transparent; border: 1px solid var(--deep); color: var(--deep); }
.section .btn { margin-bottom: 16px; }

/* ===== Дресс-код ===== */
.swatches { display: flex; justify-content: center; gap: 14px; margin: 8px 0 28px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: .72rem; color: var(--muted); }
.swatch i {
  width: 58px; height: 58px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06);
}

/* ===== Детали: карточки-конверты с вырезом ===== */
.details { display: grid; gap: 16px; }
.detail {
  position: relative; padding: 36px 24px 26px;
  background: var(--bg); border-radius: var(--radius);
  -webkit-mask: radial-gradient(circle 22px at 50% 0, transparent 21px, #000 22px);
          mask: radial-gradient(circle 22px at 50% 0, transparent 21px, #000 22px);
}
.detail h3 { font: 500 1.5rem var(--serif); margin: 0 0 8px; }
.detail p { margin: 0; }

/* ===== Форма ===== */
.form { text-align: left; max-width: 380px; margin: 28px auto 0; }
.field { display: block; border: 0; padding: 0; margin: 0 0 22px; }
.field > span, .field legend { display: block; font-weight: 500; margin-bottom: 6px; padding: 0; }
.field small { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
.field input[type="text"], .field input[type="tel"], .field textarea, .field select {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--text);
  font: 400 16px var(--sans); /* 16px — чтобы iOS не зумил */
}
.field textarea { resize: vertical; }
.field :focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.choice { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--deep); }
.form .btn { display: block; margin: 8px auto 0; }
.form-status { text-align: center; margin: 14px 0 0; }
.form-status:empty { display: none; }
.form-status.is-error { color: #A4544A; }
.field.is-invalid input, .field.is-invalid textarea { border-color: #C98B82; }
.hp { position: absolute; left: -9999px; }

/* ===== На память ===== */
.filmstrip {
  padding: 18px 12px; margin: 8px 0 24px; border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, var(--bg) 0 10px, transparent 10px 22px) top / 100% 8px no-repeat,
    repeating-linear-gradient(90deg, var(--bg) 0 10px, transparent 10px 22px) bottom / 100% 8px no-repeat,
    var(--deep);
}
.filmstrip .ph { aspect-ratio: 16 / 9; border-radius: 4px; }

/* ===== Финал ===== */
.finale { color: #fff; background: var(--tint); }
.wave { display: block; width: 100%; height: 40px; fill: var(--deep); margin-bottom: -1px; position: relative; }
.finale-body { background: var(--deep); padding: 24px var(--gutter) calc(48px + env(safe-area-inset-bottom)); text-align: center; }
.finale-title { font-size: 3rem; margin-bottom: 4px; }
.countdown { display: flex; justify-content: center; gap: 22px; margin-top: 20px; }
.countdown div { display: flex; flex-direction: column; min-width: 44px; }
.countdown b { font: 500 2rem/1 var(--serif); }
.countdown span { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; opacity: .8; margin-top: 4px; }

/* ===== Палитры в меню (временно) ===== */
.palette-dots { display: flex; gap: 10px; }
.palette-dots button {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; padding: 0;
  box-shadow: 0 0 0 1px rgb(0 0 0 / .06);
}
.palette-dots button[aria-pressed="true"] { border-color: var(--text); }
[data-palette-btn="sage"]     { background: linear-gradient(135deg, #B7C4A9 50%, #E3C4BE 50%); }
[data-palette-btn="lavender"] { background: linear-gradient(135deg, #C9C1DA 50%, #AFC3D3 50%); }
[data-palette-btn="peach"]    { background: linear-gradient(135deg, #EDCDB7 50%, #C3C59E 50%); }
[data-palette-btn="latte"]    { background: linear-gradient(135deg, #D9C3AE 50%, #9E8574 50%); }

/* ===== Появление при скролле ===== */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity .9s cubic-bezier(.22, .61, .36, 1), transform .9s cubic-bezier(.22, .61, .36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* План дня: пункты выплывают со своей стороны, линия прорисовывается сверху вниз */
.timeline > li.reveal { transform: translateX(-24px); transition-duration: 1.1s; }
.timeline > li.reveal:nth-child(even) { transform: translateX(24px); }
.timeline > li.reveal.is-visible { transform: none; }
.timeline::before { transform: scaleY(0); transform-origin: top; transition: transform 1.8s cubic-bezier(.22, .61, .36, 1); }
.timeline.is-drawn::before { transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .timeline > li.reveal { opacity: 1; transform: none; transition: none; }
  .timeline::before { transform: none; transition: none; }
  .hero *, .scroll-hint, .doodles svg { animation: none !important; }
}
