/* Mon Prof d'Échecs — socle commun : polices, couleurs, éléments de formulaire. */

@font-face {
  font-family: "Bricolage";
  src: url("fonts/bricolage.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage";
  src: url("fonts/bricolage-ext.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Pieces";
  src: url("fonts/pieces.woff2") format("woff2");
  font-display: block;
  unicode-range: U+2654-265F;
}

:root {
  /* Le tapis vert des tournois, le buis des pièces claires, le jaune du dernier coup joué. */
  --tapis: #0e3b2c;
  --tapis-sombre: #082a1f;
  --tapis-clair: #1b5a44;
  --case-verte: #4b8b68;
  --buis: #ead9a6;
  --ivoire: #f7f2e3;
  --papier: #fdfbf4;
  --encre: #14130f;
  --encre-douce: #55524a;
  --coup: #f5c542;
  --coup-fonce: #d9a514;
  --gaffe: #c2412a;
  --trait: rgba(20, 19, 15, 0.14);
  --trait-clair: rgba(247, 242, 227, 0.18);

  --font: "Bricolage", "Helvetica Neue", Arial, sans-serif;
  --rayon: 4px;
  --page: 72rem;
}

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

html {
  font-family: var(--font);
  font-size: 106.25%; /* 17 px */
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-optical-sizing: auto;
}

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-variation-settings: "wdth" 100;
}

h1, h2, h3, h4, p, ul, ol, figure, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }

:focus-visible { outline: 3px solid var(--coup-fonce); outline-offset: 2px; border-radius: 2px; }

/* Titres : la graisse et la chasse étroite de Bricolage font le caractère. */
.titre-1, .titre-2, .titre-3 {
  font-stretch: 75%;
  font-variation-settings: "wdth" 75;
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
.titre-1 { font-size: clamp(2.6rem, 6.2vw, 5.2rem); }
.titre-2 { font-size: clamp(2rem, 4vw, 3.2rem); }
.titre-3 { font-size: clamp(1.45rem, 2.2vw, 1.9rem); line-height: 1.05; }

.piece { font-family: "Pieces", "Noto Sans Symbols 2", "Segoe UI Symbol", sans-serif; font-weight: 400; font-style: normal; line-height: 1; }

/* Boutons : une case surlignée, comme le dernier coup joué. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.72em 1.15em;
  border: 2px solid var(--encre);
  border-radius: var(--rayon);
  background: var(--coup);
  color: var(--encre);
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s, transform 0.12s;
}
.btn:hover { background: #ffd65e; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn--second { background: transparent; }
.btn--second:hover { background: rgba(20, 19, 15, 0.06); }
.btn--danger { background: transparent; border-color: var(--gaffe); color: var(--gaffe); }
.btn--danger:hover { background: rgba(194, 65, 42, 0.08); }
.btn--petit { padding: 0.42em 0.8em; font-size: 0.88rem; border-width: 1.5px; }
.btn--large { padding: 0.95em 1.5em; font-size: 1.08rem; }
.btn--bloc { width: 100%; }

/* Formulaires */
.champ { display: grid; gap: 0.35rem; margin-bottom: 1.1rem; }
.champ > label, .champ > .label { font-weight: 650; font-size: 0.94rem; }
.champ .aide { font-size: 0.86rem; color: var(--encre-douce); }
.champ .erreur { font-size: 0.88rem; color: var(--gaffe); font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], input[type="url"], select, textarea {
  width: 100%;
  padding: 0.62em 0.75em;
  border: 1.5px solid rgba(20, 19, 15, 0.45);
  border-radius: var(--rayon);
  background: #fff;
  min-height: 2.75rem;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--coup-fonce); outline-offset: 0; border-color: var(--encre); }
.coche { display: flex; gap: 0.6rem; align-items: flex-start; margin-bottom: 0.9rem; }
.coche input { width: 1.15rem; height: 1.15rem; margin-top: 0.2rem; accent-color: var(--tapis); flex: none; }
.ligne-champs { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.adresse-apercu { display: block; background: var(--buis); border-radius: var(--rayon); padding: 0.4em 0.7em; font-size: 0.88rem; overflow-wrap: anywhere; }

/* Messages */
.message { padding: 0.8rem 1rem; border-radius: var(--rayon); border: 1.5px solid; margin-bottom: 1.2rem; font-weight: 550; }
.message--ok { background: #e6f2e4; border-color: #2f6f4c; color: #17402c; }
.message--erreur { background: #fbe9e4; border-color: var(--gaffe); color: #7c2414; }
.message--info { background: #fff6d6; border-color: var(--coup-fonce); color: #5a4300; }

/* Étiquettes d'état */
.etat { display: inline-flex; align-items: center; gap: 0.4em; padding: 0.16em 0.6em; border-radius: 999px; font-size: 0.8rem; font-weight: 650; white-space: nowrap; border: 1.5px solid transparent; }
.etat::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }
.etat--ok { background: #dcefdc; color: #1c5a39; }
.etat--wait { background: #fff1c2; color: #6b4e00; }
.etat--warn { background: #ffe2c2; color: #8a4300; }
.etat--bad { background: #f9ddd6; color: #8e2a17; }
.etat--off { background: transparent; color: var(--encre-douce); border-color: var(--trait); }

/* Barre gains / nulles / défaites des explorateurs d'ouvertures */
.wdl { display: flex; height: 1.35rem; min-width: 9rem; border: 1.5px solid var(--encre); border-radius: 3px; overflow: hidden; font-size: 0.72rem; font-weight: 700; line-height: 1.2rem; text-align: center; font-variant-numeric: tabular-nums; }
.wdl > span { overflow: hidden; white-space: nowrap; }
.wdl-w { background: #fff; color: var(--encre); }
.wdl-d { background: #b9b4a4; color: var(--encre); }
.wdl-l { background: var(--encre); color: #fff; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
