/* Chenar V11 - public mobile horizontal-overflow guard.
   Loaded after page styles in layout/header.blade.php; does not affect Filament.
   Prefer fixing the overflowing component over hiding the document scrollbar. */
@media (max-width: 991.98px) {
  html, body { max-width: 100%; }
  /* Safety net for transforms / third-party carousels. Component sizing fixes below
     are the primary fix, so focusable content isn't merely hidden off-screen. */
  html { overflow-x: clip; }
  body { overflow-x: clip; }

  /* Direct children of grids / flex rows must be allowed to shrink below min-content. */
  main, footer, .ck-nav { min-width: 0; max-width: 100%; }
  main :is(.container, .container-fluid, .row, .d-flex, .ckm, .ck-card,
           .account-flow, .ckm-toolbar, .ckm-filters, .ckm-section-head,
           .ckm-grid, .ckm-featured-grid, .ckm-card-body, .ckm-card-forms,
           .mkt-landing, .mkt-wrap, .mkt-lead-section, .mkt-form-card) { min-width: 0; }
  main :is(.row, .d-flex, .ckm-grid, .ckm-featured-grid, .ckm-section-head,
           .ckm-toolbar, .ckm-other-links, .mkt-hero, .mkt-lead-section) > * { min-width: 0; }

  /* A media item never dictates the width of the full page. Preserve intrinsic
     aspect ratios and normal sizing; do not force every image to width:100%. */
  main :is(img, video, svg, canvas, iframe), footer img { max-inline-size: 100%; }
  main :is(h1, h2, h3, h4, p, a, summary, label) { overflow-wrap: break-word; }
  main :is(.ckm-card, .ckm-card-body, .ckm-card-forms,
           .ckm-toolbar, .ckm-filters, .ckm-section-head, .ckm-other-links,
           .mkt-form-card, .ck-nl-panel) { max-width: 100%; }

  /* Wide tables/code intentionally scroll inside their own region. Do not clamp
     table cells or sliders to the viewport, which would destroy their UX. */
  main :is(.table-responsive, .ckgi-tablewrap, .ck-mkr-scroll,
           .ck-seo-table-wrap, .ck-gsc-table-wrap, .tg-matrix-scroll, pre) {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/*
 * iOS Safari / iOS WebKit focus auto-zoom guard.
 * WebKit zooms the visual viewport on focus when editable text controls use a
 * computed font size below 16 CSS pixels. Keep pinch-to-zoom available.
 * Only touch-based iOS WebKit is affected; desktop styles stay unchanged.
 * This shared CSS is intentionally loaded AFTER page-specific styles.
 */
@supports (-webkit-touch-callout: none) {
  @media (pointer: coarse) {
    input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]),
    textarea,
    select,
    [contenteditable="true"] {
      font-size: 16px !important;
    }
  }
}
