/**
 * WonderCookie front-end styles.
 * Every colour comes from the custom properties printed by the plugin.
 */

/*
 * Defaults live on :root only. Declaring them on .wc-root/.wc-fab/.wc-ph would
 * match those elements directly and therefore beat the values the plugin prints
 * for :root, which are inherited — a direct match always wins over inheritance.
 */
:root {
	--wc-bg: #ffffff;
	--wc-primary: #1f6feb;
	--wc-text: #0f172a;
	--wc-muted: #5b6472;
	--wc-onprim: #ffffff;
	--wc-border: #d7dce3;
	--wc-overlay: rgba( 15, 23, 42, 0.55 );
	--wc-radius: 12px;
	--wc-font: 14px;
	--wc-width: 420px;
	--wc-shadow: 0 18px 48px rgba( 15, 23, 42, 0.18 ), 0 2px 8px rgba( 15, 23, 42, 0.08 );
}

.wc-root[hidden],
.wc-fab[hidden],
.wc-root [hidden] {
	display: none !important;
}

.wc-root {
	position: relative;
	z-index: 2147483000;
	font-size: var( --wc-font );
	line-height: 1.55;
	color: var( --wc-text );
	font-family: inherit;
}

.wc-root *,
.wc-root *::before,
.wc-root *::after {
	box-sizing: border-box;
}

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

.wc-overlay {
	position: fixed;
	inset: 0;
	background: var( --wc-overlay );
	z-index: 2147483000;
}

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

.wc-banner {
	position: fixed;
	z-index: 2147483001;
	width: min( var( --wc-width ), calc( 100vw - 32px ) );
	max-height: calc( 100vh - 32px );
	overflow-y: auto;
	padding: 22px 22px 20px;
	background: var( --wc-bg );
	color: var( --wc-text );
	border: 1px solid var( --wc-border );
	border-radius: var( --wc-radius );
	box-shadow: var( --wc-shadow );
	animation: wc-in 0.25s ease-out both;
}

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

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

@media ( prefers-reduced-motion: reduce ) {
	.wc-banner,
	.wc-modal__panel {
		animation: none;
	}
}

.wc-pos-bottom-left .wc-banner {
	inset: auto auto 16px 16px;
}

.wc-pos-bottom-right .wc-banner {
	inset: auto 16px 16px auto;
}

.wc-pos-bottom-center .wc-banner {
	inset: auto auto 16px 50%;
	transform: translateX( -50% );
}

.wc-pos-top-left .wc-banner {
	inset: 16px auto auto 16px;
}

.wc-pos-top-right .wc-banner {
	inset: 16px 16px auto auto;
}

.wc-pos-center .wc-banner {
	inset: 50% auto auto 50%;
	transform: translate( -50%, -50% );
}

.wc-layout-bar .wc-banner {
	width: calc( 100vw - 32px );
	max-width: none;
	inset: auto auto 16px 16px;
	transform: none;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 16px 24px;
	align-items: center;
}

.wc-layout-bar .wc-banner__actions {
	margin-top: 0;
}

.wc-banner__title {
	margin: 0 28px 8px 0;
	font-size: 1.25em;
	line-height: 1.3;
	font-weight: 700;
	color: var( --wc-text );
}

.wc-banner__body {
	margin: 0;
	color: var( --wc-muted );
}

.wc-banner__body a,
.wc-link {
	color: var( --wc-primary );
	text-decoration: underline;
	text-underline-offset: 2px;
}

.wc-banner__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 18px;
}

.wc-banner__actions .wc-btn {
	flex: 1 1 auto;
	min-width: 110px;
}

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

.wc-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 16px;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	border-radius: calc( var( --wc-radius ) * 0.6 );
	border: 1.5px solid var( --wc-primary );
	background: transparent;
	color: var( --wc-primary );
	transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.wc-btn:hover {
	background: color-mix( in srgb, var( --wc-primary ) 8%, transparent );
}

.wc-btn:focus-visible {
	outline: 2px solid var( --wc-primary );
	outline-offset: 2px;
}

.wc-btn--primary {
	background: var( --wc-primary );
	color: var( --wc-onprim );
}

.wc-btn--primary:hover {
	background: color-mix( in srgb, var( --wc-primary ) 85%, #000 );
}

.wc-x {
	position: absolute;
	top: 10px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var( --wc-muted );
	cursor: pointer;
	line-height: 0;
}

.wc-x:hover {
	background: color-mix( in srgb, var( --wc-text ) 8%, transparent );
	color: var( --wc-text );
}

.wc-x:focus-visible {
	outline: 2px solid var( --wc-primary );
	outline-offset: 2px;
}

/* --------------------------------------------------------------------- *
 * Preference modal
 * --------------------------------------------------------------------- */

.wc-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483002;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.wc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: var( --wc-overlay );
}

.wc-modal__panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min( 640px, 100% );
	max-height: min( 82vh, 760px );
	background: var( --wc-bg );
	color: var( --wc-text );
	border-radius: var( --wc-radius );
	box-shadow: var( --wc-shadow );
	overflow: hidden;
	animation: wc-in 0.2s ease-out both;
}

.wc-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px;
	border-bottom: 1px solid var( --wc-border );
}

.wc-modal__head .wc-x {
	position: static;
}

.wc-modal__title {
	margin: 0;
	font-size: 1.15em;
	font-weight: 700;
}

.wc-modal__body {
	padding: 18px 20px;
	overflow-y: auto;
}

.wc-modal__intro {
	margin: 0 0 16px;
	color: var( --wc-muted );
}

.wc-modal__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: flex-end;
	padding: 14px 20px;
	border-top: 1px solid var( --wc-border );
}

/* --------------------------------------------------------------------- *
 * Categories
 * --------------------------------------------------------------------- */

.wc-cat {
	padding: 14px 0;
	border-bottom: 1px solid var( --wc-border );
}

.wc-cat:last-child {
	border-bottom: 0;
}

.wc-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.wc-cat__name {
	font-weight: 700;
}

.wc-cat__always {
	font-size: 0.85em;
	font-weight: 600;
	color: var( --wc-primary );
	white-space: nowrap;
}

.wc-cat__desc {
	margin: 6px 0 0;
	color: var( --wc-muted );
}

.wc-cat__details {
	margin-top: 10px;
}

.wc-cat__details > summary {
	cursor: pointer;
	color: var( --wc-primary );
	font-weight: 600;
	font-size: 0.9em;
}

.wc-table-wrap {
	margin-top: 10px;
	overflow-x: auto;
	border: 1px solid var( --wc-border );
	border-radius: 8px;
}

.wc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.86em;
}

.wc-table th,
.wc-table td {
	padding: 8px 10px;
	text-align: left;
	vertical-align: top;
	border-bottom: 1px solid var( --wc-border );
}

.wc-table tbody tr:last-child td {
	border-bottom: 0;
}

.wc-table th {
	font-weight: 600;
	color: var( --wc-muted );
	white-space: nowrap;
}

.wc-table code {
	font-size: 0.95em;
	word-break: break-all;
}

/* --------------------------------------------------------------------- *
 * Switch
 * --------------------------------------------------------------------- */

.wc-switch {
	position: relative;
	display: inline-flex;
	align-items: center;
	cursor: pointer;
	flex: 0 0 auto;
}

.wc-switch input {
	position: absolute;
	opacity: 0;
	width: 44px;
	height: 24px;
	margin: 0;
	cursor: pointer;
}

.wc-switch__track {
	display: inline-block;
	width: 44px;
	height: 24px;
	border-radius: 999px;
	background: color-mix( in srgb, var( --wc-muted ) 35%, transparent );
	transition: background-color 0.15s ease;
}

.wc-switch__thumb {
	display: block;
	width: 18px;
	height: 18px;
	margin: 3px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.25 );
	transition: transform 0.15s ease;
}

.wc-switch input:checked + .wc-switch__track {
	background: var( --wc-primary );
}

.wc-switch input:checked + .wc-switch__track .wc-switch__thumb {
	transform: translateX( 20px );
}

.wc-switch input:focus-visible + .wc-switch__track {
	outline: 2px solid var( --wc-primary );
	outline-offset: 2px;
}

.wc-root .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0, 0, 0, 0 );
	white-space: nowrap;
	border: 0;
}

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

.wc-fab {
	position: fixed;
	bottom: 16px;
	z-index: 2147482999;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 1px solid var( --wc-border );
	border-radius: 50%;
	background: var( --wc-bg );
	color: var( --wc-primary );
	box-shadow: 0 6px 20px rgba( 15, 23, 42, 0.16 );
	cursor: pointer;
}

.wc-fab--bottom-left {
	left: 16px;
}

.wc-fab--bottom-right {
	right: 16px;
}

.wc-fab:hover {
	transform: translateY( -1px );
}

.wc-fab:focus-visible {
	outline: 2px solid var( --wc-primary );
	outline-offset: 2px;
}

/* --------------------------------------------------------------------- *
 * Blocked content placeholder
 * --------------------------------------------------------------------- */

/*
 * The placeholder and the ratio spacer share one grid cell, so the box keeps
 * the embed aspect ratio but still grows when the copy needs more room.
 */
.wc-ph {
	position: relative;
	display: grid;
	grid-template-columns: 1fr;
	width: 100%;
	min-height: 180px;
	border: 1px dashed var( --wc-border );
	border-radius: var( --wc-radius );
	background: color-mix( in srgb, var( --wc-text ) 4%, var( --wc-bg ) );
	overflow: hidden;
}

.wc-ph::before {
	content: '';
	grid-area: 1 / 1;
	padding-top: var( --wc-ph-ratio, 56.25% );
}

.wc-ph > iframe {
	display: none;
}

.wc-ph__box {
	grid-area: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 20px;
	text-align: center;
	font-size: var( --wc-font );
	line-height: 1.5;
	color: var( --wc-text );
}

.wc-ph__icon {
	color: var( --wc-primary );
	line-height: 0;
}

.wc-ph__title {
	margin: 4px 0 0;
	font-weight: 700;
}

.wc-ph__text {
	margin: 0;
	max-width: 44ch;
	color: var( --wc-muted );
}

.wc-ph__service {
	margin: 0;
	font-size: 0.82em;
	color: var( --wc-muted );
	opacity: 0.8;
}

.wc-ph__btn {
	margin-top: 8px;
	padding: 9px 16px;
	font: inherit;
	font-weight: 600;
	color: var( --wc-onprim );
	background: var( --wc-primary );
	border: 0;
	border-radius: calc( var( --wc-radius ) * 0.6 );
	cursor: pointer;
}

.wc-ph__link {
	padding: 4px;
	font: inherit;
	font-size: 0.86em;
	color: var( --wc-primary );
	background: none;
	border: 0;
	text-decoration: underline;
	cursor: pointer;
}

/*
 * Released state keeps the grid and the ratio spacer: dropping them leaves the
 * wrapper with no in-flow content whenever the theme positions the embed
 * absolutely, and the box collapses to zero height. The JS unwraps the iframe
 * anyway; this is the fallback for when it cannot.
 */
.wc-ph--released {
	min-height: 0;
	border: 0;
	background: none;
}

.wc-ph--released > iframe {
	display: block;
	grid-area: 1 / 1;
	width: 100%;
	height: 100%;
	max-width: 100%;
}

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

@media ( max-width: 520px ) {
	.wc-banner,
	.wc-layout-bar .wc-banner {
		inset: auto 12px 12px 12px !important;
		width: auto;
		transform: none !important;
		display: block;
	}

	.wc-banner__actions .wc-btn {
		flex: 1 1 100%;
	}

	.wc-modal__foot {
		justify-content: stretch;
	}

	.wc-modal__foot .wc-btn {
		flex: 1 1 100%;
	}
}
