/* App Feel Lock — CSS
   Goal: page stays fixed like a native app.
   - No pinch/browser zoom drift
   - No horizontal slide/scroll
   - Only vertical scroll works
*/

html.afl-app-mode,
body.afl-app-mode {
	max-width: 100%;
	overflow-x: hidden;
	position: relative;
	touch-action: pan-y;
	-ms-touch-action: pan-y;
	overscroll-behavior-x: none;
	-webkit-text-size-adjust: 100%;
	-ms-text-size-adjust: 100%;
}

body.afl-app-mode {
	width: 100%;
	overscroll-behavior-y: contain;
	-webkit-overflow-scrolling: touch;
}

/* Kill horizontal scroll on any accidental wide element,
   but keep intentional horizontal scrollers working via .afl-allow-scroll-x */
body.afl-app-mode * {
	max-width: 100%;
}

body.afl-app-mode img,
body.afl-app-mode video,
body.afl-app-mode iframe,
body.afl-app-mode table,
body.afl-app-mode svg {
	max-width: 100%;
	height: auto;
}

/* Elements that legitimately need horizontal scroll/drag
   (carousels, sliders, wide tables) — add this class to opt out */
body.afl-app-mode .afl-allow-scroll-x {
	touch-action: pan-x pan-y;
	overflow-x: auto;
	max-width: 100%;
}

/* Allow pinch zoom specifically on images if enabled from settings */
body.afl-app-mode.afl-allow-image-zoom img {
	touch-action: pinch-zoom;
}

/* Prevent the blue tap-highlight flash for a more native feel */
body.afl-app-mode,
body.afl-app-mode * {
	-webkit-tap-highlight-color: transparent;
}

/* Safe, JS-free double-tap-zoom guard for interactive elements.
   touch-action: manipulation tells the browser "no double-tap zoom
   needed here" WITHOUT ever cancelling the click event the way a
   touchend preventDefault() in JS can. */
body.afl-app-mode a,
body.afl-app-mode button,
body.afl-app-mode input,
body.afl-app-mode select,
body.afl-app-mode textarea,
body.afl-app-mode [role="button"],
body.afl-app-mode .menu-item,
body.afl-app-mode summary {
	touch-action: manipulation;
}
