:root {
  --wine: #8f5966;
  --wine-strong: #74414e;
  --wine-soft: #b98591;
  --rose-bg: #fbf3f5;
  --rose-card: #fff9fa;
  --ink: #352c2f;
  --muted: #756a6e;
  --line: #eadde1;
  --white: #ffffff;
  --shadow: 0 24px 60px rgba(112, 65, 76, 0.11);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 10%, rgba(185, 133, 145, 0.12), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #fffdfd 42%, #fbf3f5 100%);
  font-family: "Manrope", Arial, sans-serif;
}

button, input, textarea { font: inherit; }

a { color: inherit; }

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(143, 89, 102, 0.10);
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(16px);
}

.topbar__inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  text-decoration: none;
  color: var(--wine-strong);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 34px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topbar__link {
  text-decoration: none;
  color: var(--wine-strong);
  font-size: 14px;
  font-weight: 700;
}

.hero {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  align-items: center;
  gap: 70px;
  padding-block: 70px 50px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--wine-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1,
.letter-intro h1 {
  margin: 0;
  max-width: 800px;
  color: var(--wine-strong);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.025em;
}

.hero h1 { font-size: clamp(56px, 7vw, 92px); }

.hero p {
  max-width: 640px;
  margin: 28px 0 34px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.button:hover { transform: translateY(-2px); }

.button--primary {
  color: white;
  background: linear-gradient(135deg, var(--wine), var(--wine-strong));
  box-shadow: 0 14px 28px rgba(116, 65, 78, 0.24);
}

.button--primary:hover { box-shadow: 0 18px 34px rgba(116, 65, 78, 0.30); }

.hero__art {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
}

.hero__art-halo {
  position: absolute;
  width: 430px;
  height: 430px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(185,133,145,.22), rgba(185,133,145,.07) 55%, transparent 70%);
}

.hero__art img {
  position: relative;
  width: min(430px, 90%);
  max-height: 560px;
  object-fit: contain;
  border-radius: 48% 48% 44% 44% / 24% 24% 26% 26%;
  box-shadow: var(--shadow);
}

.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding-bottom: 70px;
}

.how__card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,255,.72);
}

.how__card > span {
  color: var(--wine-soft);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 28px;
}

.how__card h2 { margin: 15px 0 10px; font-size: 20px; }
.how__card p { margin: 0; color: var(--muted); line-height: 1.65; }

.footer {
  padding: 26px 0 34px;
  color: var(--wine-soft);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 18px;
  text-align: center;
}

.letter-page { padding: 64px 0 90px; }

.letter-intro { margin-bottom: 34px; }
.letter-intro h1 { font-size: clamp(48px, 6vw, 76px); }
.letter-intro p { margin: 20px 0 0; color: var(--muted); font-size: 17px; }

.letter-form { display: grid; gap: 20px; }

.form-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 12px 36px rgba(116,65,78,.06);
}

.form-card__heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.step-number {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--wine-strong);
  background: var(--rose-bg);
  font-size: 13px;
  font-weight: 800;
}

.form-card__heading h2 { margin: 0 0 5px; font-size: 22px; }
.form-card__heading p { margin: 0; color: var(--muted); }

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: var(--rose-bg);
}

.segmented__option { position: relative; }
.segmented__option input { position: absolute; opacity: 0; pointer-events: none; }
.segmented__option span {
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 0 18px;
  border-radius: 14px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
  transition: .18s ease;
}
.segmented__option input:checked + span {
  color: var(--wine-strong);
  background: #fff;
  box-shadow: 0 6px 18px rgba(116,65,78,.10);
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.field { margin-top: 20px; }
.field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border .18s ease, box-shadow .18s ease;
}
.field input { height: 52px; padding: 0 16px; }
.field textarea { padding: 16px; resize: vertical; line-height: 1.65; }
.field input:focus,
.field textarea:focus {
  border-color: var(--wine-soft);
  box-shadow: 0 0 0 4px rgba(185,133,145,.12);
}
.field--hidden { display: none; }
.field__meta { margin-top: 7px; color: var(--muted); font-size: 12px; text-align: right; }

.design-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.design-option { position: relative; cursor: pointer; }
.design-option input { position: absolute; opacity: 0; pointer-events: none; }
.design-option__preview {
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 2px solid transparent;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: .18s ease;
}
.design-option__preview img { width: 100%; height: 160px; object-fit: contain; display: block; }
.design-option input:checked + .design-option__preview {
  border-color: var(--wine-soft);
  box-shadow: 0 12px 26px rgba(116,65,78,.10);
  transform: translateY(-2px);
}
.design-option__name { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot--green { background: #87ba73; }
.dot--red { background: #a65d68; }
.dot--blue { background: #6d98a7; }

.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 8px;
}

.privacy-note { max-width: 640px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.button--submit { min-width: 220px; }
.button:disabled { opacity: .65; cursor: wait; transform: none; }
.form-error { min-height: 24px; margin: 0; color: #a33c52; font-size: 14px; font-weight: 700; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  background: rgba(66, 39, 46, .34);
  backdrop-filter: blur(10px);
  transition: opacity .2s ease, visibility .2s ease;
}
.modal.is-open { opacity: 1; visibility: visible; }
.modal__panel {
  position: relative;
  z-index: 2;
  width: min(500px, 100%);
  padding: 52px 34px 40px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 30px;
  text-align: center;
  background: rgba(255,255,255,.96);
  box-shadow: 0 30px 80px rgba(70,38,46,.24);
}
.modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--wine-strong);
  background: var(--rose-bg);
  font-size: 26px;
  line-height: 1;
}
.modal__panel h2 {
  margin: 16px 0 8px;
  color: var(--wine-strong);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 40px;
  font-weight: 600;
}
.modal__panel p { margin: 0; color: var(--muted); line-height: 1.6; }
.beating-heart {
  color: #a65d68;
  font-size: 106px;
  line-height: 1;
  filter: drop-shadow(0 12px 22px rgba(166,93,104,.28));
  animation: heartbeat 1s infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.14); }
  28% { transform: scale(1); }
  42% { transform: scale(1.11); }
  70% { transform: scale(1); }
}

.heart-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti-heart {
  position: absolute;
  top: -30px;
  color: #b96e7f;
  font-size: 22px;
  opacity: .9;
  animation: heartFall linear forwards;
}
@keyframes heartFall {
  0% { transform: translate3d(0,-10vh,0) rotate(0deg) scale(.8); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate3d(var(--drift),110vh,0) rotate(520deg) scale(1.2); opacity: 0; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 54px; }
  .hero__art { min-height: 420px; }
  .how { grid-template-columns: 1fr; }
  .design-grid { grid-template-columns: 1fr; }
  .design-option__preview { min-height: 160px; }
}

@media (max-width: 640px) {
  .page-shell { width: min(100% - 24px, 1180px); }
  .topbar__inner { min-height: 68px; }
  .brand { font-size: 29px; }
  .topbar__link { font-size: 13px; }
  .hero h1 { font-size: 50px; }
  .hero__art { min-height: 330px; }
  .hero__art img { width: min(330px, 90%); }
  .hero__art-halo { width: 320px; height: 320px; }
  .letter-page { padding-top: 44px; }
  .letter-intro h1 { font-size: 46px; }
  .form-card { padding: 20px; }
  .segmented { width: 100%; grid-template-columns: 1fr 1fr; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .button--submit { width: 100%; }
  /* =====================================================
   LETTER PAGE V3
   Compact controls + live preview
===================================================== */

.letter-form {
  max-width: 980px;
  margin-inline: auto;
}


/* LIVE PREVIEW */

.live-preview-section {
  margin-bottom: 8px;
}

.preview-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.preview-title > span {
  color: var(--wine-strong);
  font-size: 16px;
  font-weight: 800;
}

.preview-title small {
  color: var(--muted);
  font-size: 12px;
}


/* Letter */

.letter-preview {
  position: relative;

  width: min(680px, 100%);
  aspect-ratio: 1.45 / 1;

  margin-inline: auto;

  overflow: hidden;

  border-radius: 24px;

  background: #fff;

  box-shadow:
    0 20px 55px
    rgba(116, 65, 78, .13);
}


.letter-preview__frame {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: fill;

  pointer-events: none;
}


.letter-preview__content {
  position: absolute;

  z-index: 2;

  inset:
    15% 14% 14%;

  display: flex;

  flex-direction: column;

  color: #44373b;
}


.preview-recipient {
  flex: 0 0 auto;

  font-size:
    clamp(11px, 2vw, 15px);

  line-height: 1.4;
}


.preview-message {
  flex: 1;

  display: flex;

  align-items: center;

  justify-content: center;

  padding:
    12px 4px;

  overflow: hidden;

  text-align: center;

  white-space: pre-wrap;

  overflow-wrap: anywhere;

  color: #47383d;

  font-family:
    "Cormorant Garamond",
    Georgia,
    serif;

  font-size:
    clamp(18px, 3.2vw, 30px);

  line-height: 1.25;
}


.preview-sender {
  flex: 0 0 auto;

  text-align: right;

  font-size:
    clamp(11px, 2vw, 15px);
}


/* Compact card */

.compact-card {
  padding: 22px;
}


.compact-settings {
  display: flex;

  align-items: flex-end;

  flex-wrap: wrap;

  gap: 18px 28px;
}


.compact-setting {
  display: flex;

  flex-direction: column;

  gap: 7px;
}


.compact-label {
  color: var(--muted);

  font-size: 12px;

  font-weight: 800;
}


.segmented--compact {
  width: auto;

  grid-template-columns:
    repeat(2, auto);

  padding: 4px;

  border-radius: 14px;
}


.segmented--compact
.segmented__option span {

  min-height: 38px;

  padding:
    0 16px;

  border-radius: 11px;

  font-size: 13px;
}


/* Recipient fields */

.recipient-fields {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr) 180px;

  gap: 14px;

  margin-top: 16px;
}


.recipient-fields .field {
  margin-top: 0;
}


#sender-name-wrap {
  max-width: 420px;

  margin-top: 16px;
}


/* Section title */

.compact-section-title {
  margin-bottom: 16px;
}


.compact-section-title h2 {
  margin: 0;

  color: var(--wine-strong);

  font-size: 18px;
}


/* Message */

.message-field {
  margin-top: 0;
}


/* Designs slightly smaller */

.compact-card .design-option__preview {
  min-height: 150px;
}


.compact-card
.design-option__preview img {

  height: 125px;
}


/* =====================================================
   LETTER PAGE V4
   Compact mobile-first form
===================================================== */

.letter-form {
  max-width: 980px;
  margin-inline: auto;
}


/* CARD */

.form-card.compact-card {
  padding: 22px;
}


/* TOP SETTINGS */

.compact-settings {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px 30px;
}


.compact-setting {
  display: flex;
  flex-direction: column;
  gap: 7px;
}


.compact-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}


/* SMALL SWITCHES */

.segmented--compact {
  width: auto;

  grid-template-columns:
    repeat(2, auto);

  padding: 4px;

  border-radius: 14px;
}


.segmented--compact
.segmented__option span {

  min-height: 38px;

  padding: 0 17px;

  border-radius: 11px;

  font-size: 13px;
}


/* RECIPIENT */

.recipient-fields {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr) 170px;

  gap: 14px;

  margin-top: 18px;
}


.recipient-fields .field {
  margin-top: 0;
}


#sender-name-wrap {
  width: min(420px, 100%);
  margin-top: 18px;
}


/* TITLES */

.compact-section-title {
  margin-bottom: 16px;
}


.compact-section-title h2 {
  margin: 0;

  color: var(--wine-strong);

  font-size: 18px;
}


/* MESSAGE */

.message-field {
  margin-top: 0;
}


.message-field textarea {
  min-height: 190px;
}


/* DESIGN */

.compact-card
.design-option__preview {

  min-height: 150px;
}


.compact-card
.design-option__preview img {

  height: 125px;
}


/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 640px) {

  .letter-page {
    padding-top: 28px;
    padding-bottom: 50px;
  }


  .letter-intro {
    margin-bottom: 22px;
  }


  .letter-intro .eyebrow {
    margin-bottom: 8px;
  }


  .letter-intro h1 {
    font-size: 39px;
    line-height: 1;
  }


  .letter-intro p {
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.5;
  }


  .letter-form {
    gap: 12px;
  }


  .form-card.compact-card {
    padding: 16px;

    border-radius: 19px;
  }


  /* От кого + кому стоят рядом */

  .compact-settings {
    display: grid;

    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr);

    gap: 10px;
  }


  .compact-setting {
    min-width: 0;
  }


  .segmented--compact {
    width: 100%;

    grid-template-columns:
      minmax(0, 1fr)
      minmax(0, 1fr);

    padding: 3px;
  }


  .segmented--compact
  .segmented__option span {

    min-height: 35px;

    padding: 0 4px;

    font-size: 10px;

    white-space: nowrap;
  }


  /* Имя + класс тоже в одной строке */

  .recipient-fields {
    grid-template-columns:
      minmax(0, 1fr) 90px;

    gap: 8px;

    margin-top: 14px;
  }


  #sender-name-wrap {
    margin-top: 14px;
  }


  .field label {
    margin-bottom: 6px;

    font-size: 11px;
  }


  .field input {
    height: 45px;

    padding: 0 11px;

    border-radius: 12px;

    font-size: 13px;
  }


  /* ТРИ ДИЗАЙНА В ОДНУ СТРОКУ */

  .compact-card .design-grid {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));

    gap: 7px;
  }


  .compact-card
  .design-option__preview {

    min-height: 88px;

    padding: 4px;

    border-radius: 12px;
  }


  .compact-card
  .design-option__preview img {

    height: 78px;
  }


  .design-option__name {
    gap: 4px;

    margin-top: 6px;

    font-size: 9px;

    line-height: 1.2;
  }


  .dot {
    width: 7px;
    height: 7px;

    flex: 0 0 auto;
  }


  .compact-section-title {
    margin-bottom: 10px;
  }


  .compact-section-title h2 {
    font-size: 16px;
  }


  .message-field textarea {
    min-height: 160px;

    padding: 13px;

    border-radius: 13px;

    font-size: 14px;
  }


  .submit-row {
    gap: 10px;
  }


  .privacy-note {
    font-size: 10px;
  }


  .button--submit {
    min-height: 50px;
  }

}
}
