/* Taggetig Consent. Override the custom properties below from the theme. */
/* Colors follow the theme's base and contrast palette colors (block themes), with the Taggetig ochre as fallback. */
:root {
	--tgc-bg: var(--wp--preset--color--base, oklch(0.76 0.13 85));
	--tgc-fg: var(--wp--preset--color--contrast, oklch(0.26 0 0));
	--tgc-btn-bg: var(--wp--preset--color--contrast, oklch(0.26 0 0));
	--tgc-btn-fg: var(--wp--preset--color--base, oklch(0.96 0.01 0));
	--tgc-radius: 1.5rem;
}

/* Never set display on these two: [hidden] and the popover UA styles control it. */
#tgc-banner,
#tgc-popover {
	box-sizing: border-box;
	position: fixed;
	z-index: 99999;
	inset: auto 1rem 1rem auto;
	width: calc(100% - 2rem);
	max-width: 24rem;
	max-height: calc(100dvh - 2rem);
	overflow: auto;
	margin: 0;
	padding: 1.5rem;
	border: 0;
	border-radius: var(--tgc-radius);
	background: var(--tgc-bg);
	color: var(--tgc-fg);
	font-size: 0.875rem;
	line-height: 1.5;
	text-align: left;
	box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

#tgc-popover::backdrop { background: rgb(0 0 0 / 0.3); backdrop-filter: blur(4px); }

:is(#tgc-banner, #tgc-popover) .tgc-heading { margin: 0; font-size: 1.125rem; font-weight: 700; line-height: 1.3; color: inherit; }

:is(#tgc-banner, #tgc-popover) :is(.tgc-text, .tgc-desc) { margin: 0.5rem 0 0; color: color-mix(in oklch, currentColor 80%, transparent); }

#tgc-banner .tgc-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }

/* Layout only. The buttons also carry .wp-element-button, so their looks come from the theme. */
:is(#tgc-banner, #tgc-popover) .tgc-btn {
	flex: 1;
	min-height: 2.5rem;
	margin: 0;
	cursor: pointer;
	transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fallback looks at zero specificity, so any theme button style wins over them. */
:where(.tgc-btn) {
	padding: 0.5rem 1rem;
	border: 0;
	border-radius: 999px;
	background: var(--tgc-btn-bg);
	color: var(--tgc-btn-fg);
	font: inherit;
	line-height: 1.2;
}

:is(#tgc-banner, #tgc-popover) .tgc-btn:active { transform: scale(0.97); }
#tgc-popover .tgc-btn { width: 100%; margin-top: 1rem; }

#tgc-banner .tgc-links { display: flex; gap: 1rem; margin-top: 0.75rem; }

:is(#tgc-banner, #tgc-popover) .tgc-link {
	display: inline-block;
	margin: 0.75rem 0 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.75rem;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

#tgc-banner .tgc-link { margin: 0; }
:is(#tgc-banner, #tgc-popover) .tgc-link:hover { text-decoration: none; }

:is(#tgc-banner, #tgc-popover) :focus-visible { outline: 2px solid var(--tgc-fg); outline-offset: 2px; }

#tgc-popover .tgc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
#tgc-popover .tgc-close { display: flex; padding: 0.5rem; margin-right: -0.5rem; border: 0; border-radius: 0.5rem; background: none; color: inherit; cursor: pointer; }

/* Filled panel per category, no borders. */
#tgc-popover .tgc-row {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 0 1rem;
	margin-top: 0.5rem;
	padding: 0.75rem 1rem;
	border-radius: calc(var(--tgc-radius) / 2);
	background: color-mix(in oklch, var(--tgc-fg) 8%, transparent);
}

/* The label stretches over its row, so a click anywhere in the row toggles the checkbox. */
#tgc-popover .tgc-row label::after { content: ""; position: absolute; inset: 0; }
#tgc-popover .tgc-row:has(input:enabled) label::after { cursor: pointer; }

#tgc-popover .tgc-row input { width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--tgc-fg); }
#tgc-popover .tgc-row .tgc-desc { flex-basis: 100%; margin-top: 0.25rem; font-size: 0.75rem; }

@media (prefers-reduced-motion: no-preference) {
	#tgc-banner,
	#tgc-popover {
		transition: opacity 0.2s, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), overlay 0.2s allow-discrete, display 0.2s allow-discrete;
	}
	#tgc-banner[hidden],
	#tgc-popover:not(:popover-open) { opacity: 0; transform: translateY(10px) scale(0.95); }
	@starting-style {
		#tgc-banner,
		#tgc-popover:popover-open { opacity: 0; transform: translateY(10px) scale(0.95); }
	}
}
