/* Stadbeat Mobile & App — filet de sécurité adaptatif.
 * Sélecteurs à faible priorité (:where) : le thème et les constructeurs de pages gardent la main sur leur design,
 * ce fichier ne comble que ce qui déborde ou devient illisible sur petit écran. */

:where(html) { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
:where(*, *::before, *::after) { box-sizing: border-box; }
:where(body) { overflow-wrap: break-word; -webkit-tap-highlight-color: transparent; }

/* Aucun défilement horizontal de la page (sans casser les éléments « sticky »). */
html, body.sbmo { max-width: 100%; overflow-x: clip; }
@supports not (overflow: clip) { html, body.sbmo { overflow-x: hidden; } }

/* Médias fluides */
:where(img, video, canvas, svg, picture, embed, object) { max-width: 100%; }
:where(img, video) { height: auto; }
:where(iframe) { max-width: 100%; border: 0; }
:where(iframe[src*="youtube"], iframe[src*="youtu.be"], iframe[src*="vimeo"], iframe[src*="dailymotion"]) { width: 100%; height: auto; aspect-ratio: 16 / 9; }
:where(figure) { max-width: 100%; margin-inline: 0; }

/* Texte long, code, tableaux */
:where(h1, h2, h3, h4, h5, h6, p, li, td, th, a, label, button, span, div) { hyphens: none; -webkit-hyphens: none; overflow-wrap: break-word; word-break: normal; }
:where(a, td, th) { overflow-wrap: anywhere; }
:where(h1, h2, h3, h4, h5, h6, blockquote, figcaption) { text-wrap: balance; }
:where(p, li, dd, label) { text-wrap: pretty; }
body.sbmo-nohyphen, body.sbmo-nohyphen * { hyphens: none !important; -webkit-hyphens: none !important; -ms-hyphens: none !important; }
body.sbmo-nohyphen .sbmo-nb { white-space: nowrap; }
/* Jamais de mot coupé : un mot qui ne tient pas sur la ligne passe entier à la ligne suivante (quel que soit le thème). */
html body.sbmo-nohyphen, html body.sbmo-nohyphen * { word-break: normal !important; overflow-wrap: normal !important; line-break: auto !important; hyphenate-character: none; }
html body.sbmo-nohyphen :is(a[href^="mailto:"], a[href^="http"], code, pre, input, textarea) { overflow-wrap: anywhere !important; }
body.sbmo-nohyphen :is(h1, h2, h3, h4, h5, h6) { text-wrap: balance; }
body.sbmo-nohyphen :is(p, li, dd, label) { text-wrap: pretty; }
/* Compte client : l'en-tête du site est masqué (ordinateur, tablette, téléphone). */
body.sbmo-account-clean :is(#ssb-header, .ssb-header, #masthead, .site-header, header.site-header, .solace-header, .main-header) { display: none !important; }
body.sbmo-account-clean { padding-top: 0 !important; margin-top: 0 !important; }
:where(pre) { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sbmo-table { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-block: 1em; }
.sbmo-table:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.sbmo-table > table { margin-block: 0; min-width: 32rem; }
:where(.wp-block-table, .woocommerce-cart-form, .woocommerce table.shop_table_responsive) { max-width: 100%; }
.wp-block-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Encoches et barres du téléphone (mode application) */
@supports (padding: max(0px)) {
	body.sbmo { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
	@media (display-mode: standalone), (display-mode: fullscreen) {
		body.sbmo { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
	}
}

/* Écrans tactiles : cibles de 44 px et champs de 16 px (évite le zoom automatique d'iOS) */
@media (pointer: coarse) {
	:where(button, [type="button"], [type="submit"], [type="reset"], .button, .wp-block-button__link) { min-height: 44px; }
	:where(nav a, .menu a, .menu-item > a, .page-numbers, summary) { display: inline-block; min-height: 44px; padding-block: 0.5rem; }
}
@media (max-width: 782px) {
	:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { font-size: 16px; max-width: 100%; }
	:where(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], select, textarea) { width: 100%; }
	:where(.alignwide, .alignfull) { max-width: 100vw; }
	:where(.wp-block-columns) { flex-wrap: wrap !important; }
	:where(.wp-block-columns > .wp-block-column) { flex-basis: 100% !important; }
	:where(.wp-block-buttons) { gap: 0.75rem; }
}

/* WooCommerce : tableaux empilés lisibles sur téléphone */
@media (max-width: 640px) {
	.woocommerce table.shop_table_responsive tr, .woocommerce-page table.shop_table_responsive tr { display: block; }
	.woocommerce table.shop_table_responsive tr td, .woocommerce-page table.shop_table_responsive tr td { display: block; text-align: right; }
	.woocommerce ul.products[class*="columns-"] li.product { width: 48%; }
}

/* Mouvement réduit */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: 0.01ms !important; } }

/* Bouton d'installation et messages de l'application */
.sbmo-install { position: fixed; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 99998; display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 0; border-radius: 999px; font: 700 15px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #0a0a0a; background: var(--sbmo-accent, #ffcc03); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); cursor: pointer; }
.sbmo-install.is-right { right: max(16px, env(safe-area-inset-right)); }
.sbmo-install.is-left { left: max(16px, env(safe-area-inset-left)); }
.sbmo-install[hidden], .sbmo-install-inline[hidden] { display: none !important; }
.sbmo-install-inline { min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px; font-weight: 700; color: #0a0a0a; background: var(--sbmo-accent, #ffcc03); cursor: pointer; }
.sbmo-sheet { position: fixed; inset: auto 0 0 0; z-index: 99999; padding: 20px 20px max(20px, env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; color: #f4f4f5; background: #18181b; box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.sbmo-sheet h2 { margin: 0 0 6px; font-size: 1.1rem; color: inherit; }
.sbmo-sheet p { margin: 0 0 14px; color: #d4d4d8; }
.sbmo-sheet button { min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px; font: inherit; font-weight: 700; color: #0a0a0a; background: var(--sbmo-accent, #ffcc03); cursor: pointer; }
.sbmo-toast { position: fixed; left: 50%; bottom: max(80px, env(safe-area-inset-bottom)); z-index: 99999; transform: translateX(-50%); padding: 10px 18px; border-radius: 999px; color: #f4f4f5; background: #18181b; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); font: 600 14px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.sbmo-debug-outline { outline: 2px solid #ff3b30 !important; }
