/* TidyConsent banner — original styles, no external assets.

   Everything visual hangs off a handful of CSS variables, which the
   plugin sets from the owner's appearance settings (Settings →
   TidyConsent → Appearance). Layout, theme, corner and font choices are
   classes on the banner element:

     tc-layout-bar | tc-layout-box-left | tc-layout-box-right | tc-layout-modal
     tc-theme-light | tc-theme-dark | tc-theme-auto | tc-theme-site | tc-theme-custom
     tc-corners-square | tc-corners-rounded | tc-corners-pill
     tc-font-site | tc-font-system
     tc-anim-slide | tc-anim-fade | tc-anim-none

   Owners can add their own CSS in Settings → TidyConsent → Advanced; it
   is printed after this file. The stable hooks for it are the classes
   above, the .tc-* element classes below, and the --tc-* variables.

   One rule is not a setting: Accept and Reject are always the same size,
   weight, and colour, so neither choice is visually favoured. */

.tc-banner,
.tc-reopen {
	/* Fallbacks, used only if the inline variables are missing. */
	--tc-bg-l: #ffffff;
	--tc-text-l: #111827;
	--tc-accent-l: #111827;
	--tc-accent-text-l: #ffffff;
	--tc-accent-d: #f9fafb;
	--tc-accent-text-d: #111827;

	--tc-bg: var(--tc-bg-l);
	--tc-text: var(--tc-text-l);
	--tc-accent: var(--tc-accent-l);
	--tc-accent-text: var(--tc-accent-text-l);
	--tc-line: rgba(127, 127, 127, 0.28);
	--tc-radius: 14px;
	--tc-btn-radius: 10px;
	--tc-font: inherit;
}

/* ---- Themes ---------------------------------------------------------- */

.tc-theme-dark {
	--tc-bg: #111827;
	--tc-text: #f9fafb;
	--tc-accent: var(--tc-accent-d);
	--tc-accent-text: var(--tc-accent-text-d);
}

@media (prefers-color-scheme: dark) {
	.tc-theme-auto {
		--tc-bg: #111827;
		--tc-text: #f9fafb;
		--tc-accent: var(--tc-accent-d);
		--tc-accent-text: var(--tc-accent-text-d);
	}
}

/* "Match my theme": use the site's own background/text pair, which block
   themes publish as preset colours. Buttons take the text colour with
   the background colour on top — a pairing the theme already guarantees
   is readable. Classic themes without presets get the light fallbacks. */
.tc-theme-site {
	--tc-bg: var(--wp--preset--color--base, var(--wp--preset--color--background, #ffffff));
	--tc-text: var(--wp--preset--color--contrast, var(--wp--preset--color--foreground, #111827));
	--tc-accent: var(--tc-text);
	--tc-accent-text: var(--tc-bg);
}

/* ---- Corners and font ------------------------------------------------ */

.tc-corners-square {
	--tc-radius: 0px;
	--tc-btn-radius: 0px;
}

.tc-corners-pill {
	--tc-radius: 22px;
	--tc-btn-radius: 999px;
}

.tc-font-system {
	--tc-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

.tc-banner {
	position: fixed;
	z-index: 99999;
	box-sizing: border-box;
	background: var(--tc-bg);
	color: var(--tc-text);
	font-family: var(--tc-font);
	font-size: 15px;
	line-height: 1.55;
	text-align: left;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--tc-line);
}

.tc-anim-slide {
	animation: tc-rise 0.3s ease-out;
}

.tc-anim-fade {
	animation: tc-fade 0.35s ease-out;
}

.tc-banner *,
.tc-banner *::before,
.tc-banner *::after {
	box-sizing: border-box;
}

.tc-banner[hidden] {
	display: none;
}

.tc-banner:focus {
	outline: none;
}

@keyframes tc-rise {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes tc-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

/* Visitors who ask their device for less motion get none, whatever the
   site owner picked. */
@media (prefers-reduced-motion: reduce) {
	.tc-banner {
		animation: none !important;
	}
}

.tc-banner__inner {
	padding: 20px 22px;
	max-height: 86vh;
	overflow-y: auto;
}

/* Bar: full width along the bottom edge. */
.tc-layout-bar {
	left: 0;
	right: 0;
	bottom: 0;
	border-radius: var(--tc-radius) var(--tc-radius) 0 0;
}

.tc-layout-bar .tc-banner__inner {
	max-width: 1040px;
	margin: 0 auto;
}

/* Box: a floating card in a bottom corner. */
.tc-layout-box-left,
.tc-layout-box-right {
	bottom: 20px;
	width: 420px;
	max-width: calc(100vw - 40px);
	border-radius: var(--tc-radius);
}

.tc-layout-box-left {
	left: 20px;
}

.tc-layout-box-right {
	right: 20px;
}

/* In a card there is no room for a third button beside the two
   choices, so Preferences takes its own full-width row. */
.tc-layout-box-left .tc-btn--prefs,
.tc-layout-box-right .tc-btn--prefs,
.tc-layout-modal .tc-btn--prefs {
	flex: 1 1 100%;
}

/* Modal: centred, with the page dimmed behind it. */
.tc-layout-modal {
	left: 50%;
	top: 50%;
	width: 520px;
	max-width: calc(100vw - 32px);
	transform: translate(-50%, -50%);
	border-radius: var(--tc-radius);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 0 0 100vmax rgba(0, 0, 0, 0.45);
}

/* The centred box is positioned with a transform, so it fades rather
   than slides. */
.tc-layout-modal.tc-anim-slide {
	animation-name: tc-fade;
}

/* "Page waits for a choice": a layer over the page that takes the
   clicks, and no scrolling behind it. The dimming itself comes from the
   modal's own shadow, so this layer is clear. */
.tc-backdrop {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: transparent;
}

.tc-backdrop[hidden] {
	display: none;
}

html.tc-locked,
html.tc-locked body {
	overflow: hidden !important;
}

/* ---- Close button and logo ------------------------------------------- */

.tc-banner__inner {
	position: relative;
}

.tc-close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 22px;
	line-height: 1;
	color: var(--tc-text);
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	opacity: 0.65;
}

.tc-close:hover {
	opacity: 1;
	background: rgba(127, 127, 127, 0.16);
}

.tc-close[hidden],
.tc-banner__logo[hidden] {
	display: none;
}

.tc-close:not([hidden]) ~ .tc-banner__title {
	padding-right: 34px;
}

.tc-banner__logo {
	display: block;
	max-width: 160px;
	max-height: 44px;
	width: auto;
	height: auto;
	margin: 0 0 12px;
}

/* ---- Text ------------------------------------------------------------ */

.tc-banner__title {
	margin: 0 0 6px;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
}

.tc-banner__text {
	margin: 0 0 16px;
	color: inherit;
	opacity: 0.86;
}

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

.tc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.tc-btn {
	flex: 1 1 150px;
	min-height: 46px;
	margin: 0;
	padding: 11px 18px;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-transform: none;
	letter-spacing: normal;
	border-radius: var(--tc-btn-radius);
	border: 1.5px solid var(--tc-accent);
	cursor: pointer;
	transition: filter 0.15s ease, background-color 0.15s ease;
}

/* Accept and Reject: identical, on purpose. */
.tc-btn--accept,
.tc-btn--reject,
.tc-btn--save {
	background: var(--tc-accent);
	color: var(--tc-accent-text);
}

.tc-btn--accept:hover,
.tc-btn--reject:hover,
.tc-btn--save:hover {
	filter: brightness(1.12) saturate(1.05);
}

.tc-btn--prefs {
	flex: 0 1 auto;
	background: transparent;
	color: var(--tc-text);
	border-color: var(--tc-line);
	font-weight: 500;
}

.tc-btn--prefs:hover {
	background: rgba(127, 127, 127, 0.12);
}

.tc-btn--save {
	flex: 0 0 auto;
	margin-top: 14px;
}

.tc-close:focus-visible,
.tc-btn:focus-visible,
.tc-reopen:focus-visible,
.tc-open-preferences:focus-visible,
.tc-prefs__row input:focus-visible,
.tc-banner__fineprint a:focus-visible {
	outline: 3px solid #3b82f6;
	outline-offset: 2px;
}

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

.tc-prefs {
	margin-top: 16px;
	border-top: 1px solid var(--tc-line);
	padding-top: 14px;
}

.tc-prefs[hidden] {
	display: none;
}

.tc-prefs__fieldset {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.tc-prefs__fieldset legend {
	padding: 0;
	margin-bottom: 6px;
	font-weight: 600;
	color: inherit;
}

.tc-prefs__row {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	margin: 0;
	padding: 9px 0;
	font-weight: 400;
	cursor: pointer;
}

.tc-prefs__row + .tc-prefs__row {
	border-top: 1px solid var(--tc-line);
}

/* Category switches. Still real checkboxes for keyboards and screen
   readers; only the look is a switch. */
.tc-prefs__row input[type="checkbox"] {
	-webkit-appearance: none;
	appearance: none;
	position: relative;
	flex: 0 0 auto;
	width: 40px;
	height: 24px;
	margin: 1px 0 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(127, 127, 127, 0.45);
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.tc-prefs__row input[type="checkbox"]::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
	transition: transform 0.15s ease;
}

.tc-prefs__row input[type="checkbox"]:checked {
	background: var(--tc-accent);
}

.tc-prefs__row input[type="checkbox"]:checked::before {
	transform: translateX(16px);
	background: var(--tc-accent-text);
}

.tc-prefs__row input[type="checkbox"]:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.tc-prefs__label {
	display: block;
	font-weight: 600;
}

.tc-prefs__desc {
	display: block;
	opacity: 0.86;
}

.tc-prefs__tools {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	opacity: 0.72;
}

.tc-banner__fineprint {
	margin: 14px 0 0;
	font-size: 13px;
	opacity: 0.8;
}

.tc-banner__fineprint a {
	color: inherit;
	text-decoration: underline;
}

/* ---- The small always-available way back in --------------------------- */

.tc-reopen {
	position: fixed;
	left: 14px;
	bottom: 14px;
	z-index: 99998;
	margin: 0;
	padding: 7px 13px;
	font-family: var(--tc-font);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
	background: var(--tc-bg);
	color: var(--tc-text);
	border: 1px solid var(--tc-line);
	border-radius: 999px;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
	cursor: pointer;
	opacity: 0.9;
}

.tc-reopen:hover {
	opacity: 1;
}

.tc-reopen[hidden] {
	display: none;
}

.tc-reopen--right {
	left: auto;
	right: 14px;
}

.tc-reopen--icon {
	width: 42px;
	height: 42px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.tc-reopen--icon[hidden] {
	display: none;
}

/* ---- Small screens: every layout becomes a bottom sheet --------------- */

@media (max-width: 600px) {
	.tc-banner.tc-layout-bar,
	.tc-banner.tc-layout-box-left,
	.tc-banner.tc-layout-box-right {
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		max-width: none;
		border-radius: var(--tc-radius) var(--tc-radius) 0 0;
	}

	.tc-banner__inner {
		padding: 18px 16px;
		max-height: 82vh;
	}

	.tc-btn {
		flex: 1 1 100%;
	}

	.tc-btn--save {
		width: 100%;
	}
}

/* ---- Settings-screen preview ----------------------------------------- */

.tc-banner.tc-banner--preview {
	position: relative;
	left: auto;
	right: auto;
	top: auto;
	bottom: auto;
	transform: none;
	z-index: 1;
	animation: none;
	width: 100%;
	max-width: 520px;
	border-radius: var(--tc-radius);
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px var(--tc-line);
}

.tc-banner.tc-banner--preview.tc-layout-bar {
	max-width: 100%;
}
