:root {
  /* Светлая «бумажная» палитра: тёплый офф-вайт, графитовый текст,
     шалфейный акцент и марсала для редких деталей. Все текстовые цвета
     проверены на контраст не ниже 4.5:1 на всех трёх фонах. */
  --bg: #f0ede7;
  --bg-warm: #eae6de;
  --ink: #23231f;
  --ink-soft: #4e4e48;
  --muted: #67645b;
  --accent: #8e9c88;
  --accent-deep: #59674f;
  --marsala: #7c4a48;
  --card: #fbfaf7;
  --line: rgba(35, 35, 31, 0.14);
  --line-strong: rgba(35, 35, 31, 0.30);
  --focus: rgba(89, 103, 79, 0.30);
  --shadow: 0 14px 38px rgba(35, 35, 31, 0.09);

  /* ---- Типографика ----
     Два семейства с жёсткими ролями:
     serif — только «приглашательные» моменты (монограмма, имена,
     заголовки секций, дата, финальный заголовок);
     sans  — всё функциональное: тексты, карточки, форма, кнопки.
     Другие семейства в проект не вводятся. */
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Модульная шкала — размеров вне этого списка в проекте нет */
  --t-xs: 0.75rem;    /* 12 — рубрики и мелкие подписи */
  --t-sm: 0.875rem;   /* 14 — подсказки, примечания */
  --t-md: 1rem;       /* 16 — базовый текст и поля */
  --t-lg: 1.125rem;   /* 18 — крупный текст */
  --t-xl: 1.375rem;   /* 22 — значения в карточках */
  --t-2xl: 1.75rem;   /* 28 — заголовки */
  --t-3xl: 2.5rem;    /* 40 */
  --t-4xl: 3.5rem;    /* 56 — имена */

  /* Единственная разрядка в проекте — только для прописных рубрик */
  --track: 0.18em;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: var(--t-md);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }

#app { opacity: 1; transition: opacity 0.4s ease; }
#app.loading { opacity: 0; }

a { color: var(--accent-deep); text-decoration: none; }

/* Ровные цифры одной высоты — иначе Cormorant рисует их «прыгающими» */
.monogram, .hero__names, .hero__date, .section__title, .thanks__title {
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
}

/* Единая рубрика: прописные, одна разрядка, один размер.
   Другой разрядки в проекте нет. */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: var(--track);
  font-size: var(--t-xs);
  font-weight: 600;
  line-height: 1.4;
}

/* ---------- Монограмма ---------- */
.monogram {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: var(--track);
  color: var(--ink);
  font-size: var(--t-2xl);
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
}
/* Инициалы — главное в монограмме: крупнее и плотнее по весу */
.monogram .mono__l { font-weight: 600; }
.monogram::before,
.monogram::after {
  content: "";
  align-self: center;
  width: 42px;
  height: 1px;
  background: var(--accent);
  opacity: 0.85;
}
/* Крупный вариант — только на первом экране */
.monogram--lg { font-size: var(--t-3xl); gap: 18px; }
.monogram--lg::before,
.monogram--lg::after { width: 52px; }
/* Амперсанд — соединительная деталь, а не третья буква: мельче и тише.
   Начертание строго прямое: в курсиве Cormorant рисует декоративную
   лигатуру «Et», которая читается как посторонний завиток. */
.monogram .amp {
  color: var(--accent);
  font-style: normal;
  font-weight: 400;
  letter-spacing: 0;
  font-size: 0.5em;
  opacity: 0.9;
}
.monogram--sm { font-size: var(--t-lg); gap: 10px; }
.monogram--sm::before,
.monogram--sm::after { width: 26px; }

/* ---------- Разделители ---------- */
.rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 18px auto;
  max-width: 240px;
}
.rule span { flex: 1; height: 1px; background: var(--line-strong); }
.rule i { width: 7px; height: 7px; border: 1px solid var(--accent); transform: rotate(45deg); display: block; }
.rule--sm { max-width: 150px; margin: 14px auto 22px; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 22px;
  background:
    radial-gradient(130% 90% at 50% -10%, #fdfcfa 0%, var(--bg) 46%, #e3ded4 100%);
  text-align: center;
}
.hero__frame {
  border: 1px solid var(--line-strong);
  padding: 46px 26px 40px;
  max-width: 520px;
  width: 100%;
  position: relative;
  background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0));
}
.hero__frame::before,
.hero__frame::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--accent);
}
.hero__frame::before { top: 7px; left: 7px; border-right: none; border-bottom: none; }
.hero__frame::after { bottom: 7px; right: 7px; border-left: none; border-top: none; }

.hero__eyebrow { color: var(--accent-deep); margin: 0 0 22px; }
.hero__names {
  font-family: var(--serif);
  font-weight: 500;
  /* На узких экранах имена должны оставаться заметно крупнее монограммы */
  font-size: clamp(var(--t-3xl), 13.5vw, var(--t-4xl));
  line-height: 1.05;
  margin: 22px 0 6px;
  color: var(--ink);
}
.hero__names span {
  display: block;
  font-style: italic;
  font-size: 0.42em;
  color: var(--accent);
  margin: 4px 0;
}
.hero__lead {
  font-size: var(--t-md);
  color: var(--ink-soft);
  margin: 10px auto 24px;
  max-width: 320px;
}
.hero__date {
  font-family: var(--serif);
  font-size: var(--t-2xl);
  line-height: 1.2;
  margin: 0 0 6px;
}
.hero__time {
  font-size: var(--t-md);
  color: var(--ink-soft);
  margin: 0 0 8px;
}
.hero__venue { color: var(--muted); font-size: var(--t-sm); margin: 0 0 30px; }
.hero__scroll {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  color: var(--accent-deep);
  padding: 6px 10px;
}
.hero__scroll .chev {
  width: 11px;
  height: 11px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(45deg);
  animation: bob 1.9s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(45deg); }
  50% { transform: translateY(6px) rotate(45deg); }
}

/* ---------- Секции ---------- */
.section {
  max-width: 640px;
  margin: 0 auto;
  padding: 58px 22px;
  text-align: center;
}
.section__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(var(--t-2xl), 6vw, var(--t-3xl));
  line-height: 1.15;
  margin: 0;
}
.section--about { padding-bottom: 20px; }
.about {
  font-size: var(--t-lg);
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 520px;
  margin: 0 auto;
}

/* ---------- Детали ---------- */
.details {
  display: grid;
  gap: 14px;
  text-align: left;
}
.detail {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.detail__label { color: var(--accent-deep); margin-bottom: 8px; }
.detail__value { font-size: var(--t-xl); font-weight: 500; line-height: 1.3; }
.detail__note { color: var(--muted); font-size: var(--t-sm); margin-top: 4px; }
.detail__map {
  margin-top: 12px;
  align-self: flex-start;
  font-weight: 600;
  font-size: var(--t-sm);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}
@media (min-width: 560px) {
  .details { grid-template-columns: 1fr 1fr; }
}

/* ---------- Форма ---------- */
.section--form { background: var(--bg-warm); max-width: none; }
.section--form > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.form__intro {
  color: var(--ink-soft);
  font-size: var(--t-md);
  max-width: 480px;
  margin: 0 auto 30px;
}

#rsvpForm { text-align: left; max-width: 640px; margin: 0 auto; }

.field { margin-bottom: 26px; }
.field__label {
  display: block;
  font-weight: 600;
  font-size: var(--t-md);
  margin-bottom: 4px;
}
.field__hint { display: block; color: var(--muted); font-size: var(--t-sm); margin-bottom: 12px; }
.field__label + .field__hint { margin-top: -1px; }

.field__input {
  width: 100%;
  font-family: var(--sans);
  font-size: var(--t-md);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}
.field__input--area { resize: vertical; min-height: 52px; }

/* Присутствие */
.choice--attend { display: grid; gap: 12px; }
@media (min-width: 480px) { .choice--attend { grid-template-columns: 1fr 1fr; } }
.attend { display: block; cursor: pointer; }
.attend input { position: absolute; opacity: 0; pointer-events: none; }
.attend__box {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 58px;
  padding: 12px 16px;
  font-size: var(--t-md);
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  transition: all 0.15s;
}
.attend input:focus-visible + .attend__box { box-shadow: 0 0 0 3px var(--focus); }
.attend--yes input:checked + .attend__box {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.attend--no input:checked + .attend__box {
  background: #e2ded4; border-color: var(--ink-soft); color: var(--ink);
}

/* Напитки (чекбоксы-таблетки) */
.choice--grid { display: grid; gap: 10px; }
@media (min-width: 480px) { .choice--grid { grid-template-columns: 1fr 1fr; } }
.pill { display: block; cursor: pointer; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill__box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-size: var(--t-md);
  line-height: 1.4;
  transition: all 0.15s;
  min-height: 52px;
}
.pill__box::before {
  content: "";
  flex: 0 0 auto;
  width: 20px; height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  transition: all 0.15s;
}
.pill input:checked + .pill__box {
  border-color: var(--accent);
  background: #fff;
}
.pill input:checked + .pill__box::before {
  background: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 14px; background-repeat: no-repeat; background-position: center;
}
.pill input:focus-visible + .pill__box { box-shadow: 0 0 0 3px var(--focus); }
/* Одиночная галочка вне сетки — не растягиваем на всю ширину */
@media (min-width: 480px) { .pill--single .pill__box { max-width: 340px; } }

/* Карточки блюд (radio) */
.cards { display: grid; gap: 12px; }
.dish { display: block; cursor: pointer; }
.dish input { position: absolute; opacity: 0; pointer-events: none; }
.dish__box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  transition: all 0.15s;
}
.dish__radio {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  margin-top: 2px;
  position: relative;
  transition: all 0.15s;
}
.dish__radio::after {
  content: "";
  position: absolute; inset: 4px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform 0.15s;
}
.dish__text { flex: 1; }
.dish__name { font-size: var(--t-md); font-weight: 500; line-height: 1.4; color: var(--ink); }
.dish__weight { display: block; color: var(--muted); font-size: var(--t-sm); margin-top: 3px; }
.dish input:checked + .dish__box {
  border-color: var(--accent);
  background: #fff;
  box-shadow: var(--shadow);
}
.dish input:checked + .dish__box .dish__radio { border-color: var(--accent); }
.dish input:checked + .dish__box .dish__radio::after { transform: scale(1); }
.dish input:focus-visible + .dish__box { box-shadow: 0 0 0 3px var(--focus); }

/* Кнопка отправки */
.form__error {
  color: #a13d2d;
  background: #f7e6e1;
  border: 1px solid #e2b6ab;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: var(--t-sm);
  margin: 0 0 16px;
}
.submit {
  width: 100%;
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--t-md);
  color: #fff;
  background: var(--ink);
  border: none;
  border-radius: 12px;
  padding: 18px;
  min-height: 56px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.submit:hover { background: #35352f; }
.submit:active { transform: translateY(1px); }
.submit:disabled { opacity: 0.6; cursor: default; }
.submit:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }

/* ---------- Footer ---------- */
.foot {
  text-align: center;
  padding: 44px 22px 54px;
  color: var(--muted);
}
.foot .monogram { margin-bottom: 14px; }
.foot p { margin: 0; color: var(--muted); }

/* ---------- Благодарность ---------- */
.thanks {
  position: fixed;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, #fdfcfa 0%, var(--bg) 60%, var(--bg-warm) 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 26px;
  overflow-y: auto;
  z-index: 50;
  animation: fade 0.45s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.thanks__card {
  text-align: center;
  max-width: 460px;
  width: 100%;
  margin: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 26px;
  box-shadow: var(--shadow);
}
.thanks__card .monogram { margin-bottom: 20px; }
.thanks__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: var(--t-2xl);
  line-height: 1.2;
  margin: 0 0 12px;
}
.thanks__text {
  color: var(--ink-soft);
  font-size: var(--t-md);
  margin: 0 auto 24px;
  max-width: 340px;
}

/* Пожелания по подарку — выделенный блок перед вступлением в группу */
.gifts {
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 14px;
  padding: 22px 20px;
  margin: 0 0 24px;
}
.gifts__label { color: var(--accent-deep); margin: 0 0 10px; }
.gifts__text {
  font-family: var(--serif);
  font-style: italic;
  font-size: var(--t-lg);
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

.thanks__tg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  font-weight: 600;
  font-size: var(--t-md);
  color: #fff;
  background: #2aabee;
  border-radius: 12px;
  padding: 16px 26px;
  transition: background 0.2s;
}
.thanks__tg:hover { background: #1f97d4; }
.thanks__tg:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.thanks__note { color: var(--muted); font-size: var(--t-sm); margin: 14px auto 0; max-width: 320px; }

.thanks__cal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  margin-top: 20px;
  padding: 14px 22px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--t-sm);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.thanks__cal:hover { border-color: var(--accent); background: #fff; }
.thanks__cal:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.cal__icon { width: 18px; height: 18px; flex: 0 0 auto; color: var(--accent-deep); }

/* ---------- Шторка выбора календаря ---------- */
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; }
.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 35, 31, 0.45);
  animation: fade 0.2s ease;
}
.sheet__panel {
  position: relative;
  margin-top: auto;
  width: 100%;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 26px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(35, 35, 31, 0.18);
  animation: sheetUp 0.26s cubic-bezier(0.22, 0.8, 0.3, 1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet__title {
  font-size: var(--t-lg);
  font-weight: 600;
  margin: 0 0 4px;
  text-align: center;
}
.sheet__sub {
  color: var(--muted);
  font-size: var(--t-sm);
  text-align: center;
  margin: 0 0 20px;
}
.sheet__list { display: grid; gap: 10px; }
.sheet__close {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  padding: 13px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: var(--t-md);
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
}
.sheet__close:hover { background: rgba(35, 35, 31, 0.06); }
.sheet__close:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }

.calopt {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 13px 16px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.calopt:hover { border-color: var(--accent); }
.calopt:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.calopt__ic {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg);
  color: var(--accent-deep);
}
.calopt__ic svg { width: 20px; height: 20px; }
.calopt__txt { flex: 1; min-width: 0; }
.calopt__name { display: block; font-weight: 600; font-size: var(--t-md); line-height: 1.3; }
.calopt__sub { display: block; color: var(--muted); font-size: var(--t-xs); margin-top: 2px; }
.calopt__arrow {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--line-strong);
  border-top: 1.5px solid var(--line-strong);
  transform: rotate(45deg);
}

/* На широких экранах — обычное модальное окно по центру */
@media (min-width: 560px) {
  .sheet { align-items: center; justify-content: center; padding: 24px; }
  .sheet__panel {
    margin: 0;
    max-width: 420px;
    border-radius: 20px;
    padding: 30px 26px 24px;
    animation: fade 0.2s ease;
  }
}

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