/* Arcade — the hero. Builds on theme.css (section, .button, headings). Everything snaps to the
   8px unit; the pixel is 4px, matching the theme's border and shadow. The game script
   (sections/arcade/game.js) supplies the motion; nothing here animates but the button press. */

/* Sits right under the nav and has to fit the first screen, so it gives up the theme's 64px. */
#arcade { padding-block: 32px 0; }

/* Asymmetric split: text, then the stage at about 55% of the width. */
#arcade .arcade-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 48px;
  align-items: center;
}

/* Bitmap type for short strings only. Yellow clears 4.5:1 on --bg. */
#arcade .arcade-label {
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 24px;
  color: #FFCD75;
  margin: 0 0 16px;
}
#arcade .arcade-title {
  font-family: var(--font-mono);
  font-size: 32px;
  line-height: 48px;
  margin: 0 0 16px;
}

/* Body copy stays in the sans role. */
#arcade .arcade-line {
  max-width: 34ch;
  font-size: 20px;
  line-height: 32px;
  margin: 0 0 32px;
}

#arcade .arcade-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  max-width: none;
  margin: 0;
}

#arcade .arcade-button,
#arcade .arcade-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 8px 24px;
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 24px;
  text-decoration: none;
  border: 4px solid #FFCD75;
  background: #FFCD75;
  color: #1A1C2C;
  box-shadow: 4px 4px 0 #29366F;
}
#arcade .arcade-button-alt {
  background: #333C57;
  border-color: #F4F4F4;
  color: #F4F4F4;
}
#arcade .arcade-button:hover,
#arcade .arcade-button:active,
#arcade .arcade-play:hover,
#arcade .arcade-play:active { transform: translate(4px, 4px); box-shadow: none; }
#arcade .arcade-button:focus-visible,
#arcade .arcade-play:focus-visible { outline: 4px solid #41A6F6; outline-offset: 4px; }

/* The stage. The 4px checkerboard dither shows until the canvas paints. */
#arcade .arcade-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  border: 4px solid #F4F4F4;
  border-radius: 0;
  box-shadow: 4px 4px 0 #29366F;
  background-color: #1A1C2C;
  background-image: repeating-conic-gradient(#29366F 0% 25%, #1A1C2C 0% 50%);
  background-size: 8px 8px;
  image-rendering: pixelated;
}

/* The script sizes the drawing buffer from this box. */
#arcade .arcade-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#arcade .arcade-score,
#arcade .arcade-hint {
  position: absolute;
  right: 16px;
  max-width: calc(100% - 32px);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 24px;
  text-align: right;
  background: #1A1C2C;
  pointer-events: none;
}
#arcade .arcade-score {
  top: 16px;
  padding: 4px 8px;
  color: #FFCD75;
  border: 4px solid #F4F4F4;
}
#arcade .arcade-score span { font: inherit; white-space: nowrap; }

/* Only where there is a mouse to lead it with. */
#arcade .arcade-hint {
  display: none;
  bottom: 16px;
  padding: 0 8px;
  color: #F4F4F4;
}
@media (hover: hover) and (pointer: fine) {
  #arcade .arcade-hint { display: block; }
  /* Reduced motion shows the Play button; the hint steps up a row so the two never collide. */
  #arcade .arcade-stage:has(.arcade-play:not([hidden])) .arcade-hint { bottom: 80px; }
}

#arcade .arcade-play {
  position: absolute;
  left: 16px;
  bottom: 16px;
}
/* .button sets display, which would beat the hidden attribute. */
#arcade .arcade-play[hidden] { display: none; }

/* No WebGL2: the dither stays and the fallback line sits centred on it. */
#arcade .arcade-fallback { display: none; }
#arcade .arcade-stage[data-arcade-state="unsupported"] {
  display: grid;
  place-items: center;
  padding: 16px;
}
#arcade .arcade-stage[data-arcade-state="unsupported"] .arcade-canvas,
#arcade .arcade-stage[data-arcade-state="unsupported"] .arcade-score,
#arcade .arcade-stage[data-arcade-state="unsupported"] .arcade-hint,
#arcade .arcade-stage[data-arcade-state="unsupported"] .arcade-play { display: none; }
#arcade .arcade-stage[data-arcade-state="unsupported"] .arcade-fallback {
  display: block;
  max-width: 32ch;
  margin: 0;
  padding: 8px 16px;
  text-align: center;
  background: #1A1C2C;
  color: #F4F4F4;
}

/* Bottom rule: 4px checkerboard dither, hard stops only. */
#arcade .arcade-dither {
  height: 8px;
  margin-top: 48px;
  background-color: var(--bg);
  background-image: repeating-conic-gradient(#29366F 0% 25%, #1A1C2C 0% 50%);
  background-size: 8px 8px;
  image-rendering: pixelated;
}

@media (max-width: 720px) {
  #arcade .arcade-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  #arcade .arcade-title { font-size: 24px; line-height: 40px; }
  #arcade .arcade-score,
  #arcade .arcade-hint { right: 8px; max-width: calc(100% - 16px); }
  #arcade .arcade-score { top: 8px; }
  #arcade .arcade-hint { bottom: 8px; }
  #arcade .arcade-play { left: 8px; bottom: 8px; }
  #arcade .arcade-dither { margin-top: 32px; }
}
