/* ==========================================================================
   GoJardin — moteur de quiz
   Aucune dependance, aucune police externe, aucune requete supplementaire.

   Le style est volontairement porte par des variables : le jour ou Julien
   change de theme, il n'y a que le bloc :root a revoir, pas 600 lignes.
   ========================================================================== */

.gj-quiz {
	--gjq-vert: #16a34a;
	--gjq-vert-clair: #4ade80;
	--gjq-cyan: #06b6d4;
	--gjq-violet: #8b5cf6;
	--gjq-rouge: #ef4444;
	--gjq-ambre: #f59e0b;

	--gjq-fond: #ffffff;
	--gjq-fond-carte: rgba(255, 255, 255, 0.72);
	--gjq-texte: #0f172a;
	--gjq-texte-doux: #64748b;
	--gjq-bord: rgba(15, 23, 42, 0.08);
	--gjq-ombre: 0 4px 24px rgba(15, 23, 42, 0.08);
	--gjq-ombre-forte: 0 12px 40px rgba(15, 23, 42, 0.16);

	--gjq-rayon: 20px;
	--gjq-rayon-petit: 14px;
	--gjq-transition: 260ms cubic-bezier(0.22, 1, 0.36, 1);

	position: relative;
	max-width: 760px;
	margin: 2.5rem auto;
	padding: 0;
	color: var(--gjq-texte);
	font-family: inherit;
	line-height: 1.55;
	container-type: inline-size;
}

@media (prefers-color-scheme: dark) {
	.gj-quiz {
		--gjq-fond: #0b1120;
		--gjq-fond-carte: rgba(30, 41, 59, 0.66);
		--gjq-texte: #f1f5f9;
		--gjq-texte-doux: #94a3b8;
		--gjq-bord: rgba(255, 255, 255, 0.1);
		--gjq-ombre: 0 4px 24px rgba(0, 0, 0, 0.4);
		--gjq-ombre-forte: 0 12px 40px rgba(0, 0, 0, 0.55);
	}
}

/* le site porte deja un mode sombre maison, on s'y accroche aussi */
body.gj-dark .gj-quiz,
[data-theme="dark"] .gj-quiz {
	--gjq-fond: #0b1120;
	--gjq-fond-carte: rgba(30, 41, 59, 0.66);
	--gjq-texte: #f1f5f9;
	--gjq-texte-doux: #94a3b8;
	--gjq-bord: rgba(255, 255, 255, 0.1);
}

.gj-quiz *,
.gj-quiz *::before,
.gj-quiz *::after {
	box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   La carte : verre depoli sur une aurore animee
   -------------------------------------------------------------------------- */

/* La bordure en degrade tourne autour de la carte. Elle est portee par un
   conteneur exterieur : une bordure degradee ne se fait pas sur l'element
   lui-meme sans sacrifier le border-radius du fond. */
.gjq-carte {
	position: relative;
	padding: clamp(1.25rem, 4cqi, 2.25rem);
	border-radius: var(--gjq-rayon);
	background: var(--gjq-fond-carte);
	box-shadow: var(--gjq-ombre), 0 0 0 1px var(--gjq-bord);
	backdrop-filter: blur(16px) saturate(160%);
	-webkit-backdrop-filter: blur(16px) saturate(160%);
	overflow: hidden;
	isolation: isolate;
}

/* le liseré lumineux qui fait le tour, lentement */
.gjq-carte::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	border-radius: inherit;
	padding: 1.5px;
	background: conic-gradient(
		from var(--gjq-angle, 0deg),
		transparent 0deg,
		color-mix(in srgb, var(--gjq-vert) 90%, transparent) 40deg,
		color-mix(in srgb, var(--gjq-cyan) 90%, transparent) 90deg,
		color-mix(in srgb, var(--gjq-violet) 80%, transparent) 140deg,
		transparent 200deg,
		transparent 360deg
	);
	-webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
	animation: gjq-tourne 8s linear infinite;
}

@property --gjq-angle {
	syntax: "<angle>";
	initial-value: 0deg;
	inherits: false;
}

@keyframes gjq-tourne {
	to { --gjq-angle: 360deg; }
}

/* l'aurore : trois taches de couleur qui derivent lentement derriere le verre */
.gjq-carte::before {
	content: "";
	position: absolute;
	inset: -45%;
	z-index: -1;
	background:
		radial-gradient(40% 46% at 16% 20%, color-mix(in srgb, var(--gjq-vert) 85%, transparent), transparent 68%),
		radial-gradient(38% 44% at 84% 72%, color-mix(in srgb, var(--gjq-cyan) 78%, transparent), transparent 68%),
		radial-gradient(34% 40% at 62% 8%, color-mix(in srgb, var(--gjq-violet) 62%, transparent), transparent 68%);
	filter: blur(34px);
	opacity: 0.78;
	animation: gjq-aurore 22s ease-in-out infinite alternate;
}

@media (prefers-color-scheme: dark) {
	.gjq-carte::before { opacity: 0.55; }
}

@keyframes gjq-aurore {
	0%   { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
	50%  { transform: translate3d(2%, -3%, 0) rotate(6deg) scale(1.08); }
	100% { transform: translate3d(-3%, 2%, 0) rotate(-5deg) scale(1.04); }
}

/* --------------------------------------------------------------------------
   En-tete : titre, progression
   -------------------------------------------------------------------------- */

.gjq-entete {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.gjq-titre {
	flex: 1;
	margin: 0;
	font-size: clamp(1.05rem, 3cqi, 1.4rem);
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.25;
	background: linear-gradient(120deg,
		var(--gjq-texte) 20%,
		color-mix(in srgb, var(--gjq-vert) 85%, var(--gjq-texte)) 55%,
		color-mix(in srgb, var(--gjq-cyan) 80%, var(--gjq-texte)) 90%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.gjq-compteur {
	flex-shrink: 0;
	font-variant-numeric: tabular-nums;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--gjq-texte-doux);
	padding: 0.35rem 0.7rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--gjq-texte) 6%, transparent);
	border: 1px solid var(--gjq-bord);
}

.gjq-barre {
	position: relative;
	height: 6px;
	margin-bottom: 1.75rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--gjq-texte) 8%, transparent);
	overflow: hidden;
}

.gjq-barre-remplie {
	position: absolute;
	inset: 0 auto 0 0;
	width: 0;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--gjq-vert), var(--gjq-cyan), var(--gjq-violet));
	background-size: 200% 100%;
	transition: width var(--gjq-transition);
	animation: gjq-defile 4s linear infinite;
}

@keyframes gjq-defile {
	to { background-position: -200% 0; }
}

/* --------------------------------------------------------------------------
   Question
   -------------------------------------------------------------------------- */

.gjq-question {
	animation: gjq-entree 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes gjq-entree {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: none; }
}

.gjq-intitule {
	margin: 0 0 1.25rem;
	font-size: clamp(1.1rem, 3.4cqi, 1.5rem);
	font-weight: 650;
	letter-spacing: -0.02em;
	line-height: 1.3;
}

.gjq-illustration {
	display: block;
	width: 100%;
	max-height: 320px;
	object-fit: cover;
	border-radius: var(--gjq-rayon-petit);
	margin-bottom: 1.25rem;
	border: 1px solid var(--gjq-bord);
}

/* --------------------------------------------------------------------------
   Reponses : les boutons
   -------------------------------------------------------------------------- */

.gjq-reponses {
	display: grid;
	gap: 0.7rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* avec images, on passe en grille : les vignettes ont besoin de place */
.gjq-reponses.gjq-avec-images {
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.gjq-reponse {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.85rem;
	width: 100%;
	padding: 1rem 1.15rem;
	text-align: left;
	font: inherit;
	font-weight: 550;
	color: var(--gjq-texte);
	background: color-mix(in srgb, var(--gjq-fond) 86%, transparent);
	border: 1.5px solid var(--gjq-bord);
	border-radius: var(--gjq-rayon-petit);
	cursor: pointer;
	overflow: hidden;
	transition: transform var(--gjq-transition), border-color var(--gjq-transition),
		box-shadow var(--gjq-transition), background var(--gjq-transition);
}

/* le trait lumineux qui balaie le bouton au survol, de gauche a droite */
.gjq-reponse::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: -40%;
	width: 30%;
	z-index: 0;
	background: linear-gradient(
		100deg,
		transparent,
		color-mix(in srgb, var(--gjq-vert-clair) 45%, transparent),
		transparent
	);
	opacity: 0;
	pointer-events: none;
}

.gjq-reponse:hover:not(:disabled)::after {
	opacity: 1;
	animation: gjq-balayage 750ms ease-out;
}

@keyframes gjq-balayage {
	to { left: 115%; }
}

/* le halo qui suit le curseur : --gjq-x et --gjq-y sont poses par le JS */
.gjq-reponse::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	opacity: 0;
	background: radial-gradient(
		180px circle at var(--gjq-x, 50%) var(--gjq-y, 50%),
		color-mix(in srgb, var(--gjq-vert) 26%, transparent),
		transparent 65%
	);
	transition: opacity var(--gjq-transition);
	pointer-events: none;
}

.gjq-reponse > * {
	position: relative;
	z-index: 1;
}

.gjq-reponse:hover:not(:disabled) {
	transform: translateY(-2px);
	border-color: color-mix(in srgb, var(--gjq-vert) 55%, transparent);
	box-shadow: var(--gjq-ombre-forte);
}

.gjq-reponse:hover:not(:disabled)::before {
	opacity: 1;
}

.gjq-reponse:active:not(:disabled) {
	transform: translateY(0) scale(0.985);
}

.gjq-reponse:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--gjq-cyan) 70%, transparent);
	outline-offset: 3px;
}

.gjq-reponse:disabled {
	cursor: default;
}

.gjq-puce {
	flex-shrink: 0;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 10px;
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.02em;
	color: var(--gjq-texte-doux);
	background: color-mix(in srgb, var(--gjq-texte) 7%, transparent);
	border: 1px solid var(--gjq-bord);
	transition: all var(--gjq-transition);
}

.gjq-reponse:hover:not(:disabled) .gjq-puce {
	color: #fff;
	background: linear-gradient(135deg, var(--gjq-vert), var(--gjq-cyan));
	border-color: transparent;
	transform: scale(1.08) rotate(-4deg);
	box-shadow: 0 4px 14px color-mix(in srgb, var(--gjq-vert) 45%, transparent);
}

.gjq-vignette {
	flex-shrink: 0;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 10px;
	margin-bottom: 0.55rem;
	border: 1px solid var(--gjq-bord);
}

.gjq-avec-images .gjq-reponse {
	flex-direction: column;
	align-items: stretch;
	text-align: center;
	gap: 0;
	padding: 0.6rem;
}

.gjq-avec-images .gjq-puce {
	display: none;
}

/* --- etats apres reponse --- */

.gjq-reponse.est-bonne {
	border-color: var(--gjq-vert);
	background: color-mix(in srgb, var(--gjq-vert) 14%, transparent);
	animation: gjq-pulse 500ms ease-out;
}

.gjq-reponse.est-bonne .gjq-puce {
	color: #fff;
	background: var(--gjq-vert);
	border-color: var(--gjq-vert);
}

.gjq-reponse.est-mauvaise {
	border-color: var(--gjq-rouge);
	background: color-mix(in srgb, var(--gjq-rouge) 12%, transparent);
	animation: gjq-secousse 420ms ease-in-out;
}

.gjq-reponse.est-mauvaise .gjq-puce {
	color: #fff;
	background: var(--gjq-rouge);
	border-color: var(--gjq-rouge);
}

.gjq-reponse.est-choisie {
	border-color: var(--gjq-cyan);
	background: color-mix(in srgb, var(--gjq-cyan) 14%, transparent);
}

.gjq-reponse.est-terne {
	opacity: 0.45;
}

@keyframes gjq-pulse {
	0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gjq-vert) 55%, transparent); }
	100% { box-shadow: 0 0 0 16px transparent; }
}

@keyframes gjq-secousse {
	0%, 100% { transform: translateX(0); }
	20%      { transform: translateX(-7px); }
	40%      { transform: translateX(6px); }
	60%      { transform: translateX(-4px); }
	80%      { transform: translateX(2px); }
}

/* --------------------------------------------------------------------------
   Barres de resultats d'un sondage
   -------------------------------------------------------------------------- */

.gjq-part {
	position: absolute;
	inset: 0 auto 0 0;
	z-index: 0;
	width: 0;
	background: linear-gradient(90deg,
		color-mix(in srgb, var(--gjq-cyan) 26%, transparent),
		color-mix(in srgb, var(--gjq-violet) 20%, transparent));
	transition: width 700ms cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: none;
}

.gjq-pourcent {
	margin-left: auto;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	font-size: 0.9rem;
	color: var(--gjq-texte-doux);
}

/* --------------------------------------------------------------------------
   Explication apres reponse
   -------------------------------------------------------------------------- */

.gjq-explication {
	margin-top: 1rem;
	padding: 0.9rem 1.1rem;
	border-radius: var(--gjq-rayon-petit);
	border-left: 3px solid var(--gjq-cyan);
	background: color-mix(in srgb, var(--gjq-cyan) 9%, transparent);
	font-size: 0.94rem;
	animation: gjq-entree 320ms ease-out both;
}

/* --------------------------------------------------------------------------
   Boutons d'action
   -------------------------------------------------------------------------- */

.gjq-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.7rem;
	margin-top: 1.5rem;
}

.gjq-bouton {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.8rem 1.5rem;
	font: inherit;
	font-weight: 650;
	color: #fff;
	background: linear-gradient(120deg, var(--gjq-vert), var(--gjq-cyan));
	background-size: 180% 100%;
	border: none;
	border-radius: 999px;
	cursor: pointer;
	box-shadow: 0 6px 20px color-mix(in srgb, var(--gjq-vert) 34%, transparent);
	transition: transform var(--gjq-transition), box-shadow var(--gjq-transition),
		background-position var(--gjq-transition);
}

.gjq-bouton:hover {
	transform: translateY(-2px);
	background-position: 100% 0;
	box-shadow: 0 10px 28px color-mix(in srgb, var(--gjq-cyan) 42%, transparent);
}

.gjq-bouton:active {
	transform: translateY(0) scale(0.98);
}

.gjq-bouton:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--gjq-violet) 70%, transparent);
	outline-offset: 3px;
}

.gjq-bouton-discret {
	color: var(--gjq-texte);
	background: transparent;
	border: 1.5px solid var(--gjq-bord);
	box-shadow: none;
}

.gjq-bouton-discret:hover {
	background: color-mix(in srgb, var(--gjq-texte) 6%, transparent);
	box-shadow: none;
}

/* --------------------------------------------------------------------------
   Ecran de resultat
   -------------------------------------------------------------------------- */

.gjq-resultat {
	text-align: center;
	animation: gjq-entree 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gjq-anneau {
	position: relative;
	width: 168px;
	height: 168px;
	margin: 0.5rem auto 1.25rem;
}

.gjq-anneau svg {
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

.gjq-anneau circle {
	fill: none;
	stroke-width: 11;
	stroke-linecap: round;
}

.gjq-anneau .gjq-piste {
	stroke: color-mix(in srgb, var(--gjq-texte) 10%, transparent);
}

.gjq-anneau .gjq-jauge {
	stroke: url(#gjq-degrade);
	stroke-dasharray: 440;
	stroke-dashoffset: 440;
	transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.gjq-anneau-texte {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	gap: 0.1rem;
}

.gjq-score {
	font-size: 2.5rem;
	font-weight: 800;
	line-height: 1;
	letter-spacing: -0.03em;
	font-variant-numeric: tabular-nums;
	background: linear-gradient(120deg, var(--gjq-vert), var(--gjq-cyan));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.gjq-score-detail {
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--gjq-texte-doux);
}

.gjq-resultat-titre {
	margin: 0 0 0.5rem;
	font-size: clamp(1.3rem, 4cqi, 1.75rem);
	font-weight: 750;
	letter-spacing: -0.02em;
}

.gjq-resultat-texte {
	margin: 0 auto;
	max-width: 46ch;
	color: var(--gjq-texte-doux);
}

.gjq-resultat-image {
	display: block;
	width: 100%;
	max-width: 340px;
	margin: 0 auto 1.25rem;
	border-radius: var(--gjq-rayon-petit);
	border: 1px solid var(--gjq-bord);
}

.gjq-recap {
	margin: 1.75rem 0 0;
	padding: 0;
	list-style: none;
	text-align: left;
	display: grid;
	gap: 0.5rem;
}

.gjq-recap li {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	padding: 0.65rem 0.85rem;
	border-radius: 10px;
	background: color-mix(in srgb, var(--gjq-texte) 4%, transparent);
	border: 1px solid var(--gjq-bord);
	font-size: 0.9rem;
}

.gjq-recap .gjq-marque {
	flex-shrink: 0;
	font-weight: 700;
}

.gjq-recap .gjq-juste { color: var(--gjq-vert); }
.gjq-recap .gjq-faux  { color: var(--gjq-rouge); }

.gj-quiz-erreur {
	max-width: 760px;
	margin: 2rem auto;
	padding: 1rem 1.25rem;
	border-radius: 12px;
	border: 1px solid #fca5a5;
	background: #fef2f2;
	color: #7f1d1d;
	font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   Ecrans etroits
   -------------------------------------------------------------------------- */

@container (max-width: 420px) {
	.gjq-reponses.gjq-avec-images {
		grid-template-columns: repeat(2, 1fr);
	}
	.gjq-actions .gjq-bouton {
		flex: 1;
		justify-content: center;
	}
}

/* --------------------------------------------------------------------------
   Mouvement reduit : on garde les changements d'etat, on retire le mouvement
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.gj-quiz *,
	.gj-quiz *::before,
	.gj-quiz *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}
