/**
 * 2-a-tee Cookie Consent — styling
 *
 * Written to disappear into whatever theme it lands on.
 *
 *   Fonts    inherit. There is no font stack anywhere in this file, so the
 *            banner always uses the theme's own faces.
 *   Colours  come from custom properties. The defaults below are neutral and
 *            safe; the script overwrites them with values sampled from the
 *            theme's buttons, links and body, and anything pinned on the
 *            options page overwrites both.
 *   Shape    the corner radius is copied from the theme's own buttons, so this
 *            is square on a square site and pill-shaped on a rounded one.
 *
 * Everything is scoped under .a2t-cc so it cannot leak into the site.
 *
 * @package a2tee-cookie-consent
 */

.a2t-cc {
	/* Neutral fallbacks. These apply for the fraction of a second before the
	   script runs, and permanently if JS is off — so they have to be legible
	   on their own, not placeholders. */
	--a2t-cc-surface: #ffffff;
	--a2t-cc-text: #1a1a1a;
	--a2t-cc-muted: rgba(26, 26, 26, 0.72);
	--a2t-cc-border: rgba(26, 26, 26, 0.16);
	--a2t-cc-accent: #1a1a1a;
	--a2t-cc-accent-text: #ffffff;
	--a2t-cc-radius: 4px;
	--a2t-cc-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06), 0 8px 40px rgba(0, 0, 0, 0.16);
	--a2t-cc-gap: 0.7rem;

	position: relative;
	z-index: 2147483000; /* Above sticky headers and most chat widgets. */
	font-family: inherit;
	line-height: 1.5;
}

.a2t-cc[hidden] {
	display: none;
}

.a2t-cc *,
.a2t-cc *::before,
.a2t-cc *::after {
	box-sizing: border-box;
}

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

.a2t-cc__banner {
	position: fixed;
	z-index: 1;
	background: var(--a2t-cc-surface);
	color: var(--a2t-cc-text);
	border: 1px solid var(--a2t-cc-border);
	border-radius: var(--a2t-cc-card-radius, var(--a2t-cc-radius));
	box-shadow: var(--a2t-cc-shadow);
	padding: 1.25rem 1.4rem;
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.24s ease, transform 0.24s ease;
	pointer-events: none;
	max-height: calc(100vh - 32px);
	overflow-y: auto;
}

.a2t-cc.is-visible .a2t-cc__banner {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.a2t-cc.is-panel-open .a2t-cc__banner {
	opacity: 0;
	pointer-events: none;
}

/* ---- Position: bar across the bottom ---- */

.a2t-cc--bottom-bar .a2t-cc__banner {
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 2rem;
	border-width: 1px 0 0;
	border-radius: 0;
	padding: 1.1rem clamp(16px, 4vw, 48px);
}

.a2t-cc--bottom-bar .a2t-cc__body {
	flex: 1 1 22rem;
	min-width: 0;
}

.a2t-cc--bottom-bar .a2t-cc__actions {
	flex: 0 1 auto;
}

/* ---- Position: cards ---- */

.a2t-cc--bottom-left .a2t-cc__banner,
.a2t-cc--bottom-right .a2t-cc__banner {
	bottom: 20px;
	width: min(420px, calc(100vw - 40px));
}

.a2t-cc--bottom-left .a2t-cc__banner {
	left: 20px;
}

.a2t-cc--bottom-right .a2t-cc__banner {
	right: 20px;
}

/* ---- Position: centred, dimmed page ---- */

.a2t-cc--centre::before {
	content: "";
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 0.24s ease;
	pointer-events: none;
}

.a2t-cc--centre.is-visible::before {
	opacity: 1;
	pointer-events: auto;
}

.a2t-cc--centre .a2t-cc__banner {
	top: 50%;
	left: 50%;
	transform: translate(-50%, calc(-50% + 14px));
	width: min(520px, calc(100vw - 32px));
}

.a2t-cc--centre.is-visible .a2t-cc__banner {
	transform: translate(-50%, -50%);
}

/* ---- Type ---- */

.a2t-cc__title {
	margin: 0 0 0.4rem;
	font-family: inherit;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
	/* Themes love a global h2 border-bottom. */
	border: 0;
	padding: 0;
	text-transform: inherit;
	letter-spacing: inherit;
}

.a2t-cc__text {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.6;
	color: var(--a2t-cc-muted);
}

.a2t-cc__text a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

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

   Accept and Reject are deliberately identical in size, weight and
   prominence. The law requires refusing to be as easy as agreeing, and a pale
   "reject" beside a solid "accept" is the classic way people get this wrong.
   ========================================================================== */

.a2t-cc__actions,
.a2t-cc__panel-actions {
	display: flex;
	flex-wrap: wrap;
	gap: var(--a2t-cc-gap);
	margin-top: 1rem;
}

.a2t-cc--bottom-bar .a2t-cc__actions {
	margin-top: 0;
}

.a2t-cc__btn {
	flex: 0 1 auto;
	min-width: 8.5rem;
	padding: 0.7rem 1.25rem;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	border-radius: var(--a2t-cc-radius);
	border: 1px solid transparent;
	cursor: pointer;
	transition: opacity 0.15s ease, background-color 0.15s ease;
}

.a2t-cc__btn--primary {
	background: var(--a2t-cc-accent);
	color: var(--a2t-cc-accent-text);
	border-color: var(--a2t-cc-accent);
}

.a2t-cc__btn--primary:hover {
	opacity: 0.88;
}

.a2t-cc__btn--quiet {
	background: transparent;
	color: var(--a2t-cc-text);
	border-color: var(--a2t-cc-border);
}

.a2t-cc__btn--quiet:hover {
	border-color: var(--a2t-cc-accent);
}

.a2t-cc__btn:focus-visible {
	outline: 3px solid var(--a2t-cc-accent);
	outline-offset: 2px;
}

/* ==========================================================================
   Preferences panel
   ========================================================================== */

.a2t-cc__panel {
	position: fixed;
	inset: 0;
	z-index: 2;
	display: grid;
	place-items: center;
	padding: 20px;
	background: rgba(0, 0, 0, 0.5);
	overflow-y: auto;
}

.a2t-cc__panel[hidden] {
	display: none;
}

.a2t-cc__panel-inner {
	width: 100%;
	max-width: 560px;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	padding: 1.6rem;
	background: var(--a2t-cc-surface);
	color: var(--a2t-cc-text);
	border-radius: var(--a2t-cc-card-radius, var(--a2t-cc-radius));
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.a2t-cc__panel-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.1rem;
}

.a2t-cc__panel-inner h2 {
	margin: 0;
	font-family: inherit;
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
	border: 0;
	padding: 0;
}

.a2t-cc__close {
	flex: none;
	width: 2rem;
	height: 2rem;
	padding: 0;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--a2t-cc-muted);
	background: transparent;
	border: 0;
	border-radius: var(--a2t-cc-radius);
	cursor: pointer;
}

.a2t-cc__close:hover {
	color: var(--a2t-cc-text);
}

.a2t-cc__close:focus-visible {
	outline: 3px solid var(--a2t-cc-accent);
	outline-offset: 2px;
}

.a2t-cc__cat {
	padding: 0.9rem 0;
	border-top: 1px solid var(--a2t-cc-border);
}

.a2t-cc__cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.3rem;
}

.a2t-cc__cat-head label {
	margin: 0;
	cursor: pointer;
}

.a2t-cc__cat-head strong {
	font-size: 0.95rem;
	font-weight: 700;
	color: inherit;
}

.a2t-cc__cat p {
	margin: 0;
	font-size: 0.85rem;
	line-height: 1.55;
	color: var(--a2t-cc-muted);
}

.a2t-cc__always {
	flex: none;
	padding: 0.2rem 0.6rem;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--a2t-cc-muted);
	border: 1px solid var(--a2t-cc-border);
	border-radius: 999px;
	white-space: nowrap;
}

.a2t-cc__panel-actions {
	margin-top: 1.4rem;
	padding-top: 1.2rem;
	border-top: 1px solid var(--a2t-cc-border);
}

.a2t-cc__panel-actions .a2t-cc__btn {
	flex: 1 1 auto;
}

.a2t-cc__panel-link {
	margin: 1rem 0 0;
	font-size: 0.82rem;
	text-align: center;
	color: var(--a2t-cc-muted);
}

.a2t-cc__panel-link a {
	color: inherit;
	text-decoration: underline;
}

/* ---- Toggle switch ---- */

.a2t-cc__switch {
	position: relative;
	flex: none;
	width: 46px;
	height: 26px;
	cursor: pointer;
}

.a2t-cc__switch input {
	position: absolute;
	inset: 0;
	/* Above the slider it paints behind, so a direct click or an automated
	   one lands on the control itself rather than being swallowed by the
	   decorative span. Clicking the slider still works via the wrapping
	   label either way. */
	z-index: 1;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.a2t-cc__slider {
	position: absolute;
	inset: 0;
	background: var(--a2t-cc-border);
	border-radius: 999px;
	transition: background-color 0.18s ease;
}

.a2t-cc__slider::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	background: var(--a2t-cc-surface);
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.18s ease;
}

.a2t-cc__switch input:checked + .a2t-cc__slider {
	background: var(--a2t-cc-accent);
}

.a2t-cc__switch input:checked + .a2t-cc__slider::before {
	transform: translateX(20px);
}

.a2t-cc__switch input:focus-visible + .a2t-cc__slider {
	outline: 3px solid var(--a2t-cc-accent);
	outline-offset: 2px;
}

/* ==========================================================================
   Blocked embed placeholder

   Lives outside .a2t-cc (it sits in the content), so it repeats the custom
   properties with the same fallbacks.
   ========================================================================== */

.a2t-cc-embed {
	--a2t-cc-surface: #f4f4f4;
	--a2t-cc-text: #1a1a1a;
	--a2t-cc-muted: rgba(26, 26, 26, 0.72);
	--a2t-cc-border: rgba(26, 26, 26, 0.16);
	--a2t-cc-accent: #1a1a1a;
	--a2t-cc-accent-text: #ffffff;
	--a2t-cc-radius: 4px;

	position: relative;
	min-height: 200px;
	aspect-ratio: 16 / 9;
	background: var(--a2t-cc-surface);
	border: 1px dashed var(--a2t-cc-border);
	border-radius: var(--a2t-cc-card-radius, var(--a2t-cc-radius));
	overflow: hidden;
}

.a2t-cc-embed iframe {
	width: 100%;
	height: 100%;
	border: 0;
}

.a2t-cc-embed__cover {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	text-align: center;
}

.a2t-cc-embed__msg {
	max-width: 34ch;
	margin: 0;
	font-family: inherit;
	font-size: 0.88rem;
	line-height: 1.5;
	color: var(--a2t-cc-muted);
}

.a2t-cc-embed__cover .a2t-cc__btn {
	flex: 0 0 auto;
	min-width: 0;
}

.a2t-cc-embed.is-loaded {
	min-height: 0;
	aspect-ratio: auto;
	border: 0;
	background: none;
}

/* ==========================================================================
   Re-open link
   ========================================================================== */

.a2t-cc-link {
	cursor: pointer;
}

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 640px) {
	.a2t-cc__banner {
		padding: 1.1rem 1.1rem 1.2rem;
	}

	.a2t-cc--bottom-left .a2t-cc__banner,
	.a2t-cc--bottom-right .a2t-cc__banner {
		right: 10px;
		bottom: 10px;
		left: 10px;
		width: auto;
	}

	.a2t-cc__btn {
		flex: 1 1 100%;
		min-width: 0;
	}

	.a2t-cc__panel-inner {
		padding: 1.2rem 1.1rem;
	}
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.a2t-cc__banner,
	.a2t-cc__btn,
	.a2t-cc__slider,
	.a2t-cc__slider::before,
	.a2t-cc--centre::before {
		transition: none;
	}

	.a2t-cc__banner {
		transform: none;
	}

	.a2t-cc--centre .a2t-cc__banner,
	.a2t-cc--centre.is-visible .a2t-cc__banner {
		transform: translate(-50%, -50%);
	}
}
