/*
 * Cookie consent banner. Markup is built by assets/js/consent.js; layout ported
 * from the legitum.be banner, colours and type from this theme's presets.
 *
 * EB Garamond runs small for its point size, so text sizes sit a step above
 * what a sans-serif banner would use.
 */

.drt-consent {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 100000;
	box-sizing: border-box;
	width: 380px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	padding: 20px;
	background: var(--wp--preset--color--paper, #F4F4F1);
	border: 1px solid var(--wp--preset--color--sage-pale, #C8CAC3);
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(47, 53, 42, 0.18);
	font-family: var(--wp--preset--font-family--body, Georgia, serif);
	color: var(--wp--preset--color--ink, #2F352A);
	text-align: left;
}

.drt-consent[hidden] {
	display: none;
}

.drt-consent__title {
	margin: 0 0 8px;
	font-family: var(--wp--preset--font-family--display-serif, Georgia, serif);
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.2;
	color: var(--wp--preset--color--olive, #3D4435);
}

.drt-consent__text {
	margin: 0 0 16px;
	font-size: 1rem;
	line-height: 1.45;
	color: var(--wp--preset--color--olive-soft, #4B5147);
}

.drt-consent__text a {
	color: var(--wp--preset--color--bronze, #8A6B43);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.drt-consent__text a:hover {
	color: var(--wp--preset--color--brass, #C79B6F);
}

.drt-consent__prefs {
	margin: 0 0 16px;
	border-top: 1px solid var(--wp--preset--color--sage-pale, #C8CAC3);
}

.drt-consent__prefs[hidden] {
	display: none;
}

.drt-consent__pref {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 0;
	border-bottom: 1px solid var(--wp--preset--color--sage-pale, #C8CAC3);
}

.drt-consent__pref-name {
	display: block;
	margin-bottom: 2px;
	font-size: 1rem;
	font-weight: 600;
	color: var(--wp--preset--color--olive, #3D4435);
}

.drt-consent__pref-desc {
	display: block;
	font-size: 0.9rem;
	line-height: 1.4;
	color: var(--wp--preset--color--sage, #5A6157);
}

/* Toggle switch: a real checkbox, restyled, so keyboard and screen readers work. */
.drt-consent__switch {
	position: relative;
	flex: 0 0 44px;
	width: 44px;
	height: 24px;
	margin-top: 2px;
}

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

.drt-consent__switch input:disabled {
	cursor: not-allowed;
}

.drt-consent__track {
	position: absolute;
	inset: 0;
	border-radius: 12px;
	background: var(--wp--preset--color--mist, #C2C8CC);
	transition: background-color 0.15s ease-in-out;
	pointer-events: none;
}

.drt-consent__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
	transition: transform 0.15s ease-in-out;
}

.drt-consent__switch input:checked + .drt-consent__track {
	background: var(--wp--preset--color--olive, #3D4435);
}

.drt-consent__switch input:checked + .drt-consent__track::after {
	transform: translateX(20px);
}

.drt-consent__switch input:disabled + .drt-consent__track {
	opacity: 0.6;
}

.drt-consent__switch input:focus-visible + .drt-consent__track {
	outline: 2px solid var(--wp--preset--color--brass, #C79B6F);
	outline-offset: 2px;
}

/* Accept and reject get equal weight on purpose: the ICO expects refusing to
   be as easy and as visible as agreeing. */
.drt-consent__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.drt-consent__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 42px;
	padding: 8px 12px;
	border: 1px solid var(--wp--preset--color--olive, #3D4435);
	border-radius: 8px;
	background: transparent;
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.2;
	text-align: center;
	color: var(--wp--preset--color--olive, #3D4435);
	cursor: pointer;
	transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.drt-consent__btn:hover {
	background: var(--wp--preset--color--sage-muted, #DCDED7);
}

.drt-consent__btn--primary {
	background: var(--wp--preset--color--olive, #3D4435);
	color: var(--wp--preset--color--paper, #F4F4F1);
}

.drt-consent__btn--primary:hover {
	background: var(--wp--preset--color--ink, #2F352A);
}

.drt-consent__btn--save {
	grid-column: 1 / -1;
}

.drt-consent__btn--save[hidden] {
	display: none;
}

.drt-consent__link {
	display: block;
	margin: 10px auto 0;
	padding: 4px 8px;
	border: 0;
	background: none;
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--wp--preset--color--sage, #5A6157);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.drt-consent__link:hover {
	color: var(--wp--preset--color--bronze, #8A6B43);
}

.drt-consent__link[hidden] {
	display: none;
}

@media (max-width: 576px) {
	.drt-consent {
		left: 16px;
		right: 16px;
		bottom: 16px;
		width: auto;
		max-width: none;
		max-height: calc(100vh - 32px);
		padding: 16px;
	}

	.drt-consent__actions {
		grid-template-columns: 1fr;
	}
}
