/*
 * MarginReveal design primitives.
 * Palette, typography and spacing presets are owned by theme.json.
 */

body:not(.mr-menu-profit-control-surface) :where(a, button, input, select, textarea, summary):focus-visible,
.mr-app-header :where(a, button):focus-visible {
	outline: var(--wp--custom--focus--ring-width, 3px) solid var(--wp--preset--color--focus-ring, #9c5f8c);
	outline-offset: 3px;
}

/* Buttons and text links. */
.wp-block-button.is-style-mr-primary > .wp-block-button__link,
.mr-button-primary {
	display: inline-flex;
	min-height: 2.875rem;
	align-items: center;
	justify-content: center;
	padding: 0.6875rem 1.0625rem;
	border: 1px solid var(--wp--preset--color--action, #6b3b5e);
	border-radius: var(--wp--custom--radius--button, 0.4375rem);
	background: var(--wp--preset--color--action, #6b3b5e);
	color: var(--wp--preset--color--text-inverse, #f6f1f4);
	font-size: var(--wp--preset--font-size--caption, 0.75rem);
	font-weight: 800;
	line-height: 1;
	text-decoration: none;
}

.wp-block-button.is-style-mr-primary > .wp-block-button__link:hover,
.mr-button-primary:hover {
	border-color: var(--wp--preset--color--action-hover, #55304b);
	background: var(--wp--preset--color--action-hover, #55304b);
	color: var(--wp--preset--color--text-inverse, #f6f1f4);
}

.wp-block-button.is-style-mr-primary > .wp-block-button__link:active,
.mr-button-primary:active {
	border-color: var(--wp--preset--color--brand-primary-active, #3e2337);
	background: var(--wp--preset--color--brand-primary-active, #3e2337);
}

.wp-block-button.is-style-mr-secondary > .wp-block-button__link,
.mr-button-secondary {
	display: inline-flex;
	min-height: 2.875rem;
	align-items: center;
	justify-content: center;
	padding: 0.6875rem 1.0625rem;
	border: 1px solid var(--wp--preset--color--brand-primary, #6b3b5e);
	border-radius: var(--wp--custom--radius--button, 0.4375rem);
	background: transparent;
	color: var(--wp--preset--color--brand-primary, #6b3b5e);
	font-size: var(--wp--preset--font-size--caption, 0.75rem);
	font-weight: 800;
	line-height: 1;
	text-decoration: none;
}

.wp-block-button.is-style-mr-secondary > .wp-block-button__link:hover,
.mr-button-secondary:hover {
	border-color: var(--wp--preset--color--brand-primary-hover, #55304b);
	background: var(--wp--preset--color--surface-subtle, #f1eae8);
	color: var(--wp--preset--color--brand-primary-hover, #55304b);
}

.wp-block-button.is-style-mr-text > .wp-block-button__link,
.mr-text-link {
	display: inline-flex;
	min-height: 2.75rem;
	align-items: center;
	border: 0;
	border-radius: var(--wp--custom--radius--small, 0.25rem);
	background: transparent;
	color: var(--wp--preset--color--link, #6b3b5e);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
	line-height: 1.25;
	text-decoration-line: underline;
	text-decoration-thickness: 0.1em;
	text-underline-offset: 0.22em;
}

.wp-block-button.is-style-mr-text > .wp-block-button__link {
	padding-inline: 0;
}

.wp-block-button.is-style-mr-text > .wp-block-button__link:hover,
.mr-text-link:hover {
	background: transparent;
	color: var(--wp--preset--color--brand-primary-hover, #55304b);
}

/* Editorial hierarchy. */
.wp-block-paragraph.is-style-mr-lead,
.is-style-mr-lead {
	max-width: 64ch;
	color: var(--wp--preset--color--text-secondary, #6b6058);
	font-size: var(--wp--preset--font-size--lead, 1.125rem);
	line-height: 1.65;
}

.wp-block-paragraph.is-style-mr-eyebrow,
.mr-eyebrow {
	margin-block-end: var(--wp--preset--spacing--30, 0.75rem);
	color: var(--wp--preset--color--brand-primary, #6b3b5e);
	font-size: var(--wp--preset--font-size--caption, 0.75rem);
	font-weight: 800;
	letter-spacing: 0.11em;
	line-height: 1.3;
	text-transform: uppercase;
}

.wp-block-heading.is-style-mr-section-heading,
.mr-section-heading {
	max-width: 22ch;
	margin-block-start: 0;
	text-wrap: balance;
}

body:not(.mr-menu-profit-control-surface) :where(.wp-block-post-content, .entry-content) > :where(h2, h3, h4, h5, h6) + * {
	margin-block-start: 0;
}

body:not(.mr-menu-profit-control-surface) .wp-block-quote {
	margin-inline: 0;
	padding: 0.375rem 0 0.375rem 1.625rem;
	border: 0;
	border-inline-start: 4px solid var(--wp--preset--color--brand-primary, #6b3b5e);
	background: transparent;
	color: var(--wp--preset--color--text-primary, #1a1410);
}

body:not(.mr-menu-profit-control-surface) :where(.wp-block-post-content, .entry-content) :where(ul, ol) {
	padding-inline-start: 1.4em;
}

body:not(.mr-menu-profit-control-surface) :where(.wp-block-post-content, .entry-content) li::marker {
	color: var(--wp--preset--color--brand-primary, #6b3b5e);
	font-weight: 700;
}

/* Layout primitives. */
.wp-block-group.is-style-mr-container,
.mr-container {
	box-sizing: border-box;
	width: 100%;
	max-width: calc(var(--wp--style--global--wide-size, 1280px) + (2 * var(--wp--custom--layout--gutter, 2rem)));
	margin-inline: auto;
	padding-inline: var(--wp--custom--layout--gutter, clamp(1rem, 4vw, 3rem));
}

.wp-block-group.is-style-mr-reading-container,
.mr-reading-container {
	box-sizing: border-box;
	width: 100%;
	max-width: calc(var(--wp--custom--layout--reading-measure, 47.5rem) + (2 * var(--wp--custom--layout--gutter, 2rem)));
	margin-inline: auto;
	padding-inline: var(--wp--custom--layout--gutter, clamp(1rem, 4vw, 3rem));
}

.wp-block-group.is-style-mr-content-section,
.mr-content-section {
	box-sizing: border-box;
	width: 100%;
	padding-block: var(--wp--custom--layout--section-spacing, clamp(4rem, 8vw, 7rem));
	padding-inline: var(--wp--custom--layout--gutter, clamp(1rem, 4vw, 3rem));
}

.wp-block-group.is-style-mr-card,
.mr-card {
	box-sizing: border-box;
	padding: 1.75rem;
	border: 1px solid var(--wp--preset--color--border, #e4dad3);
	border-radius: var(--wp--custom--radius--button, 0.4375rem);
	background: var(--wp--preset--color--surface, #ffffff);
	color: var(--wp--preset--color--text-primary, #1a1410);
}

.wp-block-group.is-style-mr-dark-section,
.mr-dark-section {
	box-sizing: border-box;
	padding-block: var(--wp--custom--layout--section-spacing, clamp(4rem, 8vw, 7rem));
	padding-inline: var(--wp--custom--layout--gutter, clamp(1rem, 4vw, 3rem));
	background: var(--wp--preset--color--dark-background, #1e1720);
	color: var(--wp--preset--color--dark-text-primary, #f6f1f4);
}

:is(.wp-block-group.is-style-mr-dark-section, .mr-dark-section) :is(h1, h2, h3, h4, h5, h6) {
	color: var(--wp--preset--color--dark-text-primary, #f6f1f4);
}

:where(.wp-block-group.is-style-mr-dark-section, .mr-dark-section) a:not(.wp-block-button__link) {
	color: var(--wp--preset--color--dark-text-secondary, #c3b7c1);
}

:where(.wp-block-group.is-style-mr-dark-section, .mr-dark-section) a:not(.wp-block-button__link):hover {
	color: var(--wp--preset--color--dark-text-primary, #f6f1f4);
}

:where(.wp-block-group.is-style-mr-dark-section, .mr-dark-section) .mr-muted {
	color: var(--wp--preset--color--dark-text-secondary, #c3b7c1);
}

/* Badges and status. Labels remain mandatory; color is supplementary. */
:where(
	.wp-block-paragraph.is-style-mr-badge-neutral,
	.wp-block-paragraph.is-style-mr-badge-positive,
	.wp-block-paragraph.is-style-mr-badge-watch,
	.wp-block-paragraph.is-style-mr-badge-critical,
	.wp-block-paragraph.is-style-mr-badge-info,
	.mr-badge
) {
	display: inline-flex;
	max-width: 100%;
	align-items: center;
	padding: 0.25rem 0.625rem;
	border: 1px solid currentcolor;
	border-radius: var(--wp--custom--radius--pill, 999px);
	background: var(--wp--preset--color--neutral-background, #eef0f2);
	font-size: var(--wp--preset--font-size--caption, 0.75rem);
	font-weight: 800;
	letter-spacing: 0.035em;
	line-height: 1.25;
}

.wp-block-paragraph.is-style-mr-badge-neutral,
.mr-badge--neutral {
	color: var(--wp--preset--color--neutral, #59636e);
}

.wp-block-paragraph.is-style-mr-badge-positive,
.mr-badge--positive {
	background: var(--wp--preset--color--positive-background, #e7f4ee);
	color: var(--wp--preset--color--positive, #146b3b);
}

.wp-block-paragraph.is-style-mr-badge-watch,
.mr-badge--watch {
	background: var(--wp--preset--color--warning-background, #fff3d6);
	color: var(--wp--preset--color--warning, #8a5200);
}

.wp-block-paragraph.is-style-mr-badge-critical,
.mr-badge--critical {
	background: var(--wp--preset--color--critical-background, #fdecea);
	color: var(--wp--preset--color--critical, #9b1c1c);
}

.wp-block-paragraph.is-style-mr-badge-info,
.mr-badge--info {
	background: var(--wp--preset--color--information-background, #eaf0fb);
	color: var(--wp--preset--color--informational, #2458a6);
}

/* Notices. */
:where(
	.wp-block-group.is-style-mr-notice-neutral,
	.wp-block-group.is-style-mr-notice-positive,
	.wp-block-group.is-style-mr-notice-watch,
	.wp-block-group.is-style-mr-notice-critical,
	.wp-block-group.is-style-mr-notice-info,
	.mr-notice
) {
	box-sizing: border-box;
	padding: var(--wp--preset--spacing--50, 1.5rem);
	border: 1px solid var(--wp--preset--color--border, #e4dad3);
	border-inline-start: 4px solid var(--mr-notice-accent, var(--wp--preset--color--neutral, #59636e));
	border-radius: var(--wp--custom--radius--small, 0.25rem);
	background: var(--wp--preset--color--neutral-background, #eef0f2);
	color: var(--wp--preset--color--text-primary, #1a1410);
}

.wp-block-group.is-style-mr-notice-positive,
.mr-notice--positive {
	--mr-notice-accent: var(--wp--preset--color--positive, #146b3b);
	background: var(--wp--preset--color--positive-background, #e7f4ee);
}

.wp-block-group.is-style-mr-notice-watch,
.mr-notice--watch {
	--mr-notice-accent: var(--wp--preset--color--warning, #8a5200);
	background: var(--wp--preset--color--warning-background, #fff3d6);
}

.wp-block-group.is-style-mr-notice-critical,
.mr-notice--critical {
	--mr-notice-accent: var(--wp--preset--color--critical, #9b1c1c);
	background: var(--wp--preset--color--critical-background, #fdecea);
}

.wp-block-group.is-style-mr-notice-info,
.mr-notice--info {
	--mr-notice-accent: var(--wp--preset--color--informational, #2458a6);
	background: var(--wp--preset--color--information-background, #eaf0fb);
}

/* Basic data tables. */
.wp-block-table.is-style-mr-data-table,
.mr-table-wrap {
	width: 100%;
	margin-inline: 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--wp--preset--color--border, #e4dad3);
	border-radius: var(--wp--custom--radius--button, 0.4375rem);
	background: var(--wp--preset--color--surface, #ffffff);
}

.wp-block-table.is-style-mr-data-table table,
.mr-table {
	width: 100%;
	min-width: 40rem;
	border: 0;
	border-collapse: collapse;
	color: var(--wp--preset--color--text-primary, #1a1410);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-variant-numeric: tabular-nums;
}

:where(.wp-block-table.is-style-mr-data-table table, .mr-table) :where(th, td) {
	padding: 0.875rem 1rem;
	border: 0;
	border-block-end: 1px solid var(--wp--preset--color--border, #e4dad3);
	text-align: start;
	vertical-align: middle;
}

:where(.wp-block-table.is-style-mr-data-table table, .mr-table) th {
	background: var(--wp--preset--color--surface-subtle, #f1eae8);
	color: var(--wp--preset--color--text-secondary, #6b6058);
	font-weight: 700;
	letter-spacing: 0.02em;
}

:where(.wp-block-table.is-style-mr-data-table table, .mr-table) tbody tr:last-child td {
	border-block-end: 0;
}

.wp-block-table.is-style-mr-data-table figcaption {
	padding: var(--wp--preset--spacing--30, 0.75rem) var(--wp--preset--spacing--40, 1rem);
	color: var(--wp--preset--color--text-secondary, #6b6058);
	text-align: start;
}

/* Explicitly opt-in form primitive. */
.mr-form {
	color: var(--wp--preset--color--text-primary, #1a1410);
}

.mr-form :where(label, .mr-field-label, legend) {
	display: block;
	margin-block-end: var(--wp--preset--spacing--20, 0.5rem);
	color: var(--wp--preset--color--text-primary, #1a1410);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
	line-height: 1.4;
}

.mr-form :where(input:not([type="button"]):not([type="checkbox"]):not([type="radio"]):not([type="reset"]):not([type="submit"]), select, textarea) {
	box-sizing: border-box;
	width: 100%;
	min-height: 2.875rem;
	padding: 0.6875rem 0.875rem;
	border: 1px solid var(--wp--preset--color--text-secondary, #6b6058);
	border-radius: var(--wp--custom--radius--button, 0.4375rem);
	background: var(--wp--preset--color--surface, #ffffff);
	color: var(--wp--preset--color--text-primary, #1a1410);
	font: inherit;
	line-height: 1.4;
}

.mr-form textarea {
	min-height: 8rem;
	resize: vertical;
}

.mr-form :where(input, select, textarea)::placeholder {
	color: var(--wp--preset--color--text-secondary, #6b6058);
	opacity: 1;
}

.mr-form :where(input, select, textarea):focus-visible {
	border-color: var(--wp--preset--color--focus-ring, #9c5f8c);
	outline: var(--wp--custom--focus--ring-width, 3px) solid var(--wp--custom--focus--ring-color, #9c5f8c);
	outline-offset: 1px;
}

.mr-form :where(input, select, textarea)[aria-invalid="true"] {
	border-color: var(--wp--preset--color--critical, #9b1c1c);
}

.mr-form :where(input, select, textarea):disabled {
	cursor: not-allowed;
	background: var(--wp--preset--color--surface-subtle, #f1eae8);
	color: var(--wp--preset--color--text-secondary, #6b6058);
}

.mr-form :where(input[type="checkbox"], input[type="radio"]) {
	width: 1.125rem;
	height: 1.125rem;
	accent-color: var(--wp--preset--color--action, #6b3b5e);
}

.mr-field {
	margin-block-end: var(--wp--preset--spacing--50, 1.5rem);
}

.mr-field-help,
.mr-form-hint {
	margin-block-start: var(--wp--preset--spacing--20, 0.5rem);
	color: var(--wp--preset--color--text-secondary, #6b6058);
	font-size: var(--wp--preset--font-size--caption, 0.75rem);
}

.mr-field-error {
	margin-block-start: var(--wp--preset--spacing--20, 0.5rem);
	color: var(--wp--preset--color--critical, #9b1c1c);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
}

.mr-form-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30, 0.75rem);
	align-items: center;
}

@media (max-width: 37.5rem) {
	.mr-form-actions > * {
		width: 100%;
	}

	.wp-block-button.is-style-mr-primary,
	.wp-block-button.is-style-mr-secondary {
		width: 100%;
	}

	.wp-block-button.is-style-mr-primary > .wp-block-button__link,
	.wp-block-button.is-style-mr-secondary > .wp-block-button__link {
		width: 100%;
	}
}

@media (forced-colors: active) {
	:where(.wp-block-button__link, .mr-button-primary, .mr-button-secondary, .mr-text-link) {
		border: 2px solid currentcolor;
	}

	:where(.mr-badge, [class*="is-style-mr-badge-"]) {
		border: 1px solid currentcolor;
	}
}
