/* =========================================================
   Orthognatika – верстка за макетом Figma
   Базова ширина макета: 1920px, контентна зона 1432px (x 245–1677)
   ========================================================= */

@font-face {
  font-family: "Cera Pro";
  src: local("Cera Pro Regular"), local("CeraPro-Regular"),
       url("../fonts/CeraPro-Regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Cera Pro";
  src: local("Cera Pro Medium"), local("CeraPro-Medium"),
       url("../fonts/CeraPro-Medium.woff") format("woff");
  font-weight: 500; font-style: normal; font-display: swap;
}

:root {
  --text: #383838;
  --black: #000;
  --accent: #246ff0;
  --btn: #0075d3;
  --btn-hover: #0063b3;
  --navy: #0f195c;
  --nav: #262626;
  --footer: #202020;
  --border: #cecece;
  --radius: 30px;
  --container: 1432px;
  --font: "Cera Pro", "Helvetica Neue", Arial, sans-serif;
  --lh: 1.257; /* «normal» line-height Cera Pro (ascent 808 + descent 192 + gap 257) */
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--black);
  background: #fff;
  line-height: var(--lh);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
button { font: inherit; cursor: pointer; background: none; border: 0; padding: 0; }

.container { width: var(--container); margin-left: calc(50% - 715px); }
.center { display: flex; justify-content: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 303px; height: 56px;
  border-radius: 32.87px;
  background: var(--btn);
  color: #fff;
  font-family: "Inter", Arial, sans-serif;
  font-weight: 400;
  font-size: 19.722px;
  line-height: normal;
  transition: background-color .2s, transform .2s, box-shadow .2s;
}
.btn:hover { background: var(--btn-hover); box-shadow: 0 8px 24px rgba(0,117,211,.25); }
.btn:active { transform: translateY(1px); }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center;
  width: 230px; height: 51px;
  border: 1px solid #505050; border-radius: 30px;
  font-size: 18px; color: #000;
  transition: background-color .2s, color .2s, border-color .2s;
}
.btn-outline:hover { background: var(--navy); border-color: var(--navy); color: #fff; }

.h2 { font-size: 60px; font-weight: 400; line-height: 75px; color: #000; }
.h2--white { color: #fff; }

/* ---------- Header (0–145, лінія на 146) ---------- */
.header { position: relative; z-index: 20; height: 146px; background: #fff; }
.header__inner { display: flex; align-items: flex-start; height: 100%; }
.header__logo { margin-top: 41px; }
.header__logo img { width: 168px; height: 67px; object-fit: cover; }
.nav {
  display: flex; margin: 65px 120px 0 auto;
  font-size: 20px; line-height: 25px; color: var(--nav);
}
.nav > a { transition: color .2s; }
.nav > a:hover, .nav__lang a:hover { color: var(--accent); }
.nav > a, .nav__lang { white-space: nowrap; }
/* ширини пунктів як у макеті, щоб позиції збігались 1:1 */
.nav > a:nth-child(1) { width: 76px; }
.nav > a:nth-child(2) { width: 79px; margin-left: 73px; }
.nav > a:nth-child(3) { width: 58px; margin-left: 67px; }
.nav > a:nth-child(4) { width: 86px; margin-left: 73px; }
.nav__lang { width: 69px; margin-left: 98px; }
/* англійська версія: слова іншої довжини – рівні відступи між пунктами */
.lang-en .nav > a:nth-child(n) { width: auto; margin-left: 70px; }
.lang-en .nav > a:first-child { margin-left: 0; }
.header .btn-outline { margin-top: 51px; }
.burger { display: none; }

/* ---------- Hero (146–847) ---------- */
.hero {
  position: relative; height: 701px; overflow: hidden;
  border-top: 1px solid var(--border);
}
.hero__interior {
  position: absolute; left: calc(50% - 1029px); top: -2px;
  width: 2024px; height: 702px;
  transform: scaleX(-1);
  pointer-events: none;
}
.hero__interior img { width: 100%; height: 100%; } /* прозорість 15% вже вшита в зображення */
.hero__inner { position: relative; height: 100%; }
.hero__ellipse { position: absolute; left: 480px; top: 95px; }
.hero__title {
  position: relative; z-index: 2;
  padding-top: 122px; width: 698px;
  font-size: 70px; line-height: 70px; font-weight: 500; color: var(--text);
}
.hero__title span { color: var(--accent); }
.hero__text {
  position: relative; z-index: 2;
  width: 591px; margin-top: 33px;
  font-size: 26px; line-height: 30px; color: var(--text);
}
.hero__btn { position: relative; z-index: 2; margin-top: 56px; }
.br-m { display: none; }
.hero__photo {
  position: absolute; left: 681px; top: 9px;
  width: 714px; height: 691px; overflow: hidden;
}
.hero__photo img { position: absolute; width: 233.21%; height: 160.44%; left: -61.48%; top: -0.08%; }

/* ---------- Wavy background blocks ---------- */
.wavy { position: relative; overflow: hidden; }
.wavy__bg { position: absolute; overflow: hidden; pointer-events: none; opacity: .3; z-index: 0; }
.wavy__bg img { position: absolute; }
.wavy > :not(.wavy__bg) { position: relative; z-index: 1; }
.wavy--1 .wavy__bg { left: calc(50% - 969px); top: 0; width: 1929px; height: 1812px; }
.wavy--1 .wavy__bg img { width: 141.08%; height: 100.03%; left: -22.78%; top: -2.34%; }
.wavy--2 .wavy__bg { left: calc(50% - 962px); top: 0; width: 1922px; height: 881px; }
.wavy--2 .wavy__bg img { width: 131.95%; height: 191.86%; left: -29.34%; top: -103.08%; }

/* ---------- Services (847 → 1689) ---------- */
.services { padding-top: 79px; }
.services .h2 { margin-left: -3px; }
.services__grid {
  display: grid; grid-template-columns: repeat(3, 430px);
  column-gap: 70px; row-gap: 50px;
  margin-top: 50px; margin-left: -1px;
}
.card {
  position: relative; height: 294px; border-radius: var(--radius); overflow: hidden;
  background: var(--navy);
  transform: translateZ(0);
}
.card__img { position: absolute; inset: 0; overflow: hidden; }
.card__img img { position: absolute; width: var(--w); height: var(--h); left: var(--l); top: var(--t); transition: transform .5s; }
.card__img--fill img, .card__img--cover img { inset: 0; width: 100%; height: 100%; }
.card__img--cover img { object-fit: cover; }
.card:hover .card__img img { transform: scale(1.04); }
.card[data-open-form] { cursor: pointer; }
.card__title { transition: background-color .2s; }
.card:hover .card__title { background: #16237a; }
.card:focus-visible { outline: 3px solid var(--btn); outline-offset: 4px; }
.card__title {
  position: absolute; left: 0; right: 0; bottom: 0; height: 71px;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); border-radius: 0 0 var(--radius) var(--radius);
  font-size: 26px; font-weight: 500; color: #fff; line-height: var(--lh);
  padding-bottom: 5px;
}

/* ---------- Doctors (1807 → 2654) ---------- */
.doctors { padding-top: 118px; padding-bottom: 110px; }
.doctors .h2 { margin-left: 2px; }
.doctors__grid {
  display: grid; grid-template-columns: 366px 371px 373px 327px; /* x: 248 / 614 / 985 / 1358 як у макеті */
  margin-top: 49px; padding: 0 0 0 3px; margin-right: -8px;
}
.doctor__photo { position: relative; width: 318px; height: 308px; border-radius: var(--radius); overflow: hidden; background: #eef1f6; }
.doctor__photo img { position: absolute; width: var(--w); height: var(--h); left: var(--l); top: var(--t); }
.doctor__name { width: 212px; margin-top: 20px; font-size: 24.7px; line-height: 30px; font-weight: 500; color: #000; }
.doctor__role { margin-top: 9px; font-size: 20px; line-height: 25px; color: #000; }
.doctors .center { margin-top: 110px; }

/* ---------- Stats (2654 → 3278) ---------- */
.stats { position: relative; z-index: 2; background: var(--navy); padding: 113px 0 114.5px; color: #fff; }
.stats__list { width: 1220px; margin-left: calc(50% - 612px); }
.stats__list li {
  display: flex; align-items: center;
  padding: 50.5px 0 35.5px;
  background: url("../img/line-11.svg") left bottom / 100% 1px no-repeat;
}
.stats__list li:first-child { padding-top: 0; }
.stats__list li:nth-child(2) { background-image: url("../img/line-12.svg"); }
.stats__list b { width: 244px; flex: none; font-size: 50px; font-weight: 500; line-height: 63px; }
.stats__list span { font-size: 26px; font-weight: 500; line-height: 33px; }

/* ---------- Results (3278 → 4159) ---------- */
.results { height: 881px; padding-top: 102px; }
.results__inner { width: 1013px; margin-left: calc(50% - 508px); }
.results .h2 { margin-left: 7px; }
.slider { position: relative; margin-top: 85px; }
.slider__viewport { overflow: hidden; border-radius: var(--radius); }
.slider__track { display: flex; gap: 40px; transition: transform .45s cubic-bezier(.2,.7,.2,1); }
.slide { position: relative; flex: 0 0 311px; height: 357px; border-radius: var(--radius); overflow: hidden; }
.slide > img:first-child { width: 100%; height: 100%; object-fit: cover; }
.slide__line { position: absolute; left: .32%; top: 48.88%; width: 99.68%; height: 1px; }
.slide--line2 .slide__line { left: 0; top: 49.93%; width: 100%; }
.slider__arrow {
  position: absolute; top: 179px; width: 44px; height: 44px; margin-top: -22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: background-color .2s, opacity .2s;
}
.slider__arrow:hover { background: rgba(15,25,92,.08); }
.slider__arrow[disabled] { opacity: .3; cursor: default; background: none; }
.slider__arrow--prev { left: -75px; }
.slider__arrow--prev img { transform: rotate(180deg); }
.slider__arrow--next { right: -82px; }
.results .center { margin-top: 84px; transform: translateX(2px); }

/* ---------- Contacts (4159 → 4687) ---------- */
.contacts { position: relative; z-index: 2; background: var(--navy); height: 528px; color: #fff; }
.contacts__inner { display: flex; width: 1073px; margin-left: calc(50% - 505px); }
.contacts__info { width: 566px; padding-top: 60px; }
.contacts__text { width: 494px; margin-top: 50px; font-size: 18px; font-weight: 500; line-height: 50px; }
.contacts__text a:hover { text-decoration: underline; }
.socials { display: flex; gap: 20px; margin-top: 10px; }
.social { position: relative; width: 40px; height: 40px; transition: transform .2s; }
.social:hover { transform: translateY(-2px); }
.social__bg { position: absolute; inset: 0; width: 40px; height: 40px; }
.social img:not(.social__bg) { position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; }
.social--tg img:not(.social__bg) { left: 10px; }
.social--viber img:not(.social__bg) { top: 10px; height: 19px; }
.contacts__map { display: block; width: 507px; height: 272px; margin-top: 182px; border-radius: var(--radius); overflow: hidden; }
.contacts__map { background: #e5e3df; isolation: isolate; }
.contacts__map iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- Footer (4687 → 4807) ---------- */
.footer { height: 120px; background: #fff; }
.footer__inner { position: relative; height: 100%; }
.footer__logo { position: absolute; left: 1px; top: 26px; }
.footer__logo img { width: 168px; height: 67px; object-fit: cover; }
.footer__copy, .footer__policy { position: absolute; top: 45px; font-size: 22px; line-height: 28px; color: var(--footer); }
.footer__copy { left: 620px; }
.footer__policy { right: -1px; transition: color .2s; }
.footer__policy:hover { color: var(--accent); }

.tabbar { display: none; }

/* ---------- Варіанти кадрування для фото, завантажених через адмінку ---------- */
.doctor__photo--cover img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero__photo--contain img { inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom center; }
.slide > img:first-child { object-position: center; }
/* Кількість лікарів відмінна від 4 – звичайна сітка на 4 колонки */
.doctors__grid--auto { grid-template-columns: repeat(4, 318px); justify-content: space-between; row-gap: 48px; margin-right: 0; padding-left: 0; }
.doctors__grid--auto .doctor__role { max-width: 318px; }
/* Крапки слайдера (генеруються за кількістю фото) */
.slider__dots { display: flex; justify-content: center; gap: 11.7px; margin-top: 36px; }
.slider__dots button { width: 10.23px; height: 10.23px; padding: 0; border-radius: 50%; background: #a7a7a7; transition: background-color .2s, transform .2s; }
.slider__dots button.is-active { background: #011351; }
.slider__dots button:hover { transform: scale(1.2); }

/* =========================================================
   Адаптив
   ========================================================= */

/* ≤ 1480: контейнер стає гумовим */
@media (max-width: 1480px) {
  :root { --gutter: 24px; }
  .container, .results__inner, .contacts__inner, .stats__list { width: auto; margin-left: var(--gutter); margin-right: var(--gutter); }
  .nav { margin-right: 48px; }
  .nav > a:nth-child(n) { width: auto; margin-left: 40px; }
  .lang-en .nav > a:nth-child(n) { margin-left: 40px; }
  .nav > a:first-child, .lang-en .nav > a:first-child { margin-left: 0; }
  .nav__lang { width: auto; margin-left: 56px; }
  .results .center { transform: none; }
  .services__grid { grid-template-columns: repeat(3, 1fr); column-gap: 40px; margin-left: 0; }
  .doctors__grid { grid-template-columns: repeat(4, 1fr); column-gap: 32px; margin-right: 0; padding: 0; }
  .doctor { min-width: 0; }
  .doctor__photo { width: 100%; aspect-ratio: 318 / 308; height: auto; }
  .hero__photo { left: auto; right: -40px; }
  .results__inner { max-width: 1013px; width: calc(100% - 2 * var(--gutter) - 140px); margin-left: auto; margin-right: auto; }
  .results { height: auto; padding-bottom: 76px; }
  .contacts__inner { justify-content: space-between; max-width: 1073px; width: calc(100% - 2 * var(--gutter)); margin-left: auto; margin-right: auto; }
  .contacts__info { width: auto; }
  .stats__list { max-width: 1220px; width: calc(100% - 2 * var(--gutter)); margin-left: auto; margin-right: auto; }
  .slide { flex-basis: calc((100% - 80px) / 3); height: auto; aspect-ratio: 311 / 357; }
  .results .h2 { margin-left: 0; }
  .footer__copy { left: 50%; transform: translateX(-50%); }
  .footer__policy { right: 0; }
}

/* ≤ 1200 */
@media (max-width: 1200px) {
  .header { height: 110px; }
  .header__logo { margin-top: 24px; }
  .nav { margin-top: 43px; font-size: 18px; }
  .header .btn-outline { margin-top: 30px; width: 200px; }
  .hero { height: 620px; }
  .hero__title { font-size: 56px; line-height: 58px; padding-top: 90px; width: 560px; }
  .hero__text { font-size: 22px; line-height: 27px; width: 480px; }
  .hero__photo { width: 600px; height: 610px; }
  .hero__interior { top: -2px; height: 620px; }
  .h2 { font-size: 48px; }
  .card__title { font-size: 22px; }
  .services__grid { column-gap: 24px; row-gap: 24px; }
  .card { height: auto; aspect-ratio: 430 / 294; }
  .doctors { padding-top: 90px; padding-bottom: 90px; }
  .doctors .center { margin-top: 70px; }
  .stats { height: auto; padding: 80px 0; }
  .stats__list li:last-child { padding-bottom: 0; background: none; }
  .stats__list b { width: 200px; font-size: 44px; }
  .stats__list span { font-size: 22px; }
  .contacts { height: auto; padding-bottom: 70px; }
  .contacts__map { margin-top: 170px; width: 420px; height: 240px; }
}

/* ≤ 1024: планшет, бургер-меню */
@media (max-width: 1024px) {
  .header { position: sticky; top: 0; height: 80px; background: #f8fbfc; border-bottom: 1px solid #c5c5c5; }
  .header__inner { align-items: center; }
  .header__logo { margin-top: 0; }
  .header__logo img { width: 114px; height: 44px; }
  .header .btn-outline { display: none; }
  .burger {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    flex: none; width: 41px; height: 41px; margin-left: auto; margin-right: -8px; padding: 0;
    -webkit-appearance: none; appearance: none; color: #000; -webkit-tap-highlight-color: transparent;
  }
  /* явна ширина ліній: Safari на iPhone стискає порожні span усередині button до 0 */
  .burger span { display: block; flex: none; width: 25px; height: 2px; background: #000; border-radius: 2px; transition: transform .25s, opacity .25s; }
  .burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav {
    position: fixed; left: 0; right: 0; top: 80px; z-index: 30;
    flex-direction: column; align-items: center; gap: 22px;
    margin: 0; padding: 32px 24px 40px;
    background: #fff; border-bottom: 1px solid #c5c5c5;
    font-size: 22px;
    transform: translateY(-12px); opacity: 0; visibility: hidden;
    transition: opacity .25s, transform .25s, visibility .25s;
  }
  .nav.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav > a:nth-child(n), .nav__lang,
  .lang-en .nav > a:nth-child(n) { margin-left: 0; }

  .hero { border-top: 0; height: 560px; }
  .hero__title { font-size: 42px; line-height: 46px; padding-top: 70px; width: 470px; }
  .hero__text { font-size: 19px; line-height: 24px; width: 360px; margin-top: 24px; }
  .hero__btn { margin-top: 40px; }
  .hero__photo { width: 460px; height: 470px; top: auto; bottom: 0; right: -60px; }
  .hero__interior { height: 560px; }
  .footer { height: auto; padding: 24px 0; }
  .footer__inner { display: flex; flex-direction: column; align-items: center; gap: 10px; }
  .footer__logo, .footer__copy, .footer__policy { position: static; transform: none; }
  .footer__logo img { width: 114px; height: 44px; }
  .footer__copy, .footer__policy { font-size: 16px; line-height: 22px; }
  .services__grid { grid-template-columns: repeat(2, 1fr); }
  .doctors__grid { grid-template-columns: repeat(2, 1fr); row-gap: 40px; column-gap: 24px; }
  .doctor__name { width: auto; }
  .results__inner { width: calc(100% - 2 * var(--gutter) - 112px); }
  .slide { flex-basis: calc((100% - 40px) / 2); height: auto; aspect-ratio: 311 / 357; }
  .slider__arrow--prev { left: -52px; }
  .slider__arrow--next { right: -52px; }
  .contacts__inner { flex-direction: column; }
  .contacts__map { margin-top: 40px; width: 100%; height: 300px; }
}

/* ≤ 767: мобільний макет (iPhone 402) */
@media (max-width: 767px) {
  :root { --gutter: 20px; }
  body { padding-bottom: 80px; }
  .header__logo { margin-left: 16px; }
  .burger { margin-right: 14px; }

  .hero { height: 679px; text-align: center; }
  .hero__text .br-m { display: inline; }
  .hero__inner { margin: 0; width: 100%; }
  .hero__interior { width: 1327px; height: 481px; top: 196px; left: calc(50% - 794.5px); }
  .hero__ellipse { display: none; }
  .hero__title {
    width: 350px; margin: 0 auto; padding-top: 75px;
    font-size: 36px; line-height: 34px;
  }
  .hero__text {
    width: 340px; margin: 30px auto 0; left: 1.5px;
    font-size: 17.465px; line-height: 20.152px; color: #282828;
  }
  .hero__photo { left: calc(50% - 166px); right: auto; top: 290px; bottom: auto; width: 380px; height: 389px; }
  .hero__photo img { height: 152.12%; }
  .hero__btn {
    position: absolute; left: calc(50% - 137px); top: 572px; margin: 0;
    width: 274px; height: 50.64px; border-radius: 29.724px; font-size: 17.834px;
  }

  .h2 { font-size: 34px; }
  .services { padding-top: 56px; }
  .services .h2, .doctors .h2, .results .h2 { margin-left: 0; }
  .services__grid { grid-template-columns: 1fr; margin-top: 28px; row-gap: 20px; }
  .card { border-radius: 24px; }
  .card__title { height: 60px; font-size: 22px; border-radius: 0 0 24px 24px; }
  .doctors { padding-top: 64px; padding-bottom: 64px; }
  .doctors__grid { margin-top: 28px; column-gap: 14px; row-gap: 28px; }
  .doctor__photo { border-radius: 20px; }
  .doctor__name { font-size: 18px; line-height: 22px; margin-top: 12px; }
  .doctor__role { font-size: 14px; line-height: 18px; margin-top: 6px; }
  .doctors .center, .results .center { margin-top: 44px; }
  .btn { width: 274px; height: 50.64px; font-size: 17.834px; }

  .stats { padding: 56px 0; }
  .stats__list li { flex-direction: column; align-items: flex-start; padding: 24px 0; }
  .stats__list li:first-child { padding-top: 0; }
  .stats__list b { width: auto; font-size: 40px; line-height: 50px; }
  .stats__list span { font-size: 18px; line-height: 24px; margin-top: 4px; }

  .results { height: auto; padding: 56px 0 64px; }
  .results__inner { width: auto; margin: 0 var(--gutter); }
  .slider { margin-top: 28px; }
  .slide { flex-basis: 100%; }
  .slider__arrow { top: auto; bottom: -58px; margin: 0; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
  .slider__arrow--prev { left: calc(50% - 90px); }
  .slider__arrow--next { right: calc(50% - 90px); }
  .slider__dots { margin-top: 28px; }
  .results .center { margin-top: 68px; }

  .contacts { padding-bottom: 56px; }
  .contacts__info { padding-top: 48px; }
  .contacts__text { width: auto; margin-top: 20px; font-size: 16px; line-height: 32px; }
  .socials { margin-top: 16px; }
  .contacts__map { height: 220px; border-radius: 24px; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: 80px; background: #fff; border-top: 1px solid #a3a3a3;
    justify-content: space-around; padding: 17px 16px 0;
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 500; line-height: 20.152px; color: #000920;
  }
  .tabbar img { width: 24px; height: 24px; object-fit: cover; }
}

/* =========================================================
   Форма заявки (модальне вікно)
   ========================================================= */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal__overlay { position: absolute; inset: 0; background: rgba(15, 25, 92, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s; }
.modal__box {
  position: relative; width: 100%; max-width: 560px; max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border-radius: var(--radius); padding: 48px 48px 40px;
  box-shadow: 0 30px 80px rgba(15, 25, 92, .25);
  opacity: 0; transform: translateY(16px) scale(.98); transition: opacity .25s, transform .3s cubic-bezier(.2,.7,.2,1);
}
.modal.is-open .modal__overlay { opacity: 1; }
.modal.is-open .modal__box { opacity: 1; transform: none; }
body.modal-open { overflow: hidden; }

.modal__close { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; border-radius: 50%; transition: background-color .2s; }
.modal__close:hover { background: #f1f3f8; }
.modal__close span { position: absolute; left: 11px; top: 19px; width: 18px; height: 2px; background: #383838; border-radius: 2px; }
.modal__close span:first-child { transform: rotate(45deg); }
.modal__close span:last-child { transform: rotate(-45deg); }

.modal__title { font-size: 36px; line-height: 1.15; font-weight: 500; color: var(--text); padding-right: 32px; }
.modal__sub { margin-top: 12px; font-size: 18px; line-height: 1.4; color: #5a5a5a; }

.lead-form { display: flex; flex-direction: column; gap: 18px; }
.lead-form[hidden], .lead-success[hidden] { display: none; }
.lead-form .modal__sub { margin-top: -6px; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.field label { font-size: 16px; font-weight: 500; color: var(--text); }
.field label i { font-style: normal; color: var(--btn); }
.field label small { font-size: 14px; font-weight: 400; color: #8a8a8a; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 17px; color: #1d1d1d;
  background: #f7f9fc; border: 1px solid #d9dde6; border-radius: 16px;
  padding: 15px 18px; outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.field select {
  padding-right: 40px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' fill='none' stroke='%23383838' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.field textarea { resize: vertical; min-height: 96px; line-height: 1.4; }
.field input::placeholder, .field textarea::placeholder { color: #9aa0ab; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #b9c0cd; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--btn); background: #fff; box-shadow: 0 0 0 4px rgba(0,117,211,.12); }
.field.is-invalid input { border-color: #e0413a; background: #fff7f6; }
.field__error { font-size: 14px; color: #d0342c; }

.check { position: relative; display: flex; align-items: flex-start; gap: 12px; font-size: 15px; line-height: 1.4; color: #5a5a5a; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; }
.check__box { flex: none; width: 22px; height: 22px; border: 1.5px solid #b9c0cd; border-radius: 6px; background: #fff; transition: background-color .15s, border-color .15s; }
.check input:checked + .check__box { background: var(--btn) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat; border-color: var(--btn); }
.check input:focus-visible + .check__box { box-shadow: 0 0 0 4px rgba(0,117,211,.2); }
.check.is-invalid .check__box { border-color: #e0413a; }
.check a { color: var(--btn); text-decoration: underline; text-underline-offset: 2px; }

.lead-form__submit { width: 100%; margin-top: 4px; position: relative; }
.lead-form__submit[disabled] { opacity: .7; cursor: progress; }
.lead-form__submit.is-loading span { visibility: hidden; }
.lead-form__submit.is-loading::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lead-form__status { font-size: 15px; line-height: 1.4; color: #d0342c; text-align: center; }
.lead-form__status:empty { display: none; }
.lead-form__status a { color: inherit; font-weight: 500; }

.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.lead-success { text-align: center; padding: 16px 0 4px; }
.lead-success__icon { width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #e7f2fc; color: var(--btn); }
.lead-success .modal__title { padding: 0; }
.lead-success .btn { margin-top: 28px; }

@media (max-width: 767px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal__box { max-width: none; max-height: 92dvh; border-radius: 24px 24px 0 0; padding: 36px 20px calc(24px + env(safe-area-inset-bottom)); transform: translateY(40px); }
  .modal__close { top: 12px; right: 12px; }
  .modal__title { font-size: 28px; }
  .modal__sub { font-size: 16px; }
  .field-row { grid-template-columns: 1fr; gap: 18px; }
  .field input, .field select, .field textarea { font-size: 16px; } /* 16px – щоб iPhone не збільшував сторінку при фокусі */
  .lead-form__submit, .lead-success .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .modal__overlay, .modal__box { transition: none; }
}
