/* ============== Базовые переменные ============== */
:root {
  --bg: #f5efe6;
  --bg-2: #ece2d2;
  --ink: #2a2520;
  --ink-soft: #5a5048;
  --accent: #8a7a5c;
  --accent-deep: #6b5d44;
  --line: #cdbfa4;
  --card: #fbf6ec;
  --shadow: 0 18px 50px -22px rgba(60, 45, 25, 0.25);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --serif-italic: "Cormorant Infant", "Cormorant Garamond", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow: hidden;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* ============== Контейнер страниц (свайп/перелистывание) ============== */
.pages {
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

.page {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(32px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  transition:
    transform 1100ms cubic-bezier(0.77, 0, 0.18, 1),
    opacity 900ms ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

/* Стартовое состояние — экран 1 виден, экран 2 ниже */
.page[data-page="0"] { transform: translateY(0); z-index: 2; }
.page[data-page="1"] { transform: translateY(100%); z-index: 1; }

/* Состояние «активна страница 2» */
body.is-page-1 .page[data-page="0"] {
  transform: translateY(-12%);
  opacity: 0;
  pointer-events: none;
}
body.is-page-1 .page[data-page="1"] {
  transform: translateY(0);
  z-index: 3;
}

/* ============== Точки навигации ============== */
.dots {
  position: fixed;
  top: 50%;
  right: 22px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 50;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--accent);
  padding: 0;
  transition: background 240ms ease, transform 240ms ease;
}
.dot.is-active {
  background: var(--accent);
  transform: scale(1.25);
}

/* ============== Экран 1 — Главная ============== */
.page--hero {
  background:
    radial-gradient(120% 80% at 50% 0%, #fbf5ea 0%, transparent 60%),
    radial-gradient(80% 60% at 50% 100%, #ece2d2 0%, transparent 70%),
    var(--bg);
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-leaf {
  position: absolute;
  width: 360px;
  height: 360px;
  background: no-repeat center / contain;
  opacity: 0.45;
}
.hero-leaf--tl {
  top: -60px;
  left: -80px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><g fill='none' stroke='%238a7a5c' stroke-width='1.1' stroke-linecap='round'><path d='M20 180 C 60 140, 100 90, 150 30'/><path d='M50 160 C 70 140, 80 130, 95 130'/><path d='M70 140 C 90 120, 105 110, 120 110'/><path d='M90 120 C 105 100, 120 90, 135 92'/><path d='M110 100 C 125 80, 138 75, 150 78'/><ellipse cx='52' cy='162' rx='14' ry='5' transform='rotate(-30 52 162)'/><ellipse cx='72' cy='142' rx='14' ry='5' transform='rotate(-30 72 142)'/><ellipse cx='92' cy='122' rx='14' ry='5' transform='rotate(-30 92 122)'/><ellipse cx='112' cy='102' rx='14' ry='5' transform='rotate(-30 112 102)'/><ellipse cx='132' cy='82' rx='14' ry='5' transform='rotate(-30 132 82)'/></g></svg>");
  transform: rotate(8deg);
}
.hero-leaf--br {
  bottom: -60px;
  right: -80px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><g fill='none' stroke='%238a7a5c' stroke-width='1.1' stroke-linecap='round'><path d='M20 180 C 60 140, 100 90, 150 30'/><path d='M50 160 C 70 140, 80 130, 95 130'/><path d='M70 140 C 90 120, 105 110, 120 110'/><path d='M90 120 C 105 100, 120 90, 135 92'/><path d='M110 100 C 125 80, 138 75, 150 78'/><ellipse cx='52' cy='162' rx='14' ry='5' transform='rotate(-30 52 162)'/><ellipse cx='72' cy='142' rx='14' ry='5' transform='rotate(-30 72 142)'/><ellipse cx='92' cy='122' rx='14' ry='5' transform='rotate(-30 92 122)'/><ellipse cx='112' cy='102' rx='14' ry='5' transform='rotate(-30 112 102)'/><ellipse cx='132' cy='82' rx='14' ry='5' transform='rotate(-30 132 82)'/></g></svg>");
  transform: rotate(188deg);
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 720px;
}

.overline {
  font-family: var(--sans);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 28px;
}

.names {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 24px;
  margin-bottom: 32px;
}
.name {
  font-size: clamp(56px, 12vw, 124px);
  font-weight: 400;
  letter-spacing: 0.01em;
}
.amp {
  font-family: var(--serif-italic);
  font-style: italic;
  font-size: clamp(40px, 8vw, 84px);
  color: var(--accent);
  font-weight: 300;
}

.date-row {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 36px;
  padding: 14px 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.date-side {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.date-mid {
  font-family: var(--serif-italic);
  font-style: italic;
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.hero-text {
  font-family: var(--serif);
  font-size: clamp(17px, 2.2vw, 22px);
  line-height: 1.65;
  color: var(--ink-soft);
  margin-bottom: 44px;
  font-weight: 400;
}

.next-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 220ms ease, color 220ms ease, transform 220ms ease;
}
.next-btn:hover {
  background: var(--accent);
  color: #fff;
}
.next-btn svg {
  animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* ============== Экран 2 — Детали ============== */
.page--details {
  background:
    radial-gradient(80% 60% at 50% 0%, #fbf5ea 0%, transparent 60%),
    var(--bg-2);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  align-items: flex-start;
  padding-top: max(48px, env(safe-area-inset-top));
  padding-bottom: max(48px, env(safe-area-inset-bottom));
}

.details-inner {
  width: 100%;
  max-width: 1100px;
  text-align: center;
  padding: 24px 0 60px;
}

.details-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 5vw, 52px);
  margin: 12px 0 48px;
  letter-spacing: 0.01em;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  margin-bottom: 52px;
  text-align: left;
}

.card {
  background: var(--card);
  border: 1px solid rgba(138, 122, 92, 0.18);
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  transition: transform 320ms ease, box-shadow 320ms ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px -22px rgba(60, 45, 25, 0.32);
}

.card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(138, 122, 92, 0.1);
  color: var(--accent-deep);
  margin-bottom: 18px;
}

.card-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.card-text {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}
.card-sub {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.card-link {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--accent-deep);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  padding-bottom: 2px;
}
.card-link:hover { color: var(--ink); border-color: var(--ink); }

.rsvp {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.rsvp-text {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink-soft);
  font-style: italic;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-deep);
  transition: background 220ms ease, color 220ms ease;
}
.back-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ============== Анимации появления ============== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 900ms ease, transform 900ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

.reveal-on-view {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 900ms ease, transform 900ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal-on-view.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   АДАПТИВ — топ-15 мобильных устройств 2025-2026:
   • iPhone SE 2/3 (375×667), iPhone 13 mini (375×812)
   • iPhone XR/11 (414×896), iPhone 12/13/14/15 (390×844)
   • iPhone 14/15 Pro (393×852), 14/15 Pro Max (430×932)
   • Samsung Galaxy S20-S23 (360×800), S Ultra (384×854)
   • Samsung Galaxy A51/A71 (412×914), Note (412×883)
   • Pixel 5/6/7 (393×851), 6 Pro (412×892)
   • Xiaomi Redmi (393×873), Huawei P30 (360×780)
   • OnePlus 9 (412×919)
   Диапазон ширины: 320–430, высоты: 568–932
   ============================================================ */

/* Планшет / небольшой ноутбук */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 18px; }
}

/* Все мобильные (≤ 540px) */
@media (max-width: 540px) {
  .dots {
    right: max(12px, env(safe-area-inset-right));
    gap: 10px;
  }
  .dot { width: 8px; height: 8px; }

  .page {
    padding:
      max(24px, env(safe-area-inset-top))
      max(18px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(18px, env(safe-area-inset-left));
  }

  .overline { font-size: 10px; letter-spacing: 0.28em; margin-bottom: 22px; }

  .names {
    gap: 0 16px;
    margin-bottom: 26px;
    flex-direction: column;
    line-height: 0.95;
  }
  .name { font-size: clamp(54px, 16vw, 88px); }
  .amp { font-size: clamp(30px, 9vw, 52px); margin: 4px 0; }

  .date-row { gap: 12px; padding: 12px 18px; margin-bottom: 28px; }
  .date-side { font-size: 18px; }
  .date-mid { font-size: 15px; }

  .hero-text {
    font-size: clamp(15px, 4.2vw, 18px);
    line-height: 1.6;
    margin-bottom: 32px;
  }

  .next-btn { padding: 13px 22px; font-size: 12px; min-height: 44px; }

  .details-inner { padding: 16px 0 40px; }
  .details-title { font-size: clamp(28px, 8vw, 38px); margin: 10px 0 32px; }

  .cards { grid-template-columns: 1fr; gap: 14px; }
  .card { padding: 22px 20px; border-radius: 16px; }
  .card-icon { width: 44px; height: 44px; margin-bottom: 14px; }
  .card-title { font-size: 20px; }
  .card-text { font-size: 17px; }
  .card-sub { font-size: 13px; }

  .rsvp-text { font-size: 16px; padding: 0 8px; }
  .back-btn { min-height: 44px; padding: 10px 20px; }

  .hero-leaf { width: 220px; height: 220px; opacity: 0.32; }
  .hero-leaf--tl { top: -40px; left: -60px; }
  .hero-leaf--br { bottom: -40px; right: -60px; }
}

/* Узкие телефоны: Galaxy S20/S21/S22, Huawei P30 (360px), iPhone SE (375px) */
@media (max-width: 380px) {
  .name { font-size: clamp(48px, 14.5vw, 64px); }
  .amp { font-size: clamp(28px, 8vw, 40px); }
  .date-row { gap: 10px; padding: 10px 14px; }
  .date-side { font-size: 16px; }
  .date-mid { font-size: 14px; }
  .hero-text { font-size: 14px; }
  .card { padding: 20px 18px; }
}

/* Самые узкие (320px — старый iPhone SE 1) */
@media (max-width: 340px) {
  .page {
    padding:
      max(20px, env(safe-area-inset-top))
      14px
      max(20px, env(safe-area-inset-bottom))
      14px;
  }
  .name { font-size: 44px; }
  .amp { font-size: 26px; }
  .next-btn { padding: 12px 18px; letter-spacing: 0.14em; }
  .dots { right: 8px; }
}

/* Большие телефоны: iPhone 15 Pro Max (430px), Galaxy A71 (412px) */
@media (min-width: 412px) and (max-width: 540px) {
  .name { font-size: clamp(64px, 17vw, 84px); }
  .hero-text { font-size: 17px; }
}

/* Низкая высота — короткие экраны (iPhone SE портрет 667px) */
@media (max-height: 700px) and (orientation: portrait) {
  .names { margin-bottom: 18px; }
  .date-row { margin-bottom: 20px; padding: 10px 16px; }
  .hero-text { margin-bottom: 24px; line-height: 1.5; }
  .overline { margin-bottom: 16px; }
  .name { font-size: clamp(46px, 13vw, 72px); }
  .hero-leaf { opacity: 0.25; }
}

/* Ландшафт мобилок (любой телефон повёрнут) */
@media (orientation: landscape) and (max-height: 500px) {
  .page {
    padding:
      max(16px, env(safe-area-inset-top))
      max(40px, env(safe-area-inset-right))
      max(16px, env(safe-area-inset-bottom))
      max(40px, env(safe-area-inset-left));
  }

  .hero-content { max-width: 640px; }
  .overline { margin-bottom: 10px; font-size: 10px; }
  .names { flex-direction: row; gap: 0 18px; margin-bottom: 14px; line-height: 1; }
  .name { font-size: clamp(40px, 8vh, 64px); }
  .amp { font-size: clamp(24px, 5vh, 40px); }
  .date-row { padding: 8px 18px; margin-bottom: 14px; }
  .date-side { font-size: 15px; }
  .date-mid { font-size: 13px; }
  .hero-text {
    font-size: 14px;
    line-height: 1.45;
    margin-bottom: 18px;
  }
  .next-btn { padding: 10px 20px; font-size: 11px; }

  .page--details { padding-top: 24px; padding-bottom: 24px; }
  .details-inner { padding: 8px 0 24px; }
  .details-title { font-size: 26px; margin: 8px 0 22px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
  .card { padding: 16px 16px; }
  .card-icon { width: 38px; height: 38px; margin-bottom: 10px; }
  .card-title { font-size: 17px; margin-bottom: 6px; }
  .card-text { font-size: 15px; }
  .card-sub { font-size: 12px; }

  .hero-leaf { width: 180px; height: 180px; opacity: 0.22; }
}

/* Hover только для устройств с настоящим ховером (не тач-телефоны) */
@media (hover: none) {
  .card:hover { transform: none; box-shadow: var(--shadow); }
  .next-btn:hover { background: rgba(255, 255, 255, 0.4); color: var(--accent-deep); }
  .back-btn:hover { background: transparent; color: var(--accent-deep); }
}

/* Retina/HiDPI — резче бордеры карточек */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .card { border-color: rgba(138, 122, 92, 0.22); }
}

@media (prefers-reduced-motion: reduce) {
  .page, .reveal, .reveal-on-view, .next-btn svg { transition: none; animation: none; }
}
