/* M18-03 · mobile horizontal pill rails + collections filter drawer
   owner: m18-scroll-sticky. Layout only — M17-R1 tier colours stay untouched. */
@media (max-width: 767px) {
  .fy3-tier-filter,
  .filterbar__group--tier .filterbar__chips,
  .fy3-sets__angles,
  .fy3-angles {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding-block: 4px;
    padding-inline: 2px 16px;
    max-width: 100%;
  }
  .fy3-tier-filter::-webkit-scrollbar,
  .filterbar__group--tier .filterbar__chips::-webkit-scrollbar,
  .fy3-sets__angles::-webkit-scrollbar,
  .fy3-angles::-webkit-scrollbar { display: none; }

  .fy3-tier-filter > .fy3-filter,
  .filterbar__group--tier .filterbar__chips > .chip--tier,
  .fy3-sets__angles > .fy3-sets__angle,
  .fy3-angles > button {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    white-space: nowrap;
    min-height: 44px;
    scroll-snap-align: center;
  }

  /* Sticky compact trigger bar; the original .filterbar node is moved into
     the drawer, never duplicated. */
  .fy-collections-mobile-bar {
    position: sticky;
    top: var(--nav-h-compact, 60px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-block: 10px;
    padding-inline: 16px;
    background: rgba(250, 248, 245, .94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-block-end: 1px solid rgba(20, 19, 17, .08);
  }
  .fy-filter-trigger-btn {
    min-height: 40px;
    padding-inline: 14px;
    border-radius: 999px;
    border: 1px solid #141311;
    background: #fff;
    color: #141311;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .fy-filter-collapsed { display: none; }

  .fy-mobile-filter-drawer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    visibility: hidden;
  }
  .fy-mobile-filter-drawer.is-open { visibility: visible; }
  .fy-mobile-filter-drawer__scrim {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(20, 19, 17, .42);
  }
  .fy-mobile-filter-drawer__panel {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    max-height: 78dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    border-start-start-radius: 20px;
    border-start-end-radius: 20px;
    background: #FAF8F5;
    transform: translateY(100%);
    transition: transform .24s ease;
  }
  .fy-mobile-filter-drawer.is-open .fy-mobile-filter-drawer__panel { transform: translateY(0); }
  .fy-mobile-filter-drawer .filterbar { display: block; }
  .fy-mobile-filter-drawer .filterbar__group { margin-block-end: 12px; }
  .fy-mobile-filter-drawer__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-block-start: 12px;
  }
  .fy-mobile-filter-drawer__actions button { min-height: 44px; border-radius: 999px; }
  .fy-mobile-filter-drawer__apply { background: #141311; color: #fff; border: 1px solid #141311; }
  .fy-mobile-filter-drawer__clear { background: #fff; color: #141311; border: 1px solid #141311; }

  /* M18-AR-stats · narrow RTL stat cells: the LTR-isolated sampling string
     (3–7 stock / 7–15 custom) is wider than its 95px cell and collided with
     the neighbour. Keep the bdi atomic, but allow the surrounding cell to
     wrap so scrollWidth <= clientWidth. Desktop + other 9 locales untouched. */
  html[lang="ar"][dir="rtl"] .fy3-hero__stage-cell,
  html[lang="ar"][dir="rtl"] .fy3-hero__stage-cell dd {
    min-width: 0;
    max-width: 100%;
  }
  html[lang="ar"][dir="rtl"] .fy3-hero__stage-cell dd {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: clamp(10px, 2.7vw, 13px);
    line-height: 1.35;
  }
  /* Allow the wrapping inside the isolated run without un-wrapping its digits. */
  html[lang="ar"][dir="rtl"] .fy3-hero__stage-cell dd bdi[dir="ltr"] {
    display: inline;
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
  }
}
