/* ==========================================================================
   Saquella Geo Switch — popup (modal / bottom sheet) e barra
   Usa i token del sito se presenti, con fallback.
   ========================================================================== */

.saq-geo {
	--saq-geo-surface: var(--c-bg, #f6f1eb);
	--saq-geo-card: #fff;
	--saq-geo-ink: var(--c-dark, #2a1a10);
	--saq-geo-muted: var(--c-brown, #6f5546);
	--saq-geo-accent: var(--c-red, #e40b18);
	--saq-geo-gold: var(--c-gold, #ae906c);
	--saq-geo-line: rgba(137, 109, 92, 0.28);
	--saq-geo-radius: 6px;
	--saq-geo-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

	position: fixed;
	z-index: 99999;
	font-family: inherit;
	color: var(--saq-geo-ink);
	-webkit-font-smoothing: antialiased;
}

.saq-geo *,
.saq-geo *::before,
.saq-geo *::after {
	box-sizing: border-box;
}

/* --- Head: logo + ornamento con icona ------------------------------------ */

.saq-geo__head {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	margin-bottom: 24px;
}

.saq-geo__logo {
	display: block;
	width: auto;
	max-width: 160px;
	height: auto;
	max-height: 40px;
}

.saq-geo__ornament {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	max-width: 220px;
	color: var(--saq-geo-gold);
}

.saq-geo__ornament::before,
.saq-geo__ornament::after {
	content: "";
	flex: 1;
	height: 1px;
}

.saq-geo__ornament::before {
	background: linear-gradient(90deg, transparent, var(--saq-geo-gold));
}

.saq-geo__ornament::after {
	background: linear-gradient(90deg, var(--saq-geo-gold), transparent);
}

.saq-geo__icon {
	display: grid;
	place-items: center;
	flex: none;
	width: 48px;
	height: 48px;
	border: 1px solid var(--saq-geo-gold);
	border-radius: 50%;
	background: var(--saq-geo-card);
	color: var(--saq-geo-accent);
}

.saq-geo__icon svg {
	display: block;
}

/* --- Testi --------------------------------------------------------------- */

.saq-geo__title {
	margin: 0 0 10px;
	font-size: 26px;
	line-height: 1.2;
	font-weight: 500;
	letter-spacing: -0.01em;
	text-align: center;
	text-wrap: balance;
}

.saq-geo__text {
	max-width: 38ch;
	margin: 0 auto 28px;
	font-size: 15px;
	line-height: 1.6;
	font-weight: 300;
	color: var(--saq-geo-muted);
	text-align: center;
	text-wrap: pretty;
}

/* --- Card di scelta ------------------------------------------------------ */

.saq-geo__actions {
	display: grid;
	gap: 10px;
}

.saq-geo__choice {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: 100%;
	min-height: 64px;
	margin: 0;
	padding: 14px 20px;
	border: 1px solid transparent;
	border-radius: var(--saq-geo-radius);
	font: inherit;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.saq-geo__choice-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.saq-geo__choice-label {
	font-size: 16px;
	line-height: 1.3;
	font-weight: 500;
}

.saq-geo__choice-meta {
	font-size: 12px;
	line-height: 1.3;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.72;
}

.saq-geo__choice-arrow {
	flex: none;
	transition: transform 0.25s var(--saq-geo-ease);
}

.saq-geo__choice--go {
	background: var(--saq-geo-accent);
	color: #fff;
}

.saq-geo__choice--go:hover,
.saq-geo__choice--go:focus-visible {
	background: var(--saq-geo-ink);
	color: #fff;
}

.saq-geo__choice--go:hover .saq-geo__choice-arrow,
.saq-geo__choice--go:focus-visible .saq-geo__choice-arrow {
	transform: translateX(4px);
}

.saq-geo__choice--stay {
	background: var(--saq-geo-card);
	border-color: var(--saq-geo-line);
	color: var(--saq-geo-ink);
}

.saq-geo__choice--stay:hover,
.saq-geo__choice--stay:focus-visible {
	border-color: var(--saq-geo-gold);
	box-shadow: 0 0 0 1px var(--saq-geo-gold);
}

.saq-geo__choice:focus-visible,
.saq-geo__close:focus-visible {
	outline: 2px solid var(--saq-geo-accent);
	outline-offset: 3px;
}

/* --- Chiudi -------------------------------------------------------------- */

.saq-geo__close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--saq-geo-muted);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.saq-geo__close:hover {
	background: rgba(137, 109, 92, 0.12);
	color: var(--saq-geo-ink);
}

.saq-geo__handle {
	display: none;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.saq-geo--modal {
	inset: 0;
	display: grid;
	place-items: center;
	padding: 24px;
}

.saq-geo--modal .saq-geo__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(42, 26, 16, 0.42);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.saq-geo--modal .saq-geo__panel {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	padding: 44px 40px 36px;
	background: var(--saq-geo-surface);
	border-radius: var(--saq-geo-radius);
	box-shadow:
		0 1px 0 rgba(255, 255, 255, 0.6) inset,
		0 30px 80px -20px rgba(42, 26, 16, 0.45);
	opacity: 0;
	transform: translateY(12px) scale(0.97);
	transition: opacity 0.35s var(--saq-geo-ease), transform 0.35s var(--saq-geo-ease);
}

/* Filo rosso superiore */
.saq-geo--modal .saq-geo__panel::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	width: 56px;
	height: 3px;
	background: var(--saq-geo-accent);
	transform: translateX(-50%);
}

.saq-geo--modal .saq-geo__panel:focus {
	outline: none;
}

.saq-geo--modal.is-visible .saq-geo__backdrop {
	opacity: 1;
}

.saq-geo--modal.is-visible .saq-geo__panel {
	opacity: 1;
	transform: none;
}

body.saq-geo-lock {
	overflow: hidden;
}

/* Mobile: bottom sheet */
@media (max-width: 599px) {
	.saq-geo--modal {
		place-items: end stretch;
		padding: 0;
	}

	.saq-geo--modal .saq-geo__panel {
		max-width: none;
		max-height: 88vh;
		padding: 32px 20px calc(20px + env(safe-area-inset-bottom, 0px));
		border-radius: 18px 18px 0 0;
		transform: translateY(100%);
	}

	.saq-geo--modal .saq-geo__panel::before {
		display: none;
	}

	.saq-geo--modal .saq-geo__handle {
		position: absolute;
		top: 10px;
		left: 50%;
		display: block;
		width: 40px;
		height: 4px;
		border-radius: 2px;
		background: var(--saq-geo-line);
		transform: translateX(-50%);
	}

	.saq-geo__head {
		gap: 16px;
		margin-bottom: 18px;
	}

	.saq-geo__title {
		font-size: 22px;
	}

	.saq-geo__text {
		margin-bottom: 22px;
		font-size: 14px;
	}
}

/* ==========================================================================
   Barra (non bloccante)
   ========================================================================== */

.saq-geo--bar {
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
}

.saq-geo--bar .saq-geo__backdrop,
.saq-geo--bar .saq-geo__logo,
.saq-geo--bar .saq-geo__handle {
	display: none;
}

.saq-geo--bar .saq-geo__panel {
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 4px 20px;
	width: min(1440px, 92%);
	margin: 0 auto 16px;
	padding: 16px 64px 16px 20px;
	background: var(--saq-geo-surface);
	border: 1px solid var(--saq-geo-line);
	border-radius: var(--saq-geo-radius);
	box-shadow: 0 16px 48px -12px rgba(42, 26, 16, 0.35);
	pointer-events: auto;
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.3s var(--saq-geo-ease), transform 0.3s var(--saq-geo-ease);
}

.saq-geo--bar.is-visible .saq-geo__panel {
	opacity: 1;
	transform: none;
}

.saq-geo--bar .saq-geo__head {
	grid-column: 1;
	grid-row: 1 / span 2;
	margin: 0;
}

.saq-geo--bar .saq-geo__ornament {
	max-width: none;
	width: auto;
}

.saq-geo--bar .saq-geo__ornament::before,
.saq-geo--bar .saq-geo__ornament::after {
	display: none;
}

.saq-geo--bar .saq-geo__icon {
	width: 44px;
	height: 44px;
}

.saq-geo--bar .saq-geo__title,
.saq-geo--bar .saq-geo__text {
	grid-column: 2;
	max-width: none;
	margin: 0;
	text-align: left;
}

.saq-geo--bar .saq-geo__title {
	font-size: 17px;
}

.saq-geo--bar .saq-geo__text {
	font-size: 14px;
}

.saq-geo--bar .saq-geo__actions {
	grid-column: 3;
	grid-row: 1 / span 2;
	grid-auto-flow: column;
}

.saq-geo--bar .saq-geo__choice {
	min-height: 52px;
	padding: 10px 18px;
}

.saq-geo--bar .saq-geo__choice-label {
	font-size: 15px;
	white-space: nowrap;
}

.saq-geo--bar .saq-geo__close {
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 899px) {
	.saq-geo--bar .saq-geo__panel {
		grid-template-columns: auto 1fr;
		width: calc(100% - 24px);
		margin-bottom: 12px;
		padding: 16px 52px 16px 16px;
	}

	.saq-geo--bar .saq-geo__actions {
		grid-column: 1 / -1;
		grid-row: auto;
		grid-auto-flow: row;
		margin-top: 12px;
	}

	.saq-geo--bar .saq-geo__close {
		top: 8px;
		transform: none;
	}
}

/* ==========================================================================
   Accessibilità
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.saq-geo *,
	.saq-geo *::before,
	.saq-geo *::after {
		transition: none !important;
	}
}
