/* PixelScientists – site styles.
   Colours come from the same palette as our games. Frames and buttons are the
   game's own 9-slice pixel sprites (border-image), drawn at 3x. */

@font-face {
  font-family: "Press Start 2P";
  src: url("../fonts/press-start-2p-latin-400-normal.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("../fonts/pixelify-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Pixelify Sans";
  src: url("../fonts/pixelify-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --ink: #0e0b14;
  --night: #1b1520;
  --plum: #2b2233;
  --plum-light: #3d3148;
  --muted: #a596b0;
  --bone: #f0e6cc;
  --white: #f4eee8;
  --gold: #f2c14e;
  --gold-light: #fff0a0;
  --gold-dark: #d6902a;
  --necro: #4fc28c;
  --necro-light: #9cf2c0;
  --magic: #b26ef0;
  --magic-light: #e2b8ff;
  --sky: #8fb4d8;
  --red: #e04f4f;
  --px: 3px;               /* one art pixel on the page */
  --max: 1120px;
  --head: "Press Start 2P", ui-monospace, monospace;
  --body: "Pixelify Sans", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--body);
  font-size: 20px;
  line-height: 1.5;
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
}

img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--gold-light); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* "Press Start 2P" is drawn on an 8 x 8 grid: only sizes in steps of 8 px keep every pixel square
   and the same size. So: 16, 24, 32, 48 – never in between. */
h1, h2, h3 { font-family: var(--head); font-weight: 400; line-height: 1.5; margin: 0 0 0.6em; letter-spacing: 0; }
h1 { font-size: 40px; }
h2 { font-size: 24px; }
h3 { font-size: 16px; }
@media (max-width: 720px) { h1 { font-size: 24px; } }
p { margin: 0 0 1em; }

.eyebrow {
  font-family: var(--head); font-size: 16px; color: var(--necro-light);
  text-transform: uppercase; letter-spacing: 0; margin-bottom: 16px; display: inline-block;
}
.gold-text {
  color: var(--gold);
  background: linear-gradient(180deg, var(--gold-light) 0 40%, var(--gold) 40% 70%, var(--gold-dark) 70%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 0 #4a2470);
}

/* ------------------------------------------------------------------ pixel frames & buttons */
.panel {
  border: 18px solid transparent;
  border-image: url("../ui/panel.png") 6 fill / 18px stretch;
  padding: 10px 14px;
}
.panel-light { border-image-source: url("../ui/panel_light.png"); color: var(--ink); }

.btn {
  --frame: url("../ui/button_gold.png");
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--head); font-size: 16px; line-height: 1; text-decoration: none;
  color: var(--ink); text-shadow: 0 2px 0 var(--gold-light);
  border: 15px solid transparent; border-image: var(--frame) 5 fill / 15px stretch;
  padding: 4px 10px; cursor: pointer; background: none;
  transition: transform 80ms steps(2);
}
.btn:hover { --frame: url("../ui/button_gold_hover.png"); color: var(--ink); }
.btn:active { --frame: url("../ui/button_gold_pressed.png"); transform: translateY(3px); }
.btn img { width: 24px; height: 24px; }
.btn-dark { --frame: url("../ui/button_dark.png"); color: var(--bone); text-shadow: 0 2px 0 var(--ink); }
.btn-dark:hover { --frame: url("../ui/button_dark_hover.png"); color: var(--white); }
.btn[aria-disabled="true"] { opacity: 0.55; cursor: default; pointer-events: none; }
.btn small { font-family: var(--body); font-size: 15px; text-shadow: none; opacity: 0.85; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.btn { line-height: 1.5; }                         /* a button that has to wrap still reads well */
@media (max-width: 480px) { .wide-only { display: none; } }

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 11, 20, 0.86); backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--plum);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { width: 222px; height: 48px; }          /* the 74 x 16 logo at exactly 3x */
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { color: var(--bone); text-decoration: none; font-size: 19px; }
.nav a:hover { color: var(--gold); }
.nav a.btn { color: var(--ink); }                   /* .nav a would make it light-on-gold */
.nav .btn { font-size: 16px; }
@media (max-width: 720px) {
  .nav a:not(.btn) { display: none; }
  .brand img { width: 148px; height: 32px; }        /* 2x on phones */
}

/* ------------------------------------------------------------------ hero */
.hero { position: relative; min-height: min(78vh, 720px); display: flex; align-items: center; overflow: hidden; }
.hero canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 75% 60%;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(14,11,20,0.92) 0%, rgba(14,11,20,0.75) 38%, rgba(14,11,20,0) 62%),
    linear-gradient(0deg, var(--ink) 0%, rgba(14,11,20,0) 22%);
}
.hero .wrap { position: relative; z-index: 2; padding-top: 48px; padding-bottom: 64px; }
.hero-copy { max-width: 660px; }
.hero-copy p { max-width: 560px; font-size: 23px; color: var(--bone); margin-bottom: 30px; text-shadow: 0 2px 0 var(--ink); }
@media (max-width: 720px) {
  /* phones: the lab becomes a banner on top, the text sits below it */
  .hero { display: block; min-height: 0; }
  .hero canvas { position: relative; display: block; height: 300px; object-position: 64% 78%; }
  .hero::after { inset: 0 0 auto 0; height: 300px; background: linear-gradient(0deg, var(--ink) 0%, rgba(14,11,20,0) 35%); }
  .hero .wrap { padding-top: 8px; padding-bottom: 48px; }
  .hero-copy p { font-size: 20px; }
}

/* ------------------------------------------------------------------ sections */
section { padding: 88px 0; position: relative; }
.section-title { display: flex; align-items: center; gap: 14px; margin-bottom: 36px; }
.section-title img { width: 48px; height: 48px; }
.section-title h2 { margin: 0; }

/* starfield divider */
.stars-strip { height: 9px; background:
  radial-gradient(circle, var(--plum-light) 1.5px, transparent 2px) 0 0 / 27px 9px; opacity: .8; }

/* ------------------------------------------------------------------ game feature */
.game { display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .game { grid-template-columns: 1fr; } }
.screens { position: relative; }
.screens .panel { padding: 0; }
.screens .shot { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; }
/* screenshots are shown smaller than they are: smooth scaling looks better than pixel-dropping */
.screens img, .teaser img { image-rendering: auto; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.thumbs button { padding: 0; border: 3px solid var(--plum-light); background: none; cursor: pointer; aspect-ratio: 16/9; }
.thumbs button[aria-current="true"] { border-color: var(--gold); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.game-title { font-family: var(--head); font-size: 48px; margin-bottom: 8px; }
@media (max-width: 720px) { .game-title { font-size: 32px; } }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 20px; padding: 0; list-style: none; }
.tags li {
  font-size: 16px; padding: 2px 10px; background: var(--plum); color: var(--magic-light);
  box-shadow: 0 -3px 0 var(--plum), 0 3px 0 var(--plum), -3px 0 0 var(--plum), 3px 0 0 var(--plum);
}
.platforms { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 18px; color: var(--muted); font-size: 17px; }
.platforms span::before { content: "■ "; color: var(--necro); }
.platforms span.soon::before { color: var(--plum-light); }

/* walking sprites on the game card */
.parade { display: flex; gap: 6px; align-items: flex-end; height: 96px; margin: 6px 0 4px; }
.parade img { width: auto; height: 96px; }
.parade img.sk { height: 72px; }

/* ------------------------------------------------------------------ the three games */
.game-block + .game-block { margin-top: 112px; }
.game.flip { grid-template-columns: 1fr 1.25fr; }
.game.flip > .screens { order: 2; }
@media (max-width: 900px) { .game.flip { grid-template-columns: 1fr; } .game.flip > .screens { order: 0; } }
.screens .panel { position: relative; }
.badge {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%); white-space: nowrap; z-index: 2;
  font-family: var(--head); font-size: 8px; line-height: 1; text-transform: uppercase;
  color: var(--necro-light); background: var(--ink); padding: 8px 10px;
  box-shadow: 0 0 0 3px var(--plum-light);
}
.badge-live { color: var(--gold-light); box-shadow: 0 0 0 3px var(--gold-dark); }
.platforms span.dev::before { color: var(--gold); }
.shot.swap { animation: swap 280ms steps(4); }
@keyframes swap { from { opacity: 0.25; } to { opacity: 1; } }

/* sprite sheets, stepped through frame by frame (--sheet = width of the whole scaled strip) */
.sprite {
  display: inline-block; background-repeat: no-repeat; background-position: 0 0;
  image-rendering: pixelated; animation: sheet var(--speed, 0.6s) steps(var(--frames, 2)) infinite;
}
@keyframes sheet { to { background-position: calc(-1 * var(--sheet)) 0; } }
.parade-items { gap: 24px; align-items: flex-end; }
.sprite.lantern { width: 96px; height: 72px; background-image: url("../img/amaze/lantern.png"); background-size: 192px 72px;
  --sheet: 192px; --speed: 0.5s; filter: drop-shadow(0 0 14px rgba(242, 193, 78, 0.55)); }
.sprite.key     { width: 96px; height: 42px; background-image: url("../img/amaze/key.png"); background-size: 192px 42px;
  --sheet: 192px; --speed: 2.4s; margin-bottom: 15px; }
.sprite.bell    { width: 96px; height: 72px; background-image: url("../img/amaze/bell.png"); background-size: 192px 72px;
  --sheet: 192px; --speed: 1.2s; }
.parade-chase { gap: 0; align-items: flex-end; }
.sprite.knight { width: 72px; height: 96px; background-image: url("../img/roguee/knight_walk_side.png"); background-size: 288px 96px;
  --sheet: 288px; --frames: 4; --speed: 0.5s; margin-left: 12px; }
.sprite.ghoul  { width: 72px; height: 72px; background-image: url("../img/roguee/ghoul_walk.png"); background-size: 288px 72px;
  --sheet: 288px; --frames: 4; --speed: 0.66s; margin-left: -18px; }
.sprite.ghoul.g2 { animation-delay: -0.33s; }
.sprite.bat    { width: 48px; height: 48px; background-image: url("../img/roguee/bat_flap.png"); background-size: 192px 48px;
  --sheet: 192px; --frames: 4; --speed: 0.4s; align-self: flex-start; margin-top: 6px; }

/* ------------------------------------------------------------------ motion helpers (see js/fx.js) */
.reveal.waiting { opacity: 0; transform: translateY(24px); }
.reveal.shown { animation: rise 480ms steps(6) both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.fx-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 60; }
.px { position: absolute; pointer-events: none; }
.flask { position: relative; display: inline-block; cursor: pointer; }
.flask img { width: 96px; height: 96px; }
.flask-big img { width: 128px; height: 128px; margin: 0 auto 20px; }
.stars-strip { position: relative; }
.stars-strip::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle, var(--gold-light) 1.5px, transparent 2px) 13px 0 / 81px 9px;
  animation: twinkle 4s steps(2) infinite;
}
@keyframes twinkle { 0%, 60% { opacity: 0; } 70%, 90% { opacity: 0.7; } }

/* ------------------------------------------------------------------ lab notes (values) */
.notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 900px) { .notes { grid-template-columns: 1fr; } }
.note img { width: 48px; height: 48px; margin-bottom: 12px; }
.note h3 { color: var(--gold); margin-bottom: 10px; }
.note p { margin: 0; color: var(--bone); font-size: 19px; }

/* ------------------------------------------------------------------ creators call */
.creators { display: grid; grid-template-columns: auto 1fr auto; gap: 26px; align-items: center; }
.creators img { width: 96px; height: 96px; }
@media (max-width: 760px) { .creators { grid-template-columns: 1fr; text-align: left; } }
.creators p { margin: 0; }

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 3px solid var(--plum); padding: 34px 0 44px; color: var(--muted); font-size: 17px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 18px 30px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a, .linklike { color: var(--muted); }
.site-footer a:hover, .linklike:hover { color: var(--gold); }
.linklike { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }
.foot-brand { display: flex; align-items: center; gap: 10px; }
.foot-brand img { width: 32px; height: 32px; }

/* ------------------------------------------------------------------ legal pages */
.legal { padding: 64px 0 90px; }
.legal .wrap { max-width: 820px; }
.legal h1 { font-size: 32px; }
@media (max-width: 720px) { .legal h1 { font-size: 24px; } }
.legal h2 { font-size: 16px; margin-top: 2.2em; color: var(--gold); }
.legal p, .legal li { font-size: 19px; }
.legal .summary { margin: 26px 0 10px; }
.legal address { font-style: normal; }
.todo { background: var(--red); color: var(--white); padding: 0 6px; }

/* ------------------------------------------------------------------ consent dialog */
.consent {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 100; max-width: 620px; margin: 0 auto;
}
.consent[hidden] { display: none; }
.consent h2 { font-size: 16px; color: var(--gold); }
.consent p { font-size: 18px; }
.consent label { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 18px; }
.consent input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--necro); margin-top: 4px; }
.consent .btn { font-size: 16px; }
.consent .btn-row { margin-top: 14px; }

/* ------------------------------------------------------------------ 404 */
.lost { min-height: 70vh; display: grid; place-items: center; text-align: center; }
.lost img { width: 128px; height: 128px; margin: 0 auto 20px; }

/* ------------------------------------------------------------------ motion */
.pop-in { animation: pop 400ms steps(6) both; }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.bob { animation: bob 1.2s steps(2) infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) {
  .pop-in, .bob, .sprite, .stars-strip::after, .shot.swap { animation: none; }
  .reveal.waiting { opacity: 1; transform: none; }
}
