/*
 * iTrobes Settings — cookie notice and scroll-to-top button.
 *
 * Every colour, radius and font comes from the Design System variables, with a
 * sensible fallback for a site that has not set them. Selectors are wrapped in
 * :where() so they carry no specificity: a theme rule always wins.
 */

:where(.its-consent, .its-totop) {
	--its-fe-accent: var(--ds-btn-bg, var(--ds-primary, #2563eb));
	--its-fe-accent-ink: var(--ds-btn-text, #fff);
	--its-fe-surface: var(--c-surface, #fff);
	--its-fe-ink: var(--c-ink, #0f172a);
	--its-fe-body: var(--c-body, #475569);
	--its-fe-border: var(--c-border, #e2e8f0);
	--its-fe-radius: var(--ds-btn-radius, 999px);
	font-family: var(--font-sans, inherit);
}

/* ------------------------------------------------------------- the notice */

:where(.its-consent:not(.its-choice)) { /* not the form consent checkbox (.its-choice.its-consent) */
	position: fixed;
	z-index: 9998;
	background: var(--its-fe-surface);
	color: var(--its-fe-ink);
	border: 1px solid var(--its-fe-border);
	box-shadow: 0 10px 40px rgba(15, 23, 42, 0.16);
}

:where(.its-consent--bottom) {
	inset: auto 0 0 0;
	border-width: 1px 0 0;
}
:where(.its-consent--left, .its-consent--right) {
	bottom: 20px;
	width: min(380px, calc(100vw - 32px));
	border-radius: 12px;
}
:where(.its-consent--left) { left: 20px; }
:where(.its-consent--right) { right: 20px; }

:where(.its-consent__inner) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	max-width: 1200px;
	margin: 0 auto;
	padding: 16px 20px;
}
:where(.its-consent--left .its-consent__inner, .its-consent--right .its-consent__inner) {
	display: block;
}

:where(.its-consent__text) {
	flex: 1 1 320px;
	margin: 0;
	color: var(--its-fe-body);
	font-size: 0.95em;
	line-height: 1.55;
}
:where(.its-consent__link) { color: var(--its-fe-accent); }

:where(.its-consent__actions) {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
:where(.its-consent--left .its-consent__actions, .its-consent--right .its-consent__actions) {
	margin-top: 14px;
}

:where(.its-consent__btn) {
	padding: 10px 20px;
	border: 1px solid var(--its-fe-accent);
	border-radius: var(--its-fe-radius);
	background: var(--its-fe-accent);
	color: var(--its-fe-accent-ink);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}
:where(.its-consent__btn:hover) { filter: brightness(0.93); }
:where(.its-consent__btn:focus-visible) { outline: 2px solid var(--its-fe-ink); outline-offset: 2px; }
:where(.its-consent__btn--ghost) {
	background: transparent;
	color: var(--its-fe-accent);
}

:where(.its-consent__reset) {
	padding: 0;
	border: 0;
	background: none;
	color: var(--its-fe-accent);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

/* --------------------------------------------------------- back to the top */

:where(.its-totop) {
	position: fixed;
	bottom: 20px;
	z-index: 9997;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: var(--its-fe-radius);
	background: var(--its-fe-accent);
	color: var(--its-fe-accent-ink);
	box-shadow: 0 6px 20px rgba(15, 23, 42, 0.22);
	cursor: pointer;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}
:where(.its-totop--right) { right: 20px; }
:where(.its-totop--left) { left: 20px; }
:where(.its-totop.is-in) { opacity: 1; transform: none; }
:where(.its-totop:hover) { filter: brightness(0.93); }
:where(.its-totop:focus-visible) { outline: 2px solid var(--its-fe-ink); outline-offset: 2px; }

/* Out of the notice's way while it is on screen. */
:where(body.its-has-consent .its-totop) { bottom: 96px; }

@media (max-width: 600px) {
	:where(.its-consent__inner) { padding: 14px 16px; }
	:where(.its-consent__actions) { width: 100%; }
	:where(.its-consent__btn) { flex: 1 1 auto; }
	:where(body.its-has-consent .its-totop) { bottom: 140px; }
}

@media (prefers-reduced-motion: reduce) {
	:where(.its-totop) { transition: none; }
}

/* The hidden attribute wins over the layout rules above. */
.its-consent[hidden],
.its-totop[hidden] { display: none !important; }
