/*
 * Cookie banner, settings dialog and cookie tables (flagbeach-core, inc/consent.php).
 * Uses the theme's tokens when they exist, with the same values as fallbacks, so
 * the banner keeps working under any theme. Accept and reject always look alike.
 */
.fb-consent,
.fb-consent-prefs,
.fb-cookie-policy {
	--fbc-navy: var(--fb-navy, #0A1A2F);
	--fbc-sand: var(--fb-sand, #F9F7F2);
	--fbc-low: var(--fb-low, #F4F0E8);
	--fbc-ink: var(--fb-ink, #00705F);
	--fbc-lagoon: var(--fb-lagoon, #00A896);
	--fbc-rule: var(--fb-rule, rgba(10, 26, 47, 0.12));
	--fbc-ui: var(--fb-ui, Inter, system-ui, -apple-system, 'Segoe UI', sans-serif);
	--fbc-display: var(--fb-display, 'Archivo Black', Impact, 'Arial Black', sans-serif);
	--fbc-mono: var(--fb-mono, 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace);
	--fbc-r: var(--fb-r, 4px);
}

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

.fb-consent {
	position: fixed;
	z-index: 1000;
	left: 12px;
	right: 12px;
	bottom: 12px;
	box-sizing: border-box;
	max-height: calc(100vh - 24px);
	overflow-y: auto;
	padding: 20px 20px 16px;
	border-radius: var(--fbc-r);
	background: var(--fbc-navy);
	color: var(--fbc-sand);
	font: 500 14px/1.5 var(--fbc-ui);
	box-shadow: 0 12px 40px rgba(10, 26, 47, 0.35);
}
.fb-consent[hidden] { display: none; }
@media (min-width: 720px) {
	.fb-consent { left: 24px; right: auto; bottom: 24px; width: 520px; }
}
@media (prefers-reduced-motion: no-preference) {
	.fb-consent:not([hidden]) { animation: fb-consent-in 0.25s ease-out; }
	@keyframes fb-consent-in { from { opacity: 0; transform: translateY(12px); } }
}
.fb-consent__title {
	margin: 0 0 8px;
	font: 400 19px/1.15 var(--fbc-display);
	letter-spacing: -0.01em;
	text-transform: uppercase;
}
.fb-consent p { margin: 0 0 10px; }
.fb-consent__list { margin: 0 0 10px; padding-left: 18px; }
.fb-consent__list li { margin: 0 0 4px; }
.fb-consent a { color: var(--fbc-lagoon); text-decoration: underline; text-underline-offset: 2px; }
.fb-consent a:hover { color: #fff; }

.fb-consent__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin-top: 14px;
}
.fb-consent__btn {
	min-height: 48px;
	padding: 0 16px;
	border: 1.5px solid var(--fbc-sand);
	border-radius: var(--fbc-r);
	background: var(--fbc-sand);
	color: var(--fbc-navy);
	font: 700 15px/1.1 var(--fbc-ui);
	cursor: pointer;
}
.fb-consent__btn:hover { background: #fff; border-color: #fff; }
.fb-consent__more {
	grid-column: 1 / -1;
	justify-self: center;
	min-height: 44px;
	padding: 0 12px;
	border: 0;
	background: none;
	color: var(--fbc-sand);
	font: 600 14px/1 var(--fbc-ui);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}
.fb-consent__more:hover { color: #fff; }
.fb-consent :focus-visible,
.fb-consent-prefs :focus-visible { outline: 2px solid var(--fb-orange, #FF5722); outline-offset: 2px; }

/* ------------------------------------------------------------------ settings dialog */

.fb-consent-prefs {
	box-sizing: border-box;
	width: min(640px, calc(100vw - 24px));
	max-height: min(88vh, 900px);
	padding: 0;
	border: 0;
	border-radius: var(--fbc-r);
	background: var(--fbc-sand);
	color: var(--fbc-navy);
	font: 500 14px/1.5 var(--fbc-ui);
	box-shadow: 0 16px 48px rgba(10, 26, 47, 0.4);
}
.fb-consent-prefs::backdrop { background: rgba(10, 26, 47, 0.62); }
.fb-consent-prefs[open] { display: flex; }
.fb-consent-prefs__form { display: flex; flex-direction: column; width: 100%; max-height: inherit; margin: 0; }
.fb-consent-prefs__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid var(--fbc-rule);
}
.fb-consent-prefs__title {
	margin: 0;
	font: 400 22px/1.1 var(--fbc-display);
	letter-spacing: -0.01em;
	text-transform: uppercase;
}
.fb-consent-prefs__close {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: var(--fbc-r);
	background: none;
	color: var(--fbc-navy);
	font: 400 28px/1 var(--fbc-ui);
	cursor: pointer;
}
.fb-consent-prefs__close:hover { background: var(--fbc-low); }
.fb-consent-prefs__body { flex: 1 1 auto; overflow-y: auto; padding: 14px 20px 8px; }
.fb-consent-prefs__body > p { margin: 0 0 8px; }
.fb-consent-prefs a { color: var(--fbc-ink); }

.fb-consent-cat { padding: 14px 0; border-top: 1px solid var(--fbc-rule); }
.fb-consent-cat:first-of-type { margin-top: 8px; }
.fb-consent-cat__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fb-consent-cat__name { margin: 0; font: 700 16px/1.3 var(--fbc-ui); letter-spacing: 0; text-transform: none; }
.fb-consent-cat__always { font: 700 11px/1 var(--fbc-ui); letter-spacing: 0.12em; text-transform: uppercase; color: var(--fbc-ink); }
.fb-consent-cat__desc { margin: 6px 0 8px; }
.fb-consent-cat__details summary { cursor: pointer; color: var(--fbc-ink); font-weight: 600; min-height: 32px; }
.fb-consent-cat__details[open] summary { margin-bottom: 4px; }

.fb-consent-prefs__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	padding: 14px 20px;
	border-top: 1px solid var(--fbc-rule);
	background: var(--fbc-low);
}
.fb-consent-prefs .fb-consent__btn { background: transparent; border-color: var(--fbc-navy); color: var(--fbc-navy); }
.fb-consent-prefs .fb-consent__btn:hover { background: #fff; }
.fb-consent-prefs .fb-consent__btn--save { grid-column: 1 / -1; background: var(--fbc-navy); color: var(--fbc-sand); }
.fb-consent-prefs .fb-consent__btn--save:hover { background: var(--fb-lift, #17324F); }
@media (min-width: 560px) {
	.fb-consent-prefs__actions { grid-template-columns: 1fr 1fr 1.2fr; }
	.fb-consent-prefs .fb-consent__btn--save { grid-column: auto; }
}

/* Switch: a real checkbox over a drawn track, so keyboard and screen readers get the native control. */
.fb-switch { position: relative; display: inline-block; flex: none; width: 48px; height: 28px; }
.fb-switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fb-switch span { position: absolute; inset: 0; border-radius: 14px; background: #847E72; transition: background 0.15s; }
.fb-switch span::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(10, 26, 47, 0.3);
	transition: transform 0.15s;
}
.fb-switch input:checked + span { background: var(--fbc-ink); }
.fb-switch input:checked + span::after { transform: translateX(20px); }
.fb-switch input:focus-visible + span { outline: 2px solid var(--fb-orange, #FF5722); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
	.fb-switch span, .fb-switch span::after { transition: none; }
}

/* ------------------------------------------------------------------ cookie tables (dialog and policy page) */

.fb-cookie-service { margin: 12px 0 18px; }
.fb-cookie-service__name { margin: 0 0 2px; font: 700 15px/1.3 var(--fbc-ui); letter-spacing: 0; text-transform: none; }
.fb-cookie-service__meta { margin: 0 0 6px; font-size: 13px; color: rgba(10, 26, 47, 0.75); }
.fb-cookie-service__meta a { color: var(--fbc-ink); }
.fb-cookie-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; }
.fb-cookie-table th,
.fb-cookie-table td { padding: 7px 10px 7px 0; border-top: 1px solid var(--fbc-rule); text-align: left; vertical-align: top; }
.fb-cookie-table th { font: 700 10.5px/1.2 var(--fbc-ui); letter-spacing: 0.1em; text-transform: uppercase; color: rgba(10, 26, 47, 0.7); }
.fb-cookie-table code { font: 500 12.5px/1.4 var(--fbc-mono); overflow-wrap: anywhere; }
.fb-cookie-table td:first-child { width: 24%; }
.fb-cookie-table td:nth-child(3) { width: 16%; }
@media (max-width: 620px) {
	.fb-cookie-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.fb-cookie-table tr { display: block; padding: 8px 0; border-top: 1px solid var(--fbc-rule); }
	.fb-cookie-table td { display: block; width: auto !important; padding: 2px 0; border: 0; }
	.fb-cookie-table td + td::before { content: attr(data-label) ": "; font-weight: 700; }
}

.fb-cookie-policy__status { padding: 12px 14px; border-radius: var(--fbc-r); background: var(--fbc-low); font-weight: 600; }
.fb-cookie-policy__status:empty { display: none; }

@media print {
	.fb-consent, .fb-consent-prefs { display: none !important; }
}
