/*
 * games.aklasoftware.com
 *
 * One look, deliberately: black. The games bring the colour, so everything
 * around them stays out of the way. Tokens first; nothing below names a
 * colour directly.
 */

:root {
  color-scheme: dark;

  --ground: #060607;
  --raised: #101013;
  --raised-2: #17171b;
  --line: #24242a;
  --ink: #f3f3f5;
  --muted: #a3a3ad;
  --on-light: #060607;

  --display: 'Unbounded', 'Arial Black', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --shell: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --gap: clamp(14px, 2vw, 24px);
  --radius: 18px;
  --radius-sm: 10px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--ground);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

/* ─── frame ─────────────────────────────────────────────────────────────── */

.masthead,
.shell,
.footer {
  width: 100%;
  max-width: calc(var(--shell) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 44px;
  align-items: center;
  text-decoration: none;
}

.wordmark__mark {
  font: 700 20px/1 var(--display);
  letter-spacing: 0.04em;
}

.wordmark__rest {
  font-weight: 500;
  font-size: 15px;
  color: var(--muted);
}

.masthead__label,
.crumbs {
  font-size: 14px;
  color: var(--muted);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--ink);
}

.crumbs [aria-current] {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell {
  flex: 1;
  padding-block: clamp(32px, 6vw, 72px) clamp(48px, 8vw, 96px);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

/* ─── the grid ──────────────────────────────────────────────────────────── */

.intro {
  display: grid;
  gap: 14px;
  margin-bottom: clamp(28px, 5vw, 56px);
}

.intro__title {
  margin: 0;
  font: 700 clamp(44px, 9vw, 104px) / 0.95 var(--display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.intro__lede {
  margin: 0;
  max-width: 44ch;
  font-size: clamp(17px, 2vw, 20px);
  color: var(--muted);
  text-wrap: pretty;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tile {
  display: grid;
  gap: 4px;
  text-decoration: none;
  border-radius: var(--radius);
}

.tile__art {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
  margin-bottom: 8px;
  transition:
    transform 260ms var(--ease),
    box-shadow 260ms var(--ease);
}

.tile__art img,
.tile__art video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile__art video {
  opacity: 0;
  transition: opacity 220ms var(--ease);
}

.tile.is-playing .tile__art video {
  opacity: 1;
}

.tile__name {
  font-weight: 600;
  font-size: 17px;
  line-height: 1.3;
}

.tile__meta span {
  margin-inline: 3px;
}

.tile__meta {
  font-size: 14px;
  color: var(--muted);
}

.tile:hover .tile__art,
.tile:focus-visible .tile__art {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 2px var(--ink),
    0 18px 40px -18px rgb(0 0 0 / 0.9);
}

.tile:focus-visible {
  outline: none;
}

/* ─── one game ──────────────────────────────────────────────────────────── */

.game {
  display: grid;
  gap: clamp(28px, 4vw, 48px);
}

/*
 * The play area is as big as the portals make theirs. Poki reviews and plays
 * at 640x360, 836x470 and 1031x580; CrazyGames from 907x510 up to 1920x1080
 * (handbook 3.10). So: the full width of the page, up to 1200 wide, and never
 * so tall that the bar under it falls below the first screen. That gives
 * about 1060x600 on a 1366x768 laptop and 1200x675 on a 1920x1080 monitor,
 * and never less than 640 wide where the window has room for it.
 */
.game__play,
.game__about {
  /* header, the top of the page and the bar under the stage */
  --chrome: 170px;
  width: clamp(
    min(100%, 640px),
    calc((100svh - var(--chrome)) * (var(--aspect))),
    min(100%, 1200px)
  );
  margin-inline: auto;
}

.page--game .shell {
  padding-top: 24px;
}

/* The words share the stage's edges, so the page reads as one column. */
.game__about {
  display: grid;
  gap: 32px 64px;
  align-items: start;
}

@media (min-width: 900px) {
  .game__about {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .game__about .howto {
    padding-top: 0;
    border-top: 0;
  }
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--aspect);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--line);
}

.stage__backdrop {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  max-width: none;
  object-fit: cover;
  filter: blur(48px) saturate(1.2) brightness(0.45);
}

.stage__cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3%, 28px);
  padding: 16px;
}

/* Sized by the stage's height, which is the dimension that runs out. */
.stage__thumb {
  height: min(52%, 260px);
  width: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -20px rgb(0 0 0 / 0.9);
}

.stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--ground);
}

.stage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 12px;
}

.stage-bar__hint {
  font-size: 14px;
  color: var(--muted);
}

.stage-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-light);
  font: 600 15px/1 var(--body);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms var(--ease),
    background 160ms var(--ease);
}

.button:hover {
  transform: translateY(-1px);
}

.button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.button--play {
  min-height: 56px;
  padding: 0 34px 0 28px;
  font-size: 18px;
}

.button--quiet {
  background: var(--raised-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.button--quiet:hover {
  background: var(--line);
}

.game__genre {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.game__title {
  margin: 0 0 18px;
  font: 700 clamp(32px, 4.4vw, 44px) / 1.05 var(--display);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.game__premise {
  margin: 0 0 16px;
  font-size: 19px;
  line-height: 1.45;
}

.game__description {
  margin: 0 0 32px;
  max-width: 62ch;
  color: var(--muted);
}

.howto {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.howto__title,
.more__title {
  margin: 0 0 16px;
  font: 600 13px/1.2 var(--body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.howto__list {
  display: grid;
  gap: 18px;
  margin: 0;
}

.howto__list dt {
  font-weight: 600;
  margin-bottom: 4px;
}

.howto__list dd {
  margin: 0;
  color: var(--muted);
}

.more {
  margin-top: clamp(56px, 8vw, 96px);
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.missing {
  display: grid;
  align-content: start;
  gap: 16px;
}

.missing p {
  margin: 0;
}

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

  .tile:hover .tile__art,
  .tile:focus-visible .tile__art,
  .button:hover {
    transform: none;
  }
}
