/**
 * Base document styles that theme.json cannot express.
 * Values come only from theme.json tokens (--wp--preset--*, --wp--custom--*).
 */

html {
	font-size: 100%; /* 1rem = 16px, keeps the user's browser setting. */
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizelegibility;

	/* Only the weights we ship exist; never fake bold or italic. */
	font-synthesis: none;
}

/*
 * The footer stays at the bottom of the screen: the page is at least one
 * screen high (minus the admin bar) and <main> takes the free space.
 */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-block-size: calc(100svh - var(--wp-admin--admin-bar--height, 0px));
}

.wp-site-blocks > main {
	flex-grow: 1;
}

/*
 * Font-size presets picked in the editor apply the whole text style
 * (family, weight, line height, letter spacing), like text styles in Figma.
 */
.has-heading-1-font-size {
	font-family: var(--wp--custom--text--heading-1--font-family);
	font-weight: var(--wp--custom--text--heading-1--font-weight);
	line-height: var(--wp--custom--text--heading-1--line-height);
	letter-spacing: var(--wp--custom--text--heading-1--letter-spacing);
}

.has-heading-2-font-size {
	font-family: var(--wp--custom--text--heading-2--font-family);
	font-weight: var(--wp--custom--text--heading-2--font-weight);
	line-height: var(--wp--custom--text--heading-2--line-height);
	letter-spacing: var(--wp--custom--text--heading-2--letter-spacing);
}

.has-heading-3-font-size {
	font-family: var(--wp--custom--text--heading-3--font-family);
	font-weight: var(--wp--custom--text--heading-3--font-weight);
	line-height: var(--wp--custom--text--heading-3--line-height);
	letter-spacing: var(--wp--custom--text--heading-3--letter-spacing);
}

.has-title-large-font-size {
	font-family: var(--wp--custom--text--title-large--font-family);
	font-weight: var(--wp--custom--text--title-large--font-weight);
	line-height: var(--wp--custom--text--title-large--line-height);
	letter-spacing: var(--wp--custom--text--title-large--letter-spacing);
}

.has-title-medium-font-size {
	font-family: var(--wp--custom--text--title-medium--font-family);
	font-weight: var(--wp--custom--text--title-medium--font-weight);
	line-height: var(--wp--custom--text--title-medium--line-height);
	letter-spacing: var(--wp--custom--text--title-medium--letter-spacing);
}

.has-body-large-font-size {
	font-family: var(--wp--custom--text--body-large--font-family);
	font-weight: var(--wp--custom--text--body-large--font-weight);
	line-height: var(--wp--custom--text--body-large--line-height);
	letter-spacing: var(--wp--custom--text--body-large--letter-spacing);
}

.has-body-medium-font-size {
	font-family: var(--wp--custom--text--body-medium--font-family);
	font-weight: var(--wp--custom--text--body-medium--font-weight);
	line-height: var(--wp--custom--text--body-medium--line-height);
	letter-spacing: var(--wp--custom--text--body-medium--letter-spacing);
}

.has-body-small-font-size {
	font-family: var(--wp--custom--text--body-small--font-family);
	font-weight: var(--wp--custom--text--body-small--font-weight);
	line-height: var(--wp--custom--text--body-small--line-height);
	letter-spacing: var(--wp--custom--text--body-small--letter-spacing);
}

.has-caption-font-size {
	font-family: var(--wp--custom--text--caption--font-family);
	font-weight: var(--wp--custom--text--caption--font-weight);
	line-height: var(--wp--custom--text--caption--line-height);
	letter-spacing: var(--wp--custom--text--caption--letter-spacing);
}

/*
 * Element button (core/button, WooCommerce blocks): states theme.json cannot
 * express. Base look = primary medium (theme.json styles.elements.button).
 * Same logical tokens as the .mk-button component in markiza-core.
 * :where() keeps Woo's transparent buttons (drawer close, outline, link) out.
 */
@media (hover: hover) {
	.wp-element-button:not(
			:where(
				.wc-block-components-drawer__close,
				.is-style-outline,
				.outlined,
				.is-link
			)
		):hover {
		background-color: var(--wp--custom--color--action--primary--hover);
		color: var(--wp--custom--color--text--on-action);
	}
}

.wp-element-button:not(
		:where(
			.wc-block-components-drawer__close,
			.is-style-outline,
			.outlined,
			.is-link
		)
	):active {
	background-color: var(--wp--custom--color--action--primary--active);
}

/* `body` outweighs Woo's `.wc-block-components-button:not(.is-link):disabled` opacity. */
body
	.wp-element-button:not(.is-link):is(
		:disabled,
		[aria-disabled="true"],
		.disabled
	) {
	background-color: var(--wp--custom--color--action--primary--disabled);
	color: var(--wp--custom--color--text--on-action);
	cursor: not-allowed;
	opacity: 1;
}
