/**
 * Consent banner and preference centre.
 *
 * Matches the Figma banner and the existing Deluxe theme: Jost, Fun Green
 * (#005c3b), 4px radii, 44px controls. Tokens are read from the theme when it
 * is active and fall back to literals so the plugin still looks right if the
 * theme changes.
 */

.dlxa-root {
	--dlxa-green: var(--dp-green-700, #005c3b);
	--dlxa-green-deep: var(--dp-green-900, #00412a);
	--dlxa-ink: #1e2229;
	--dlxa-body: #626770;
	--dlxa-line: var(--dp-line, #e5e5e5);
	--dlxa-surface: #ffffff;
	--dlxa-radius: 4px;
	--dlxa-font: var(--dp-font-sans, "Jost", system-ui, -apple-system, "Segoe UI", sans-serif);

	font-family: var(--dlxa-font);
}

.dlxa-root *,
.dlxa-root *::before,
.dlxa-root *::after {
	box-sizing: border-box;
}

/*
 * `hidden` must beat the layout rules below. `.dlxa-modal { display: flex }`
 * is an author rule, so it wins over the user-agent's `[hidden]` no matter the
 * specificity — without this the preference centre renders open on every page
 * load.
 */
.dlxa-root [hidden],
.dlxa-root[hidden] {
	display: none !important;
}

.dlxa-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ===============================================================
 * Banner
 * =============================================================== */

.dlxa-banner {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	/* Below the theme's sticky header (100) but above page content. */
	z-index: 95;
	background: var(--dlxa-surface);
	border-top: 1px solid var(--dlxa-line);
	box-shadow: 0 -8px 12px rgba(0, 0, 0, 0.05);
	animation: dlxa-rise 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dlxa-rise {
	from { transform: translateY(100%); }
	to   { transform: none; }
}

.dlxa-banner__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 32px;
	max-width: 1440px;
	margin-inline: auto;
	padding: 32px 64px;
}

.dlxa-banner__copy {
	max-width: 760px;
}

.dlxa-banner__title {
	margin: 0 0 8px;
	font-family: var(--dlxa-font);
	font-size: 18px;
	font-weight: 600;
	letter-spacing: 0.2px;
	line-height: 1.3;
	color: var(--dlxa-ink);
}

.dlxa-banner__text {
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	color: var(--dlxa-body);
}

.dlxa-banner__actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: none;
}

/* ===============================================================
 * Buttons
 * =============================================================== */

.dlxa-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* 44px is the minimum comfortable touch target. */
	min-height: 44px;
	padding: 12px 20px;
	border: 1px solid var(--dlxa-green);
	border-radius: var(--dlxa-radius);
	background: transparent;
	font-family: var(--dlxa-font);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.5px;
	line-height: 1.2;
	white-space: nowrap;
	color: var(--dlxa-green);
	cursor: pointer;
	transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.dlxa-btn--primary {
	background: var(--dlxa-green);
	color: #fff;
}

.dlxa-btn--primary:hover {
	background: var(--dlxa-green-deep);
	transform: translateY(-1px);
}

.dlxa-btn--ghost:hover {
	background: rgba(0, 92, 59, 0.06);
}

.dlxa-root :focus-visible {
	outline: 2px solid var(--dlxa-green);
	outline-offset: 2px;
}

/* The footer/shortcode link that reopens the centre. */
.dlxa-settings-link {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* ===============================================================
 * Preference centre
 * =============================================================== */

.dlxa-modal {
	position: fixed;
	inset: 0;
	z-index: 120;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.dlxa-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(22, 32, 27, 0.55);
}

.dlxa-modal__panel {
	position: relative;
	width: min(620px, 100%);
	max-height: min(84vh, 760px);
	overflow-y: auto;
	padding: 28px;
	border-radius: 10px;
	background: var(--dlxa-surface);
	box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.5);
	animation: dlxa-pop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dlxa-pop {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

.dlxa-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.dlxa-modal__title {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.25;
	color: var(--dlxa-ink);
}

.dlxa-modal__close {
	flex: none;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: var(--dlxa-radius);
	background: none;
	font-size: 24px;
	line-height: 1;
	color: var(--dlxa-body);
	cursor: pointer;
}

.dlxa-modal__close:hover {
	background: rgba(0, 0, 0, 0.05);
}

.dlxa-modal__lede {
	margin: 8px 0 22px;
	font-size: 14px;
	line-height: 1.6;
	color: var(--dlxa-body);
}

.dlxa-category {
	padding: 16px 0;
	border-top: 1px solid var(--dlxa-line);
}

.dlxa-category__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.dlxa-category__label {
	font-size: 15px;
	font-weight: 600;
	color: var(--dlxa-ink);
	cursor: pointer;
}

.dlxa-category__locked {
	font-size: 12px;
	font-weight: 600;
	color: var(--dlxa-green);
}

.dlxa-category__text {
	margin: 6px 0 0;
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--dlxa-body);
}

.dlxa-category__services {
	margin: 8px 0 0;
	font-size: 12.5px;
	color: #8a908c;
}

/* Toggle */
.dlxa-switch {
	position: relative;
	flex: none;
	width: 46px;
	height: 26px;
}

.dlxa-switch input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.dlxa-switch__track {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 999px;
	background: #d3d9d4;
	transition: background 0.22s ease;
	pointer-events: none;
}

.dlxa-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.22s ease;
}

.dlxa-switch input:checked + .dlxa-switch__track {
	background: var(--dlxa-green);
}

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

.dlxa-switch input:focus-visible + .dlxa-switch__track {
	outline: 2px solid var(--dlxa-green);
	outline-offset: 2px;
}

.dlxa-modal__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-top: 22px;
	padding-top: 20px;
	border-top: 1px solid var(--dlxa-line);
}

.dlxa-modal__privacy {
	font-size: 13.5px;
	color: var(--dlxa-green);
}

.dlxa-modal__buttons {
	display: flex;
	gap: 12px;
	margin-left: auto;
}

/* ===============================================================
 * Responsive — the brief's breakpoints, down to 320px
 * =============================================================== */

@media (max-width: 1024px) {
	.dlxa-banner__inner {
		flex-direction: column;
		align-items: stretch;
		gap: 24px;
		padding: 40px;
	}

	.dlxa-banner__actions {
		justify-content: flex-end;
	}
}

@media (max-width: 640px) {
	.dlxa-banner__inner {
		padding: 24px;
		gap: 24px;
	}

	.dlxa-banner__actions {
		flex-direction: column;
		gap: 10px;
	}

	.dlxa-banner__actions .dlxa-btn {
		width: 100%;
	}

	/*
	 * Stacked order is Accept / Manage / Reject, which is neither the DOM order
	 * (Reject first, so keyboard and screen-reader users meet the least
	 * committing option first) nor a simple reversal. Every button is therefore
	 * ordered explicitly rather than nudging one with `order: -1`.
	 */
	.dlxa-banner__actions [data-dlxa-action="accept"] { order: 1; }
	.dlxa-banner__actions [data-dlxa-action="manage"] { order: 2; }
	.dlxa-banner__actions [data-dlxa-action="reject"] { order: 3; }

	.dlxa-banner__title { font-size: 16px; }

	.dlxa-banner__text {
		font-size: 13px;
		line-height: 1.45;
	}

	.dlxa-modal { padding: 0; align-items: flex-end; }

	.dlxa-modal__panel {
		width: 100%;
		max-height: 92vh;
		border-radius: 12px 12px 0 0;
		padding: 22px 18px 26px;
	}

	.dlxa-modal__buttons {
		width: 100%;
		flex-direction: column-reverse;
	}

	.dlxa-modal__buttons .dlxa-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.dlxa-banner,
	.dlxa-modal__panel {
		animation: none;
	}

	.dlxa-btn,
	.dlxa-switch__track,
	.dlxa-switch__track::after {
		transition: none;
	}
}
