/* Consent Bridge - every colour, radius and size is a CSS variable set from the admin settings. */

#cb-root,
#cb-root * { box-sizing: border-box; }

#cb-root[hidden],
#cb-root.cb-is-closed,
#cb-root[aria-hidden="true"] {
	display: none !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

.cb-scroll-lock { overflow: hidden !important; }

#cb-root {
	position: fixed;
	z-index: 2147483000;
	font-family: var(--cb-font, inherit);
	font-size: var(--cb-font-size, 14px);
	line-height: 1.55;
	color: var(--cb-text);
}

/* ------------------------------------------------------------------ *
 * Armour against theme and page-builder globals
 *
 * Page builders style bare element selectors across the whole site, e.g.
 *   .elementor-kit-47 h2     { font-size: 48px; font-family: ... }
 *   .elementor-kit-47 button { font-size: 20px; text-transform: uppercase }
 * Those are specificity (0,1,1) and beat a plain .cb-heading (0,1,0), so on
 * any template where that stylesheet is enqueued the banner silently
 * inherits the theme's headings and buttons.
 *
 * Everything the banner renders lives inside #cb-root, so scoping every rule
 * to that ID puts them at (1,x,y) - no class/element combination can win.
 * The declarations below restore the properties a theme is most likely to
 * set on the element directly, which inheritance alone cannot undo.
 * ------------------------------------------------------------------ */

#cb-root .cb-panel,
#cb-root .cb-body,
#cb-root .cb-actions,
#cb-root .cb-cats {
	font-family: var(--cb-font, inherit);
	letter-spacing: normal;
	text-transform: none;
}

#cb-root .cb-heading {
	font-family: var(--cb-font, inherit);
	font-size: 1.15em;
	font-weight: 650;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	color: var(--cb-text);
	margin: 0 0 8px;
	padding: 0;
	border: 0;
	background: none;
	text-shadow: none;
}

#cb-root button {
	font-family: var(--cb-font, inherit);
	font-size: var(--cb-font-size, 14px);
	line-height: 1.4;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	text-shadow: none;
	background-image: none;
	box-shadow: none;
	min-height: 0;
	height: auto;
	margin: 0;
	text-align: center;
	vertical-align: middle;
}

#cb-root .cb-text,
#cb-root .cb-cat-desc {
	font-family: var(--cb-font, inherit);
	font-size: 1em;
	letter-spacing: normal;
	text-transform: none;
	background: none;
}

#cb-root a {
	font-family: var(--cb-font, inherit);
	font-weight: inherit;
	letter-spacing: normal;
	text-transform: none;
	background: none;
	box-shadow: none;
	padding: 0;
	border: 0;
}

/* ---------- Positioning ---------- */

#cb-root.cb-layout-bar { left: 0; right: 0; }
#cb-root.cb-layout-bar.cb-pos-bottom { bottom: 0; }
#cb-root.cb-layout-bar.cb-pos-top { top: 0; }
#cb-root.cb-layout-bar .cb-panel {
	max-width: none;
	width: 100%;
	border-radius: 0;
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
	border-left: 0;
	border-right: 0;
}
#cb-root.cb-layout-bar .cb-body { flex: 1 1 420px; }
#cb-root.cb-layout-bar .cb-actions { flex: 0 0 auto; padding-top: 0; }

#cb-root.cb-layout-box { max-width: var(--cb-max-width, 460px); }
#cb-root.cb-layout-box.cb-pos-bottom-left { left: 20px; bottom: 20px; }
#cb-root.cb-layout-box.cb-pos-bottom-right { right: 20px; bottom: 20px; }
#cb-root.cb-layout-box.cb-pos-bottom { left: 50%; bottom: 20px; transform: translateX(-50%); }
#cb-root.cb-layout-box.cb-pos-top { left: 50%; top: 20px; transform: translateX(-50%); }
#cb-root.cb-layout-box.cb-pos-center { left: 50%; top: 50%; transform: translate(-50%, -50%); }

#cb-root.cb-layout-modal,
#cb-root.cb-modal-open {
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	max-width: var(--cb-max-width, 460px);
	width: calc(100% - 32px);
	right: auto;
	bottom: auto;
}

/* ---------- Panel ---------- */

#cb-root .cb-panel {
	position: relative;
	background: var(--cb-bg);
	border: 1px solid var(--cb-border);
	border-radius: var(--cb-radius, 14px);
	box-shadow: 0 12px 40px var(--cb-shadow);
	padding: 22px;
	max-height: min(80vh, 720px);
	overflow-y: auto;
	animation: cb-in .22s ease-out;
}

@keyframes cb-in {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	#cb-root .cb-panel { animation: none; }
}

#cb-root .cb-logo { display: block; max-height: 34px; width: auto; margin: 0 0 12px; }

#cb-root .cb-heading {
	margin: 0 0 8px;
	font-size: 1.15em;
	font-weight: 650;
	line-height: 1.3;
	color: var(--cb-text);
}

#cb-root .cb-text { margin: 0; color: var(--cb-muted); }

/* Every link state is pinned so a theme's :visited / :hover rules (the usual
   cause of a link turning purple) cannot bleed into the banner. */
#cb-root a,
#cb-root a:link,
#cb-root .cb-text a,
#cb-root .cb-text a:link,
#cb-root .cb-link,
#cb-root .cb-link:link {
	color: var(--cb-link);
	text-decoration: underline;
	text-underline-offset: 2px;
	background: none;
	box-shadow: none;
}

#cb-root a:visited,
#cb-root .cb-text a:visited,
#cb-root .cb-link:visited { color: var(--cb-link-visited); }

#cb-root a:hover,
#cb-root a:focus,
#cb-root a:active,
#cb-root .cb-text a:hover,
#cb-root .cb-text a:focus,
#cb-root .cb-text a:active,
#cb-root .cb-link:hover,
#cb-root .cb-link:focus,
#cb-root .cb-link:active {
	color: var(--cb-link-hover);
	text-decoration: underline;
	background: none;
}

#cb-root a:focus-visible,
#cb-root .cb-link:focus-visible {
	outline: 2px solid var(--cb-highlight);
	outline-offset: 2px;
	border-radius: 2px;
}

#cb-root .cb-links { margin-top: 10px; display: flex; gap: 16px; flex-wrap: wrap; font-size: .92em; }

#cb-root .cb-close {
	position: absolute;
	top: 10px;
	right: 12px;
	background: none;
	border: 0;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: var(--cb-muted);
	padding: 4px 8px;
	border-radius: 6px;
}
#cb-root .cb-close:hover,
#cb-root .cb-close:focus-visible { background: var(--cb-highlight); color: var(--cb-highlight-text); outline: none; }

/* ---------- Buttons ---------- */

#cb-root .cb-actions {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	padding-top: 18px;
}

#cb-root .cb-btn {
	flex: 1 1 auto;
	min-width: 130px;
	appearance: none;
	border: 1px solid transparent;
	border-radius: var(--cb-btn-radius, 10px);
	padding: 11px 16px;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
	text-align: center;
}

/* --- Base states --- */

#cb-root .cb-btn-accept { background: var(--cb-accept-bg); color: var(--cb-accept-text); }
#cb-root .cb-btn-reject { background: var(--cb-reject-bg); color: var(--cb-reject-text); }

#cb-root .cb-btn-settings {
	background: var(--cb-settings-bg);
	color: var(--cb-settings-text);
	border-color: var(--cb-border);
}

/* --- Highlight ---------------------------------------------------------
   Every button lifts to the same royal-blue highlight on hover, focus and
   while pressed. A secondary button that only shifts by one shade of grey
   is indistinguishable from a disabled one, which is what this replaces. */

#cb-root .cb-btn:hover,
#cb-root .cb-btn:focus-visible,
#cb-root .cb-btn:active {
	background: var(--cb-highlight);
	color: var(--cb-highlight-text);
	border-color: var(--cb-highlight);
}

/* The primary button is already filled, so it deepens instead of flipping. */
#cb-root .cb-btn-accept:hover,
#cb-root .cb-btn-accept:focus-visible,
#cb-root .cb-btn-accept:active {
	background: var(--cb-highlight-hover);
	color: var(--cb-highlight-text);
	border-color: var(--cb-highlight-hover);
}

#cb-root .cb-btn:focus-visible {
	outline: 2px solid var(--cb-highlight);
	outline-offset: 2px;
}

#cb-root .cb-btn:active { transform: translateY(1px); }

@media (prefers-reduced-motion: reduce) {
	#cb-root .cb-btn { transition: none; }
	#cb-root .cb-btn:active { transform: none; }
}

/* Keyboard users on a touch device never get :hover, so the focus ring above
   is what carries the highlight. Pointer-capable devices get both. */
@media (hover: none) {
	#cb-root .cb-btn:hover { background: var(--cb-settings-bg); color: var(--cb-settings-text); }
	#cb-root .cb-btn-accept:hover { background: var(--cb-accept-bg); color: var(--cb-accept-text); }
	#cb-root .cb-btn-reject:hover { background: var(--cb-reject-bg); color: var(--cb-reject-text); }
	#cb-root .cb-btn:focus-visible,
	#cb-root .cb-btn:active { background: var(--cb-highlight); color: var(--cb-highlight-text); }
}

@media (forced-colors: active) {
	#cb-root .cb-btn { border: 1px solid ButtonText; }
	#cb-root .cb-btn:hover,
	#cb-root .cb-btn:focus-visible { background: Highlight; color: HighlightText; }
}

/* ---------- Preferences ---------- */

#cb-root .cb-cats { margin-top: 16px; display: flex; flex-direction: column; gap: 4px; }

#cb-root .cb-cat {
	padding: 14px 0;
	border-top: 1px solid var(--cb-border);
}
#cb-root .cb-cat:first-child { border-top: 0; }

#cb-root .cb-cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

#cb-root .cb-cat-label { font-weight: 600; }
#cb-root .cb-cat-desc { margin: 6px 0 0; color: var(--cb-muted); font-size: .93em; }

#cb-root .cb-always {
	font-size: .82em;
	font-weight: 600;
	color: var(--cb-muted);
	text-transform: uppercase;
	letter-spacing: .04em;
	white-space: nowrap;
}

#cb-root .cb-toggle {
	position: relative;
	flex: 0 0 auto;
	width: 46px;
	height: 26px;
	border: 0;
	border-radius: 99px;
	background: var(--cb-toggle-off);
	cursor: pointer;
	padding: 0;
	transition: background-color .18s ease;
}
#cb-root .cb-toggle.is-on { background: var(--cb-toggle-on); }
#cb-root .cb-toggle:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--cb-highlight) 28%, transparent); }
#cb-root .cb-toggle:focus-visible { outline: 2px solid var(--cb-highlight); outline-offset: 2px; }

#cb-root .cb-knob {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--cb-toggle-knob);
	box-shadow: 0 1px 3px rgba(0,0,0,.25);
	transition: transform .18s ease;
}
#cb-root .cb-toggle.is-on .cb-knob { transform: translateX(20px); }

/* ---------- Overlay ---------- */

#cb-overlay {
	position: fixed;
	inset: 0;
	background: var(--cb-overlay);
	z-index: 2147482999;
	animation: cb-fade .2s ease-out;
}
@keyframes cb-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Floating reopen button ---------- */

/* Off by default. Nothing is left in the layout - no reserved space, no
   invisible hit target sitting over your content. */
#cb-fab[hidden],
#cb-fab.cb-is-closed { display: none !important; }

#cb-fab {
	position: fixed;
	bottom: 18px;
	z-index: 2147482900;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: var(--cb-fab-bg);
	color: var(--cb-fab-icon);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 14px var(--cb-shadow);
	opacity: .82;
	transition: opacity .15s ease, transform .15s ease;
}
#cb-fab:hover,
#cb-fab:focus-visible { opacity: 1; transform: translateY(-2px); background: var(--cb-highlight); color: var(--cb-highlight-text); }
#cb-fab.cb-fab-bottom-left { left: 18px; }
#cb-fab.cb-fab-bottom-right { right: 18px; }

/* ---------- Cookie policy table (shortcode) ---------- */

.cb-cookie-table { width: 100%; border-collapse: collapse; margin: 0 0 28px; font-size: .95em; }
.cb-cookie-table th,
.cb-cookie-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--cb-border, #e4e8ee); vertical-align: top; }
.cb-cookie-table thead th { border-bottom-width: 2px; font-weight: 650; }
.cb-cookie-group-title { margin: 26px 0 8px; }
.cb-cookie-group-desc { margin: 0 0 12px; opacity: .8; }
.cb-cookie-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; word-break: break-word; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
	/* The desktop position rules are compound - #cb-root.cb-layout-box.cb-pos-bottom
	   is specificity (1,2,0) - and a media query adds no specificity of its own.
	   A plainer selector here would only partially apply: `left: 50%` and the
	   centring transform would survive, leaving a half-width panel wedged in the
	   middle of the screen.

	   The attribute selector below matches every layout/position combination at
	   the same (1,2,0) specificity and wins on source order, so the phone layout
	   fully replaces the desktop geometry. The full-width bar is excluded because
	   it is already edge-to-edge. */
	#cb-root[class*="cb-pos-"]:not(.cb-layout-bar),
	#cb-root.cb-layout-modal[class],
	#cb-root.cb-modal-open[class] {
		top: auto;
		right: 8px;
		bottom: 8px;
		left: 8px;
		width: auto;
		max-width: none;
		transform: none;
	}
	#cb-root .cb-panel { padding: 18px; max-height: 84vh; }
	/* Keep the same order as desktop (settings, reject, accept). Reversing it
	   would put Accept first on mobile only, which reads as a nudge. */
	#cb-root .cb-actions { flex-direction: column; }
	/* 44px is the minimum comfortable tap target; the desktop padding lands at
	   about 42px once the label line-height is added. */
	#cb-root .cb-btn {
		width: 100%;
		min-height: 44px;
		padding: 12px 16px;
	}
	#cb-root.cb-layout-bar .cb-actions { width: 100%; }
}
