/**
 * HD Cookies - consent banner styles.
 *
 * Every visual value is a CSS custom property, so a client site can restyle
 * the banner entirely from its own theme stylesheet - no need to touch this
 * file or the JavaScript. Override any token under :root or .hdc-banner.
 */

:root {
	/* Structure */
	--hdc-font-family: inherit;
	--hdc-font-size: 15px;
	--hdc-line-height: 1.5;
	--hdc-z-index: 999999;
	--hdc-max-width: 460px;
	--hdc-gap: 16px;
	--hdc-padding: 24px;
	--hdc-radius: 10px;

	/* Surface */
	--hdc-bg: #ffffff;
	--hdc-fg: #1e1e1e;
	--hdc-muted-fg: #555555;
	--hdc-border: #e2e2e2;
	--hdc-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
	--hdc-backdrop: rgba(0, 0, 0, 0.45);

	/* Buttons */
	--hdc-btn-radius: 6px;
	--hdc-btn-padding: 11px 18px;
	--hdc-btn-font-weight: 600;

	--hdc-accept-bg: #1a7f4b;
	--hdc-accept-fg: #ffffff;
	--hdc-reject-bg: #f1f1f1;
	--hdc-reject-fg: #1e1e1e;
	--hdc-save-bg: transparent;
	--hdc-save-fg: #1a7f4b;
	--hdc-save-border: #1a7f4b;

	/* Category toggles */
	--hdc-toggle-on: #1a7f4b;
	--hdc-toggle-off: #c4c4c4;
	--hdc-toggle-knob: #ffffff;

	/* Focus - keep this visible for keyboard users (WCAG 2.4.7). */
	--hdc-focus-ring: 0 0 0 3px rgba(26, 127, 75, 0.45);
	--hdc-focus-outline: 2px solid #1a7f4b;

	/* Re-open control ([hdc_cookie_settings]). */
	--hdc-reopen-bg: #1e1e1e;
	--hdc-reopen-fg: #ffffff;

	/* Motion */
	--hdc-transition: 0.15s ease;
}

@media (prefers-color-scheme: dark) {
	:root {
		--hdc-bg: #1f1f1f;
		--hdc-fg: #f2f2f2;
		--hdc-muted-fg: #b2b2b2;
		--hdc-border: #3a3a3a;
		--hdc-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
		--hdc-reject-bg: #2e2e2e;
		--hdc-reject-fg: #f2f2f2;
		--hdc-reopen-bg: #f2f2f2;
		--hdc-reopen-fg: #1e1e1e;
	}
}

/* -------------------------------------------------------------------------
 * Container + backdrop
 * ---------------------------------------------------------------------- */
.hdc-banner[hidden] {
	display: none;
}

.hdc-banner {
	position: fixed;
	inset: 0;
	z-index: var(--hdc-z-index);
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	font-family: var(--hdc-font-family);
	font-size: var(--hdc-font-size);
	line-height: var(--hdc-line-height);
	color: var(--hdc-fg);
}

@media (min-width: 640px) {
	.hdc-banner {
		padding: 24px;
	}
}

.hdc-banner__backdrop {
	position: absolute;
	inset: 0;
	background: var(--hdc-backdrop);
}

/* -------------------------------------------------------------------------
 * Panel
 * ---------------------------------------------------------------------- */
.hdc-banner__panel {
	position: relative;
	width: 100%;
	max-width: var(--hdc-max-width);
	max-height: calc(100vh - 32px);
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: var(--hdc-gap);
	padding: var(--hdc-padding);
	background: var(--hdc-bg);
	border: 1px solid var(--hdc-border);
	border-radius: var(--hdc-radius);
	box-shadow: var(--hdc-shadow);
}

.hdc-banner__panel:focus {
	outline: none;
}

.hdc-banner__panel:focus-visible {
	outline: var(--hdc-focus-outline);
	outline-offset: 2px;
}

.hdc-banner__title {
	margin: 0;
	font-size: 1.15em;
}

.hdc-banner__body {
	margin: 0;
	color: var(--hdc-muted-fg);
}

.hdc-banner__privacy {
	color: inherit;
}

.hdc-banner__close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	line-height: 1;
	color: var(--hdc-muted-fg);
	background: transparent;
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.hdc-banner__close[hidden] {
	display: none;
}

.hdc-banner__close:focus-visible {
	outline: none;
	box-shadow: var(--hdc-focus-ring);
}

/* -------------------------------------------------------------------------
 * Category rows + toggle switch
 * ---------------------------------------------------------------------- */
.hdc-banner__categories {
	margin: 0;
	padding: 0;
	border: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.hdc-category {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.hdc-category__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.hdc-category__desc {
	margin: 0;
	font-size: 0.9em;
	color: var(--hdc-muted-fg);
}

.hdc-category__badge {
	flex: 0 0 auto;
	font-size: 0.72em;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--hdc-muted-fg);
}

.hdc-switch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
}

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

.hdc-switch__track {
	position: relative;
	flex: 0 0 auto;
	width: 40px;
	height: 22px;
	border-radius: 999px;
	background: var(--hdc-toggle-off);
	transition: background var(--hdc-transition);
}

.hdc-switch__track::after {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--hdc-toggle-knob);
	transition: transform var(--hdc-transition);
}

.hdc-switch__input:checked + .hdc-switch__track {
	background: var(--hdc-toggle-on);
}

.hdc-switch__input:checked + .hdc-switch__track::after {
	transform: translateX(18px);
}

.hdc-switch__input:disabled + .hdc-switch__track {
	opacity: 0.6;
}

.hdc-switch__input:focus-visible + .hdc-switch__track {
	box-shadow: var(--hdc-focus-ring);
}

.hdc-switch__label {
	user-select: none;
}

/* -------------------------------------------------------------------------
 * Actions
 * ---------------------------------------------------------------------- */
.hdc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.hdc-btn {
	flex: 1 1 auto;
	min-width: 120px;
	padding: var(--hdc-btn-padding);
	font: inherit;
	font-weight: var(--hdc-btn-font-weight);
	border: 1px solid transparent;
	border-radius: var(--hdc-btn-radius);
	cursor: pointer;
}

.hdc-btn:focus-visible {
	outline: none;
	box-shadow: var(--hdc-focus-ring);
}

.hdc-btn--accept {
	background: var(--hdc-accept-bg);
	color: var(--hdc-accept-fg);
}

.hdc-btn--reject {
	background: var(--hdc-reject-bg);
	color: var(--hdc-reject-fg);
}

.hdc-btn--save {
	background: var(--hdc-save-bg);
	color: var(--hdc-save-fg);
	border-color: var(--hdc-save-border);
}

/* -------------------------------------------------------------------------
 * Re-open control (shortcode) + a11y helper
 * ---------------------------------------------------------------------- */
.hdc-open-settings {
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	text-decoration: underline;
}

/* Redefined so the banner works on themes that lack WP's core helper. */
.hdc-banner .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* -------------------------------------------------------------------------
 * Small screens: full-width sheet
 * ---------------------------------------------------------------------- */
@media (max-width: 639px) {
	.hdc-banner {
		align-items: stretch;
		justify-content: stretch;
	}

	.hdc-banner__panel {
		max-width: none;
		max-height: 100vh;
		border-radius: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hdc-banner,
	.hdc-banner * {
		transition: none !important;
		animation: none !important;
	}
}
