/* BIOS Personal mobile drawer gesture R32. */

@media (max-width: 760px),
  (max-width: 1024px) and (max-height: 500px) and (pointer: coarse) {
  body.bios-live.mobile-section-window {
    --mobile-navigation-offset: min(calc(100vw - 82px), 354px);
  }

  body.bios-live.mobile-section-window .main {
    touch-action: pan-y pinch-zoom;
  }

  body.bios-live.mobile-navigation-open .main,
  body.bios-live.mobile-navigation-open .main:has(> .view.active:not(.view-ai-chat)) {
    transform: translate3d(var(--mobile-navigation-offset), 0, 0);
  }

  body.bios-live.mobile-navigation-dragging {
    user-select: none;
    -webkit-user-select: none;
  }

  body.bios-live.mobile-navigation-dragging .main,
  body.bios-live.mobile-navigation-dragging .main:has(> .view.active:not(.view-ai-chat)) {
    transform: translate3d(var(--mobile-navigation-drag-x, 0px), 0, 0) !important;
    filter: saturate(calc(1 - var(--mobile-navigation-progress, 0) * .28))
      brightness(calc(1 - var(--mobile-navigation-progress, 0) * .09));
    transition: none !important;
  }

  body.bios-live.mobile-navigation-dragging .main::after {
    opacity: calc(var(--mobile-navigation-progress, 0) * 1);
    transition: none;
  }
}

@media (max-width: 360px) {
  body.bios-live.mobile-section-window {
    --mobile-navigation-offset: calc(100vw - 74px);
  }
}

/* The last-loaded Personal stylesheet owns the global reduced-motion override. */
@media (prefers-reduced-motion: reduce) {
  body.bios-live *,
  body.bios-live *::before,
  body.bios-live *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }
}

/* Last-loaded WCAG AA text contrast guard for the live Personal surfaces. */
body.bios-live .view.active :where(p, small, time, dt):not(.home-primary-card *):not(.home-referral-card *):not(.profile-consent-card *):not(.expert-growth-band *) {
  color: #596a7e !important;
}

body.bios-live .view.active :where(
  .home-article-copy,
  .privacy-list,
  .history-day,
  .history-event,
  .permissions-copy,
  .permissions-summary-list,
  .grant-permission-list,
  .summary-items,
  .summary-meta,
  .delete-summary-list,
  .profile-row,
  .profile-product-card,
  .profile-action-grid,
  .bios-protocol-card,
  .protocol-detail-progress-head,
  .protocol-detail-data-item,
  .doctors-directory-toolbar,
  .doctors-directory-filters,
  .case-detail-facts,
  .case-detail-timeline,
  .family-profile-meta,
  .family-profile-privacy,
  .sport-balance-copy,
  .sport-program-progress,
  .collected-use-list,
  .security-action-row
) :where(span, small, time, b) {
  color: #596a7e !important;
}

body.bios-live .view.active :where(
  .instruction-filter,
  .protocol-tab,
  .personal-filter-row > button,
  .history-filter-chips button
) {
  color: #596a7e !important;
}

body.bios-live .protocol-detail-status { color: #7a4b00; }
body.bios-live .protocol-detail-status.in-progress { color: #125f9d; }
body.bios-live .protocol-detail-status.closed,
body.bios-live .bios-protocol-state.closed { color: #246b4d; }
body.bios-live .case-detail-step { color: #1f659a; }
body.bios-live .case-detail-avatar { color: #35678e; }

body.bios-live :where(
  .protocol-detail-ai button:not(.protocol-detail-send-doctor),
  .doctors-directory-access,
  .family-add-primary,
  .family-profile-hero-action
) {
  background: #0666c7 !important;
  color: #fff !important;
}

body.bios-live .instruction-filter.active {
  background: #0666c7 !important;
  color: #fff !important;
}

body.bios-live .view.active :where(
  .chat-day,
  .protocol-detail-eyebrow,
  .doctors-directory-empty,
  .sport-empty,
  .sport-program-tag,
  .instruction-results-head > span,
  .personal-empty-state > span,
  .collected-summary-kicker,
  .history-period > span,
  .permissions-summary-kicker,
  .security-summary-score > span,
  .backup-overview-kicker,
  .export-panel-kicker
) {
  color: #596a7e !important;
}

body.bios-live .view.active :where(
  .privacy-policy-link,
  .collected-source-action,
  .permissions-primary,
  .analysis-upload-top,
  .profile-photo-upload-button,
  .profile-telegram-action
) {
  background: #0666c7 !important;
  color: #fff !important;
}

body.bios-live .family-profile-status { color: #526479 !important; }
body.bios-live .grant-type.active b { color: #145b91 !important; }
body.bios-live .backup-state-pill { color: #246b4d !important; }
body.bios-live .family-add { color: #145b91 !important; }
body.bios-live .delete-support-link { color: #145b91 !important; }
body.bios-live .btn-danger {
  background: #f7e9eb !important;
  color: #8f2430 !important;
}

body.bios-live .view.active .permissions-row > span {
  color: #596a7e !important;
}

body.bios-live .home-referral-card :where(p, small),
body.bios-live .profile-consent-card :where(.profile-product-label, strong, p) {
  color: #fff !important;
}

body.bios-live .instruction-card-media i { color: #fff !important; }
