/* Fonts: Exo 2, shipped with the site (no external requests). */
@font-face {
  font-family: "Exo2";
  src: url("assets/fonts/Exo2-600.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Exo2";
  src: url("assets/fonts/Exo2-800.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

/* Colours: the game's palette (app/lib/prototype/theme.dart). */
:root {
  --bg: #07070b;
  --text: #f2f0fa;
  --muted: #9a96b0;
  --faint: #5e5a73;
  --violet: #8b5cf6;
  --magenta: #e040fb;
  --cyan: #40e0ff;
  --gold: #ffc94d;
  --line: rgba(255, 255, 255, 0.14);
  --px: 0;
  --skew: 0;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  /* The henchman starts at --hero-from (vw from the centre, negative = left)
     and walks to --hero-to over --hero-dur. Set per slide in index.html. */
  --hero-from: -38vw;
  --hero-to: 0vw;
  --hero-dur: 56s;
  --hero-drop: 0vh;
  --veil: 0.65;
  --panel-anim: skew-x;
  --skew-amp: 3deg;
  --skew-dur: 14s;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Exo2", system-ui, sans-serif;
}

/* ---------- Home: NFD at the top, full-screen slides, logo and links at the bottom ---------- */

body.home {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  min-height: 560px;
}

.top {
  position: absolute;
  top: max(26px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 11;
  text-align: center;
  pointer-events: none;
}
.top .logo {
  display: block;
  width: 100px;
  height: auto;
  margin: 0 auto 12px;
  image-rendering: pixelated;
}

.slides {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: pan-y;
  cursor: pointer;
}

.slide {
  position: absolute;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
}
.slide.on { visibility: visible; }


/* A background panel: a rectangle, tilted a little, that moves in
   parallax behind the henchman. */
.panel {
  position: absolute;
  left: 50%;
  top: 6vh;
  width: 88vw;
  height: 88vh;
  margin-left: -44vw;
  overflow: hidden;
  /* Each slide sets its own skew: --panel-anim (skew-x or skew-y),
     --skew-amp (how far) and --skew-dur (how long one swing takes). */
  transform: rotate(-1deg);
  animation: var(--panel-anim) var(--skew-dur) ease-in-out infinite alternate;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}
@keyframes skew-x {
  from { transform: rotate(-1deg) skewX(calc(var(--skew-amp) * -1)); }
  to { transform: rotate(-1deg) skewX(var(--skew-amp)); }
}
@keyframes skew-y {
  from { transform: rotate(-1deg) skewY(calc(var(--skew-amp) * -1)); }
  to { transform: rotate(-1deg) skewY(var(--skew-amp)); }
}
.panel img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.slide.on .panel img { animation: slow-zoom 40s var(--ease) both; }
@keyframes slow-zoom {
  from { transform: scale(1.12); }
  to { transform: scale(1.02); }
}

/* Each slide shows its first picture, then a glitch, then the new picture
   (the -2120 one, stacked on top). The glitch runs every time the slide
   comes on. Offsets use `translate`, so the zoom (`transform`) is kept. */
.panel .glitch-to {
  opacity: 0;
}
.slide.on .panel .glitch-to {
  animation:
    slow-zoom 40s var(--ease) both,
    glitch-reveal 2.6s linear both;
}
@keyframes glitch-reveal {
  0%, 45% { opacity: 0; }
  46% { opacity: 1; clip-path: inset(8% 0 80% 0); translate: -6% 0; filter: hue-rotate(120deg) saturate(3) contrast(1.5); }
  48% { clip-path: inset(45% 0 30% 0); translate: 5% 0; filter: invert(1) hue-rotate(-90deg); }
  50% { clip-path: inset(20% 0 55% 0); translate: -3% 0; filter: none; }
  52% { clip-path: inset(70% 0 10% 0); translate: 8% 0; filter: hue-rotate(60deg) saturate(2.5); }
  54% { opacity: 0.3; clip-path: inset(0 0 0 0); translate: 0 0; filter: none; }
  55% { opacity: 1; clip-path: inset(35% 0 45% 0); translate: -7% 0; filter: hue-rotate(-120deg) saturate(3); }
  57% { clip-path: inset(0 0 60% 0); translate: 4% 0; filter: invert(1); }
  59% { clip-path: inset(60% 0 15% 0); translate: -4% 0; filter: none; }
  61% { clip-path: inset(15% 0 70% 0); translate: 6% 0; filter: hue-rotate(90deg) contrast(2); }
  63% { clip-path: inset(0 0 0 0); translate: -2% 0; filter: none; }
  65% { clip-path: inset(50% 0 25% 0); translate: 3% 0; filter: invert(1); }
  67% { clip-path: inset(0); translate: -1% 0; filter: none; }
  70%, 100% { opacity: 1; clip-path: inset(0 0 0 0); translate: 0 0; filter: none; }
}

/* The veil: a black film over the whole screen, between the background
   panel and the henchman and the text, so the backgrounds stay calm. The
   opacity is --veil; raise it for a darker look. */
.veil {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, var(--veil));
  pointer-events: none;
}

/* The henchman: big, no frame, standing on the lower half. */
.hero {
  position: absolute;
  left: 50%;
  /* The pictures are already cut at the ankles, so the bottom of the picture
     sits on the bottom of the screen. --hero-drop is 0; a positive value
     would push the picture further below the screen. */
  bottom: calc(var(--hero-drop) * -1);
  height: 84vh;
  transform: translate3d(calc(-50% + var(--px) * var(--depth) * 40px), 0, 0);
  will-change: transform;
}
.hero img {
  display: block;
  height: 100%;
  width: auto;
}
.slide.on .hero { animation: walk-in var(--hero-dur) cubic-bezier(0.25, 0.6, 0.3, 1) both; }
@keyframes walk-in {
  0% { translate: var(--hero-from) 0; }
  100% { translate: var(--hero-to) 0; }
}

.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 22%),
    linear-gradient(to top, rgba(0, 0, 0, 0.92), transparent 42%);
}

.bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 0 16px max(14px, env(safe-area-inset-bottom));
  text-align: center;
}
.wordmark {
  margin: 0;
  font-size: clamp(30px, 9vw, 42px);
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.35), 0 2px 10px #000;
}

.links {
  max-width: 360px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
/* The footer has two rows: the stores, then the legal links. */
.links + .links { margin-top: 4px; }
/* Tap targets of at least 44 px high (the links are small on a phone). */
.links a,
.links .store {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
}
.links a {
  color: var(--text);
  text-decoration: none;
  text-shadow: 0 2px 8px #000;
}
.links a:hover,
.links a:focus-visible { color: var(--cyan); }
.links a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.links .store {
  color: var(--faint);
  cursor: default;
}

/* Reduced motion: no zoom, no rise, no parallax. */
@media (prefers-reduced-motion: reduce) {
  .panel, .hero { transform: none !important; }
  .slide.on .panel img { animation: none !important; }
  .panel .glitch-to, .slide.on .panel .glitch-to { animation: none !important; opacity: 1; }
  .slide.on .hero { animation: none !important; translate: var(--hero-to) 0; }
  .panel { animation: none !important; }
}

/* ---------- Pages below the home (privacy, terms, contacts) ---------- */

body.page {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(7, 7, 11, 0.55), rgba(7, 7, 11, 0.9)),
    url("assets/bg/abstract-neon.jpg") center / cover fixed no-repeat,
    var(--bg);
}
.page main {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 72px;
  line-height: 1.6;
}
.page .back {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.page h1 {
  margin: 0 0 16px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.page h2 {
  margin: 28px 0 8px;
  font-size: 18px;
  font-weight: 800;
}
.page p, .page li { color: var(--text); opacity: 0.9; }
.page .note {
  margin: 28px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font-size: 14px;
}
.page footer {
  margin-top: 40px;
  font-size: 12px;
  color: var(--faint);
}

/* ---------- Loading: abstract light flares and a white bar ---------- */

/* Until every image is in, the slides and the links stay hidden. The logo
   and NFD at the top are shown at once, in the same place as at the end. */
body.loading .slides,
body.loading .bottom { visibility: hidden; }

.loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(7, 7, 11, 0.35), rgba(7, 7, 11, 0.85)),
    url("assets/bg/abstract-neon.jpg") center / cover no-repeat,
    var(--bg);
  transition: opacity 0.9s ease;
}
body.ready .loader {
  opacity: 0;
  pointer-events: none;
}

/* The flares: soft white and cyan lights. Each one follows its own slow,
   continuous path, so the motion never jumps. No blur and no blend mode:
   the soft edges come from the gradient, which keeps it smooth on phones. */
.flare {
  position: absolute;
  width: 90vmax;
  height: 90vmax;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.5) 0%,
    rgba(64, 224, 255, 0.22) 22%,
    rgba(224, 64, 251, 0.1) 40%,
    transparent 62%
  );
  opacity: 0.85;
  pointer-events: none;
  will-change: transform;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}
.f1 {
  left: -34vmax;
  top: -26vmax;
  animation-name: flare-a;
  animation-duration: 26s;
}
.f2 {
  right: -36vmax;
  top: 8vh;
  animation-name: flare-b;
  animation-duration: 32s;
  animation-delay: -8s;
}
.f3 {
  left: 4vw;
  bottom: -40vmax;
  animation-name: flare-c;
  animation-duration: 29s;
  animation-delay: -15s;
}
@keyframes flare-a {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  25% { transform: translate3d(14vw, 5vh, 0) scale(1.06); }
  50% { transform: translate3d(6vw, 14vh, 0) scale(1); }
  75% { transform: translate3d(-4vw, 6vh, 0) scale(0.96); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes flare-b {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  30% { transform: translate3d(-12vw, 8vh, 0) scale(1.08); }
  60% { transform: translate3d(-6vw, 18vh, 0) scale(1); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes flare-c {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  35% { transform: translate3d(10vw, -10vh, 0) scale(1.05); }
  70% { transform: translate3d(-8vw, -4vh, 0) scale(0.97); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* The bar: a thin white track with ticks, glowing fill and a shine. */
.track {
  position: relative;
  width: min(72vw, 340px);
  height: 3px;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0 1px, transparent 1px 10%),
    rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, #ffffff, #dfe9ff);
  box-shadow: 0 0 10px #fff, 0 0 28px rgba(255, 255, 255, 0.6);
  transition: width 0.35s ease;
  overflow: hidden;
}
.fill::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  animation: shine 1.6s linear infinite;
}
@keyframes shine {
  from { transform: translateX(-100%); }
  to { transform: translateX(260%); }
}

@media (prefers-reduced-motion: reduce) {
  .flare, .fill::after { animation: none; }
}
