/* ============================================================================
   Blob Bounce — web design system
   ----------------------------------------------------------------------------
   A direct port of the app's design system so the site and the game read as one
   product:
     colors  -> utils/colors.js
     scales  -> utils/theme.js  (Radius, Spacing, Size, Type, Motion, Elevation)
     buttons -> components/ui/GameButton.js  (two-tone extrusion, no blur)
     cards   -> components/ui/Card.js        (luminance step + 1px hairline)

   Keep this file the single source of truth. Page-specific rules live in the
   page itself.
   ========================================================================== */

/* ---------------------------------------------------------------- fonts --- */
/* The same static Nunito faces the app registers in App.js. Self-hosted so the
   wordmark is identical on the site and on the store screenshots. */
@font-face {
  font-family: 'Nunito';
  src: url('fonts/Nunito-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/Nunito-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/Nunito-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('fonts/Nunito-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-display: swap;
}

/* ---------------------------------------------------------------- tokens -- */
:root {
  /* Brand */
  --primary: #5b4fff;
  --primary-light: #7b6fff;
  --primary-base: #4138b7;
  --accent: #ff4f8b;
  --accent-base: #b73864;
  --success: #00d9a3;
  --warning: #ffb800;
  --danger: #ff4f4f;
  --blob: #00d9ff;
  --obstacle: #ff6b9d;

  /* Surfaces — elevation on a dark UI is a luminance step, ~+6% per level */
  --sunken: #0b0822;
  --bg: #0f0b2e;
  --bg-light: #1a1545;
  --surface: #251e5c;
  --surface-2: #2e2670;
  --surface-3: #332a7a;

  /* Ink */
  --text: #ffffff;
  --text-2: #b8b3d9;
  --text-3: #8b85b5;
  --on-warning: #1f1500;
  --on-success: #00291f;

  /* Hairlines — the real elevation cue */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-focus: rgba(255, 255, 255, 0.24);
  --rim: rgba(255, 255, 255, 0.18);

  /* Medals */
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;

  /* Shape */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 24px;
  --r-3xl: 32px;
  --r-pill: 999px;

  /* Space */
  --x1: 4px;
  --x2: 8px;
  --x3: 12px;
  --x4: 16px;
  --x5: 20px;
  --x6: 24px;
  --x8: 32px;
  --x10: 40px;
  --x12: 48px;

  /* Motion — spatial values may overshoot, effects must not */
  --ease-spatial: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --ease-effect: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-effect: 200ms;
  --dur-effect-slow: 350ms;

  /* Layout */
  --extrude: 4px;
  --tap-min: 48px;
  --shell: 1120px;
  --shell-narrow: 860px;
}

/* ------------------------------------------------------------- baseline --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--primary);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

/* --------------------------------------------------------------- layout --- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding-inline: var(--x5);
}

.shell--narrow {
  max-width: var(--shell-narrow);
}

section {
  position: relative;
}

.section {
  padding-block: clamp(56px, 9vw, 104px);
}

.section-head {
  max-width: 620px;
  margin: 0 auto clamp(28px, 4vw, 48px);
  text-align: center;
}

.section-head p {
  color: var(--text-2);
  margin-top: var(--x3);
}

/* ----------------------------------------------------------------- type --- */
/* Mirrors the Type presets in utils/theme.js. Never pair a face with a
   font-weight the face does not have — Nunito ships four static weights. */
h1,
h2,
h3,
h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

h1 {
  font-size: clamp(2.6rem, 7vw, 4.2rem);
}

h2 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}

h3 {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.overline {
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.lead {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-2);
}

.muted {
  color: var(--text-2);
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

a {
  color: var(--primary-light);
  text-decoration-color: color-mix(in srgb, var(--primary-light) 40%, transparent);
  text-underline-offset: 3px;
  transition: color var(--dur-effect) var(--ease-effect);
}

a:hover {
  color: var(--blob);
}

/* ----------------------------------------------------------------- chip --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--x2);
  padding: 6px var(--x3);
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip--accent {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: #ffd0e0;
}

.chip--success {
  border-color: color-mix(in srgb, var(--success) 45%, transparent);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: #9dffe4;
}

.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* --------------------------------------------------------------- button --- */
/* Two-tone extrusion: a face sitting on a darker base, with a 1px lit top rim.
   Pressing collapses the face onto the base. Same recipe as
   components/ui/GameButton.js — a hard, zero-blur offset, deliberately not a
   blurred drop shadow, which is nearly invisible on #0F0B2E.

   The base is a box-shadow rather than a pseudo-element: a negative-z-index
   pseudo would paint behind any ancestor that has its own background, so the
   extrusion would vanish inside .card and .closing. */
.btn {
  --face: var(--primary);
  --base: var(--primary-base);
  --ink: #fff;

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--x3);
  min-height: 56px;
  margin-bottom: var(--extrude);
  padding: var(--x3) var(--x6);
  border: 0;
  border-radius: var(--r-xl);
  background: var(--face);
  border-top: 1px solid var(--rim);
  box-shadow: 0 var(--extrude) 0 var(--base);
  color: var(--ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transform: translateY(0);
  transition: transform 140ms var(--ease-spatial), box-shadow 140ms var(--ease-spatial),
    filter var(--dur-effect) var(--ease-effect);
}

.btn:hover {
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(3px) scale(0.985);
  box-shadow: 0 1px 0 var(--base);
}

.btn__icon {
  flex: none;
  width: 22px;
  height: 22px;
}

.btn__stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.btn__stack small {
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.78;
}

/* The one coloured glow in the product: the hero CTA (Elevation.glow). */
.btn--hero {
  min-height: 64px;
  border-radius: var(--r-2xl);
  font-size: 1.06rem;
  box-shadow: 0 var(--extrude) 0 var(--base),
    0 10px 34px color-mix(in srgb, var(--face) 42%, transparent);
}

.btn--hero:active {
  box-shadow: 0 1px 0 var(--base), 0 6px 22px color-mix(in srgb, var(--face) 34%, transparent);
}

.btn--accent {
  --face: var(--accent);
  --base: var(--accent-base);
}

.btn--secondary {
  --face: var(--surface-2);
  --base: #1a1542;
  --ink: var(--text);
  border: 1px solid var(--border);
  border-top-color: var(--rim);
}

.btn--ghost {
  --face: transparent;
  --base: transparent;
  min-height: var(--tap-min);
  margin-bottom: 0;
  border: 1px solid var(--border-strong);
  box-shadow: none;
  color: var(--text-2);
  font-weight: 700;
}

.btn--ghost:active {
  box-shadow: none;
}

.btn--ghost:hover {
  background: var(--surface);
  color: var(--text);
}

.btn--sm {
  min-height: var(--tap-min);
  padding-inline: var(--x5);
  font-size: 0.92rem;
  border-radius: var(--r-lg);
}

/* ----------------------------------------------------------------- card --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--x6);
}

.card--elevated {
  background: var(--surface-2);
}

.card--overlay {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.card--sunken {
  background: var(--sunken);
}

/* ------------------------------------------------------------------ nav --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: var(--x4);
  min-height: 68px;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: var(--x3);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.nav__mark {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: var(--primary);
  border-top: 1px solid var(--rim);
  overflow: hidden;
  flex: none;
}

.nav__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--x6);
  margin-left: auto;
}

.nav__links a {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
}

.nav__links a:hover {
  color: var(--text);
}

.nav__cta {
  margin-left: var(--x4);
}

/* Things drop in order of how little is lost by dropping them: the download CTA
   first (the hero's store buttons are one scroll away), then the brand wordmark,
   then Features.
 *
 * Features is the one destination that gives up nothing: it is a grid you scroll
 * past rather than somewhere you navigate to, while Modes/Duels/Parties/Daily are
 * the four things a visitor came to compare and Leaderboard is live data. Six
 * links measure ~440px laid out; a 360px phone has ~286px after the brand mark
 * and the shell padding, so one of them has to go. */
@media (max-width: 760px) {
  .nav__cta {
    display: none;
  }
  .nav__links {
    gap: var(--x4);
  }
  .nav__links a {
    font-size: 0.86rem;
  }
}

@media (max-width: 560px) {
  .nav__links a[href="#features"] {
    display: none;
  }
}

@media (max-width: 420px) {
  .nav__brand-text {
    display: none;
  }
  .nav__links {
    gap: 10px;
    /* Five links measure ~348px, which clears a 360px phone and does not clear
       a 320px one. Rather than keep dropping destinations for a vanishing slice
       of devices, let the strip scroll: below 360 it slides instead of forcing
       the whole page wider, and a sixth link later cannot break the layout
       either. Nothing scrolls while it fits. */
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav__links::-webkit-scrollbar {
    display: none;
  }
  .nav__links a {
    font-size: 0.8rem;
    white-space: nowrap;
  }
}

/* --------------------------------------------------------------- footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding-block: var(--x12) var(--x10);
  margin-top: var(--x12);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--x5);
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: var(--x3);
  font-weight: 800;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--x6);
}

.footer__links a {
  color: var(--text-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.footer__links a:hover {
  color: var(--blob);
}

.footer__legal {
  margin-top: var(--x6);
  color: var(--text-3);
  font-size: 0.85rem;
}

/* ---------------------------------------------------- document pages ------ */
/* privacy.html / terms.html share this block. */
.doc {
  padding-block: var(--x10) var(--x8);
}

.doc__header {
  text-align: center;
  margin-bottom: var(--x10);
}

.doc__header h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
}

.doc__updated {
  margin-top: var(--x3);
  color: var(--text-3);
  font-size: 0.9rem;
}

.doc__body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: clamp(24px, 5vw, 48px);
  line-height: 1.75;
}

.doc__body h2 {
  font-size: 1.45rem;
  color: var(--text);
  margin: var(--x10) 0 var(--x4);
  padding-top: var(--x5);
  border-top: 1px solid var(--border);
}

.doc__body > h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.doc__body h3 {
  font-size: 1.05rem;
  color: var(--blob);
  margin: var(--x6) 0 var(--x3);
}

.doc__body p {
  color: var(--text-2);
  margin-bottom: var(--x4);
}

.doc__body ul {
  list-style: none;
  margin: 0 0 var(--x5);
  padding: 0;
}

.doc__body li {
  position: relative;
  color: var(--text-2);
  padding-left: var(--x6);
  margin-bottom: var(--x2);
}

.doc__body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--primary-light);
}

.doc__body strong {
  color: var(--text);
  font-weight: 700;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--x2);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  padding: var(--x2) 0;
}

.back-link:hover {
  color: var(--blob);
}

/* -------------------------------------------------------------- a11y ------ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
