@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-6px); } }

/* ================= header ================= */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center;
  transition: height 0.25s var(--ease-out);
}
/* Backdrop lives on a pseudo-element: backdrop-filter on the header itself would
   turn it into the containing block for the fixed mobile nav drawer. */
.header::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background: rgba(8, 19, 15, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 var(--px) 0 0 var(--line);
  opacity: 0;
  transition: opacity 0.25s;
}
.header.is-scrolled { height: 60px; }
.header.is-scrolled::before { opacity: 1; }
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__mark { width: 56px; height: auto; }
.brand__name {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  line-height: 1.3;
  color: var(--text);
  text-shadow: 0 2px 0 var(--shadow);
}
.brand:hover .brand__mark { animation: bob 0.5s steps(2) infinite; }

.nav__list { display: flex; align-items: center; gap: clamp(16px, 3vw, 36px); }
.nav__link {
  position: relative;
  padding: 8px 0;
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  text-decoration: none;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.2s;
}
.nav__link::after {
  content: "";
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: var(--px);
  background: var(--firefly);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.2s steps(4);
}
.nav__link:hover, .nav__link.is-active { color: var(--text); }
.nav__link:hover::after, .nav__link.is-active::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  padding: 0; border: 0; background: transparent; cursor: pointer;
  color: var(--text);
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: ""; display: block; width: 24px; height: var(--px);
  background: currentColor; margin: auto;
  transition: transform 0.2s steps(3), background 0.2s;
}
.nav-toggle span { position: relative; }
.nav-toggle span::before { position: absolute; top: -8px; left: 0; }
.nav-toggle span::after { position: absolute; top: 8px; left: 0; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; inset: 0; z-index: -1;
    display: grid; place-content: center;
    background: var(--bg-0);
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s steps(4), visibility 0s 0.25s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
  .nav__list { flex-direction: column; gap: 32px; text-align: center; }
  .nav__link { font-size: 0.95rem; }
  .brand__name { font-size: 0.6rem; }
}

/* ================= hero ================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid; align-items: center;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(to bottom, #040a08 0%, #0a1d19 45%, #14403a 100%);
}
.hero__layer { position: absolute; left: 0; width: 100%; will-change: transform; pointer-events: none; }
.hero__stars { top: -50%; height: 150%; z-index: -6; }
.hero__stars--twinkle { animation: twinkle 3.2s steps(1) infinite; }
.hero__moon {
  top: 16%; left: auto; right: 12%; width: clamp(64px, 9vw, 112px); z-index: -5;
  filter: drop-shadow(0 0 32px rgba(193, 220, 63, 0.35));
}
.hero__hills { bottom: 0; }
.hero__hills--far { height: 46%; z-index: -4; }
.hero__hills--mid { height: 36%; z-index: -3; }
.hero__hills--near { height: 26%; z-index: -2; }
.hero__fireflies { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero__content {
  position: relative;
  padding: calc(var(--header-h) + 32px) 0 120px;
  display: grid; justify-items: center; gap: 28px; text-align: center;
}
.hero__logo {
  width: clamp(256px, 42vw, 420px); height: auto; aspect-ratio: 1;
  cursor: pointer;
  filter: drop-shadow(0 6px 0 rgba(4, 11, 9, 0.55)) drop-shadow(0 0 36px rgba(193, 220, 63, 0.18));
}
.hero__tagline {
  min-height: 3.8em;
  max-width: 38em;
  font-family: var(--font-pixel);
  font-size: clamp(0.62rem, 1.7vw, 0.95rem);
  line-height: 1.9;
  color: var(--text);
  text-shadow: 0 2px 0 var(--shadow);
}
.hero__tagline.is-pending { opacity: 0; }
.hero__tagline::after {
  content: "";
  display: inline-block; width: 0.55em; height: 1em; margin-left: 4px;
  vertical-align: -0.12em; background: var(--firefly);
  animation: blink 1s steps(1) infinite;
}
.hero__cta { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; margin-top: 8px; }

.hero__scroll {
  position: absolute; left: 50%; bottom: 28px; z-index: 1;
  width: 44px; height: 44px; margin-left: -22px;
  display: grid; place-items: center;
  color: var(--firefly); text-decoration: none;
  animation: nudge 1.4s steps(3) infinite;
}
.hero__scroll svg { width: 24px; height: 24px; }
@keyframes nudge { 50% { transform: translateY(8px); } }

/* ================= games ================= */
.games__grid {
  display: grid; gap: clamp(28px, 4vw, 44px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}
.game {
  --accent: var(--firefly);
  position: relative;
  display: flex; flex-direction: column;
  --px-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  transition: transform 0.2s steps(3);
}
/* No tilt or zoom on hover: rotating or fractionally scaling pixel art blurs it. Whole-pixel lift only. */
.game:hover, .game:focus-within { --px-color: var(--accent); transform: translateY(-4px); }
.game__media { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: var(--bg-0); }
.game__media img { width: 100%; height: 100%; object-fit: cover; }

/* Title-logo art: the logo sits contained on a dark panel with a row of the game's own sprites below. */
.game__media--logo {
  display: flex; align-items: center; justify-content: center;
  padding: 44px 20px 76px;
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 65%),
    linear-gradient(to bottom, #0a1020, #131a2e);
}
.game__media--logo .game__logo { width: min(100%, 340px); height: auto; }
@media (max-width: 899px) { .game__media--logo .game__logo { width: min(64%, 260px); } }
.game__media--logo::after { display: none; }
.game__decor {
  position: absolute; left: 0; right: 0; bottom: 10px; z-index: 0;
  display: flex; justify-content: center; gap: clamp(6px, 2vw, 18px);
}
.game__decor img {
  width: clamp(36px, 7%, 56px); height: auto; aspect-ratio: 1; object-fit: contain;
  animation: hop 1.6s steps(3) infinite; animation-delay: calc(var(--i) * 0.28s);
}

/* "Art coming soon" placeholder for games without key art yet. */
.game__media--soon {
  display: grid; place-content: center; justify-items: center; gap: 14px;
  background:
    conic-gradient(rgba(255, 255, 255, 0.035) 25%, transparent 0 50%, rgba(255, 255, 255, 0.035) 0 75%, transparent 0) 0 0 / 8px 8px,
    radial-gradient(ellipse at 50% 45%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--bg-0);
}
.game__media--soon img { width: 112px; height: auto; opacity: 0.85; animation: bob 2s steps(2) infinite; }
.game__media--soon .game__soon { font-family: var(--font-pixel); font-size: 0.6rem; color: var(--text-dim); }
.game__media--soon::after { display: none; }
.game__media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8, 19, 15, 0.55), transparent 45%);
}
.game__status { position: absolute; left: 12px; top: 12px; z-index: 1; }
.game__body { display: grid; gap: 14px; padding: 24px; flex: 1; align-content: start; }
.game__title { font-family: var(--font-pixel); font-size: 1.05rem; line-height: 1.45; color: var(--accent); }
.game__tagline { font-size: 0.8rem; font-family: var(--font-pixel); line-height: 1.6; color: var(--text); }
.game__blurb { color: var(--text-dim); font-size: 0.98rem; }
.game__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.game__link {
  margin-top: 8px; justify-self: start;
  font-family: var(--font-pixel); font-size: 0.62rem; text-decoration: none; color: var(--accent);
}
.game__link::after { content: " >"; display: inline-block; transition: transform 0.15s steps(2); }
.game__link:hover::after { transform: translateX(6px); }
.game__link::before { content: ""; position: absolute; inset: 0; z-index: 2; } /* whole card clickable */

@media (min-width: 900px) {
  .games__grid { grid-template-columns: repeat(2, 1fr); }
  .game--featured { grid-column: 1 / -1; flex-direction: row; }
  .game--featured .game__media { flex: 1.35; aspect-ratio: auto; min-height: 380px; }
  .game--featured .game__body { flex: 1; padding: 40px; align-content: center; }
  .game--featured .game__title { font-size: 1.5rem; }
}

/* ================= gallery ================= */
.gallery { column-width: 210px; column-gap: 24px; }
.art {
  display: block; width: 100%; margin: 0 0 24px; padding: 0;
  break-inside: avoid; cursor: zoom-in;
  border: 0; position: relative; overflow: visible; color: inherit; text-align: left;
  --px-color: var(--line);
  transition: transform 0.2s steps(3);
}
.art img { width: 100%; background: var(--bg-0); }
.art__cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px 14px 12px;
  background: linear-gradient(to top, rgba(4, 11, 9, 0.9), transparent);
  font-size: 0.85rem; line-height: 1.4;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s steps(3);
}
.art:hover, .art:focus-visible { transform: translateY(-4px); --px-color: var(--firefly); }
.art:hover .art__cap, .art:focus-visible .art__cap { opacity: 1; transform: none; }
@media (hover: none) { .art__cap { opacity: 1; transform: none; } }

.lightbox {
  width: min(96vw, 1200px); max-height: 94vh;
  padding: 0; border: 0; background: transparent; color: var(--text); overflow: visible;
}
.lightbox::backdrop { background: rgba(4, 10, 8, 0.92); }
.lightbox[open] { animation: pop 0.25s steps(4); }
@keyframes pop { from { opacity: 0; transform: scale(0.94); } }
.lightbox__stage { display: grid; place-items: center; }
.lightbox__img { max-height: 78vh; max-width: 100%; box-shadow: 0 0 0 var(--px) var(--line); touch-action: pan-y; }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; }
.lightbox__cap { font-size: 0.95rem; color: var(--text-dim); }
.lightbox__count { font-family: var(--font-pixel); font-size: 0.6rem; color: var(--moon); }
.lightbox__btn {
  position: absolute; z-index: 1; width: 48px; height: 48px;
  border: 0; background: var(--surface); color: var(--text); cursor: pointer;
  font-family: var(--font-pixel); font-size: 1rem;
  box-shadow: 0 0 0 var(--px) var(--line);
}
.lightbox__btn:hover { background: var(--firefly); color: var(--bg-0); }
.lightbox__close { top: -8px; right: 0; transform: translateY(-100%); }
.lightbox__prev { left: 8px; top: 40%; }
.lightbox__next { right: 8px; top: 40%; }

/* ================= team ================= */
.team__grid {
  display: grid; gap: clamp(28px, 4vw, 48px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  max-width: 820px;
}
.member { display: grid; gap: 20px; padding: 28px; justify-items: start; --px-color: var(--line); transition: transform 0.2s steps(3); }
.member:hover { transform: translateY(-6px); --px-color: var(--moon); }
.member__frame {
  width: 144px; height: 144px; padding: 8px; background: var(--bg-0);
  display: grid; place-items: center;
  box-shadow: 0 0 0 var(--px) var(--moon);
}
.member__frame img { max-width: 100%; height: auto; }
.member:hover .member__frame img { animation: hop 0.5s steps(3) infinite; }
@keyframes hop { 50% { transform: translateY(-6px); } }
.member__name { font-family: var(--font-pixel); font-size: 0.95rem; line-height: 1.5; }
.member__role { margin-top: 8px; color: var(--text-dim); font-family: var(--font-pixel); font-size: 0.6rem; line-height: 1.7; }
.member__bio { color: var(--text-dim); font-size: 0.98rem; }
.member__links { display: flex; gap: 12px; flex-wrap: wrap; }
.member__links a { font-size: 0.85rem; color: var(--firefly); text-underline-offset: 4px; }

/* ================= contact ================= */
.contact__panel {
  display: grid; gap: clamp(28px, 4vw, 48px); padding: clamp(24px, 5vw, 56px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  --px-color: var(--firefly);
}
.contact__panel h3 { font-family: var(--font-pixel); font-size: 0.95rem; line-height: 1.5; margin-bottom: 16px; }
.contact__panel p { color: var(--text-dim); }
.socials { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.socials a {
  display: inline-flex; align-items: center; padding: 10px 14px;
  font-family: var(--font-pixel); font-size: 0.58rem; text-decoration: none;
  border: 2px solid var(--line); color: var(--text);
  transition: background 0.15s steps(2), color 0.15s steps(2), border-color 0.15s;
}
.socials a:hover { background: var(--firefly); color: var(--bg-0); border-color: var(--firefly); }

.signup { display: grid; gap: 14px; align-content: start; }
.signup__row { display: flex; flex-wrap: wrap; gap: 16px; }
.signup input[type="email"] {
  flex: 1 1 200px; min-width: 0; padding: 14px 16px;
  border: 0; background: var(--bg-0); color: var(--text);
  font: inherit; font-size: 1rem;
  box-shadow: 0 0 0 var(--px) var(--line);
}
.signup input::placeholder { color: #6f8a7d; }
.signup input:focus { outline: 0; box-shadow: 0 0 0 var(--px) var(--firefly); }

/* ================= footer ================= */
.footer {
  position: relative;
  padding: 56px 0 40px;
  background: var(--bg-0);
  border-top: var(--px) solid var(--line);
  overflow: hidden;
}
.footer__inner { display: grid; gap: 28px; justify-items: center; text-align: center; }
.footer__nav { display: flex; flex-wrap: wrap; gap: 20px 32px; justify-content: center; }
.footer__nav a { font-family: var(--font-pixel); font-size: 0.6rem; color: var(--text-dim); text-decoration: none; text-transform: uppercase; }
.footer__nav a:hover { color: var(--firefly); }
.footer__copy { font-size: 0.85rem; color: var(--text-dim); }
.crawler {
  position: absolute; left: 0; bottom: 8px; width: 33px; padding: 0;
  border: 0; background: transparent; cursor: pointer;
}
.crawler img { width: 100%; }
.crawler.is-running { animation: scurry 5s steps(40) forwards; }
@keyframes scurry { from { transform: translateX(-40px); } to { transform: translateX(calc(100vw + 40px)); } }

/* ================= responsive tweaks ================= */
@media (max-width: 560px) {
  .hero__content { padding-bottom: 96px; }
  .btn { padding: 14px 16px; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: -64px; }
  .lightbox__prev { left: 0; }
  .lightbox__next { right: 0; }
  .lightbox__bar { justify-content: center; text-align: center; flex-direction: column; margin-bottom: 72px; }
}

/* ================= signup extras, toasts ================= */
.signup__legal { font-size: 0.72rem; line-height: 1.5; color: var(--text-dim); }
.signup__legal a { color: inherit; text-underline-offset: 3px; }
.grecaptcha-badge { visibility: hidden; } /* allowed because the legal text above is shown */

.toasts {
  position: fixed; z-index: 400;
  left: 16px; right: 16px; bottom: 16px;
  display: grid; gap: 14px; justify-items: end;
  pointer-events: none;
}
.toast {
  --px-color: var(--firefly);
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 14px;
  width: min(100%, 420px);
  padding: 16px 16px 16px 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--px-color),
    0 var(--px) 0 0 var(--px-color),
    calc(var(--px) * -1) 0 0 0 var(--px-color),
    var(--px) 0 0 0 var(--px-color),
    0 calc(var(--px) * 3) 0 0 var(--shadow);
  opacity: 0; transform: translateY(16px);
  transition: opacity 0.25s steps(4), transform 0.25s steps(4);
}
.toast.is-in { opacity: 1; transform: none; }
.toast--error { --px-color: var(--danger); }
.toast p { flex: 1; font-size: 0.95rem; line-height: 1.5; }
.toast__close {
  flex: none; width: 28px; height: 28px; padding: 0;
  border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
  font-family: var(--font-pixel); font-size: 0.7rem;
}
.toast__close:hover { color: var(--text); }
