/* ===========================================================
   CHESSCEPTION — Core Design System
   Tokens · Reset · Layout · Navbar · Footer · Utilities
   =========================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Surfaces */
  --bg-0: #070713;
  --bg-1: #0c0c1d;
  --bg-2: #131329;
  --bg-3: #1a1a35;
  --surface-glass: rgba(20, 22, 45, 0.55);
  --surface-glass-strong: rgba(28, 30, 60, 0.78);
  --surface-elevated: rgba(40, 44, 80, 0.45);
  --border-soft: rgba(120, 140, 200, 0.10);
  --border-mid:  rgba(120, 140, 200, 0.20);
  --border-strong: rgba(120, 140, 200, 0.35);

  /* Brand */
  --teal: #3cd2c8;
  --teal-soft: rgba(60, 210, 200, 0.18);
  --teal-glow: rgba(60, 210, 200, 0.55);
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.20);
  --copper: #c0a880;
  --magenta: #c45dff;
  --magenta-glow: rgba(196, 93, 255, 0.45);

  /* Semantic */
  --success: #2ee99f;
  --warning: #ffb547;
  --danger:  #ff4f6d;
  --info:    #5db0ff;

  /* Text */
  --text-1: #f4f5fb;
  --text-2: #c8cce0;
  --text-3: #8c92ad;
  --text-4: #5c6285;
  --text-on-accent: #06121a;

  /* Typography */
  --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.55);
  --shadow-neon: 0 0 24px var(--teal-glow);
  --shadow-gold: 0 0 22px rgba(212,175,55,0.35);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Layout */
  --nav-h: 72px;
  --container: 1240px;
  --container-narrow: 880px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 160ms;
  --dur: 280ms;
  --dur-slow: 520ms;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--text-1);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv01", "cv11";
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
ul { list-style: none; }
::selection { background: var(--teal); color: var(--text-on-accent); }

/* ---------- Page Background (cosmic + grid) ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 700px at 12% -5%, rgba(60,210,200,0.10), transparent 60%),
    radial-gradient(900px 600px at 95% 8%, rgba(196,93,255,0.08), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(212,175,55,0.07), transparent 60%),
    var(--bg-0);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(120,140,200,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,140,200,0.045) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  pointer-events: none;
}

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-narrow { width: 100%; max-width: var(--container-narrow); margin: 0 auto; padding: 0 24px; }
.section { padding: clamp(64px, 9vw, 120px) 0; position: relative; }
.section--tight { padding: clamp(48px, 7vw, 80px) 0; }
.stack-sm > * + * { margin-top: 8px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 32px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; }
.gap-sm { gap: 12px; } .gap { gap: 20px; } .gap-lg { gap: 32px; }
.text-center { text-align: center; }
.muted { color: var(--text-3); }
.hidden { display: none !important; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
h1, .h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); }
h2, .h2 { font-size: clamp(2rem, 4.4vw, 3.2rem); }
h3, .h3 { font-size: clamp(1.4rem, 2.4vw, 1.85rem); }
h4 { font-size: 1.2rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--teal-soft);
  border: 1px solid rgba(60,210,200,0.25);
}
.eyebrow.gold { color: var(--gold); background: var(--gold-soft); border-color: rgba(212,175,55,0.3); }

.text-lead { font-size: clamp(1.05rem, 1.4vw, 1.2rem); color: var(--text-2); max-width: 640px; }
.text-mono { font-family: var(--font-mono); }
.text-gradient {
  background: linear-gradient(135deg, var(--teal) 0%, #80fff2 50%, var(--gold) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.text-gold { color: var(--gold); }
.text-teal { color: var(--teal); }

/* ---------- Navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(7, 7, 19, 0.65);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--border-soft);
}
.nav__inner {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.1rem;
}
.brand__mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1a2240, #0c0f24);
  border: 1px solid rgba(60,210,200,0.35);
  border-radius: 9px;
  box-shadow: inset 0 0 12px rgba(60,210,200,0.15), 0 0 18px rgba(60,210,200,0.20);
  color: var(--teal);
  font-size: 18px;
}
.brand__name { background: linear-gradient(120deg, var(--text-1), var(--teal) 70%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav__links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav__link {
  position: relative;
  padding: 8px 14px;
  font-size: 0.92rem;
  color: var(--text-2);
  border-radius: var(--r-pill);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
.nav__link:hover { color: var(--text-1); background: var(--border-soft); }
.nav__link.active { color: var(--teal); }
.nav__link.active::after {
  content: "";
  position: absolute; left: 50%; bottom: -2px;
  width: 16px; height: 2px;
  background: var(--teal);
  border-radius: 2px;
  transform: translateX(-50%);
  box-shadow: 0 0 8px var(--teal-glow);
}

.nav__cta { display: flex; align-items: center; gap: 10px; }

.nav__burger { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border-mid); align-items: center; justify-content: center; }
.nav__burger:hover { background: var(--surface-elevated); }
.nav__burger span { display: block; width: 18px; height: 2px; background: var(--text-2); position: relative; }
.nav__burger span::before, .nav__burger span::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: var(--text-2); }
.nav__burger span::before { top: -6px; } .nav__burger span::after { top: 6px; }

/* Mobile menu */
.mobile-menu {
  position: fixed;
  inset: var(--nav-h) 0 0 0;
  background: var(--bg-1);
  z-index: 49;
  padding: 24px;
  display: none;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border-soft);
}
.mobile-menu.open { display: flex; animation: slide-down var(--dur) var(--ease-out); }
.mobile-menu .nav__link { padding: 14px 16px; border-radius: var(--r-md); font-size: 1.05rem; }
.mobile-menu .nav__link.active { background: var(--teal-soft); }
.mobile-menu__cta { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 920px) {
  .nav__links, .nav__cta { display: none; }
  .nav__burger { display: inline-flex; margin-left: auto; }
}

/* ---------- Beta Banner ---------- */
.beta-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 16px;
  font-size: 0.82rem;
  color: var(--text-2);
  background: linear-gradient(90deg, rgba(60,210,200,0.10), rgba(196,93,255,0.10));
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.beta-banner strong { color: var(--teal); font-weight: 600; }
.beta-banner a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.beta-banner .pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 var(--teal-glow);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(60,210,200,0.7); }
  70% { box-shadow: 0 0 0 12px rgba(60,210,200,0); }
  100% { box-shadow: 0 0 0 0 rgba(60,210,200,0); }
}

.maintenance-banner {
  background: linear-gradient(90deg, rgba(255,79,109,0.15), rgba(255,181,71,0.15));
  border-bottom: 1px solid rgba(255,79,109,0.3);
  padding: 10px 16px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--warning);
  font-family: var(--font-mono);
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 80px;
  padding: 64px 0 32px;
  border-top: 1px solid var(--border-soft);
  background: linear-gradient(180deg, transparent, rgba(7,7,19,0.6));
  position: relative;
}
.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 48px;
  margin-bottom: 48px;
}
.footer__brand { max-width: 320px; }
.footer__brand p { color: var(--text-3); margin-top: 12px; font-size: 0.9rem; }
.footer__col h4 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-3); margin-bottom: 18px; font-family: var(--font-mono); font-weight: 500; }
.footer__col ul { display: flex; flex-direction: column; gap: 10px; }
.footer__col a { color: var(--text-2); font-size: 0.92rem; transition: color var(--dur-fast); }
.footer__col a:hover { color: var(--teal); }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding-top: 24px; border-top: 1px solid var(--border-soft); color: var(--text-3); font-size: 0.85rem; }
.footer__socials { display: flex; gap: 8px; }
.footer__socials a { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border-mid); color: var(--text-2); transition: all var(--dur-fast); }
.footer__socials a:hover { color: var(--teal); border-color: var(--teal); background: var(--teal-soft); transform: translateY(-2px); }

@media (max-width: 880px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .footer__grid { grid-template-columns: 1fr; }
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5,5,15,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
  animation: fade-in var(--dur) var(--ease-out);
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: scale-in var(--dur) var(--ease-out);
  position: relative;
}
.modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-3);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.modal__close:hover { color: var(--text-1); background: var(--border-soft); }
.modal h3 { margin-bottom: 8px; }
.modal p { color: var(--text-3); margin-bottom: 20px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--surface-glass-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--teal);
  padding: 14px 18px;
  border-radius: var(--r-md);
  min-width: 280px;
  max-width: 380px;
  font-size: 0.9rem;
  color: var(--text-1);
  box-shadow: var(--shadow-md);
  animation: toast-in var(--dur) var(--ease-out);
  pointer-events: auto;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
