/*
 * PICMAN : pages hors gabarit (docs/UI.md, fiche 10.11) — connexion, re-saisie du mot de passe,
 * démarrage de l'application installée, hors ligne et erreurs. Jetons de picman-tokens.css. La connexion charge aussi les
 * feuilles du gabarit (head.xhtml) ; le démarrage et les pages statiques (hors-ligne.html,
 * erreur-404.html, erreur-500.html) ne chargent que les jetons, le socle et cette feuille.
 */

.system {
	min-height: 100vh;
	min-height: 100dvh;
	margin: 0;
	background: var(--ground);
	color: var(--ink);
}

/* Le ciel de la connexion, identique en clair et en sombre à un ton près */
.system--hero {
	background:
		radial-gradient(70% 55% at 85% 105%, var(--hero-halo), transparent 70%),
		linear-gradient(160deg, var(--hero-a) 0%, var(--hero-b) 58%, var(--hero-c) 100%);
	background-color: var(--hero-b);
	color: var(--hero-text);
}

/* Le bleu nuit du démarrage : celui de l'écran du système (manifeste) et de la barre latérale */
.system--launch {
	background: var(--side-bg);
	color: var(--side-active-ink);
}

.sys-icon {
	flex: none;
	width: 1.125rem;
	height: 1.125rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---------- Connexion (login.xhtml) et re-saisie du mot de passe (unlock.xhtml) ---------- */

/* Tout tient dans l'écran d'un téléphone, sans défiler : logo, formulaire, aide repliée */
.login {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	min-height: 100vh;
	min-height: 100dvh;
	padding:
		max(1rem, env(safe-area-inset-top, 0px))
		max(1rem, env(safe-area-inset-right, 0px))
		max(1rem, env(safe-area-inset-bottom, 0px))
		max(1rem, env(safe-area-inset-left, 0px));
	box-sizing: border-box;
}

.login [hidden] {
	display: none;
}

.login__logo {
	width: 8.5rem;
	height: auto;
}

.login__card {
	display: grid;
	gap: 0.875rem;
	width: 100%;
	max-width: 25rem;
	padding: 1.125rem 1.125rem 0.375rem;
	box-sizing: border-box;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--paper);
	color: var(--ink);
	box-shadow: var(--shadow-float);
}

.login__notices {
	display: grid;
	gap: 0.5rem;
}

.login__notices:empty {
	display: none;
}

.login__notice {
	display: flex;
	align-items: flex-start;
	gap: 0.625rem;
	margin: 0;
	padding: 0.625rem 0.75rem;
	border: 1px solid var(--blue-line);
	border-left: 4px solid var(--blue);
	border-radius: var(--radius-sm);
	background: var(--blue-mist);
	font-size: 0.875rem;
	line-height: 1.45;
}

.login__notice .icon {
	width: 1.125rem;
	height: 1.125rem;
	margin-top: 0.0625rem;
	color: var(--blue);
}

/* Le mot de passe à allonger avant d'entrer dans l'espace administratif */
.login__notice--warn {
	border-color: var(--amber-soft);
	border-left-color: var(--amber);
	background: var(--amber-soft);
}

.login__notice--warn .icon {
	color: var(--amber-ink);
}

.login__title,
.login__who-title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 740;
	letter-spacing: -0.02em;
}

/* Re-saisie du mot de passe (unlock.xhtml) : qui est reconnu, et ce que le mot de passe ouvre */
.login__who {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-width: 0;
}

.login__who .avatar {
	width: 2.5rem;
	height: 2.5rem;
	font-size: 0.875rem;
}

.login__who-text {
	display: grid;
	gap: 0.125rem;
	min-width: 0;
}

.login__who-title {
	line-height: 1.2;
}

/* Un nom long (« PIZZOLANTE PIRES Mario Raul ») passe à la ligne plutôt que d'être tronqué */
.login__who-meta {
	margin: 0;
	color: var(--muted);
	font-size: 0.8125rem;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.login__form {
	display: grid;
	gap: 0.875rem;
}

.login__keywrap:empty {
	display: none;
}

.login__field {
	display: grid;
	gap: 0.3125rem;
	min-width: 0;
}

body .login .login__label {
	color: var(--ink);
	font-size: 0.84375rem;
	font-weight: 640;
}

.login .login__ac {
	display: block;
	width: 100%;
}

body .login .login__input {
	width: 100%;
	height: 3rem;
	padding: 0 0.875rem;
	box-sizing: border-box;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	background: var(--field-bg);
	color: var(--ink);
	font: inherit;
	font-size: 1rem;
	transition: border-color 200ms, box-shadow 200ms;
}

body .login .login__input::placeholder {
	color: var(--muted);
}

body .login .login__input:focus {
	outline: none;
	border-color: var(--blue);
	box-shadow: var(--focus-ring);
}

body .login .login__input[aria-invalid="true"] {
	border-color: var(--red);
}

.login__secret {
	position: relative;
}

body .login .login__secret .login__input {
	padding-right: 3.25rem;
}

/* Centré dans le champ, haut de 48 px au téléphone et de 44 px au-delà : il n'en dépasse jamais */
.login__eye {
	position: absolute;
	top: calc(50% - 1.375rem);
	right: 2px;
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--slate);
	cursor: pointer;
}

.login__eye:hover {
	color: var(--blue);
}

.login__eye:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.login__eye .icon {
	width: 1.125rem;
	height: 1.125rem;
}

.login__eye[aria-pressed="true"] .login__eye-show,
.login__eye[aria-pressed="false"] .login__eye-hide {
	display: none;
}

.login__hint {
	margin: 0;
	color: var(--muted);
	font-size: 0.8125rem;
	line-height: 1.45;
}

.login__error {
	display: flex;
	align-items: flex-start;
	gap: 0.4375rem;
	margin: 0;
	color: var(--red);
	font-size: 0.84375rem;
	font-weight: 560;
	line-height: 1.45;
}

.login__error .icon {
	width: 1rem;
	height: 1rem;
	margin-top: 0.125rem;
}

/* « Mot de passe oublié ? », après deux échecs : une ligne à lui sous l'erreur, à la hauteur d'une cible */
.login__forgot {
	display: inline-flex;
	align-items: center;
	justify-self: start;
	min-height: var(--control-h);
	border-radius: var(--radius-xs);
	color: var(--blue);
	font-size: 0.84375rem;
	font-weight: 620;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.login__forgot:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.login__stay {
	display: grid;
	margin-top: -0.25rem;
}

/* Cible de 44 px par le remplissage et non par une hauteur minimale : quand le libellé passe sur deux
   lignes (320 px), l'aide qui remonte de 0,375 rem sous lui ne le chevauche pas */
.login__check {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding-block: 0.6875rem;
	font-size: 0.9375rem;
	font-weight: 620;
	cursor: pointer;
}

.login__check input {
	flex: none;
	width: 1.375rem;
	height: 1.375rem;
	margin: 0;
	accent-color: var(--fill-primary);
	cursor: pointer;
}

.login__stay .login__hint {
	margin-top: -0.375rem;
	padding-left: 2.125rem;
}

.login__office {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	margin: 0;
	padding: 0.5625rem 0.75rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--paper-2);
	color: var(--slate);
	font-size: 0.84375rem;
}

.login__office .icon {
	width: 1rem;
	height: 1rem;
	margin-top: 0.125rem;
	color: var(--muted);
}

body .login .login__go {
	width: 100%;
	min-height: 3.125rem;
	font-size: 1rem;
	font-weight: 680;
}

body .login .login__go.is-busy {
	cursor: progress;
	opacity: 0.85;
}

body .login .login__later {
	width: 100%;
	min-height: 2.75rem;
}

/* La clé personnelle, affichée, se relit en chasse fixe comme dans le mail qui l'envoie */
body .login .login__input--key {
	font-family: var(--font-mono);
	letter-spacing: 0.06em;
}

.login__help {
	padding-top: 0.125rem;
	border-top: 1px solid var(--line);
	font-size: 0.875rem;
}

.login__help summary {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	min-height: 2.75rem;
	border-radius: var(--radius-xs);
	color: var(--blue);
	font-weight: 640;
	list-style: none;
	cursor: pointer;
}

.login__help summary::-webkit-details-marker {
	display: none;
}

.login__help summary:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.login__help summary .icon {
	width: 1rem;
	height: 1rem;
	transition: transform 200ms;
}

.login__help[open] summary .icon {
	transform: rotate(180deg);
}

.login__help dl {
	display: grid;
	gap: 0.625rem;
	margin: 0 0 0.75rem;
}

.login__help dt {
	font-weight: 680;
}

.login__help dd {
	margin: 0.125rem 0 0;
	color: var(--slate);
}

.login__help a,
.login__hint a {
	color: var(--blue);
	font-weight: 620;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.login__help a .icon {
	width: 0.875rem;
	height: 0.875rem;
	margin-left: 0.25rem;
	vertical-align: -0.0625rem;
}

.login__newtab {
	color: var(--muted);
	font-size: 0.8125rem;
}

/* Les sorties sans mot de passe de la re-saisie : l'espace membre, la déconnexion */
.login__exits {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	column-gap: 1rem;
	padding-top: 0.125rem;
	border-top: 1px solid var(--line);
	font-size: 0.875rem;
}

.login__exit {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	min-height: 2.75rem;
	border-radius: var(--radius-xs);
	color: var(--blue);
	font-weight: 640;
	text-decoration: none;
}

.login__exit:hover {
	color: var(--blue);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.login__exit:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.login__exit .icon {
	width: 1rem;
	height: 1rem;
}

.login__exit--quiet {
	color: var(--slate);
	font-weight: 600;
}

.login__foot {
	margin: 0;
	color: var(--hero-muted);
	font-size: 0.8125rem;
	text-align: center;
}

/* Connexion venue du forum : la connexion sans PICMAN et le mot pour l'ancien membre prennent la place du pied */
.login__forum {
	display: grid;
	gap: 0.25rem;
	width: 100%;
	max-width: 25rem;
	line-height: 1.45;
	text-align: left;
}

.login__forum p {
	margin: 0;
}

.login__forum-link {
	display: flex;
	align-items: center;
	min-height: 2.75rem;
	color: var(--hero-text);
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.login__forum-link:focus-visible {
	outline: 2px solid var(--hero-text);
	outline-offset: 2px;
	border-radius: var(--radius-xs);
}

/* La liste des noms : huit au plus, lisibles d'un coup d'œil. En bloc, jamais en flex : le texte et
   la partie tapée (span) seraient deux éléments flexibles, et l'espace entre nom et prénom tombait
   (« DE CACHARDMarc ») */
body .login__suggestions .ui-autocomplete-item {
	display: block;
	padding-block: 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.25rem;
}

body .login__suggestions .ui-autocomplete-moretext,
body .login__suggestions .ui-autocomplete-empty-message {
	color: var(--muted);
	font-size: 0.8125rem;
}

@media screen and (min-width: 640px) {
	.login__logo {
		width: 9rem;
	}

	.login__card {
		padding: 1.5rem 1.5rem 0.5rem;
	}

	body .login .login__input {
		height: 2.75rem;
		font-size: 0.9375rem;
	}

	@media (pointer: coarse) {
		body .login .login__input {
			font-size: 1rem;
		}
	}

	body .login .login__go {
		min-height: 2.875rem;
		font-size: 0.9375rem;
	}

	body .login__suggestions .ui-autocomplete-item {
		padding-block: 0.5625rem;
		font-size: 0.90625rem;
	}
}

/* Écran bas (petit téléphone, portable 1366 × 768 avec ses barres) : le logo se fait plus petit */
@media screen and (max-height: 680px) {
	.login__logo {
		width: 7rem;
	}
}

/* Téléphone en paysage : le formulaire passe avant le logo, réduit à une vignette */
@media screen and (max-height: 480px) {
	.login__logo {
		width: 4.5rem;
	}

	.login {
		gap: 0.5rem;
	}
}

/* Téléphone en paysage : le logo à gauche de la carte, « Se connecter » dans le premier écran ;
   le titre « Connexion » (lecteurs d'écran) cède sa ligne */
@media screen and (orientation: landscape) and (max-height: 500px) {
	.login {
		display: grid;
		grid-template-columns: auto minmax(0, 25rem);
		grid-template-areas: "logo card" "foot card";
		justify-content: center;
		align-items: center;
		column-gap: 2rem;
	}

	.login__logo {
		grid-area: logo;
		align-self: end;
		width: 7.5rem;
	}

	.login__card {
		grid-area: card;
	}

	.login__foot {
		grid-area: foot;
		align-self: start;
		max-width: 12rem;
	}

	.login__title {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

@media screen and (pointer: coarse) {
	body .login__suggestions .ui-autocomplete-item {
		min-height: 2.75rem;
	}
}

/* ---------- Démarrage de l'application installée (launch.xhtml) ---------- */

.launch {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.875rem;
	min-height: 100vh;
	min-height: 100dvh;
	padding: 2rem 1rem;
	box-sizing: border-box;
	text-align: center;
}

.launch__logo {
	width: 12.5rem;
	height: auto;
}

.launch__status {
	min-height: 1.3125rem;
	margin: 0.625rem 0 0;
	color: var(--hero-muted);
	font-size: 0.9375rem;
}

.launch__bar {
	position: relative;
	width: 10.5rem;
	height: 3px;
	overflow: hidden;
	border-radius: 3px;
	background: var(--side-line);
}

.launch__bar::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: -40%;
	width: 40%;
	border-radius: 3px;
	background: var(--side-active-ink);
	animation: launch-slide 1.2s ease-in-out infinite;
}

@keyframes launch-slide {
	from {
		left: -40%;
	}

	to {
		left: 100%;
	}
}

.launch__again {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	margin-top: 0.5rem;
	padding: 0 1rem;
	border: 1px solid var(--hero-line);
	border-radius: var(--radius-sm);
	color: var(--side-active-ink);
	font-weight: 600;
	text-decoration: none;
}

.launch__again:focus-visible {
	outline: 2px solid var(--side-active-ink);
	outline-offset: 2px;
}

/* ---------- Pages système : hors ligne, erreurs ---------- */

.sys {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}

.sys__top {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	padding:
		max(0.875rem, env(safe-area-inset-top, 0px))
		max(1.125rem, env(safe-area-inset-right, 0px))
		0.875rem
		max(1.125rem, env(safe-area-inset-left, 0px));
	color: var(--navy);
	font-weight: 800;
	letter-spacing: 0.04em;
}

.sys__top img {
	width: 1.875rem;
	height: 1.875rem;
}

.sys__main {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	padding:
		0.5rem
		max(1rem, env(safe-area-inset-right, 0px))
		max(2.5rem, env(safe-area-inset-bottom, 0px))
		max(1rem, env(safe-area-inset-left, 0px));
}

.sys__card {
	display: grid;
	gap: 0.875rem;
	width: 100%;
	max-width: 27.5rem;
	padding: 1.625rem 1.375rem;
	box-sizing: border-box;
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: var(--paper);
	box-shadow: var(--shadow-1);
}

.sys__disc {
	display: grid;
	place-items: center;
	width: 3.5rem;
	height: 3.5rem;
	border-radius: 50%;
	background: var(--blue-soft);
	color: var(--blue);
}

.sys__disc .sys-icon {
	width: 1.75rem;
	height: 1.75rem;
	stroke-width: 1.6;
}

.sys__disc--warn {
	background: var(--amber-soft);
	color: var(--amber-ink);
}

.sys__disc--bad {
	background: var(--red-soft);
	color: var(--red);
}

.sys__code {
	justify-self: start;
	color: var(--muted);
	font-size: 0.78125rem;
	font-weight: 650;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.02em;
}

.sys__title {
	margin: 0;
	font-size: 1.375rem;
	font-weight: 740;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.sys__text {
	margin: 0;
	color: var(--slate);
	font-size: 0.9375rem;
	line-height: 1.5;
}

.sys__small {
	margin: 0;
	color: var(--muted);
	font-size: 0.84375rem;
	line-height: 1.5;
}

.sys__stat {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 1.375rem;
	margin: 0;
	font-size: 0.875rem;
	font-weight: 560;
	font-variant-numeric: tabular-nums;
}

.sys__stat .sys-icon {
	width: 1rem;
	height: 1rem;
	color: var(--muted);
}

.sys__stat--ok .sys-icon {
	color: var(--green-deep);
}

.sys__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
}

/* Deux boutons côte à côte s'ils tiennent sur une ligne chacun, l'un sous l'autre sinon */
.sys__btn {
	display: inline-flex;
	flex: 1 1 12rem;
	white-space: nowrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 3rem;
	padding: 0 0.875rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-sm);
	background: var(--paper);
	color: var(--ink);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 200ms, border-color 200ms, color 200ms, transform 200ms;
}

.sys__btn:hover {
	border-color: var(--blue);
	color: var(--blue);
	transform: scale(1.02);
}

.sys__btn:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.sys__btn--primary {
	border-color: var(--fill-primary);
	background: var(--fill-primary);
	color: var(--on-accent);
}

.sys__btn--primary:hover {
	border-color: var(--fill-primary-hover);
	background: var(--fill-primary-hover);
	color: var(--on-accent);
}

@media screen and (min-width: 640px) {
	.sys__card {
		max-width: 30rem;
		padding: 2.125rem 2.125rem 1.875rem;
	}

	.sys__btn {
		flex: 0 0 auto;
		min-height: 2.625rem;
	}
}

@media screen and (min-width: 640px) and (pointer: coarse) {
	.sys__btn {
		min-height: 2.75rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.launch__bar::after {
		left: 30%;
		animation: none;
	}

	body .login .login__input,
	.login__help summary .icon,
	.sys__btn {
		transition: none;
	}

	.sys__btn:hover {
		transform: none;
	}
}
