/*
 * Daphnée Opale — Confort mobile
 * Corrections ciblées : en-tête, zones tactiles, tableau tarifaire et débordements.
 */

body.daphnee-mobile-comfort {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body.daphnee-mobile-comfort :where(img, video, iframe, canvas, svg) {
	max-width: 100%;
}

body.daphnee-mobile-comfort :where(p, li, h1, h2, h3, h4, a, button) {
	overflow-wrap: break-word;
}

@media (max-width: 782px) {
	body.daphnee-mobile-comfort {
		overflow-x: clip;
	}

	/* Keep the logo and the three controls on one calm, compact row. */
	body.daphnee-mobile-comfort .site-header {
		display: grid !important;
		grid-template-columns: minmax(0, 1fr) 44px 44px 44px;
		align-items: center;
		gap: 4px !important;
		min-height: 68px;
		padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)) !important;
	}

	/* WordPress' mobile admin bar must not cover the public header while editing. */
	body.admin-bar.daphnee-mobile-comfort .site-header {
		top: 46px;
	}

	body.daphnee-mobile-comfort .site-header > .wp-block-site-title {
		min-width: 0;
		margin: 0;
		line-height: 1.1;
		white-space: nowrap;
	}

	body.daphnee-mobile-comfort .site-header > :where(
		.wp-block-navigation,
		.wp-block-woocommerce-customer-account,
		.wp-block-woocommerce-mini-cart
	) {
		width: 44px !important;
		min-width: 44px;
		margin: 0 !important;
		justify-self: center;
	}

	body.daphnee-mobile-comfort :where(
		.wp-block-navigation__responsive-container-open,
		.wp-block-navigation__responsive-container-close,
		.wc-block-customer-account__link,
		.wc-block-mini-cart__button
	) {
		display: grid;
		width: 44px !important;
		height: 44px !important;
		min-width: 44px;
		min-height: 44px;
		padding: 8px !important;
		place-items: center;
		border-radius: 999px;
		-webkit-tap-highlight-color: transparent;
	}

	body.daphnee-mobile-comfort .wc-block-customer-account__visual,
	body.daphnee-mobile-comfort .wc-block-customer-account__avatar {
		width: 28px !important;
		height: 28px !important;
	}

	body.daphnee-mobile-comfort .wp-block-navigation__responsive-container.is-menu-open {
		padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
	}

	body.daphnee-mobile-comfort .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		display: flex;
		align-items: center;
		min-height: 44px;
		padding-block: 8px;
	}

	/* Prevent iOS from zooming into fields and keep controls comfortable. */
	body.daphnee-mobile-comfort :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
		max-width: 100%;
		font-size: max(16px, 1em);
	}

	body.daphnee-mobile-comfort :where(main, .wp-site-blocks) :where(button, .wp-element-button, input[type="submit"]) {
		min-height: 44px;
	}

	/* Wide WordPress content remains reachable instead of being cut off. */
	body.daphnee-mobile-comfort :where(.wp-block-table, .woocommerce table.shop_table) {
		max-width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	body.daphnee-mobile-comfort :where(.wp-block-post-content, .entry-content, main) {
		min-width: 0;
		max-width: 100%;
	}

	body.daphnee-mobile-comfort :where(footer.wp-block-template-part, .wp-block-post-excerpt) a {
		display: inline-flex;
		align-items: center;
		min-height: 32px;
	}

	body.daphnee-mobile-comfort :where(h1, h2, h3, [id]) {
		scroll-margin-top: 84px;
	}
}

@media (max-width: 480px) {
	/* The three-column price table was clipped on 320 px screens. */
	body.daphnee-mobile-comfort .presta-table-wrapper {
		width: 100%;
		max-width: 100%;
		overflow: visible;
	}

	body.daphnee-mobile-comfort .presta-table {
		width: 100% !important;
		min-width: 0 !important;
		max-width: 100%;
		table-layout: fixed;
		font-size: 12px;
	}

	body.daphnee-mobile-comfort .presta-table :where(th, td) {
		width: auto !important;
		padding: 11px 5px !important;
		line-height: 1.35;
	}

	body.daphnee-mobile-comfort .presta-table th {
		font-size: 10px;
		letter-spacing: 0.06em;
	}

	body.daphnee-mobile-comfort .presta-table :where(th, td):first-child {
		width: 27% !important;
	}

	body.daphnee-mobile-comfort .presta-table :where(th, td):nth-child(2) {
		width: 36% !important;
	}

	body.daphnee-mobile-comfort .presta-table :where(th, td):nth-child(3) {
		width: 37% !important;
	}
}

@media (max-width: 340px) {
	body.daphnee-mobile-comfort .site-header > .wp-block-site-title {
		font-size: 1.2rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.daphnee-mobile-comfort {
	scroll-behavior: auto;
	}
}
