/*
 * МЕДФОРМАТ — исправления адаптивной верстки
 *
 * Исправляет:
 * 1. Наложение мобильного меню и перекрытие панели действий (.mobilebar).
 * 2. Блокировку прокрутки страницы под меню и свободный тач-скролл внутри меню.
 * 3. Переполнение и тесноту десктопной шапки (чистый брейкпоинт 992 px).
 * 4. Автозум в iOS Safari при фокусе в поля ввода (font-size 16px).
 * 5. Поведение на компактных экранах (320–360 px) и устройствах с safe-area.
 */

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body.body--locked {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body.body--locked .mobilebar {
  display: none !important;
}

.mobilebar {
  transition: transform 0.28s ease;
  will-change: transform;
}

.mobilebar.mobilebar--hidden {
  transform: translateY(calc(100% + env(safe-area-inset-bottom) + 20px));
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
}

.logo__mark {
  width: 40px;
  height: 40px;
  flex: none;
  color: var(--c-primary);
  transition: color 0.2s ease;
}

.logo:hover .logo__mark {
  color: var(--c-primary-dark);
}

.footer .logo__mark {
  color: var(--c-accent);
}

.footer .logo:hover .logo__mark {
  color: #ffffff;
}

.logo__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.logo__name {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .02em;
  line-height: 1.1;
}

.logo__sub {
  font-size: 10.5px;
  color: var(--c-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.1;
}

/* Мобильная шапка (< 992 px) */
@media (max-width: 991.98px) {
  .header {
    transition: box-shadow 0.25s ease, transform 0.28s ease;
    will-change: transform;
  }

  .header.header--hidden {
    transform: translateY(-100%);
  }

  .burger {
    display: grid;
    flex: 0 0 48px;
  }

  .header__phone,
  .header__cta {
    display: none;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    height: calc(100dvh - 70px);
    min-height: 0;
    padding: 20px 24px calc(28px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;

    display: none;
    flex-direction: column;
    gap: 4px;

    background: #fff;
    box-shadow: 0 18px 32px rgba(18, 38, 63, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition:
      opacity 0.25s ease,
      transform 0.25s ease,
      visibility 0.25s ease;
    z-index: 90;
  }

  .nav.nav--open {
    display: flex;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav a {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 8px 0;
    font-size: 17px;
    border-bottom: 1px solid var(--c-line);
  }

  .nav__extra {
    display: grid;
    gap: 12px;
    width: 100%;
    margin-top: auto;
    padding-top: 20px;
  }

  .nav__extra a {
    justify-content: center;
    width: 100%;
    min-height: 50px;
    border-bottom: 0;
  }

  .nav__extra .btn--primary {
    background: var(--c-primary) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 20px rgba(14, 90, 167, 0.28);
  }

  .nav__extra .btn--primary .ic {
    color: #ffffff !important;
    stroke: #ffffff !important;
  }

  .nav__extra .btn--primary:hover,
  .nav__extra .btn--primary:active {
    background: var(--c-primary-dark) !important;
    color: #ffffff !important;
  }

  .nav__extra .btn--ghost {
    background: #ffffff !important;
    color: var(--c-primary) !important;
    border: 1.5px solid var(--c-line) !important;
  }

  .nav__extra .btn--ghost:hover,
  .nav__extra .btn--ghost:active {
    border-color: var(--c-primary) !important;
    color: var(--c-primary-dark) !important;
  }
}

/* Десктопная шапка (>= 992 px) */
@media (min-width: 992px) {
  .nav {
    display: flex;
    align-items: center;
    gap: clamp(16px, 1.8vw, 26px);
  }

  .burger {
    display: none;
  }

  .header__phone,
  .header__cta {
    display: inline-flex;
  }

  .nav__extra {
    display: none;
  }
}

/* Поля формы: предотвращение нежелательного зума на iPhone */
.field input,
.field textarea {
  font-size: 16px;
}

/* Компактный бейдж на узких мобильных экранах */
@media (max-width: 480px) {
  .hero__badge {
    border-radius: var(--r-sm);
    line-height: 1.35;
    padding: 8px 12px;
    white-space: normal;
  }
}

.hero__messengers {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  list-style: none;
  padding: 0;
  margin-left: 0;
}

/* Единая форма кнопок мессенджеров (скругление 14px как у основных кнопок) */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 14px;
  text-decoration: none;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  transition: transform .18s, filter .18s, box-shadow .18s;
  white-space: nowrap;
}

.chip:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

.chip--tg {
  background: var(--c-tg);
  box-shadow: 0 8px 20px rgba(34, 158, 217, 0.28);
}

.chip--max {
  background: linear-gradient(135deg, #7a5cf5, #3b82f6);
  box-shadow: 0 8px 20px rgba(90, 92, 240, 0.28);
}

/* На мобильных экранах кнопки первого экрана выстраиваются аккуратно */
@media (max-width: 640px) {
  .hero__cta,
  .hero__messengers {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }

  .hero__cta .btn,
  .hero__messengers .chip {
    width: 100%;
    margin: 0;
  }
}

/* Оборудование и кабинет врача: адаптивная высота на десктопе под высоту контент-блока */
.equipment__img,
.doctors__img {
  margin: 0;
}

.equipment__img img,
.doctors__img img {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  max-height: 340px;
  object-fit: cover;
  display: block;
}

@media (min-width: 1024px) {
  .equipment__inner,
  .doctors__inner {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: clamp(32px, 3.5vw, 52px);
  }

  .equipment__img,
  .doctors__img {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .equipment__img img {
    height: 100%;
    min-height: 360px;
    max-height: 480px;
    aspect-ratio: auto;
    object-position: center;
  }

  .doctors__img img {
    height: 100%;
    min-height: 380px;
    max-height: 520px;
    aspect-ratio: auto;
    object-position: 45% center;
  }
}

@media (max-width: 640px) {
  .equipment__img img,
  .doctors__img img {
    aspect-ratio: 3 / 2;
    max-height: 240px;
    height: auto;
  }
}

.contact-card {
  overflow: hidden;
}

/* Уменьшение движения */
@media (prefers-reduced-motion: reduce) {
  .nav {
    transition: none;
  }
}

/* ============ ВАРИАНТ Б: ЕДИНЫЙ МЕДИА-БЛОК В КОНТАКТАХ ============ */
@media (min-width: 992px) {
  .contacts__grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 28px;
  }

  .contact-card {
    display: flex;
    flex-direction: column;
    height: 100%;
  }



  .contact-card--form .form__grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 14px;
    margin-top: 18px;
  }

  .contact-card--form button[type="submit"] {
    margin-top: auto;
  }
}

.contact-info__top {
  display: flex;
  flex-direction: column;
}

.contact-phone-link {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-primary);
  text-decoration: none;
  transition: opacity 0.2s;
}
.contact-phone-link:hover {
  text-decoration: underline;
  opacity: 0.85;
}

.contact-address-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}
.contact-address-link:hover {
  color: var(--c-primary);
  text-decoration: underline;
}

.contact-line__content {
  flex: 1;
}

.contact-line__action {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn--sm {
  min-height: 38px;
  padding: 0 16px;
  font-size: 13.5px;
  border-radius: 10px;
  gap: 7px;
  display: inline-flex;
}

.btn--sm .ic {
  width: 16px;
  height: 16px;
}

/* Фотография входа и ориентир проезда */
.contact-photo {
  margin: 20px 0 0;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 14px rgba(18, 38, 63, 0.05);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  outline: none;
}

.contact-photo:focus-visible {
  outline: 3px solid var(--c-accent);
  outline-offset: 2px;
}

.contact-photo__wrap {
  position: relative;
  overflow: hidden;
  display: block;
}

.contact-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  max-height: 300px;
  object-fit: cover;
  object-position: center 52%;
  display: block;
  transition: transform 0.3s ease;
}

.contact-photo:hover img {
  transform: scale(1.02);
}

.contact-photo__zoom-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(18, 38, 63, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transition: background 0.2s, transform 0.2s;
}

.contact-photo__zoom-badge .ic {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.contact-photo:hover .contact-photo__zoom-badge {
  background: rgba(14, 90, 167, 0.92);
  transform: scale(1.04);
}

.contact-photo figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--c-muted);
  padding: 9px 14px;
  background: #f8fafc;
  border-top: 1px solid var(--c-line);
  line-height: 1.35;
  flex-shrink: 0;
}

.contact-photo figcaption .ic {
  width: 15px;
  height: 15px;
  color: var(--c-teal);
  flex-shrink: 0;
}

/* ============ LIGHTBOX МОДАЛЬНОЕ ОКНО ============ */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 3vw, 32px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 28, 48, 0.88);
  backdrop-filter: blur(8px);
}

.lightbox-modal__container {
  position: relative;
  z-index: 2;
  max-width: min(94vw, 1060px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.lightbox-modal__close {
  position: absolute;
  top: -44px;
  right: 0;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, transform 0.2s;
}

.lightbox-modal__close:hover {
  background: #fff;
  color: var(--c-ink);
  transform: scale(1.08);
}

.lightbox-modal__content {
  background: #0d1c30;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1024px;
}

.lightbox-modal__content img {
  width: 100%;
  max-height: calc(85vh - 70px);
  object-fit: contain;
  display: block;
  background: #000;
}

.lightbox-modal__caption {
  margin: 0;
  padding: 12px 18px;
  font-size: 13.5px;
  color: #dce8f7;
  background: #12263f;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  line-height: 1.4;
}

@media (max-width: 600px) {
  .lightbox-modal {
    padding: 8px;
  }
  .lightbox-modal__close {
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.65);
    width: 34px;
    height: 34px;
    font-size: 18px;
  }
}

@media (max-width: 991.98px) {
  .contact-photo {
    width: 100%;
    margin: 22px 0 0;
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(18, 38, 63, 0.05);
  }

  .contact-photo img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 11;
    max-height: 320px;
    object-fit: cover;
    object-position: center 52%;
    display: block;
  }

  .contact-photo figcaption {
    padding: 10px 14px;
    justify-content: flex-start;
  }
}

@media (min-width: 992px) {
  .contacts__grid {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    gap: 28px;
  }

  .contact-card {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .contact-photo {
    margin-top: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: var(--r-md);
  }

  .contact-photo__wrap {
    flex: 1;
    display: flex;
    min-height: 240px;
    position: relative;
    overflow: hidden;
  }

  .contact-photo img {
    width: 100%;
    height: 100%;
    min-height: 240px;
    max-height: 320px;
    object-fit: cover;
    object-position: center 52%;
  }

  .contact-card--form .form__grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 14px;
    margin-top: 18px;
  }

  .contact-card--form button[type="submit"] {
    margin-top: auto;
  }
}



/* ============ БЛОК ОТЗЫВОВ И РЕЙТИНГА (СИММЕТРИЧНЫЕ ОТСТУПЫ) ============ */
.doctors {
  padding-bottom: clamp(36px, 5vw, 64px);
}

#reviews {
  padding-block: clamp(36px, 5vw, 64px);
}

.faq {
  padding-top: clamp(36px, 5vw, 64px);
}

.reviews__card {
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: clamp(24px, 3.5vw, 36px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  box-shadow: 0 4px 20px rgba(18, 38, 63, 0.05);
}

.reviews__info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reviews__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.reviews__title {
  font-size: clamp(1.25rem, 2vw + 0.4rem, 1.65rem);
  font-weight: 800;
  margin: 0;
  color: var(--c-ink);
}

.reviews__stars-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.reviews__stars {
  display: flex;
  gap: 3px;
  margin: 0;
}

.reviews__stars .ic {
  width: 19px;
  height: 19px;
  color: #f5b300;
}

.reviews__score {
  font-weight: 800;
  font-size: 14.5px;
  color: var(--c-ink);
  background: #fff8e6;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 2px 8px;
  line-height: 1.2;
}

.reviews__src {
  font-size: 14px;
  color: var(--c-muted);
  margin: 0;
}

.reviews__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

@media (max-width: 680px) {
  .reviews__card {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  .reviews__actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin-top: 6px;
  }
  .reviews__actions .btn {
    width: 100%;
    margin: 0;
  }
}

/* Кнопки мессенджеров с единым скруглением как у кнопки Позвонить */
.btn--tg {
  background: var(--c-tg);
  color: #fff;
  box-shadow: 0 8px 20px rgba(34, 158, 217, 0.28);
}
.btn--tg:hover {
  background: #1a8ec4;
  transform: translateY(-2px);
}

.btn--max {
  background: linear-gradient(135deg, #7a5cf5, #3b82f6);
  color: #fff;
  box-shadow: 0 8px 20px rgba(90, 92, 240, 0.28);
}
.btn--max:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .referral__actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  .referral__actions .btn {
    width: 100%;
    margin: 0;
  }
}

/* ============ БЕЗОПАСНЫЙ ПОКАЗ БЛОКОВ (.reveal) ============ */
.reveal--visible {
  opacity: 1 !important;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ============ БЛОК РАЗРАБОТЧИКА В ФУТЕРЕ (DCW) ============ */
.footer__bottom {
  margin-top: 28px;
  border-top: 1px solid #22364e;
  padding-top: 20px;
}

.footer__bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.footer__copy {
  color: #8fa5c2;
  font-size: 13px;
  line-height: 1.4;
}

.footer__developer {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #8fa5c2 !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
  line-height: 1;
}

.footer__developer:hover {
  color: #ffffff !important;
}

.footer__developer-label {
  letter-spacing: 0.01em;
}

.footer__developer-logo {
  display: inline-block;
  height: 22px;
  width: auto;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
  vertical-align: middle;
}

.footer__developer:hover .footer__developer-logo {
  opacity: 1;
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  .footer__bottom-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

