/**
 * Cookie Banner — front-end styles.
 *
 * Everything is namespaced under .cban-* so it cannot leak into the theme.
 * The `.cli-*` rules exist so a banner message copied from CookieYes / GDPR
 * Cookie Consent keeps its original layout.
 */

/* -------------------------------------------------------------------------
 * Tokens
 * ---------------------------------------------------------------------- */

:root {
	--cban-bar-bg: #0a1e14;
	--cban-bar-text: #ffffff;
	--cban-accent: #4c9a75;
	--cban-revisit-bg: #0a1e14;
	--cban-revisit-text: #ffffff;
	--cban-radius: 6px;
	--cban-shadow: 0 -2px 20px rgba(0, 0, 0, .18);
	--cban-modal-bg: #ffffff;
	--cban-modal-text: #2c2c2c;
	--cban-border: #e3e3e3;
	--cban-z: 2147483000;
}

/* -------------------------------------------------------------------------
 * Consent bar
 * ---------------------------------------------------------------------- */

.cban-bar {
	position: fixed;
	z-index: var(--cban-z);
	box-sizing: border-box;
	background: var(--cban-bar-bg);
	color: var(--cban-bar-text);
	font-size: 14px;
	line-height: 1.6;
	opacity: 1;
	transition: opacity .3s ease, transform .3s ease;
}

.cban-bar[hidden] {
	display: none;
}

.cban-bar * {
	box-sizing: border-box;
}

.cban-bar.is-visible {
	opacity: 1;
}

.cban-bar__inner {
	padding: 20px;
	margin: 0 auto;
	max-width: 1200px;
}

.cban-bar__heading {
	font-size: 17px;
	font-weight: 600;
	margin: 0 0 8px;
}

.cban-bar__body a:not(.cban-btn) {
	color: inherit;
	text-decoration: underline;
}

/* --- Banner (full width, top or bottom) --- */

.cban-bar--banner {
	left: 0;
	right: 0;
	width: 100%;
	box-shadow: var(--cban-shadow);
}

.cban-bar--banner.cban-bar--bottom {
	bottom: 0;
}

.cban-bar--banner.cban-bar--top {
	top: 0;
	box-shadow: 0 2px 20px rgba(0, 0, 0, .18);
}

/* --- Popup (centred card) --- */

/* Centred with inset+margin rather than a translate, so `transform` stays
   free for the entrance animation. Centring must not depend on a property
   the animation also wants to set. */
.cban-bar--popup {
	inset: 0;
	margin: auto;
	width: min(560px, calc(100vw - 40px));
	height: max-content;
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	border-radius: var(--cban-radius);
	box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}

/* --- Widget (small corner card) --- */

.cban-bar--widget {
	bottom: 20px;
	width: min(380px, calc(100vw - 32px));
	border-radius: var(--cban-radius);
	box-shadow: 0 6px 28px rgba(0, 0, 0, .28);
}

.cban-bar--widget.cban-bar--left,
.cban-bar--widget.cban-bar--bottom,
.cban-bar--widget.cban-bar--top {
	left: 16px;
}

.cban-bar--widget.cban-bar--right {
	right: 16px;
}

.cban-bar--widget .cban-bar__inner {
	padding: 18px;
}

/* --- Entrance and exit motion ---------------------------------------
   Every offset is scoped to :not(.is-visible), so a resting off-screen
   position can never win over a bar that is meant to be on screen, and
   to --load-animate, so sticky mode never transforms at all. */

.cban-bar--load-animate:not(.is-visible) {
	opacity: 0;
}

.cban-bar--load-animate.cban-bar--banner.cban-bar--bottom:not(.is-visible) {
	transform: translateY(100%);
}

.cban-bar--load-animate.cban-bar--banner.cban-bar--top:not(.is-visible) {
	transform: translateY(-100%);
}

.cban-bar--load-animate.cban-bar--popup:not(.is-visible) {
	transform: translateY(14px);
}

.cban-bar--load-animate.cban-bar--widget.cban-bar--right:not(.is-visible) {
	transform: translateX(calc(100% + 24px));
}

.cban-bar--load-animate.cban-bar--widget:not(.cban-bar--right):not(.is-visible) {
	transform: translateX(calc(-100% - 24px));
}

/* Sticky mode: on screen immediately, no motion of any kind. */
.cban-bar--load-sticky {
	transition: none;
	transform: none;
}

/* --- Interaction-blocking overlay --- */

.cban-overlay {
	position: fixed;
	inset: 0;
	z-index: calc(var(--cban-z) - 1);
	background: rgba(0, 0, 0, .5);
}

.cban-overlay[hidden] {
	display: none;
}

/* -------------------------------------------------------------------------
 * CookieYes-compatible message layout
 * ---------------------------------------------------------------------- */

.cli-bar-container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}

.cli-bar-message {
	flex: 1 1 320px;
	min-width: 0;
}

.cli-bar-btn_container {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	flex-shrink: 0;
}

.cban-bar--popup .cli-bar-container,
.cban-bar--widget .cli-bar-container {
	display: block;
}

.cban-bar--popup .cli-bar-btn_container,
.cban-bar--widget .cli-bar-btn_container {
	margin-top: 14px;
}

/* -------------------------------------------------------------------------
 * Buttons
 * ---------------------------------------------------------------------- */

.cban-btn {
	display: inline-block;
	cursor: pointer;
	border: 0;
	text-decoration: none;
	font-weight: 500;
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
	transition: filter .15s ease, opacity .15s ease;
}

.cban-btn:hover,
.cban-btn:focus {
	filter: brightness(.92);
	text-decoration: none;
}

.cban-btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.cban-btn--as-button {
	padding: 10px 18px;
	font-size: 14px;
}

.cban-btn--small.cban-btn--as-button {
	padding: 7px 13px;
	font-size: 13px;
}

.cban-btn--large.cban-btn--as-button {
	padding: 13px 24px;
	font-size: 16px;
}

.cban-btn--as-link {
	background: none !important;
	padding: 0 4px;
	text-decoration: underline;
	font-weight: 400;
}

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

body.cban-modal-open {
	overflow: hidden;
}

.cban-modal {
	position: fixed;
	inset: 0;
	z-index: calc(var(--cban-z) + 10);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	opacity: 0;
	transition: opacity .2s ease;
}

.cban-modal[hidden] {
	display: none;
}

.cban-modal.is-open {
	opacity: 1;
}

.cban-modal * {
	box-sizing: border-box;
}

.cban-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	cursor: pointer;
}

.cban-modal__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(720px, 100%);
	max-height: min(640px, calc(100vh - 40px));
	background: var(--cban-modal-bg);
	color: var(--cban-modal-text);
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
	font-size: 14px;
	line-height: 1.6;
	transform: translateY(8px);
	transition: transform .2s ease;
}

.cban-modal.is-open .cban-modal__panel {
	transform: none;
}

.cban-modal__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 24px 12px;
	border-bottom: 1px solid var(--cban-border);
}

.cban-modal__title {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.35;
	color: inherit;
}

.cban-modal__close {
	flex: 0 0 auto;
	background: none;
	border: 0;
	font-size: 26px;
	line-height: 1;
	padding: 0 4px;
	cursor: pointer;
	color: inherit;
	opacity: .6;
}

.cban-modal__close:hover {
	opacity: 1;
}

.cban-modal__body {
	padding: 16px 24px;
	overflow-y: auto;
	flex: 1 1 auto;
	-webkit-overflow-scrolling: touch;
}

.cban-modal__intro {
	margin-bottom: 18px;
}

.cban-modal__footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
	padding: 14px 24px;
	border-top: 1px solid var(--cban-border);
	background: #fafafa;
	border-radius: 0 0 8px 8px;
}

/* -------------------------------------------------------------------------
 * Accordion
 * ---------------------------------------------------------------------- */

.cban-accordion__item {
	border-bottom: 1px solid var(--cban-border);
}

.cban-accordion__item:last-child {
	border-bottom: 0;
}

.cban-accordion__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 4px 0;
}

.cban-accordion__trigger {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1 1 auto;
	background: none;
	border: 0;
	padding: 12px 0;
	font-size: 15px;
	font-weight: 600;
	color: inherit;
	cursor: pointer;
	text-align: left;
}

.cban-accordion__chevron {
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform .2s ease;
	opacity: .7;
}

.cban-accordion__trigger[aria-expanded="true"] .cban-accordion__chevron {
	transform: rotate(45deg);
}

.cban-accordion__always {
	flex: 0 0 auto;
	font-size: 13px;
	font-weight: 600;
	color: var(--cban-accent);
}

.cban-accordion__panel {
	padding: 0 0 16px 18px;
}

.cban-accordion__panel[hidden] {
	display: none;
}

.cban-accordion__desc {
	margin-bottom: 12px;
	opacity: .85;
}

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

.cban-switch {
	position: relative;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	cursor: pointer;
}

.cban-switch__input {
	position: absolute;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

.cban-switch__track {
	display: block;
	width: 40px;
	height: 22px;
	border-radius: 11px;
	background: #c9c9c9;
	transition: background .2s ease;
}

.cban-switch__thumb {
	display: block;
	width: 18px;
	height: 18px;
	margin: 2px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	transition: transform .2s ease;
}

.cban-switch__input:checked + .cban-switch__track {
	background: var(--cban-accent);
}

.cban-switch__input:checked + .cban-switch__track .cban-switch__thumb {
	transform: translateX(18px);
}

.cban-switch__input:focus-visible + .cban-switch__track {
	outline: 2px solid var(--cban-accent);
	outline-offset: 2px;
}

.cban-sr,
.cban-modal .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* -------------------------------------------------------------------------
 * Cookie tables
 * ---------------------------------------------------------------------- */

.cban-table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.cban-cookie-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	margin: 0 0 8px;
}

.cban-cookie-table th,
.cban-cookie-table td {
	border: 1px solid var(--cban-border);
	padding: 8px 10px;
	text-align: left;
	vertical-align: top;
}

.cban-cookie-table th {
	background: #f5f5f5;
	font-weight: 600;
	white-space: nowrap;
}

.cban-cookie-table code {
	font-size: 12px;
	background: none;
	padding: 0;
	word-break: break-word;
}

.cban-cookie-table__provider {
	display: block;
	font-size: 11px;
	opacity: .7;
	margin-top: 2px;
}

.cban-policy-tables__heading {
	margin-top: 1.6em;
}

.cban-policy-tables__empty {
	opacity: .7;
	font-style: italic;
}

/* -------------------------------------------------------------------------
 * Blocked-embed placeholder
 * ---------------------------------------------------------------------- */

.cban-blocked-embed {
	display: none !important;
}

.cban-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 180px;
	padding: 24px;
	text-align: center;
	background: #f3f4f6;
	border: 1px dashed #c9ccd1;
	border-radius: var(--cban-radius);
	color: #3b3f45;
	font-size: 14px;
	line-height: 1.5;
}

.cban-placeholder__text {
	margin: 0;
	max-width: 46ch;
}

.cban-placeholder__service {
	margin: 0;
	font-size: 12px;
	font-weight: 600;
	opacity: .7;
}

.cban-placeholder__btn {
	border: 0;
	border-radius: 4px;
	padding: 9px 16px;
	background: var(--cban-accent);
	color: #fff;
	font-size: 14px;
	cursor: pointer;
}

.cban-placeholder__btn:hover {
	filter: brightness(.92);
}

/* -------------------------------------------------------------------------
 * Revisit widget
 * ---------------------------------------------------------------------- */

.cban-revisit {
	position: fixed;
	bottom: 0;
	z-index: calc(var(--cban-z) - 2);
	border: 0;
	padding: 9px 16px;
	background: var(--cban-revisit-bg);
	color: var(--cban-revisit-text);
	font-size: 13px;
	line-height: 1.3;
	cursor: pointer;
	border-radius: 4px 4px 0 0;
	box-shadow: 0 -1px 8px rgba(0, 0, 0, .2);
}

.cban-revisit--bottom-left {
	left: 16px;
}

.cban-revisit--bottom-right {
	right: 16px;
}

.cban-manage-consent {
	cursor: pointer;
}

/* -------------------------------------------------------------------------
 * Responsive
 * ---------------------------------------------------------------------- */

@media (max-width: 782px) {
	.cban-bar__inner {
		padding: 16px;
	}

	.cli-bar-container {
		display: block;
	}

	.cli-bar-btn_container {
		margin-top: 12px;
	}

	.cban-btn {
		white-space: normal;
	}

	.cban-modal {
		padding: 0;
	}

	.cban-modal__panel {
		max-height: 100vh;
		height: 100%;
		border-radius: 0;
	}

	.cban-modal__footer {
		border-radius: 0;
		justify-content: stretch;
	}

	.cban-modal__footer .cban-btn {
		flex: 1 1 auto;
	}

	/* Stack cookie tables into labelled cards. */
	.cban-cookie-table thead {
		display: none;
	}

	.cban-cookie-table,
	.cban-cookie-table tbody,
	.cban-cookie-table tr,
	.cban-cookie-table td {
		display: block;
		width: 100%;
	}

	.cban-cookie-table tr {
		margin-bottom: 10px;
		border: 1px solid var(--cban-border);
	}

	.cban-cookie-table td {
		border: 0;
		border-bottom: 1px solid var(--cban-border);
	}

	.cban-cookie-table td:last-child {
		border-bottom: 0;
	}

	.cban-cookie-table td::before {
		content: attr(data-label);
		display: block;
		font-weight: 600;
		font-size: 11px;
		text-transform: uppercase;
		letter-spacing: .04em;
		opacity: .6;
		margin-bottom: 2px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cban-bar,
	.cban-modal,
	.cban-modal__panel,
	.cban-switch__track,
	.cban-switch__thumb,
	.cban-accordion__chevron {
		transition: none !important;
	}
}
