/*
 * Motifs apériodiques — charte graphique de Design Luminy.
 *
 * Couleurs : variables du thème DesignLuminy (--color-*), modifiables dans
 * le Customizer ; les valeurs après la virgule sont ses valeurs par défaut.
 * Typographie : General Sans ; tailles, graisses, capitales et interlettrage
 * repris des rôles du thème (widget 14 px, méta 12 px, boutons 12 px 600).
 * Angles vifs partout, comme sur le thème.
 */

.ma-app {
	--ma-encre: var(--color-text, #1a1a1a);
	--ma-discret: var(--color-muted, #767676);
	--ma-accent: var(--color-accent, #B89A45);
	--ma-lien: var(--color-link, #1a1a1a);
	--ma-lien-survol: var(--color-link-hover, #B89A45);
	--ma-papier: var(--color-bg, #ffffff);
	--ma-fond-image: #f0f0f0;
	--ma-filet: color-mix(in srgb, var(--ma-discret) 30%, transparent);
	--ma-voile: rgba(26, 26, 26, 0.55);
	--ma-police: 'General Sans', system-ui, -apple-system, Arial, sans-serif;

	color: var(--ma-encre);
	font-family: var(--ma-police);
	font-size: 14px;
	font-weight: 400;
	line-height: 1.45;
	margin: 1.25em 0;
	max-width: 100%;
	-webkit-font-smoothing: antialiased;
}

.ma-app *,
.ma-app *::before,
.ma-app *::after {
	box-sizing: border-box;
}

.ma-app [hidden] {
	display: none !important;
}

.ma-app input,
.ma-app select,
.ma-app button,
.ma-app output {
	font-family: var(--ma-police);
}

.ma-grille {
	display: grid;
	grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
	gap: 20px;
	align-items: start;
}

/* ---------- Panneau de réglages ---------- */

.ma-panneau {
	background: var(--ma-papier);
	border-top: 1px solid var(--ma-encre);
}

.ma-groupe {
	border: 0;
	border-bottom: 1px solid var(--ma-filet);
	margin: 0;
	padding: 14px 0 16px;
	min-width: 0;
}

/* Titres de groupe : rôle « méta » du thème (capitales, interlettrage 0,06em). */
.ma-groupe legend {
	float: left;
	width: 100%;
	padding: 0;
	margin: 0 0 10px;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--ma-discret);
}

.ma-groupe legend + * {
	clear: both;
}

.ma-ligne {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 8px;
}

.ma-ligne label {
	flex: 0 0 auto;
	min-width: 5.5em;
}

.ma-app input[type="range"],
.ma-app input[type="checkbox"],
.ma-app progress {
	accent-color: var(--ma-accent);
}

.ma-ligne input[type="range"] {
	flex: 1 1 auto;
	min-width: 0;
}

.ma-ligne output {
	flex: 0 0 4.5em;
	text-align: right;
	font-variant-numeric: tabular-nums;
	color: var(--ma-discret);
}

/* Champs : filet inférieur seul, comme la recherche de l'en-tête du thème. */
.ma-app input[type="number"],
.ma-app select {
	appearance: none;
	border: 0;
	border-bottom: 1px solid var(--ma-discret);
	border-radius: 0;
	background-color: transparent;
	box-shadow: none;
	color: var(--ma-encre);
	font-size: 14px;
	line-height: 1.4;
	min-height: 0;
	padding: 4px 0;
	font-variant-numeric: tabular-nums;
}

.ma-app input[type="number"]:focus,
.ma-app select:focus {
	border-bottom-color: var(--ma-accent);
	box-shadow: none;
	outline: none;
}

.ma-app select {
	padding-right: 22px;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(-45deg, transparent 50%, currentColor 50%);
	background-position: calc(100% - 9px) 55%, calc(100% - 4px) 55%;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	cursor: pointer;
}

.ma-ligne input[type="number"] {
	width: 7.5em;
}

.ma-ligne input[type="color"] {
	width: 34px;
	height: 26px;
	padding: 0 2px;
	margin-left: auto;
	border: 1px solid var(--ma-filet);
	border-radius: 0;
	background: var(--ma-papier);
}

.ma-ligne input[type="checkbox"] {
	margin: 0;
}

.ma-ligne input[type="checkbox"] + label {
	min-width: 0;
}

.ma-dimensions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 16px;
}

.ma-dimensions .ma-ligne {
	flex-direction: column;
	align-items: stretch;
	gap: 2px;
}

.ma-dimensions input[type="number"] {
	width: 100%;
}

.ma-panneau select {
	width: 100%;
	max-width: none;
}

.ma-note {
	margin: 8px 0 0;
	font-size: 12px;
	color: var(--ma-discret);
}

.ma-fiche {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 3px 10px;
	margin: 10px 0 0;
	font-size: 12px;
}

.ma-fiche dt {
	color: var(--ma-discret);
}

.ma-fiche dd {
	margin: 0;
}

.ma-chiffres {
	font-variant-numeric: tabular-nums;
}

.ma-boutons {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.ma-export {
	padding: 16px 0 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ma-export progress {
	width: 100%;
	height: 4px;
	appearance: none;
	border: 0;
	border-radius: 0;
	background: var(--ma-fond-image);
}

.ma-export progress::-webkit-progress-bar {
	background: var(--ma-fond-image);
}

.ma-export progress::-webkit-progress-value {
	background: var(--ma-accent);
}

.ma-export progress::-moz-progress-bar {
	background: var(--ma-accent);
}

.ma-export .ma-note {
	margin: 0;
}

/* ---------- Boutons : rôle « boutons » du thème (12 px, 600, capitales, 0,08em) ---------- */

.ma-app .button.ma-bouton,
.ma-app .ma-bouton {
	appearance: none;
	display: inline-block;
	height: auto;
	min-height: 0;
	margin: 0;
	padding: 10px 14px;
	border: 1px solid var(--ma-encre);
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	color: var(--ma-encre);
	font-family: var(--ma-police);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	text-align: center;
	text-shadow: none;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.ma-app .button.ma-bouton:hover:not(:disabled),
.ma-app .ma-bouton:hover:not(:disabled) {
	border-color: var(--ma-accent);
	background: transparent;
	color: var(--ma-accent);
}

.ma-app .button.ma-principal,
.ma-app .ma-principal {
	border-color: var(--ma-encre);
	background: var(--ma-encre);
	color: var(--ma-papier);
}

.ma-app .button.ma-principal:hover:not(:disabled),
.ma-app .ma-principal:hover:not(:disabled) {
	border-color: var(--ma-accent);
	background: var(--ma-accent);
	color: var(--ma-papier);
}

.ma-app .button.ma-bouton:disabled,
.ma-app .ma-bouton:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Liens d'action : même traitement que « Lire la suite » du thème. */
.ma-app .ma-lien {
	align-self: flex-start;
	display: inline-block;
	text-align: left;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var(--ma-accent);
	cursor: pointer;
	font-family: var(--ma-police);
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	text-decoration: none;
}

.ma-app .ma-lien:hover {
	color: var(--ma-accent);
	text-decoration: underline;
}

.ma-app .ma-annuler {
	color: var(--ma-encre);
}

.ma-app button:focus-visible,
.ma-app input:focus-visible,
.ma-app select:focus-visible,
.ma-app canvas:focus-visible {
	outline: 2px solid var(--ma-accent);
	outline-offset: 2px;
}

/* ---------- Scènes ---------- */

.ma-scenes {
	display: grid;
	gap: 16px;
	min-width: 0;
}

.ma-scene {
	margin: 0;
	min-width: 0;
}

.ma-cadre {
	position: relative;
	overflow: hidden;
	background: var(--ma-fond-image);
}

.ma-scene-editeur .ma-cadre {
	height: 320px;
}

.ma-scene-surface .ma-cadre {
	height: min(560px, 70vh);
	min-height: 320px;
}

/* Surface de travail : le gris des vignettes du thème, quadrillé à l'encre. */
.ma-tapis {
	background-image:
		linear-gradient(rgba(26, 26, 26, 0.08) 1px, transparent 1px),
		linear-gradient(90deg, rgba(26, 26, 26, 0.08) 1px, transparent 1px),
		linear-gradient(rgba(26, 26, 26, 0.035) 1px, transparent 1px),
		linear-gradient(90deg, rgba(26, 26, 26, 0.035) 1px, transparent 1px);
	background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
	background-position: -1px -1px;
}

.ma-canvas {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
	touch-action: none;
}

.ma-scene-editeur .ma-canvas {
	cursor: move;
}

.ma-scene-surface .ma-canvas {
	cursor: grab;
}

.ma-scene-surface .ma-canvas:active {
	cursor: grabbing;
}

/* Légendes : rôle « légende » du thème (12 px, italique, texte secondaire). */
.ma-groupe > .ma-lien {
	display: block;
	margin-top: 4px;
}

.ma-scene figcaption {
	margin-top: 6px;
	font-size: 12px;
	font-style: italic;
	color: var(--ma-discret);
}

.ma-barre-scene {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 12px;
}

.ma-barre-scene > span {
	margin-right: auto;
}

.ma-barre-scene input[type="range"] {
	width: 160px;
}

.ma-barre-scene output {
	min-width: 4em;
	text-align: right;
	font-style: normal;
}

.ma-barre-scene .ma-lien {
	font-style: normal;
}

.ma-invisible {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Aide (page d'administration) ---------- */

.ma-aide {
	margin-top: 24px;
	max-width: 70ch;
}

.ma-aide summary {
	cursor: pointer;
	font-weight: 600;
}

/* ---------- Petits écrans ---------- */

@media (max-width: 900px) {
	.ma-grille {
		grid-template-columns: minmax(0, 1fr);
	}

	.ma-scenes {
		order: -1;
	}

	.ma-scene-editeur .ma-cadre {
		height: 260px;
	}

	.ma-scene-surface .ma-cadre {
		height: 60vh;
	}
}

/* ---------- Propre à Motifs apériodiques ---------- */

.ma-app .ma-petit {
	padding: 7px 10px;
}

.ma-bloc-type {
	padding: 0 0 12px;
	margin: 0 0 12px;
	border-bottom: 1px dotted var(--ma-filet);
}

.ma-type {
	margin: 0 0 6px;
	font-weight: 600;
}

.ma-bloc-type select {
	flex: 1 1 auto;
}

.ma-boutons-liens {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	margin: 4px 0 0;
}

.ma-scene-editeur .ma-cadre {
	height: 300px;
}

.ma-barre-scene > span {
	flex: 1 1 16em;
}

.ma-legende {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 18px;
	margin-top: 4px;
	font-size: 12px;
	color: var(--ma-discret);
}

.ma-classe::before {
	content: "";
	display: inline-block;
	width: 18px;
	height: 3px;
	margin-right: 6px;
	vertical-align: middle;
}

.ma-classe::before {
	background: var(--ma-couleur-classe, var(--ma-encre));
}

.ma-reglages-pavage {
	margin-top: 12px;
}

/* Outils du sommet sélectionné : bascule Angle / Courbe */
.ma-outils-sommet {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 10px;
	margin-top: 8px;
}

.ma-outils-titre {
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--ma-discret);
}

.ma-app .ma-bascule {
	appearance: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px 10px;
	border: 1px solid var(--ma-encre);
	border-radius: 0;
	background: transparent;
	color: var(--ma-encre);
	font-family: var(--ma-police);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
}

.ma-app .ma-bascule + .ma-bascule {
	margin-left: -11px; /* boutons accolés */
}

.ma-app .ma-bascule[aria-pressed="true"] {
	background: var(--ma-encre);
	color: var(--ma-papier);
}

.ma-app .ma-bascule:hover {
	border-color: var(--ma-accent);
}

.ma-icone {
	display: inline-block;
	width: 9px;
	height: 9px;
	border: 1.5px solid currentColor;
}

.ma-icone-angle {
	transform: rotate(45deg);
}

.ma-icone-courbe {
	border-radius: 50%;
}

.ma-app .ma-lien:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	text-decoration: none;
}

.ma-info-sommet {
	margin: 0;
}

.ma-export-tuiles {
	display: flex;
	align-items: center;
	gap: 6px 14px;
	padding: 6px 0 2px;
}

/* ---------- Désordre ---------- */

.ma-desordre {
	margin-top: 12px;
}

.ma-avertissement {
	margin: 6px 0 0;
	padding: 8px 10px;
	border-left: 3px solid var(--ma-accent);
	background: var(--ma-fond-image);
	font-size: 12px;
	line-height: 1.45;
	color: var(--ma-encre);
}

.ma-desordonne .ma-scene-editeur .ma-canvas {
	opacity: 0.45;
}

.ma-desordonne .ma-scene-editeur .ma-cadre::after {
	content: "Désordre actif : arêtes droites imposées, l'éditeur est suspendu.";
	position: absolute;
	left: 12px;
	bottom: 10px;
	font-size: 12px;
	font-style: italic;
	color: var(--ma-encre);
}

.ma-desordonne .ma-outils-sommet {
	display: none;
}
