/* Mobile fixes (design M), loaded after every other stylesheet. Only small, isolated corrections from the
   mobile QA of November 2026; page-specific work belongs in the page's own site-*.css file. */

/* iOS Safari zooms the page in when a form field with a font size below 16px gets focus.
   Some selects and textareas (product order form, project picker, notes) used 14-14.5px. */
@media (max-width: 760px) {
	/* Repeated classes only raise specificity above the page files (e.g. body.xp-page .xp-form select). */
	:root body.xr-m.xr-m.xr-m select,
	:root body.xr-m.xr-m.xr-m textarea,
	:root body.xr-m.xr-m.xr-m input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="hidden"]) {
		font-size: 16px !important;
	}
}

/* Language switcher in the header: the 320px dropdown hung from the middle of the header and ran
   ~45px off the left edge of a phone screen (English, Nederlands ... cut off). On phones it now spans
   the header width, anchored to the sticky header instead of the button. */
@media (max-width: 600px) {
	body.xr-m .site-header .language-switcher,
	body.xr-m .site-header .xl-sw { position: static !important; }
	body.xr-m .site-header .xl-sw > ul {
		left: 12px !important; right: 12px !important; width: auto !important;
		top: calc(100% - 4px) !important;
		max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px);
		-webkit-overflow-scrolling: touch; overscroll-behavior: contain;
	}
	body.xr-m .site-header .xl-sw li a { padding-top: 10px; padding-bottom: 10px; }
}

/* Mobile menu: the page behind it no longer scrolls while it is open (class set in inc/m2.php). */
html.xm-nav-lock, html.xm-nav-lock body { overflow: hidden !important; overscroll-behavior: none; }
body.xr-m .site-nav-mobile { overscroll-behavior: contain; }

/* Header on phones and tablets: the cart (with its count) next to the menu button, as on desktop.
   Only the cart of the account bar shows here; login and account stay in the menu. */
@media (max-width: 1024px) {
	body.xr-m .site-header__top .user-nav:has(#site-header-cart) { display: flex !important; order: 2; flex: none !important; align-items: center; margin: 0 !important; gap: 0 !important; }
	body.xr-m .site-header__top .user-nav:has(#site-header-cart) > :not(#site-header-cart) { display: none !important; }
	body.xr-m .site-header__top .user-nav #site-header-cart { margin: 0 !important; }
}
@media (max-width: 400px) {
	body.xr-m .site-header__top { gap: 8px !important; }
	body.xr-m .language-switcher .xl-sw summary { padding: 0 9px 0 10px !important; }
}

/* Publisher profile (Advertise on <domain>): a long domain shrinks to fit the line instead of breaking
   mid-word ("businessinsider.co / m"). --xt-dl is the domain length (xxl-tools tool-advertise-on.php). */
@media (max-width: 760px) {
	body.xr-m .xt-h1 .xt-dom { font-size: min(1em, calc((100vw - 40px) / (var(--xt-dl, 10) * .6))); overflow-wrap: normal; word-break: normal; white-space: nowrap; }
}

/* Catalogue on phones: the first publishers show sooner.
   - The parent theme's steps, intro and help cards above the catalogue are left out (the help is in
     the menu, the chat and the feedback button).
   - The notes (price on request, XXL Points, links you already have) fold into one line; the toggle
     is added by site-catalog.js. */
@media (max-width: 760px) {
	body.xr-m:has(#xr-cat) .js-info-blocks { display: none !important; }
	body.xr-m .xr-cat-notes.is-folded > :not(.xr-notes-toggle) { display: none !important; }
	body.xr-m .xr-cat-notes > .xr-notes-toggle { display: flex !important; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin: 0; padding: 8px 12px !important; border: 0; background: #fff !important; color: var(--xr-ink, #1D2330); font: inherit; font-weight: 700; font-size: 14px !important; text-align: left; cursor: pointer; }
	body.xr-m .xr-notes-toggle b { min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--xr-paper-2, #FFF6DA); font-size: 12px; line-height: 20px; text-align: center; }
	body.xr-m .xr-notes-toggle i { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); opacity: .6; transition: transform .15s; }
	body.xr-m .xr-notes-toggle[aria-expanded="true"] i { transform: rotate(-135deg) translate(-2px, -2px); }
	body.xr-m .xr-notes-toggle:focus-visible { outline: 3px solid var(--xr-btn, #1F4E9C); outline-offset: -3px; }
	/* "Leave them out": input and button share the row instead of running past the card. */
	body.xr-m .xr-cat-notes form.xt-kl .xt-kl-f { display: flex; gap: 8px; width: 100%; min-width: 0; }
	body.xr-m .xr-cat-notes form.xt-kl input[name=xt_kl_site] { flex: 1 1 auto; min-width: 0; width: auto !important; }
	body.xr-m .xr-cat-notes form.xt-kl .xt-kl-f button { flex: none; white-space: nowrap; }
}

/* My account tables with cell labels (data-l, e.g. Projects): cards on phones instead of a table that
   runs off the card. data-lt is the translated label (xxl-tools i18n.php). */
@media (max-width: 600px) {
	body.xr-m .woocommerce-MyAccount-content :is(.oxxd-scroll, .table-wrapper):has(> .oxxd-tbl tbody td[data-l]) { overflow: visible !important; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) { display: block; width: 100% !important; min-width: 0 !important; border: 0 !important; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) thead { display: none; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) tbody { display: grid; gap: 10px; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) tr { display: block; padding: 12px 14px; border: 1px solid var(--xr-line, #EDE5D0); border-radius: 14px; background: #fff; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: auto !important; padding: 5px 0 !important; border: 0 !important; text-align: right; white-space: normal; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) td[data-l]::before { content: attr(data-l); flex: none; max-width: 45%; text-align: left; font-size: 12.5px; font-weight: 600; color: var(--xr-ink-2, #5B6472); }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) td[data-lt]::before { content: attr(data-lt); }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) td:first-child { display: block; text-align: left; padding-top: 0 !important; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) td:first-child::before { content: none; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) td:first-child small { display: block; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) td:not([data-l]) { justify-content: flex-start; padding-top: 10px !important; }
	body.xr-m .woocommerce-MyAccount-content .oxxd-tbl:has(tbody td[data-l]) td:not([data-l]):empty { display: none; }
}
