/*
 * Studio Base - minimal global CSS (loaded on the frontend and in the editor).
 *
 * Only things theme.json cannot express: focus rings, form controls,
 * reduced motion, small accessibility helpers. Uses theme.json custom
 * properties only - no hard-coded colors. Keep this file small (< 4 KB).
 */

/* ---------- Focus (WCAG 2.4.7 / 2.4.11) ---------- */
:where(.has-primary-background-color, .has-contrast-background-color, .is-style-section-primary, .is-style-section-contrast) {
	--wp--custom--focus--color: var(--wp--preset--color--base);
}
:where(.has-primary-background-color, .is-style-section-primary) {
	--wp--custom--focus--color: var(--wp--preset--color--primary-contrast);
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--custom--focus--color);
	outline-offset: var(--wp--custom--focus--offset);
}
:where(input, select, textarea):focus-visible {
	outline-offset: 0;
}

/* ---------- Form controls (search, lead form, comments) ---------- */
:where(input:not([type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="hidden"]), select, textarea) {
	box-sizing: border-box;
	width: 100%;
	min-height: var(--wp--custom--form--control-height);
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
	font: inherit;
	color: var(--wp--preset--color--contrast);
	background-color: var(--wp--preset--color--base);
	/* "muted" (not "border") so the control edge meets 3:1 non-text contrast (WCAG 1.4.11). */
	border: var(--wp--custom--border-width--thin) solid var(--wp--preset--color--muted);
	border-radius: var(--wp--custom--radius--small);
}
:where(textarea) {
	min-height: 8rem;
	resize: vertical;
}
:where(input[type="checkbox"], input[type="radio"]) {
	width: 1.125rem;
	height: 1.125rem;
	accent-color: var(--wp--preset--color--primary);
}
:where([aria-invalid="true"]) {
	border-color: var(--wp--preset--color--error);
	border-width: var(--wp--custom--border-width--thick);
}
.wp-block-search__input {
	min-height: var(--wp--custom--form--control-height);
}

/* ---------- Section rhythm ----------
 * Header, main and footer carry their own padding; full-width sections inside post content
 * carry their own padding too, so they stack edge to edge (no white bands between bands). */
body .wp-site-blocks > * + * {
	margin-block-start: 0;
}
.wp-block-post-content > .alignfull + .alignfull {
	margin-block-start: 0;
}

/* ---------- Disclosure (FAQ / core/details) ---------- */
.wp-block-details summary {
	cursor: pointer;
	font-weight: var(--wp--custom--font-weight--semibold);
}

/* ---------- Media ---------- */
img {
	max-width: 100%;
	height: auto;
}
.wp-block-image img,
.wp-block-media-text__media img {
	border-radius: inherit;
}

/* ---------- Helpers ---------- */
.screen-reader-text:not(:focus):not(:active) {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ---------- Motion (WCAG 2.3.3) ---------- */
@media (prefers-reduced-motion: no-preference) {
	:where(a, .wp-element-button, .wp-block-button__link) {
		transition: background-color var(--wp--custom--transition--fast), color var(--wp--custom--transition--fast), border-color var(--wp--custom--transition--fast);
	}
	html {
		scroll-behavior: smooth;
	}
}
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
