@import url('https://fonts.googleapis.com/css2?family=Texturina:wght@100&display=swap');

/* The panel is fluid and only capped at the old 482px. A fixed width made
   every phone from 361px to 499px wide (375, 390, 412, 428...) miss both
   media-query steps below and keep the 482px board, which then stuck out past
   the navbar and the footer. */
.panel {
  width: 100%;
  max-width: 482px;
}
.panel-body {
  padding-left: 0px;
  padding-top: 0px;
  padding-right: 0px;
}

.list-group-item {
    padding: 3px;
    margin-right: 64px;
    margin-left: 64px;
}

.board {
  font-family: 'Texturina', serif;
}
.bg-game {
  font-family: 'Texturina', serif;
}

.bg-24-title {
  font-family: 'Texturina', serif;
  font-size: 40px;
  text-align: center;
  text-shadow: 2px 2px silver;
  padding-bottom: 6px;
}
.bg-24-footer {
  font-size: 18px;
}
/* The board is fluid: the picture stretches to the panel and each of the 100
   cells is one tenth of it, so the two always agree at any width. The panel
   caps at 482px (480 of board plus 1px of border each side), which is the size
   the old fixed rules gave it, and the board caps at its old 480px too. */
.bg-board {
  padding-left: 0px;
  padding-top: 0px;
  padding-right: 0px;
  margin-right: 0px;
  margin-left: 0px;
  width: 100%;
  max-width: 480px;
  background-size: 100% 100%;
  background-image: url(/24/gameoftheamazons-board-480.png);
  background-repeat: no-repeat;
  line-height: 0px;
  /* The ten cells of a row sit next to each other with no space between them
     in the template. nowrap keeps the row on one line when the tenth cell's
     sub-pixel rounding would otherwise push it to the next one. */
  white-space: nowrap;
  /* The drag ghost is a clone of a cell image and jQuery UI 1.12 sets
     position:absolute on it. A static board is not a containing block, so the
     clone resolved width:calc(100% / 10) against the body and the ghost grew
     to a tenth of the window instead of a cell. The relative box makes the
     board that containing block, so the ghost is one cell and its left and
     top are counted from the board too. */
  position: relative;
}

.bg-board img {
    width: calc(100% / 10);
    height: auto;
}
/* The cup is the piece the player drags, and its clone is the drag ghost. It
   has to be the same size as one board cell or the ghost does not fit the
   square it lands on. The board is min(page width, 482px) minus 1px of panel
   border each side, divided into ten cells, and this repeats that sum. 100vw
   is the page width, which is what the board gets at phone widths. The class
   sits on the image itself, so a `.bg-cup img` selector matches nothing. */
.bg-cup {
    width: calc((min(100vw, 482px) - 2px) / 10);
    height: auto;
}

@media (max-width: 361px) {
  .col-xs-12,.board {
    margin-left: 0px;
    padding-left: 0px;
  }
}

/* The board and the panel are fluid (see .panel and .bg-board above), so there
   are no more fixed-size steps here. The old rules pinned the panel to 362px
   and then 320px and the cells to 36px and 32px, which is what left every
   phone between those widths with a board wider than the page. The .bg-chat
   steps went with them: a fixed 360px chat would overflow a 340px phone just
   like the board did. */

/* Below 512px the container's 15px padding would hold the board under its
   482px cap, so the game page drops that padding and the board runs edge to
   edge, at the same width as the navbar and the footer. 512px is the width at
   which the capped panel first fills the padded container (482 + 2 x 15), so
   the board size does not jump at the breakpoint. */
@media (max-width: 512px) {
  .bg-pagebody {
    padding-left: 0px;
    padding-right: 0px;
    margin-left: 0px;
    margin-right: 0px;
  }
}

@media (max-width: 321px) {

  .list-group-item {
    padding: 3px;
    margin-right: 32px;
    margin-left: 32px;
  }
  .bg-24-title {
    font-size: 28px;
    text-align: center;
    text-shadow: 2px 2px gold;
  }
}


/* ---------- two-click selection and the last move, ported from Hnefatafl (27)
   ---------- */
/* The marks live in one absolutely positioned layer over the picture, placed
   by percent of the board, so they track the fluid grid at every width. The
   layer is click-through; only the route's arrow targets take the pointer. */
.a24-marks {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.a24-mark {
  position: absolute;
  width: 10%;
  height: 10%;
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* The golden dot: deliberately small, so it marks the square without hiding
   the picture under it. It keeps the round dark border that defines it on
   the cream board, but the edge of the gradient must stay gold: the burnt
   orange of the first ship read as an ember ring. Two glow layers shine
   outwards, and the pulse breathes the light instead of dimming it. */
.a24-target::after,
.a24-soft::after {
  content: "";
  width: 22%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff0b0, #ffc94a 55%, #dd9a12);
  box-shadow:
    0 0 0 2px rgba(38, 22, 4, .88),
    0 0 10px rgba(255, 178, 44, .95),
    0 0 24px rgba(255, 140, 20, .55),
    inset 0 1px 2px rgba(255, 255, 255, .8);
  animation: a24-pulse 1.4s ease-in-out infinite;
}
.a24-target {
  pointer-events: auto;
  cursor: pointer;
}

/* The pending arrow: the square it would leave and the square it lands on. */
.a24-selected {
  box-shadow:
    inset 0 0 0 3px rgba(122, 78, 10, .9),
    inset 0 0 18px rgba(246, 223, 148, .5);
}

/* The last move: the square the opponent left, the square it landed on and
   the square its arrow hit. The same ember ring Hnefatafl draws. */
.a24-last {
  box-shadow:
    inset 0 0 0 3px rgba(224, 112, 47, .85),
    inset 0 0 16px rgba(224, 112, 47, .3);
}

/* The picked amazon lifts and glows. The class sits on the image itself, so
   the selector must reach the image, not its parent. */
.bg-board img.piece-selected {
  transform: translateY(-6%) scale(1.07);
  filter:
    drop-shadow(0 1px 0 rgba(0, 0, 0, .8))
    drop-shadow(0 4px 4px rgba(0, 0, 0, .45))
    drop-shadow(0 0 8px rgba(255, 214, 90, .95));
  transition: transform .18s cubic-bezier(.2, .8, .3, 1), filter .18s;
}
/* The dot alone marks the square, like on the Hnefatafl board: the cell
   itself gets no frame, so the move phase looks like the arrow phase. */
.bg-board img.valid-move-target {
  cursor: pointer;
}

@keyframes a24-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; filter: brightness(1); }
  50%      { transform: scale(1.14); opacity: 1; filter: brightness(1.28); }
}
@media (prefers-reduced-motion: reduce) {
  .a24-target::after,
  .a24-soft::after { animation: none; }
  .bg-board img.piece-selected { transition: none; }
}
