/**
 * Мобильная вёрстка BabkaVPN: safe-area, шапка, hero, тарифы, формы, липкий CTA.
 * Подключается после main.css и header-wordmark.css.
 */

@media (max-width: 767px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.mobile-menu-open {
    overflow: hidden;
    touch-action: none;
  }

  /* ---- Шапка ---- */
  #siteHeader.header-tech-wrap--mobile-top {
    padding-top: max(0.35rem, env(safe-area-inset-top, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  #siteHeader .header-tech {
    min-height: 3.55rem !important;
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
  }

  .header-tech-wrap--split-brand .header-layout-row--balanced {
    display: flex;
    align-items: center;
    gap: clamp(0.65rem, 3vw, 1rem);
  }

  .header-tech-wrap--split-brand .header-panel-row {
    padding-top: 0;
    padding-left: 0;
    padding-right: 0;
    flex: 1 1 auto;
  }

  #siteHeader .header-nav-panel.header-tech {
    width: 100%;
  }

  #siteHeader .header-nav-panel.header-tech {
    min-height: 3.55rem !important;
    padding-top: 0.45rem !important;
    padding-bottom: 0.45rem !important;
  }

  #siteHeader .header-logo.header-wordmark,
  #siteHeader .header-logo {
    height: auto !important;
    min-height: 0 !important;
    transform: none !important;
  }

  #siteHeader .header-tech-inner {
    justify-content: flex-start;
  }

  .header-wordmark--split {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }

  .header-logo-icon-wrap {
    width: auto !important;
    height: 50px !important;
  }

  .header-logo-icon-neon {
    transform: none !important;
    transform-origin: center center !important;
  }

  .header-wordmark-text.babkavps-wordmark--glitch {
    font-size: clamp(1.32rem, 6.33vw, 1.78rem) !important;
  }

  .header-menu-toggle {
    -webkit-tap-highlight-color: transparent;
  }

  .header-menu-toggle[aria-expanded="true"] {
    border-color: rgba(244, 114, 182, 0.55);
    background: rgba(88, 28, 135, 0.45);
    color: #fff;
  }

  #mobileMenu.header-mobile-menu:not(.hidden) {
    margin-top: 0.35rem;
    margin-left: 0;
    margin-right: 0;
    border-radius: 1rem;
    box-shadow:
      0 12px 40px rgba(0, 0, 0, 0.55),
      0 0 24px rgba(176, 38, 255, 0.15);
  }

  /* ---- Hero (главная) ---- */
  .hero-mobile-main {
    padding-top: 0.5rem !important;
  }

  .hero-mobile-stage {
    padding-top: clamp(5rem, 16vw, 6.5rem) !important;
  }

  .hero-mobile-stage .babka-character {
    max-height: min(42vh, 320px);
    object-position: top center;
  }

  #hero-headline.hero-mobile-title {
    font-size: clamp(1.35rem, 6.8vw, 1.85rem) !important;
    line-height: 1.05 !important;
    white-space: normal !important;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .hero-mobile-sub {
    font-size: clamp(0.95rem, 4.2vw, 1.15rem) !important;
    line-height: 1.35 !important;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .hero-mobile-cta {
    margin-top: 1.25rem !important;
    min-height: 3rem;
    font-size: 1.05rem !important;
    border-radius: 1rem;
  }

  .usp-card {
    padding: 1rem 1.1rem;
    border-radius: 1.15rem;
  }

  .usp-card p {
    font-size: 0.95rem;
  }

  /* ---- Секции ---- */
  section h2 {
    font-size: clamp(1.35rem, 5.5vw, 1.75rem);
    line-height: 1.15;
  }

  .service-chip-shape {
    min-height: 2.75rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
  }

  #pricing .grid > article {
    padding: 1.25rem 1.15rem;
  }

  #pricing .grid > article p.text-4xl {
    font-size: 2.25rem !important;
    line-height: 1.1;
  }

  #pricing .js-buy-btn {
    min-height: 3rem;
    font-size: 1rem;
  }

  details summary {
    min-height: 2.75rem;
    padding: 0.25rem 0;
    font-size: 0.95rem;
  }

  /* ---- Кабинет / вход ---- */
  .page-with-header {
    padding-top: calc(4.75rem + env(safe-area-inset-top, 0px)) !important;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  }

  .cabinet-main {
    padding-top: calc(4.5rem + env(safe-area-inset-top, 0px)) !important;
    padding-bottom: 2rem;
  }

  .cabinet-slab {
    padding: 1rem 1rem 0.95rem;
    border-radius: 1.1rem;
  }

  .cabinet-happ-actions {
    flex-direction: column;
  }

  .cabinet-happ-actions .cabinet-happ-btn {
    width: 100%;
    min-height: 2.75rem;
    justify-content: center;
  }

  #loginForm input,
  #loginForm button,
  #loginForm .tech-btn {
    min-height: 3rem;
    font-size: 1rem;
  }

  /* ---- Модалка оплаты ---- */
  #connectModalShell {
    padding: max(0.75rem, env(safe-area-inset-top, 0px)) 0.75rem
      max(1rem, env(safe-area-inset-bottom, 0px)) !important;
    align-items: flex-end !important;
  }

  #connectModalCard.pay-modal-card {
    max-height: min(92dvh, 720px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 1.25rem 1.25rem 0.85rem 0.85rem;
    margin-bottom: 0;
  }

  #connectPlanPickerGrid {
    grid-template-columns: 1fr !important;
  }

  .connect-plan-option {
    min-height: 4.5rem;
  }

  /* ---- Подвал ---- */
  footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }

  body.has-mobile-sticky-cta footer {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Липкая кнопка «Подключиться» на главной (только телефон) */
.mobile-sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem max(0.75rem, env(safe-area-inset-left, 0px))
    max(0.65rem, env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-right, 0px));
  background: linear-gradient(
    180deg,
    rgba(7, 9, 16, 0) 0%,
    rgba(7, 9, 16, 0.88) 28%,
    rgba(7, 9, 16, 0.96) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

.mobile-sticky-cta__btn {
  pointer-events: auto;
  flex: 1;
  min-height: 3rem;
  border-radius: 1rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.mobile-sticky-cta__tariffs {
  pointer-events: auto;
  flex-shrink: 0;
  min-height: 3rem;
  min-width: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.45);
  color: #a5f3fc;
  font-size: 1.15rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 768px) {
  .mobile-sticky-cta {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-sticky-cta {
    backdrop-filter: none;
  }
}
