/* The palette is sampled from the game's night scene and UI. */
:root {
  --sky: #322947;
  --dusk: #473b78;
  --slate: #38374f;
  --under: #221d34;
  --ink: #1b1630;
  --lantern: #fecf4e;
  --lantern-hi: #fff0a8;
  --lantern-lo: #c98a1b;
  --wall: #852b3b;
  --text: #f4f0ff;
  --soft: #cdc7ea;

  --u: 2;                 /* integer pixel scale for all game art */
  --sink: 44;             /* art-pixels of the bands' flat base hidden behind the street */
  --gutter: clamp(20px, 5vw, 64px);
  --display: "Afacad Flux", system-ui, sans-serif;   /* the face Strixel's UI is set in */
  --body: "Afacad Flux", system-ui, sans-serif;
  --out: cubic-bezier(.16, 1, .3, 1);
}
@media (min-width: 1500px) and (min-height: 1000px) { :root { --u: 3; } }

* { box-sizing: border-box; }
html { font-size: 112.5%; scroll-behavior: smooth; scrollbar-color: var(--dusk) var(--under); }
body {
  margin: 0;
  background: var(--slate);
  color: var(--text);
  font: 400 1.0625rem/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--lantern); color: var(--ink); }
:focus-visible { outline: 3px solid var(--lantern); outline-offset: 3px; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--lantern); text-underline-offset: .2em; text-decoration-thickness: 2px; }
a:hover { color: var(--lantern-hi); }

html[data-lang="en"] .vi, html[data-lang="vi"] .en { display: none; }

.wrap { width: 100%; max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.02; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(2.3rem, min(6vw, 9.4vh), 4.75rem); font-weight: 900; color: var(--lantern); letter-spacing: -.025em; line-height: .96; }
h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); }
h3 { font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 700; }
.lead { font-size: 1.3rem; line-height: 1.4; }

/* ---------- Night scene: sky bands, lanterns, street ---------- */

.night {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--sky);
}
header.night { min-height: min(100svh, 1100px); }

.sky, .street { position: absolute; inset: 0; pointer-events: none; }
.sky { z-index: -2; }
.street { z-index: -1; }

.band {
  position: absolute;
  left: 0; right: 0;
  bottom: calc((32px - var(--sink) * 1px) * var(--u));
  height: calc(320px * var(--u));
  overflow: hidden;
}
.band i {
  position: absolute;
  inset: 0 calc(-640px * var(--u)) 0 0;
  background: var(--img) repeat-x 0 0 / calc(640px * var(--u)) 100%;
  image-rendering: pixelated;
  animation: drift var(--t, 60s) linear infinite;
}
.still i { animation: none; }
@keyframes drift { to { transform: translateX(calc(-640px * var(--u))); } }

.lanterns {
  position: absolute; inset: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent min(48%, 640px), #000 calc(min(48%, 640px) + 160px));
          mask-image: linear-gradient(90deg, transparent min(48%, 640px), #000 calc(min(48%, 640px) + 160px));
}
.lanterns i {
  position: absolute;
  inset: 0 0 calc(-320px * var(--u)) 0;
  background: url(assets/art/lanterns.png) repeat 0 0 / calc(640px * var(--u)) calc(320px * var(--u));
  image-rendering: pixelated;
  animation: rise 54s linear infinite;
}
@keyframes rise { to { transform: translateY(calc(-320px * var(--u))); } }

.ground {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(32px * var(--u));
  overflow: hidden;
}
.ground i {
  position: absolute;
  inset: 0 calc(-640px * var(--u)) 0 0;
  background: url(assets/art/ground.png) repeat-x 0 0 / calc(32px * var(--u)) 100%;
  image-rendering: pixelated;
  animation: drift 7s linear infinite;
}

/* Sprite sheets are 6 x 7 frames of 64px. Row 0 runs; row 2, frame 3 stands. */
.spr {
  --s: var(--u);
  display: block;
  flex: none;
  width: calc(64px * var(--s));
  height: calc(64px * var(--s));
  background: var(--img) no-repeat calc(-192px * var(--s)) calc(-128px * var(--s)) / calc(384px * var(--s)) calc(448px * var(--s));
  image-rendering: pixelated;
}
.spr.run, .lineup button:hover .spr, .lineup button:focus-visible .spr, .lineup button[aria-pressed="true"] .spr {
  animation: run .56s steps(6) infinite;
}
@keyframes run {
  from { background-position: 0 0; }
  to { background-position: calc(-384px * var(--s)) 0; }
}

.procession {
  position: absolute;
  left: max(calc(var(--gutter) - 40px), calc((100% - 1240px) / 2));
  bottom: calc(16px * var(--u));      /* feet sit 16 art-pixels above the frame's bottom edge */
  display: flex;
}
.procession .spr + .spr { margin-left: calc(-20px * var(--u)); }
.procession .spr.wide + .spr, .procession .spr + .spr.wide { margin-left: calc(-10px * var(--u)); }
.procession .float { translate: 0 calc(-14px * var(--u)); }

.pet {
  position: absolute;
  left: calc(max(calc(var(--gutter) - 40px), calc((100% - 1240px) / 2)) + 150px * var(--u));
  bottom: calc(74px * var(--u));
  width: calc(64px * var(--u)); height: calc(64px * var(--u));
  background: url(assets/art/pet-dragon.png) 0 0 / 200% 200%;
  image-rendering: pixelated;
  animation: flap .6s step-end infinite, bob 3.2s ease-in-out infinite alternate;
}
@keyframes flap {
  0% { background-position: 0 0; }
  25% { background-position: 100% 0; }
  50% { background-position: 0 100%; }
  75% { background-position: 100% 100%; }
}
@keyframes bob { to { translate: calc(10px * var(--u)) calc(-6px * var(--u)); } }

/* ---------- Top of the page ---------- */

.top {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
  padding-block: 20px;
}
.brand { display: flex; align-items: flex-end; gap: 10px; margin-right: auto; text-decoration: none; color: var(--soft); }
.brand img { width: calc(44px * var(--k, 3)); height: calc(12px * var(--k, 3)); image-rendering: pixelated; }
.brand span { font: 700 .72rem/1 var(--body); letter-spacing: .26em; text-transform: uppercase; padding-bottom: calc(2px * var(--k, 3)); }
.brand:hover span { color: var(--lantern); }
.top ul { display: flex; gap: clamp(14px, 2.4vw, 32px); }
.top ul a {
  color: var(--text); text-decoration: none; font-weight: 600;
  padding-block: 6px; border-bottom: 3px solid transparent;
}
.top ul a:hover { color: var(--lantern); border-color: var(--lantern); }
.lang { display: flex; border: 2px solid var(--ink); background: var(--ink); gap: 2px; }
.lang button {
  font: 700 .8rem/1 var(--body); letter-spacing: .06em;
  min-width: 40px; min-height: 32px; padding: 0 8px;
  border: 0; cursor: pointer;
  background: var(--dusk); color: var(--soft);
}
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] { background: var(--lantern); color: var(--ink); }

.pitch {
  flex: 1;
  padding-top: clamp(16px, 4vh, 72px);
  /* reserve the mountains and the street so copy never sits on them */
  padding-bottom: calc((242px - var(--sink) * 1px) * var(--u));
}
.pitch h1 { max-width: 18ch; }
.pitch p { max-width: 36rem; margin-top: 20px; font-size: 1.2rem; line-height: 1.42; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; margin-top: 28px; }

.btn {
  display: inline-block;
  padding: 14px 22px 18px;
  background: var(--lantern);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border: 3px solid var(--ink);
  box-shadow: inset 0 -5px 0 var(--lantern-lo);
  transition: background-color .25s var(--out), translate .12s var(--out), box-shadow .12s var(--out);
}
.btn:hover { background: var(--lantern-hi); color: var(--ink); }
.btn:active { translate: 0 3px; box-shadow: inset 0 -2px 0 var(--lantern-lo); }
.link { font-weight: 600; color: var(--text); }

/* ---------- The game ---------- */

main { background: var(--slate) url(assets/art/lotus-dark.png) 0 0 / 640px 480px; }

.game { padding-top: clamp(72px, 10vw, 136px); }
.game-top {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}
.cover { position: relative; margin-top: 12px; }
.cover-col { min-width: 0; }
.cover > img:first-child { width: 100%; border: 4px solid var(--ink); }
.seal {
  position: absolute;
  right: -28px; top: -44px;
  width: clamp(88px, 11vw, 148px);
  rotate: 7deg;
  filter: drop-shadow(0 6px 10px rgb(27 22 48 / .55));
}
.about-game h2 { color: var(--lantern); }
.about-game .lead { margin-top: 20px; }
.about-game p + p { margin-top: 14px; color: var(--soft); }
.about-game .btn { margin-top: 28px; }

.facts {
  margin-top: 32px;
  padding: 0;
  border: 40px solid transparent;
  border-image: url(assets/art/panel.png) 20 fill / 40px / 0 stretch;
  image-rendering: pixelated;
}
.facts div { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; }
.facts div + div { border-top: 2px solid rgb(254 207 78 / .22); }
.facts dt { color: var(--soft); font-size: .9375rem; }
.facts dd { text-align: right; font-weight: 500; font-size: .9375rem; font-variant-numeric: tabular-nums; }

.reel {
  margin-top: clamp(56px, 7vw, 96px);
  padding: 4px var(--gutter) 20px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  scrollbar-color: var(--lantern) var(--ink);
  scrollbar-width: thin;
}
.reel .track { display: flex; width: max-content; }
.reel img {
  flex: none;
  width: min(80vw, 600px);
  margin-right: 16px;
  border: 4px solid var(--ink);
  scroll-snap-align: start;
}

/* Strips that slide on their own; site.js clones the items and sets --shift / --dur. */
.is-marquee { overflow: hidden; }
.is-marquee .track { animation: marquee var(--dur) linear infinite; }
.is-marquee:hover .track,
.is-marquee:focus-within .track,
.is-marquee:has([aria-pressed="true"]) .track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-1 * var(--shift))); } }
.reel.is-marquee { padding-inline: 0; }

main img:not(.seal) { cursor: zoom-in; }

.wardrobe { margin-top: clamp(72px, 9vw, 128px); }
.wardrobe-head { display: grid; gap: 10px; }
.wardrobe-head p { color: var(--soft); max-width: 36rem; }
.wall {
  margin-top: 36px;
  overflow-x: auto;
  scrollbar-width: none;
  background: url(assets/art/wall.png) repeat-x 0 0 / 48px 192px;
  image-rendering: pixelated;
}
.lineup {
  display: flex;
  justify-content: space-between;
  min-width: max-content;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: calc(var(--gutter) - 24px);
}
.wall.is-marquee { background: none; }
.is-marquee .lineup {
  justify-content: flex-start;
  max-width: none;
  width: max-content;
  margin: 0;
  padding: 0;
  background: url(assets/art/wall.png) repeat-x 0 0 / 48px 192px;   /* 144px slots keep the wall seamless */
  image-rendering: pixelated;
}
.is-marquee .lineup li { width: 144px; display: grid; justify-items: center; }
.lineup button {
  --s: 2;
  display: grid;
  justify-items: center;
  width: 128px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: 600 .9375rem/1.25 var(--body);
  cursor: pointer;
  image-rendering: auto;
}
.lineup .spr { margin-top: 96px; }            /* 192px wall: feet land on its stone base */
.lineup .name { padding: 14px 4px 4px; min-height: 3.6em; text-wrap: balance; }
.lineup button:hover .name, .lineup button[aria-pressed="true"] .name { color: var(--lantern); }

/* ---------- Next game ---------- */

.next { padding-top: clamp(88px, 11vw, 152px); }
.next-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}
.next-copy .lead { margin-top: 18px; }
.next-copy p + p { margin-top: 14px; color: var(--soft); max-width: 34rem; }
.next-copy .wip {
  margin-top: 26px; padding-top: 14px;
  border-top: 2px solid rgb(254 207 78 / .28);
  color: var(--lantern); font-size: .9375rem;
}
.next-shots { display: flex; gap: clamp(12px, 2.4vw, 28px); align-items: flex-start; }
.next-shots img { flex: 1 1 0; min-width: 0; border: 4px solid var(--ink); }
.next-shots img:nth-child(2) { margin-top: clamp(28px, 5vw, 72px); }
.next-shots img:nth-child(3) { margin-top: clamp(14px, 2.5vw, 36px); }
.flip { margin-top: clamp(88px, 11vw, 152px); grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.wide-shots img { border: 4px solid var(--ink); }
.pair { display: flex; gap: clamp(10px, 1.4vw, 16px); margin-top: clamp(10px, 1.4vw, 16px); }
.pair img { flex: 1 1 0; min-width: 0; }

/* ---------- Team ---------- */

.team { padding-block: clamp(72px, 10vw, 136px); }
.team-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 5vw, 72px);
}
.team p { max-width: 38rem; }
.team p + p { margin-top: 16px; color: var(--soft); }

/* ---------- Close ---------- */

.close .pitch { padding-top: clamp(64px, 9vw, 120px); }
.close .pitch p { margin-top: 14px; }
.mail {
  display: inline-block;
  margin-top: 26px;
  font: 800 clamp(1.3rem, 4.2vw, 2.75rem)/1.2 var(--display); letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.legal { background: var(--under); font-size: .875rem; }
.legal .wrap { display: flex; flex-wrap: wrap; gap: 8px 28px; min-height: 56px; align-items: center; }
.legal span { margin-right: auto; color: var(--soft); }
.legal a { color: var(--soft); }
.legal a:hover { color: var(--lantern); }

/* ---------- Lightbox ---------- */

.lightbox {
  width: 100vw; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 12px 12px 44px;
  border: 0;
  background: none;
  cursor: zoom-out;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgb(27 22 48 / .93); }
.lightbox img {
  max-width: 100%;
  max-height: calc(100dvh - 68px);
  width: auto;
  border: 4px solid var(--ink);
  outline: 2px solid var(--lantern);
  animation: zoom .32s var(--out);
}
.lightbox p {
  position: fixed; left: 0; right: 0; bottom: 14px;
  text-align: center; font-size: .85rem; color: var(--soft);
}
@keyframes zoom { from { opacity: 0; transform: scale(.94); } }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .game-top, .team-grid, .next-grid { grid-template-columns: minmax(0, 1fr); }
  .flip .next-copy { order: -1; }
  .seal { right: -8px; top: -36px; }
  .cover-col { display: contents; }
  .cover { order: 1; }
  .about-game { order: 2; }
  .facts { order: 3; margin-top: 0; }
  .lineup:not(.is-marquee *) { justify-content: flex-start; gap: 4px; }
  .wall { scrollbar-width: thin; scrollbar-color: var(--lantern) var(--ink); }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; row-gap: 8px; padding-block: 14px; }
  .top ul { order: 3; width: 100%; flex-wrap: wrap; row-gap: 0; }
  .pitch { padding-top: 20px; }
  .pitch p { font-size: 1.0625rem; }
  .brand { --k: 2; }
  .lanterns {
    -webkit-mask-image: linear-gradient(transparent calc(100% - 420px), #000 calc(100% - 340px));
            mask-image: linear-gradient(transparent calc(100% - 420px), #000 calc(100% - 340px));
  }
  .procession { left: -28px; }
  .procession .spr:nth-child(-n+2), .procession .spr:nth-child(5) { display: none; }
  .pet { left: 150px; }
  .close .procession .spr { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .band i, .ground i, .lanterns i, .pet, .spr.run, .lightbox img { animation: none; }
  .spr.run { background-position: 0 0; }
}
