/**
 * Squee cookie consent (squeev3 look, 30 Oct 2026).
 *
 * Deliberately plain CSS rather than Tailwind. This has to render correctly
 * before anything else on the page, must not depend on a Tailwind rebuild, and
 * must not be at the mercy of a purge pass. It is also why nothing in here
 * belongs in input.css.
 *
 * Design: a white card pinned to the bottom, centred on the site's content
 * width, with the v3 type and buttons: Sentient heading, ink pill for Accept,
 * outlined pill for Reject (same size, same place, one click apart), hairline
 * borders. The squeev2 dark bar is in _backups/consent.pre-v3.css.
 */

.squee-consent {
	/* Surfaces */
	--squee-consent-ground: var(--color-surface, #FFFFFF);
	--squee-consent-ground-alt: var(--color-band, #F5F3F0);
	--squee-consent-line: var(--color-line, #E7E2DB);

	/* Type: ink headings, muted body (#5A5650 on white is about 7:1). */
	--squee-consent-heading: var(--color-ink, #232323);
	--squee-consent-body: var(--color-muted, #5A5650);

	/* Buttons, links and ticks: ink. */
	--squee-consent-accent: var(--color-ink, #232323);

	font-family: inherit;
	color: var(--squee-consent-body);
	color-scheme: light;
}

/* ---------------------------------------------------------------- Banner */

/* Centred on the site's content width, so its edges line up with the sections above. */
.squee-consent__banner {
	position: fixed;
	z-index: 9998;
	left: 50%;
	bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
	transform: translateX(-50%);
	width: min(var(--container-site, 1426px), calc(100% - 2rem));

	background: var(--squee-consent-ground);
	border: 1px solid var(--squee-consent-line);
	border-radius: var(--radius-card, 24px);
	box-shadow: 0 18px 44px rgba(35, 35, 35, 0.14);
	padding: 1.75rem 2rem;

	max-height: 85vh;
	overflow-y: auto;
}

/*
 * Stacked rather than two columns. Side by side forces the paragraph into a
 * narrow ragged column while leaving the rest of the bar empty.
 */
.squee-consent__banner-inner {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.squee-consent__banner-text {
	min-width: 0;
	max-width: 88ch;
}

.squee-consent__banner-text p {
	margin: 0.4rem 0 0;
	font-size: 0.9375rem;
	line-height: 1.65;
}

.squee-consent__title {
	margin: 0;
	font-family: var(--font-head, Georgia, serif);
	font-size: 1.375rem;
	font-weight: 400;
	line-height: 1.2;
	color: var(--squee-consent-heading);
}

.squee-consent__banner a,
.squee-consent__modal a {
	color: var(--squee-consent-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* --------------------------------------------------------------- Actions */

.squee-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
	justify-content: flex-start;
}

/* Pushed to the far end of the row, away from the accept/reject pair. */
.squee-consent__actions .squee-consent__btn--link {
	margin-left: auto;
}

.squee-consent__btn {
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;

	/* 44px minimum target, per WCAG 2.5.5. */
	min-height: 44px;
	padding: 0.75rem 1.5rem;

	/* Pill, to match the site's own buttons. */
	border-radius: 999px;
	border: 2px solid var(--squee-consent-accent);
	cursor: pointer;
	background: transparent;
	color: var(--squee-consent-accent);
	transition: background-color 0.15s ease, color 0.15s ease;
}

/*
 * Accept is filled, reject is outlined. They are deliberately kept the same
 * size, in the same place, one click apart, and at the same contrast (both
 * #FFCFE8 against #232323, 11.5:1) — the thing the ICO objects to is a reject
 * that is harder to find or harder to use, not one that is a different fill.
 * If that ever gets challenged, making reject --primary again is a one word
 * change in class-squee-consent.php.
 */
.squee-consent__btn--primary {
	background: var(--squee-consent-accent);
	color: #FFFFFF;
}

.squee-consent__btn--secondary {
	background: transparent;
	border-color: var(--squee-consent-line);
	color: var(--squee-consent-accent);
}

.squee-consent__btn--link {
	border-color: transparent;
	background: transparent;
	color: var(--squee-consent-heading);
	text-decoration: underline;
	text-underline-offset: 2px;
	padding-left: 0.5rem;
	padding-right: 0.5rem;
}

.squee-consent__btn--primary:hover {
	background: #3A3A3A;
	border-color: #3A3A3A;
}

.squee-consent__btn--secondary:hover {
	border-color: var(--squee-consent-heading);
}

.squee-consent__btn--link:hover {
	background: var(--squee-consent-ground-alt);
}

/* Ink outline, offset from the control. */
.squee-consent__btn:focus-visible,
.squee-consent__close:focus-visible,
.squee-consent__choice input:focus-visible,
.squee-consent a:focus-visible {
	outline: 3px solid var(--squee-consent-heading);
	outline-offset: 3px;
}

/* Windows High Contrast Mode: borders and outlines must survive. */
@media (forced-colors: active) {
	.squee-consent__btn {
		border: 2px solid ButtonText;
	}

	.squee-consent__btn:focus-visible {
		outline: 3px solid Highlight;
	}
}

/* ----------------------------------------------------------- Preferences */

.squee-consent__overlay {
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: rgba(35, 35, 35, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	overflow-y: auto;
}

/*
 * A column layout with only the body scrolling. The buttons must stay in view,
 * otherwise someone who opens the panel to change one toggle has to scroll to
 * find Save, and may reasonably assume the toggle alone was enough.
 */
.squee-consent__modal {
	background: var(--squee-consent-ground);
	border: 1px solid var(--squee-consent-line);
	border-radius: var(--radius-card, 24px);
	max-width: 40rem;
	width: 100%;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 24px 64px rgba(35, 35, 35, 0.2);
}

.squee-consent__modal:focus {
	outline: none;
}

.squee-consent__modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--squee-consent-line);
	flex: none;
}

.squee-consent__close {
	font: inherit;
	font-size: 1.5rem;
	line-height: 1;
	min-width: 44px;
	min-height: 44px;
	border: 2px solid transparent;
	border-radius: 999px;
	background: transparent;
	color: var(--squee-consent-body);
	cursor: pointer;
}

.squee-consent__close:hover {
	background: var(--squee-consent-ground-alt);
	color: var(--squee-consent-heading);
}

.squee-consent__modal-body {
	padding: 1.25rem 1.5rem;
	overflow-y: auto;
	flex: 1 1 auto;
}

.squee-consent__modal-body > p {
	margin-top: 0;
	margin-bottom: 1.5rem;
	line-height: 1.6;
}

.squee-consent__group {
	border: 1px solid var(--squee-consent-line);
	border-radius: 0.75rem;
	padding: 1rem 1.25rem 1.25rem;
	margin: 0 0 1rem;
}

.squee-consent__group-title {
	font-weight: 700;
	padding: 0 0.35rem;
	font-size: 1rem;
	color: var(--squee-consent-heading);
}

.squee-consent__group-desc {
	margin: 0.35rem 0 0.85rem;
	line-height: 1.6;
	font-size: 0.9375rem;
}

.squee-consent__always {
	margin: 0;
	font-weight: 600;
	color: var(--squee-consent-accent);
	font-size: 0.9375rem;
}

.squee-consent__choice {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-height: 44px;
}

/*
 * Drawn by hand rather than left native. The theme sets its own styles on bare
 * inputs, and a native dark-scheme checkbox rendered as a filled dark square
 * with no visible border, which read as "on" when it was off.
 */
.squee-consent__choice input[type="checkbox"] {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	width: 1.4rem;
	height: 1.4rem;
	min-height: 0;
	margin: 0;
	padding: 0;
	flex: none;
	cursor: pointer;
	border: 2px solid var(--squee-consent-body);
	border-radius: 0.3rem;
	background: transparent;
	box-shadow: none;
}

.squee-consent__choice input[type="checkbox"]:checked {
	background: var(--squee-consent-accent);
	border-color: var(--squee-consent-accent);
}

/* The tick: two borders of a rotated box. */
.squee-consent__choice input[type="checkbox"]:checked::after {
	content: "";
	position: absolute;
	left: 0.38rem;
	top: 0.15rem;
	width: 0.32rem;
	height: 0.62rem;
	border: solid #FFFFFF;
	border-width: 0 3px 3px 0;
	transform: rotate(45deg);
}

@media (forced-colors: active) {
	.squee-consent__choice input[type="checkbox"] {
		border-color: ButtonText;
	}

	.squee-consent__choice input[type="checkbox"]:checked {
		background: Highlight;
		border-color: Highlight;
	}

	.squee-consent__choice input[type="checkbox"]:checked::after {
		border-color: HighlightText;
	}
}

.squee-consent__choice label {
	cursor: pointer;
	font-weight: 600;
	color: var(--squee-consent-heading);
}

.squee-consent__modal-foot {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 1.25rem 1.5rem;
	border-top: 1px solid var(--squee-consent-line);
	background: var(--squee-consent-ground-alt);
	border-radius: 0 0 var(--radius-card, 24px) var(--radius-card, 24px);
	flex: none;
}

/* ------------------------------------------------------- Status / footer */

/*
 * Visually hidden, but announced. Confirms the choice landed for anyone who
 * cannot see the bar disappear.
 */
.squee-consent__status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Stop the fixed bar covering the end of the page. */
html.squee-consent-active body {
	padding-bottom: 13rem;
}

html.squee-consent-modal-open,
html.squee-consent-modal-open body {
	overflow: hidden;
}

@media (max-width: 40rem) {
	.squee-consent__banner {
		width: calc(100% - 1.5rem);
		bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
		padding: 1.25rem;
		max-height: 80vh;
	}

	/* Full width stacked buttons, so Manage preferences is not stranded. */
	.squee-consent__actions .squee-consent__btn {
		flex: 1 1 100%;
		text-align: center;
	}

	.squee-consent__actions .squee-consent__btn--link {
		margin-left: 0;
	}

	.squee-consent__modal-foot .squee-consent__btn {
		flex: 1 1 100%;
	}

	html.squee-consent-active body {
		padding-bottom: 24rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.squee-consent *,
	.squee-consent *::before,
	.squee-consent *::after {
		transition: none !important;
		animation: none !important;
	}
}
