:root {
  --bg-outer: #d9d2c4;
  --bg-page: #f1ede3;
  --bg-card: #f7f4ec;
  --bg-tile: #e7e1d2;
  --photo-1: #c9bfa9;
  --photo-2: #b3a78c;
  --photo-3: #8c8a6e;
  --photo-4: #a89d88;
  --text: #3a352c;
  --text-dark: #2e2a22;
  --text-soft: #6d6558;
  --text-faint: #8a8172;
  --script: #a89d88;
  --line: #d8d0bf;
  --accent-border: #b3a78c;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', -apple-system, sans-serif;
  --script-font: 'Caveat', cursive;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-outer);
  font-family: var(--sans);
  color: var(--text);
  padding: 12px;
  -webkit-font-smoothing: antialiased;
}

.frame {
  background: var(--bg-page);
  border-radius: 18px;
  max-width: 1200px;
  margin: 0 auto;
  overflow: hidden;
}

/* ---------- Шапка ---------- */
.header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  padding: 28px 32px 20px;
  gap: 16px;
}

.header__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header__nav a,
.header__meta a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.25s;
}

.header__nav a:hover,
.header__meta a:hover { color: var(--text-dark); }

.header__logo {
  font-family: var(--script-font);
  font-size: 26px;
  color: var(--text-faint);
}

.header__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  font-size: 13px;
  color: var(--text-soft);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  margin: 8px 14px 14px;
  border-radius: 16px;
  overflow: hidden;
  min-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.hero__media img,
.hero__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero__card {
  position: relative;
  z-index: 2;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 44px 48px;
  text-align: center;
  max-width: 560px;
  margin: 0 20px;
  box-shadow: 0 20px 60px rgba(58, 53, 44, 0.18);
}

.hero__eyebrow {
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 18px;
}

.hero__names {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.2;
  color: var(--text-dark);
}

.hero__names em {
  font-size: 0.7em;
  font-style: italic;
}

.hero__lead {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-soft);
  margin-top: 18px;
}

.hero__scroll {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--bg-card);
  text-transform: uppercase;
}

.hero__scroll-line {
  width: 1px;
  height: 36px;
  background: var(--bg-card);
  opacity: 0.7;
}

/* ---------- Секции ---------- */
.section {
  padding: 56px 32px 48px;
  border-top: 1px solid var(--line);
}

.section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 28px;
}

.section__head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 4vw, 38px);
  color: var(--text-dark);
}

.section__script {
  font-family: var(--script-font);
  font-size: 22px;
  color: var(--script);
}

/* ---------- Отсчёт ---------- */
.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.countdown__cell {
  background: var(--bg-tile);
  border-radius: 14px;
  padding: 28px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.countdown__num {
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 54px);
  color: var(--text-dark);
  font-variant-numeric: tabular-nums;
}

.countdown__label {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
}

.countdown__done {
  font-family: var(--serif);
  font-size: 26px;
  text-align: center;
  color: var(--text-dark);
  padding: 20px 0;
}

/* ---------- Кнопки ---------- */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.actions--center { justify-content: center; }

.btn {
  font-family: var(--sans);
  font-size: 13px;
  padding: 13px 26px;
  border-radius: 30px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.2s, opacity 0.2s;
  border: none;
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--outline {
  background: transparent;
  border: 1px solid var(--accent-border);
  color: var(--text);
}

.btn--solid {
  background: var(--text);
  color: var(--bg-page);
}

.calendar-wrap { position: relative; }

.calendar-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  min-width: 220px;
  z-index: 10;
  box-shadow: 0 12px 32px rgba(58, 53, 44, 0.12);
}

.calendar-menu a {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
}

.calendar-menu a:hover { background: var(--bg-tile); }

/* ---------- История пары ---------- */
.story {
  position: relative;
  padding-left: 8px;
}

.story__track {
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}

.story__line {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent-border);
  transform-origin: top;
}

.story__item {
  position: relative;
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 18px;
  padding: 0 0 36px 34px;
}

.story__item:last-child { padding-bottom: 6px; }

.story__dot {
  position: absolute;
  left: -5px;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 2px solid var(--accent-border);
}

.story__year {
  font-family: var(--script-font);
  font-size: 26px;
  color: var(--script);
  line-height: 1;
}

.story__body h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 20px;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.story__body p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-soft);
  max-width: 560px;
}

/* ---------- Галерея (masonry) ---------- */
.masonry {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: start;
}

.masonry__col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.masonry__col:nth-child(2) { margin-top: 36px; }
.masonry__col:nth-child(3) { margin-top: 18px; }

.masonry__item {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
}

.masonry__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.masonry__item:hover img { transform: scale(1.04); }

.masonry__caption {
  position: absolute;
  bottom: 10px;
  left: 14px;
  font-family: var(--script-font);
  font-size: 20px;
  color: var(--bg-card);
  text-shadow: 0 1px 8px rgba(46, 42, 34, 0.4);
}

/* ---------- Лайтбокс ---------- */
.masonry__item { cursor: pointer; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(46, 42, 34, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 48px 16px;
}

.lightbox[hidden] { display: none; }

.lightbox__figure {
  margin: 0;
  max-width: min(1000px, 86vw);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox__img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 12px;
  display: block;
}

.lightbox__caption {
  font-family: var(--script-font);
  font-size: 22px;
  color: var(--bg-card);
  min-height: 1em;
}

.lightbox__close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: none;
  border: none;
  color: var(--bg-card);
  font-size: 40px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 10px;
}

.lightbox__arrow {
  background: none;
  border: 1px solid rgba(247, 244, 236, 0.4);
  color: var(--bg-card);
  font-size: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.25s, background 0.25s;
}

.lightbox__arrow:hover {
  border-color: var(--bg-card);
  background: rgba(247, 244, 236, 0.1);
}

@media (max-width: 760px) {
  .lightbox { padding: 48px 8px; gap: 8px; }
  .lightbox__arrow { width: 40px; height: 40px; }
}

/* ---------- Локация ---------- */
.location {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 14px;
}

.location__info {
  background: var(--bg-tile);
  border-radius: 14px;
  padding: 30px 28px;
}

.location__info h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  color: var(--text-dark);
  margin-bottom: 14px;
}

.location__list {
  list-style: none;
  font-size: 14px;
  line-height: 2;
  color: var(--text-soft);
}

.location__route {
  display: inline-block;
  margin-top: 18px;
  font-size: 14px;
  color: var(--text);
  text-underline-offset: 4px;
}

.location__map {
  border-radius: 14px;
  overflow: hidden;
  min-height: 280px;
}

.location__map iframe {
  width: 100%;
  height: 100%;
  min-height: 280px;
  border: none;
  display: block;
}

/* ---------- Дресс-код ---------- */
.dresscode__notes {
  list-style: none;
  font-size: 14px;
  line-height: 2;
  color: var(--text-soft);
}

.dresscode__palette {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.swatch {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

/* ---------- RSVP ---------- */
.section--rsvp { text-align: center; }

.section--rsvp .section__head { justify-content: center; gap: 16px; }

.rsvp__text {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-soft);
}

/* ---------- Футер ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 22px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer__note {
  font-size: 12px;
  color: var(--text-faint);
}

.footer__sign {
  font-family: var(--script-font);
  font-size: 24px;
  color: var(--text-soft);
}

/* ---------- Адаптив ---------- */
@media (max-width: 760px) {
  body { padding: 6px; }

  .header {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 12px;
  }

  .header__nav { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 14px; }
  .header__logo { order: -1; }
  .header__meta { flex-direction: row; justify-content: center; gap: 14px; text-align: center; }

  .hero { min-height: 66vh; }
  .hero__card { padding: 32px 24px; }

  .section { padding: 44px 20px 38px; }

  .countdown { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .story__item { grid-template-columns: 1fr; gap: 6px; padding-left: 26px; }

  .masonry { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .masonry__col { gap: 10px; }
  .masonry__col:nth-child(3) { display: none; }

  .location { grid-template-columns: 1fr; }

  .footer { flex-direction: column; gap: 8px; }
}

/* ---------- Печать (PDF) ---------- */
@media print {
  body { padding: 0; background: #fff; }
  .frame { border-radius: 0; max-width: none; }
  .header__nav, .hero__scroll, .actions, .calendar-menu,
  #gallery, #rsvp, .location__map, .lightbox { display: none !important; }
  .hero { min-height: auto; page-break-inside: avoid; }
  .section { padding: 28px 32px; page-break-inside: avoid; }
}

/* Отключение анимаций по предпочтению пользователя */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .masonry__item img { transition: none; }
}
