/*--------------------------------------------------------------
# Popup
--------------------------------------------------------------*/

.popup {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    visibility 0.3s ease,
    opacity 0.3s ease;
}

.popup_active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.popup-overlay {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.popup__container {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
}


.popup__container--wide {
  width: min(100%, 820px);
}

.popup__content {
  padding: clamp(32px, 5vw, 56px);
}

.popup__close {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--black-color);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition:
    color var(--transition-duration),
    background-color var(--transition-duration);
}

.popup__close svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

@media (hover: hover) {
  .popup__close:hover {
    color: var(--accent-d-color);
    background-color: var(--accent-xl-color);
  }
}

.popup__title {
  margin: 0 52px 12px 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.15;
}

.popup__text {
  margin: 0 0 30px;
  color: var(--gray-d-color);
  font-size: 18px;
  line-height: 1.45;
}

.popup__note {
  margin: 18px 0 0;
  color: var(--gray-color);
  font-size: 13px;
  line-height: 1.45;
}

.popup__note a {
  color: inherit;
  text-decoration: underline;
}

.popup__message {
  margin-top: 18px;
  padding: 14px 16px;
  background-color: var(--accent-xl-color);
  border-radius: var(--br);
}


/*--------------------------------------------------------------
# Forms
--------------------------------------------------------------*/

.popup .form-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.popup .email_2 {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(100%) !important;
  white-space: nowrap !important;
  border: 0 !important;
  pointer-events: none !important;
}

.popup .form-title {
  display: block;
  margin: 0;
}

.popup .form-title.widget {
  margin: 0 0 4px;
}

.popup .widget-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.popup .form-field {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  color: var(--black-color);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  background-color: var(--white-color);
  border: 1px solid var(--accent-l-color);
  border-radius: var(--br);
  outline: none;
  transition:
    border-color var(--transition-duration),
    box-shadow var(--transition-duration),
    background-color var(--transition-duration);
}

.popup .form-field::placeholder {
  color: var(--gray-color);
  opacity: 1;
}

.popup .form-field:hover {
  border-color: var(--accent-color);
}

.popup .form-field:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgb(119 122 241 / 14%);
}

.popup .form-field:invalid:not(:placeholder-shown) {
  border-color: #d9534f;
}

.popup textarea.form-field {
  min-height: 112px;
  resize: vertical;
}

.popup .form-container .button {
  margin-top: 4px;
}

.popup .form-container .button:disabled {
  opacity: .6;
  cursor: default;
}

.popup .form-container br {
  display: none;
}

.popup .privacy {
  color: var(--gray-color);
  font-size: 13px;
  line-height: 1.45;
}

.popup .privacy a {
  color: inherit;
  text-decoration: underline;
}

.popup .response {
  margin-top: 16px;
  padding: 14px 16px;
  background-color: var(--accent-xl-color);
  border-radius: var(--br);
}

/*--------------------------------------------------------------
# Callback service form
--------------------------------------------------------------*/

.popup .callback-service-form {
  gap: 16px;
}

.popup .callback-service-form > .flex {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.popup .callback-service-form .flex_c {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.popup .callback-service-form .label_np {
  flex-grow: 1;
}

.popup .callback-service-form .button {
  width: 100%;
}

/*--------------------------------------------------------------
# Magnet popup
--------------------------------------------------------------*/

.magnet-popup .popup__container {
  width: min(100%, 620px);
}

.magnet-popup .popup__content {
  text-align: center;
}

.magnet-popup .popup__title {
  margin-right: 52px;
}

.magnet-popup .form-container {
  text-align: left;
}

.magnet-popup .button {
  width: 100%;
}

/*--------------------------------------------------------------
# Blog popup
--------------------------------------------------------------*/

.blog-popup .popup__container {
  width: min(100%, 620px);
}

.blog-popup .widget-title {
  color: var(--accent-d-color);
}

/*--------------------------------------------------------------
# Mobile
--------------------------------------------------------------*/

@media (max-width: 767px) {
  .popup {
    align-items: flex-end;
    padding: 0;
  }

  .popup__container,
  .popup__container--wide {
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: calc(var(--br) * 2) calc(var(--br) * 2) 0 0;
  }

  .popup__content {
    padding: 48px 20px 28px;
  }

  .popup__close {
    top: 10px;
    right: 10px;
  }

  .popup__title {
    margin-right: 40px;
    font-size: 28px;
  }

  .popup__text {
    margin-bottom: 24px;
    font-size: 16px;
  }

  .popup .form-container {
    gap: 12px;
  }

  .popup .form-field {
    min-height: 54px;
    padding: 13px 16px;
  }

  .popup textarea.form-field {
    min-height: 100px;
  }

  .popup .callback-service-form > .flex {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .popup .callback-service-form .flex_c {
    gap: 12px;
  }
}

.popup .response {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: var(--br);
}

.popup .response:empty {
  display: none;
}

.popup .response p {
  margin: 0;
}

.popup .response--success {
  background-color: var(--accent-xl-color);
}

.popup .response--error {
  color: var(--black-color);
  background-color: #fff0f0;
  border: 1px solid #e8a5a5;
}

.popup .form-container--loading {
  pointer-events: none;
}

.popup .form-container--loading .button {
  opacity: .6;
}

.popup__links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}

.popup__links a {
  color: var(--accent-color);
  font-weight: 600;

}