/**
 * Pole Fit Freedom: the CookieYes banner and "Your cookie choices" popup, matched to the site.
 *
 * Light-mode colours are set in the plugin's own banner settings so they stay editable
 * there (see content-audit/scripts/cookieyes-setup.php). This file adds what those
 * settings can't: the site's fonts, 12px corners, pill buttons with the same lift,
 * focus rings, a tidy phone layout and dark mode. CookieYes writes its colours as inline
 * styles, so the dark-mode colours need !important.
 */

.cky-consent-container .cky-consent-bar,
.cky-modal .cky-preference-center {
	border-radius: 12px;
	border-style: solid;
	border-width: 1px;
	box-shadow: 0 1px 2px rgb(41 35 43 / 6%), 0 18px 40px -18px rgb(41 35 43 / 35%);
	font-family: var(--wp--preset--font-family--body);
}

.cky-consent-container .cky-consent-bar {
	padding: 1.5rem;
}

.cky-modal.cky-modal {
	border-radius: 12px;
}

.cky-consent-container .cky-notice .cky-title,
.cky-modal .cky-preference-header .cky-preference-title {
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1.15;
	margin-bottom: 0.5rem;
}

.cky-consent-container .cky-notice-des,
.cky-consent-container .cky-notice-des *,
.cky-modal .cky-preference-content-wrapper,
.cky-modal .cky-preference-content-wrapper *,
.cky-modal .cky-accordion-header-des,
.cky-modal .cky-accordion-header-des *,
.cky-modal .cky-audit-table * {
	font-family: var(--wp--preset--font-family--body);
	line-height: 1.55;
}

.cky-consent-container .cky-notice-des,
.cky-consent-container .cky-notice-des p,
.cky-modal .cky-preference-content-wrapper p {
	font-size: 0.9375rem;
}

.cky-consent-container .cky-notice-des p + p {
	margin-top: 0.5rem;
}

.cky-consent-container .cky-notice-des a,
.cky-consent-container .cky-policy {
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.cky-modal .cky-accordion-header .cky-accordion-btn {
	font-family: var(--wp--preset--font-family--body);
	font-size: 1rem;
	font-weight: 600;
}

.cky-modal .cky-accordion-header .cky-always-active {
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
}

/* Buttons: the site's pill shape and lift. */
.cky-consent-container .cky-btn,
.cky-modal .cky-btn {
	border-radius: 999px;
	border-style: solid;
	border-width: 2px;
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.9375rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.2;
	padding: 0.7em 1.3em;
}

.cky-consent-container .cky-btn:hover,
.cky-modal .cky-btn:hover {
	box-shadow: var(--wp--preset--shadow--soft);
	opacity: 1;
	transform: translateY(-2px);
}

.cky-consent-container .cky-btn:active,
.cky-modal .cky-btn:active {
	box-shadow: none;
	transform: translateY(0);
}

.cky-consent-container .cky-btn:focus-visible,
.cky-modal .cky-btn:focus-visible,
.cky-modal .cky-accordion-btn:focus-visible,
.cky-modal .cky-btn-close:focus-visible,
.cky-consent-container .cky-banner-btn-close:focus-visible,
.cky-btn-revisit-wrapper .cky-btn-revisit:focus-visible,
.cky-modal .cky-switch input:focus-visible {
	outline: 3px solid var(--wp--preset--color--primary-light);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
	.cky-consent-container .cky-btn,
	.cky-modal .cky-btn {
		transition: box-shadow 0.2s ease, transform 0.2s ease;
	}
}

/* The floating "Cookie settings" button (bottom left), with the site's shadow and tooltip colours. */
.cky-btn-revisit-wrapper.cky-btn-revisit-wrapper {
	box-shadow: var(--wp--preset--shadow--soft);
}

.cky-btn-revisit-wrapper.cky-revisit-bottom-left:hover::before {
	background: #29232b;
	font-family: var(--wp--preset--font-family--body);
}

.cky-btn-revisit-wrapper.cky-revisit-bottom-left:hover::after {
	border-right-color: #29232b;
}

/* On phones the floating "Contents" button also sits bottom left, so step up above it while it shows. */
@media (prefers-reduced-motion: no-preference) {
	.cky-btn-revisit-wrapper.cky-btn-revisit-wrapper {
		transition: bottom 0.2s ease;
	}
}

body:has(.pff-toc-jump.is-visible) .cky-btn-revisit-wrapper.cky-btn-revisit-wrapper {
	bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

/*
 * The cookie list on the Privacy & Cookies Policy ([pff_cookie_list] in inc/consent.php).
 * Phones: each cookie becomes a small card, with the column name beside each value.
 */
.pff-cookie-list code {
	overflow-wrap: anywhere;
}

@media (max-width: 600px) {
	.wp-block-table.pff-cookie-list table,
	.wp-block-table.pff-cookie-list tbody,
	.wp-block-table.pff-cookie-list tr,
	.wp-block-table.pff-cookie-list td {
		box-sizing: border-box;
		display: block;
		min-width: 0;
		width: 100%;
	}

	.wp-block-table.pff-cookie-list thead {
		display: none;
	}

	.wp-block-table.pff-cookie-list tr + tr {
		border-top: 1px solid color-mix(in srgb, var(--wp--preset--color--primary) 35%, transparent);
	}

	.wp-block-table.pff-cookie-list td {
		border: 0;
		display: grid;
		gap: 0.75rem;
		grid-template-columns: 6.5rem minmax(0, 1fr);
		padding-block: 0.35rem;
	}

	.wp-block-table.pff-cookie-list tr > td:first-child {
		padding-top: 0.85rem;
	}

	.wp-block-table.pff-cookie-list tr > td:last-child {
		padding-bottom: 0.85rem;
	}

	.wp-block-table.pff-cookie-list td::before {
		color: var(--wp--preset--color--primary-dark);
		content: attr(data-label);
		font-size: 0.8125rem;
		font-weight: 600;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}
}

/* Embeds waiting for consent: a calm plum box instead of black, in the site's type. */
.video-placeholder-normal,
.video-placeholder-youtube {
	border-radius: 12px;
	font-family: var(--wp--preset--font-family--body);
	max-width: 100%;
}

/* No YouTube thumbnail: loading it would contact Google before the reader has agreed. */
.video-placeholder-youtube {
	background-image: none !important;
	background-color: #29232b !important;
}

.video-placeholder-normal .video-placeholder-text-normal,
.video-placeholder-youtube .video-placeholder-text-youtube {
	background-color: #a15a6d !important;
	border-radius: 999px;
	color: #faf7f5 !important;
	cursor: pointer;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	max-width: calc(100% - 2rem);
	padding: 0.6em 1.2em;
	text-align: center;
}

/* Phones: stack the buttons full width, Accept and Reject together at the top. */
@media (max-width: 576px) {
	.cky-consent-container .cky-consent-bar {
		padding: 1.25rem 1rem;
	}

	.cky-consent-container .cky-notice .cky-title {
		font-size: 1.5rem;
	}

	.cky-consent-container .cky-notice-btn-wrapper,
	.cky-modal .cky-prefrence-btn-wrapper {
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
	}

	/* Space between the policy text and the stacked buttons (CookieYes leaves none). */
	.cky-consent-container .cky-notice-btn-wrapper {
		margin-top: 1rem;
	}

	.cky-consent-container .cky-notice-btn-wrapper .cky-btn,
	.cky-modal .cky-prefrence-btn-wrapper .cky-btn {
		margin: 0;
		width: 100%;
	}

	/* CookieYes injects its own order rules later, so these are one class more specific. */
	.cky-consent-container .cky-notice-btn-wrapper .cky-btn-accept,
	.cky-modal .cky-prefrence-btn-wrapper .cky-btn-accept {
		order: 1;
	}

	.cky-consent-container .cky-notice-btn-wrapper .cky-btn-reject,
	.cky-modal .cky-prefrence-btn-wrapper .cky-btn-reject {
		order: 2;
	}

	.cky-consent-container .cky-notice-btn-wrapper .cky-btn-customize,
	.cky-modal .cky-prefrence-btn-wrapper .cky-btn-preferences {
		order: 3;
	}
}

/*
 * Dark mode: the same swap as the rest of the site (dark-mode.css). The palette variables
 * are already switched there, so these just point CookieYes at them.
 */
:root[data-theme="dark"] .cky-consent-container .cky-consent-bar,
:root[data-theme="dark"] .cky-modal .cky-preference-center {
	background-color: var(--wp--preset--color--surface) !important;
	border-color: var(--wp--preset--color--primary-light) !important;
	color: var(--wp--preset--color--contrast) !important;
}

:root[data-theme="dark"] .cky-consent-container [style*="color:#29232B"],
:root[data-theme="dark"] .cky-modal [style*="color:#29232B"],
:root[data-theme="dark"] .cky-modal .cky-preference-center,
:root[data-theme="dark"] .cky-modal .cky-audit-table * {
	color: var(--wp--preset--color--contrast) !important;
}

:root[data-theme="dark"] .cky-consent-container .cky-btn-accept,
:root[data-theme="dark"] .cky-consent-container .cky-btn-reject,
:root[data-theme="dark"] .cky-modal .cky-btn-accept,
:root[data-theme="dark"] .cky-modal .cky-btn-reject {
	background-color: var(--wp--preset--color--primary) !important;
	border-color: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--base) !important;
}

:root[data-theme="dark"] .cky-consent-container .cky-btn-customize,
:root[data-theme="dark"] .cky-modal .cky-btn-preferences {
	border-color: var(--wp--preset--color--primary) !important;
	color: var(--wp--preset--color--primary) !important;
}

:root[data-theme="dark"] .cky-consent-container .cky-notice-des a,
:root[data-theme="dark"] .cky-consent-container .cky-policy,
:root[data-theme="dark"] .cky-modal .cky-always-active {
	color: var(--wp--preset--color--primary) !important;
}

:root[data-theme="dark"] .cky-modal .cky-audit-table,
:root[data-theme="dark"] .cky-modal .cky-footer-wrapper,
:root[data-theme="dark"] .cky-modal .cky-prefrence-btn-wrapper {
	background-color: var(--wp--preset--color--surface) !important;
	border-color: var(--wp--preset--color--primary-light) !important;
}

:root[data-theme="dark"] .cky-modal .cky-footer-shadow {
	background: linear-gradient(180deg, rgb(42 34 48 / 0%) 0%, var(--wp--preset--color--surface) 100%) !important;
}

:root[data-theme="dark"] .cky-modal .cky-switch input[type="checkbox"]:checked {
	background-color: var(--wp--preset--color--primary) !important;
}

:root[data-theme="dark"] .cky-consent-container .cky-banner-btn-close img,
:root[data-theme="dark"] .cky-modal .cky-btn-close img {
	filter: invert(1);
}

:root[data-theme="dark"] .cky-modal .cky-accordion-chevron i {
	border-color: var(--wp--preset--color--contrast) !important;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .cky-consent-container .cky-consent-bar,
	:root:not([data-theme="light"]) .cky-modal .cky-preference-center {
		background-color: var(--wp--preset--color--surface) !important;
		border-color: var(--wp--preset--color--primary-light) !important;
		color: var(--wp--preset--color--contrast) !important;
	}

	:root:not([data-theme="light"]) .cky-consent-container [style*="color:#29232B"],
	:root:not([data-theme="light"]) .cky-modal [style*="color:#29232B"],
	:root:not([data-theme="light"]) .cky-modal .cky-preference-center,
	:root:not([data-theme="light"]) .cky-modal .cky-audit-table * {
		color: var(--wp--preset--color--contrast) !important;
	}

	:root:not([data-theme="light"]) .cky-consent-container .cky-btn-accept,
	:root:not([data-theme="light"]) .cky-consent-container .cky-btn-reject,
	:root:not([data-theme="light"]) .cky-modal .cky-btn-accept,
	:root:not([data-theme="light"]) .cky-modal .cky-btn-reject {
		background-color: var(--wp--preset--color--primary) !important;
		border-color: var(--wp--preset--color--primary) !important;
		color: var(--wp--preset--color--base) !important;
	}

	:root:not([data-theme="light"]) .cky-consent-container .cky-btn-customize,
	:root:not([data-theme="light"]) .cky-modal .cky-btn-preferences {
		border-color: var(--wp--preset--color--primary) !important;
		color: var(--wp--preset--color--primary) !important;
	}

	:root:not([data-theme="light"]) .cky-consent-container .cky-notice-des a,
	:root:not([data-theme="light"]) .cky-consent-container .cky-policy,
	:root:not([data-theme="light"]) .cky-modal .cky-always-active {
		color: var(--wp--preset--color--primary) !important;
	}

	:root:not([data-theme="light"]) .cky-modal .cky-audit-table,
	:root:not([data-theme="light"]) .cky-modal .cky-footer-wrapper,
	:root:not([data-theme="light"]) .cky-modal .cky-prefrence-btn-wrapper {
		background-color: var(--wp--preset--color--surface) !important;
		border-color: var(--wp--preset--color--primary-light) !important;
	}

	:root:not([data-theme="light"]) .cky-modal .cky-footer-shadow {
		background: linear-gradient(180deg, rgb(42 34 48 / 0%) 0%, var(--wp--preset--color--surface) 100%) !important;
	}

	:root:not([data-theme="light"]) .cky-modal .cky-switch input[type="checkbox"]:checked {
		background-color: var(--wp--preset--color--primary) !important;
	}

	:root:not([data-theme="light"]) .cky-consent-container .cky-banner-btn-close img,
	:root:not([data-theme="light"]) .cky-modal .cky-btn-close img {
		filter: invert(1);
	}

	:root:not([data-theme="light"]) .cky-modal .cky-accordion-chevron i {
		border-color: var(--wp--preset--color--contrast) !important;
	}
}
