/**
 * CookieVakt front-end styles.
 *
 * Colours come from the settings as custom properties, set inline on :root, so
 * a site can be recoloured without touching this file.
 *
 * A word on the !important flags, which are otherwise not something to reach
 * for. This banner is dropped into somebody else's theme, and themes style
 * `button` and `a` freely — Elementor kits in particular set colour, fill,
 * padding and, fatally, `display`, which overrides the browser's own rule for
 * the hidden attribute and reveals controls that are supposed to be waiting
 * their turn. The declarations that decide whether a control is visible, and
 * which of two buttons is the emphasised one, are therefore defended. Anything
 * a site might reasonably want to restyle is left alone, and the Extra CSS box
 * in the settings loads after this file.
 *
 * The accept and reject buttons are deliberately the same size, in the same
 * row, with the same padding and the same font weight. Only the fill differs.
 * A refusal that is harder to find than an acceptance is not a free choice,
 * and the design should not be the place that quietly reintroduces one.
 */

.cookievakt {
	--cookievakt-bg: #fff;
	--cookievakt-text: #14161a;
	--cookievakt-accent: #14161a;
	--cookievakt-accent-text: #fff;
	--cookievakt-border: #d9dde3;
	--cookievakt-radius: 10px;

	position: fixed;
	inset: 0;
	z-index: 2147483000;
	pointer-events: none;
}

/* Visibility. A theme that styles `button` or `div` with a display value
   would otherwise override the browser's rule for the hidden attribute, and
   the banner would show controls before their turn. */

.cookievakt[hidden],
.cookievakt__prefs[hidden],
.cookievakt__button[hidden],
.cookievakt-reopen[hidden] {
	display: none !important;
}

.cookievakt__overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 12, 16, .45);
	pointer-events: auto;
}

.cookievakt .cookievakt__dialog {
	position: absolute;
	box-sizing: border-box;
	width: min(420px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	margin: 0;
	padding: 22px 24px;
	background: var(--cookievakt-bg) !important;
	color: var(--cookievakt-text) !important;
	border: 1px solid var(--cookievakt-border);
	border-radius: var(--cookievakt-radius);
	box-shadow: 0 18px 48px rgba(10, 12, 16, .18);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.55;
	text-align: left;
	pointer-events: auto;
}

/* Where the card sits. */

.cookievakt[data-position="bottom-left"] .cookievakt__dialog {
	bottom: 16px;
	left: 16px;
}

.cookievakt[data-position="bottom-right"] .cookievakt__dialog {
	right: 16px;
	bottom: 16px;
}

.cookievakt[data-position="bottom"] .cookievakt__dialog,
.cookievakt[data-position="top"] .cookievakt__dialog {
	left: 50%;
	transform: translateX(-50%);
}

.cookievakt[data-position="bottom"] .cookievakt__dialog {
	bottom: 16px;
}

.cookievakt[data-position="top"] .cookievakt__dialog {
	top: 16px;
}

/* Full-width bar. */

.cookievakt[data-layout="bar"] .cookievakt__dialog {
	width: 100%;
	max-width: none;
	left: 0;
	right: 0;
	transform: none;
	border-radius: 0;
	border-left: 0;
	border-right: 0;
}

.cookievakt[data-layout="bar"][data-position="top"] .cookievakt__dialog {
	top: 0;
	bottom: auto;
}

.cookievakt[data-layout="bar"]:not([data-position="top"]) .cookievakt__dialog {
	top: auto;
	bottom: 0;
}

.cookievakt[data-layout="bar"] .cookievakt__dialog > * {
	max-width: 1180px;
	margin-inline: auto;
}

/* Centred dialog. */

.cookievakt[data-layout="center"] .cookievakt__dialog {
	top: 50%;
	left: 50%;
	right: auto;
	bottom: auto;
	transform: translate(-50%, -50%);
	width: min(560px, calc(100vw - 32px));
}

/* Text. */

.cookievakt .cookievakt__title {
	margin: 0 0 8px;
	padding: 0;
	color: var(--cookievakt-text) !important;
	font-family: inherit;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
}

.cookievakt .cookievakt__body {
	margin: 0 0 16px;
}

.cookievakt .cookievakt__body p,
.cookievakt .cookievakt__prefs-body,
.cookievakt .cookievakt__category-description {
	color: var(--cookievakt-text) !important;
	font-family: inherit;
}

.cookievakt .cookievakt__body p {
	margin: 0 0 8px;
	font-size: 15px;
	line-height: 1.55;
}

.cookievakt .cookievakt__dialog a {
	color: var(--cookievakt-accent) !important;
	text-decoration: underline;
	background: none;
}

.cookievakt .cookievakt__privacy {
	margin: 8px 0 0;
	font-size: 14px;
}

/* Buttons. Refuse and accept sit side by side; the way into the switches sits
   under them, full width, looking like the secondary action it is. */

.cookievakt .cookievakt__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

.cookievakt .cookievakt__button {
	flex: 1 1 calc(50% - 4px);
	box-sizing: border-box;
	min-height: 44px;
	width: auto;
	margin: 0;
	padding: 11px 16px;
	border: 1px solid var(--cookievakt-accent) !important;
	border-radius: calc(var(--cookievakt-radius) - 3px);
	background: transparent !important;
	color: var(--cookievakt-accent) !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: normal;
	text-align: center;
	text-decoration: none !important;
	text-transform: none;
	box-shadow: none !important;
	appearance: none;
	cursor: pointer;
	transition: opacity .15s ease;
}

.cookievakt .cookievakt__button--primary {
	background: var(--cookievakt-accent) !important;
	border-color: var(--cookievakt-accent) !important;
	color: var(--cookievakt-accent-text) !important;
}

.cookievakt .cookievakt__button--ghost {
	flex: 1 1 100%;
	min-height: 38px;
	padding: 8px 16px;
	border-color: transparent !important;
	font-weight: 500;
	text-decoration: underline !important;
}

.cookievakt .cookievakt__button:hover {
	opacity: .85;
}

.cookievakt .cookievakt__button:focus-visible,
.cookievakt-reopen:focus-visible,
.cookievakt .cookievakt__switch input:focus-visible + .cookievakt__switch-track {
	outline: 2px solid var(--cookievakt-accent);
	outline-offset: 2px;
}

/* The category toggles.
 *
 * Opening them roughly triples the height of the card, which on a normal
 * laptop means a scrollbar and a visitor reading four descriptions through a
 * letterbox. So the card widens as it opens and the categories go into two
 * columns: the same content, about half as tall, and no scrolling for the
 * usual four categories. The scroll fallback stays for short viewports. */

.cookievakt[data-prefs="open"] .cookievakt__dialog {
	width: min(780px, calc(100vw - 32px));
}

.cookievakt .cookievakt__prefs {
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--cookievakt-border);
}

.cookievakt .cookievakt__prefs-title {
	margin: 0 0 4px;
	padding: 0;
	color: var(--cookievakt-text) !important;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.3;
	text-transform: none;
}

.cookievakt .cookievakt__prefs-body {
	margin: 0 0 12px;
	font-size: 14px;
}

.cookievakt .cookievakt__categories {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cookievakt .cookievakt__category {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cookievakt .cookievakt__category + .cookievakt__category {
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px solid var(--cookievakt-border);
}

/* Two columns once there is room for them. Each item carries its own rule
   above it, since in a grid there is no such thing as the previous sibling
   being the one directly above. */

@media (min-width: 700px) {
	.cookievakt[data-prefs="open"] .cookievakt__categories {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
		gap: 4px 32px;
	}

	.cookievakt[data-prefs="open"] .cookievakt__category {
		padding-top: 12px;
		border-top: 1px solid var(--cookievakt-border);
	}

	.cookievakt[data-prefs="open"] .cookievakt__category + .cookievakt__category {
		margin-top: 0;
		padding-top: 12px;
	}
}

.cookievakt .cookievakt__switch {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	color: var(--cookievakt-text) !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.cookievakt .cookievakt__switch input {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	min-height: 0 !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0 !important;
	opacity: 0;
}

.cookievakt .cookievakt__switch-track {
	position: relative;
	flex: 0 0 auto;
	display: block;
	width: 40px;
	height: 22px;
	border-radius: 999px;
	background: #c9ced6;
	transition: background .15s ease;
}

.cookievakt .cookievakt__switch-track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #fff;
	transition: transform .15s ease;
}

.cookievakt .cookievakt__switch input:checked + .cookievakt__switch-track {
	background: var(--cookievakt-accent);
}

.cookievakt .cookievakt__switch input:checked + .cookievakt__switch-track::after {
	transform: translateX(18px);
}

.cookievakt .cookievakt__switch input:disabled + .cookievakt__switch-track {
	opacity: .55;
	cursor: not-allowed;
}

.cookievakt .cookievakt__always {
	margin-left: 6px;
	font-size: 12px;
	font-style: normal;
	font-weight: 400;
	opacity: .7;
}

.cookievakt .cookievakt__category-description {
	margin: 6px 0 0;
	font-size: 14px;
	line-height: 1.5;
	opacity: .8;
}

/* The floating reopen button. */

.cookievakt-reopen {
	position: fixed;
	z-index: 2147482000;
	min-height: 40px;
	margin: 0;
	padding: 10px 16px;
	border: 1px solid var(--cookievakt-border, #d9dde3) !important;
	border-radius: 999px;
	background: var(--cookievakt-bg, #fff) !important;
	color: var(--cookievakt-text, #14161a) !important;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none !important;
	text-transform: none;
	box-shadow: 0 6px 20px rgba(10, 12, 16, .16);
	appearance: none;
	cursor: pointer;
}

.cookievakt-reopen[data-position="bottom-left"] {
	left: 16px;
	bottom: 16px;
}

.cookievakt-reopen[data-position="bottom-right"] {
	right: 16px;
	bottom: 16px;
}

/* Blocked embeds and what stands in for them. */

iframe[data-cookievakt] {
	display: none !important;
}

.cookievakt-placeholder {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	width: 100%;
	min-height: 180px;
	padding: 24px;
	background: #f2f3f5;
	border: 1px dashed #c3c8d0;
	border-radius: 8px;
	color: #14161a;
	text-align: center;
}

.cookievakt-placeholder__text {
	margin: 0;
	max-width: 46ch;
	color: inherit !important;
	font-size: 15px;
	line-height: 1.5;
}

.cookievakt-placeholder__meta {
	margin: 0;
	color: inherit !important;
	font-size: 13px;
	opacity: .75;
}

.cookievakt-placeholder__button {
	min-height: 40px;
	margin: 0;
	padding: 9px 18px;
	border: 0 !important;
	border-radius: 6px;
	background: var(--cookievakt-accent, #14161a) !important;
	color: var(--cookievakt-accent-text, #fff) !important;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	text-decoration: none !important;
	text-transform: none;
	box-shadow: none !important;
	appearance: none;
	cursor: pointer;
}

/* The declaration table on the privacy page. */

.cookievakt-declaration__table {
	width: 100%;
	margin: 0 0 28px;
	border-collapse: collapse;
	font-size: 14px;
}

.cookievakt-declaration__table th,
.cookievakt-declaration__table td {
	padding: 8px 10px;
	border: 1px solid #d9dde3;
	text-align: left;
	vertical-align: top;
}

.cookievakt-declaration__table th {
	background: #f6f7f8;
	font-weight: 600;
}

.cookievakt-declaration__title {
	margin: 24px 0 4px;
}

.cookievakt-declaration__description {
	margin: 0 0 10px;
}

/* Small screens: the two answers go full width, one under the other, neither
   easier to hit than the other. */

@media (max-width: 480px) {
	.cookievakt .cookievakt__dialog,
	.cookievakt[data-prefs="open"] .cookievakt__dialog {
		width: calc(100vw - 16px);
		left: 8px;
		right: 8px;
		bottom: 8px;
		transform: none;
	}

	.cookievakt[data-layout="center"] .cookievakt__dialog {
		top: auto;
		transform: none;
	}

	.cookievakt .cookievakt__button {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cookievakt .cookievakt__button,
	.cookievakt .cookievakt__switch-track,
	.cookievakt .cookievakt__switch-track::after {
		transition: none;
	}
}
