/*
 * Armeria 3S Legal - cookie banner, preferences dialog, floating button, embed placeholder, cookie table.
 * Theme tokens with fallbacks (works with any theme). Custom colours arrive as inline --a3sc-* variables.
 * z-index: banner/dialog 7000, floating button 6500 (SPEC-v1.1 §1.9).
 */

.a3s-consent,
.a3s-consent-prefs,
.a3s-consent-fab,
.a3s-consent-embed {
	--a3sc-bg: var(--a3s-color-bg, #fff);
	--a3sc-text: var(--a3s-color-text, #231f20);
	--a3sc-primary: var(--a3s-color-primary, #e95e1b);
	--a3sc-on-primary: var(--a3s-color-primary-contrast, #231f20);
	--a3sc-muted: var(--a3s-color-muted, #5f5859);
	--a3sc-border: var(--a3s-color-border, #dcd9d5);
	--a3sc-surface: var(--a3s-color-surface, #f3f2f0);
	--a3sc-radius: var(--a3s-radius, 0);
	--a3sc-ring: 0 0 0 3px rgba(233, 94, 27, .35);
	--a3sc-font: var(--a3s-font-body, inherit);
}

/* The text token may come from an Elementor kit (default kit text = #7a7a7a, 4.29:1 on white): darken it so the
   consent UI stays at WCAG AA (>= 4.5:1) whatever the kit. Custom colours (inline --a3sc-text) win over this. */
@supports (color: color-mix(in srgb, red, blue)) {
	.a3s-consent,
	.a3s-consent-prefs,
	.a3s-consent-fab,
	.a3s-consent-embed {
		--a3sc-text: color-mix(in srgb, var(--a3s-color-text, #231f20) 72%, #000);
	}
}

/* Banner ------------------------------------------------------------------ */
.a3s-consent {
	position: fixed;
	z-index: 7000;
	box-sizing: border-box;
	margin: 0;
	padding: 0;
	border: 1px solid var(--a3sc-border);
	background: var(--a3sc-bg);
	color: var(--a3sc-text);
	font-family: var(--a3sc-font);
	font-size: 15px;
	line-height: 1.5;
	box-shadow: 0 -2px 16px rgba(0, 0, 0, .18);
	max-height: 85vh;
	max-height: 85dvh;
	overflow: auto;
	overscroll-behavior: contain;
}

.a3s-consent[hidden],
.a3s-consent-fab[hidden],
.a3s-consent-prefs__id[hidden] {
	display: none !important;
}

.a3s-consent *,
.a3s-consent-prefs * {
	box-sizing: border-box;
}

.a3s-consent--bar {
	left: 0;
	right: 0;
	bottom: 0;
	width: 100%;
	border-width: 1px 0 0;
}

.a3s-consent--box {
	bottom: 16px;
	width: min(420px, calc(100vw - 32px));
	left: 50%;
	transform: translateX(-50%);
}

.a3s-consent--box.a3s-consent--pos-bottom-left {
	left: 16px;
	transform: none;
}

.a3s-consent--box.a3s-consent--pos-bottom-right {
	left: auto;
	right: 16px;
	transform: none;
}

/* Modal banner: native <dialog> in the top layer. */
dialog.a3s-consent--modal {
	position: fixed;
	inset: 0;
	margin: auto;
	width: min(560px, calc(100vw - 32px));
	height: fit-content;
	max-width: none;
}

dialog.a3s-consent--modal:not([open]) {
	display: none;
}

.a3s-consent--modal::backdrop,
.a3s-consent-prefs::backdrop {
	background: rgba(35, 31, 32, .55);
}

.a3s-consent__inner {
	position: relative;
	display: grid;
	gap: 12px 24px;
	padding: 20px 56px 20px 20px;
	margin: 0 auto;
}

.a3s-consent--bar .a3s-consent__inner {
	max-width: var(--a3s-container-wide, 1620px);
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	padding: 20px 64px 20px 24px;
}

.a3s-consent__title,
.a3s-consent-prefs__title {
	margin: 0 0 6px;
	padding: 0;
	font-family: var(--a3s-font-heading, inherit);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	color: inherit;
	text-transform: none;
	letter-spacing: 0;
}

.a3s-consent__msg > :first-child {
	margin-top: 0;
}

.a3s-consent__msg > :last-child {
	margin-bottom: 0;
}

.a3s-consent__msg p {
	margin: 0 0 8px;
}

.a3s-consent a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.a3s-consent__links {
	margin: 8px 0 0;
	font-size: 14px;
}

.a3s-consent-prefs .a3s-consent__links a {
	color: inherit;
}

/* Buttons: "Reject all" and "Accept all" identical (no dark pattern). */
.a3s-consent__actions,
.a3s-consent-prefs__foot {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.a3s-consent__actions .a3s-consent__btn--alt,
.a3s-consent-prefs__foot .a3s-consent__btn--alt {
	grid-column: 1 / -1;
}

.a3s-consent--bar .a3s-consent__actions {
	grid-template-columns: repeat(3, auto);
}

.a3s-consent--bar .a3s-consent__actions .a3s-consent__btn--alt {
	grid-column: auto;
}

.a3s-consent__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	min-width: 0;
	margin: 0;
	padding: 10px 20px;
	border: 2px solid var(--a3sc-primary);
	border-radius: var(--a3sc-radius);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-transform: none;
	letter-spacing: 0;
	white-space: normal;
	cursor: pointer;
	box-shadow: none;
	transition: background-color .15s ease-in-out, color .15s ease-in-out, border-color .15s ease-in-out;
}

.a3s-consent__btn--main {
	background: var(--a3sc-primary);
	color: var(--a3sc-on-primary);
}

.a3s-consent__btn--main:hover {
	filter: brightness(.94);
}

.a3s-consent__btn--alt {
	background: transparent;
	color: var(--a3sc-text);
	border-color: currentColor;
}

.a3s-consent__btn--alt:hover {
	background: var(--a3sc-surface);
}

.a3s-consent__x {
	position: absolute;
	top: 8px;
	right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	cursor: pointer;
	box-shadow: none;
}

.a3s-consent__x:hover {
	background: var(--a3sc-surface);
}

.a3s-consent__btn:focus-visible,
.a3s-consent__x:focus-visible,
.a3s-consent a:focus-visible,
.a3s-consent-prefs a:focus-visible,
.a3s-consent-prefs summary:focus-visible,
.a3s-consent-switch:focus-visible,
.a3s-consent-fab:focus-visible,
.a3s-consent-embed__btn:focus-visible,
.a3s-cookie-settings:focus-visible {
	outline: 2px solid var(--a3sc-primary);
	outline-offset: 2px;
	box-shadow: var(--a3sc-ring);
}

/* Preferences dialog ---------------------------------------------------------- */
.a3s-consent-prefs {
	z-index: 7000;
	width: min(640px, calc(100vw - 32px));
	max-width: none;
	max-height: min(90vh, 900px);
	max-height: min(90dvh, 900px);
	margin: auto;
	padding: 0;
	border: 1px solid var(--a3sc-border);
	border-radius: var(--a3sc-radius);
	background: var(--a3sc-bg);
	color: var(--a3sc-text);
	font-family: var(--a3sc-font);
	font-size: 15px;
	line-height: 1.5;
	box-shadow: 0 0 10px 3px rgba(0, 0, 0, .3);
	overflow: hidden;
}

.a3s-consent-prefs[open] {
	display: flex;
	flex-direction: column;
}

.a3s-consent-prefs__form {
	display: flex;
	flex-direction: column;
	min-height: 0;
	max-height: inherit;
	margin: 0;
}

.a3s-consent-prefs__head {
	position: relative;
	padding: 18px 64px 12px 20px;
	border-bottom: 1px solid var(--a3sc-border);
}

.a3s-consent-prefs__head .a3s-consent-prefs__title {
	margin: 0;
}

.a3s-consent-prefs__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 16px 20px;
	overflow: auto;
	overscroll-behavior: contain;
}

.a3s-consent-prefs__intro {
	margin: 0 0 12px;
}

.a3s-consent-prefs__foot {
	padding: 12px 20px 16px;
	border-top: 1px solid var(--a3sc-border);
	background: var(--a3sc-bg);
}

.a3s-consent-prefs__id {
	margin: 12px 0 0;
	font-size: 13px;
	color: var(--a3sc-muted);
	word-break: break-all;
}

.a3s-consent-cat {
	padding: 12px 0;
	border-top: 1px solid var(--a3sc-border);
}

.a3s-consent-cat__head {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 44px;
}

.a3s-consent-cat__label {
	flex: 1 1 auto;
	margin: 0;
	font-weight: 700;
	cursor: pointer;
}

.a3s-consent-cat__always {
	font-size: 13px;
	color: var(--a3sc-muted);
}

.a3s-consent-cat__desc {
	margin: 4px 0 0;
	font-size: 14px;
	color: var(--a3sc-muted);
}

.a3s-consent-cat__details {
	margin-top: 8px;
	font-size: 14px;
}

.a3s-consent-cat__details summary {
	display: inline-block;
	padding: 6px 0;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Switch: native checkbox (keyboard + screen reader), drawn as a toggle. */
.a3s-consent-switch {
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	flex: 0 0 auto;
	width: 48px;
	height: 28px;
	margin: 8px 0;
	border: 2px solid var(--a3sc-muted);
	border-radius: 28px;
	background: var(--a3sc-surface);
	cursor: pointer;
	transition: background-color .15s ease-in-out, border-color .15s ease-in-out;
}

.a3s-consent-switch::before {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--a3sc-muted);
	transition: transform .15s ease-in-out, background-color .15s ease-in-out;
}

.a3s-consent-switch:checked {
	background: var(--a3sc-primary);
	border-color: var(--a3sc-primary);
}

.a3s-consent-switch:checked::before {
	transform: translateX(20px);
	background: var(--a3sc-on-primary);
}

.a3s-consent-switch:disabled {
	cursor: not-allowed;
	opacity: .6;
}

/* Floating button ------------------------------------------------------------- */
.a3s-consent-fab {
	position: fixed;
	left: 16px;
	bottom: 16px;
	z-index: 6500;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--a3sc-border);
	border-radius: 50%;
	background: var(--a3sc-bg);
	color: var(--a3sc-text);
	box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
	cursor: pointer;
}

.a3s-consent-fab:hover {
	color: var(--a3sc-primary);
}

/* Blocked embed ------------------------------------------------------------------ */
.a3s-consent-embed {
	position: relative;
	display: block;
	max-width: 100%;
	min-height: 160px;
}

.a3s-consent-embed > iframe {
	display: block;
	max-width: 100%;
}

.a3s-consent-embed__ph {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 16px;
	background: var(--a3sc-surface);
	border: 1px solid var(--a3sc-border);
	color: var(--a3sc-text);
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
}

/* Elementor Video widget: the notice covers the player box and its image overlay. */
.elementor-wrapper.a3s-consent-embed > .a3s-consent-embed__ph {
	z-index: 2;
}

.a3s-consent-embed.is-loaded > .a3s-consent-embed__ph {
	display: none;
}

.a3s-consent-embed__txt {
	display: block;
	max-width: 46ch;
}

.a3s-consent-embed__btn {
	min-height: 44px;
	margin: 0;
	padding: 10px 20px;
	border: 2px solid var(--a3sc-primary);
	border-radius: var(--a3sc-radius);
	background: var(--a3sc-primary);
	color: var(--a3sc-on-primary);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

/* Cookie settings button ([a3s_cookie_settings]) ---------------------------------- */
.a3s-cookie-settings {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
	min-height: 24px;
}

/* Cookie table ([a3s_cookie_table] + preferences) --------------------------------- */
.a3s-cookie-table {
	max-width: 100%;
	overflow-x: auto;
	margin: 0 0 1em;
}

.a3s-cookie-table table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 14px;
	line-height: 1.4;
}

.a3s-cookie-table th,
.a3s-cookie-table td {
	padding: 8px 10px;
	border: 1px solid var(--a3s-color-border, #dcd9d5);
	text-align: left;
	vertical-align: top;
}

.a3s-cookie-table th {
	background: var(--a3s-color-surface, #f3f2f0);
	font-weight: 600;
}

.a3s-cookie-table code {
	font-size: 13px;
	word-break: break-all;
	background: none;
	padding: 0;
}

/* Small screens ----------------------------------------------------------------- */
@media (max-width: 991px) {
	.a3s-consent--bar .a3s-consent__inner {
		grid-template-columns: minmax(0, 1fr);
		padding: 16px 56px 16px 16px;
	}

	.a3s-consent--bar .a3s-consent__actions {
		grid-template-columns: 1fr 1fr;
	}

	.a3s-consent--bar .a3s-consent__actions .a3s-consent__btn--alt {
		grid-column: 1 / -1;
	}
}

@media (max-width: 575px) {
	.a3s-consent {
		font-size: 14px;
	}

	.a3s-consent--box,
	.a3s-consent--box.a3s-consent--pos-bottom-left,
	.a3s-consent--box.a3s-consent--pos-bottom-right {
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		transform: none;
		border-width: 1px 0 0;
	}

	.a3s-consent__inner {
		padding: 16px 52px 16px 16px;
	}

	.a3s-consent__btn {
		padding: 10px 12px;
		font-size: 14px;
	}

	.a3s-consent-prefs {
		width: 100vw;
		max-height: 100vh;
		max-height: 100dvh;
		border-width: 0;
	}

	.a3s-consent-prefs__body,
	.a3s-consent-prefs__foot {
		padding-left: 16px;
		padding-right: 16px;
	}

	/* Cookie table as stacked cards. */
	.a3s-cookie-table thead {
		display: none;
	}

	.a3s-cookie-table table,
	.a3s-cookie-table tbody,
	.a3s-cookie-table tr,
	.a3s-cookie-table td {
		display: block;
		width: 100%;
	}

	.a3s-cookie-table tr {
		margin-bottom: 8px;
		border: 1px solid var(--a3s-color-border, #dcd9d5);
	}

	.a3s-cookie-table td {
		border: 0;
		border-bottom: 1px solid var(--a3s-color-border, #dcd9d5);
	}

	.a3s-cookie-table td:last-child {
		border-bottom: 0;
	}

	.a3s-cookie-table td::before {
		content: attr(data-label);
		display: block;
		font-weight: 600;
		font-size: 12px;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.a3s-consent--bar:not([hidden]),
	.a3s-consent--pos-bottom-left:not([hidden]),
	.a3s-consent--pos-bottom-right:not([hidden]) {
		animation: a3s-consent-in .3s ease-out;
	}

	@keyframes a3s-consent-in {
		from {
			opacity: 0;
			translate: 0 16px;
		}

		to {
			opacity: 1;
			translate: 0 0;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.a3s-consent__btn,
	.a3s-consent-switch,
	.a3s-consent-switch::before {
		transition: none;
	}
}

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