/* Thank you modal (CF7 success) — Figma TY modal */

#thankYouModalV2.ty-modal-root.modal {
  --ty-bg: #212121;
  --ty-accent: #fcba1d;
  --ty-text: #ffffff;
}

#thankYouModalV2.ty-modal-root .modal-dialog {
  margin: 0.5rem auto;
}

#thankYouModalV2.ty-modal-root .modal-content {
  /* visible: обернуті SVG не обрізаються по кутах модалки */
  overflow: visible;
}

.ty-modal {
  --ty-modal-px: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--ty-bg);
  color: var(--ty-text);
  border-radius: 20px;
  text-align: center;
  font-family: "Mabry Pro", sans-serif;
  padding: 48px var(--ty-modal-px) 24px;
  min-height: 100%;
  box-sizing: border-box;
}

.ty-modal__intro {
  order: 1;
  width: 100%;
}

.ty-modal__visual--qr {
  order: 2;
}

.ty-modal__visual--phone {
  order: 4;
}

@media (min-width: 500px) {
  .ty-modal {
    --ty-modal-px: 24px;
    min-height: 543px;
    padding-top: 57px;
    padding-bottom: 20px;
    max-height: 545px;
    overflow: hidden;
  }
}

@media (min-width: 1441px) {
  .ty-modal {
    --ty-modal-px: 32px;
    min-height: 633px;
    padding-top: 67px;
    padding-bottom: 32px;
  }
}

.ty-modal__close {
  position: absolute;
  top: -1px;
  right: 1px;
  margin: 0 !important;
  z-index: 5;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s;
  rotate: 45deg;
}

.ty-modal__close:hover,
.ty-modal__close:focus {
  opacity: 0.75;
}

.ty-modal__close img {
  display: block;
  width: 22px;
  height: 22px;
}

.ty-modal__title {
  margin: 0 auto 12px;
  max-width: 420px;
  font-weight: 500;
  font-size: 28px;
  line-height: 1;
  text-transform: uppercase;
  color: var(--ty-accent);
}

.ty-modal__title-line {
  display: block;
}

@media (min-width: 1441px) {
  .ty-modal__title {
    font-size: 35px;
    margin-bottom: 10px;
  }
}

.ty-modal__subtitle {
  margin: 0 auto 32px;
  max-width: 420px;
  font-weight: 300;
  font-size: 14px;
  line-height: 16px;
  color: var(--ty-text);
}

@media (min-width: 500px) {
  .ty-modal__subtitle {
    font-size: 16px;
    margin-bottom: 55px;
  }
}

@media (min-width: 1441px) {
  .ty-modal__subtitle {
    font-size: 18px;
    margin-bottom: 53px;
  }
}

.ty-modal__insta-title {
  margin: 0 auto 12px;
  max-width: 402px;
  font-weight: 500;
  font-size: 18px;
  line-height: 22px;
  text-transform: uppercase;
  color: var(--ty-text);
}

@media (min-width: 500px) {
  .ty-modal__insta-title {
    font-size: 20px;
    line-height: 22px;
  }
}

@media (min-width: 1441px) {
  .ty-modal__insta-title {
    font-size: 25px;
    line-height: 27px;
    max-width: 480px;
    margin-bottom: 10px;
  }
}

.ty-modal__insta-text {
  margin: 0 auto 20px;
  max-width: 313px;
  font-weight: 300;
  font-size: 12px;
  line-height: 14px;
  color: var(--ty-text);
}

@media (min-width: 500px) {
  .ty-modal__insta-text {
    max-width: 400px;
    font-size: 14px;
    line-height: 16px;
    margin-bottom: 20px;
  }
}

@media (min-width: 1441px) {
  .ty-modal__insta-text {
    max-width: 481px;
    font-size: 18px;
    line-height: 20px;
    margin-bottom: 28px;
  }
}

/* Bottom visual: phone (<1441) vs QR (desktop wide) */
.ty-modal__visual {
  position: relative;
  margin: 0 auto;
  width: 100%;
  max-width: 548px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ty-modal__visual--qr {
  display: none;
}

.ty-modal__visual--phone {
  margin-top: 8px;
}

@media (min-width: 1200px) {
  .ty-modal__visual--phone {
    display: none;
  }

  .ty-modal__visual--qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0;
    margin-bottom: 20px;
  }
}

/* waves.svg — на всю ширину панелі модалки (вихід за внутрішні відступи) */
.ty-modal__waves-stack {
  position: absolute;
  flex-shrink: 0;
  top: -250px;
  overflow: visible;
  pointer-events: none;
  width: calc(100% + 2 * var(--ty-modal-px));
  max-width: none;
  margin-left: calc(-1 * var(--ty-modal-px));
  margin-right: calc(-1 * var(--ty-modal-px));
}

@media (max-width: 1200px) {
  .ty-modal__waves-stack {
    top: -266px;
  }
}

@media (max-width: 1440px) {
  .ty-modal__waves-stack {
    top: -205px;
  }
}

.ty-modal__waves-img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: top;
}

.ty-modal__phone {
  display: block;
  width: 235px;
  max-width: 72%;
  height: auto;
  margin: -160px auto 0;
  position: absolute;
  top: 100px;
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 499.98px) {
  .ty-modal__phone {
    width: 235px;
    max-width: 80%;
    margin-top: -152px;
    /* Плавне згасання нижньої частини мокапу на мобайлі */
    -webkit-mask-image: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 1) 0%,
      rgba(0, 0, 0, 1) 41%,
      rgba(0, 0, 0, 0) 68%
    );
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 41%, rgba(0, 0, 0, 0) 68%);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
  }

  .ty-modal__waves-stack {
    top: -150px;
  }
}


@media (max-width: 499.98px) and (max-height: 700px) {
  .ty-modal__phone {
    mask-image: none;
    -webkit-mask-image: none;
  }
}

@media (max-width: 499.98px) and (min-height: 701px) {
  #thankYouModalV2.ty-modal-root .ty-modal {
    padding-top: 113px !important;
    background-color: var(--ty-bg);
    background-image: url("./images/thank-you/Mask_group-1.svg"), url("./images/thank-you/Mask_group.svg");
    background-repeat: no-repeat, no-repeat;
    background-position: top center, bottom center;
    background-size: 100% auto, 100% auto;
  }

  .ty-modal__intro {
    max-width: 300px;
  }

  #thankYouModalV2.ty-modal-root .ty-modal__subtitle {
    margin-bottom: 46px !important;
  }

  #thankYouModalV2.ty-modal-root .ty-modal__cta {
    gap: 6px;
  }

  .ty-modal__phone {
    width: 266px;
  }
}

.ty-modal__qr {
  display: block;
  width: 133px;
  height: 133px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

@media (min-width: 1200px) and (max-width: 1440px) {
  .ty-modal__qr {
    width: 120px;
    height: 120px;
  }
}

/* Хвилі під QR (після картки в розмітці) */
.ty-modal__visual--qr .ty-modal__waves-stack {
  z-index: 0;
  margin-top: 8px;
}

.ty-modal__cta {
  order: 3;
  position: relative;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 24px;
  padding: 0 18px;
  min-height: 39px;
  border-radius: 40px;
  background: var(--ty-accent);
  color: var(--ty-bg);
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
  transition: filter 0.2s, transform 0.15s;
  pointer-events: auto;
}

@media (min-width: 1200px) and (max-width: 1441px) {
  .ty-modal__cta {
    margin-top: 120px;
  }
}

.ty-modal__cta:hover,
.ty-modal__cta:focus {
  color: var(--ty-bg);
  filter: brightness(1.05);
}

.ty-modal__cta-ig {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  filter: brightness(0);
}

.ty-modal__cta-arrow {
  flex-shrink: 0;
  width: 18px;
  height: 8px;
}

@media (min-width: 1441px) {
  .ty-modal__cta {
    min-height: 49px;
    padding: 11px 33px;
    font-weight: 500;
    font-size: 22px;
    border-radius: 37px;
    margin-bottom: 0;
  }

  .ty-modal__cta-ig {
    width: 17px !important;
    height: 17px !important;
  }
}

/* Dialog sizing */
#thankYouModalV2.ty-modal-root .ty-modal-dialog {
  max-width: 440px;
}

@media (min-width: 1441px) {
  #thankYouModalV2.ty-modal-root .ty-modal-dialog {
    max-width: 548px;
  }
}

/* Повний екран лише при max-width 499.98px; від 500px — планшетна модалка по центру */
@media (max-width: 499.98px) {
  #thankYouModalV2.ty-modal-root .ty-modal-dialog {
    width: 100vw;
    max-width: none;
    height: 100%;
    margin: 0;
  }

  #thankYouModalV2.ty-modal-root .ty-modal-dialog .modal-body .ty-modal__close {
    /* top: 20px; */
  }

  #thankYouModalV2.ty-modal-root .ty-modal-dialog .modal-content {
    height: 100%;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
  }

  #thankYouModalV2.ty-modal-root .ty-modal-dialog .modal-body {
    padding: 0;
    overflow: auto;
    max-height: 100svh;
    overflow: hidden;
  }

  #thankYouModalV2.ty-modal-root .ty-modal {
    border-radius: 0;
    min-height: 100svh;
    padding-top: 95px;
    padding-bottom: 32px;
    /* justify-content: center; */
  }

  #thankYouModalV2.ty-modal-root .ty-modal__title {
    font-size: 28px;
    margin-bottom: 10px;
  }

  #thankYouModalV2.ty-modal-root .ty-modal__subtitle {
    font-size: 14px;
    margin-bottom: 67px;
  }

  #thankYouModalV2.ty-modal-root .ty-modal__insta-title {
    font-size: 18px;
    line-height: normal;
    margin-bottom: 10px;
  }

  #thankYouModalV2.ty-modal-root .ty-modal__insta-text {
    font-size: 12px;
    line-height: 14px;
    margin-bottom: 13px;
  }

  #thankYouModalV2.ty-modal-root .ty-modal__cta {
    max-width: 320px;
  }
}

/**
 * Блокування скролу сторінки для TY-модалки (#thankYouModalV2).
 * Клас ty-modal-v2-scroll-lock додає thank-you-modal.js (position:fixed на body для iOS).
 * Додатково вимикаємо overflow-y у .modal — у Bootstrap він auto і на мобайлі дає «пробивання» фону.
 */
html.ty-modal-v2-scroll-lock,
body.ty-modal-v2-scroll-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
}

#thankYouModalV2.ty-modal-root.modal.show {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/**
 * Підкладка для модалки «Спасибо»: плавне затемнення без спалаху rgba(33,33,33,.9).
 * main.css задає .modal-backdrop.show { background:#212121; opacity:1 } — перебиваємо після додавання .ty-modal-backdrop (див. thank-you-modal.js).
 */
.modal-backdrop.ty-modal-backdrop {
  background-color: rgba(33, 33, 33, 0.5) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: opacity 0.2s linear !important;
}

.modal-backdrop.ty-modal-backdrop.fade:not(.show) {
  opacity: 0 !important;
}

.modal-backdrop.ty-modal-backdrop.show {
  background-color: rgba(33, 33, 33, 0.5) !important;
  opacity: 1 !important;
}

/**
 * У main.css для .modal-open задано filter: blur на section/header/footer.
 * Для модалки «Спасибо» лишаємо лише затемнення (.modal-backdrop), без розмиття сторінки.
 * Клас ty-modal-no-page-blur додає thank-you-modal.js.
 */
body.ty-modal-no-page-blur.modal-open section,
body.ty-modal-no-page-blur.modal-open header,
body.ty-modal-no-page-blur.modal-open footer {
  filter: none !important;
}
