/* Cookie Banner
----------------------------------------------------------------------------- */

[data-termly-part="consent-banner"] {
	box-sizing: border-box;
	padding: var(--wp--preset--spacing--28);
	border: 1px solid var(--wp--preset--color--neutral-lighter);
	border-radius: 1rem;
	background-color: var(--wp--preset--color--base) !important;
	box-shadow: 0 24px 60px -20px color-mix(in srgb, var(--wp--preset--color--contrast) 35%, transparent);
	color: var(--wp--preset--color--contrast) !important;
	font-family: var(--wp--preset--font-family--primary) !important;
	font-size: 1rem !important;
}

[data-termly-part="consent-banner"][data-termly-variant="tooltip"] {
	/* Termly retains its own placement and full-width mobile treatment. */
	width: 27.5rem;
	max-width: 100vw;
	border-top: 3px solid var(--wp--preset--color--primary);
}

[data-termly-part="consent-banner"] [data-termly-part="banner-message"] {
	margin: 0;
	color: var(--wp--preset--color--neutral);
	font-size: 0.9375rem;
	line-height: 1.5rem;
	font-family: var(--wp--preset--font-family--primary);
}


[data-termly-part="consent-banner"] [data-termly-part="banner-actions"] {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--10);
	margin-top: 1.375rem;
	position: static;
	padding: 0;
	background-color: transparent !important;
}

[data-termly-part="consent-banner"] [data-tid^="banner-"] {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 2.75rem;
	width: 100%;
	max-width: none;
	height: auto;
	margin: 0;
	border: 0;
	border-radius: 0.375rem;
	font-family: inherit !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
	line-height: 1.25rem;
	cursor: pointer;
}

[data-termly-part="consent-banner"] [data-tid="banner-decline"] {
	order: 0;
	border: 1px solid var(--wp--preset--color--contrast) !important;
	background-color: transparent !important;
	color: var(--wp--preset--color--contrast) !important;
}

[data-termly-part="consent-banner"] [data-tid="banner-accept"] {
	order: 1;
	padding: 0.875rem 1.5rem;
	background-color: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--base) !important;
}

[data-termly-part="consent-banner"] [data-focus-id="preferences-button"] {
	order: 2;
	grid-column: 1 / -1;
	justify-self: start;
	justify-content: flex-start;
	min-width: 0;
	width: auto;
	max-width: none;
	height: auto;
	min-height: 2.75rem;
	margin: var(--wp--preset--spacing--10) 0 -0.625rem;
	padding: 0;
	border: 0;
	background: none !important;
	color: var(--wp--preset--color--primary) !important;
	font-family: inherit !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
	line-height: 1.25rem;
	cursor: pointer;
}

[data-termly-part="consent-banner"] [data-focus-id$="-link"] {
	color: var(--wp--preset--color--primary);
	text-decoration: none;
	font: inherit;
}

[data-termly-part="consent-banner"] [data-focus-id$="-link"]:hover {
	text-decoration: underline;
}

[data-termly-part="consent-banner"] :is(button, a, [tabindex]):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
}

/* Native Preference Center
----------------------------------------------------------------------------- */

#termly-code-snippet-support [style*="font-family"] {
	font-family: var(--wp--preset--font-family--primary) !important;
}

#termly-code-snippet-support [role="checkbox"] {
	margin: 0;
	color: inherit;
	font-family: var(--wp--preset--font-family--primary);
}

#termly-code-snippet-support input[aria-hidden="true"] {
	display: none;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) {
	--termly-theme-background-color: var(--wp--preset--color--base);
	--termly-theme-color: var(--wp--preset--color--contrast);
	--termly-theme-font-family: var(--wp--preset--font-family--primary);
}

#termly-code-snippet-support dialog:has(.t-preference-modal) > div {
	position: relative;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	width: 40rem;
	max-width: calc(100vw - 1.5rem);
	max-height: calc(100dvh - 3rem);
	margin: 1.5rem auto !important;
	overflow: hidden;
	border: 1px solid var(--wp--preset--color--neutral-lighter);
	border-top: 3px solid var(--wp--preset--color--primary);
	border-radius: 1rem;
	background-color: var(--wp--preset--color--base);
	box-shadow: 0 24px 60px -20px color-mix(in srgb, var(--wp--preset--color--contrast) 35%, transparent);
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--primary);
}

#termly-code-snippet-support dialog:has(.t-preference-modal) > div > div:has(> div > .t-preference-modal) {
	flex: 1;
	min-height: 0;
	max-height: none;
	overflow-y: auto;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) div:has(> .t-preference-modal) {
	padding: var(--wp--preset--spacing--28);
}

#termly-code-snippet-support dialog:has(.t-preference-modal) h2 {
	margin: 0 2rem var(--wp--preset--spacing--12) 0;
	color: var(--wp--preset--color--contrast) !important;
	font-family: var(--wp--preset--font-family--display) !important;
	font-size: 1.5rem !important;
	font-weight: 600 !important;
	line-height: 1.875rem;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) .t-preference-modal p {
	margin: 0;
	color: var(--wp--preset--color--neutral) !important;
	font-size: 0.9375rem !important;
	line-height: 1.5rem;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) h2 + div {
	gap: var(--wp--preset--spacing--12);
	margin-bottom: var(--wp--preset--spacing--18);
	padding-bottom: var(--wp--preset--spacing--18);
	border-bottom: 1px solid var(--wp--preset--color--neutral-lighter);
}

#termly-code-snippet-support dialog:has(.t-preference-modal) h2 + div > :empty {
	display: none;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) div:has(> .consentSettingsRowContainer) {
	margin: 0;
	padding: var(--wp--preset--spacing--14) 0;
	border-bottom: 1px solid var(--wp--preset--color--neutral-lighter);
	font-family: var(--wp--preset--font-family--primary);
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [data-tracking^="accordion-"] + div {
	margin: var(--wp--preset--spacing--8) 0 0 1.75rem;
	padding: 0;
	color: var(--wp--preset--color--neutral) !important;
	font-family: var(--wp--preset--font-family--primary) !important;
	font-size: 0.875rem !important;
	line-height: 1.25rem;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [role="checkbox"] {
	font-size: 0.9375rem;
	line-height: 1.375rem;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [data-tracking^="accordion-"] {
	color: var(--wp--preset--color--contrast) !important;
	font-family: var(--wp--preset--font-family--primary) !important;
	font-size: 0.875rem !important;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [role="checkbox"] > span > div {
	font-size: inherit;
	font-weight: 600;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [role="checkbox"][aria-checked="true"] [data-testid="cb-ui"] {
	display: grid;
	place-items: center;
	border-color: var(--wp--preset--color--primary);
	background-color: var(--wp--preset--color--primary);
	background-image: none;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [role="checkbox"][aria-checked="true"] [data-testid="cb-ui"]::after {
	content: "";
	width: var(--wp--custom--form-control--checkbox-check-size);
	height: var(--wp--custom--form-control--checkbox-check-size);
	background-color: var(--wp--preset--color--base);
	mask: url(../icons/form-check.png) center / contain no-repeat;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [role="checkbox"]:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [data-focus-id] {
	font-size: inherit !important;
	color: var(--wp--preset--color--primary) !important;
	text-decoration: none;
	font: inherit;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) [data-focus-id]:hover {
	text-decoration: underline;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) .t-closeModal {
	position: absolute;
	top: var(--wp--preset--spacing--12);
	right: var(--wp--preset--spacing--12);
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	color: var(--wp--preset--color--contrast);
}

#termly-code-snippet-support dialog:has(.t-preference-modal) div:has(> .t-closeModal) {
	height: 0;
	padding: 0;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) .t-closeModal [fill] {
	fill: currentcolor;
}

#termly-code-snippet-support dialog:has(.t-preference-modal) div:has(> :is(.t-declineAllButton, .t-discardButton, .t-allowAllButton, .t-saveButton)) {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--10);
	flex-shrink: 0;
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--28);
	border-top: 1px solid var(--wp--preset--color--neutral-lighter);
	background-color: var(--wp--preset--color--base);
}

#termly-code-snippet-support :is(.t-declineAllButton, .t-discardButton, .t-allowAllButton, .t-saveButton) {
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	height: auto;
	min-height: 2.75rem;
	border-radius: 0.375rem;
	font-family: var(--wp--preset--font-family--primary) !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
	line-height: 1.25rem;
}

#termly-code-snippet-support :is(.t-allowAllButton, .t-saveButton) {
	padding: 0.875rem 1.5rem;
	border: 0;
	background-color: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--base) !important;
}

#termly-code-snippet-support :is(.t-declineAllButton, .t-discardButton) {
	border: 1px solid var(--wp--preset--color--contrast) !important;
	background-color: transparent !important;
	color: var(--wp--preset--color--contrast) !important;
}

#termly-code-snippet-support :is(.t-declineAllButton, .t-discardButton, .t-allowAllButton, .t-saveButton):focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
}

/* Button Treatments
----------------------------------------------------------------------------- */

#termly-code-snippet-support :is(.t-declineAllButton, .t-discardButton, .t-allowAllButton, .t-saveButton),
[data-termly-part="consent-banner"] [data-tid^="banner-"],
[data-termly-part="consent-banner"] [data-focus-id="preferences-button"] {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	transition: var(--wp--custom--transition--button);
}

/* Override Termly's inline backgrounds while matching the site's button effects. */
[data-termly-part="consent-banner"] [data-tid="banner-accept"],
#termly-code-snippet-support :is(.t-allowAllButton, .t-saveButton) {
	background-image: var(--wp--preset--gradient--primary-hover) !important;
	background-size: 200% 100% !important;
	background-position: 0% 0 !important;
	background-repeat: no-repeat !important;
	transition: var(--wp--custom--transition--button), background-position 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-termly-part="consent-banner"] [data-tid="banner-accept"]:is(:hover, :focus-visible),
#termly-code-snippet-support :is(.t-allowAllButton, .t-saveButton):is(:hover, :focus-visible) {
	background-position: 100% 0 !important;
	box-shadow: var(--wp--preset--shadow--purple-glow);
}

[data-termly-part="consent-banner"] [data-tid="banner-decline"],
#termly-code-snippet-support :is(.t-declineAllButton, .t-discardButton) {
	padding: calc(0.875rem - 1px) calc(1.5rem - 1px);
	transition: border-color 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), color 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), background-color 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-termly-part="consent-banner"] [data-tid="banner-decline"]:is(:hover, :focus-visible),
#termly-code-snippet-support :is(.t-declineAllButton, .t-discardButton):is(:hover, :focus-visible) {
	border-color: var(--wp--preset--color--purple) !important;
	color: var(--wp--preset--color--purple) !important;
}

[data-termly-part="consent-banner"] [data-focus-id="preferences-button"] {
	overflow: visible;
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--8);
}

[data-termly-part="consent-banner"] [data-focus-id="preferences-button"]:hover {
	text-decoration: none;
}

[data-termly-part="consent-banner"] [data-focus-id="preferences-button"]::after {
	content: "";
	width: 0.875rem;
	height: 0.875rem;
	background-color: currentcolor;
	mask: url(../images/sitecare-arrow-magenta.svg) center / contain no-repeat;
}

@media (prefers-reduced-motion: no-preference) {
	[data-termly-part="consent-banner"] [data-focus-id="preferences-button"]:is(:hover, :focus-visible)::after {
		animation: sitecare-cookie-arrow-bounce 0.75s cubic-bezier(0.3, 0.7, 0.35, 1) both;
	}
}

@keyframes sitecare-cookie-arrow-bounce {

	0% {
		transform: translateX(0);
	}

	35% {
		transform: translateX(0.375rem);
	}

	55% {
		transform: translateX(0.09375rem);
	}

	72% {
		transform: translateX(0.28125rem);
	}

	86% {
		transform: translateX(0.15625rem);
	}

	100% {
		transform: translateX(0.21875rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	#termly-code-snippet-support :is(.t-declineAllButton, .t-discardButton, .t-allowAllButton, .t-saveButton),
	[data-termly-part="consent-banner"] [data-tid^="banner-"],
	[data-termly-part="consent-banner"] [data-focus-id="preferences-button"] {
		transition: none;
	}
}

/* Small Screens
----------------------------------------------------------------------------- */

@media (max-width: 640px) {
	#termly-code-snippet-support dialog:has(.t-preference-modal) div:has(> .t-preference-modal) {
		padding: 1.375rem var(--wp--preset--spacing--20);
	}

	#termly-code-snippet-support dialog:has(.t-preference-modal) div:has(> :is(.t-declineAllButton, .t-discardButton, .t-allowAllButton, .t-saveButton)) {
		grid-template-columns: 1fr;
		padding: var(--wp--preset--spacing--20);
	}

	#termly-code-snippet-support dialog:has(.t-preference-modal) h2 {
		font-size: 1.375rem !important;
		line-height: 1.75rem;
	}

	[data-termly-part="consent-banner"] {
		padding: 1.375rem var(--wp--preset--spacing--20);
		border-radius: 0.875rem;
	}


	[data-termly-part="consent-banner"] [data-termly-part="banner-actions"] {
		grid-template-columns: 1fr;
	}
}

