/* Reusable page modals. */
html.gw-modal-open {
	overflow: hidden;
}

body.gw-modal-open {
	/* Unlike hidden, clip does not create a new scroll container for the sticky header. */
	overflow: clip;
	padding-inline-end: var(--gw-modal-scrollbar-width, 0);
}

.gw-modal-root[hidden] {
	display: none;
}

.gw-modal-root {
	--gw-modal-accent: var(--wp--preset--color--primary, #17679a);
	--gw-modal-surface: #fff;
	--gw-modal-text: #1f2933;
	--gw-modal-header-background: var(--gw-modal-accent);
	--gw-modal-header-color: #fff;
	--gw-modal-border: #d8e0dc;
	--gw-modal-actions-background: #f5f7f6;
	--gw-modal-focus: #2271b1;
	--gw-modal-duration: 280ms;
	--gw-modal-fast: 160ms;
	--gw-modal-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
	--gw-modal-max-width: 680px;
	font: inherit;
	align-items: center;
	box-sizing: border-box;
	display: flex;
	inset: 0;
	justify-content: center;
	padding: clamp(1rem, 4vw, 2rem);
	position: fixed;
	z-index: 2147483020;
}

.gw-modal-backdrop {
	background: rgba(3, 17, 28, 0.78);
	backdrop-filter: blur(4px);
	inset: 0;
	opacity: 0;
	position: absolute;
	transition: opacity var(--gw-modal-duration) var(--gw-modal-ease);
}

.gw-modal-dialog {
	background: var(--gw-modal-surface);
	border: 1px solid rgba(255, 255, 255, 0.7);
	border-radius: 18px;
	box-shadow: 0 28px 80px rgba(3, 17, 28, 0.32);
	box-sizing: border-box;
	max-height: calc(100vh - 2rem);
	max-height: calc(100dvh - 2rem);
	max-width: var(--gw-modal-max-width);
	opacity: 0;
	overflow: auto;
	overscroll-behavior: contain;
	position: relative;
	transform: translateY(18px) scale(0.985);
	transition: opacity var(--gw-modal-duration) var(--gw-modal-ease), transform var(--gw-modal-duration) var(--gw-modal-ease);
	width: 100%;
	z-index: 1;
}

.gw-modal-root.is-open .gw-modal-backdrop,
.gw-modal-root.is-open .gw-modal-dialog {
	opacity: 1;
}

.gw-modal-root.is-open .gw-modal-dialog {
	transform: translateY(0) scale(1);
}

.gw-modal-dialog__heading {
	align-items: center;
	background: var(--gw-modal-header-background);
	border-bottom: 3px solid var(--gw-modal-accent);
	display: flex;
	gap: 1.5rem;
	justify-content: space-between;
	min-height: clamp(4.5rem, 8vw, 5.5rem);
	padding: clamp(1.35rem, 4vw, 2rem) clamp(1.35rem, 4vw, 2rem) 1.15rem;
	position: sticky;
	top: 0;
	z-index: 2;
}

.gw-modal-dialog__heading.is-close-only {
	justify-content: flex-end;
	padding-block: 0.9rem;
}

.gw-modal-dialog__heading.is-empty {
	padding-block: 1rem;
}

.gw-modal-dialog__heading h2 {
	color: var(--gw-modal-header-color);
	font-size: clamp(1.55rem, 4vw, 2.25rem);
	line-height: 1.12;
	margin: 0;
}

.gw-modal-dialog__close {
	align-items: center;
	appearance: none;
	background: transparent;
	border: 2px solid rgba(255, 255, 255, 0.62);
	border-radius: 9px;
	color: var(--gw-modal-header-color);
	cursor: pointer;
	display: inline-flex;
	flex: 0 0 38px;
	height: 38px;
	justify-content: center;
	padding: 0;
	position: relative;
	transition: background-color var(--gw-modal-fast) ease, border-color var(--gw-modal-fast) ease, color var(--gw-modal-fast) ease;
	width: 38px;
}

.gw-modal-dialog__close::after {
	content: "";
	inset: -3px;
	position: absolute;
}

.gw-modal-dialog__close svg {
	fill: none;
	height: 16px;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-width: 2;
	width: 16px;
}

.gw-modal-dialog__close:hover,
.gw-modal-dialog__close:focus-visible {
	background: var(--gw-modal-accent);
	border-color: var(--gw-modal-accent);
	color: var(--gw-modal-header-color);
}

.gw-modal-dialog__close--floating {
	background: var(--gw-modal-surface);
	border-color: var(--gw-modal-border);
	color: var(--gw-modal-text);
	position: absolute;
	right: 1rem;
	top: 1rem;
	z-index: 3;
}

.gw-modal-dialog.has-floating-close .gw-modal-dialog__content {
	padding-inline-end: clamp(4.5rem, 10vw, 5.25rem);
}

.gw-modal-dialog__close:focus-visible,
.gw-modal-dialog__button:focus-visible {
	outline: 3px solid var(--gw-modal-focus);
	outline-offset: 3px;
}

.gw-modal-dialog__content {
	color: var(--gw-modal-text);
	font-size: 1rem;
	line-height: 1.65;
	padding: clamp(1.35rem, 4vw, 2rem);
}

.gw-modal-dialog__content > :first-child {
	margin-top: 0;
}

.gw-modal-dialog__content > :last-child {
	margin-bottom: 0;
}

.gw-modal-dialog__content a {
	font-weight: 650;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

.gw-modal-dialog__content img {
	height: auto;
	max-width: 100%;
}

.gw-modal-dialog__actions {
	background: var(--gw-modal-actions-background);
	border-top: 1px solid var(--gw-modal-border);
	display: flex;
	justify-content: flex-end;
	padding: 1.15rem clamp(1.35rem, 4vw, 2rem) clamp(1.35rem, 4vw, 2rem);
}

.gw-modal-dialog__button {
	appearance: none;
	background: var(--gw-modal-accent);
	border: 2px solid var(--gw-modal-accent);
	border-radius: 8px;
	color: var(--gw-modal-header-color);
	cursor: pointer;
	font: inherit;
	font-weight: 700;
	min-height: 48px;
	padding: 0.7rem 1.3rem;
	transition: background-color var(--gw-modal-fast) ease, border-color var(--gw-modal-fast) ease;
}

.gw-modal-dialog__button:hover,
.gw-modal-dialog__button:focus-visible {
	background: var(--gw-modal-accent);
	border-color: var(--gw-modal-accent);
	color: var(--gw-modal-header-color);
}

.gw-modal-editor-placeholder {
	background: #f0f6fc;
	border: 1px dashed #72aee6;
	border-radius: 6px;
	color: #1d2327;
	font-family: sans-serif;
	font-size: 13px;
	line-height: 1.45;
	padding: 12px 14px;
}

.gw-modal-editor-placeholder code {
	overflow-wrap: anywhere;
}

@media (max-width: 767px) {
	.gw-modal-root {
		align-items: center;
		padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
	}

	.gw-modal-dialog {
		border-radius: 16px;
		max-height: calc(100vh - 1.5rem);
		max-height: calc(100dvh - 1.5rem);
	}

	.gw-modal-dialog__heading {
		gap: 1rem;
	}

	.gw-modal-dialog__actions {
		display: block;
	}

	.gw-modal-dialog__button {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.gw-modal-backdrop,
	.gw-modal-dialog {
		transition: none;
	}
}
