/* Master of Some Studio — one dark night-camp theme for the studio and its games.
   Colours come from marketing/studio/palette.hex (duck yellow, amber, indigo night). */
:root {
  --night: #14101c;
  --night-2: #1c1424;
  --panel: #241b30;
  --line: #3c395f;
  --ink: #e3e1db;
  --muted: #a9a6b4;
  --duck: #fbd243;
  --amber: #f09c28;
  --sky: #87bad4;
  --display: "Chakra Petch", "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  --body: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--night); color: var(--ink); font: 17px/1.7 var(--body); }
img, video { max-width: 100%; height: auto; display: block; }
img.pixel { image-rendering: pixelated; }
a { color: var(--duck); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--duck); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(32px, 6vw, 56px); font-weight: 700; }
h2 { font-size: clamp(24px, 3.6vw, 34px); font-weight: 700; }
h3 { font-size: 20px; font-weight: 600; }
p { margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
.narrow { max-width: 760px; }
.eyebrow { font: 600 13px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.lede { color: var(--muted); font-size: 18px; max-width: 60ch; }

/* top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; background: color-mix(in srgb, var(--night) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 700 17px var(--display); white-space: nowrap; }
.brand img { width: 32px; height: 32px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; font: 600 15px var(--display); }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { color: var(--duck); }
.nav .lang { border: 1px solid var(--line); padding: 2px 10px; border-radius: 3px; color: var(--muted); }

/* buttons: square pixel corners, the duck's yellow */
.btn { display: inline-flex; align-items: center; gap: 10px; font: 700 17px var(--display); text-decoration: none; padding: 13px 22px; border-radius: 2px; border: 2px solid var(--duck); color: var(--night); background: var(--duck); box-shadow: 4px 4px 0 var(--amber); transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--amber); }
.btn.ghost { background: transparent; color: var(--duck); box-shadow: none; }
.btn.ghost:hover { background: color-mix(in srgb, var(--duck) 12%, transparent); }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero .bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: saturate(.95); }
.hero .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,16,28,.94) 0%, rgba(20,16,28,.78) 45%, rgba(20,16,28,.25) 100%), linear-gradient(0deg, rgba(20,16,28,1) 0%, rgba(20,16,28,0) 40%); }
.hero .wrap { position: relative; padding-block: clamp(56px, 10vw, 120px); display: grid; gap: 22px; }
.hero .logo { width: min(520px, 100%); }

section { padding-block: clamp(48px, 8vw, 88px); }
section + section { border-top: 1px solid var(--line); }
.stack { display: grid; gap: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; align-items: center; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* a game card on the studio page */
.game { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 0; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; overflow: hidden; }
.game img { width: 100%; height: 100%; object-fit: cover; }
.game .info { padding: 26px; display: grid; gap: 14px; align-content: center; }
.game.soon { grid-template-columns: 1fr; border-style: dashed; }
.game.soon .info { padding: 22px 26px; }
@media (max-width: 760px) { .game { grid-template-columns: 1fr; } }
.tag { display: inline-block; font: 600 12px/1.8 var(--display); letter-spacing: .06em; padding: 0 9px; border-radius: 2px; background: var(--line); color: var(--ink); }
.tag.live { background: var(--duck); color: var(--night); }

/* the duck's three trades */
.trade { display: grid; gap: 6px; padding: 18px; border-left: 3px solid var(--duck); background: var(--night-2); }
.trade b { font-family: var(--display); font-size: 18px; color: var(--duck); }
.trade span { color: var(--muted); font-size: 15.5px; }

/* features */
.feat { display: grid; gap: 10px; }
.feat img { border: 2px solid var(--line); border-radius: 3px; width: 100%; }
.feat p { color: var(--muted); font-size: 16px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px 26px; font: 600 15px var(--display); color: var(--muted); }
.facts b { color: var(--duck); font-size: 22px; margin-right: 6px; }
.clip { border: 2px solid var(--line); border-radius: 4px; overflow: hidden; background: #000; }

/* join steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 52px 1fr; gap: 16px; align-items: start; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; padding: 18px; }
.steps li::before { content: counter(s); font: 700 26px/52px var(--display); text-align: center; background: var(--duck); color: var(--night); width: 52px; height: 52px; border-radius: 2px; }
.steps .s { display: grid; gap: 10px; min-width: 0; }
.steps .s p { color: var(--muted); }
.rules { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.rules li::marker { color: var(--duck); }
.note { background: var(--night-2); border: 1px dashed var(--line); padding: 14px 18px; border-radius: 4px; color: var(--muted); font-size: 15.5px; }

/* legal pages */
.legal h2 { font-size: 22px; margin-top: 30px; margin-bottom: 8px; }
.legal p, .legal li { color: var(--ink); }
.legal ul { padding-left: 22px; }
.legal .date { color: var(--muted); }

footer { border-top: 1px solid var(--line); background: var(--night-2); }
footer .wrap { padding-block: 34px; display: grid; gap: 14px; color: var(--muted); font-size: 14.5px; }
footer .links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
footer img { height: 28px; width: auto; }
@media (max-width: 560px) {
  .nav .hide-s { display: none; }
  .brand { font-size: 15px; }
}
.art { width: 100%; border: 2px solid var(--line); border-radius: 4px; image-rendering: pixelated; }
.joinhead { align-items: center; }
.joinhead .art { max-width: 320px; justify-self: center; }

/* final-form showcase: two branch portraits per hero */
.heroes { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-top: 8px; }
.heroes .herocard { flex: 1 1 300px; max-width: 344px; }
.herocard { margin: 0; background: var(--panel); border: 2px solid var(--line); border-radius: 4px; overflow: hidden; }
.herocard .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line); }
.herocard .pair img { width: 100%; image-rendering: pixelated; }
.herocard figcaption { padding: 12px 14px 14px; display: grid; gap: 6px; }
.herocard .hn { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.herocard .hn b { font: 700 20px var(--display); color: var(--duck); }
.herocard .forms { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; color: var(--muted); font-size: 14.5px; line-height: 1.4; }
.herocard .forms span:last-child { text-align: right; }
@media (max-width: 760px) { .heroes .herocard { max-width: none; } }

/* tap a hero card: the in-game model on its tribe scene */
.herocard .pair { position: relative; border: 0; padding: 0; margin: 0; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.herocard .pair:hover img { filter: brightness(1.08); }
.viewchip { position: absolute; right: 8px; bottom: 8px; font: 700 13px/1 var(--display); padding: 7px 10px; border-radius: 2px; background: var(--duck); color: var(--night); box-shadow: 3px 3px 0 var(--amber); }
.hdlg { width: min(960px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 2px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ink); overflow: auto; }
.hdlg::backdrop { background: rgba(10, 8, 16, .82); }
.hd-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; }
.hd-top b { font: 700 22px var(--display); color: var(--duck); }
.hd-x { min-width: 44px; min-height: 44px; border: 2px solid var(--line); border-radius: 2px; background: var(--night-2); color: var(--ink); font-size: 20px; cursor: pointer; }
.hd-stage { position: relative; width: 100%; aspect-ratio: var(--ar); background-size: 100% 100%; background-position: center bottom; image-rendering: pixelated; overflow: hidden; }
.hd-stage img { position: absolute; left: 50%; transform: translateX(-50%); width: var(--ww); height: auto; image-rendering: pixelated; }
@media (max-width: 600px) { .hd-stage { aspect-ratio: 1 / 1; background-size: auto 100%; } .hd-stage img { width: var(--ws); } }
.hd-tabs { display: flex; gap: 8px; padding: 12px 14px 0; flex-wrap: wrap; }
.hd-tabs button { min-width: 64px; min-height: 44px; font: 700 17px var(--display); border: 2px solid var(--duck); border-radius: 2px; background: transparent; color: var(--duck); cursor: pointer; }
.hd-tabs button[aria-selected="true"] { background: var(--duck); color: var(--night); box-shadow: 3px 3px 0 var(--amber); }
.hd-cap { display: grid; gap: 2px; padding: 10px 14px 16px; }
.hd-cap b { font: 700 19px var(--display); }
.hd-cap span { color: var(--muted); font-size: 15.5px; }

/* ================= Astramarch: the march page ================= */
/* key art: the picture leans with the pointer, the glow breathes, sparks drift (assets/journey.js) */
.kv { position: relative; min-height: 100vh; min-height: 100svh; display: grid; align-items: end; overflow: hidden; border-bottom: 0; }
.kv-art { position: absolute; inset: -3%; transform: translate(calc(var(--mx, 0) * -16px), calc(var(--my, 0) * -10px)); transition: transform .5s ease-out; }
.kv-img, .kv-glow { position: absolute; inset: 0; background-size: cover; background-position: 50% 35%; image-rendering: pixelated; }
.kv-img { animation: kvzoom 26s ease-in-out infinite alternate; }
.kv-glow { mix-blend-mode: screen; animation: kvzoom 26s ease-in-out infinite alternate, breathe 3.4s ease-in-out infinite; }
.kv-art .motes { position: absolute; inset: 0; width: 100%; height: 100%; }
@keyframes kvzoom { from { transform: scale(1.02); } to { transform: scale(1.1); } }
@keyframes breathe { 0%, 100% { opacity: .25; } 50% { opacity: .9; } }
.kv::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(0deg, rgba(20,16,28,1) 0%, rgba(20,16,28,.9) 30%, rgba(20,16,28,.35) 55%, rgba(20,16,28,0) 72%), linear-gradient(90deg, rgba(20,16,28,.78) 0%, rgba(20,16,28,.3) 45%, rgba(20,16,28,0) 65%); }
.kv-text .lede { color: var(--ink); text-shadow: 0 2px 10px rgba(0,0,0,.85); }
@media (max-width: 640px) { .kv::after { background: linear-gradient(0deg, rgba(20,16,28,1) 0%, rgba(20,16,28,.93) 52%, rgba(20,16,28,.2) 78%, rgba(20,16,28,0) 90%); } .kv-text { padding-block: 30vh 9vh; } }
.kv-text { position: relative; z-index: 2; display: grid; gap: 18px; padding-block: 22vh 12vh; transform: translate(calc(var(--mx, 0) * 6px), calc(var(--my, 0) * 4px)); transition: transform .5s ease-out; }
.kv-text .logo { width: min(560px, 92%); filter: drop-shadow(0 6px 18px rgba(0,0,0,.6)); }
.scrollcue { position: absolute; z-index: 2; left: 50%; bottom: 22px; width: 18px; height: 18px; border-right: 3px solid var(--duck); border-bottom: 3px solid var(--duck); transform: translateX(-50%) rotate(45deg); animation: cue 1.6s ease-in-out infinite; }
@keyframes cue { 0%, 100% { translate: 0 0; opacity: .5; } 50% { translate: 0 8px; opacity: 1; } }

/* the journey: one sticky stage of game scenes behind every section */
.journey { position: relative; }
.journey section { border-top: 0; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; margin-bottom: -100vh; margin-bottom: -100svh; overflow: hidden; z-index: 0; background: var(--night); --x: 0; }
.scenes, .scene, .bd { position: absolute; inset: 0; }
.scene { opacity: 0; transition: opacity 1.1s ease; }
.scene.on { opacity: 1; }
.bd { background-size: cover; background-position: 50% 100%; image-rendering: pixelated; }
.fl, .fg { position: absolute; left: 0; right: 0; bottom: 0; background-repeat: repeat-x; image-rendering: pixelated; }
.fl { height: calc(var(--flh) * var(--s) * 1px); background-size: calc(var(--flw) * var(--s) * 1px) 100%; background-position-x: calc(var(--x) * -1px); }
.fg { z-index: 3; height: calc(var(--fgh) * var(--s) * 1px); background-size: calc(var(--fgw) * var(--s) * 1px) 100%; background-position-x: calc(var(--x) * -1.3px); }
.stage .motes { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.stage::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; background: linear-gradient(180deg, rgba(20,16,28,.55) 0%, rgba(20,16,28,0) 22%, rgba(20,16,28,0) 78%, rgba(20,16,28,.35) 100%); }
.army { position: absolute; z-index: 2; left: 3%; bottom: var(--ground); display: flex; align-items: flex-end; }
.army .u { display: block; flex: none; width: calc(var(--z) * var(--sa) * 1px); height: calc(var(--z) * var(--sa) * 1px);
  margin-bottom: calc(var(--ft) * var(--sa) * -1px); margin-right: calc(var(--z) * var(--sa) * -.42px);
  background-size: calc(var(--f) * 100%) 100%; background-repeat: no-repeat; image-rendering: pixelated;
  animation: walk .9s steps(var(--f), jump-none) infinite; }
.army .u:nth-child(2n) { animation-delay: -.33s; }
@keyframes walk { from { background-position-x: 0%; } to { background-position-x: 100%; } }
@media (max-width: 1100px) { .army .u:nth-child(1), .army .u:nth-child(2) { display: none; } }
@media (max-width: 640px) { .army .u:nth-child(4) { display: none; } }
.landtag { position: absolute; z-index: 5; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(var(--ground) * .35); display: grid; gap: 0; text-align: right; padding: 8px 14px; background: rgba(14,10,18,.78); border: 2px solid var(--amber); border-radius: 2px; box-shadow: 3px 3px 0 rgba(0,0,0,.5); }
.landtag small { font: 600 12px/1.4 var(--display); letter-spacing: .08em; color: var(--muted); }
.landtag small::after { content: " · " attr(data-realm); }
.landtag b { font: 700 18px/1.3 var(--display); color: var(--duck); }
.landtag.pop { animation: pop .5s ease-out; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* sections float over the stage; gaps between them show the land */
.leg { position: relative; z-index: 1; padding-block: 34vh 0; }
.leg:first-of-type { padding-top: 46vh; }
.leg-end { height: 70vh; }
/* the game's ornate frame (assets/ui/frame_bar.png, 9-slice) around dark glass */
.panel { border-style: solid; border-width: 44px; border-image: url("img/ui/frame_bar.webp") 22 / 44px round; image-rendering: pixelated;
  background: rgba(17,12,22,.9); background-clip: padding-box; padding: 6px 8px 10px; backdrop-filter: blur(3px); }
@media (max-width: 640px) { .panel { border-width: 26px; border-image-width: 26px; padding: 2px 2px 8px; } }
.js .reveal { opacity: 0; transform: translateY(48px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }

/* lands: tap one and the stage marches there */
.realm { display: grid; gap: 10px; margin-top: 10px; }
.realm h3 { font-size: 16px; letter-spacing: .06em; color: var(--amber); }
.lands { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.land { display: grid; gap: 0; padding: 0; border: 2px solid var(--line); border-radius: 2px; background: var(--night-2); color: var(--ink); cursor: pointer; text-align: left; overflow: hidden; transition: transform .15s, border-color .15s; }
.land img { width: 100%; aspect-ratio: 688 / 384; object-fit: cover; image-rendering: pixelated; }
.land span { font: 600 14.5px/1.35 var(--display); padding: 7px 9px 9px; }
.land:hover { transform: translateY(-2px); border-color: var(--amber); }
.land[aria-pressed="true"] { border-color: var(--duck); box-shadow: 3px 3px 0 var(--amber); }

/* story: the picture follows the paragraph in view */
.story { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; margin-top: 14px; }
.story-pic { position: sticky; top: 92px; align-self: start; aspect-ratio: 16 / 9; border: 2px solid var(--line); border-radius: 2px; overflow: hidden; background: #000; z-index: 2; }
.story-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; opacity: 0; transition: opacity 1.2s ease; }
.story-pic img.on { opacity: 1; }
.step { min-height: 52vh; display: flex; align-items: center; }
.step p { font: 600 clamp(19px, 2.2vw, 24px)/1.55 var(--display); color: color-mix(in srgb, var(--ink) 40%, transparent); transition: color .6s; }
.step.on p { color: var(--ink); }
@media (max-width: 760px) {
  .story { grid-template-columns: 1fr; gap: 0; }
  .story-pic { top: 62px; }
  .step { min-height: 30vh; position: relative; z-index: 1; }
  .step:last-child { min-height: 22vh; }
}

@media (prefers-reduced-motion: reduce) {
  .kv-img, .kv-glow, .scrollcue, .army .u { animation: none; }
  .kv-glow { opacity: .5; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* studio home on the same stage */
.kv-studio .kv-img { background-position: 72% 40%; animation-duration: 34s; }
.kv-studio .kv-text { max-width: 1080px; }
.kv-studio h1 { text-shadow: 0 3px 14px rgba(0,0,0,.8); }
.game > a { display: block; min-height: 100%; }
.panel .game { background: var(--night-2); }
@media (max-width: 640px) { .kv-studio .kv-img { background-position: 78% 30%; } }
.mail { font: 700 clamp(16px, 4.6vw, 22px) var(--display); overflow-wrap: anywhere; }
