/*
 * Flydoo cookie banner and the Cookie policy's "Your cookie choice" panel (review 2026-11-15, B8;
 * Nicolas's cookie page design, 18 November). Phone first, theme tokens only, no hex.
 *
 * Banner: a navy bar fixed at the bottom, above the phone bottom bar (z-index 40), that does not
 * block the page. "Only essentials" and "I agree" have the same size; "Settings" opens the
 * switches. Every control keeps a 44 px target.
 */
.fd-consent {
	position: fixed;
	inset-inline: 0;
	inset-block-end: 0;
	z-index: 100;
	box-sizing: border-box;
	padding: var(--wp--preset--spacing--12, 0.75rem);
	font-family: var(--wp--preset--font-family--body);
	pointer-events: none;
}

.fd-consent[hidden] {
	display: none;
}

.fd-consent *,
.fd-consent *::before,
.fd-consent *::after {
	box-sizing: border-box;
}

.fd-consent__inner {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	max-inline-size: 48rem;
	max-block-size: calc(100dvh - 1.5rem);
	margin-inline: auto;
	padding: 1rem 1.25rem;
	overflow-y: auto;
	border-radius: 16px;
	background-color: var(--wp--preset--color--surface-inverse);
	color: var(--wp--preset--color--text-on-inverse);
	box-shadow: 0 16px 40px -12px var(--wp--preset--color--line-strong);
	pointer-events: auto;
}

/* The heading names the region for screen readers; the design shows no title. */
.fd-consent__title {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.fd-consent__text,
.fd-consent__hint {
	margin: 0;
	color: var(--wp--preset--color--text-on-inverse);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.5;
}

.fd-consent__hint {
	color: var(--wp--preset--color--text-on-inverse-muted);
}

.fd-consent__policy {
	color: var(--wp--preset--color--text-on-inverse);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.fd-consent__panel[hidden] {
	display: none;
}

.fd-consent__fieldset {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin: 0 0 0.75rem;
	padding: 0;
	border: 0;
}

.fd-consent__legend {
	margin-block-end: 0.25rem;
	padding: 0;
	font-weight: 700;
}

.fd-consent__option {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 0 1rem;
	padding-block: 0.5rem;
	border-top: 1px solid var(--wp--preset--color--inverse-line);
}

.fd-consent__option input {
	grid-column: 2;
	grid-row: 1 / span 2;
}

.fd-consent__option label {
	display: inline-flex;
	grid-row: 1;
	align-items: center;
	min-block-size: 44px;
	font-weight: 600;
}

.fd-consent__option .fd-consent__hint {
	grid-column: 1;
	grid-row: 2;
}

.fd-consent__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}

.fd-consent__button {
	display: inline-flex;
	flex: 1 1 8rem;
	align-items: center;
	justify-content: center;
	min-block-size: 44px;
	padding: 0.625rem 1.25rem;
	border: 1px solid var(--wp--preset--color--text-on-inverse);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--text-on-inverse);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.fd-consent__button[data-fd-consent-accept],
.fd-consent__button--save {
	border-color: var(--wp--preset--color--cta-primary);
	background-color: var(--wp--preset--color--cta-primary);
	color: var(--wp--preset--color--text-on-cta);
}

.fd-consent__button--link {
	flex: 0 1 auto;
	padding-inline: 0.5rem;
	border-color: transparent;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.fd-consent__button:focus-visible,
.fd-consent__policy:focus-visible,
.fd-consent__option input:focus-visible {
	outline: 2px solid var(--wp--preset--color--text-on-inverse);
	outline-offset: 2px;
}

/* Switches (banner and Cookie policy panel): a checkbox with role="switch", 44 x 24 px. */
.fd-consent__option input,
.fd-cookie-choice__switch {
	position: relative;
	flex: none;
	inline-size: 44px;
	block-size: 24px;
	margin: 0;
	border-radius: 999px;
	background-color: var(--wp--preset--color--line-strong);
	cursor: pointer;
	transition: background-color 0.15s;
	appearance: none;
}

.fd-consent__option input::after,
.fd-cookie-choice__switch::after {
	position: absolute;
	inset-block-start: 3px;
	inset-inline-start: 3px;
	inline-size: 18px;
	block-size: 18px;
	border-radius: 50%;
	background-color: var(--wp--preset--color--surface-raised);
	content: "";
	transition: transform 0.15s;
}

.fd-consent__option input:checked,
.fd-cookie-choice__switch:checked {
	background-color: var(--wp--preset--color--brand-primary);
}

.fd-consent__option input:checked::after,
.fd-cookie-choice__switch:checked::after {
	transform: translateX(20px);
}

.fd-consent__option input:disabled,
.fd-cookie-choice__switch:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {

	.fd-consent__option input,
	.fd-consent__option input::after,
	.fd-cookie-choice__switch,
	.fd-cookie-choice__switch::after {
		transition: none;
	}
}

/* The Cookie policy's "Your cookie choice" panel. */
.fd-cookie-choice {
	box-sizing: border-box;
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--wp--preset--color--line-default);
	border-radius: 16px;
	background-color: var(--wp--preset--color--surface-sunken);
	color: var(--wp--preset--color--text-primary);
}

.fd-cookie-choice__title {
	margin: 0 0 0.25rem;
	font-size: 1.25rem;
	line-height: 1.3;
}

.fd-cookie-choice__current,
.fd-cookie-choice__hint,
.fd-cookie-choice__status {
	margin: 0;
	color: var(--wp--preset--color--text-secondary);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.5;
}

.fd-cookie-choice__current strong {
	color: var(--wp--preset--color--text-primary);
}

.fd-cookie-choice__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-block-start: 1rem;
	padding-block-start: 1rem;
	border-top: 1px solid var(--wp--preset--color--line-default);
}

.fd-cookie-choice__label label {
	display: inline-flex;
	align-items: center;
	min-block-size: 44px;
	font-weight: 600;
}

.fd-cookie-choice__actions {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.625rem;
	margin-block-start: 1.25rem;
}

.fd-cookie-choice__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-block-size: 44px;
	padding: 0.625rem 1.25rem;
	border: 1px solid var(--wp--preset--color--text-primary);
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--text-primary);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.fd-cookie-choice__button--save {
	border-color: var(--wp--preset--color--cta-primary);
	background-color: var(--wp--preset--color--cta-primary);
	color: var(--wp--preset--color--text-on-cta);
}

.fd-cookie-choice__button:focus-visible,
.fd-cookie-choice__switch:focus-visible {
	outline: 2px solid var(--wp--preset--color--brand-primary);
	outline-offset: 2px;
}

.fd-cookie-choice__status {
	margin-block-start: 0.75rem;
	color: var(--wp--preset--color--success, var(--wp--preset--color--text-secondary));
}

.fd-cookie-choice__status:empty {
	display: none;
}

@media (min-width: 768px) {

	.fd-consent {
		padding: var(--wp--preset--spacing--24, 1.5rem);
	}

	.fd-consent__inner {
		flex-flow: row wrap;
		align-items: center;
		padding: 1rem 1rem 1rem 1.5rem;
	}

	.fd-consent__text {
		flex: 1 1 20rem;
	}

	.fd-consent__panel {
		flex: 1 0 100%;
		order: 3;
	}

	.fd-consent__button {
		flex: 0 1 auto;
	}

	.fd-consent__actions {
		justify-content: flex-end;
	}
}
