/* ————— Total Black ————— */
:root {
  --bg: #050505;
  --bg-soft: #0c0c0c;
  --ink: #ece7df;
  --ink-dim: #9d978d;
  --line: rgba(236, 231, 223, 0.16);
  --serif: "Cormorant", Georgia, serif;
  --sans: "Manrope", "Segoe UI", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ————— общие ————— */
.section {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(72px, 12vw, 140px) 24px;
  text-align: center;
}

.label {
  font-size: 11px;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 28px;
}

.amp {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  opacity: 0.55;
  margin: 0 0.08em;
}

.muted { color: var(--ink-dim); font-size: 0.85em; }

.br-wide { display: none; }
@media (min-width: 640px) { .br-wide { display: inline; } }

/* появление при скролле */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.reveal.on { opacity: 1; transform: none; }

/* ————— hero ————— */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end; /* имена и дата — в нижней трети, не перекрывают лица */
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: var(--bg);
  overflow: hidden;
}
.hero-inner { padding-bottom: clamp(88px, 16vh, 170px); }
/* фото — отдельным слоем, чтобы применить ч/б-фильтр */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-img) center top / cover no-repeat;
  filter: grayscale(1) contrast(1.06);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.hero.has-photo::before { opacity: 1; }
/* затемнение поверх фото, под текстом */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5,5,5,0.62) 0%, rgba(5,5,5,0.44) 45%, var(--bg) 100%);
}
.hero-inner, .hero-scroll { position: relative; z-index: 1; }
.hero-names .amp { opacity: 0.85; }

/* ————— секции с фото-обложкой ————— */
.section-cover {
  position: relative;
  overflow: hidden;
  max-width: none;
}
.section-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--sec-img) center / cover no-repeat;
  filter: grayscale(1) contrast(1.05);
}
.section-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--bg) 0%, rgba(5,5,5,0.82) 18%, rgba(5,5,5,0.82) 82%, var(--bg) 100%);
}
.section-cover > * { position: relative; z-index: 1; }

.hero-top {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.6em;
  color: #fff;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.8);
  margin-bottom: clamp(20px, 4vh, 40px);
}

.hero-names {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(46px, 10vw, 110px);
  line-height: 1.08;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.75);
}

/* десктоп: вертикальное фото на обложке — целиком по высоте, бока уходят в чёрный */
@media (min-width: 641px) {
  .hero.cover-portrait::before {
    background-size: auto 100%;
    background-position: center 20%;
  }
  .hero.cover-portrait::after {
    background:
      linear-gradient(90deg, var(--bg) 10%, rgba(5, 5, 5, 0) 36%, rgba(5, 5, 5, 0) 64%, var(--bg) 90%),
      linear-gradient(180deg, rgba(5, 5, 5, 0.5) 0%, rgba(5, 5, 5, 0.28) 45%, var(--bg) 100%);
  }
}

/* ультраширокие экраны (21:9 и шире): фото целиком по высоте, бока в чёрный */
@media (min-width: 641px) and (min-aspect-ratio: 2/1) {
  .hero.cover-landscape::before {
    background-size: auto 100%;
    background-position: center top;
  }
  .hero.cover-landscape::after {
    background:
      linear-gradient(90deg, var(--bg) 6%, rgba(5, 5, 5, 0) 30%, rgba(5, 5, 5, 0) 70%, var(--bg) 94%),
      linear-gradient(180deg, rgba(5, 5, 5, 0.5) 0%, rgba(5, 5, 5, 0.28) 45%, var(--bg) 100%);
  }
}

/* мобайл: горизонтальное фото — верхняя «шапка», контент под ней, без гигантского зума */
@media (max-width: 640px) {
  .hero.cover-landscape::before {
    inset: 0 0 auto 0;
    height: 46svh;
    background-size: cover;
    background-position: center 30%;
  }
  .hero.cover-landscape::after {
    background: linear-gradient(
      180deg,
      rgba(5, 5, 5, 0.4) 0%,
      rgba(5, 5, 5, 0.1) 24svh,
      rgba(5, 5, 5, 0.55) 38svh,
      var(--bg) 47svh
    );
  }
  .hero.cover-landscape {
    align-items: center;
    padding-top: 46svh;
  }
  .hero.cover-landscape .hero-inner { padding-bottom: 70px; }

  .section-cover.cover-landscape::before {
    inset: 0 0 auto 0;
    height: 62vw;
    background-size: cover;
    background-position: center 30%;
  }
  .section-cover.cover-landscape::after {
    background: linear-gradient(
      180deg,
      var(--bg) 0%,
      rgba(5, 5, 5, 0.35) 18vw,
      rgba(5, 5, 5, 0.45) 44vw,
      var(--bg) 62vw
    );
  }
  .section-cover.cover-landscape { padding-top: calc(62vw + 48px); }
}

.hero-scroll {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  cursor: pointer;
}
.hero-scroll small {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.42em;
  padding-left: 0.42em; /* компенсация трекинга для центровки */
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
  animation: hsGlow 2.4s ease-in-out infinite;
}
.hs-line {
  display: block;
  width: 1px;
  height: 48px;
  background: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.15));
  animation: drop 2.4s ease-in-out infinite;
}
.hs-chev {
  display: block;
  width: 9px;
  height: 9px;
  margin-top: -14px;
  border-right: 1.5px solid rgba(255, 255, 255, 0.9);
  border-bottom: 1.5px solid rgba(255, 255, 255, 0.9);
  transform: rotate(45deg);
  animation: chevPulse 2.4s ease-in-out infinite;
}
@keyframes drop {
  0% { transform: scaleY(0); transform-origin: top; }
  45% { transform: scaleY(1); transform-origin: top; }
  58% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}
@keyframes chevPulse {
  0%, 30% { opacity: 0; transform: rotate(45deg) translate(0, 0); }
  48% { opacity: 1; }
  62% { opacity: 1; transform: rotate(45deg) translate(3px, 3px); }
  100% { opacity: 0; transform: rotate(45deg) translate(6px, 6px); }
}
@keyframes hsGlow {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 1; }
}

/* ————— приглашение ————— */
.invite-text {
  font-family: var(--serif);
  font-size: clamp(21px, 3.4vw, 30px);
  font-weight: 300;
  line-height: 1.6;
}

/* ————— детали ————— */
.details {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(28px, 6vw, 64px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.detail { flex: 1; max-width: 300px; }
.detail-divider { width: 1px; background: var(--line); }
.detail-big {
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 400;
  line-height: 1.2;
}
.detail-small {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.detail-addr {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.map-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 10.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: color 0.3s, border-color 0.3s;
}
.map-link:hover { color: #fff; border-color: #fff; }
@media (max-width: 560px) {
  .details { flex-direction: column; gap: 40px; }
  .detail { max-width: none; }
  .detail-divider { width: 60px; height: 1px; margin: 0 auto; }
}

/* ————— счётчик ————— */
.countdown {
  display: flex;
  justify-content: center;
  gap: clamp(20px, 6vw, 56px);
}
.cd span {
  font-family: var(--serif);
  font-size: clamp(34px, 6vw, 58px);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  display: block;
}
.cd small {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* ————— счётчик + дресс-код (один блок) ————— */
.dresscode { background: var(--bg-soft); max-width: none; }
.dc-sep {
  width: 64px;
  height: 1px;
  background: var(--line);
  margin: clamp(56px, 9vw, 96px) auto;
}
.dc-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(44px, 9vw, 92px);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.05;
}
.dc-italic { font-style: italic; text-transform: none; }
.dc-text { margin-top: 26px; color: var(--ink-dim); font-size: 15px; }
.dc-swatches {
  margin-top: 36px;
  display: flex;
  justify-content: center;
  gap: 14px;
}
.dc-swatches span {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: inline-block;
}

/* ————— галерея ————— */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.gallery-grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.05);
  transition: transform 0.4s;
}
.gallery-grid img:hover { transform: scale(1.015); }
.gallery-grid img:only-child { max-width: 440px; justify-self: center; }

/* ————— RSVP ————— */
.rsvp-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.3;
  margin-bottom: 48px;
}

#rsvp-form {
  max-width: 520px;
  margin: 0 auto;
  text-align: left;
}

.field { margin-bottom: 34px; }

.field > label, .field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 14px;
}

input[type="text"], textarea {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  padding: 10px 2px;
  outline: none;
  transition: border-color 0.3s;
  resize: vertical;
}
input[type="text"]:focus, textarea:focus { border-color: var(--ink); }
::placeholder { color: rgba(236, 231, 223, 0.28); }

.radios, .checks { display: flex; flex-direction: column; gap: 2px; }

/* плавное раскрытие блоков (grid-rows 0fr -> 1fr) */
.collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 0.45s ease, opacity 0.45s ease, visibility 0.45s;
}
.collapse.open {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
}
.collapse-inner { overflow: hidden; min-height: 0; }

#drinks-field { margin-bottom: 0; transition: grid-template-rows 0.45s ease, opacity 0.45s ease, visibility 0.45s, margin-bottom 0.45s ease; }
#drinks-field.open { margin-bottom: 34px; }

.sub-opts {
  margin-left: 34px;
  border-left: 1px solid var(--line);
  padding-left: 18px;
}
.opt.sub {
  font-size: 14.5px;
  padding: 9px 4px;
  color: var(--ink-dim);
}
.opt.sub input { width: 15px; height: 15px; }
.opt.sub input::before { width: 7px; height: 7px; }

.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  cursor: pointer;
  border-bottom: 1px solid rgba(236, 231, 223, 0.06);
  font-size: 16px;
  transition: color 0.25s;
}
.opt:hover { color: #fff; }

.opt input {
  appearance: none;
  width: 18px; height: 18px;
  border: 1px solid var(--ink-dim);
  flex: none;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: border-color 0.25s;
}
.opt input[type="radio"] { border-radius: 50%; }
.opt input::before {
  content: "";
  width: 8px; height: 8px;
  background: var(--ink);
  transform: scale(0);
  transition: transform 0.2s;
}
.opt input[type="radio"]::before { border-radius: 50%; }
.opt input:checked { border-color: var(--ink); }
.opt input:checked::before { transform: scale(1); }

.submit {
  width: 100%;
  margin-top: 10px;
  padding: 18px;
  background: var(--ink);
  color: #000;
  border: 1px solid var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
}
.submit:hover { background: transparent; color: var(--ink); }
.submit:disabled { opacity: 0.5; cursor: wait; }

.form-error { margin-top: 16px; color: #c96b6b; font-size: 14px; text-align: center; }

/* уход формы после отправки */
#rsvp-form {
  transition: opacity 0.45s ease, transform 0.45s ease;
}
#rsvp-form.gone { opacity: 0; transform: translateY(-14px); }

/* смена заголовка */
.swap { animation: fadeUp 0.8s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

/* экран «спасибо»: сердце рисуется штрихом, потом бьётся */
.rsvp-done { padding: 40px 0; }

.heart-draw {
  width: 86px;
  height: auto;
  display: block;
  margin: 0 auto;
  overflow: visible;
  animation: heartBeat 2s ease-in-out 2.4s infinite;
}
.heart-draw path {
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 360;
  stroke-dashoffset: 360;
  animation: heartLine 1.8s ease 0.15s forwards;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.35));
}
@keyframes heartLine {
  to { stroke-dashoffset: 0; }
}
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.09); }
  24% { transform: scale(1); }
  36% { transform: scale(1.06); }
  48% { transform: scale(1); }
}

.done-title {
  font-family: var(--serif);
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 300;
  color: #fff;
  margin-top: 28px;
  animation: fadeUp 0.8s ease 1s both;
}
.done-text {
  color: var(--ink-dim);
  margin-top: 14px;
  font-size: 16px;
  animation: fadeUp 0.8s ease 1.4s both;
}

/* ————— музыка ————— */
.music-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.55);
  backdrop-filter: blur(6px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, background 0.3s;
}
.music-toggle:hover { border-color: rgba(255, 255, 255, 0.6); }

.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
}
.bars span {
  width: 2px;
  height: 5px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 1px;
  transform-origin: bottom;
  transition: height 0.3s;
}
.music-toggle.playing .bars span { animation: eq 1s ease-in-out infinite; }
.music-toggle.playing .bars span:nth-child(1) { height: 9px; animation-delay: 0s; }
.music-toggle.playing .bars span:nth-child(2) { height: 15px; animation-delay: 0.25s; }
.music-toggle.playing .bars span:nth-child(3) { height: 7px; animation-delay: 0.5s; }
@keyframes eq {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.15); }
}

/* ————— футер ————— */
.footer {
  border-top: 1px solid var(--line);
  padding: 60px 24px 70px;
  text-align: center;
}
.footer-names {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.25em;
  color: #fff;
}
.footer-names .amp { opacity: 0.85; }
.footer-date {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.5em;
  color: #fff;
}
