/* Backrooms — the dark, the rooms in it, and the few controls. Shared chrome: artifact.css */

/*
 * The page is the picture: it fills the window from the top, edge to edge,
 * and the masthead floats over it in light ink. What there is to read
 * follows below, for whoever scrolls.
 */
body.in-the-dark {
  padding-top: 0;
  --paper: #0b0b0a;
  --ink: #ece8da;
  --ink-soft: #a6a08e;
  --ink-faint: #5d5a50;
  --line: #2c2b27;
}

.in-the-dark .masthead {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  max-width: none;
  padding: clamp(1rem, 3vw, 1.75rem) clamp(1.25rem, 4vw, 2.5rem);
  /* Only the links take presses; the picture under the rest of it is dragged. */
  pointer-events: none;
}

.in-the-dark .masthead > * {
  pointer-events: auto;
}

/*
 * The stage: the full width of the window, whatever the column, and its full
 * height. The canvas paints the dark itself; the colour here only shows
 * until it does.
 */
.board__stage {
  position: relative;
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #000;
  /* 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;
}

/* Given the whole screen, the window is the screen. */
.board__stage:fullscreen {
  width: 100%;
  height: 100%;
  margin: 0;
}

/* 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%;
}

/*
 * The bar along the foot of the picture: the title and the distance walked
 * at the left, the buttons at the right. It belongs to the picture, so it
 * stays when the picture is given the whole screen.
 */
.stage__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  padding: 2.5rem clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 3vw, 1.75rem);
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.55));
  color: #e8e4d6;
  /* The bar's empty space is still the picture: a drag may start there. */
  pointer-events: none;
}

.stage__bar > * {
  pointer-events: auto;
}

.stage__title h1 {
  font-size: clamp(1.4rem, 1.1rem + 1.6vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stage__title .eyebrow {
  color: #a29d8c;
}

.stage__hud {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: #c9c3b0;
}

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

.stage__button {
  min-height: 2.75rem;
  padding: 0 0.9rem;
  border: 1px solid rgba(232, 228, 214, 0.18);
  border-radius: 0.6rem;
  background: rgba(20, 20, 18, 0.6);
  color: #e8e4d6;
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}

.stage__button:hover {
  background: rgba(40, 40, 36, 0.85);
}

/* Paused: said in the middle of the picture, where the eyes are. */
.stage__paused {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: #e8e4d6;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.game.is-paused .stage__paused {
  display: flex;
}

/* What there is to read, in the page's column below the picture. */
.game__about {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.seed {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #e8e4d6;
}

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

/* On a touch screen, keys on the picture, above the bar: a cross to walk and turn. */
.pad {
  position: absolute;
  right: clamp(1.25rem, 4vw, 2.5rem);
  bottom: 7.5rem;
  z-index: 3;
  display: none;
  gap: 0.35rem;
  grid-template-columns: repeat(3, 2.9rem);
  grid-template-rows: repeat(3, 2.9rem);
}

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

.pad__key:active {
  background: rgba(60, 60, 54, 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 {
    display: grid;
  }

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

/* Over a lit ceiling the masthead's light ink needs a little dark behind it. */
.in-the-dark .masthead {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
