/**
 * Hapster consent UI.
 *
 * Accessibility rules that must survive future restyling:
 *  - .hapster-consent-btn--equal is used by BOTH "Reject all" and "Accept all".
 *    They must stay visually identical: same size, weight, colour and contrast.
 *    Do not add a modifier that makes one of them quieter than the other.
 *  - :focus-visible outlines must remain visible against every background here.
 *  - Nothing in this file may hide the refusal path at any viewport width.
 */

.hapster-consent {
	--hc-ink: var(--hapster-ink, #131313);
	--hc-muted: var(--hapster-muted, #56514b);
	--hc-surface: var(--hapster-surface, #ffffff);
	--hc-line: var(--hapster-line, #ddd6cc);
	--hc-focus: #0b57d0;

	font-family: var(--hapster-ds-font-family, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	color: var(--hc-ink);
}

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

/* ------------------------------------------------------------------ banner */

.hapster-consent__banner {
	position: fixed;
	z-index: 99999;
	inset-inline: 0;
	inset-block-end: 0;
	margin: 0 auto;
	max-width: 46rem;
	background: var(--hc-surface);
	border: 1px solid var(--hc-line);
	border-block-end: 0;
	border-start-start-radius: 16px;
	border-start-end-radius: 16px;
	box-shadow: 0 -8px 32px rgb(0 0 0 / 14%);
	padding: 1.25rem 1.25rem 1.5rem;
}

@media (min-width: 48rem) {
	.hapster-consent__banner {
		inset-block-end: 1.25rem;
		border-block-end: 1px solid var(--hc-line);
		border-radius: 16px;
	}
}

.hapster-consent__title {
	margin: 0 0 0.5rem;
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.3;
	color: var(--hc-ink);
}

.hapster-consent__body {
	margin: 0 0 0.75rem;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--hc-muted);
}

.hapster-consent__policy {
	margin: 0 0 1rem;
	font-size: 0.8125rem;
}

.hapster-consent__policy a {
	color: var(--hc-ink);
	text-decoration: underline;
}

/* ----------------------------------------------------------------- actions */

.hapster-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
	align-items: stretch;
}

.hapster-consent-btn {
	flex: 1 1 12rem;
	min-height: 2.875rem;
	padding: 0.6875rem 1.125rem;
	border-radius: 999px;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	text-align: center;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/*
 * Accept and Reject share this one rule. Contrast of #ffffff on #131313 is
 * ~16.6:1, well clear of the WCAG AA 4.5:1 threshold for body-size text.
 */
.hapster-consent-btn--equal {
	background: var(--hc-ink);
	color: #ffffff;
	border: 1px solid var(--hc-ink);
}

.hapster-consent-btn--equal:hover,
.hapster-consent-btn--equal:focus-visible {
	background: #000000;
	border-color: #000000;
}

.hapster-consent-btn--ghost {
	background: transparent;
	color: var(--hc-ink);
	border: 1px solid var(--hc-line);
}

.hapster-consent-btn--ghost:hover,
.hapster-consent-btn--ghost:focus-visible {
	border-color: var(--hc-ink);
}

.hapster-consent-btn--primary {
	background: var(--hc-ink);
	color: #ffffff;
	border: 1px solid var(--hc-ink);
}

.hapster-consent :focus-visible {
	outline: 3px solid var(--hc-focus);
	outline-offset: 2px;
}

/* -------------------------------------------------------- preference centre */

.hapster-consent__overlay {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgb(0 0 0 / 55%);
}

.hapster-consent__prefs {
	position: fixed;
	z-index: 100000;
	inset-block: 0;
	inset-inline-end: 0;
	width: min(32rem, 100%);
	overflow-y: auto;
	background: var(--hc-surface);
	border-inline-start: 1px solid var(--hc-line);
	padding: 1.5rem 1.25rem 2rem;
}

.hapster-consent__prefs-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
}

.hapster-consent__close {
	flex: 0 0 auto;
	width: 2.25rem;
	height: 2.25rem;
	border: 1px solid var(--hc-line);
	border-radius: 999px;
	background: transparent;
	font-size: 1.25rem;
	line-height: 1;
	color: var(--hc-ink);
	cursor: pointer;
}

.hapster-consent__categories {
	list-style: none;
	margin: 1.25rem 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.hapster-consent__category {
	border: 1px solid var(--hc-line);
	border-radius: 12px;
	padding: 0.875rem 1rem;
}

.hapster-consent__category-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
}

.hapster-consent__category-label {
	font-size: 0.9375rem;
	font-weight: 650;
	color: var(--hc-ink);
	cursor: pointer;
}

.hapster-consent__always {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--hc-muted);
	white-space: nowrap;
}

/* Native checkbox kept in the accessibility tree and keyboard-operable. */
.hapster-consent__toggle {
	flex: 0 0 auto;
	width: 1.375rem;
	height: 1.375rem;
	accent-color: var(--hc-ink);
	cursor: pointer;
}

.hapster-consent__category-desc {
	margin: 0.5rem 0 0;
	font-size: 0.8125rem;
	line-height: 1.55;
	color: var(--hc-muted);
}

.hapster-consent__services {
	margin-top: 0.625rem;
	font-size: 0.8125rem;
	color: var(--hc-muted);
}

.hapster-consent__services summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--hc-ink);
}

.hapster-consent__services ul {
	margin: 0.5rem 0 0;
	padding-inline-start: 1rem;
}

.hapster-consent__services li {
	margin-bottom: 0.5rem;
}

.hapster-consent__vendor,
.hapster-consent__purpose,
.hapster-consent__hosts,
.hapster-consent__cookies,
.hapster-consent__unverified {
	display: block;
	line-height: 1.5;
}

.hapster-consent__hosts,
.hapster-consent__unverified {
	font-style: italic;
}

.hapster-consent__note {
	margin: 0.75rem 0 0;
	font-size: 0.75rem;
	line-height: 1.55;
	color: var(--hc-muted);
}

.hapster-consent__prefs .hapster-consent__actions {
	margin-top: 1.25rem;
}

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

body.hapster-consent-locked {
	overflow: hidden;
}

/* ------------------------------------------------- blocked-content placeholder */

.hapster-consent-placeholder {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	align-items: flex-start;
	padding: 1.25rem;
	border: 1px dashed var(--hapster-line, #ddd6cc);
	border-radius: 12px;
	background: var(--hapster-bg, #f6f4ef);
	color: var(--hapster-ink, #131313);
	font-family: var(--hapster-ds-font-family, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.hapster-consent-placeholder__title {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 700;
}

.hapster-consent-placeholder__body {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.55;
	color: var(--hapster-muted, #56514b);
}

.hapster-consent-placeholder__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.25rem 0 0;
}

.hapster-consent-placeholder .hapster-consent-btn {
	flex: 0 0 auto;
}

.hapster-consent-placeholder :focus-visible {
	outline: 3px solid #0b57d0;
	outline-offset: 2px;
}

.hapster-consent-blocked-frame {
	display: none !important;
}

/* --------------------------------------------------------- footer settings */

.hapster-consent-settings-link {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	text-align: inherit;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.hapster-consent-settings-link:focus-visible {
	outline: 3px solid #0b57d0;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.hapster-consent-btn {
		transition: none;
	}
}
