/* RL Studios. The colours are the logo's own (img/rl-studios-*.svg). */

@font-face {
  font-family: 'Press Start 2P';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/press-start-2p-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2');
}

:root {
  /* The logo: the R, the L, the line and STUDIOS, and the background. */
  --red: #D8261F;
  --blue: #1B49B5;
  --cream: #F2E8D5;
  --black: #151515;

  --panel: #1f1f1f;
  --panel-quiet: #1a1a1a;
  --chip: #1f2a47;     /* a dark of the logo's blue */
  --line: #2a2a2a;
  --line-panel: #2f2f2f;
  --muted: #cfc8b4;    /* secondary text (10.9:1 on black) */
  --dim: #a39d8c;      /* footer text (6.8:1) */

  /* Press Start 2P is drawn on an 8-pixel grid: at multiples of 8px its
     pixels land on whole screen pixels (12px does on any 2x screen). */
  --px-s: 12px;
  --px-m: 16px;
  --px-l: 24px;
  --px-xl: 48px;

  /* One spacing scale. */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
  --width: 1120px;
  --gutter: 24px;
  color-scheme: dark;
  accent-color: var(--blue);
  scrollbar-color: #3d3d3d var(--black);
}

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

/* The page stays hidden (on the intro's dark) until the intro covers it (js/intro.js). */
html.intro body > :not(.rlsi) { visibility: hidden; }

html { background: var(--black); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--black);
  color: var(--cream);
  font-family: var(--body);
  -webkit-text-size-adjust: 100%;
}
::selection { background: var(--blue); color: var(--cream); }

a { color: var(--cream); text-underline-offset: 4px; text-decoration-thickness: 2px; }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 4px; }

.wrap {
  max-width: var(--width);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* Everything in the pixel font: no smoothing, so its pixels stay square. */
.pixel, .site-nav, .tag, .btn, .hero h1, .featured-info h2, .section-title,
.game-tile-title, .game-tile-status, .game-over h1, .intro-skip-hint {
  font-family: var(--pixel);
  font-weight: 400;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}
/* Labels, buttons and titles show in capitals; the source is in ordinary
   case, so screen readers say words instead of spelling them out. */
.pixel, .site-nav, .tag, .btn, .section-title, .game-tile-title,
.game-tile-status, .game-over h1, .intro-skip-hint { text-transform: uppercase; }

/* Read aloud, not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Header ------------------------------------------------------------- */
.site-header { border-bottom: 2px solid var(--line); }
.site-header .wrap {
  padding-top: var(--s-4);
  padding-bottom: var(--s-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.brand { display: block; line-height: 0; }
.brand img { display: block; height: 80px; width: auto; }
.site-nav {
  display: flex;
  gap: var(--s-5);
  font-size: var(--px-s);
  line-height: 16px;
}
.site-nav a {
  text-decoration: none;
  padding: 14px 0; /* (44px tall: easy to tap) */
  border-bottom: 4px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--red); }

/* --- Labels and buttons ------------------------------------------------- */
/* A label: cream pixel text after a red pixel. Not a filled block: filled
   blue is only for things you can press. */
.tag {
  align-self: flex-start;
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-3);
  color: var(--cream);
  font-size: var(--px-s);
  line-height: 20px;
}
.tag::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--red);
}
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 56px;
  padding: 0 var(--s-5);
  text-decoration: none;
  font-size: var(--px-m);
  line-height: 20px;
}
/* The main button: the logo's blue, with a red shadow (the R behind the L).
   Pixel art has no blur, so the shadow is a solid block. */
.btn-play {
  background: var(--blue);
  color: var(--cream);
  box-shadow: 4px 4px 0 var(--red);
}
.btn-play:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--red); }
.btn-play:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--red); }
.btn-ghost { border: 2px solid var(--cream); }
/* On the red-shadowed things, the focus ring is cream (a red one would merge with the shadow). */
.btn-play:focus-visible, a.game-tile:focus-visible { outline-color: var(--cream); outline-offset: 6px; }
.btn-ghost:hover { border-color: var(--red); }

/* --- Hero ---------------------------------------------------------------- */
.hero {
  padding-top: var(--s-9);
  padding-bottom: var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}
.hero h1 {
  margin: 0;
  font-size: var(--px-xl);
  line-height: 64px;
  max-width: 820px;
  text-wrap: balance;
}
.hero p {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 34em;
  text-wrap: pretty;
}
.actions { display: flex; gap: var(--s-4); flex-wrap: wrap; margin-top: var(--s-2); }

/* --- Featured game ------------------------------------------------------- */
.featured { padding-bottom: var(--s-9); }
.featured-card {
  display: flex;
  flex-wrap: wrap;
  background: var(--panel);
  border: 2px solid var(--line-panel);
}
/* When the text beside it is taller than the scene, the scene sits in the
   middle: the night sky (its top row) carries on above it, and the forest
   floor and purple waterfalls (3 of its 64 columns, each side) below it. */
.featured-art {
  flex: 1 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(#3b1f5c 50%, transparent 50%),
    linear-gradient(to right, #a855f7 0 4.6875%, #1f5130 4.6875% 95.3125%, #a855f7 95.3125%);
}
.featured-art svg { display: block; width: 100%; height: auto; shape-rendering: crispEdges; }
/* The dragon's green fire flickers now and then, like the dragon on The
   Dragon's Claw's title screen breathing a puff of fire. Its pixels and
   colours are the scene's own; with reduce motion on, it holds still. */
.fire { animation: fire-flicker 4.2s steps(1) infinite; }
.fire-tip { animation: fire-tip 4.2s steps(1) infinite; }
@keyframes fire-flicker {
  0%, 70% { opacity: 1; }
  72% { opacity: 0.35; }
  75% { opacity: 1; }
  78% { opacity: 0.6; }
  81%, 100% { opacity: 1; }
}
@keyframes fire-tip {
  0%, 70% { opacity: 1; }
  72% { opacity: 0; }
  75% { opacity: 1; }
  78% { opacity: 0; }
  81%, 100% { opacity: 1; }
}
.featured-info {
  flex: 1 1 340px;
  min-width: 0;
  padding: var(--s-5) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.featured-info h2 {
  margin: var(--s-2) 0 0;
  font-size: var(--px-l);
  line-height: 32px;
  text-wrap: balance;
}
.byline { margin-top: calc(var(--s-2) * -1); font-size: 1rem; line-height: 1.5; color: var(--muted); }
.featured-info p { margin: 0; font-size: 1.0625rem; line-height: 1.6; text-wrap: pretty; }
.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.chips li {
  padding: 6px 10px;
  background: var(--chip);
  border: 2px solid var(--chip);
  color: var(--cream);
  font-size: 0.875rem;
  line-height: 1;
}
/* What it plays with, not what it is: outlined in red. */
.chips li.chip-feature { background: transparent; border-color: var(--red); }
.featured-info .spacer { flex-grow: 1; min-height: var(--s-2); }
.featured-info .btn { align-self: flex-start; }

/* --- All games ------------------------------------------------------------ */
.games {
  padding-bottom: var(--s-9);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}
.section-title {
  margin: 0;
  font-size: var(--px-l);
  line-height: 32px;
}
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.game-tile {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px solid var(--line-panel);
  text-decoration: none;
  color: var(--cream);
}
/* A playable tile lifts like the PLAY buttons, onto the same red block shadow. */
a.game-tile:hover,
a.game-tile:focus-visible {
  border-color: var(--red);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--red);
}
a.game-tile:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--red); }
.game-tile.is-soon { background: var(--panel-quiet); border: 2px dashed #3a3a3a; }
.game-tile svg,
.game-tile img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; shape-rendering: crispEdges; image-rendering: pixelated; }
.game-tile-text { padding: var(--s-4) var(--s-5) var(--s-5); display: flex; flex-direction: column; gap: var(--s-2); flex-grow: 1; }
.game-tile-title { font-size: var(--px-m); line-height: 24px; }
.game-tile-blurb { font-size: 0.9375rem; line-height: 1.45; color: var(--muted); }
.game-tile-status {
  margin-top: auto;
  padding-top: var(--s-2);
  font-size: var(--px-s);
  line-height: 12px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
/* The ▶: a little red triangle, drawn (the pixel font has none). It steps forward on hover. */
.game-tile-status.is-play::before {
  content: '';
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--red);
}
a.game-tile:hover .game-tile-status.is-play::before { transform: translateX(4px); }
a.game-tile:hover .game-tile-status.is-play { gap: var(--s-3); }
.game-tile-status.is-soon { color: var(--muted); }

/* --- For parents -------------------------------------------------------- */
.parents { border-top: 2px solid var(--line); background: var(--panel-quiet); }
.parents .wrap {
  padding-top: var(--s-8);
  padding-bottom: var(--s-8);
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-6) var(--s-5);
  margin: 0;
}
.fact { display: flex; flex-direction: column; gap: var(--s-2); }
.fact dt {
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
}
/* Each fact's pixel picture (coin, phone, save disk, controller): 4px pixels. */
.fact-icon { display: block; height: 32px; width: auto; shape-rendering: crispEdges; }
.fact dd { margin: 0; font-size: 1rem; line-height: 1.6; color: var(--muted); }

/* --- Footer ------------------------------------------------------------- */
.site-footer { border-top: 2px solid var(--line); }
.site-footer .wrap {
  padding-top: var(--s-6);
  padding-bottom: var(--s-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--dim);
}
.site-footer .pixel { font-size: var(--px-s); line-height: 16px; }

/* --- 404: GAME OVER ------------------------------------------------------ */
.game-over {
  min-height: 60vh;
  padding-top: var(--s-9);
  padding-bottom: var(--s-9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-5);
  text-align: center;
}
.game-over .hearts { width: 150px; height: auto; shape-rendering: crispEdges; }
.game-over h1 {
  margin: 0;
  font-size: 72px;
  line-height: 1.2;
  color: var(--red); /* (big text: 3.7:1 on black is plenty) */
  text-shadow: 0.125em 0.125em 0 var(--blue); /* (one font pixel) */
}
.game-over p { margin: 0; font-size: 1.25rem; line-height: 1.6; color: var(--muted); }
.game-over .continue { margin-top: var(--s-3); font-size: var(--px-m); line-height: 24px; color: var(--cream); animation: blink 1s steps(1) infinite; }
.game-over .actions { justify-content: center; }
@keyframes blink { 50% { opacity: 0; } }

/* --- The intro's skip hint (js/intro.js) ---------------------------------- */
.intro-skip-hint {
  position: absolute;
  left: var(--s-4);
  right: var(--s-4);
  bottom: var(--s-6);
  margin: 0;
  text-align: center;
  font-size: var(--px-s);
  line-height: 20px;
  color: var(--dim);
  opacity: 0;
  animation: hint-in 0.3s steps(3) 1.2s forwards;
}
@keyframes hint-in { to { opacity: 1; } }

/* --- Motion: quick, in whole steps, like a game. None with reduce motion. */
.btn-play, a.game-tile, .game-tile-status.is-play::before {
  transition: transform 90ms steps(2), box-shadow 90ms steps(2), border-color 90ms steps(2);
}
@media (prefers-reduced-motion: reduce) {
  .fire, .fire-tip, .game-over .continue { animation: none; }
  .btn-play, a.game-tile, .game-tile-status.is-play::before { transition: none; }
}

/* --- Tablets ------------------------------------------------------------ */
@media (max-width: 1000px) {
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .hero h1 { font-size: 40px; line-height: 56px; }
  .game-over h1 { font-size: 48px; }
}

/* --- Phones ------------------------------------------------------------- */
@media (max-width: 600px) {
  :root { --gutter: 16px; }
  .brand img { height: 64px; }
  .site-nav { gap: 20px; }
  .hero { padding-top: var(--s-7); padding-bottom: var(--s-7); gap: var(--s-4); }
  .hero h1 { font-size: 32px; line-height: 44px; }
  .hero p { font-size: 1.125rem; }
  .btn { min-height: 52px; padding: var(--s-2) var(--s-4); font-size: var(--px-s); line-height: 20px; }
  .featured { padding-bottom: var(--s-8); }
  .featured-info { padding: var(--s-5) var(--s-4) var(--s-6); }
  .games { padding-bottom: var(--s-8); }
  .parents .wrap { padding-top: var(--s-7); padding-bottom: var(--s-7); }
  .facts { grid-template-columns: 1fr; gap: var(--s-5); }
  .game-over { padding-top: var(--s-7); padding-bottom: var(--s-7); }
  .game-over h1 { font-size: 32px; }
}
/* Smaller phones: the headline on two lines, as on a computer. */
@media (max-width: 430px) {
  .hero h1 { font-size: 24px; line-height: 36px; }
}
@media (max-width: 360px) {
  .site-nav { gap: var(--s-3); }
}
