/**
 * Galaxyy Consent : style de base de la bannière et de la fenêtre de préférences.
 *
 * Tout passe par les variables --gc-* : le thème du site (galaxyy-trixie) les relie aux tokens
 * du design system. Les valeurs par défaut sont posées sous :where() (spécificité nulle) : une
 * simple règle `.gc { --gc-…: … }` du thème l'emporte, quel que soit l'ordre des feuilles.
 * Les trois boutons ont volontairement le même style : refuser doit être aussi simple et
 * visible qu'accepter (CNIL).
 */
:where(.gc) {
	--gc-bg: #ffffff;
	--gc-fg: #1f2937;
	--gc-muted: #4b5563;
	--gc-border: #d1d5db;
	--gc-button-bg: #1f2937;
	--gc-button-fg: #ffffff;
	--gc-focus: #2563eb;
	--gc-switch-off: #9ca3af;
	--gc-switch-on: #1f2937;
	--gc-radius: 8px;
	--gc-font: inherit;
	--gc-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
	--gc-z: 99999;
}

/* Sombre sans thème qui relie les tokens : classe `dark` sur <html>, comme galaxyy-trixie. */
:where(html.dark .gc) {
	--gc-bg: #111827;
	--gc-fg: #f3f4f6;
	--gc-muted: #d1d5db;
	--gc-border: #374151;
	--gc-button-bg: #f3f4f6;
	--gc-button-fg: #111827;
	--gc-focus: #93c5fd;
	--gc-switch-off: #6b7280;
	--gc-switch-on: #f3f4f6;
}

.gc-banner,
.gc-dialog {
	box-sizing: border-box;
	color: var(--gc-fg);
	background: var(--gc-bg);
	border: 1px solid var(--gc-border);
	border-radius: var(--gc-radius);
	box-shadow: var(--gc-shadow);
	font-family: var(--gc-font);
	font-size: 1rem;
	line-height: 1.5;
}

.gc-banner {
	position: fixed;
	z-index: var(--gc-z);
	right: 16px;
	bottom: 16px;
	left: 16px;
	max-width: 960px;
	max-height: calc(100vh - 32px);
	margin: 0 auto;
	padding: 20px 24px;
	overflow: auto;
}

.gc--center .gc-banner {
	top: 50%;
	bottom: auto;
	max-width: 640px;
	transform: translateY(-50%);
}

.gc-banner[hidden] {
	display: none;
}

/* Focus posé par le script pour annoncer la bannière : le conteneur n'a pas de contour, ses boutons si. */
.gc-banner:focus {
	outline: none;
}

.gc-title {
	margin: 0 0 8px;
	color: inherit;
	font-size: 1.25rem;
	line-height: 1.3;
}

.gc-banner p,
.gc-dialog p {
	margin: 0 0 12px;
}

.gc-purposes {
	margin: 0 0 12px;
	padding-left: 1.25em;
}

.gc a {
	color: inherit;
	text-decoration: underline;
}

.gc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

.gc-button {
	flex: 1 1 160px;
	min-height: 44px;
	padding: 10px 16px;
	color: var(--gc-button-fg);
	background: var(--gc-button-bg);
	border: 1px solid var(--gc-button-bg);
	border-radius: var(--gc-radius);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.gc-button:hover {
	opacity: 0.9;
}

.gc-button:focus-visible,
.gc-close:focus-visible,
.gc-switch input:focus-visible + .gc-switch__track {
	outline: 3px solid var(--gc-focus);
	outline-offset: 2px;
}

.gc-dialog {
	width: min(640px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	padding: 20px 24px;
	overflow: auto;
}

.gc-dialog::backdrop {
	background: rgba(0, 0, 0, 0.5);
}

.gc-dialog__header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.gc-close {
	min-width: 44px;
	min-height: 44px;
	padding: 0;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: var(--gc-radius);
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.gc-category {
	padding: 12px 0;
	border-top: 1px solid var(--gc-border);
}

.gc-category__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.gc-category h3 {
	margin: 0 0 4px;
	color: inherit;
	font-size: 1rem;
}

.gc-category p,
.gc-id {
	color: var(--gc-muted);
	font-size: 0.9375rem;
}

.gc-always {
	color: var(--gc-muted);
	font-size: 0.875rem;
	font-weight: 600;
}

.gc-switch {
	position: relative;
	display: inline-flex;
	flex: none;
	cursor: pointer;
}

.gc-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.gc-switch__track {
	position: relative;
	display: block;
	width: 48px;
	height: 28px;
	background: var(--gc-switch-off);
	border-radius: 14px;
	transition: background-color 0.15s;
}

.gc-switch__track::after {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	background: var(--gc-bg);
	border-radius: 50%;
	content: "";
	transition: transform 0.15s;
}

.gc-switch input:checked + .gc-switch__track {
	background: var(--gc-switch-on);
}

.gc-switch input:checked + .gc-switch__track::after {
	transform: translateX(20px);
}

.gc-id code {
	font-size: 0.8125rem;
	word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
	.gc-switch__track,
	.gc-switch__track::after {
		transition: none;
	}
}

@media (max-width: 600px) {
	.gc-banner {
		right: 8px;
		bottom: 8px;
		left: 8px;
		padding: 16px;
	}

	.gc-button {
		flex-basis: 100%;
	}
}
