/* KB home + header/footer: mobile polish (phones up to 600px). */
@media (max-width: 600px) {
  body.clinion-kb { overflow-x: hidden; }

  /* Header */
  .kb-topbar { height: 56px; padding: 0 12px; }
  .kb-topbar .kb-logo-img { height: 28px; max-width: 130px; }
  .kb-topbar .kb-topbar-right { gap: 6px; }
  .kb-topbar a.kb-topbar-right { padding: 2px; }
  .kb-topbar .kb-nav > a,
  .kb-topbar .kb-nav .kb-dropdown-toggle,
  .kb-topbar .kb-submenu-toggle,
  .kb-topbar .kb-dropdown-menu a { font-size: 15px; padding: 12px; }

  /* Hero + search (16px inputs stop iPhone zoom-on-focus) */
  .clinion-kb .kb-hero { padding: 28px 16px 24px; }
  .clinion-kb .kb-hero h1 { font-size: 22px; }
  .clinion-kb .kb-hero p { font-size: 13px; margin-bottom: 16px; }
  .clinion-kb .kb-search-row input { height: 46px; font-size: 16px; }
  .clinion-kb .kb-search-btn { height: 46px; padding: 0 14px; font-size: 14px; }
  .clinion-kb .kb-search-results { max-height: 60vh; }
  .clinion-kb .cp-hero-link { display: block; margin-top: 14px; font-size: 13px; }

  /* Cards */
  .clinion-kb .kb-grid { gap: 14px; padding: 16px 12px 8px; }
  .clinion-kb .kb-card-head.kb-head-wordmark,
  .clinion-kb .kb-card-head.kb-head-icon { min-height: 0; padding: 14px; }
  .clinion-kb .kb-card-wordmark img { max-width: 120px; }
  .clinion-kb .kb-card-fullname { font-size: 12.5px; }
  .clinion-kb .kb-card-body { padding: 6px 14px 12px; }

  /* Bigger tap targets in the card lists */
  .clinion-kb .kb-card-item { padding: 10px 0; gap: 10px; }
  .clinion-kb .kb-item-label { font-size: 14px; line-height: 1.4; }
  .clinion-kb .kb-tree-chevron,
  .clinion-kb .kb-page-icon { width: 20px; height: 20px; }
  .clinion-kb .kb-tree-children { margin-left: 9px; padding-left: 12px; }

  /* Footer */
  .kb-site-footer { padding: 16px; font-size: 12.5px; }
}

/* ── Login / register / password forms (Ultimate Member) ──
   The site's Additional CSS sets .um-form { width: 50% !important } and the child theme
   pads the form 50px 85px, which squeezes the card on phones and pushes the Login button out.
   These selectors are more specific, so they win over those !important rules. */
@media (max-width: 1024px) {
  body div.um .um-form { width: 100% !important; max-width: 480px !important; margin: 0 auto !important; }
}
@media (max-width: 767px) {
  body div.um { max-width: 100% !important; margin: 24px auto !important; padding: 0 !important; }
  body div.um .um-form form { padding: 28px 20px !important; border-radius: 18px !important; box-sizing: border-box; }
  body div.um .um-field { padding-top: 12px !important; }
  body div.um .um-field-label label { font-size: 15px !important; line-height: 1.4 !important; }
  body div.um .um-field-area input.um-form-field {
    width: 100% !important; max-width: 100% !important; height: 46px !important;
    font-size: 16px !important; box-sizing: border-box !important;
  }
  body div.um .um-col-alt .um-left,
  body div.um .um-col-alt .um-right,
  body div.um .um-col-alt .um-half { float: none !important; width: 100% !important; margin: 0 0 10px !important; }
  body div.um input[type=submit].um-button,
  body div.um a.um-button { width: 100% !important; max-width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; }
  body div.um .um-col-alt-b { text-align: center; }
}

/* ── Header: menu button on the right (phones/tablets, where the button shows) ── */
@media (max-width: 900px) {
  body header.kb-topbar > .kb-topbar-left { flex: 1 1 auto !important; width: 100% !important; }
  body header.kb-topbar .kb-topbar-left > .kb-nav-toggle { margin-left: auto !important; order: 3 !important; }
}

/* ── Login / register / password pages on phones: less empty space above and below the card.
   Astra's page margins/padding and the <p> around the form shortcode add the extra space. ── */
@media (max-width: 767px) {
  body:has(div.um-login, div.um-register, div.um-password) #content.site-content { padding: 0 !important; min-height: 0 !important; }
  body:has(div.um-login, div.um-register, div.um-password) #primary { margin: 0 !important; padding: 0 !important; min-height: 0 !important; }
  body:has(div.um-login, div.um-register, div.um-password) .site-main > article,
  body:has(div.um-login, div.um-register, div.um-password) .ast-article-single {
    margin: 0 !important; padding: 0 !important; min-height: 0 !important;
  }
  body:has(div.um-login, div.um-register, div.um-password) .entry-content > p { margin: 0 !important; }
  /* Centre the card in the blue area: the page fills the screen height, so split the spare space evenly.
     The site's Additional CSS paints .ast-container white, which showed as a stripe; make it transparent here. */
  body:has(div.um-login, div.um-register, div.um-password) #page { display: flex !important; flex-direction: column !important; min-height: 100svh; }
  body:has(div.um-login, div.um-register, div.um-password) #content.site-content { flex: 1 0 auto !important; display: flex !important; align-items: center !important; }
  body:has(div.um-login, div.um-register, div.um-password) #content.site-content > .ast-container { width: 100% !important; background: transparent !important; padding-left: 16px !important; padding-right: 16px !important; box-sizing: border-box !important; }
  body div.um.um-login, body div.um.um-register, body div.um.um-password { margin: 20px auto !important; }
  body div.um.um-login .um-form form,
  body div.um.um-register .um-form form,
  body div.um.um-password .um-form form { padding: 22px 24px 20px !important; }
}

/* ── Login form only (Ultimate Member form on /user-login/, not wp-login.php): the form's row
   has 30px padding + 30px margin below it (set in the UM form builder), which left a big gap
   between Password and "Keep me signed in". All screen sizes. ── */
body div.um.um-login .um-row { padding-bottom: 0 !important; margin-bottom: 14px !important; }

/* ── Show/hide password button (all screen sizes, Ultimate Member forms only) ── */
body div.um .kbc-pw-wrap { position: relative !important; }
body div.um .kbc-pw-wrap input[type="password"],
body div.um .kbc-pw-wrap input[data-kbc-toggle] { padding-right: 44px !important; }
body div.um .kbc-pw-toggle {
  position: absolute !important; top: 50% !important; right: 6px !important; transform: translateY(-50%) !important;
  width: 34px !important; height: 34px !important; min-width: 0 !important; margin: 0 !important; padding: 0 !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  background: transparent !important; border: 0 !important; box-shadow: none !important; border-radius: 6px !important;
  color: #888780 !important; cursor: pointer !important; line-height: 1 !important;
}
body div.um .kbc-pw-toggle:hover,
body div.um .kbc-pw-toggle:focus-visible { color: #185FA5 !important; background: rgba(24,95,165,.08) !important; }
