/* ============ Panda Play Pals ============ */

/* ---- Fonts (self-hosted, no third-party requests) ---- */
@font-face { font-family: "Baloo 2"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/baloo-2-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Baloo 2"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/baloo-2-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Baloo 2"; font-style: normal; font-weight: 800; font-display: swap; src: url("/assets/fonts/baloo-2-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/fredoka-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/fredoka-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/fredoka-latin-600-normal.woff2") format("woff2"); }

/* ---- Tokens ---- */
:root {
  --ink: #17181c;
  --paper: #fff9ef;
  --cream-2: #ffefd2;
  --green: #4caf3e;
  --green-deep: #2e7d32;
  --green-dark: #1c4a1f;
  --gold: #ffc93c;
  --gold-deep: #f5a623;
  --sky: #63b8f0;
  --navy: #0e1b2e;
  --navy-2: #14263f;
  --magenta: #ff3ddb;
  --cyan: #33e6ff;
  --yt-red: #ff0033;
  --radius: 22px;
  --border: 3px solid var(--ink);
  --shadow: 0 6px 0 rgba(23, 24, 28, .9);
  --font-head: "Baloo 2", "Comic Sans MS", cursive, sans-serif;
  --font-body: "Fredoka", "Trebuchet MS", sans-serif;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.06rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}
img, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.12; margin: 0 0 .5em; }
h2 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; letter-spacing: .01em; }
h3 { font-size: clamp(1.3rem, 3vw, 1.7rem); font-weight: 700; }
p { margin: 0 0 1em; }
a { color: inherit; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }
.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; }
:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

.kicker {
  font-family: var(--font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .85rem;
  margin-bottom: .4em;
  opacity: .75;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  font-family: var(--font-head); font-weight: 800; font-size: 1.05rem;
  text-decoration: none; text-align: center;
  padding: .72em 1.5em; border-radius: 999px;
  border: var(--border); box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  cursor: pointer; user-select: none;
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 9px 0 rgba(23,24,28,.9); filter: brightness(1.04); }
.btn:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(23,24,28,.9); }
.btn .ic { width: 1.15em; height: 1.15em; fill: currentColor; }
.btn-gold { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: var(--ink); }
.btn-green { background: linear-gradient(180deg, #5ec84f, var(--green-deep)); color: #fff; }
.btn-yt { background: linear-gradient(180deg, #ff4d4d, var(--yt-red)); color: #fff; }
.btn-big { font-size: 1.3rem; padding: .85em 1.8em; }

/* ---- Nav ---- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
  background: rgba(23, 24, 28, 0);
  transition: background .25s ease, box-shadow .25s ease, padding .25s ease;
}
.nav.solid { background: rgba(23, 24, 28, .92); box-shadow: 0 3px 0 rgba(0,0,0,.25); padding: 6px 20px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  font-family: var(--font-head); font-weight: 700; text-decoration: none;
  color: #fff; padding: .45em .9em; border-radius: 999px;
  text-shadow: 0 2px 4px rgba(0,0,0,.45);
  transition: background .15s ease;
}
.nav-links a:hover { background: rgba(255, 201, 60, .28); }
.nav-cta { font-size: .95rem; padding: .5em 1.1em; }
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-cta { margin-left: auto; }
}

/* ---- Hero ---- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; color: #fff; overflow: hidden;
  background: var(--navy);
}
.hero-bg {
  position: absolute; left: 0; right: 0; top: -14%; bottom: -14%;
  background: url("/assets/img/hero-bg.webp") center / cover no-repeat;
  z-index: 0; will-change: transform;
}
.hero-shade {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(14, 27, 46, .18) 0%, rgba(14, 27, 46, .66) 78%),
    linear-gradient(180deg, rgba(14, 27, 46, .5) 0%, rgba(14, 27, 46, .18) 30%, rgba(14, 27, 46, .74) 100%);
}
.hero-content { position: relative; z-index: 3; padding: 96px 22px 70px; max-width: 760px; }
.hero-logo {
  width: min(430px, 72vw); height: auto; margin: 0 auto 14px;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, .55));
  animation: bob 5.5s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-.6deg); } 50% { transform: translateY(-14px) rotate(.6deg); } }
.tagline {
  font-family: var(--font-head); font-weight: 700;
  font-size: clamp(1.25rem, 3.4vw, 1.8rem);
  margin: 0 0 .25em; text-shadow: 0 2px 8px rgba(0,0,0,.55);
}
.tagline strong { color: var(--gold); }
.tagline-sub { font-size: clamp(.95rem, 2.4vw, 1.1rem); opacity: .92; margin-bottom: 1.6em; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.scroll-cue {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 3; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 249, 239, .16);
  animation: cue 1.6s ease-in-out infinite;
}
.scroll-cue svg { width: 26px; height: 26px; fill: #fff; }
@keyframes cue { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* Floating voxel cubes */
.voxels { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.vx {
  position: absolute; display: block;
  width: 34px; height: 34px; border-radius: 7px;
  border: 3px solid rgba(23, 24, 28, .55);
  animation: floaty 7s ease-in-out infinite;
  will-change: transform;
}
.vx-1 { left: 7%;  top: 22%; background: var(--gold);    animation-delay: -1s; }
.vx-2 { left: 14%; top: 64%; background: var(--green);   width: 26px; height: 26px; animation-delay: -2.5s; }
.vx-3 { left: 24%; top: 38%; background: var(--sky);     width: 20px; height: 20px; animation-delay: -4s; }
.vx-4 { right: 8%; top: 26%; background: var(--magenta); animation-delay: -3s; }
.vx-5 { right: 16%; top: 58%; background: var(--gold);   width: 22px; height: 22px; animation-delay: -5.2s; }
.vx-6 { right: 26%; top: 40%; background: var(--green);  width: 28px; height: 28px; animation-delay: -.8s; }
.vx-7 { left: 38%; top: 16%; background: var(--cyan);    width: 18px; height: 18px; animation-delay: -2s; }
.vx-8 { right: 38%; top: 12%; background: #fff;          width: 16px; height: 16px; animation-delay: -6s; }
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(8deg); }
  50% { transform: translateY(-22px) rotate(-8deg); }
}

/* ---- Intro video band ---- */
.intro-band {
  position: relative;
  background: var(--navy);
  line-height: 0;
  border-top: 4px solid var(--ink);
  border-bottom: 4px solid var(--ink);
}
.intro-band video {
  width: 100%;
  min-width: 100%;
  height: auto;
  max-height: 88vh;
  object-fit: cover;
}

/* ---- Scroll-parallax decorations ---- */
.deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.dv {
  position: absolute; display: block;
  width: 26px; height: 26px; border-radius: 6px;
  border: 3px solid rgba(23, 24, 28, .4);
  opacity: .55; will-change: transform;
}
.dv-gold { background: var(--gold); }
.dv-cyan { background: var(--cyan); }
.dv-magenta { background: var(--magenta); }
.dv-green { background: var(--green); }
.dv-sky { background: var(--sky); }
.dv-a { left: 4%;  top: 14%; }
.dv-b { right: 6%; top: 24%; width: 18px; height: 18px; }
.dv-c { left: 7%;  bottom: 20%; width: 22px; height: 22px; }
.dv-d { right: 4%; bottom: 34%; width: 32px; height: 32px; }
.dv-e { left: 46%; top: 6%;  width: 16px; height: 16px; }
@media (max-width: 700px) { .dv { opacity: .4; } .dv-e { display: none; } }

/* ---- Film section ---- */
.film {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(51, 230, 255, .07), transparent 45%),
    radial-gradient(ellipse at 85% 20%, rgba(255, 61, 219, .08), transparent 45%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 90px 0 70px;
}
.film .wrap, .film .worlds { position: relative; z-index: 1; }
.film .kicker { color: var(--gold); opacity: 1; }
.film h2 { text-shadow: 0 3px 0 rgba(0,0,0,.35); }
.film .lede { max-width: 640px; opacity: .94; }

.player {
  position: relative; margin: 34px 0 12px;
  border-radius: var(--radius); overflow: hidden;
  border: var(--border);
  box-shadow: 0 10px 0 rgba(0, 0, 0, .45), 0 24px 60px rgba(0, 0, 0, .45);
  background: #000;
}
.player video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.play-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  width: 100%; border: 0; cursor: pointer;
  background: linear-gradient(180deg, rgba(14,27,46,.05), rgba(14,27,46,.45));
  color: #fff; font-family: var(--font-head);
  transition: background .2s ease;
}
.play-overlay:hover { background: linear-gradient(180deg, rgba(14,27,46,0), rgba(14,27,46,.3)); }
.play-overlay.hidden { display: none; }
.play-ring {
  width: clamp(72px, 12vw, 108px); height: clamp(72px, 12vw, 108px);
  border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  border: var(--border); box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.play-overlay:hover .play-ring { transform: scale(1.08); }
.play-ring svg { width: 46%; height: 46%; fill: var(--ink); margin-left: 6%; }
.play-label {
  font-weight: 800; font-size: clamp(1.1rem, 3vw, 1.5rem);
  background: rgba(23, 24, 28, .78); padding: .3em .95em; border-radius: 999px;
}
.film-meta { text-align: center; font-size: .92rem; opacity: .75; }

/* ---- Worlds strip ---- */
.worlds { margin-top: 56px; }
.worlds h3 { display: flex; align-items: center; gap: .5em; }
.shard { color: var(--gold); font-size: .8em; }
.worlds-hint { opacity: .8; margin-bottom: 18px; }
.world-strip {
  list-style: none; margin: 0; padding: 8px 22px 26px;
  display: flex; gap: 18px; overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-color: var(--gold) transparent;
  will-change: transform;
}
.world-card {
  position: relative; flex: 0 0 172px; scroll-snap-align: start;
  border-radius: 18px; overflow: hidden;
  border: var(--border); background: var(--navy);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .4);
  transition: transform .18s ease, box-shadow .18s ease;
}
.world-card img { width: 100%; height: 250px; object-fit: cover; }
.world-card:hover { transform: translateY(-8px) rotate(-1deg); box-shadow: 0 14px 0 rgba(0,0,0,.4), 0 16px 34px rgba(255, 201, 60, .25); }
.level-chip {
  position: absolute; top: 10px; left: 10px;
  font-family: var(--font-head); font-weight: 800; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .08em;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: var(--ink); border: 2px solid var(--ink);
  padding: .18em .7em; border-radius: 999px;
}
.world-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 12px 10px;
  font-family: var(--font-head); font-weight: 700; font-size: .95rem; color: #fff;
  background: linear-gradient(180deg, transparent, rgba(10, 14, 22, .92));
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* ---- Pals ---- */
.pals {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 12% 10%, rgba(76, 175, 62, .12), transparent 50%),
    radial-gradient(ellipse at 90% 85%, rgba(255, 201, 60, .16), transparent 50%),
    var(--paper);
  padding: 90px 0;
}
.pals .wrap { position: relative; z-index: 1; }
.pal-grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  margin-top: 26px;
}
.pal-card {
  background: #fff; border: var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 20px; text-align: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.pal-card:hover { transform: translateY(-8px) rotate(-1.2deg); box-shadow: 0 12px 0 rgba(23,24,28,.9); }
.pal-card:nth-child(even):hover { transform: translateY(-8px) rotate(1.2deg); }
.pal-pic {
  height: 240px; display: grid; place-items: center;
  margin-bottom: 12px; border-radius: 14px;
  background: linear-gradient(180deg, var(--cream-2), #fff);
  overflow: hidden;
}
.pal-pic img { max-height: 220px; width: auto; transition: transform .25s ease; }
.pal-card:hover .pal-pic img { transform: scale(1.06); }
.pal-card h3 { margin-bottom: 0; font-size: 1.5rem; }
.pal-role {
  font-family: var(--font-head); font-weight: 700; font-size: .82rem;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--green-deep); margin-bottom: .5em;
}
.pal-card p:last-child { margin-bottom: 0; font-size: .97rem; }
.pal-pix .pal-role { color: var(--magenta); }
.pal-pix:hover .pal-pic img { animation: glitch .35s steps(2) infinite; }
@keyframes glitch {
  0%   { transform: scale(1.06) translate(0, 0); filter: none; }
  25%  { transform: scale(1.06) translate(-3px, 1px); filter: drop-shadow(3px 0 0 var(--magenta)) drop-shadow(-3px 0 0 var(--cyan)); }
  50%  { transform: scale(1.06) translate(2px, -2px); filter: drop-shadow(-3px 0 0 var(--magenta)) drop-shadow(3px 0 0 var(--cyan)); }
  75%  { transform: scale(1.06) translate(-1px, 2px); filter: drop-shadow(2px 2px 0 var(--cyan)); }
  100% { transform: scale(1.06) translate(0, 0); filter: none; }
}

/* ---- Subscribe band (parallax background) ---- */
.subscribe {
  position: relative; text-align: center; color: #fff;
  padding: 96px 0;
  background: var(--green-dark);
  overflow: hidden;
}
.subscribe-bg {
  position: absolute; left: 0; right: 0; top: -22%; bottom: -22%;
  background: linear-gradient(rgba(28, 74, 31, .84), rgba(23, 24, 28, .88)), url("/assets/img/bg-overworld.webp") center / cover no-repeat;
  will-change: transform; z-index: 0;
}
.subscribe .wrap { position: relative; z-index: 1; }
.subscribe h2 { text-shadow: 0 3px 0 rgba(0,0,0,.4); }
.subscribe p { max-width: 520px; margin-left: auto; margin-right: auto; }
.subscribe .btn { margin: 14px 0 22px; }
.subscribe .small { font-size: .9rem; opacity: .8; }

/* ---- Footer ---- */
.footer {
  background: var(--ink); color: #efe9dd;
  text-align: center; padding: 42px 22px 34px;
}
.footer nav { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.footer nav a {
  font-family: var(--font-head); font-weight: 700; font-size: .95rem;
  color: #efe9dd; text-decoration: none; padding: .3em .8em; border-radius: 999px;
}
.footer nav a:hover { background: rgba(255, 201, 60, .18); color: var(--gold); }
.footer p { margin: 0 0 .3em; font-size: .92rem; }
.footer .tiny { font-size: .8rem; opacity: .6; }

/* ---- Debug badge (only rendered with ?debug=1) ---- */
.debug-badge {
  position: fixed; left: 10px; bottom: 10px; z-index: 999;
  background: rgba(23, 24, 28, .93); color: #7cfc9a;
  font-family: Consolas, Menlo, monospace; font-size: 12px; line-height: 1.5;
  padding: 8px 12px; border-radius: 8px;
  max-width: 46ch; white-space: pre-wrap; pointer-events: none;
}

/* ---- Reveal on scroll ---- */
.reveal { opacity: 0; transform: translateY(26px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .3, 1); }

/* ---- Motion preferences ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-logo, .vx, .scroll-cue { animation: none; }
  .pal-pix:hover .pal-pic img { animation: none; }
  .reveal { opacity: 1; transform: none; }
  .reveal.in { transition: none; }
  .btn, .world-card, .pal-card, .pal-pic img { transition: none; }
  .dv { display: none; }
  .subscribe-bg { top: 0; bottom: 0; }
  .hero-bg { top: 0; bottom: 0; }
}

/* ---- Centring pass ---- */
.film .wrap, .pals .wrap, .worlds .wrap { text-align: center; }
.film .lede { margin-left: auto; margin-right: auto; }
.worlds h3 { justify-content: center; }
.pal-grid { justify-items: center; }
@media (min-width: 1600px) {
  .world-strip { justify-content: center; }
}
