/* ============================================================
   Dojoon — page d'accueil (morpion / logo interactif)

   Le fond est un pattern infini (bg-pattern.png, tuile 150×150).
   La grille de jeu fait 3×3 tuiles = exactement le logo, centrée
   sur le même point que le fond → les cases tombent pile sur le
   quadrillage, quelle que soit la taille de la tuile (responsive).
   ============================================================ */

:root {
  /* Taille d'une tuile du quadrillage. La grille = 3 tuiles. */
  --tile: clamp(70px, 18vmin, 150px);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  position: relative;
  background: url("img/bg-pattern.png") center / var(--tile) repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Grille 3×3 ---------- */
.board {
  width: calc(var(--tile) * 3);
  height: calc(var(--tile) * 3);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

/* Repli sans JavaScript : le logo complet. */
.board__fallback {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  width: 100%;
  height: 100%;
}

/* ---------- Case (bouton) ---------- */
.cell {
  /* reset bouton */
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cell svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Point initial : blanc, devient gris au survol de la case. */
.dot {
  fill: #fff;
  transition: fill 0.2s ease;
}
.cell:hover .dot,
.cell:focus-visible .dot {
  fill: #929292;
}

/* Clignotement aléatoire au repos (blanc → #C5C5C5 → blanc). */
@keyframes dot-pulse {
  0%, 100% { fill: #fff; }
  50%      { fill: #c5c5c5; }
}
.dot.is-pulsing {
  animation: dot-pulse 1.6s ease-in-out;
}

/* Glyphe révélé : blanc (couleur du logo). */
.glyph { fill: #fff; }

/* Accessibilité clavier. */
.cell:focus-visible { outline: 2px solid #000; outline-offset: -4px; }

/* Une fois révélée, la case n'est plus interactive. */
.cell.is-on { cursor: default; }
.cell.is-on .dot { opacity: 0; }

/* ---------- Bouton « Recommencer » ---------- */
/* Positionné en absolu, centré sous la grille : la grille reste
   parfaitement centrée et calée sur le quadrillage. */
.restart {
  position: absolute;
  left: 50%;
  top: calc(50% + (var(--tile) * 1.5) + clamp(16px, 4vmin, 32px));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  border-radius: 16px;
  background: #000;
  color: #fff;
  font-family: "Lexend", var(--font, system-ui, sans-serif);
  font-weight: 600;
  font-size: 13px;
  line-height: normal;
  white-space: nowrap;
  cursor: pointer;
  animation: restart-in 0.3s ease both;
}
.restart[hidden] { display: none; }
.restart:hover { opacity: 0.85; }
.restart:focus-visible { outline: 2px solid #000; outline-offset: 3px; }

.restart__icon {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

@keyframes restart-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
