/**
 * Flore — Mots fléchés, mots casés et mots croisés des fleurs. Version 1.13.0.
 *
 * La taille des cases suit la largeur de la grille (requêtes de conteneur) : on ne
 * fixe rien en pixels sinon le plafond d'une case. Aucune couleur n'est écrite deux
 * fois : les teintes jour, sépia et nuit ne redéfinissent que les variables.
 */

/* Deux pigments seulement, lus dans l'habillage : --flore-violet et --flore-orange. Tout le
   reste s'en déduit, si bien que les chartes « Herbier » et « Atelier » repeignent la grille
   sans une ligne de plus ici. */
.flore-mots {
	--fm-violet: var(--flore-violet, #7b5aa6);
	--fm-accent: var(--flore-orange, #935516);
	--fm-pale: var(--flore-violet-pale, #d6c9e6);
	--fm-fond: #ffffff;
	--fm-case: #fffdf8;
	--fm-encre: var(--contrast, #2e2838);
	--fm-faux: #b3261e;
	--fm-trait: color-mix(in srgb, var(--fm-violet) 82%, #000000);
	--fm-def-fond: color-mix(in srgb, var(--fm-violet) 14%, var(--fm-fond));
	--fm-def-texte: color-mix(in srgb, var(--fm-violet) 50%, #000000);
	--fm-def-actif: color-mix(in srgb, var(--fm-violet) 30%, var(--fm-fond));
	--fm-mot: color-mix(in srgb, var(--fm-accent) 14%, var(--fm-fond));
	--fm-cur: color-mix(in srgb, var(--fm-accent) 32%, var(--fm-fond));
	--fm-barre: color-mix(in srgb, var(--fm-accent) 6%, var(--fm-fond));
}

html.flore-sepia .flore-mots {
	--fm-fond: #f6eee0;
	--fm-case: #f8f2e7;
}

html.flore-nuit .flore-mots {
	--fm-violet: #cbb6e6;
	--fm-accent: #db9f62;
	--fm-pale: #4b4457;
	--fm-fond: #1c1f21;
	--fm-case: #1d2023;
	--fm-encre: #eceff2;
	--fm-faux: #ff8f85;
	--fm-trait: color-mix(in srgb, var(--fm-violet) 62%, var(--fm-fond));
	--fm-def-fond: color-mix(in srgb, var(--fm-violet) 16%, var(--fm-fond));
	--fm-def-texte: color-mix(in srgb, var(--fm-violet) 70%, #ffffff);
	--fm-def-actif: color-mix(in srgb, var(--fm-violet) 34%, var(--fm-fond));
	--fm-mot: color-mix(in srgb, var(--fm-accent) 20%, var(--fm-fond));
	--fm-cur: color-mix(in srgb, var(--fm-accent) 42%, var(--fm-fond));
}

/* Les chartes de rechange donnent leurs propres pigments de nuit : on les reprend. */
html.flore-th-herbier.flore-nuit .flore-mots,
html.flore-th-atelier.flore-nuit .flore-mots {
	--fm-violet: var(--flore-violet, #cbb6e6);
	--fm-accent: var(--flore-orange, #db9f62);
	--fm-pale: var(--flore-violet-pale, #4b4457);
}

html.flore-contraste:not(.flore-nuit) .flore-mots {
	--fm-trait: #1f1a26;
	--fm-def-texte: #000000;
	--fm-encre: #000000;
}

/* --- le choix des grilles --------------------------------------------------------------- */

.flore-mots__nav {
	margin: 1rem 0 1.75rem;
}

.flore-mots__nav-titre {
	margin: 0 0 .35rem;
	font-size: .85rem;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--contrast-2, #5c5266);
}

.flore-mots__choix {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: .45rem;
}

.flore-mots__choix li {
	margin: 0;
}

.flore-mots .flore-mots__choix a {
	display: inline-flex;
	align-items: baseline;
	gap: .35rem;
	padding: .3rem .75rem;
	border: 1px solid var(--fm-pale);
	border-radius: 999px;
	color: inherit;
	text-decoration: none;
	box-shadow: none;
	font-size: .92rem;
	line-height: 1.3;
}

.flore-mots .flore-mots__choix a:hover,
.flore-mots .flore-mots__choix a:focus-visible {
	border-color: var(--fm-accent);
}

.flore-mots .flore-mots__choix a[aria-current="true"] {
	background: var(--fm-violet);
	border-color: var(--fm-violet);
	color: #fff;
}

html.flore-nuit .flore-mots .flore-mots__choix a[aria-current="true"] {
	color: #1b1622;
}

.flore-mots__choix-n {
	font-weight: 700;
}

.flore-mots__autre {
	margin: .6rem 0 0;
	font-size: .92rem;
}

.flore-mots__grille {
	margin: 0 0 2.5rem;
}

.flore-mots__accroche {
	margin-top: -.25rem;
	color: var(--contrast-2, #5c5266);
}

/* --- la grille ---------------------------------------------------------------------------- */

/* Le conteneur a exactement la largeur de la grille : les unités cqi mesurent donc la
   grille, et le passage aux numéros se décide sur sa taille réelle. */
.fm-plateau {
	--fm-w: 10;
	container-type: inline-size;
	box-sizing: border-box;
	width: 100%;
	max-width: calc(var(--fm-w) * 76px + 5px);
	margin: .5rem auto .75rem;
}

.fm-plateau--cases {
	max-width: calc(var(--fm-w) * 46px + 4px);
}

.fm-grille {
	display: grid;
	grid-template-columns: repeat(var(--fm-w), 1fr);
	gap: 1px;
	box-sizing: border-box;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 2px solid var(--fm-trait);
	background: var(--fm-trait);
	color: var(--fm-encre);
	-webkit-print-color-adjust: exact;
	print-color-adjust: exact;
}

.fm-c8 { --fm-w: 8; }
.fm-c9 { --fm-w: 9; }
.fm-c10 { --fm-w: 10; }
.fm-c11 { --fm-w: 11; }
.fm-c12 { --fm-w: 12; }
.fm-c13 { --fm-w: 13; }
.fm-c14 { --fm-w: 14; }
.fm-c15 { --fm-w: 15; }

.fm-grille > div {
	position: relative;
	aspect-ratio: 1 / 1;
	min-width: 0;
	overflow: hidden;
}

.fm-l {
	background: var(--fm-case);
}

.fm-grille--solution .fm-l,
.fm-donne:not(:has(input)) {
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: calc(100cqi / var(--fm-w) * .46);
	line-height: 1;
}

/* Mots casés : des mots entrecroisés sur le papier, sans fond de grille. */
.fm-grille--cases {
	gap: 1px;
	padding: 1px;
	border: 0;
	background: transparent;
}

.fm-grille--cases .fm-l {
	box-shadow: 0 0 0 1px var(--fm-trait);
	overflow: visible;
}

.fm-vide {
	background: transparent;
}

/* Mots croisés : cases noires, numéros de colonnes au-dessus et de lignes à gauche, dans deux
   bandes posées hors de la grille et alignées sur elle (même bordure, même écart). */
.fm-plateau--croises {
	max-width: calc(var(--fm-w) * 52px + 2.2rem);
}

.fm-croix {
	display: grid;
	grid-template-columns: 1.7rem 1fr;
	grid-template-rows: auto 1fr;
}

.fm-croix .fm-grille {
	grid-column: 2;
	grid-row: 2;
}

.fm-etiq {
	display: grid;
	color: var(--contrast-2, #5c5266);
	font-size: .78rem;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.fm-etiq--cols {
	grid-column: 2;
	grid-row: 1;
	grid-template-columns: repeat(var(--fm-w), 1fr);
	gap: 1px;
	padding: 0 2px .3rem;
	text-align: center;
}

.fm-etiq--ligs {
	grid-column: 1;
	grid-row: 2;
	grid-template-rows: repeat(var(--fm-h), 1fr);
	gap: 1px;
	padding: 2px .35rem 2px 0;
	text-align: right;
}

.fm-etiq--ligs span {
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

.fm-noire {
	background: var(--fm-trait);
}

.fm-grille--croises.fm-grille--solution .fm-l {
	font-size: calc(100cqi / var(--fm-w) * .44);
}

.fm-defs--croises .fm-defs__liste {
	columns: auto;
}

.fm-defs--croises .fm-defs__liste li {
	cursor: default;
}

.fm-defs--croises .fm-defs__n {
	min-width: 2.2em;
	margin-right: .15rem;
}

.fm-cd {
	padding: 0 .15rem;
	border-radius: 4px;
	cursor: pointer;
}

.fm-cd.fm-defs-actif {
	background: var(--fm-mot);
}

.fm-cd__sep {
	color: var(--contrast-2, #5c5266);
}

/* --- les cases de définition -------------------------------------------------------------- */

.fm-def {
	display: flex;
	flex-direction: column;
	background: var(--fm-def-fond);
	color: var(--fm-def-texte);
}

.fm-def--0 {
	background: var(--fm-trait);
}

.fm-d {
	flex: 1 1 0;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1px 2px;
	text-align: center;
	font-size: calc(100cqi / var(--fm-w) * .143);
	line-height: 1.08;
	font-weight: 600;
	-webkit-hyphens: auto;
	hyphens: auto;
	overflow-wrap: anywhere;
	overflow: hidden;
	cursor: pointer;
}

.fm-def--2 .fm-d {
	font-size: calc(100cqi / var(--fm-w) * .132);
	line-height: 1.04;
}

.fm-def--2 .fm-d + .fm-d {
	border-top: 1px solid var(--fm-trait);
}

.fm-d.fm-d-actif {
	background: var(--fm-def-actif);
}

.fm-d__n {
	display: none;
	font-weight: 700;
	font-size: calc(100cqi / var(--fm-w) * .3);
}

.fm-def--2 .fm-d__n {
	font-size: calc(100cqi / var(--fm-w) * .24);
}

/* Écran étroit : un numéro dans la case, la définition dans la barre et la liste. */
@container (max-width: 560px) {
	.fm-def {
		position: relative;
	}

	.fm-d__t {
		display: none;
	}

	.fm-d__n {
		display: block;
	}

	/* Deux définitions, un seul numéro : les flèches disent laquelle est laquelle. */
	.fm-def--2 .fm-d + .fm-d {
		border-top: 0;
	}

	.fm-def--2 .fm-d + .fm-d .fm-d__n {
		display: none;
	}

	.fm-def--2 .fm-d:first-child .fm-d__n {
		position: absolute;
		inset: 0;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: calc(100cqi / var(--fm-w) * .3);
		pointer-events: none;
	}
}

/* --- les flèches, dessinées dans la première case du mot ---------------------------------- */

.fm-in-droite::before,
.fm-in-bas-droite::before,
.fm-in-bas::after,
.fm-in-droite-bas::after {
	content: "";
	position: absolute;
	z-index: 2;
	background: var(--fm-trait);
	-webkit-mask: var(--fm-fleche) no-repeat center / contain;
	mask: var(--fm-fleche) no-repeat center / contain;
	pointer-events: none;
}

.fm-in-droite::before {
	--fm-fleche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M0 1.5 7 5 0 8.5z'/%3E%3C/svg%3E");
	left: 0;
	top: 50%;
	width: 17%;
	height: 26%;
	transform: translateY(-50%);
}

.fm-in-bas::after {
	--fm-fleche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 0 5 7 8.5 0z'/%3E%3C/svg%3E");
	top: 0;
	left: 50%;
	width: 26%;
	height: 17%;
	transform: translateX(-50%);
}

.fm-in-droite-bas::after {
	--fm-fleche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M0 1h4.8v5h1.8L4.1 9.5 1.6 6h1.8V2.4H0z'/%3E%3C/svg%3E");
	left: 0;
	top: 0;
	width: 30%;
	height: 30%;
}

.fm-in-bas-droite::before {
	--fm-fleche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 0v4.8h5v1.8l3.5-2.5L6 1.6v1.8H2.4V0z'/%3E%3C/svg%3E");
	left: 0;
	top: 0;
	width: 30%;
	height: 30%;
}

/* --- la saisie ---------------------------------------------------------------------------- */

.flore-mots .fm-saisie {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	box-sizing: border-box;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	outline: 0;
	box-shadow: none;
	background: transparent;
	color: var(--fm-encre);
	caret-color: transparent;
	text-align: center;
	text-transform: uppercase;
	font-family: inherit;
	font-weight: 700;
	font-size: max(16px, calc(100cqi / var(--fm-w) * .5));
	line-height: 1;
	cursor: pointer;
}

.flore-mots .fm-saisie::selection {
	background: transparent;
}

.fm-l.fm-mot {
	background: var(--fm-mot);
}

.fm-l.fm-cur {
	background: var(--fm-cur);
	box-shadow: inset 0 0 0 2px var(--fm-accent);
}

.fm-grille--cases .fm-l.fm-cur {
	box-shadow: 0 0 0 1px var(--fm-trait), inset 0 0 0 2px var(--fm-accent);
}

.fm-faux .fm-saisie {
	color: var(--fm-faux);
	text-decoration: line-through;
	text-decoration-thickness: 2px;
}

.fm-revele .fm-saisie,
.fm-donne .fm-saisie {
	color: var(--fm-violet);
}

.fm-finie .fm-grille:not(.fm-grille--solution) .fm-l {
	background: var(--fm-case);
	box-shadow: none;
}

.fm-finie .fm-grille--cases:not(.fm-grille--solution) .fm-l {
	box-shadow: 0 0 0 1px var(--fm-trait);
}

/* --- barre, outils, fin ------------------------------------------------------------------- */

.fm-barre {
	position: sticky;
	top: 0;
	z-index: 5;
	margin: .5rem 0 0;
	padding: .55rem .8rem;
	min-height: 2.9em;
	border-left: 3px solid var(--fm-accent);
	background: var(--fm-barre);
	font-size: .98rem;
	line-height: 1.35;
}

.fm-barre__n {
	font-weight: 700;
	color: var(--fm-accent);
	white-space: nowrap;
}

.fm-barre__l {
	color: var(--contrast-2, #5c5266);
	white-space: nowrap;
}

.fm-outils {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: .45rem;
	margin: .9rem 0 .4rem;
}

.flore-mots .fm-bouton {
	display: inline-block;
	margin: 0;
	padding: .45rem .9rem;
	border: 1px solid var(--fm-pale);
	border-radius: 999px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: .92rem;
	line-height: 1.2;
	text-decoration: none;
	box-shadow: none;
	cursor: pointer;
}

.flore-mots .fm-bouton:hover,
.flore-mots .fm-bouton:focus-visible {
	border-color: var(--fm-accent);
	color: inherit;
	background: transparent;
}

.flore-mots .fm-bouton--principal {
	background: var(--fm-violet);
	border-color: var(--fm-violet);
	color: #fff;
}

.flore-mots .fm-bouton--principal:hover,
.flore-mots .fm-bouton--principal:focus-visible {
	background: var(--fm-violet);
	color: #fff;
}

html.flore-nuit .flore-mots .fm-bouton--principal,
html.flore-nuit .flore-mots .fm-bouton--principal:hover {
	color: #1b1622;
}

.flore-mots .fm-bouton--confirmer {
	border-color: var(--fm-faux);
	color: var(--fm-faux);
}

.fm-etat {
	min-height: 1.4em;
	margin: .3rem 0 .6rem;
	text-align: center;
	font-size: .95rem;
}

.fm-fin {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: .6rem;
	margin: .4rem 0 1.2rem;
	padding: .8rem;
	border: 1px solid var(--fm-pale);
	border-radius: 14px;
}

.fm-fin[hidden] {
	display: none;
}

.fm-fin__titre {
	flex-basis: 100%;
	margin: 0;
	text-align: center;
	font-weight: 700;
	color: var(--fm-accent);
}

/* --- la liste des définitions et le casier ------------------------------------------------ */

.fm-defs__titre,
.fm-casier__titre,
.fm-theme__titre {
	margin: 1.2rem 0 .5rem;
	font-size: 1.05rem;
}

.fm-defs__liste {
	margin: 0;
	padding: 0;
	list-style: none;
	columns: 2 15rem;
	column-gap: 1.5rem;
	font-size: .92rem;
	line-height: 1.35;
}

.fm-defs__liste li {
	margin: 0 0 .25rem;
	break-inside: avoid;
	padding: .05rem .25rem;
	border-radius: 4px;
	cursor: pointer;
}

.fm-defs__liste li.fm-defs-actif {
	background: var(--fm-mot);
}

.fm-defs__n {
	display: inline-block;
	min-width: 1.4em;
	font-weight: 700;
	text-align: right;
}

.fm-defs__f {
	color: var(--fm-accent);
	font-weight: 700;
}

.fm-defs__l {
	color: var(--contrast-3, #7a7084);
	white-space: nowrap;
}

.fm-casier__groupe {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: .2rem .9rem;
	margin: 0 0 .45rem;
}

.fm-casier__long {
	flex: 0 0 5.5rem;
	margin: 0;
	font-size: .85rem;
	color: var(--contrast-2, #5c5266);
}

.fm-casier__mots {
	flex: 1 1 12rem;
	display: flex;
	flex-wrap: wrap;
	gap: .15rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.fm-casier__mots li {
	margin: 0;
	font-weight: 600;
	letter-spacing: .06em;
}

.fm-casier__mots li.fm-place {
	color: var(--contrast-3, #8a8094);
	text-decoration: line-through;
	text-decoration-color: var(--fm-accent);
	text-decoration-thickness: 2px;
	font-weight: 400;
}

.fm-casier__note {
	font-size: .9rem;
	color: var(--contrast-2, #5c5266);
}

/* --- la solution ---------------------------------------------------------------------------- */

.fm-solution {
	margin: 1.2rem 0 0;
	padding: .6rem .9rem;
	border: 1px solid var(--fm-pale);
	border-radius: 14px;
}

.fm-solution > summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--fm-violet);
}

.fm-theme {
	margin: .4rem 0 .2rem 1.1rem;
	padding: 0;
}

.fm-theme li {
	margin: 0 0 .2rem;
}

.fm-theme__def {
	color: var(--contrast-2, #5c5266);
}

.fm-theme--noms {
	display: flex;
	flex-wrap: wrap;
	gap: .2rem 1.1rem;
	margin: .8rem 0 .2rem;
	list-style: none;
}

/* --- sans JavaScript, et avec ------------------------------------------------------------ */

.flore-mots--actif .flore-mots__sansjs {
	display: none;
}

.flore-mots--actif .fm-l {
	cursor: pointer;
}

.flore-mots__grille[hidden] {
	display: none;
}

/* --- impression ------------------------------------------------------------------------------ */

@media print {
	.flore-mots__nav,
	.fm-barre,
	.fm-outils,
	.fm-etat,
	.fm-fin,
	.fm-solution,
	.fm-donnees,
	.flore-mots > h2,
	.flore-mots > p {
		display: none !important;
	}

	.flore-mots .fm-l,
	.flore-mots .fm-l.fm-mot,
	.flore-mots .fm-l.fm-cur {
		background: #fff;
		box-shadow: none;
	}

	.flore-mots .fm-grille--cases .fm-l {
		box-shadow: 0 0 0 1px #000;
	}

	.flore-mots .fm-defs {
		display: none;
	}

	/* Les mots croisés n'ont leurs définitions que sous la grille : on les imprime. */
	.flore-mots .fm-defs--croises {
		display: block;
		font-size: 10pt;
	}

	.flore-mots .fm-defs--croises .fm-defs__l {
		display: none;
	}

	.flore-mots .fm-plateau {
		max-width: 17cm;
		break-inside: avoid;
	}

	.flore-mots .fm-plateau--cases {
		max-width: 15cm;
	}

	.fm-saisie {
		color: #000 !important;
	}
}
