/**
 * Site Consent - front end styles.
 *
 * Everything is scoped under .site-consent and uses BEM style names so it
 * cannot collide with a theme. Colours, spacing and radii come from CSS custom
 * properties printed inline from the Design tab.
 */

.site-consent,
.site-consent *,
.site-consent *::before,
.site-consent *::after {
	box-sizing: border-box;
}

.site-consent {
	/* Fallbacks so the interface still looks right if the inline design
	   variables are ever missing. */
	--sc-bg: #ffffff;
	--sc-text: #16181d;
	--sc-muted: #5a6273;
	--sc-border: #e3e6ec;
	--sc-accent: #1d4ed8;
	--sc-radius: 16px;
	--sc-btn-radius: 10px;
	--sc-shadow: 0 10px 34px rgba(16, 18, 24, 0.14);
	--sc-width: 390px;
	--sc-space: 22px;
	--sc-font-size: 14px;
	--sc-heading-size: 17px;
	--sc-heading-weight: 650;
	--sc-icon-size: 46px;
	--sc-icon-x: 20px;
	--sc-icon-y: 20px;
	--sc-accept-bg: #16181d;
	--sc-accept-text: #ffffff;
	--sc-accept-border: #16181d;
	--sc-reject-bg: #ffffff;
	--sc-reject-text: #16181d;
	--sc-reject-border: #16181d;
	--sc-settings-bg: #ffffff;
	--sc-settings-text: #3b4252;
	--sc-settings-border: #c9cfdb;

	font-family: inherit;
	font-size: var(--sc-font-size);
	line-height: 1.55;
	color: var(--sc-text);
}

.site-consent [hidden] {
	display: none !important;
}

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

.site-consent__banner {
	position: fixed;
	z-index: 999998;
	bottom: max(20px, env(safe-area-inset-bottom, 0px));
	width: min(var(--sc-width), calc(100vw - 32px));
	max-width: calc(100vw - 32px);
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 200ms ease, transform 200ms ease;
}

.site-consent__banner--bottom-left {
	left: 20px;
}

.site-consent__banner--bottom-right {
	right: 20px;
}

.site-consent__banner--bottom-center {
	left: 50%;
	transform: translate(-50%, 12px);
}

.site-consent__banner--visible {
	opacity: 1;
	transform: translateY(0);
}

.site-consent__banner--bottom-center.site-consent__banner--visible {
	transform: translate(-50%, 0);
}

.site-consent__card {
	padding: var(--sc-space);
	background: var(--sc-bg);
	border: 1px solid var(--sc-border);
	border-radius: var(--sc-radius);
	box-shadow: var(--sc-shadow);
}

.site-consent__title {
	margin: 0 0 8px;
	padding: 0;
	font-size: var(--sc-heading-size);
	font-weight: var(--sc-heading-weight);
	line-height: 1.3;
	color: var(--sc-text);
	letter-spacing: -0.01em;
}

.site-consent__text {
	margin: 0;
	color: var(--sc-muted);
}

.site-consent__text p {
	margin: 0 0 8px;
}

.site-consent__text p:last-child {
	margin-bottom: 0;
}

.site-consent__policy-links {
	margin: 10px 0 0;
	font-size: calc(var(--sc-font-size) - 1px);
}

.site-consent__policy-links a {
	color: var(--sc-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.site-consent__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-top: calc(var(--sc-space) - 4px);
}

/* Accept and Reject are deliberately the same size and weight; Settings sits
   on its own row at the same height. */
.site-consent__actions .site-consent__button--settings {
	grid-column: 1 / -1;
}

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

.site-consent__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin: 0;
	padding: 10px 16px;
	font-family: inherit;
	font-size: var(--sc-font-size);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	border: 1.5px solid transparent;
	border-radius: var(--sc-btn-radius);
	cursor: pointer;
	transition: filter 150ms ease, box-shadow 150ms ease;
	-webkit-appearance: none;
	appearance: none;
}

.site-consent__button:hover {
	filter: brightness(0.94);
}

.site-consent__button:focus-visible,
.site-consent__switch-input:focus-visible + .site-consent__switch-track,
.site-consent__close:focus-visible,
.site-consent__icon:focus-visible {
	outline: 3px solid var(--sc-accent);
	outline-offset: 2px;
}

.site-consent__button--accept {
	color: var(--sc-accept-text);
	background: var(--sc-accept-bg);
	border-color: var(--sc-accept-border);
}

.site-consent__button--reject {
	color: var(--sc-reject-text);
	background: var(--sc-reject-bg);
	border-color: var(--sc-reject-border);
}

.site-consent__button--settings {
	color: var(--sc-settings-text);
	background: var(--sc-settings-bg);
	border-color: var(--sc-settings-border);
}

.site-consent__trigger {
	font-family: inherit;
	color: var(--sc-accent);
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.site-consent__trigger.site-consent__button {
	text-decoration: none;
}

/* -------------------------------------------------------------------------
   Modal
   ------------------------------------------------------------------------- */

.site-consent__overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(12, 14, 20, 0.5);
	opacity: 0;
	transition: opacity 200ms ease;
}

.site-consent__overlay--visible {
	opacity: 1;
}

.site-consent__modal {
	position: fixed;
	z-index: 1000000;
	top: 50%;
	left: 50%;
	width: min(560px, calc(100vw - 32px));
	max-height: min(86vh, 780px);
	transform: translate(-50%, -46%);
	opacity: 0;
	transition: opacity 200ms ease, transform 200ms ease;
}

.site-consent__modal--visible {
	opacity: 1;
	transform: translate(-50%, -50%);
}

.site-consent__modal-inner {
	display: flex;
	flex-direction: column;
	max-height: min(86vh, 780px);
	background: var(--sc-bg);
	border: 1px solid var(--sc-border);
	border-radius: var(--sc-radius);
	box-shadow: var(--sc-shadow);
	overflow: hidden;
}

.site-consent__modal-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: var(--sc-space) var(--sc-space) 12px;
	border-bottom: 1px solid var(--sc-border);
}

.site-consent__modal-head .site-consent__title {
	margin: 0;
}

.site-consent__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	margin: -8px -8px 0 0;
	color: var(--sc-muted);
	background: none;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.site-consent__close:hover {
	color: var(--sc-text);
	background: rgba(0, 0, 0, 0.05);
}

.site-consent__modal-body {
	flex: 1 1 auto;
	padding: var(--sc-space);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.site-consent__modal-foot {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	padding: 12px var(--sc-space) var(--sc-space);
	border-top: 1px solid var(--sc-border);
	background: var(--sc-bg);
}

.site-consent__modal-foot .site-consent__button--settings {
	grid-column: 1 / -1;
}

/* -------------------------------------------------------------------------
   Categories
   ------------------------------------------------------------------------- */

.site-consent__categories {
	margin: var(--sc-space) 0 0;
	padding: 0;
	list-style: none;
}

.site-consent__category {
	padding: 14px 0;
	border-top: 1px solid var(--sc-border);
}

.site-consent__category:first-child {
	border-top: 0;
	padding-top: 4px;
}

.site-consent__category-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 32px;
}

.site-consent__category-label {
	font-weight: 600;
	color: var(--sc-text);
	cursor: pointer;
}

.site-consent__badge {
	flex: 0 0 auto;
	padding: 4px 10px;
	font-size: calc(var(--sc-font-size) - 2px);
	font-weight: 600;
	color: var(--sc-muted);
	background: rgba(0, 0, 0, 0.05);
	border-radius: 999px;
}

.site-consent__category-desc {
	margin: 6px 0 0;
	color: var(--sc-muted);
	font-size: calc(var(--sc-font-size) - 1px);
}

.site-consent__category-desc:empty {
	display: none;
}

.site-consent__services {
	margin-top: 8px;
	font-size: calc(var(--sc-font-size) - 1px);
	color: var(--sc-muted);
}

.site-consent__services summary {
	cursor: pointer;
	padding: 6px 0;
	color: var(--sc-accent);
}

.site-consent__services ul {
	margin: 4px 0 0;
	padding-left: 18px;
}

.site-consent__services li {
	margin: 2px 0;
}

.site-consent__service-provider::before {
	content: " – ";
}

.site-consent__services a {
	color: var(--sc-accent);
}

/* -------------------------------------------------------------------------
   Switch. State is conveyed by text as well as colour and position.
   ------------------------------------------------------------------------- */

.site-consent__switch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	flex: 0 0 auto;
	position: relative;
}

.site-consent__switch-state {
	font-size: calc(var(--sc-font-size) - 2px);
	font-weight: 600;
	color: var(--sc-muted);
	white-space: nowrap;
}

/* The visible track is 52x32; the hit area is deliberately taller so the
   target comfortably exceeds WCAG 2.2 target size guidance on touch. */
.site-consent__switch-input {
	position: absolute;
	top: 50%;
	right: 0;
	width: 52px;
	height: 44px;
	margin: 0;
	transform: translateY(-50%);
	opacity: 0;
	cursor: pointer;
	z-index: 1;
}

.site-consent__switch-track {
	position: relative;
	display: block;
	width: 52px;
	height: 32px;
	background: #cfd4de;
	border: 1.5px solid #b7bdca;
	border-radius: 999px;
	transition: background 150ms ease, border-color 150ms ease;
}

.site-consent__switch-track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 23px;
	height: 23px;
	background: #ffffff;
	border-radius: 50%;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 150ms ease;
}

.site-consent__switch-input:checked + .site-consent__switch-track {
	background: var(--sc-accent);
	border-color: var(--sc-accent);
}

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

/* -------------------------------------------------------------------------
   Floating icon
   ------------------------------------------------------------------------- */

.site-consent__icon {
	position: fixed;
	z-index: 999997;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--sc-icon-size);
	height: var(--sc-icon-size);
	padding: 0;
	color: var(--sc-text);
	background: var(--sc-bg);
	border: 1px solid var(--sc-border);
	border-radius: 50%;
	box-shadow: var(--sc-shadow);
	cursor: pointer;
	transition: transform 150ms ease;
}

.site-consent__icon:hover {
	transform: scale(1.06);
}

.site-consent__icon--bottom-left {
	left: var(--sc-icon-x);
	bottom: calc(var(--sc-icon-y) + env(safe-area-inset-bottom, 0px));
}

.site-consent__icon--bottom-right {
	right: var(--sc-icon-x);
	bottom: calc(var(--sc-icon-y) + env(safe-area-inset-bottom, 0px));
}

/* -------------------------------------------------------------------------
   Blocked content placeholder
   ------------------------------------------------------------------------- */

.site-consent__placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 200px;
	padding: var(--sc-space);
	background: rgba(0, 0, 0, 0.03);
	border: 1px dashed var(--sc-border);
	border-radius: var(--sc-radius);
}

.site-consent__placeholder-inner {
	max-width: 420px;
	text-align: center;
}

.site-consent__placeholder-title {
	margin: 0 0 6px;
	font-size: var(--sc-heading-size);
	font-weight: var(--sc-heading-weight);
}

.site-consent__placeholder-text {
	margin: 0 0 14px;
	color: var(--sc-muted);
}

.site-consent__placeholder-note {
	margin: 10px 0 0;
	font-size: calc(var(--sc-font-size) - 2px);
	color: var(--sc-muted);
}

/* -------------------------------------------------------------------------
   Cookie declaration
   ------------------------------------------------------------------------- */

.site-consent__declaration-group {
	margin: 0 0 28px;
}

.site-consent__declaration-title {
	margin: 0 0 4px;
	font-size: calc(var(--sc-heading-size) + 1px);
	font-weight: var(--sc-heading-weight);
}

.site-consent__declaration-desc,
.site-consent__declaration-empty {
	margin: 0 0 12px;
	color: var(--sc-muted);
}

.site-consent__table-wrap {
	overflow-x: auto;
}

.site-consent__table {
	width: 100%;
	border-collapse: collapse;
	font-size: calc(var(--sc-font-size) - 1px);
}

.site-consent__table th,
.site-consent__table td {
	padding: 10px 12px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var(--sc-border);
}

.site-consent__table th {
	font-weight: 600;
	white-space: nowrap;
}

.site-consent__table code {
	font-size: inherit;
	word-break: break-word;
}

.site-consent__declaration-status {
	color: var(--sc-muted);
}

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

@media (max-width: 600px) {
	.site-consent__banner {
		left: 12px;
		right: 12px;
		bottom: max(12px, env(safe-area-inset-bottom, 0px));
		width: auto;
		max-width: none;
	}

	.site-consent__banner--bottom-center {
		left: 12px;
		transform: translateY(12px);
	}

	.site-consent__banner--bottom-center.site-consent__banner--visible {
		transform: translateY(0);
	}

	.site-consent__modal {
		top: auto;
		bottom: 0;
		left: 0;
		width: 100%;
		max-height: 92vh;
		transform: translateY(16px);
		border-radius: 0;
	}

	.site-consent__modal--visible {
		transform: translateY(0);
	}

	.site-consent__modal-inner {
		max-height: 92vh;
		border-radius: var(--sc-radius) var(--sc-radius) 0 0;
		border-bottom: 0;
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	.site-consent__actions,
	.site-consent__modal-foot {
		grid-template-columns: 1fr;
	}

	.site-consent__category-head {
		flex-wrap: wrap;
	}

	.site-consent__table thead {
		display: none;
	}

	.site-consent__table,
	.site-consent__table tbody,
	.site-consent__table tr,
	.site-consent__table td {
		display: block;
		width: 100%;
	}

	.site-consent__table tr {
		padding: 8px 0;
		border-bottom: 1px solid var(--sc-border);
	}

	.site-consent__table td {
		border: 0;
		padding: 3px 0;
	}

	.site-consent__table td::before {
		content: attr(data-label) ": ";
		font-weight: 600;
	}
}

@media (max-width: 360px) {
	.site-consent {
		--sc-space: 16px;
	}
}

/* -------------------------------------------------------------------------
   Motion and contrast preferences
   ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.site-consent__banner,
	.site-consent__modal,
	.site-consent__overlay,
	.site-consent__button,
	.site-consent__icon,
	.site-consent__switch-track,
	.site-consent__switch-track::after {
		transition: none !important;
	}

	.site-consent__banner {
		transform: none;
	}

	.site-consent__icon:hover {
		transform: none;
	}
}

@media (forced-colors: active) {
	.site-consent__card,
	.site-consent__modal-inner,
	.site-consent__icon,
	.site-consent__button {
		border: 1px solid ButtonText;
	}

	.site-consent__switch-track {
		border: 2px solid ButtonText;
	}
}

.site-consent__status {
	margin: 14px 0 0;
	font-size: calc(var(--sc-font-size) - 1px);
	color: var(--sc-muted);
}

.site-consent__declaration-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 20px;
}
