/**
 * Mobile responsive fixes
 *
 * Scoped to viewports up to 781px so desktop rendering is untouched.
 * Targets measured on 320 / 375 / 768px:
 *  - touch targets below the 44x44 minimum (WCAG 2.5.8, Apple HIG)
 *  - buttons with unequal widths inside one button group
 *  - body copy clamping down to 13.6px (the floor now sits in theme.json)
 */

@media (max-width: 781px) {

	/* --- Touch targets: navigation ------------------------------------ */

	.mobile-nav-trigger,
	.mobile-nav-close {
		min-width: 44px;
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	.mobile-nav-submenu-back {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		padding-inline: 4px;
	}

	/* --- Touch targets: slider controls -------------------------------- */
	/* The block stylesheets shrink these to 40px below 768 and 35px below 480,
	   which is the wrong direction for touch. The class is repeated to beat
	   their specificity without resorting to !important; the SVG inside keeps
	   the size the design intends. */

	.quote-slider.quote-slider .splide__arrow,
	.card-slider.card-slider .splide__arrow,
	.splide__arrow {
		width: 44px;
		height: 44px;
	}

	/* --- Touch targets: forms ------------------------------------------ */
	/* Gravity Forms sizes its buttons through its own custom properties, so
	   setting those is more reliable than overriding the rules themselves. */

	/* Set on the button itself: a value declared on the element wins over the
	   inherited one, so this does not depend on stylesheet load order. */
	.gform_wrapper .gform-theme-button,
	.gform_wrapper .button,
	.gform_wrapper input[type="submit"] {
		--gf-ctrl-btn-size: 48px;
		--gf-ctrl-btn-size-sm: 48px;
		--gf-ctrl-btn-size-md: 48px;
	}

	.gform_wrapper .gform-theme-button,
	.gform_wrapper input[type="submit"],
	.gform_wrapper .button {
		min-height: 48px;
		width: 100%;
	}

	.gform_wrapper.gform_wrapper .gform_page_footer .gform-theme-button,
	.gform_wrapper.gform_wrapper .gform_next_button,
	.gform_wrapper.gform_wrapper .gform_previous_button {
		width: auto;
		min-width: 44%;
		min-height: 48px;
	}

	/* --- Touch targets: social icons ------------------------------------ */

	.wp-block-social-links .wp-block-social-link {
		min-width: 44px;
		min-height: 44px;
	}

	.wp-block-social-links .wp-block-social-link-anchor {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: 44px;
	}

	.gform_wrapper input[type="text"],
	.gform_wrapper input[type="email"],
	.gform_wrapper input[type="tel"],
	.gform_wrapper select,
	.gform_wrapper textarea {
		min-height: 48px;
		font-size: 16px; /* stops iOS Safari zooming in on focus */
	}

	/* --- Touch targets: inline contact links ---------------------------- */
	/* Vertical padding on an inline element grows the hit area without
	   changing the line box, so the footer layout stays as it is. */

	a[href^="tel:"],
	a[href^="mailto:"] {
		padding-block: 0.8rem;
	}

	/* --- Touch targets: logo link --------------------------------------- */

	.custom-logo-link {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
	}

	/* --- Touch targets: vertical (footer) navigation --------------------- */
	/* Links are 21px tall with a 24px gap between them. Moving that 24px from
	   the gap into the link's own padding grows the tap area to 45px while the
	   spacing between items stays exactly the same. */

	.wp-block-navigation.is-vertical > .wp-block-navigation__container {
		gap: 0;
	}

	.wp-block-navigation.is-vertical .wp-block-navigation-item__content {
		display: block;
		padding-block: 12px;
	}

	/* --- Buttons: equal width inside one group -------------------------- */

	.wp-block-buttons:not(.is-nowrap) {
		gap: 0.75rem;
	}

	.wp-block-buttons:not(.is-nowrap) > .wp-block-button {
		width: 100%;
	}

	.wp-block-buttons:not(.is-nowrap) > .wp-block-button .wp-block-button__link {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: 48px;
		text-align: center;
	}

	/* --- Spacing presets: scale down on mobile -------------------------- */
	/* theme.json clamps these to a fixed value (e.g. clamp(64px, 7.5vw, 64px)),
	   so a block with 64px side padding leaves only ~264px for text on a
	   412px phone. Redefining the presets here only affects viewports up to
	   781px; desktop and tablet keep the theme.json values. Blocks with their
	   own mobile padding (variable-spacing snippet) are unaffected. Set on
	   body rather than :root so it does not depend on the order in which the
	   global-styles CSS is printed. */

	body {
		--wp--preset--spacing--40: clamp(24px, 6vw, 40px);
		--wp--preset--spacing--60: clamp(32px, 7.5vw, 60px);
		--wp--preset--spacing--64: clamp(32px, 7.5vw, 64px);
		--wp--preset--spacing--76: clamp(40px, 9vw, 76px);
		--wp--preset--spacing--80: clamp(40px, 9vw, 80px);
		--wp--preset--spacing--96: clamp(48px, 10vw, 96px);
		--wp--preset--spacing--100: clamp(48px, 10vw, 100px);
		--wp--preset--spacing--120: clamp(56px, 12vw, 120px);
		--wp--preset--spacing--160: clamp(64px, 14vw, 160px);
	}

	/* Note: hero padding on mobile is NOT set here. The variable-spacing
	   snippet writes --sv-mobile-padding-* as an inline style per block, set
	   in the Site Editor. Overriding that from a stylesheet would need
	   !important and would flatten the intentional per-block spacing across
	   every cover block on the site. Adjust it on the block instead. */
}
