/*
 * The banner is a <dialog>. Opened as a modal it sits in the middle of the screen over a dimmed
 * page that does not scroll until a choice is made; on the policy pages it opens as a plain
 * panel at the bottom, so the policy can be read.
 */
.mm-consent {
	position: fixed;
	z-index: 9999;
	box-sizing: border-box;
	max-height: calc(100dvh - 2rem);
	margin: 0;
	padding: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	border: 1px solid var(--wp--preset--color--line-strong);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text);
}

.mm-consent:not([open]) {
	display: none;
}

.mm-consent:modal {
	inset: 0;
	width: min(36rem, calc(100% - 2rem));
	height: fit-content;
	margin: auto;
}

.mm-consent:not(:modal) {
	inset: auto 0 0;
	width: auto;
	max-width: none;
	max-height: 90dvh;
}

.mm-consent::backdrop {
	background: rgb(0 0 0 / 0.5);
}

/* The page under the modal keeps its scroll position and its width (no scrollbar jump). */
html:has(.mm-consent:modal) {
	overflow: hidden;
	scrollbar-gutter: stable;
}

.mm-consent__inner {
	position: relative;
	max-width: 82rem;
	margin-inline: auto;
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
}

.mm-consent__title {
	margin: 0 0 var(--wp--preset--spacing--20);
	font-size: var(--wp--preset--font-size--md);
	line-height: 1.25;
}

.mm-consent__text {
	margin: 0 0 var(--wp--preset--spacing--40);
	max-width: 70ch;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--text-2);
}

.mm-consent__text a {
	color: var(--wp--preset--color--accent);
}

.mm-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30);
	align-items: center;
}

.mm-consent__btn {
	min-height: 44px;
	padding: 0.7rem 1.3rem;
	font: inherit;
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 500;
	color: var(--wp--preset--color--on-accent);
	background: var(--wp--preset--color--accent);
	border: 1px solid var(--wp--preset--color--accent);
	border-radius: var(--wp--custom--radius);
	cursor: pointer;
}

.mm-consent__btn:hover {
	background: var(--wp--preset--color--accent-strong);
	border-color: var(--wp--preset--color--accent-strong);
}

.mm-consent__link {
	min-height: 44px;
	padding: 0.5rem 0.2rem;
	font: inherit;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--accent);
	background: none;
	border: 0;
	text-decoration: underline;
	cursor: pointer;
}

.mm-consent__close {
	position: absolute;
	top: var(--wp--preset--spacing--20);
	right: var(--wp--preset--spacing--20);
	min-width: 44px;
	min-height: 44px;
	font-size: var(--wp--preset--font-size--lg);
	line-height: 1;
	color: var(--wp--preset--color--text);
	background: none;
	border: 0;
	cursor: pointer;
}

.mm-consent__btn:focus-visible,
.mm-consent__link:focus-visible,
.mm-consent__close:focus-visible,
.mm-consent__title:focus-visible,
.mm-consent__option input:focus-visible + label {
	outline: var(--wp--custom--focus);
	outline-offset: 2px;
}

.mm-consent__options {
	display: grid;
	gap: var(--wp--preset--spacing--30);
	margin: 0 0 var(--wp--preset--spacing--40);
	padding: 0;
	border: 0;
}

.mm-consent__option {
	display: grid;
	grid-template-columns: 1.5rem 1fr;
	gap: var(--wp--preset--spacing--30);
	align-items: start;
}

.mm-consent__option input {
	width: 1.5rem;
	height: 1.5rem;
	margin: 0.1rem 0 0;
	accent-color: var(--wp--preset--color--accent);
}

.mm-consent__option label {
	display: grid;
	gap: var(--wp--preset--spacing--20);
	cursor: pointer;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--text-2);
}

.mm-consent__option strong {
	color: var(--wp--preset--color--text);
	font-weight: 500;
}

.mm-embed {
	display: grid;
	gap: var(--wp--preset--spacing--30);
	padding: var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius);
	background: var(--wp--preset--color--surface);
}

.mm-embed__note {
	margin: 0;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--text-2);
}

.mm-embed__load {
	min-height: 44px;
	justify-self: start;
	padding: 0.7rem 1.3rem;
	font: inherit;
	font-size: var(--wp--preset--font-size--sm);
	color: var(--wp--preset--color--on-accent);
	background: var(--wp--preset--color--accent);
	border: 1px solid var(--wp--preset--color--accent);
	border-radius: var(--wp--custom--radius);
	cursor: pointer;
}

.mm-embed iframe {
	width: 100%;
	border: 0;
}

/* Scoped to the banner: a global rule here used to hide the theme's skip link on focus. */
.mm-consent .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
