/* A static, server-rendered chess diagram: the opening pages' main line and
   the embeddable game viewer. It needs no Chessground and no script. The 64
   squares come from core/services/public/game_embed.py in a8..h1 order, and
   the pieces use piece-sets.css, so a diagram matches the game boards' Merida
   set and blue board. A flipped board turns the grid and turns each piece
   back upright. */

.board-diagram {
  --diagram-light: #dee3e6;
  --diagram-dark: #8ca2ad;
  --diagram-mark: rgba(155, 199, 0, 0.41);
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  aspect-ratio: 1;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--diagram-light);
  /* Each 2x2 tile: light a8-style corners top left and bottom right. */
  background-image: conic-gradient(
    var(--diagram-dark) 25%,
    var(--diagram-light) 0 50%,
    var(--diagram-dark) 0 75%,
    var(--diagram-light) 0
  );
  background-size: 25% 25%;
  border-radius: 3px;
  overflow: hidden;
  user-select: none;
}

.board-diagram.is-flipped {
  transform: rotate(180deg);
}

.board-diagram .board-square {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.board-diagram .board-square.is-marked {
  background: var(--diagram-mark);
}

.board-diagram piece {
  position: absolute;
  inset: 0;
  display: block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.board-diagram.is-flipped piece {
  transform: rotate(180deg);
}
