@font-face {
  font-family: "Playpen Sans";
  src: url("../../assets/developments/playpen-sans-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Playpen Sans";
  src: url("../../assets/developments/playpen-sans-medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

/* Поле контакта растёт после свободных строк; природа остаётся привязана ко дну. */
.contact {
  width: var(--page-block-width);
  margin: var(--section-gap) auto 0;
  container-type: inline-size;
}

.contact__panel {
  --contact-min-height: clamp(520px, calc(15.9722vw + 397.333px), 704px);
  --contact-top: clamp(60px, calc(1.7361vw + 46.667px), 80px);
  --contact-inline: clamp(32px, 4.55cqw, 60px);
  --contact-type-size: clamp(20px, calc(0.69444vw + 14.667px), 28px);
  --nature-reserve: calc(25.45cqw - 26px);

  position: relative;
  min-height: var(--contact-min-height);
  padding: var(--contact-top) var(--contact-inline) calc(var(--nature-reserve) + 30px);
  overflow: hidden;
  border-radius: clamp(26px, 2.73cqw, 36px);
  background: linear-gradient(180deg, #0084d7 0%, #349bce 35.512%, #72abc8 64.794%, #72abc8 100%);
  cursor: text;
  transition: height 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.contact__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.contact__title {
  color: #fff;
  font-size: clamp(30px, calc(1.04167vw + 22px), 42px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: pre-line;
  text-wrap: balance;
  cursor: default;
  transition: opacity 240ms ease, transform 240ms ease;
}

.contact__panel:is(.is-editing, .has-message) .contact__title {
  opacity: 0;
  transform: translateY(-6px);
}

.contact__editor {
  position: relative;
  width: 100%;
  margin-top: 10px;
  font-family: "Playpen Sans", cursive;
  font-size: var(--contact-type-size);
  font-weight: 500;
  line-height: 1.5;
}

.contact__hint {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 0;
  width: 100%;
  color: rgb(255 255 255 / 60%);
  text-align: center;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}

.contact__editor.is-focused .contact__hint,
.contact__editor.is-filled .contact__hint {
  opacity: 0;
  transform: translateY(-4px);
}

.contact__render {
  position: absolute;
  z-index: 1;
  inset: 0 0 auto;
  min-height: 58px;
  padding: 10px 20px;
  color: #fff;
  line-height: inherit;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  pointer-events: none;
}

.contact__measure {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  padding: 10px 20px;
  line-height: inherit;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  opacity: 0;
}

.contact__selection {
  position: absolute;
  inset: 0;
}

.contact__glyph {
  position: absolute;
  display: block;
  white-space: pre;
  line-height: inherit;
  transform-origin: center center;
  opacity: 0;
  animation: contact-glyph-in 220ms ease-out forwards, contact-infinity-opposite 8s linear infinite;
}

.contact__quote {
  position: absolute;
  display: block;
  color: rgb(255 255 255 / 50%);
  white-space: pre;
  line-height: inherit;
  opacity: 0;
  user-select: none;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.contact__quote.is-visible {
  opacity: 1;
}

.contact__selection-piece {
  position: absolute;
  border-radius: 6px;
  background: rgb(255 255 255 / 20%);
}

@keyframes contact-glyph-in {
  to { opacity: 1; }
}

@keyframes contact-infinity {
  0%, 50%, 100% { transform: translate(0, 0) rotate(0); }
  12.5% { transform: translate(1.13px, .8px) rotate(.27deg); }
  25% { transform: translate(1.6px, 0) rotate(.4deg); }
  37.5% { transform: translate(1.13px, -.8px) rotate(.27deg); }
  62.5% { transform: translate(-1.13px, .8px) rotate(-.22deg); }
  75% { transform: translate(-1.6px, 0) rotate(-.3deg); }
  87.5% { transform: translate(-1.13px, -.8px) rotate(-.22deg); }
}

@keyframes contact-infinity-opposite {
  0%, 50%, 100% { transform: translate(0, 0) rotate(0); }
  12.5% { transform: translate(-.678px, -.48px) rotate(-.27deg); }
  25% { transform: translate(-.96px, 0) rotate(-.4deg); }
  37.5% { transform: translate(-.678px, .48px) rotate(-.27deg); }
  62.5% { transform: translate(.678px, -.48px) rotate(.22deg); }
  75% { transform: translate(.96px, 0) rotate(.3deg); }
  87.5% { transform: translate(.678px, -.48px) rotate(.22deg); }
}

.contact__message {
  position: relative;
  display: block;
  width: 100%;
  min-height: 58px;
  padding: 10px 20px;
  overflow: hidden;
  border: 0;
  outline: 0;
  background: transparent;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: transparent;
  font: inherit;
  text-align: center;
  resize: none;
}

.contact__message::selection {
  color: transparent;
  background: transparent;
}

.contact__message::-moz-selection {
  color: transparent;
  background: transparent;
}

.contact__nature {
  position: absolute;
  z-index: 0;
  bottom: -30px;
  left: -1%;
  display: block;
  width: 102%;
  height: auto;
  max-width: none;
  pointer-events: none;
  user-select: none;
  transform-origin: center bottom;
  animation: contact-infinity 8s linear infinite;
}

.contact__action,
.contact__thanks {
  position: relative;
  z-index: 2;
  flex: none;
  max-width: 100%;
  margin-top: 60px;
  padding: 8px 12px;
  color: #fff;
  font-family: "Playpen Sans", cursive;
  font-size: var(--contact-type-size);
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.contact__action {
  opacity: .7;
  transition: opacity 220ms ease;
}

.contact__action[hidden],
.contact__thanks[hidden] {
  display: none;
}

.contact__action:not([hidden]) {
  animation: contact-action-in 300ms ease-out backwards;
}

@keyframes contact-action-in {
  from { opacity: 0; }
  to { opacity: .7; }
}

.contact__action:hover,
.contact__action:focus-visible {
  opacity: 1;
}

.contact__action:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.contact__thanks {
  display: block;
  text-align: center;
  pointer-events: none;
}

/* Попап обратной связи по макету 704 px; высота растёт вместе с сообщением. */
.feedback-dialog {
  --feedback-title-size: clamp(12px, min(calc(3.2086vw + 8.449px), calc(8.5vw - 11px)), 32px);
  --feedback-header-inline: clamp(16px, calc(5.882vw - 3.176px), 40px);
  --feedback-body-inline: clamp(20px, calc(4.813vw + 4.667px), 40px);
  --feedback-close-size: clamp(20px, calc(1.07vw + 16.15px), 24px);
  --feedback-field-gap: clamp(24px, calc(4.278vw + 8.6px), 40px);
  --feedback-label-size: clamp(16px, calc(1.07vw + 12.15px), 20px);
  --feedback-control-height: clamp(54px, calc(2.14vw + 46.3px), 62px);

  width: min(704px, calc(100vw - 30px));
  max-height: calc(100dvh - 30px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 2px solid #e0e0e0;
  border-radius: clamp(16px, calc(1.07vw + 12.15px), 20px);
  background: #fff;
  color: #000;
  box-shadow: 0 24px 80px rgb(0 0 0 / 16%);
}

.feedback-dialog[open] {
  animation: feedback-dialog-in 300ms cubic-bezier(.22, 1, .36, 1) both;
}

.feedback-dialog[open].is-closing {
  animation: feedback-dialog-out 260ms ease-in both;
}

.feedback-dialog::backdrop {
  background: rgb(248 248 248 / 95%);
  background: color-mix(in srgb, var(--surface-3100) 95%, transparent);
  animation: feedback-backdrop-in 300ms ease-out both;
}

.feedback-dialog.is-closing::backdrop {
  animation: feedback-backdrop-out 260ms ease-in both;
}

@keyframes feedback-dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes feedback-dialog-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(8px) scale(.99); }
}

@keyframes feedback-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes feedback-backdrop-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

.feedback-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, calc(2.67vw + .4px), 20px);
  min-height: clamp(72px, calc(5.348vw + 52.75px), 92px);
  padding: clamp(18px, calc(1.604vw + 12.225px), 24px) var(--feedback-header-inline);
  border-bottom: 2px solid #e0e0e0;
}

.feedback-dialog__title {
  min-width: 0;
  font-size: var(--feedback-title-size);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: .04em;
  white-space: nowrap;
}

.feedback-dialog__close {
  position: relative;
  flex: none;
  width: var(--feedback-close-size);
  height: var(--feedback-close-size);
  color: #b0b0b0;
  transition: color 200ms ease;
}

.feedback-dialog__close:hover,
.feedback-dialog__close:focus-visible {
  color: #000;
}

.feedback-dialog__close span,
.feedback-dialog__close span::before {
  position: absolute;
  top: calc(50% - .75px);
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  content: "";
}

.feedback-dialog__close span {
  transform: rotate(45deg);
}

.feedback-dialog__close span::before {
  top: 0;
  transform: rotate(90deg);
}

.feedback-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--feedback-field-gap);
  padding: clamp(26px, calc(2.674vw + 16.375px), 36px) var(--feedback-body-inline)
    clamp(28px, calc(3.209vw + 16.448px), 40px);
}

.feedback-form__field {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, calc(1.604vw + 4.225px), 16px);
  width: 100%;
  min-width: 0;
}

.feedback-form__label {
  color: #888;
  font-size: var(--feedback-label-size);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: .05em;
  transition: opacity 140ms ease, color 180ms ease;
}

.feedback-form__label.is-changing {
  opacity: 0;
}

.feedback-form__control {
  display: block;
  width: 100%;
  min-height: var(--feedback-control-height);
  padding: clamp(12px, calc(.267vw + 11.04px), 13px)
    clamp(16px, calc(2.14vw + 8.3px), 24px);
  border: 2px solid transparent;
  border-radius: 14px;
  outline: 0;
  background: var(--surface-3000);
  color: #282828;
  font-family: inherit;
  font-size: var(--feedback-label-size);
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: .05em;
  transition: background 200ms ease, border-color 200ms ease;
}

.feedback-form__control::placeholder {
  color: #888;
  opacity: 1;
}

.feedback-form__control:focus-visible {
  border-color: var(--mart-b3);
}

.feedback-form__control--message {
  min-height: clamp(108px, calc(115.85px - 1.07vw), 112px);
  max-height: min(40dvh, 360px);
  padding-block: 16px;
  overflow-y: auto;
  resize: none;
  font-family: var(--font-information);
  font-weight: 300;
  transition: height 360ms cubic-bezier(.22, 1, .36, 1), background 200ms ease, border-color 200ms ease;
}

.feedback-form__field.is-invalid .feedback-form__label {
  color: var(--mart-r3);
}

.feedback-form__field.is-invalid .feedback-form__control {
  border-color: var(--mart-r3);
  background: var(--red-50);
}

.feedback-form__submit {
  width: fit-content;
  max-width: 100%;
  min-height: var(--feedback-control-height);
  padding: 10px clamp(22px, calc(2.674vw + 12.375px), 32px);
  border-radius: 100px;
  background: var(--a-blue-300);
  color: #000;
  font-size: clamp(16px, calc(.535vw + 14.075px), 18px);
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .03em;
  transition: background 200ms ease, color 200ms ease;
}

.feedback-form__submit:disabled {
  background: var(--surface-3000);
  color: var(--text-1000);
  cursor: default;
}

.feedback-form__submit:not(:disabled):hover,
.feedback-form__submit:not(:disabled):focus-visible {
  background: var(--mart-b3);
  color: #fff;
}

.feedback-form__submit.is-success,
.feedback-form__submit.is-success:disabled {
  background: var(--green-100);
  color: var(--mart-g3);
}

.feedback-form__notice {
  margin-top: calc(12px - var(--feedback-field-gap));
  color: #888;
  font-size: 15px;
  line-height: 1.4;
}

.feedback-form__notice[hidden] {
  display: none;
}

.feedback-form__submit:focus-visible,
.feedback-dialog__close:focus-visible {
  outline: 2px solid var(--mart-b3);
  outline-offset: 3px;
}

@media (max-width: 767.98px) {
  .contact__panel {
    --contact-min-height: clamp(730px, calc(35cqw + 614.5px), 832px);
    --contact-top: clamp(60px, calc(14.2857cqw + 12.857px), 80px);
    --contact-inline: clamp(22px, 6.8cqw, 32px);
    --contact-type-size: clamp(20px, calc(2.857cqw + 10.571px), 24px);
    --nature-reserve: calc(22.9cqw + 134px);
  }

  .contact__title {
    font-size: clamp(26px, calc(4.2857cqw + 11.857px), 32px);
    line-height: 1.2;
  }

  .contact__nature {
    bottom: -6px;
    left: calc(-2.4cqw - 5.27px);
    width: calc(91.8cqw + 537.54px);
  }

  .contact__action,
  .contact__thanks {
    max-width: calc(100% - 32px);
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact__panel,
  .contact__hint,
  .contact__title,
  .contact__quote,
  .contact__glyph {
    transition: none;
    animation: none;
  }

  .contact__glyph { opacity: 1; }

  .contact__action,
  .feedback-dialog__close,
  .feedback-form__control,
  .feedback-form__submit,
  .feedback-form__label {
    transition: none;
  }

  .contact__action:not([hidden]),
  .feedback-dialog[open],
  .feedback-dialog[open].is-closing,
  .feedback-dialog::backdrop,
  .feedback-dialog.is-closing::backdrop,
  .contact__nature {
    animation: none;
  }
}
