/**
 * Site-wide overlays: cookie consent banner and "Book a demo" popup.
 * Matches routectrl-website (Next.js). Breakpoints: 640, 768, 1024px.
 */

/* ---------- Cookie consent banner: a bar along the bottom ---------- */

.rc-cookie {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 9000;
	font-family: var(--wp--preset--font-family--inter);
	opacity: 0;
	transform: translateY(100%);
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.rc-cookie[hidden] {
	display: none;
}

.rc-cookie.is-visible {
	opacity: 1;
	transform: none;
}

.rc-cookie__card {
	display: grid;
	grid-template-areas: "icon text" "choices choices" "buttons buttons";
	grid-template-columns: auto 1fr;
	gap: 16px;
	box-sizing: border-box;
	max-height: 100dvh;
	padding: 20px clamp(1rem, 3vw, 1.5rem);
	overflow-y: auto;
	border-top: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--base);
	box-shadow: 0 -12px 40px rgba(1, 6, 68, 0.12);
	color: var(--wp--preset--color--heading);
	outline: none;
}

.rc-cookie__icon {
	grid-area: icon;
	color: var(--wp--preset--color--heading);
}

.rc-cookie__text {
	grid-area: text;
}

.rc-cookie__title {
	margin: 0;
	color: var(--wp--preset--color--heading);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	line-height: 24px;
}

.rc-cookie__description {
	max-width: 760px;
	margin: 6px 0 0;
	color: var(--wp--preset--color--body);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 300;
	line-height: 18px;
}

.rc-cookie__choices {
	display: flex;
	flex-wrap: wrap;
	grid-area: choices;
	align-items: center;
	gap: 12px 28px;
}

.rc-cookie__logo {
	width: auto;
	height: 20px;
}

.rc-cookie__buttons {
	display: grid;
	grid-area: buttons;
	gap: 8px;
}

.rc-cookie__buttons .ml-btn {
	min-height: 44px;
	padding-block: 9px;
	font-size: var(--wp--preset--font-size--small);
}

/* On/off switch around a checkbox. */
.rc-switch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--wp--preset--color--body);
	font-size: var(--wp--preset--font-size--small);
	line-height: 20px;
	cursor: pointer;
}

.rc-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.rc-switch__track {
	position: relative;
	flex-shrink: 0;
	order: 1;
	width: 36px;
	height: 20px;
	border-radius: 10px;
	background: #c3c6d0;
	transition: background-color 0.2s ease;
}

.rc-switch__track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--wp--preset--color--base);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s ease;
}

.rc-switch input:checked + .rc-switch__track {
	background: #22a55a;
}

.rc-switch input:checked + .rc-switch__track::after {
	transform: translateX(16px);
}

.rc-switch input:disabled + .rc-switch__track {
	opacity: 0.6;
}

.rc-switch:has(input:disabled) {
	cursor: default;
}

.rc-switch input:focus-visible + .rc-switch__track {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

@media (min-width: 768px) {

	.rc-cookie__buttons {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (min-width: 1024px) {

	.rc-cookie__card {
		grid-template-areas: "icon text buttons" ". choices buttons";
		grid-template-columns: auto 1fr 220px;
		gap: 12px 24px;
		align-items: center;
		padding: 24px max(clamp(1rem, 3vw, 1.5rem), (100% - 1248px) / 2);
	}

	.rc-cookie__buttons {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {

	.rc-cookie {
		transition: none;
	}
}

/* ---------- "Book a demo" popup ---------- */

.rc-demo {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(0, 0, 0, 0.5);
	font-family: var(--wp--preset--font-family--inter);
}

.rc-demo[hidden] {
	display: none;
}

.rc-demo__card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 90vw;
	height: 85vh;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--xlarge);
	background: var(--wp--preset--color--surface);
	box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
	outline: none;
	animation: rc-demo-in 0.25s ease;
}

@keyframes rc-demo-in {

	from {
		opacity: 0;
		transform: scale(0.97);
	}
}

.rc-demo__head {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px;
	border-bottom: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--base);
}

.rc-demo__fallback {
	color: var(--wp--preset--color--link);
	font-size: 14px;
	line-height: 20px;
	text-decoration: none;
}

.rc-demo__fallback:hover {
	color: var(--wp--preset--color--royal);
	text-decoration: underline;
}

.rc-demo__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin-left: auto;
	padding: 0;
	border: 0;
	border-radius: 9999px;
	background: none;
	color: var(--wp--preset--color--muted);
	cursor: pointer;
}

.rc-demo__close:hover {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--body);
}

.rc-demo__close .ml-icon {
	width: 20px;
	height: 20px;
}

.rc-demo__frame {
	flex: 1;
	width: 100%;
	border: 0;
	background: var(--wp--preset--color--base);
}

@media (min-width: 1024px) {

	.rc-demo__card {
		width: 70vw;
	}
}
