/*
 * Drie-O: the cookie banner of the Web&Wij plugin in the style of drieo.nl (05_media/huisstijl.md).
 *
 * Loads after the style of the plugin, and only on pages that show the banner (inc/cookiebanner.php).
 * Every selector starts with .wwcb, .wwcb-settings or .wwcb-placeholder: the reset of Hello Elementor
 * ([type=button]:hover turns buttons pink) and the kit of Elementor (.elementor-kit-10 h2) are heavier than the
 * classes of the plugin alone.
 *
 * Computer: a low bar at the bottom, as wide as the content. Phone: a narrow bar against the bottom edge with
 * accept and reject side by side, so a form above the fold (like on /nis2-checklist/) stays free.
 * Accept and reject always look the same.
 */

:root {
	--wwcb-bg: #fff;
	--wwcb-text: #242d54;
	--wwcb-muted: #5a6072;
	--wwcb-border: #dbdbdb;
	--wwcb-accent: #242d54;
	--wwcb-accent-text: #fff;
	--wwcb-secondary-bg: transparent;
	--wwcb-secondary-text: #242d54;
	--wwcb-focus: #242d54;
	--wwcb-font: "Open Sans", "Segoe UI", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
	--wwcb-heading-font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
	--wwcb-radius: 15px;
	--wwcb-button-radius: 999px;
	--wwcb-shadow: 0 10px 30px rgba(31, 39, 80, 0.18);
	--wwcb-max-width: 1300px;
}

/* Text */

.wwcb .wwcb__title,
.wwcb-settings .wwcb__title {
	margin: 0 0 4px;
	font-family: var(--_heading-font);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0;
	text-transform: none;
	color: var(--_text);
}

.wwcb .wwcb__text,
.wwcb-settings .wwcb__text {
	font-family: var(--_font);
	font-size: 14.5px;
	line-height: 1.55;
	color: var(--_text);
}

.wwcb .wwcb__link,
.wwcb-settings .wwcb__link {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.wwcb .wwcb__link:hover,
.wwcb-settings .wwcb__link:hover {
	color: #0978bf;
}

/* Buttons: pills in the letter of the headings */

.wwcb .wwcb__button,
.wwcb-settings .wwcb__button,
.wwcb-placeholder .wwcb__button {
	min-height: 44px;
	padding: 10px 22px;
	font-family: var(--_heading-font);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
	white-space: normal;
	border-style: solid;
	border-width: 2px;
	border-radius: var(--_button-radius);
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wwcb .wwcb__button--main,
.wwcb .wwcb__button--main:focus,
.wwcb-settings .wwcb__button--main,
.wwcb-settings .wwcb__button--main:focus,
.wwcb-placeholder .wwcb__button--main,
.wwcb-placeholder .wwcb__button--main:focus {
	color: var(--_accent-text);
	background: var(--_accent);
	border-color: var(--_accent);
}

.wwcb .wwcb__button--main:hover,
.wwcb-settings .wwcb__button--main:hover,
.wwcb-placeholder .wwcb__button--main:hover {
	color: #fff;
	background: #0978bf;
	border-color: #0978bf;
}

.wwcb .wwcb__button--secondary,
.wwcb .wwcb__button--secondary:focus,
.wwcb-settings .wwcb__button--secondary,
.wwcb-settings .wwcb__button--secondary:focus {
	color: var(--_secondary-text);
	background: var(--_secondary-bg);
	border-color: var(--_border);
}

.wwcb .wwcb__button--secondary:hover,
.wwcb-settings .wwcb__button--secondary:hover {
	color: var(--_text);
	background: #f5f5f5;
	border-color: var(--_text);
}

/* Text button: the settings link in the footer */

body .webwij-consent-link,
body .webwij-consent-link:hover,
body .webwij-consent-link:focus {
	display: inline;
	min-height: 0;
	padding: 4px 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: normal;
	background: none;
	border: 0;
	border-radius: 0;
}

/*
 * The settings window: one calm list with a line between the kinds of cookies. Per kind the name left and a
 * switch right, the explanation under it and "Diensten en cookies" as a blue link that opens a grey block with
 * the details. The buttons stay at the bottom while the window scrolls. The banner hides while the window is open.
 * Selectors are heavier than the kit of Elementor (.elementor-kit-10 input:focus:not(...) is 0,4,1) and the
 * table reset of Hello Elementor.
 */

body:has(.wwcb-settings[open]) .wwcb {
	visibility: hidden;
}

.wwcb-settings {
	width: min(600px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	color: var(--_text);
	border: 0;
	border-radius: var(--_radius);
	box-shadow: 0 24px 60px rgba(31, 39, 80, 0.35);
}

.wwcb-settings::backdrop {
	background: rgba(31, 39, 80, 0.6);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}

.wwcb-settings .wwcb-settings__inner {
	padding: 28px 32px 0;
}

.wwcb-settings .wwcb-settings__head {
	align-items: center;
	margin: 0 0 8px;
}

.wwcb-settings .wwcb-settings__head .wwcb__title {
	margin: 0;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.2;
}

/* Back: a small pill with an arrow, top right */

.wwcb-settings .wwcb-settings__back,
.wwcb-settings .wwcb-settings__back:hover,
.wwcb-settings .wwcb-settings__back:focus {
	display: inline-flex;
	flex: none;
	gap: 8px;
	align-items: center;
	min-height: 36px;
	padding: 6px 16px 6px 14px;
	font-family: var(--_heading-font);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	color: var(--_text);
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	background: #fff;
	border: 1px solid var(--_border);
	border-radius: 999px;
}

.wwcb-settings .wwcb-settings__back:hover {
	background: #f5f5f5;
	border-color: var(--_text);
}

.wwcb-settings .wwcb-settings__back::before {
	width: 7px;
	height: 7px;
	content: "";
	border-bottom: 2px solid currentColor;
	border-left: 2px solid currentColor;
	transform: rotate(45deg);
}

.wwcb-settings .wwcb-settings__inner > .wwcb__text {
	margin: 0 0 20px;
	font-size: 15px;
	color: var(--_muted);
}

/* The kinds of cookies */

.wwcb-settings .wwcb-cat {
	padding: 18px 0;
	border-top: 1px solid var(--_border);
}

.wwcb-settings .wwcb-cat__head {
	flex-direction: row-reverse;
	gap: 16px;
	align-items: center;
	justify-content: space-between;
}

.wwcb-settings .wwcb-cat__label {
	flex: 1;
	margin: 0;
	font-family: var(--_heading-font);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--_text);
	cursor: pointer;
}

.wwcb-settings .wwcb-cat__switch:disabled + .wwcb-cat__label {
	cursor: default;
}

.wwcb-settings .wwcb-cat__switch:disabled + .wwcb-cat__label::after {
	margin-left: 10px;
	font-family: var(--_font);
	font-size: 14px;
	font-weight: 400;
	color: var(--_muted);
	content: "altijd aan";
}

.wwcb-settings .wwcb-cat__text {
	max-width: 46ch;
	margin: 4px 0 0;
	font-family: var(--_font);
	font-size: 15px;
	line-height: 1.55;
	color: var(--_muted);
}

/* The switch: grey when off, blue when on. The knob is a gradient, so it also works where an input has no ::before. */

body .wwcb-settings input.wwcb-cat__switch[type="checkbox"][role="switch"] {
	flex: none;
	width: 46px;
	height: 26px;
	padding: 0;
	margin: 0;
	cursor: pointer;
	background: #8b90a3 radial-gradient(circle, #fff 0 9px, transparent 9.5px) no-repeat 3px 50% / 20px 20px;
	border: 0;
	border-radius: 999px;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

body .wwcb-settings input.wwcb-cat__switch[type="checkbox"][role="switch"]:checked {
	background-color: #0978bf;
	background-position: calc(100% - 3px) 50%;
}

body .wwcb-settings input.wwcb-cat__switch[type="checkbox"][role="switch"]:disabled {
	cursor: default;
	opacity: 0.5;
}

body .wwcb-settings input.wwcb-cat__switch[type="checkbox"][role="switch"]:focus-visible {
	outline: 3px solid var(--_focus);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {

	body .wwcb-settings input.wwcb-cat__switch[type="checkbox"][role="switch"] {
		transition: background-color 0.15s ease, background-position 0.15s ease;
	}
}

/* Services and cookies: a blue link with an arrow, the details in a grey block */

.wwcb-settings .wwcb-cat__details {
	margin-top: 10px;
	font-size: 14px;
}

.wwcb-settings .wwcb-cat__details summary {
	display: inline-flex;
	gap: 8px;
	align-items: center;
	font-family: var(--_heading-font);
	font-size: 14px;
	font-weight: 600;
	color: #06598e;
	list-style: none;
}

.wwcb-settings .wwcb-cat__details summary::-webkit-details-marker {
	display: none;
}

.wwcb-settings .wwcb-cat__details summary::after {
	width: 7px;
	height: 7px;
	margin-top: -4px;
	content: "";
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
}

.wwcb-settings .wwcb-cat__details[open] summary::after {
	margin-top: 4px;
	transform: rotate(-135deg);
}

@media (hover: hover) {

	.wwcb-settings .wwcb-cat__details summary:hover {
		color: #0978bf;
		text-decoration: underline;
		text-underline-offset: 2px;
	}
}

.wwcb-settings .wwcb-services {
	padding: 4px 16px;
	margin: 12px 0 0;
	background: #f5f5f5;
	border-radius: 10px;
}

.wwcb-settings .wwcb-service {
	padding: 12px 0;
}

.wwcb-settings .wwcb-service + .wwcb-service {
	margin-top: 0;
	border-top: 1px solid var(--_border);
}

.wwcb-settings .wwcb-service p {
	margin: 0;
	font-family: var(--_font);
	font-size: 14px;
	line-height: 1.5;
	color: var(--_muted);
}

.wwcb-settings .wwcb-service p + p {
	margin-top: 4px;
}

.wwcb-settings .wwcb-service .wwcb-service__name {
	font-size: 14.5px;
	color: var(--_text);
}

.wwcb-settings .wwcb-service .wwcb-service__name strong {
	font-weight: 700;
}

.wwcb-settings .wwcb-cookies {
	width: 100%;
	margin: 8px 0 0;
	font-size: 13px;
	line-height: 1.45;
	background: none;
	border: 0;
	border-collapse: collapse;
}

.wwcb-settings .wwcb-cookies th,
.wwcb-settings .wwcb-cookies td {
	padding: 6px 12px 6px 0;
	color: var(--_text);
	text-align: left;
	vertical-align: top;
	background: none;
	border: 0;
	border-bottom: 1px solid var(--_border);
}

.wwcb-settings .wwcb-cookies th {
	font-family: var(--_font);
	font-size: 12.5px;
	font-weight: 600;
	color: var(--_muted);
}

.wwcb-settings .wwcb-cookies tr:last-child td {
	border-bottom: 0;
}

.wwcb-settings .wwcb-cookies code {
	padding: 0;
	font-family: Consolas, "SFMono-Regular", Menlo, monospace;
	font-size: 12.5px;
	color: var(--_text);
	word-break: normal;
	white-space: nowrap;
	background: none;
}

/* The buttons stay at the bottom: accept and reject side by side, save next to them */

.wwcb-settings .wwcb__buttons {
	position: sticky;
	bottom: 0;
	z-index: 1;
	display: grid;
	grid-template-columns: 1fr 1fr 1fr;
	gap: 8px;
	padding: 16px 32px;
	margin: 0 -32px;
	background: var(--_bg);
	border-top: 1px solid var(--_border);
}

.wwcb-settings .wwcb__buttons .wwcb__button {
	padding: 10px 14px;
}

.wwcb-settings .wwcb-settings__inner > p.wwcb__text:last-child {
	padding: 2px 0 18px;
	margin: 0;
	font-size: 14px;
	text-align: center;
}

/* Computer: one low bar, text left and the buttons right */

@media (min-width: 1100px) {

	.wwcb {
		right: 24px;
		bottom: 24px;
		left: 24px;
	}

	.wwcb .wwcb__inner {
		display: grid;
		grid-template-areas:
			"title buttons"
			"text buttons";
		grid-template-columns: minmax(0, 1fr) auto;
		column-gap: 40px;
		align-items: center;
		padding: 18px 24px;
	}

	.wwcb .wwcb__title {
		grid-area: title;
		align-self: end;
	}

	.wwcb .wwcb__text {
		grid-area: text;
		align-self: start;
		margin: 0;
	}

	/* Two equal columns: accept and reject as wide as the longest of the two. */
	.wwcb .wwcb__buttons {
		display: grid;
		grid-area: buttons;
		grid-template-columns: 1fr 1fr auto;
		gap: 8px;
	}
}

/*
 * Phone: a narrow bar against the bottom edge. The title is only for screen readers (the text says what it is
 * about), accept and reject side by side and Settings as a quiet link under them. At most 170 px high from 360 px
 * wide: on /nis2-check/ in a screen of 360 x 600 the button of the form ends at 426 px and the bar starts below it.
 */

@media (max-width: 599px) {

	.wwcb {
		right: 0;
		bottom: 0;
		left: 0;
		max-height: 75vh;
		border-width: 1px 0 0;
		border-radius: var(--_radius) var(--_radius) 0 0;
		box-shadow: 0 -6px 24px rgba(31, 39, 80, 0.16);
	}

	.wwcb .wwcb__inner {
		padding: 12px 16px calc(8px + env(safe-area-inset-bottom, 0px));
	}

	.wwcb .wwcb__title {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.wwcb .wwcb__text {
		margin: 0 0 8px;
		font-size: 13px;
		line-height: 1.45;
	}

	.wwcb .wwcb__buttons {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 2px 8px;
	}

	.wwcb .wwcb__button {
		padding: 8px 10px;
		font-size: 14px;
	}

	.wwcb .wwcb__button--secondary,
	.wwcb .wwcb__button--secondary:hover,
	.wwcb .wwcb__button--secondary:focus {
		grid-column: 1 / -1;
		min-height: 28px;
		padding: 4px 8px;
		font-family: var(--_font);
		font-size: 13px;
		text-decoration: underline;
		text-underline-offset: 2px;
		background: none;
		border-color: transparent;
	}
}

/* The smallest phones: three lines of text instead of four. */

@media (max-width: 359px) {

	.wwcb .wwcb__text {
		font-size: 12px;
	}

	.wwcb .wwcb__button {
		font-size: 13px;
	}
}

/* Phone: the settings window almost as wide as the screen, accept and reject side by side and save under them */

@media (max-width: 599px) {

	.wwcb-settings {
		width: calc(100vw - 24px);
		max-height: calc(100vh - 24px);
		max-height: calc(100dvh - 24px);
	}

	.wwcb-settings .wwcb-settings__inner {
		padding: 22px 20px 0;
	}

	.wwcb-settings .wwcb-settings__head .wwcb__title {
		font-size: 20px;
	}

	.wwcb-settings .wwcb-cat {
		padding: 16px 0;
	}

	.wwcb-settings .wwcb__buttons {
		grid-template-columns: 1fr 1fr;
		padding: 12px 20px;
		margin: 0 -20px;
	}

	.wwcb-settings .wwcb__buttons .wwcb__button {
		padding: 8px 10px;
		font-size: 14px;
	}

	.wwcb-settings .wwcb__buttons .wwcb__button--secondary {
		grid-column: 1 / -1;
	}
}
