:root {
  --cream: #f5f1ea;
  --cream-2: #e9e2d6;
  --ink: #1c1a17;
  --muted: #857d70;
  --sage: #c2b39e;
  --sage-dark: #2b2723;
  --rose: #c9b9a6;
  --line: #ddd4c5;
  --shadow: 0 24px 60px -28px rgba(28, 26, 23, 0.35);
  --serif: "Cormorant Garamond", Georgia, serif;
  --script: "Great Vibes", cursive;
  --sans: "Jost", system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

/* Зручні тапи на сенсорних екранах */
a, button, label, input, .btn, .choice, .chip { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: .5px; }

.script { font-family: var(--script); font-weight: 400; }

.container { width: min(1100px, 90vw); margin: 0 auto; }
.container.narrow { width: min(680px, 90vw); }

.section { padding: clamp(64px, 11vw, 130px) 0; text-align: center; }

.ornament { display: block; color: var(--sage); font-size: 1.4rem; margin-bottom: 18px; }
.ornament.small { font-size: 1rem; margin-bottom: 12px; }

.muted { color: var(--muted); }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  color: #fff;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(160deg, #1c1a17 0%, #6b6055 55%, #c2b39e 100%);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -8%;
  background: url("photos/hero-bg.jpg") center center / cover no-repeat;
  filter: grayscale(1) blur(1.6px);
  transform: scale(1.06);
  opacity: .78;
  z-index: 0;
}
.hero__overlay {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(120% 120% at 50% 0%, rgba(0,0,0,.22), rgba(0,0,0,.55)),
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.08), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,.06), transparent 45%);
  pointer-events: none;
  z-index: 1;
}
.hero__inner { position: relative; z-index: 2; padding: 24px; }
.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: .45em;
  font-size: .72rem;
  margin: 0 0 18px;
  opacity: .9;
}
.hero__names {
  font-size: clamp(3.2rem, 12vw, 7.5rem);
  line-height: 1;
  display: flex;
  flex-direction: column;
  gap: .05em;
  font-weight: 400;
}
.hero__names .amp { font-family: var(--script); font-size: .6em; color: #f3e9df; margin: -.1em 0; }
.hero__date {
  font-family: var(--serif);
  font-size: clamp(1.1rem, 3.5vw, 1.7rem);
  letter-spacing: .35em;
  margin: 22px 0 34px;
}
.hero__btn { border-color: rgba(255,255,255,.7); color: #fff; background: transparent; }
.hero__btn:hover { background: #fff; color: var(--ink); }
.hero__scroll {
  position: absolute; bottom: max(28px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  width: 1px; height: 56px; background: rgba(255,255,255,.5); overflow: hidden;
  z-index: 2;
}
.hero__scroll span {
  position: absolute; top: -56px; left: 0; width: 1px; height: 56px; background: #fff;
  animation: scrollLine 2.2s ease-in-out infinite;
}
@keyframes scrollLine { 0% { top: -56px; } 60%,100% { top: 56px; } }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-block;
  padding: 14px 38px;
  border: 1px solid var(--sage-dark);
  color: #fff;
  background: var(--sage-dark);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .74rem;
  font-family: var(--sans);
  cursor: pointer;
  transition: all .35s ease;
  border-radius: 2px;
}
.btn:hover { background: transparent; color: var(--sage-dark); }
.btn--full { width: 100%; padding: 16px; }

/* ---------- INVITE TEXT ---------- */
.invite .script { font-size: clamp(2.6rem, 8vw, 4rem); color: var(--sage-dark); margin-bottom: 24px; }
.lead { font-size: 1.12rem; color: var(--ink); margin: 0 auto 18px; max-width: 56ch; }

.section__title {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  margin-bottom: 36px;
  position: relative;
  display: inline-block;
}
.section__title::after {
  content: ""; display: block; width: 60px; height: 1px;
  background: var(--sage); margin: 18px auto 0;
}

/* ---------- GALLERY ---------- */
.gallery__hint { color: var(--muted); margin: -18px 0 36px; }
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.gallery__item {
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 4px;
  background: var(--cream-2);
  box-shadow: var(--shadow);
}
.gallery__item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .8s ease;
}
.gallery__item:hover img { transform: scale(1.05); }
.gallery__item--empty { display: none; }

/* ---------- HONEYPOT ---------- */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---------- COUNTDOWN ---------- */
.countdown-section { background: var(--cream-2); }
.countdown { display: flex; justify-content: center; gap: clamp(14px, 5vw, 48px); flex-wrap: wrap; }
.countdown__item { min-width: 70px; }
.countdown__item span {
  display: block; font-family: var(--serif); font-size: clamp(2.2rem, 7vw, 3.6rem);
  font-weight: 500; color: var(--sage-dark); line-height: 1;
}
.countdown__item small {
  text-transform: uppercase; letter-spacing: .2em; font-size: .68rem; color: var(--muted);
}

/* ---------- TIMELINE ---------- */
.timeline { max-width: 620px; margin: 0 auto; text-align: left; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 92px; top: 8px; bottom: 8px; width: 1px; background: var(--line);
}
.timeline__item { display: flex; gap: 28px; padding: 18px 0; position: relative; }
.timeline__time {
  width: 72px; text-align: right; font-family: var(--serif); font-size: 1.3rem;
  color: var(--sage-dark); flex-shrink: 0;
}
.timeline__item::before {
  content: ""; position: absolute; left: 88px; top: 28px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--sage); border: 2px solid var(--cream);
}
.timeline__body { padding-left: 18px; }
.timeline__body h4 { font-size: 1.4rem; margin-bottom: 2px; }
.timeline__body p { margin: 0; color: var(--muted); }

/* ---------- DETAILS ---------- */
.details { background: var(--cream-2); }
.details__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.detail-card {
  background: var(--cream); padding: 40px 26px; border: 1px solid var(--line);
  box-shadow: var(--shadow); border-radius: 4px;
}
.detail-card h4 { font-size: 1.5rem; margin-bottom: 10px; }
.detail-card p { margin: 2px 0; }
.detail-card .link {
  display: inline-block; margin-top: 12px; color: var(--sage-dark);
  text-decoration: none; border-bottom: 1px solid var(--sage); padding-bottom: 2px;
  font-size: .9rem; letter-spacing: .04em;
}
.detail-card .link:hover { color: var(--ink); }

/* ---------- RSVP FORM ---------- */
.rsvp__note { color: var(--muted); margin: -18px 0 36px; }
.form { text-align: left; display: grid; gap: 24px; }
.field { display: grid; gap: 8px; }
.field label, .field__label {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
}
.field input[type="text"],
.field input[type="number"],
.field textarea {
  width: 100%; padding: 13px 16px; border: 1px solid var(--line); background: #fff;
  font-family: var(--sans); font-size: 1rem; color: var(--ink); border-radius: 3px;
  transition: border-color .25s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--sage); }
.field textarea { resize: vertical; }

.choices { display: flex; gap: 14px; flex-wrap: wrap; }
.choice {
  flex: 1 1 200px; display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 3px; background: #fff;
  transition: all .25s; font-size: .98rem;
}
.choice:hover { border-color: var(--sage); }
.choice input { accent-color: var(--sage-dark); }
.choice:has(input:checked) { border-color: var(--sage-dark); background: #f0efe6; }

.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 9px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: .9rem; transition: all .25s;
}
.chip:has(input:checked) span { background: var(--sage-dark); color: #fff; border-color: var(--sage-dark); }

.conditional { display: none; }
.conditional.show { display: grid; animation: fade .4s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.form__status { text-align: center; margin: 0; font-size: .95rem; min-height: 1.2em; }
.form__status.success { color: var(--sage-dark); }
.form__status.error { color: #b4584f; }

/* ---------- FOOTER ---------- */
.footer { background: var(--ink); color: #e9e3d8; text-align: center; padding: 70px 20px; padding-bottom: max(70px, calc(40px + env(safe-area-inset-bottom))); }
.footer__names { font-size: clamp(2.4rem, 8vw, 3.4rem); color: #f3e9df; margin: 0 0 6px; }
.footer__date { letter-spacing: .3em; text-transform: uppercase; font-size: .8rem; margin: 0 0 18px; opacity: .8; }
.footer__credit { color: var(--rose); margin: 0; }

/* ---------- REVEAL ANIMATION ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s ease, transform .9s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* =========================================
   RESPONSIVE (АДАПТАЦІЯ ДЛЯ СМАРТФОНІВ)
   ========================================= */

/* Для планшетів та звичайних смартфонів */
@media (max-width: 768px) {
  /* Зменшуємо загальні відступи для екранів телефонів */
  .section { padding: 60px 0; }
  
  /* Адаптація головного екрану (Hero) */
  .hero__names { font-size: clamp(2.5rem, 10vw, 4rem); }
  .hero__date { font-size: 1rem; }
  .hero::before {
    background-position: 60% center;
    filter: grayscale(1) blur(2px);
    transform: scale(1.1);
    opacity: .74;
  }

  /* Галерея: 1 фото в ряд для зручного вертикального скролу */
  .gallery__grid {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 320px;
    margin: 0 auto;
  }
  
  /* Деталі: 1 колонка замість 3 */
  .details__grid { grid-template-columns: 1fr; gap: 16px; }
  .detail-card { padding: 24px 16px; }

  /* Таймлайн: адаптація для вузьких екранів */
  .timeline::before { left: 64px; }
  .timeline__item::before { left: 60px; }
  .timeline__time { width: 48px; font-size: 1.1rem; text-align: left; }
  .timeline__body { padding-left: 12px; }

  /* Форма RSVP: робимо кнопки зручнішими для пальців */
  .choices { flex-direction: column; gap: 10px; }
  .choice { width: 100%; justify-content: center; padding: 16px; }
  .chips { justify-content: center; }
  
  /* Зменшення заголовків */
  .invite .script { font-size: 2.4rem; }
  .section__title { font-size: 1.8rem; margin-bottom: 24px; }
}

/* Для найменших екранів (наприклад iPhone SE) */
@media (max-width: 480px) {
  .hero__names { font-size: 2.2rem; }
  .hero::before {
    background-position: 62% center;
    filter: grayscale(1) blur(2.4px);
    transform: scale(1.14);
  }
  
  /* Перебудова таймлайну вертикально (прибираємо лінію) */
  .timeline::before { display: none; }
  .timeline__item { flex-direction: column; gap: 4px; padding: 16px 0; text-align: center; }
  .timeline__item::before { display: none; }
  .timeline__time { width: 100%; text-align: center; font-size: 1.3rem; color: var(--sage); }
  .timeline__body { padding-left: 0; }
  
  /* Компактний зворотний відлік */
  .countdown { gap: 16px; }
  .countdown__item span { font-size: 1.8rem; }
}