/**
 * Safe-area padding for iPhone (Dynamic Island + home indicator), incl. iPhone 17.
 * Requires viewport-fit=cover (see inc/lc-ios-safe-area.php).
 * High-specificity selectors beat Customizer / Additional CSS shorthand resets.
 */

@media (max-width: 768px) {
  html {
    --lc-safe-top: env(safe-area-inset-top, 0px);
    --lc-safe-bottom: env(safe-area-inset-bottom, 0px);
    --lc-safe-left: env(safe-area-inset-left, 0px);
    --lc-safe-right: env(safe-area-inset-right, 0px);
  }

  /* Top app bar: clear Dynamic Island / status bar */
  html body .lcmtm-mobile-shell .lcmtm-mobile-top,
  html body .lcmtm-mobile-top {
    padding-top: max(10px, var(--lc-safe-top)) !important;
    padding-left: max(0px, var(--lc-safe-left)) !important;
    padding-right: max(0px, var(--lc-safe-right)) !important;
  }

  html body .lcmtm-mobile-shell .lcmtm-appbar,
  html body .lcmtm-appbar {
    padding-left: max(12px, var(--lc-safe-left)) !important;
    padding-right: max(12px, var(--lc-safe-right)) !important;
  }

  /* Bottom tab bar: clear home indicator */
  html body .lcmtm-mobile-shell .lcmtm-mobile-bottom,
  html body .lcmtm-mobile-bottom {
    padding-bottom: max(10px, var(--lc-safe-bottom)) !important;
    padding-left: max(6px, var(--lc-safe-left)) !important;
    padding-right: max(6px, var(--lc-safe-right)) !important;
  }

  html body {
    padding-bottom: calc(88px + var(--lc-safe-bottom)) !important;
  }

  /* Drawer: interactive content inside safe area */
  html body .lcmtm-drawer {
    padding-top: max(0px, var(--lc-safe-top));
    padding-bottom: max(0px, var(--lc-safe-bottom));
    padding-left: max(0px, var(--lc-safe-left));
    padding-right: max(0px, var(--lc-safe-right));
  }

  /* Accessibility launcher / dialog above home indicator + bottom nav */
  html body.lc-a11y-p1 .lc-a11y-menu__launch,
  html body.lc-a11y-p1 .lc-a11y-menu__dialog {
    bottom: calc(88px + var(--lc-safe-bottom) + 8px) !important;
    left: max(16px, var(--lc-safe-left)) !important;
  }

  /* Auth / OTP cards: keep submit area clear of bottom chrome */
  html body .lc-otp-card,
  html body .lc-sms-register-form,
  html body .lc-sms-login-form {
    margin-bottom: calc(12px + var(--lc-safe-bottom));
  }

  /* Member card public pages */
  html body .lc-mc-shell,
  html body .lc-mc-page {
    padding-bottom: calc(24px + var(--lc-safe-bottom));
  }
}
