/*
 * La page Participer : six portes, puis le formulaire de la personne choisie.
 * Une porte montre quoi ? Sa bulle grandit au survol, comme dans les listes du site. Le formulaire suit la
 * ligne du temps : elle part de la bulle, et l'anneau d'une étape se remplit quand elle est complète.
 */

.participer {
	--fort: var(--dm-encre);
	--sur: var(--dm-blanc);
	--trait: #8d877b; /* 3,5 pour 1 sur blanc : le bord d'un champ se voit. */

	container: participer / inline-size;
	padding-bottom: 34px;
}

.participer--createur,
.porte--createur,
.rang__lien--createur {
	--fort: var(--dm-ambre);
	--sur: var(--dm-encre);
}

.participer--evenement,
.porte--evenement,
.rang__lien--evenement {
	--fort: var(--dm-menthe);
	--sur: var(--dm-encre);
}

.participer--publication,
.porte--publication,
.rang__lien--publication {
	--fort: var(--dm-cyan);
	--sur: var(--dm-encre);
}

.porte--encre,
.rang__lien--encre {
	--fort: var(--dm-encre);
	--sur: var(--dm-blanc);
}

/* 1. L'entrée : qui êtes-vous ?
   -------------------------------------------------------------------------- */

.portes + .portes {
	margin-top: 30px;
}

.portes__titre {
	margin: 0 0 12px;
	font-family: var(--dm-police-texte);
	font-size: 1.02rem;
	font-weight: 600;
}

.portes__liste {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* La bulle et le fond de la tuile sont un même disque : il grandit. */
.porte {
	--centre-x: 45px;
	--centre-y: 50%;
	--disque: 27px;

	position: relative;
	isolation: isolate;
	display: grid;
	align-content: center;
	min-height: 94px;
	padding: 16px 62px 16px 90px;
	overflow: hidden;
	border-radius: var(--dm-rayon);
	background: var(--dm-blanc);
	transition: color 0.3s ease;
}

.porte::before {
	content: "";
	position: absolute;
	z-index: -1;
	inset: 0;
	background: var(--fort);
	clip-path: circle(var(--disque) at var(--centre-x) var(--centre-y));
	transition: clip-path 0.55s var(--dm-courbe);
}

.porte__icone {
	position: absolute;
	top: calc(50% - 27px);
	left: 18px;
	display: grid;
	place-items: center;
	width: 54px;
	height: 54px;
	color: var(--sur);
}

.porte__nom {
	margin: 0 0 2px;
	font-size: 1.22rem;
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.porte__nom a {
	text-decoration: none;
}

.porte__nom a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.porte__nom a:focus-visible {
	outline: 0;
}

.porte:has(a:focus-visible) {
	outline: 3px solid var(--dm-encre);
	outline-offset: 3px;
}

.porte__info {
	margin: 0;
	color: var(--dm-gris);
	font-size: 0.97rem;
	line-height: 1.4;
	transition: color 0.3s ease;
}

.porte__fleche {
	position: absolute;
	top: calc(50% - 18px);
	right: 16px;
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--dm-fond);
	color: var(--dm-encre);
	transition: background-color 0.3s ease, transform 0.25s var(--dm-courbe);
}

@container participer (min-width: 50rem) {
	.portes__liste {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: var(--dm-ecart);
	}

	.porte {
		--centre-x: 56px;
		--centre-y: 58px;
		--disque: 34px;

		align-content: end;
		min-height: 252px;
		padding: 112px 22px 24px;
	}

	.porte__icone {
		top: 24px;
		left: 22px;
		width: 68px;
		height: 68px;
	}

	.porte__icone svg {
		width: 29px;
		height: 29px;
	}

	.porte__nom {
		margin-bottom: 5px;
		font-size: clamp(1.28rem, 2.5cqi, 1.62rem);
	}

	.porte__info {
		padding-right: 46px;
	}

	.porte__fleche {
		top: auto;
		right: 20px;
		bottom: 22px;
	}
}

@media (hover: hover) {
	.porte:hover {
		color: var(--sur);
	}

	.porte:hover::before {
		clip-path: circle(150% at var(--centre-x) var(--centre-y));
	}

	.porte:hover .porte__info {
		color: inherit;
	}

	.porte:hover .porte__fleche {
		background: var(--dm-blanc);
		transform: scale(1.14);
	}
}

.participer__mail {
	margin: 28px 0 0;
}

/* 2. Le formulaire
   -------------------------------------------------------------------------- */

.rang {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 24px;
	margin: 4px 0 var(--dm-ecart);
}

.rang__retour {
	font-family: var(--dm-police-titres);
	font-size: 1.2rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	text-decoration: none;
}

.rang__retour:hover .fleche--retour {
	transform: translateX(-4px);
}

.rang__liste {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rang__lien {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	min-height: 40px;
	padding: 0 16px 0 13px;
	border-radius: var(--dm-capsule);
	background: var(--dm-blanc);
	font-size: 0.92rem;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.rang__lien::before {
	content: "";
	width: 11px;
	height: 11px;
	border-radius: 50%;
	background: var(--fort);
}

.rang__lien[aria-current] {
	background: var(--fort);
	color: var(--sur);
}

.rang__lien[aria-current]::before {
	background: var(--sur);
}

@media (hover: hover) {
	.rang__lien:not([aria-current]):hover {
		background: var(--fort);
		color: var(--sur);
	}

	.rang__lien:not([aria-current]):hover::before {
		background: var(--sur);
	}
}

@media (max-width: 47.99rem) {
	.rang__liste {
		flex-wrap: nowrap;
		width: calc(100% + var(--cadre-gauche) + var(--cadre-droite));
		margin-inline: calc(-1 * var(--cadre-gauche)) calc(-1 * var(--cadre-droite));
		padding: 2px var(--cadre-droite) 2px var(--cadre-gauche);
		overflow-x: auto;
		scrollbar-width: none;
	}

	.rang__lien {
		min-height: 44px;
	}
}

.participer__carte {
	display: grid;
	gap: var(--dm-ecart);
	align-items: start;
}

@container participer (min-width: 56rem) {
	.participer__carte {
		grid-template-columns: minmax(0, 1fr) clamp(250px, 30cqi, 330px);
	}
}

.parcours,
.merci {
	--bulle: 46px; /* La ligne descend du milieu de la bulle. */
	--retrait: 60px;

	padding: 22px 18px 28px 14px;
	border-radius: var(--dm-rayon);
	background: var(--dm-blanc);
}

.parcours__tete {
	position: relative;
	display: grid;
	grid-template-columns: var(--bulle) minmax(0, 1fr);
	gap: 8px calc(var(--retrait) - var(--bulle));
	padding-bottom: 30px;
}

.parcours__bulle {
	display: grid;
	grid-row: span 2;
	place-items: center;
	align-self: start;
	width: var(--bulle);
	height: var(--bulle);
	border-radius: 50%;
	background: var(--fort);
	color: var(--sur);
}

.parcours__titre {
	margin: 0;
	padding-top: 0.06em;
	font-size: clamp(1.8rem, 5.4cqi, 3.3rem);
	font-weight: 800;
	line-height: 1.02;
	letter-spacing: -0.035em;
}

.parcours__intro {
	max-width: 36rem;
	margin: 0;
	font-size: 1.08rem;
	line-height: 1.5;
}

@container participer (min-width: 40rem) {
	.parcours,
	.merci {
		--bulle: 76px;
		--retrait: 104px;

		padding: 34px clamp(26px, 4.4cqi, 52px) 40px clamp(22px, 3.2cqi, 36px);
	}

	.parcours__bulle svg {
		width: 32px;
		height: 32px;
	}

	.parcours__titre {
		padding-top: 0.14em;
	}
}

/* La ligne et ses anneaux */
.etape {
	position: relative;
	padding: 0 0 36px var(--retrait);
}

.parcours__tete::after,
.etape::after {
	content: "";
	position: absolute;
	top: 11px;
	bottom: -11px;
	left: calc(var(--bulle) / 2 - 1px);
	width: 2px;
	background: #cfc8bb;
	transition: background-color 0.4s ease;
}

.parcours__tete::after {
	top: var(--bulle);
	background: var(--dm-encre);
}

.etape::before {
	content: "";
	position: absolute;
	z-index: 1;
	top: 2px;
	left: calc(var(--bulle) / 2 - 10px);
	width: 20px;
	height: 20px;
	border: 2px solid var(--dm-encre);
	border-radius: 50%;
	background: var(--dm-blanc);
	transition: background-color 0.3s ease;
}

.etape--faite::before {
	background: var(--fort);
}

.etape--faite::after {
	background: var(--dm-encre);
}

.etape--envoi {
	padding-bottom: 0;
}

.etape--envoi::before {
	top: 20px;
}

.etape--envoi::after {
	content: none;
}

.etape[hidden] {
	display: none;
}

.etape__titre {
	margin: 0 0 16px;
	font-size: 1.3rem;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

.etape__champs {
	display: grid;
	gap: 20px 16px;
}

@container participer (min-width: 34rem) {
	.etape__champs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Les champs */
.champ {
	grid-column: 1 / -1;
	min-width: 0;
	margin: 0;
}

@container participer (min-width: 34rem) {
	.champ--moitie {
		grid-column: auto;
	}
}

.champ[hidden],
.champ--piege {
	display: none;
}

.champ__nom {
	display: block;
	margin: 0 0 6px;
	font-size: 0.97rem;
	font-weight: 600;
	line-height: 1.35;
}

.champ__option {
	margin-left: 3px;
	color: var(--dm-gris);
	font-size: 0.86rem;
	font-weight: 400;
}

.champ input:not([type="radio"], [type="checkbox"]),
.champ textarea {
	display: block;
	width: 100%;
	min-height: 50px;
	padding: 10px 14px;
	border: 1.5px solid var(--trait);
	border-radius: var(--dm-capsule);
	background: var(--dm-blanc);
	color: var(--dm-encre);
	font: inherit;
	font-size: 1rem;
	line-height: 1.5;
	transition: border-color 0.2s ease;
}

.champ textarea {
	min-height: 0;
	resize: vertical;
}

.champ input::placeholder {
	color: var(--dm-gris);
	opacity: 0.85;
}

.champ input:hover,
.champ textarea:hover {
	border-color: var(--dm-encre);
}

.champ input:focus-visible,
.champ textarea:focus-visible {
	border-color: var(--dm-encre);
	outline-offset: 1px;
}

.champ__aide {
	display: flex;
	justify-content: space-between;
	gap: 18px;
	margin: 6px 0 0;
	color: var(--dm-gris);
	font-size: 0.87rem;
	line-height: 1.4;
}

.champ__compte {
	flex: none;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.champ__erreur {
	margin: 6px 0 0;
	color: #a1260d;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.4;
}

.champ__erreur[hidden] {
	display: none;
}

.champ--faux input:not([type="radio"], [type="checkbox"]),
.champ--faux textarea {
	border-color: #a1260d;
}

/* Les choix : un anneau pour un seul, une case pour plusieurs */
.champ__choix {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.option {
	position: relative;
	display: inline-flex;
	max-width: 100%;
}

.option input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.option label {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 46px;
	padding: 6px 17px 6px 14px;
	border: 1.5px solid var(--trait);
	border-radius: var(--dm-capsule);
	font-size: 0.97rem;
	font-weight: 600;
	line-height: 1.25;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.option label::before {
	content: "";
	flex: none;
	width: 14px;
	height: 14px;
	border: 2px solid currentColor;
	border-radius: 50%;
}

.option input[type="checkbox"] + label::before {
	border-radius: 4px;
}

.option input:hover + label {
	border-color: var(--dm-encre);
}

.option input:focus-visible + label {
	outline: 3px solid var(--dm-encre);
	outline-offset: 2px;
}

.option input:checked + label {
	border-color: var(--dm-encre);
	background: var(--fort);
	color: var(--sur);
}

.option input:checked + label::before {
	background: currentColor;
	box-shadow: inset 0 0 0 2px var(--fort);
}

.accord {
	position: relative;
	display: flex;
	gap: 12px;
	font-size: 0.97rem;
	line-height: 1.45;
}

.accord input {
	flex: none;
	width: 22px;
	height: 22px;
	margin: 1px 0 0;
	accent-color: var(--dm-encre);
}

/* L'envoi */
.parcours__envoyer {
	display: inline-flex;
	align-items: center;
	gap: 18px;
	min-height: 60px;
	padding: 8px 8px 8px 24px;
	border: 0;
	border-radius: var(--dm-rayon);
	background: var(--dm-encre);
	color: var(--dm-blanc);
	font: inherit;
	font-size: 1.08rem;
	font-weight: 700;
	line-height: 1.25;
	text-align: left;
	cursor: pointer;
}

.parcours__envoyer-bulle {
	display: grid;
	flex: none;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: var(--fort);
	color: var(--sur);
	transition: transform 0.25s var(--dm-courbe);
}

.participer--encre .parcours__envoyer-bulle {
	background: var(--dm-blanc);
	color: var(--dm-encre);
}

.parcours__envoyer:hover .parcours__envoyer-bulle {
	transform: scale(1.1);
}

.parcours__envoyer[aria-busy="true"] {
	opacity: 0.6;
	cursor: progress;
}

/* La vérification anti-robots : un anneau tourne, puis se remplit. */
.parcours__robot {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 16px 0 0;
	font-size: 0.9rem;
	line-height: 1.4;
}

.parcours__robot[hidden] {
	display: none;
}

.parcours__robot-anneau {
	flex: none;
	width: 16px;
	height: 16px;
	border: 2px solid var(--dm-encre);
	border-top-color: transparent;
	border-radius: 50%;
	animation: tourne 0.9s linear infinite;
}

.parcours__robot--fait .parcours__robot-anneau {
	border-color: var(--dm-encre);
	background: var(--fort);
	animation: none;
}

@keyframes tourne {
	to {
		transform: rotate(1turn);
	}
}

.parcours__erreur {
	margin-top: 14px;
}

.adresse {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.15em;
	cursor: pointer;
}

.parcours__note {
	max-width: 34rem;
	margin: 16px 0 0;
	color: var(--dm-gris);
	font-size: 0.87rem;
	line-height: 1.45;
}

/* Et après ? */
.apres {
	padding: 24px 22px;
	border-radius: var(--dm-rayon);
	background: color-mix(in srgb, var(--fort) 18%, var(--dm-blanc));
}

.participer--encre .apres {
	background: #e2dcd2;
}

@container participer (min-width: 56rem) {
	.apres {
		position: sticky;
		top: 18px;
	}
}

.apres__titre {
	margin: 0 0 16px;
	font-size: 1.3rem;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.apres__etapes {
	margin: 0;
	padding: 0;
	list-style: none;
}

.apres__etapes li {
	position: relative;
	padding: 0 0 18px 30px;
	font-size: 0.97rem;
	line-height: 1.45;
}

.apres__etapes strong {
	display: block;
	line-height: 1.3;
}

.apres__etapes li::before,
.apres__etapes li:not(:last-child)::after {
	content: "";
	position: absolute;
}

.apres__etapes li::before {
	top: 3px;
	left: 0;
	width: 14px;
	height: 14px;
	border: 2px solid var(--dm-encre);
	border-radius: 50%;
	background: var(--dm-blanc);
}

.apres__etapes li:not(:last-child)::after {
	top: 17px;
	bottom: -3px;
	left: 6px;
	width: 2px;
	background: var(--dm-encre);
}

.apres__note-titre {
	margin: 8px 0 4px;
	padding-top: 18px;
	border-top: 1px solid rgb(51 51 51 / 0.22);
	font-family: var(--dm-police-texte);
	font-size: 0.97rem;
	font-weight: 700;
}

.apres__note,
.apres__mail {
	margin: 0;
	font-size: 0.93rem;
	line-height: 1.5;
}

.apres__mail {
	margin-top: 16px;
	overflow-wrap: anywhere;
}

/* Merci */
.merci {
	display: grid;
	gap: 14px;
	align-content: center;
	min-height: 60vh;
}

.merci__liens {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 10px 0 0;
}

.parcours__titre:focus {
	outline: 0;
}

@media (prefers-reduced-motion: reduce) {
	.porte,
	.porte::before,
	.porte__fleche,
	.etape::before,
	.etape::after {
		transition: none;
	}

	.parcours__robot-anneau {
		animation: none;
	}
}
