/* Shared frontend/editor foundations. Tokens are owned by theme.json. */
:where(body, .editor-styles-wrapper) {
	overflow-wrap: break-word;
	text-rendering: optimizeLegibility;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(*, *::before, *::after) {
	box-sizing: border-box;
}

:where(.wp-site-blocks, .editor-styles-wrapper) ::selection {
	background: color-mix(in srgb, var(--wp--preset--color--primary) 14%, transparent);
	color: var(--wp--preset--color--dark);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
	box-shadow: 0 0 0 2px var(--wp--preset--color--white);
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(a) {
	text-underline-offset: 0.22em;
	text-decoration-thickness: 0.075em;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(p) {
	line-height: 1.85;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(h1, h2, h3, h4, h5, h6) {
	text-wrap: balance;
	letter-spacing: -0.012em;
}

:where(.wp-element-button, .wp-block-button__link) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	max-inline-size: 100%;
	min-block-size: 46px;
	transition:
		background-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		border-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		box-shadow var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		transform var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
}

:where(.wp-element-button, .wp-block-button__link):hover {
	transform: translateY(-1px);
	box-shadow: 0 10px 24px color-mix(in srgb, var(--wp--preset--color--primary) 18%, transparent);
}

:where(.wp-element-button, .wp-block-button__link):active {
	transform: translateY(0);
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]), select, textarea) {
	max-inline-size: 100%;
	min-block-size: 46px;
	padding-block: 0.72rem;
	padding-inline: var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--custom--border--input);
	border-radius: var(--wp--custom--radius--small);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--text);
	font: inherit;
	line-height: 1.5;
	box-shadow: 0 1px 0 color-mix(in srgb, var(--wp--preset--color--dark) 2%, transparent);
	transition:
		border-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		box-shadow var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]), select, textarea):hover {
	border-color: #927FA1;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input, textarea)::placeholder {
	color: var(--wp--custom--surface--muted);
	opacity: 0.78;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(input[type="email"], input[type="url"], input[type="tel"]) {
	direction: ltr;
	text-align: start;
}

/* Technical text keeps its own reading order inside Arabic prose. */
:where(.wp-site-blocks, .editor-styles-wrapper) :where(pre, code, kbd, samp) {
	direction: ltr;
	unicode-bidi: isolate;
	text-align: start;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(img, video) {
	max-inline-size: 100%;
	height: auto;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(p, li, figcaption) {
	overflow-wrap: anywhere;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(ul, ol) {
	padding-inline-start: var(--wp--preset--spacing--50);
	padding-inline-end: 0;
}

:where(.wp-site-blocks, .editor-styles-wrapper) :where(li + li) {
	margin-block-start: var(--wp--preset--spacing--20);
}

@media (max-width: 47.99rem) {
	:where(.wp-site-blocks, .editor-styles-wrapper) :where(p) {
		line-height: 1.8;
	}
}

@media (prefers-reduced-motion: reduce) {
	:where(.wp-element-button, .wp-block-button__link),
	:where(.wp-site-blocks, .editor-styles-wrapper) :where(input, select, textarea) {
		transition: none;
	}

	:where(.wp-element-button, .wp-block-button__link):hover {
		transform: none;
	}
}

/* Preserve legacy text tokens and presentation; CTA native color controls win. */
:root { --wp--preset--color--text: var(--wp--preset--color--body-text); }
.has-text-color:not(:where(.amp-cta-banner, .amp-cta-banner *)) { color: var(--wp--preset--color--text) !important; }
.has-text-background-color { background-color: var(--wp--preset--color--text) !important; }
.has-text-border-color { border-color: var(--wp--preset--color--text) !important; }