/* tofdeki.css - l'identite entiere du jeu.
 *
 * DEUX OBJETS PHOTOGRAPHIQUES, DEUX ROLES, ET IL NE FAUT JAMAIS LES CONFONDRE.
 *
 *   .bande    trois vues a la suite, perforations en haut et en bas.
 *             C'est la QUESTION. Elle se regarde, elle ne se clique pas.
 *
 *   .planche  la grille des participants. C'est la REPONSE. Le crayon rouge
 *             entoure un compte, jamais une photo.
 *
 * Une premiere version entourait une vignette de la bande : elle disait « c'est
 * cette photo-la » quand la question est « c'est ce compte-la ». Tout le reste
 * de cette feuille decoule de cette correction.
 *
 * LE ROUGE EST LE SEUL ACCENT DU SITE. Il ne sert qu'a une chose : designer un
 * compte. Un bouton rouge, un lien rouge, un titre rouge lui prendraient sa
 * force, et le geste central du jeu deviendrait une decoration parmi d'autres.
 */

/* ------------------------------------------------------------ polices */

@font-face {
  font-family: 'Bricolage'; src: url('/polices/bricolage-800.woff2') format('woff2');
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Bricolage'; src: url('/polices/bricolage-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Manrope'; src: url('/polices/manrope-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Manrope'; src: url('/polices/manrope-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Manrope'; src: url('/polices/manrope-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ------------------------------------------------------------ couleurs */

:root {
  --papier: #F7F5EF;
  --papier-2: #EFECE3;
  --encre: #2C2C2A;
  --encre-2: #5F5E5A;
  --encre-3: #8D8B84;
  --trait: rgba(44, 44, 42, .14);
  --trait-fort: rgba(44, 44, 42, .30);
  --rouge: #E24B4A;
  --rouge-pale: rgba(226, 75, 74, .12);
  --vert: #3B6D11;
  --ambre: #854F0B;

  --titre: 'Bricolage', 'Manrope', system-ui, sans-serif;
  --texte: 'Manrope', system-ui, -apple-system, sans-serif;

  --rayon: 10px;
  --large: 62rem;
}

/* LA CHAMBRE NOIRE.
 * Le mode sombre n'est pas ici une politesse envers les reglages du systeme :
 * c'est le seul jeu ou il raconte quelque chose. Le papier devient la chambre,
 * et le rouge devient la lampe inactinique — la seule lumiere sous laquelle on
 * peut travailler sans voiler le tirage. */
@media (prefers-color-scheme: dark) {
  :root {
    --papier: #14140F;
    --papier-2: #1D1D18;
    --encre: #E9E7DF;
    --encre-2: #A8A69C;
    --encre-3: #75736B;
    --trait: rgba(233, 231, 223, .14);
    --trait-fort: rgba(233, 231, 223, .30);
    --rouge: #F0716F;
    --rouge-pale: rgba(240, 113, 111, .14);
    --vert: #97C459;
    --ambre: #EF9F27;
  }
}

/* ------------------------------------------------------------ ossature */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--texte);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: var(--large);
  margin: 0 auto;
  padding: 0 20px 80px;
}

h1, h2, h3 { font-family: var(--titre); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); margin: 0 0 .3em; }
h2 { font-size: clamp(1.2rem, 3.4vw, 1.5rem); margin: 2.2em 0 .6em; }
h3 { font-size: 1.05rem; margin: 1.6em 0 .4em; }
p { margin: 0 0 1em; }
a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: 1px; }

.discret { color: var(--encre-2); font-size: .93rem; }
.minuscule { color: var(--encre-3); font-size: .84rem; }
.centre { text-align: center; }
.rouge { color: var(--rouge); }

/* ------------------------------------------------------------ en-tete */

header.barre {
  border-bottom: 1px solid var(--trait);
  margin-bottom: 26px;
}
.barre-dedans {
  max-width: var(--large); margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.marque {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--titre); font-weight: 800; font-size: 1.15rem;
  text-decoration: none; letter-spacing: -.03em;
}
.marque svg { width: 26px; height: 26px; flex: none; }
nav.liens { display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; align-items: center; }
nav.liens a {
  text-decoration: none; color: var(--encre-2); font-size: .92rem; font-weight: 600;
  padding: 4px 0; border-bottom: 2px solid transparent;
}
nav.liens a:hover { color: var(--encre); }
nav.liens a[aria-current="page"] { color: var(--encre); border-bottom-color: var(--rouge); }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover; background: var(--papier-2); border: 1px solid var(--trait);
}

/* ------------------------------------------------------------ boutons */

button, .bouton {
  font-family: var(--texte); font-weight: 700; font-size: .95rem;
  padding: 10px 18px; border-radius: var(--rayon);
  border: 1.5px solid var(--encre); background: var(--encre); color: var(--papier);
  cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3;
}
button:hover, .bouton:hover { opacity: .88; }
button:disabled { opacity: .38; cursor: not-allowed; }
button.creux, .bouton.creux { background: transparent; color: var(--encre); }
button.discrete {
  background: transparent; border-color: var(--trait-fort); color: var(--encre-2);
  font-weight: 600;
}
button.danger { background: transparent; border-color: var(--rouge); color: var(--rouge); }

/* ------------------------------------------------------------ la bande */

/* LA BANDE : LA QUESTION.
 * Perforations en haut et en bas, comme un film 35 mm. Elles sont dessinees en
 * dégradé répété plutot qu'avec des elements : trente petits carres dans le
 * document pour une decoration seraient trente choses de plus a lire pour un
 * lecteur d'ecran. */
.bande {
  border-top: 2px solid var(--trait-fort);
  border-bottom: 2px solid var(--trait-fort);
  padding: 14px 0;
  margin: 0 0 8px;
  position: relative;
}
.bande::before, .bande::after {
  content: ''; position: absolute; left: 0; right: 0; height: 8px;
  background-image: repeating-linear-gradient(
    to right, var(--trait-fort) 0 10px, transparent 10px 22px);
  opacity: .55;
}
.bande::before { top: 2px; }
.bande::after { bottom: 2px; }

.vues {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
@media (max-width: 640px) { .vues { grid-template-columns: 1fr; } }

.vue { margin: 0; }
.vue img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  background: var(--papier-2); border: 1px solid var(--trait);
  display: block;
}
.vue figcaption {
  font-size: .82rem; color: var(--encre-2); margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.vue figcaption.muette { color: var(--encre-3); font-style: italic; }

/* Le numero de la journee, gratte dans la marge de la planche. */
.cote-bande {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .84rem; color: var(--encre-3);
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
  margin-bottom: 6px; text-transform: uppercase;
}

/* ------------------------------------------------------------ la planche */

/* LA PLANCHE : LA REPONSE.
 * Facile porte des avatars, moyen n'en porte pas — reconnaitre une tete va plus
 * vite que lire cent identifiants, et servir les avatars au niveau moyen le
 * rendrait plus facile que le niveau facile, avec le coefficient 2. */
.planche {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  margin: 16px 0;
}
.planche.texte { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

.vignette {
  position: relative; border: 1.5px solid var(--trait);
  background: var(--papier-2); border-radius: 4px;
  padding: 10px 8px; cursor: pointer; text-align: center;
  font-family: var(--texte); font-weight: 600; font-size: .8rem; color: var(--encre);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  word-break: break-word; line-height: 1.35;
}
.vignette img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.vignette:hover { border-color: var(--trait-fort); }
.planche.texte .vignette { text-align: left; align-items: stretch; padding: 9px 12px; }

/* LE CRAYON ROUGE.
 * Une ellipse legerement inclinee et un peu debordante : un cercle parfait
 * ferait bouton, et le geste doit rester celui d'une main sur du papier. */
.vignette[aria-pressed="true"] { border-color: var(--rouge); background: var(--rouge-pale); }
.vignette[aria-pressed="true"]::after {
  content: ''; position: absolute; inset: -5px -7px;
  border: 2.5px solid var(--rouge); border-radius: 50%;
  transform: rotate(-3deg); pointer-events: none;
}
/* Une vignette barree : compte en quarantaine, ou retire. */
.vignette.barree { opacity: .45; }
.vignette.barree::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom right, transparent calc(50% - 1px),
    var(--rouge) calc(50% - 1px), var(--rouge) calc(50% + 1px), transparent calc(50% + 1px));
  pointer-events: none;
}

/* ------------------------------------------------------------ niveaux */

.niveaux { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); margin: 18px 0; }
@media (max-width: 640px) { .niveaux { grid-template-columns: 1fr; } }

.niveau {
  border: 1.5px solid var(--trait); border-radius: var(--rayon);
  padding: 16px; text-align: left; background: transparent; color: inherit;
  display: flex; flex-direction: column; gap: 4px; cursor: pointer;
}
.niveau:hover { border-color: var(--trait-fort); }
.niveau .nom { font-family: var(--titre); font-weight: 800; font-size: 1.1rem; }
.niveau .coef {
  font-variant-numeric: tabular-nums; color: var(--rouge);
  font-weight: 700; font-size: .9rem;
}
.niveau .quoi { color: var(--encre-2); font-size: .88rem; font-weight: 500; }
.niveau[aria-pressed="true"] { border-color: var(--rouge); background: var(--rouge-pale); }

/* ------------------------------------------------------------ cartes */

.carte {
  border: 1px solid var(--trait); border-radius: var(--rayon);
  padding: 18px; margin: 16px 0; background: var(--papier-2);
}
.carte.plate { background: transparent; }

.compteurs { display: flex; gap: 22px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.compteur .n { font-family: var(--titre); font-weight: 800; font-size: 1.5rem; display: block; }
.compteur .quoi { color: var(--encre-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }

/* ------------------------------------------------------------ revelation */

/* LE GESTE SIGNATURE : L'EPREUVE QUI SORT DU REVELATEUR.
 * Le nom apparait de blanc a noir, puis le cercle rouge se referme dessus. Six
 * cents millisecondes, une seule fois, a 21 h. C'est ce dont les gens parleront,
 * et cela tient en deux animations. */
.revelation {
  margin: 24px 0; padding: 26px 20px; text-align: center;
  border: 1px solid var(--trait); border-radius: var(--rayon);
  position: relative;
}
.revelation .nom {
  font-family: var(--titre); font-weight: 800;
  font-size: clamp(1.4rem, 5vw, 2.1rem);
  display: inline-block; position: relative; padding: 6px 14px;
  animation: developper .7s ease-out both;
}
.revelation .nom::after {
  content: ''; position: absolute; inset: -6px -14px;
  border: 3px solid var(--rouge); border-radius: 50%;
  transform: rotate(-4deg) scale(1.35); opacity: 0;
  animation: entourer .45s ease-out .55s both;
}
@keyframes developper {
  from { opacity: 0; filter: contrast(0) brightness(1.8); }
  to { opacity: 1; filter: none; }
}
@keyframes entourer {
  from { opacity: 0; transform: rotate(-14deg) scale(1.35); }
  to { opacity: 1; transform: rotate(-4deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .revelation .nom, .revelation .nom::after { animation: none; opacity: 1; transform: rotate(-4deg); }
}

/* ------------------------------------------------------------ tableaux */

table.tableau { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.tableau th, table.tableau td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--trait);
}
table.tableau th {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--encre-3); font-weight: 700;
}
table.tableau td.n { text-align: right; }
table.tableau tr.moi { background: var(--rouge-pale); }
table.tableau tr.moi td:first-child { box-shadow: inset 3px 0 0 var(--rouge); }

/* ------------------------------------------------------------ barres */

.barre-part { height: 7px; background: var(--trait); border-radius: 4px; overflow: hidden; }
.barre-part > span { display: block; height: 100%; background: var(--encre-3); }
.barre-part.juste > span { background: var(--rouge); }

/* ------------------------------------------------------------ formes */

input[type="text"], input[type="search"], textarea, select {
  font-family: var(--texte); font-size: 1rem; font-weight: 500;
  padding: 10px 12px; border-radius: var(--rayon);
  border: 1.5px solid var(--trait-fort); background: var(--papier);
  color: var(--encre); width: 100%;
}
input:focus-visible, button:focus-visible, .vignette:focus-visible, a:focus-visible {
  outline: 2px solid var(--rouge); outline-offset: 2px;
}
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }

/* ------------------------------------------------------------ messages */

.mot {
  padding: 11px 14px; border-radius: var(--rayon); margin: 14px 0;
  border: 1px solid var(--trait-fort); font-size: .93rem;
}
.mot.erreur { border-color: var(--rouge); color: var(--rouge); background: var(--rouge-pale); }
.mot.bien { border-color: var(--vert); color: var(--vert); }

/* Le compte a rebours, en chiffres tabulaires : un compteur qui saute pendant
   qu'il s'incremente est desagreable, et il s'incremente toutes les secondes. */
.rebours { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

.charge { color: var(--encre-3); padding: 30px 0; text-align: center; }

footer.pied {
  border-top: 1px solid var(--trait); margin-top: 50px; padding: 20px;
  text-align: center; color: var(--encre-3); font-size: .85rem;
}
footer.pied a { color: var(--encre-2); }

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