/*
 * HFS Consent — the banner and the placeholder for a held frame.
 *
 * Every colour, radius and shadow is a custom property declared at zero
 * specificity, so a theme restyles the banner by setting the same properties
 * on :root — no selector of the theme's has to outrank one of these. Type is
 * inherited from the page.
 */

:where(:root) {
	--hfs-consent-surface: #fff;
	--hfs-consent-text: #1a1c21;
	--hfs-consent-muted: #565d69;
	--hfs-consent-line: #d9dde4;
	--hfs-consent-accent: #2c76a8;
	--hfs-consent-accent-strong: #245e86;
	--hfs-consent-on-accent: #fff;
	--hfs-consent-radius: 16px;
	--hfs-consent-button-radius: 999px;
	--hfs-consent-shadow: 0 2px 6px rgb(0 0 0 / 8%), 0 28px 64px -24px rgb(0 0 0 / 40%);
	--hfs-consent-title-font: inherit;
	--hfs-consent-embed-surface: #f4f6f8;
}

.hfs-consent {
	position: fixed;
	z-index: 99999;
	right: 16px;
	bottom: 16px;
	box-sizing: border-box;
	width: min(440px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	padding: 24px;
	border: 1px solid var(--hfs-consent-line);
	border-radius: var(--hfs-consent-radius);
	background: var(--hfs-consent-surface);
	box-shadow: var(--hfs-consent-shadow);
	color: var(--hfs-consent-text);
	font-size: 15px;
	line-height: 1.55;
	text-align: left;
}

.hfs-consent[hidden],
.hfs-consent [hidden] {
	display: none;
}

.hfs-consent__title {
	margin: 0 0 8px;
	color: inherit;
	font-family: var(--hfs-consent-title-font);
	font-size: 20px;
	line-height: 1.2;
	outline: none;
}

.hfs-consent__text {
	margin: 0;
	color: var(--hfs-consent-muted);
}

.hfs-consent a {
	color: var(--hfs-consent-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.hfs-consent__choices {
	display: grid;
	gap: 14px;
	margin: 20px 0 0;
	padding: 16px 0 0;
	border: 0;
	border-top: 1px solid var(--hfs-consent-line);
}

.hfs-consent__legend {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.hfs-consent__choice {
	display: grid;
	grid-template-columns: 20px 1fr;
	gap: 2px 12px;
	cursor: pointer;
}

.hfs-consent__choice input {
	grid-row: 1;
	width: 20px;
	height: 20px;
	margin: 1px 0 0;
	accent-color: var(--hfs-consent-accent);
	cursor: inherit;
}

.hfs-consent__choice input:disabled {
	cursor: default;
}

.hfs-consent__choice > span {
	grid-column: 2;
}

.hfs-consent__choice-name {
	font-weight: 600;
}

.hfs-consent__choice-name em {
	margin-left: 6px;
	color: var(--hfs-consent-muted);
	font-size: 13px;
	font-style: normal;
	font-weight: 400;
}

.hfs-consent__choice-text {
	color: var(--hfs-consent-muted);
	font-size: 14px;
}

.hfs-consent__choice-cookies {
	color: var(--hfs-consent-muted);
	font-size: 13px;
	overflow-wrap: anywhere;
}

.hfs-consent__buttons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-top: 20px;
}

/* Accept and reject share one style on purpose: a refusal is as easy as a yes. */
.hfs-consent__button {
	box-sizing: border-box;
	min-height: 44px;
	padding: 10px 18px;
	border: 1px solid var(--hfs-consent-accent);
	border-radius: var(--hfs-consent-button-radius);
	background: var(--hfs-consent-accent);
	color: var(--hfs-consent-on-accent);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.hfs-consent__button:hover {
	border-color: var(--hfs-consent-accent-strong);
	background: var(--hfs-consent-accent-strong);
}

.hfs-consent__button:focus-visible {
	outline: 2px solid var(--hfs-consent-accent);
	outline-offset: 2px;
}

/* Settings, and Save once the categories are open: the full width, under the two. */
.hfs-consent__button--quiet,
.hfs-consent__button--wide {
	grid-column: 1 / -1;
	order: 1;
}

.hfs-consent__button--quiet {
	border-color: var(--hfs-consent-line);
	background: transparent;
	color: var(--hfs-consent-text);
}

.hfs-consent__button--quiet:hover {
	border-color: var(--hfs-consent-accent);
	background: transparent;
	color: var(--hfs-consent-accent);
}

@media (max-width: 600px) {
	.hfs-consent {
		right: 8px;
		bottom: 8px;
		width: calc(100vw - 16px);
		max-height: calc(100vh - 16px);
		padding: 20px;
	}
}

/* A third-party frame waiting for consent, and the frame itself until then. */
iframe[data-hfs-consent-src] {
	display: none;
}

.hfs-consent-embed {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	width: 100%;
	height: 100%;
	min-height: 240px;
	padding: 24px;
	border-radius: inherit;
	background: var(--hfs-consent-embed-surface);
	color: var(--hfs-consent-text);
	font-size: 15px;
	line-height: 1.5;
	text-align: center;
}

.hfs-consent-embed p {
	max-width: 34em;
	margin: 0;
}

.hfs-consent-embed a {
	color: var(--hfs-consent-accent);
	font-size: 14px;
}

/* [hfs_consent_cookies]: the cookie table for the privacy policy. */
.hfs-consent-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
	line-height: 1.45;
}

.hfs-consent-table th,
.hfs-consent-table td {
	padding: 10px 12px 10px 0;
	border-bottom: 1px solid var(--hfs-consent-line);
	text-align: left;
	vertical-align: top;
}

.hfs-consent-table th {
	font-weight: 600;
}

.hfs-consent-table code {
	font-size: 0.9em;
	overflow-wrap: anywhere;
}

@media (max-width: 600px) {
	.hfs-consent-table {
		display: block;
		overflow-x: auto;
	}
}
