@import url('https://fonts.googleapis.com/css?family=Mukta&display=swap');

@font-face {
	font-family: 'Chelsea Market';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: local("Chelsea Market"), local("ChelseaMarket-Regular"),
		 url("chelsea-market/chelsea-market-v5-latin-regular.woff2") format("woff2"),
		 url("chelsea-market/chelsea-market-v5-latin-regular.woff") format("woff"),
		 url("chelsea-market/chelsea-market-v5-latin-regular.ttf") format("truetype");
}

/* nunito-300 - latin */
@font-face {
	font-family: 'Nunito';
	font-style: normal;
	font-weight: 300;
	font-display: swap;
	src: local("Nunito Light"), local("Nunito-Light"),
		 url("nunito/nunito-v9-latin-300.woff2") format("woff2"),
		 url("nunito/nunito-v9-latin-300.woff") format("woff"),
		 url("nunito/nunito-v9-latin-300.ttf") format("truetype");
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	padding: 17px;
	font-family: "Mukta", sans-serif;
	background: #dadada;
	-webkit-text-size-adjust: 100%;
	-webkit-tap-highlight-color: transparent;
	overscroll-behavior-y: contain;
}

.board {
	width: 100%;
	max-width: 420px;
	margin: 0 auto;
}

/* ------------------------------------------------------------------
   Canvas
   ------------------------------------------------------------------ */

canvas {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;      /* evite le saut de mise en page au chargement */
	background: #ffffff;
	border: 2px solid #9d9d9d;
	cursor: crosshair;

	/* Indispensable sur mobile : sans cela le navigateur interprete le
	   glissement du doigt comme un defilement de la page. */
	touch-action: none;

	/* Empeche la selection et le menu d'appui long pendant le coloriage. */
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

/* ------------------------------------------------------------------
   Outils
   ------------------------------------------------------------------ */

.tools {
	margin-top: 15px;
}

.tools-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}

.color-field {
	height: 44px;
	width: 44px;
	min-height: 44px;
	min-width: 44px;
	padding: 0;
	cursor: pointer;
	border-radius: 50%;
	border: 3px solid #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
	transition: transform .12s ease, border-color .12s ease;
}

.color-field.is-active {
	border-color: #252525;
	transform: scale(1.12);
}

.button {
	min-height: 44px;
	padding: 0 16px;
	cursor: pointer;
	color: #ffffff;
	background: #252525;
	border: 2px solid #ffffff;
	border-radius: 6px;
	font-family: inherit;
	font-weight: bold;
	font-size: 17px;
}

.button-light {
	color: #252525;
	background: #f4f4f4;
	border-color: #9d9d9d;
}

.button-light.is-active {
	color: #ffffff;
	background: #b62263;
	border-color: #b62263;
}

/* Curseur de taille du pinceau */

.pen-size {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
}

.pen-size-label {
	font-size: 16px;
	color: #3d3d3d;
}

.pen-range {
	flex: 1;
	height: 44px;             /* zone tactile confortable */
	accent-color: #b62263;
	background: transparent;
	cursor: pointer;
}

.pen-preview-box {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: #ffffff;
	border: 2px solid #9d9d9d;
	border-radius: 6px;
	flex: 0 0 auto;
}

#pen-preview {
	display: block;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: rgb(231, 149, 41);
	border: 1px solid rgba(0, 0, 0, .2);
}

/* ------------------------------------------------------------------
   Selecteur de dessins
   ------------------------------------------------------------------ */

.picker {
	margin-top: 20px;
	padding-top: 18px;
	border-top: 1px solid #c2c2c2;
}

.picker-title {
	margin: 0 0 12px;
	text-align: center;
	font-family: 'Nunito', sans-serif;
	font-size: 18px;
	font-weight: 600;
	color: #3d3d3d;
}

.drawings {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 8px;
}

.drawing-field {
	position: relative;
	padding: 0;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	cursor: pointer;
	background: #ffffff;
	border: 3px solid #ffffff;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
	transition: transform .12s ease, border-color .12s ease;
	-webkit-tap-highlight-color: transparent;
}

.drawing-field img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	pointer-events: none;   /* le clic va toujours au bouton */
}

.drawing-field.is-active {
	border-color: #b62263;
	transform: scale(1.06);
}

/* Petit voile pendant le chargement d'un dessin */
canvas.is-loading {
	opacity: .45;
	transition: opacity .2s ease;
}

/* ------------------------------------------------------------------
   Textes
   ------------------------------------------------------------------ */

.intro {
	padding: 20px 10px 40px;
}

h1 {
	font-family: 'Chelsea Market', cursive;
	font-size: 44px;
	margin-top: 20px;
	text-align: center;
	color: rgb(61, 61, 61);
}

p {
	font-family: 'Nunito', sans-serif;
	font-size: 20px;
	line-height: 1.5;
}

a {
	text-decoration: none;
	color: rgb(182, 34, 99);
}

@media (max-width: 480px) {
	body { padding: 10px; }
	h1 { font-size: 36px; }
	p { font-size: 18px; }
	.intro { padding: 10px 0 30px; }
}
