/**
 * Local consent controller — notice, modal and policy-page section.
 * Theme tokens only; no remote assets, icons or animation dependency.
 */

.fdiv-consent-notice {
	position: fixed;
	left: 50%;
	bottom: 16px;
	transform: translateX(-50%);
	width: min(100% - 32px, 1120px);
	max-height: 50dvh;
	overflow: auto;
	z-index: 100000;
	background: var(--color-bg);
	color: var(--color-text);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	padding: var(--space-4) var(--space-5);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-4);
	font-size: var(--text-sm);
	line-height: var(--leading-normal);
}

.fdiv-consent-notice__body {
	flex: 1 1 320px;
	min-width: 0;
}

.fdiv-consent-notice__title {
	margin: 0 0 var(--space-1);
	font-weight: 600;
	font-size: var(--text-base);
	color: var(--color-heading);
}

.fdiv-consent-notice__text {
	margin: 0 0 var(--space-1);
}

.fdiv-consent-notice__policy-link {
	color: var(--color-accent);
	text-decoration: underline;
}

.fdiv-consent-notice__actions {
	flex: 0 0 auto;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.fdiv-consent-btn {
	white-space: nowrap;
}

@media (max-width: 767px) {
	.fdiv-consent-notice {
		left: 0;
		right: 0;
		bottom: 0;
		transform: none;
		width: 100%;
		max-width: none;
		border-radius: var(--radius-md) var(--radius-md) 0 0;
		padding: var(--space-4) max(var(--space-4), env(safe-area-inset-left)) calc(var(--space-4) + env(safe-area-inset-bottom)) max(var(--space-4), env(safe-area-inset-right));
		flex-direction: column;
		align-items: stretch;
	}

	.fdiv-consent-notice__actions {
		flex-direction: column;
	}

	.fdiv-consent-notice__actions .fdiv-consent-btn {
		width: 100%;
	}

	.fdiv-consent-btn {
		white-space: normal;
	}
}

/* Selection modal */

.fdiv-consent-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgb(0 0 0 / 0.45);
	z-index: 100001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-4);
}

.fdiv-consent-modal {
	background: var(--color-bg);
	color: var(--color-text);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	width: min(560px, 100%);
	max-height: 80dvh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.fdiv-consent-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-4) var(--space-5);
	border-bottom: 1px solid var(--color-border);
}

.fdiv-consent-modal__header h2 {
	margin: 0;
	font-size: var(--text-lg);
	color: var(--color-heading);
}

.fdiv-consent-modal__close {
	background: none;
	border: none;
	font-size: var(--text-2xl);
	line-height: 1;
	cursor: pointer;
	color: var(--color-text-muted);
	padding: 0 var(--space-2);
}

.fdiv-consent-modal__close:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

.fdiv-consent-modal__categories {
	overflow-y: auto;
	padding: var(--space-4) var(--space-5);
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.fdiv-consent-category {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
	font-size: var(--text-sm);
}

.fdiv-consent-category__checkbox {
	margin-top: 0.2em;
	flex-shrink: 0;
}

.fdiv-consent-category__desc {
	color: var(--color-text-muted);
	font-size: var(--text-xs);
}

.fdiv-consent-modal__actions {
	display: flex;
	gap: var(--space-2);
	padding: var(--space-4) var(--space-5);
	border-top: 1px solid var(--color-border);
	flex-wrap: wrap;
}

@media (max-width: 767px) {
	.fdiv-consent-modal-backdrop {
		align-items: flex-end;
		padding: 0;
	}

	.fdiv-consent-modal {
		width: 100%;
		max-height: 85dvh;
		border-radius: var(--radius-md) var(--radius-md) 0 0;
		padding-bottom: env(safe-area-inset-bottom);
	}

	.fdiv-consent-modal__actions {
		flex-direction: column;
	}
}

body.fdiv-consent-modal-open {
	overflow: hidden;
}

/* Paired with the aria-hidden/inert the controller sets on the same nodes, for browsers that do not
   yet implement inert. */
.fdiv-consent-modal-open > [inert] {
	pointer-events: none;
	user-select: none;
}

/* Policy-page inline section */

.fdiv-consent-policy-section {
	margin-top: var(--space-8);
	padding-top: var(--space-6);
	border-top: 1px solid var(--color-border);
}

.fdiv-consent-policy-state {
	font-size: var(--text-sm);
	color: var(--color-text-muted);
}

/* The server renders this container hidden; the author-level display below would otherwise beat the
   user-agent rule for [hidden] and show an empty action row before the controller hydrates. */
.fdiv-consent-policy-actions[hidden] {
	display: none;
}

.fdiv-consent-policy-actions {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	margin-top: var(--space-3);
}

/* Optional circular access link to the cookie Page.
   left/right are physical on purpose: an administrator who placed this on one side of the viewport
   must still find it there on a right-to-left site. */

a.fdiv-consent-access-link {
	position: fixed;
	bottom: 16px;
	width: 48px;
	height: 48px;
	padding: 0;
	border-radius: var(--radius-full);
	box-shadow: var(--shadow-lg);
	z-index: 99998;
}

a.fdiv-consent-access-link--left {
	left: 16px;
}

a.fdiv-consent-access-link--right {
	right: 16px;
}

.fdiv-consent-access-link__icon {
	width: 24px;
	height: 24px;
	display: block;
}

@media (max-width: 767px) {
	a.fdiv-consent-access-link--desktop-only {
		display: none;
	}

	a.fdiv-consent-access-link {
		width: 44px;
		height: 44px;
		bottom: calc(12px + env(safe-area-inset-bottom));
	}

	a.fdiv-consent-access-link--left {
		left: calc(12px + env(safe-area-inset-left));
	}

	a.fdiv-consent-access-link--right {
		right: calc(12px + env(safe-area-inset-right));
	}

	.fdiv-consent-access-link__icon {
		width: 22px;
		height: 22px;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.fdiv-consent-notice,
	.fdiv-consent-modal {
		transition: none; /* No animation dependency — explicit, not merely absent. */
	}
}
