/* the games page runs on its own palette and rules, not the portfolio's */

/* self-hosted: no third-party request on page load */
@font-face {
  font-family: "Press Start 2P";
  src: url("/public/fonts/press-start-2p.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* straight off a Pixvader screenshot: the two board blues, the cream, the dust */
:root {
  color-scheme: light;
  --sky: #2483cb;
  --sky-light: #308ace;
  --chalk: #fff6e3;
  --dust: #66ceff;
  --cell: clamp(2rem, 4.4vw, 3.25rem);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--chalk);
  /* the game's checkerboard floor */
  background-color: var(--sky);
  background-image: repeating-conic-gradient(
    var(--sky-light) 0% 25%,
    var(--sky) 0% 50%
  );
  background-size: calc(var(--cell) * 2) calc(var(--cell) * 2);
}

body {
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--chalk);
  color: var(--sky);
}

.page-shell {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem 1.25rem;
}

.site-logo {
  display: block;
  width: clamp(3.25rem, 8vw, 5.5rem);
  height: clamp(3.25rem, 8vw, 5.5rem);
}

.site-name {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.6rem, 1.6vw, 0.85rem);
  line-height: 1.4;
  /* keep the pixels hard instead of letting the OS blur them */
  -webkit-font-smoothing: none;
  font-smooth: never;
}

/* the scene: sprites from the Unity project, laid out like an actual level */
.hero {
  position: relative;
  display: grid;
  flex: 1;
  place-items: center;
  align-content: center;
  overflow: hidden;
  padding: clamp(0.75rem, 1.7vw, 2rem);
}

.scene {
  position: absolute;
  inset: 0;
}

.layer {
  position: absolute;
  inset: 0;
}

/* nothing animates on its own; the pointer is the only thing that moves */
.scene .layer > * {
  will-change: translate, rotate;
}

.sprite {
  position: absolute;
  display: block;
  height: auto;
  /* centre each sprite on its point; the pointer drift rides on translate/rotate */
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
}

.boss {
  left: 50%;
  top: 21%;
  width: clamp(5rem, 15vw, 10.5rem);
}

/* the sprites have different aspect ratios; match them by height so they read
   as the same size on screen, the way they do in the game */
.alien {
  height: clamp(1.4rem, 3.2vw, 2.4rem);
  width: auto;
}

.alien.big {
  height: clamp(2.1rem, 4.8vw, 3.5rem);
}

.ship {
  left: 50%;
  top: 81%;
  width: clamp(2.75rem, 7vw, 4.75rem);
}

/* the player's shot is a plain square, like the pellets in the game */
.bullet {
  position: absolute;
  left: 50%;
  top: 74%;
  width: clamp(6px, 0.75vw, 10px);
  aspect-ratio: 1;
  background: var(--chalk);
  transform: translate(-50%, -50%);
}

.dust {
  position: absolute;
  width: clamp(4px, 0.5vw, 7px);
  aspect-ratio: 1;
  background: var(--dust);
}

.shot {
  position: absolute;
  width: clamp(5px, 0.6vw, 8px);
  aspect-ratio: 1;
  background: var(--chalk);
}

.billboard {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: clamp(1.1rem, 3vh, 2rem);
  will-change: translate;
}

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 0.9rem;
  margin: 0;
}

.store {
  padding: 0.6rem 0.75rem;
  border: 2px solid var(--chalk);
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.45rem, 1.1vw, 0.62rem);
  line-height: 1;
  -webkit-font-smoothing: none;
  font-smooth: never;
  transition: background-color 140ms ease, color 140ms ease;
}

a.store:hover,
a.store:focus-visible {
  background: var(--chalk);
  color: var(--sky);
  outline: none;
}

/* placeholder until the store listings go live */
.store.is-soon {
  opacity: 0.55;
}

.store.is-soon::after {
  content: " · soon";
}

.game-title {
  margin: 0;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(1.1rem, 5vw, 2.6rem);
  font-weight: 400;
  line-height: 1.3;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.45rem, 1.1vw, 0.6rem);
  line-height: 1.5;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

footer p {
  margin: 0;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.25rem;
}

footer a {
  transition: opacity 160ms ease;
}

footer a:hover,
footer a:focus-visible {
  opacity: 0.6;
  outline: none;
}

@media (max-width: 480px) {
  footer {
    flex-direction: column;
    gap: 0.7rem;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
