/* =====================================================================
   ECHO — web design system  ("Cube Command")
   Dark frosted-glass chrome · brand-red hero accent · extruded cubes.
   Mirrors the in-game token set (PING/App/Theme.swift).
   ===================================================================== */

:root {
  /* Background field */
  --bg-top: #1a1f33;
  --bg-mid: #11141f;
  --bg-bottom: #0a0b12;

  /* Brand */
  --brand: #f92a18;
  --brand-hi: #ff5a3c;
  --brand-dark: #c81a0c;

  /* Accents */
  --green: #57d9a3;
  --green-dark: #2fa877;
  --sky: #57b7f5;
  --gold: #ffc74a;
  --gold-dark: #e0961e;
  --orange: #ff9e3d;
  --lilac: #a98bf5;
  --pink: #ff7fa8;
  --danger: #ff5e7a;

  /* Text */
  --text: #f4f6fb;
  --text-2: rgba(244, 246, 251, 0.62);
  --text-3: rgba(244, 246, 251, 0.40);

  /* Glass surfaces & strokes */
  --surface: #181b28;
  --surface-hi: #232737;
  --stroke: rgba(255, 255, 255, 0.10);
  --stroke-hi: rgba(255, 255, 255, 0.24);
  --glass: rgba(255, 255, 255, 0.05);

  /* Radii */
  --r-panel: 28px;
  --r-card: 22px;
  --r-btn: 18px;
  --r-tile: 16px;
  --r-chip: 13px;

  /* Spacing rhythm */
  --gap: clamp(1rem, 2vw, 1.5rem);
  --pad-x: clamp(1.1rem, 5vw, 3rem);
  --section-y: clamp(4rem, 10vw, 8rem);
  --maxw: 1180px;

  --shadow-card: 0 24px 50px rgba(0, 0, 0, 0.5);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font: "Poppins", -apple-system, "SF Pro Rounded", system-ui, "Segoe UI", roboto, sans-serif;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@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;
  }
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-bottom);
  line-height: 1.6;
  font-weight: 500;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Layered cube backdrop (fixed) ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 80% at 50% 44%, rgba(249, 42, 24, 0.16), transparent 60%),
    radial-gradient(90% 60% at 8% 90%, rgba(87, 183, 245, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-top), var(--bg-mid) 45%, var(--bg-bottom));
}
.bg::before { /* perspective grid */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 46%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: linear-gradient(transparent, #000 70%);
  mask-image: linear-gradient(transparent, #000 70%);
  transform: perspective(420px) rotateX(62deg);
  transform-origin: bottom;
  opacity: 0.6;
}
.bg::after { /* vignette */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 100% at 50% 40%, transparent 55%, rgba(10, 11, 18, 0.85));
}

/* ---------- Layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad-x); }
section { padding-block: var(--section-y); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-2);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 3px; background: var(--brand); box-shadow: 0 0 12px var(--brand); }
h1, h2, h3 { font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; }
.section-title { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 900; margin-top: 0.9rem; }
.lead { color: var(--text-2); font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 56ch; }
.center { text-align: center; margin-inline: auto; }
.center .lead { margin-inline: auto; }

/* ---------- Buttons (extruded cubes) ---------- */
.btn {
  --c: var(--brand); --c-hi: var(--brand-hi); --c-dark: var(--brand-dark);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  font-family: inherit; font-weight: 800; font-size: 1rem; letter-spacing: 0.01em;
  color: #fff; text-decoration: none; cursor: pointer;
  padding: 0.95rem 1.6rem; min-height: 54px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--r-btn);
  background: linear-gradient(180deg, var(--c-hi), var(--c));
  box-shadow: 0 6px 0 var(--c-dark), 0 14px 26px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), filter 0.2s var(--ease);
  isolation: isolate;
}
.btn::before { /* gloss */
  content: ""; position: absolute; inset: 1px 1px 45% 1px; border-radius: calc(var(--r-btn) - 1px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent);
  pointer-events: none; mix-blend-mode: soft-light;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--c-dark), 0 6px 14px rgba(0, 0, 0, 0.35); }
.btn:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }

.btn-gold { --c: var(--gold); --c-hi: #ffd873; --c-dark: var(--gold-dark); color: #2a1c00; }
.btn-ghost {
  background: var(--glass); color: var(--text);
  border: 1px solid var(--stroke-hi);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.btn-ghost::before { display: none; }
.btn-ghost:active { transform: translateY(2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }

/* Store badges */
.stores { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.store {
  display: inline-flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1.25rem; min-height: 60px;
  border-radius: var(--r-tile);
  background: linear-gradient(180deg, #20242f, #14171f);
  border: 1px solid var(--stroke-hi);
  color: var(--text); text-decoration: none;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s var(--ease), border-color 0.2s var(--ease);
}
.store:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, 0.4); }
.store svg { width: 26px; height: 26px; flex: none; }
.store .store-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.store .store-text small { font-size: 0.7rem; color: var(--text-2); font-weight: 600; }
.store .store-text b { font-size: 1.05rem; font-weight: 800; }

/* ---------- Glass card ---------- */
.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-top-color: var(--stroke-hi);
  border-radius: var(--r-card);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--shadow-card);
}

/* ---------- Cube icon tile ---------- */
.tile {
  display: grid; place-items: center;
  width: 56px; height: 56px; flex: none;
  border-radius: var(--r-tile);
  background: var(--c, var(--green)); /* fallback for browsers without color-mix */
  background: linear-gradient(180deg, var(--c, var(--green)), color-mix(in srgb, var(--c, var(--green)) 70%, #000));
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c, var(--green)) 55%, #000), 0 12px 22px rgba(0, 0, 0, 0.4);
  color: #fff;
}
.tile svg { width: 28px; height: 28px; }

/* =====================================================================
   NAV
   ===================================================================== */
.nav {
  position: sticky; top: 0; z-index: 50;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(12, 14, 22, 0.72);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border-bottom-color: var(--stroke);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 76px; }
.brand-mark { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text); }
.brand-mark img { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4)); }
.brand-mark b { font-weight: 900; font-size: 1.4rem; letter-spacing: 0.02em; }
.nav-links { display: flex; align-items: center; gap: 2rem; list-style: none; }
.nav-links a { color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 0.98rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 0.8rem; }
.nav .btn { min-height: 46px; padding: 0.6rem 1.2rem; font-size: 0.95rem; box-shadow: 0 4px 0 var(--c-dark), 0 10px 18px rgba(0, 0, 0, 0.3); }
.nav-toggle {
  display: none; width: 46px; height: 46px; border-radius: var(--r-tile);
  background: var(--glass); border: 1px solid var(--stroke-hi); color: var(--text);
  cursor: pointer; place-items: center;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* =====================================================================
   HERO
   ===================================================================== */
.hero { position: relative; padding-top: clamp(2rem, 6vw, 4rem); }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero-copy { max-width: 38rem; }
.wordmark {
  font-weight: 900; line-height: 0.9; letter-spacing: -0.04em;
  font-size: clamp(4.5rem, 16vw, 9rem);
  background: linear-gradient(180deg, #fff, #ffe9e2 55%, #ffd2c6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 10px 30px rgba(249, 42, 24, 0.35));
  margin-top: 1.1rem;
}
.tagline { font-weight: 800; letter-spacing: 0.22em; color: var(--text); font-size: clamp(0.85rem, 2vw, 1rem); text-transform: uppercase; margin-top: 0.4rem; }
.hero-copy .lead { margin-top: 1.4rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2rem; }
.hero-note { margin-top: 1.1rem; color: var(--text-3); font-size: 0.85rem; }

/* Hero visual — character render in a glowing cube stage + floating cubes */
.hero-stage { position: relative; display: grid; place-items: center; min-height: 420px; }
.hero-glow {
  position: absolute; width: 70%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 199, 74, 0.5), transparent 65%);
  filter: blur(20px); animation: pulse 5s var(--ease) infinite;
}
.hero-hero-img {
  position: relative; width: min(80%, 360px); aspect-ratio: 1;
  border-radius: var(--r-panel);
  border: 1px solid var(--stroke-hi);
  box-shadow: var(--shadow-card);
  object-fit: cover;
  animation: floaty 6s ease-in-out infinite;
}
.ping-rings { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.ping-rings span {
  position: absolute; width: 40%; aspect-ratio: 1; border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%; animation: ping 3.2s ease-out infinite;
}
.ping-rings span:nth-child(2) { animation-delay: 1.06s; }
.ping-rings span:nth-child(3) { animation-delay: 2.13s; }

/* Floating decorative 3D cubes */
.cubes { position: absolute; inset: -6% -2%; pointer-events: none; z-index: -1; }
.cube { position: absolute; transform-style: preserve-3d; animation: spin 18s linear infinite; opacity: 0.85; }
.cube .face {
  position: absolute; inset: 0; border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--c, var(--sky)); /* fallback */
  background: color-mix(in srgb, var(--c, var(--sky)) 80%, transparent);
}
.cube .f-front { transform: translateZ(var(--h)); }
.cube .f-back { transform: translateZ(calc(var(--h) * -1)) rotateY(180deg); filter: brightness(0.6); }
.cube .f-right { transform: rotateY(90deg) translateZ(var(--h)); filter: brightness(0.8); }
.cube .f-left { transform: rotateY(-90deg) translateZ(var(--h)); filter: brightness(0.8); }
.cube .f-top { transform: rotateX(90deg) translateZ(var(--h)); filter: brightness(1.15); }
.cube .f-bottom { transform: rotateX(-90deg) translateZ(var(--h)); filter: brightness(0.5); }

/* =====================================================================
   SECTIONS — generic
   ===================================================================== */
.section-head { max-width: 60ch; }

/* Description split */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.delay-demo { display: flex; flex-direction: column; gap: 0.9rem; padding: clamp(1.4rem, 3vw, 2rem); }
.delay-row { display: flex; align-items: center; gap: 1rem; }
.delay-row .step { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; color: #fff; flex: none; }
.delay-bar { height: 10px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; flex: 1; }
.delay-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--orange)); }

/* Features grid */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: var(--gap); margin-top: clamp(2rem, 4vw, 3rem); }
.feature-card { padding: clamp(1.4rem, 3vw, 1.8rem); transition: transform 0.3s var(--ease), border-color 0.3s var(--ease); }
.feature-card:hover { transform: translateY(-6px); border-top-color: rgba(255, 255, 255, 0.4); }
.feature-card h3 { font-size: 1.2rem; margin: 1.1rem 0 0.5rem; font-weight: 800; }
.feature-card p { color: var(--text-2); font-size: 0.97rem; }

/* Characters */
.char-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--gap); margin-top: clamp(2rem, 4vw, 3rem); }
.char-card { padding: 0.8rem; text-align: center; transition: transform 0.3s var(--ease); }
.char-card:hover { transform: translateY(-6px) scale(1.02); }
.char-card .frame { position: relative; border-radius: var(--r-tile); overflow: hidden; border: 1px solid var(--stroke-hi); aspect-ratio: 1; }
.char-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.char-card .rarity { position: absolute; top: 0.5rem; left: 0.5rem; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.12em; padding: 0.25rem 0.55rem; border-radius: 99px; border: 1px solid rgba(255, 255, 255, 0.3); color: #fff; }
.char-card b { display: block; margin-top: 0.7rem; font-size: 0.95rem; font-weight: 800; }
.char-card small { color: var(--text-3); font-size: 0.78rem; }

/* CTA band */
.cta-band { text-align: center; padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.4rem, 5vw, 4rem); overflow: hidden; }
.cta-band h2 { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 900; }
.cta-band .stores { justify-content: center; margin-top: 2rem; }

/* Stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--gap); margin-top: clamp(2rem, 4vw, 3rem); }
.stat { text-align: center; padding: 1.5rem 1rem; }
.stat b { display: block; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 900; background: linear-gradient(180deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--text-2); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.04em; }

/* =====================================================================
   FOOTER
   ===================================================================== */
.footer { border-top: 1px solid var(--stroke); margin-top: var(--section-y); padding-block: clamp(3rem, 6vw, 4rem) 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 2rem; }
.footer-brand p { color: var(--text-2); max-width: 34ch; margin-top: 1rem; font-size: 0.92rem; }
.footer h4 { font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); margin-bottom: 1rem; }
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 0.7rem; }
.footer a { color: var(--text-2); text-decoration: none; font-size: 0.95rem; transition: color 0.2s; }
.footer a:hover { color: var(--text); }
.footer-bottom { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--stroke); color: var(--text-3); font-size: 0.85rem; }

/* =====================================================================
   LEGAL PAGES
   ===================================================================== */
.page-head { padding-block: clamp(3rem, 8vw, 6rem) clamp(1.5rem, 4vw, 3rem); text-align: center; }
.page-head h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); font-weight: 900; }
.page-head p { color: var(--text-2); margin-top: 0.8rem; }
.legal { max-width: 820px; margin-inline: auto; padding: clamp(1.6rem, 4vw, 3rem); }
.legal h2 { font-size: 1.35rem; font-weight: 800; margin: 2.2rem 0 0.8rem; color: var(--text); }
.legal h2:first-child { margin-top: 0; }
.legal h3 { font-size: 1.05rem; font-weight: 700; margin: 1.4rem 0 0.5rem; color: var(--text); }
.legal p, .legal li { color: var(--text-2); margin-bottom: 0.9rem; font-size: 0.98rem; }
.legal ul, .legal ol { margin: 0 0 1rem 1.3rem; }
.legal li { margin-bottom: 0.5rem; }
.legal a { color: var(--sky); text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.legal strong { color: var(--text); }
.toc { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 2rem; }
.toc a { font-size: 0.85rem; padding: 0.4rem 0.8rem; border-radius: 99px; background: var(--glass); border: 1px solid var(--stroke); color: var(--text-2); text-decoration: none; }
.toc a:hover { color: var(--text); border-color: var(--stroke-hi); }

/* =====================================================================
   Reveal-on-scroll
   ===================================================================== */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* =====================================================================
   Keyframes
   ===================================================================== */
@keyframes floaty { 0%, 100% { transform: translateY(-10px); } 50% { transform: translateY(10px); } }
@keyframes pulse { 0%, 100% { transform: scale(0.95); opacity: 0.8; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.6; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes spin { to { transform: rotateX(360deg) rotateY(360deg); } }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; text-align: center; }
  .hero-copy { margin-inline: auto; }
  .hero-cta, .hero .eyebrow { justify-content: center; }
  .hero-copy .lead { margin-inline: auto; }
  .hero-stage { order: -1; min-height: 320px; }
  .split { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .nav-links, .nav .btn.nav-cta { display: none; }
  .nav-toggle { display: grid; }
  .nav.open .nav-links {
    display: flex; flex-direction: column; gap: 1.2rem;
    position: absolute; top: 76px; left: 0; right: 0;
    padding: 1.5rem var(--pad-x) 2rem;
    background: rgba(12, 14, 22, 0.96);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--stroke);
  }
  .nav.open .nav-links a { font-size: 1.1rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { justify-content: center; text-align: center; }
}
