/* kinologlife.online — site-wide mobile fixes (v3) */

html {
  -webkit-text-size-adjust: 100%;
}

/* ── Landing page ── */
@media (max-width: 768px) {
  body.kl-landing-page .kl-container {
    padding-left: max(14px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(14px, env(safe-area-inset-right, 0px)) !important;
  }

  body.kl-landing-page .kl-hero {
    padding-top: 72px !important;
    padding-bottom: 28px !important;
  }

  body.kl-landing-page .kl-hero h1 {
    font-size: clamp(1.75rem, 7.8vw, 2.35rem) !important;
    line-height: 1.12 !important;
    word-break: break-word;
  }

  body.kl-landing-page .kl-hero-btns {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 10px !important;
  }

  body.kl-landing-page .kl-hero-btns .kl-btn,
  body.kl-landing-page .kl-hero-btns a.kl-btn {
    width: 100% !important;
    min-height: 50px !important;
    justify-content: center !important;
  }

  body.kl-landing-page .kl-hero-pills {
    justify-content: flex-start !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  body.kl-landing-page .kl-hero-pills::-webkit-scrollbar {
    display: none;
  }

  body.kl-landing-page .kl-hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body.kl-landing-page .site-header {
    left: max(10px, env(safe-area-inset-left, 0px)) !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    width: auto !important;
  }
}

@media (max-width: 480px) {
  body.kl-landing-page .kl-hero-stats {
    grid-template-columns: 1fr !important;
  }

  body.kl-landing-page .kl-hero-visual {
    max-width: 100% !important;
  }
}

/* ── Community / articles / KB ── */
@media (max-width: 767px) {
  body:not(.kl-landing-page) .site-content,
  body:not(.kl-landing-page) .content-area-inner,
  body:not(.kl-landing-page) .entry-content {
    padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
  }

  body:not(.kl-landing-page) .entry-title,
  body:not(.kl-landing-page) .post-card__title,
  body:not(.kl-landing-page) .kl-course-program-heading,
  body:not(.kl-landing-page) .kl-lesson-h2 {
    font-size: clamp(1.15rem, 5.2vw, 1.45rem) !important;
    line-height: 1.25 !important;
    word-break: break-word;
  }

  body:not(.kl-landing-page) .entry-content img,
  body:not(.kl-landing-page) .entry-content video,
  body:not(.kl-landing-page) .entry-content iframe,
  body:not(.kl-landing-page) .entry-content embed,
  body:not(.kl-landing-page) .kl-lesson-body img,
  body:not(.kl-landing-page) .kl-lesson-body video,
  body:not(.kl-landing-page) .kl-lesson-body iframe {
    max-width: 100% !important;
    height: auto !important;
  }

  body:not(.kl-landing-page) .entry-content table,
  body:not(.kl-landing-page) .kl-lesson-body table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  body:not(.kl-landing-page) .entry-content pre,
  body:not(.kl-landing-page) .kl-lesson-body pre {
    max-width: 100% !important;
    overflow-x: auto !important;
    white-space: pre-wrap !important;
    word-break: break-word;
  }

  body:not(.kl-landing-page) .kl-chapter-link,
  body:not(.kl-landing-page) .kl-k9-module-card,
  body:not(.kl-landing-page) .post-card {
    max-width: 100% !important;
  }
}

/* ── Join / checkout ── */
@media (max-width: 767px) {
  body.kl-join-checkout-page .kl-sub-checkout {
    padding-left: max(12px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__heading {
    font-size: clamp(1.35rem, 6vw, 1.75rem) !important;
    line-height: 1.15 !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__grid {
    grid-template-columns: 1fr !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__btn,
  body.kl-join-checkout-page .kl-sub-checkout__form input,
  body.kl-join-checkout-page .kl-sub-checkout__form select,
  body.kl-join-checkout-page .kl-sub-checkout__form textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__btn {
    min-height: 50px !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__staff-row {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__card--staff-row .kl-sub-checkout__badge.kl-sub-checkout__badge--staff-access {
    max-width: 100% !important;
  }
}

/* ── Forms / profile ── */
@media (max-width: 767px) {
  body.kl-community-paper .profile-form__body,
  body.kl-community-paper .wpc-user-profile,
  body.kl-community-paper .wpc-form {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.kl-community-paper input[type="text"],
  body.kl-community-paper input[type="email"],
  body.kl-community-paper input[type="password"],
  body.kl-community-paper input[type="tel"],
  body.kl-community-paper select,
  body.kl-community-paper textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.kl-community-paper .profile-form__body a[href*="/join"],
  body.kl-community-paper .wpc-user-profile a[href*="/join"] {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* ── Mobile menu drawer ── */
@media (max-width: 991px) {
  body:not(.kl-landing-page) .mobile-menu {
    padding-left: max(14px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(14px, env(safe-area-inset-right, 0px)) !important;
  }

  body:not(.kl-landing-page) .mobile-menu a,
  body:not(.kl-landing-page) .mobile-menu button {
    min-height: 44px !important;
  }
}

/* ── Cookie banner ── */
@media (max-width: 767px) {
  .kl-cookie-consent {
    left: max(8px, env(safe-area-inset-left, 0px)) !important;
    right: max(8px, env(safe-area-inset-right, 0px)) !important;
    bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
    padding: 8px !important;
  }

  .kl-cookie-consent__inner {
    padding: 10px 12px !important;
    gap: 10px !important;
    font-size: 12px !important;
    max-height: min(38vh, 200px) !important;
    overflow-y: auto !important;
  }

  .kl-cookie-consent__btn {
    min-height: 44px !important;
  }

  /* Не перекрывать кнопки входа / оплаты */
  body.page-template-template-account:not(.logged-in),
  body.page-profile:not(.logged-in),
  body.kl-join-checkout-page {
    padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* ── Вход / регистрация (/profile/) ── */
@media (max-width: 767px) {
  body.page-template-template-account:not(.logged-in) .site-main,
  body.page-profile:not(.logged-in) .site-main {
    padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.page-template-template-account:not(.logged-in) .breadcrumbs-container,
  body.page-profile:not(.logged-in) .breadcrumbs-container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    box-sizing: border-box !important;
  }

  body.page-template-template-account:not(.logged-in) .post-card,
  body.page-profile:not(.logged-in) .post-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 14px 12px !important;
    box-sizing: border-box !important;
  }

  body.page-template-template-account:not(.logged-in) .post-card__header,
  body.page-profile:not(.logged-in) .post-card__header {
    padding: 0 0 10px !important;
  }

  body.page-template-template-account:not(.logged-in) .post-card__content,
  body.page-profile:not(.logged-in) .post-card__content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  body.page-template-template-account:not(.logged-in) .auth-form,
  body.page-profile:not(.logged-in) .auth-form {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  body.page-template-template-account:not(.logged-in) .auth-form .input,
  body.page-template-template-account:not(.logged-in) .auth-form input,
  body.page-profile:not(.logged-in) .auth-form .input,
  body.page-profile:not(.logged-in) .auth-form input {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }

  body.page-template-template-account:not(.logged-in) .auth-form__row,
  body.page-profile:not(.logged-in) .auth-form__row {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body.page-template-template-account:not(.logged-in) .auth-form__row:has(button.btn),
  body.page-profile:not(.logged-in) .auth-form__row:has(button.btn) {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  body.page-template-template-account:not(.logged-in) .auth-form .btn,
  body.page-template-template-account:not(.logged-in) .auth-form button[type="submit"],
  body.page-profile:not(.logged-in) .auth-form .btn,
  body.page-profile:not(.logged-in) .auth-form button[type="submit"] {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
  }

  body.page-template-template-account:not(.logged-in) .auth-form .pseudo-link,
  body.page-profile:not(.logged-in) .auth-form .pseudo-link {
    margin-left: 0 !important;
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 44px !important;
  }

  body.page-template-template-account:not(.logged-in) .auth-form__row:has(label + .pseudo-link) .pseudo-link,
  body.page-profile:not(.logged-in) .auth-form__row:has(label + .pseudo-link) .pseudo-link {
    grid-column: 2 !important;
    width: auto !important;
    min-height: auto !important;
    padding: 0 !important;
  }

  body.page-template-template-account:not(.logged-in) .auth-form__description,
  body.page-profile:not(.logged-in) .auth-form__description {
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  body.page-template-template-account:not(.logged-in) .kl-pass-wrap,
  body.page-profile:not(.logged-in) .kl-pass-wrap {
    width: 100% !important;
    display: block !important;
  }
}

/* ── Join / оплата — ширина и чекбоксы ── */
@media (max-width: 767px) {
  body.kl-join-checkout-page .entry-content {
    padding-left: max(10px, env(safe-area-inset-left, 0px)) !important;
    padding-right: max(10px, env(safe-area-inset-right, 0px)) !important;
    box-sizing: border-box !important;
  }

  body.kl-join-checkout-page .post-card {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 12px 10px 14px !important;
    box-sizing: border-box !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__grid,
  body.kl-join-checkout-page .kl-sub-checkout__card,
  body.kl-join-checkout-page .kl-sub-checkout__form {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__consent,
  body.kl-join-checkout-page .kl-sub-checkout__consent label,
  body.kl-join-checkout-page .kl-sub-checkout__form label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    font-size: 0.88rem !important;
    line-height: 1.4 !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__consent input[type="checkbox"],
  body.kl-join-checkout-page .kl-sub-checkout__form input[type="checkbox"] {
    margin-top: 0.2rem !important;
    flex-shrink: 0 !important;
  }

  body.kl-join-checkout-page .kl-sub-checkout__price {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
}

/* ── wp-login.php (если попали напрямую) ── */
@media (max-width: 767px) {
  body.login #login {
    width: min(100%, 360px) !important;
    margin: 24px auto !important;
    padding: 0 12px !important;
    box-sizing: border-box !important;
  }

  body.login #loginform .input,
  body.login #loginform input[type="text"],
  body.login #loginform input[type="password"] {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
  }

  body.login .button-primary {
    width: 100% !important;
    min-height: 48px !important;
  }
}
