/* The base every page links first (owner's choice, 2026-10-29: "the overflow issue never again"). Rules for the
   whole app live here once — never copied into a page's own stylesheet — so a fix reaches every page, new ones
   included; each page's own stylesheet comes after it and can still say otherwise. (offline.html is the one page
   without it: it has to work with nothing else loaded, so it keeps its own copy of the zoom rule.) */

/* no zooming anywhere (owner's choice, 2026-09-28): no double-tap zoom here; pinch and text-box zoom are off via
   the viewport meta on every page */
html { touch-action: manipulation; }


/* ── nothing wider than a phone's screen ── */

/* a box's padding and border count inside its width, so width: 100% never ends up wider than 100% */
*, *::before, *::after { box-sizing: border-box; }

/* photos, videos and embedded files shrink to fit their place */
img, video, canvas, iframe { max-width: 100%; }

/* form fields never push past their container, and shrink with their row instead of holding it wide */
input, select, textarea, button { max-width: 100%; }
input, select, textarea { min-width: 0; }

/* date and time boxes (found on an iPhone, 2026-10-29): Safari draws them its own way and lets them grow wider
   than the space they're given — the Quran «إضافة» sheet overflowed. Drawn plainly they keep the page's width. */
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="month"] {
  -webkit-appearance: none; appearance: none;
}
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value,
input[type="datetime-local"]::-webkit-date-and-time-value, input[type="month"]::-webkit-date-and-time-value {
  min-height: 1.4em; text-align: start;
}

/* a long word with no spaces — a link, an email, a long name — breaks inside cards and popups instead of
   running out of them */
:where([role="dialog"], dialog, .sheet, .mt-sheet, .drawer, .card, .panel-card) { overflow-wrap: break-word; }

/* the safety net: if something still escapes, it's cut at the edge instead of making a popup — or the whole page —
   scroll sideways. It hides a mistake rather than fixing it, so the phone-width check
   (My_Project/docs/overflow-check.js, before every front-end commit) is what finds the cause. */
body { overflow-x: clip; }
/* !important on purpose: a popup's own stylesheet sets overflow: auto (to scroll down), which would otherwise let it
   scroll sideways too — sideways is never wanted, down still works */
[role="dialog"], dialog, .sheet, .mt-sheet, .drawer { overflow-x: clip !important; }
