/* ──────────────────────────────────────────────────────────────────────
   MOBILE LOCK — prevents zoom, horizontal scroll, and landscape rotation.
   Included on every public page.
   ────────────────────────────────────────────────────────────────────── */

/* Disable pinch-zoom + horizontal page scroll site-wide */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html {
  /* Block multi-finger gestures (iOS pinch) on the document, but keep
     vertical pan working so users can still scroll the page. */
  touch-action: pan-y pinch-zoom; /*MH-F45*/
}

/* Stop iOS from zooming when an input gets focus — fonts must be ≥16px */
input:not([type="checkbox"]):not([type="radio"]),
textarea,
select {
  font-size: max(16px, 1rem) !important;
}

/* Containers that LEGITIMATELY need horizontal scroll override the
   document-wide pan-y rule. Add new selectors here as needed. */
.main-menu,
.gen-list,
.gen-grid,
.shot-grid,
.ms-aspects,
.search-cards,
.search-grid-2,
.cam-tiles,
.cam-popover-v2,
.dt,
table,
pre,
.msg-bubble pre,
[data-allow-x-scroll] {
  touch-action: pan-x pan-y !important;
}

/* Disable the iOS magnifier / callout on long-press of regular text */
body * {
  -webkit-touch-callout: none;
}
/* Re-enable selection for content the user might want to copy */
input, textarea, p, h1, h2, h3, h4, .msg-bubble, .vp-prompt-box,
[contenteditable], [data-allow-select] {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

/* ──────────────────────────────────────────────────────────────────────
   LANDSCAPE MOBILE → show "rotate to portrait" overlay.
   We don't actually lock the orientation (the Screen Orientation API only
   works in fullscreen / PWA), but we block all interaction and politely
   ask the user to rotate.
   v2: keyed on pointer:coarse + short height instead of max-width:900 —
   covers big phones in landscape (e.g. iPhone Pro Max = 932px wide) and
   no longer hits short desktop windows; tablets (height ≥ ~700) excluded.
   ────────────────────────────────────────────────────────────────────── */
@media screen and (orientation: landscape) and (pointer: coarse) and (max-height: 520px) {
  html[data-portrait-lock], html[data-portrait-lock] body { overflow: hidden !important; }
  html[data-portrait-lock] body::before {
    content: '📱  لطفاً گوشی را عمودی نگه دارید';
    position: fixed; inset: 0; z-index: 2147483647;
    background: #0a0a0a; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Vazirmatn', system-ui, sans-serif;
    font-size: 1.2rem; font-weight: 700;
    text-align: center; padding: 24px;
    direction: rtl;
    backdrop-filter: blur(8px);
  }
}
