:root {
  --ink: #263d35;
  --muted: #57665b;
  --gold: #986323;
  --line: #dccba7;
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  color: var(--ink);
  font:
    18px/1.65 Arial,
    sans-serif;
  background:
    radial-gradient(ellipse at 5% 5%, #ffe49b 0, transparent 40%),
    radial-gradient(ellipse at 95% 30%, #ffcbbf 0, transparent 40%),
    radial-gradient(ellipse at 10% 75%, #d4edbb 0, transparent 42%), #fff5e4;
}

button,
input {
  font: inherit;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
}
button,
input,
a {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid #a76f28;
  outline-offset: 5px;
}

[hidden] {
  display: none !important;
}

/* Декоративный слой */
#celebration {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

/* Шапка */
header {
  max-width: 1240px;
  margin: auto;
  padding: 24px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font:
    24px Georgia,
    serif;
  text-decoration: none;
}
.brand span {
  color: var(--gold);
}
nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}
nav a {
  text-decoration: none;
  font-size: 15px;
}
nav a:hover {
  color: var(--gold);
}

/* Первый экран */
.hero {
  max-width: 1240px;
  margin: auto;
  padding: 72px 40px 85px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 64px;
}

.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  font-size: 12px;
  font-weight: bold;
}

h1,
h2 {
  font-family: Georgia, serif;
  font-weight: normal;
}

h1 {
  font-size: clamp(48px, 6.8vw, 92px);
  line-height: 1.08;
  margin: 24px 0;
}

h1 em {
  color: var(--gold);
}

h2 {
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.2;
  margin: 18px 0 24px;
}

.intro {
  max-width: 440px;
  color: var(--muted);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 30px 0;
  font-size: 17px;
}

.facts span + span {
  border-left: 1px solid var(--line);
  padding-left: 20px;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 14px 26px;
  border: 0;
  border-radius: 100px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  box-shadow: 0 8px 24px #263d3520;
  transition:
    transform 0.25s,
    background 0.25s,
    box-shadow 0.25s;
}

.primary:hover {
  background: #395b49;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px #263d3530;
}

.primary:active {
  transform: scale(0.97);
}

/* Портрет */
.photo-wrap {
  position: relative;
  padding: 16px;
}

.photo-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid #bc8c42;
  border-radius: 48% 48% 12px 12px;
  transform: rotate(4deg);
}

.photo {
  position: relative;
  height: 500px;
  border-radius: 48% 48% 12px 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  text-align: center;
  background: linear-gradient(145deg, #ffe4aa, #f5c8b8 55%, #d3e2bf);
  box-shadow: 0 24px 60px #98632318;
}

.photo img,
.memory img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.placeholder {
  padding: 24px;
  color: #705e42;
  font:
    italic 24px/1.5 Georgia,
    serif;
}

.portrait-star {
  display: block;
  color: var(--gold);
  font-size: 82px;
  animation: twinkle 4s ease-in-out infinite;
}

.seal {
  position: absolute;
  bottom: 28px;
  left: -12px;
  width: 116px;
  height: 116px;
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff1d8;
  box-shadow: 0 0 0 7px #fff1dc;
}

.seal b {
  font:
    46px/1.2 Georgia,
    serif;
}
.seal span {
  font-size: 11px;
  letter-spacing: 3px;
}

/* Разделы */
.section {
  max-width: 1160px;
  margin: auto;
  padding: 76px 40px;
}
.welcome,
.memories {
  text-align: center;
}
.welcome {
  border-top: 1px solid var(--line);
}
.welcome p {
  max-width: 700px;
  margin: auto;
  color: var(--muted);
}
.star {
  color: var(--gold);
  font-size: 34px;
}

.details {
  background: linear-gradient(120deg, #e1edcdcc, #fff0cacc);
  border-block: 1px solid #d3d9b7;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 70px;
}
.detail-grid p {
  color: var(--muted);
}

.handwritten {
  font:
    italic 24px/1.5 Georgia,
    serif;
  color: var(--gold) !important;
}

.info-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid #cbd2b9;
}

.info-row:first-child {
  padding-top: 0;
}
.num {
  color: var(--gold);
  font:
    26px Georgia,
    serif;
}
.info-row h3 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: normal;
}
.info-row p {
  margin: 0;
  font-size: 16px;
}

/* Галерея */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 36px;
}

.memory {
  height: 280px;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffe6b2, #f1d3b4);
  border-radius: 18px;
  transition:
    transform 0.35s,
    box-shadow 0.35s;
}

.memory:nth-child(2) {
  background: linear-gradient(145deg, #dfedc7, #bdd9ca);
}
.memory:nth-child(3) {
  background: linear-gradient(145deg, #ffdbd0, #f2c1c1);
}

.memory:hover {
  transform: translateY(-6px) rotate(-1deg);
  box-shadow: 0 18px 35px #98632318;
}

/* Анкета */
.rsvp {
  padding-top: 30px;
}

.form-card {
  max-width: 820px;
  margin: auto;
  padding: clamp(24px, 5vw, 48px);
  background: #fffdf6ed;
  border: 1px solid #fff;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px #98632318;
}

.form-heading {
  text-align: center;
}
.form-heading p {
  color: var(--muted);
  font-size: 16px;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 30px;
}

.field {
  display: grid;
  gap: 8px;
}
.field > span {
  font-size: 15px;
  font-weight: bold;
}

.field input {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  padding: 13px 16px;
  border: 1px solid #d8cbb1;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  transition:
    border-color 0.25s,
    box-shadow 0.25s,
    background 0.25s;
}

.field input:focus {
  border-color: #a77737;
  box-shadow: 0 0 0 4px #dfb87025;
  background: #fffdf7;
}

.full {
  grid-column: 1 / -1;
}
.hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

fieldset {
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 28px 0 0;
}

legend {
  font-size: 17px;
  font-weight: bold;
  margin-bottom: 6px;
}
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  opacity: 0;
}

.choice span {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  height: 100%;
  padding: 14px;
  border: 1px solid #dfd4bf;
  border-radius: 14px;
  background: #fffaf0;
  font-size: 15px;
  line-height: 1.4;
  transition:
    background 0.25s,
    border-color 0.25s,
    transform 0.25s,
    box-shadow 0.25s;
}

.choice span::before {
  content: "";
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid #b5a384;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  transition:
    background 0.25s,
    border-color 0.25s;
}

.choice input[type="radio"] + span::before {
  border-radius: 50%;
}

.choice input:checked + span {
  background: #edf3e5;
  border-color: #6b8c68;
  box-shadow: 0 4px 14px #38553712;
  animation: select-pop 0.3s ease;
}

.choice input:checked + span::before {
  content: "✓";
  background: #3b6249;
  border-color: #3b6249;
}

.choice input:focus-visible + span {
  outline: 3px solid #a76f28;
  outline-offset: 3px;
}

.form-bottom {
  margin-top: 30px;
}
.form-bottom .primary {
  width: 100%;
}

.status {
  min-height: 28px;
  margin: 14px 0 0;
  text-align: center;
  font-size: 14px;
  color: #355d40;
}

.status.error {
  color: #a33333;
}
.form-card.success {
  animation: success-glow 0.8s ease;
}

/* Счётчик гостей */
.guest-counter {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 12px;
  padding: 8px;
  border: 1px solid #d8cbb1;
  border-radius: 18px;
  background: #fffaf0;
}

.guest-counter button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  font-size: 28px;
  line-height: 1;
  transition:
    transform 0.2s,
    background 0.2s,
    opacity 0.2s;
}

.guest-counter button:hover:not(:disabled) {
  background: #395b49;
  transform: translateY(-2px);
}

.guest-counter button:active:not(:disabled) {
  transform: scale(0.92);
}
.guest-counter button:disabled {
  opacity: 0.3;
  cursor: default;
}

.guest-counter output {
  min-width: 64px;
  text-align: center;
  font:
    32px/1 Georgia,
    serif;
  color: var(--ink);
}

.guest-counter output.changing {
  animation: counter-pop 0.25s ease;
}



/* Завершение страницы */
.closing {
  text-align: center;
  padding: 64px 24px;
  color: #fff5e0;
  background: linear-gradient(135deg, #294937, #3a6150);
}

.closing .eyebrow {
  color: #f5cf89;
}
.closing h2 {
  margin-bottom: 0;
}
footer {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Появление блоков при прокрутке */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js .reveal.visible {
  opacity: 1;
  transform: none;
}

/* CSS-анимации */
@keyframes twinkle {
  0%,
  100% {
    transform: scale(1) rotate(-8deg);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.12) rotate(8deg);
    opacity: 1;
  }
}

@keyframes select-pop {
  50% {
    transform: scale(1.025);
  }
}

@keyframes success-glow {
  50% {
    box-shadow:
      0 0 0 7px #b8d49d60,
      0 24px 80px #98632318;
  }
}

@keyframes counter-pop {
  50% {
    transform: translateY(-3px) scale(1.15);
    color: var(--gold);
  }
}

/* Планшеты */
@media (max-width: 900px) {
  header {
    padding: 22px 24px;
  }
  nav {
    gap: 14px;
  }
  .hero {
    padding: 50px 24px;
    gap: 32px;
  }
  .photo {
    height: 410px;
  }
  .section {
    padding: 56px 24px;
  }
  .detail-grid {
    gap: 36px;
  }
  .gallery {
    gap: 14px;
  }
  .memory {
    height: 230px;
  }
}

/* Телефоны */
@media (max-width: 680px) {
  body {
    font-size: 17px;
  }
  header {
    flex-wrap: wrap;
    gap: 14px;
  }
  .brand {
    font-size: 22px;
  }
  nav {
    width: 100%;
    gap: 10px 18px;
  }
  nav a {
    font-size: 13px;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 38px;
    padding-top: 36px;
  }
  h1 {
    font-size: clamp(44px, 10vw, 66px);
  }
  .photo-wrap {
    width: 100%;
    max-width: 390px;
    margin: auto;
  }
  .photo {
    height: 400px;
  }
  .seal {
    left: 0;
    width: 100px;
    height: 100px;
  }
  .seal b {
    font-size: 40px;
  }
  .detail-grid,
  .gallery {
    grid-template-columns: 1fr;
  }
  .gallery {
    gap: 20px;
  }
  .memory {
    height: 290px;
  }
  .fields {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .choices {
    grid-template-columns: 1fr;
  }
  .food-choices {
    grid-template-columns: 1fr 1fr;
  }
  .rsvp {
    padding: 24px 16px 48px;
  }
  .form-card {
    padding: 28px 20px;
  }
  .effect-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .effect-buttons button {
    padding: 12px 10px;
  }
  .effect-settings {
    flex-direction: column;
  }
}

@media (max-width: 360px) {
  .hero,
  .section {
    padding-inline: 18px;
  }
  .photo {
    height: 340px;
  }
  .food-choices {
    grid-template-columns: 1fr;
  }
}

/* Учитываем системную настройку уменьшения движения */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
  #celebration {
    display: none;
  }
}

.other-drink-field {
  margin-top: 18px;
}

[hidden] {
  display: none !important;
}