/* Buxtehude — the town, its tallies and its controls. Shared chrome: artifact.css */

.board {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/*
 * A window onto the town: wide, the way a view is, rounded like the buttons.
 * The canvas paints the sky itself; the colour here only shows until it does.
 */
.board__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 0.9rem;
  background: #cfd9e3;
  /* A drag anywhere on it looks around, so no drag may scroll or select. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.game.is-dragging .board__stage {
  cursor: grabbing;
}

.game.is-night .board__stage {
  background: #0f1424;
}

/* Given the whole screen, the window is the screen: no frame, no corners, no aspect but the screen's. */
.board__stage:fullscreen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}

/*
 * On the screen the page's readouts and buttons are out of reach, so a bar
 * along the top of the picture carries them: the same readouts, the same
 * buttons, wired to the same things. It is nowhere otherwise.
 */
.stage__bar {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0.9rem;
  background: linear-gradient(rgba(12, 14, 20, 0.55), rgba(12, 14, 20, 0));
  color: #fff;
  font-size: 0.8125rem;
}

.board__stage:fullscreen .stage__bar {
  display: flex;
}

.stage__hud {
  margin: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.stage__actions {
  display: flex;
  gap: 0.4rem;
}

.stage__button {
  min-height: 2.75rem;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 0.6rem;
  background: rgba(25, 28, 33, 0.6);
  color: #fff;
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.stage__button:hover {
  background: rgba(25, 28, 33, 0.85);
}

/* Out of the flow, so the size of its drawing can never feed back into the box's. */
.board__stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

/* Where the town comes from: a line at the foot of the page, above whose the page is. */
.colophon__source {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.colophon__source a {
  color: inherit;
}

.board__side .scores {
  justify-content: space-between;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}

.controls .status {
  flex-basis: 100%;
}

/* Four buttons: on a phone they take two rows rather than the margin. */
.actions {
  flex-wrap: wrap;
}

/* The pad ------------------------------------------------------------------ */

/*
 * On a touch screen, keys on the picture: a cross to walk and turn at the
 * left, and when flying, a pair to rise and sink at the right. Hidden where
 * there is a keyboard, because there the keys are the keys.
 */
.pad {
  position: absolute;
  bottom: 0.75rem;
  z-index: 2;
  display: none;
  gap: 0.35rem;
}

.pad--walk {
  left: 0.75rem;
  grid-template-columns: repeat(3, 2.9rem);
  grid-template-rows: repeat(3, 2.9rem);
}

.pad--fly {
  right: 0.75rem;
  grid-template-rows: repeat(2, 2.9rem);
}

.pad__key {
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 0;
  border-radius: 0.6rem;
  background: rgba(25, 28, 33, 0.55);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.pad__key:active {
  background: rgba(25, 28, 33, 0.85);
}

.pad__key--forward {
  grid-column: 2;
  grid-row: 1;
}

.pad__key--left {
  grid-column: 1;
  grid-row: 2;
}

.pad__key--back {
  grid-column: 2;
  grid-row: 3;
}

.pad__key--right {
  grid-column: 3;
  grid-row: 2;
}

/* The touch hint is hidden by default and shown where a finger is the pointer: the default must come first, or it wins. */
.hint--touch {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .pad--walk {
    display: grid;
  }

  .game.is-flying .pad--fly {
    display: grid;
  }

  .hint--touch {
    display: block;
  }
}

/* Legend ------------------------------------------------------------------ */

.legend__heading {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.75rem;
}

.legend__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.4rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

.legend__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* The tones a thing is drawn in, as blocks side by side. */
.chips {
  flex: none;
  display: flex;
  gap: 0.15rem;
}

.chip {
  display: block;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

@media (max-width: 47.99rem) {
  .game {
    gap: 1.25rem;
  }

  /* Squarer, so the town and the buttons share a phone's screen. */
  .board__stage {
    aspect-ratio: 4 / 3;
  }

  .controls {
    justify-content: center;
  }

  .status {
    min-height: 1.4em;
    text-align: center;
  }

  .actions {
    justify-content: center;
  }

  .legend__list {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1rem;
  }
}
