/* ==========================================================================
   Thunder Stallion — Global / Base
   Reset, base type, background system, buttons, badges, scrollbar, helpers.
   ========================================================================== */

/* ---- Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }

/* ---- Base --------------------------------------------------------------- */
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg-0);
  line-height: 1.6;
  font-size: 16px;
  letter-spacing: 0.1px;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #fff;
}

/* ---- Background system (fixed, behind everything) ----------------------- */
.bg-field {
  position: fixed;
  inset: 0;
  z-index: var(--z-bg);
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(1100px 700px at 78% -8%, rgba(138, 61, 255, 0.22), transparent 60%),
    radial-gradient(900px 620px at 10% 8%, rgba(25, 227, 255, 0.16), transparent 58%),
    radial-gradient(1200px 800px at 50% 116%, rgba(255, 54, 197, 0.12), transparent 60%),
    linear-gradient(180deg, var(--storm-black) 0%, var(--bg-1) 55%, var(--bg-0) 100%);
}
.bg-field::after { /* faint grid texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 150, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 150, 255, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 75%);
  opacity: 0.5;
}
.bg-particles { position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none; }

/* ---- Layout ------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.container--narrow { max-width: var(--maxw-narrow); }
main { position: relative; z-index: var(--z-base); }
section { position: relative; }
.section { padding-block: var(--pad-section); }
.section--tight { padding-block: clamp(40px, 5vw, 70px); }

/* ---- Section heading ---------------------------------------------------- */
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; flex-wrap: wrap; }
.section-head__titles { max-width: 640px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--cyan-bright); margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--cyan); box-shadow: var(--glow-cyan); }
.section-title { font-size: clamp(26px, 3.4vw, 40px); }
.section-sub { color: var(--text-dim); margin-top: 10px; font-size: clamp(15px, 1.4vw, 17px); }

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  --btn-bg: var(--surface-2);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 22px;
  font-family: var(--font-display); font-weight: 600; font-size: 15px;
  border-radius: var(--r-pill);
  color: var(--text);
  background: var(--btn-bg);
  border: 1px solid var(--border);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t);
  overflow: hidden; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; }

.btn--primary {
  background: var(--grad-brand); background-size: 180% 180%;
  color: #04121f; border: none; font-weight: 700;
  box-shadow: 0 10px 30px -8px rgba(25, 227, 255, 0.5);
  animation: gradient-shift 7s ease infinite;
}
.btn--primary:hover { box-shadow: 0 14px 40px -8px rgba(138, 61, 255, 0.6), var(--glow-cyan); }
/* sheen sweep */
.btn--primary::after {
  content: ""; position: absolute; top: 0; left: 0; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
}
.btn--primary:hover::after { animation: sheen 0.9s var(--ease); }

.btn--ghost { background: var(--surface); backdrop-filter: blur(10px); }
.btn--ghost:hover { border-color: var(--border-glow); box-shadow: var(--glow-soft); }
.btn--sm { padding: 9px 16px; font-size: 13px; }
.btn--lg { padding: 16px 30px; font-size: 16px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Badges / pills ----------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}
.badge--cyan { color: var(--cyan-bright); border-color: rgba(25, 227, 255, 0.3); background: rgba(25, 227, 255, 0.08); }
.badge--purple { color: var(--purple-bright); border-color: rgba(138, 61, 255, 0.3); background: rgba(138, 61, 255, 0.08); }
.badge--magenta { color: var(--magenta-soft); border-color: rgba(255, 54, 197, 0.3); background: rgba(255, 54, 197, 0.08); }
.badge--ember { color: var(--orange); border-color: rgba(255, 138, 61, 0.3); background: rgba(255, 138, 61, 0.08); }
.badge--soon { color: var(--text-faint); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 10px var(--up); animation: glow-pulse 2s infinite; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: var(--r-pill); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  font-size: 14px; font-weight: 500; transition: all var(--t-fast) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.is-active { color: #04121f; background: var(--grad-brand); border-color: transparent; font-weight: 600; }

.delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta--up { color: var(--up); }
.delta--down { color: var(--down); }

/* ---- Glass card base ---------------------------------------------------- */
.glass {
  background: var(--grad-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  box-shadow: var(--shadow-card);
}

/* ---- Skeleton / shimmer ------------------------------------------------- */
.skeleton {
  position: relative; overflow: hidden;
  background: linear-gradient(90deg, rgba(124, 150, 255, 0.06) 25%, rgba(124, 150, 255, 0.16) 50%, rgba(124, 150, 255, 0.06) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
.skeleton--text { height: 12px; margin: 7px 0; }
.skeleton--line-60 { width: 60%; } .skeleton--line-40 { width: 40%; } .skeleton--line-80 { width: 80%; }
.skeleton--circle { border-radius: 50%; }

/* ---- Spinner ------------------------------------------------------------ */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(124, 150, 255, 0.25); border-top-color: var(--cyan); animation: spin 0.7s linear infinite; }
.loader-block { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 40px; color: var(--text-dim); }

/* ---- Empty / error states ---------------------------------------------- */
.state { text-align: center; padding: 56px 24px; color: var(--text-dim); }
.state svg { width: 46px; height: 46px; margin: 0 auto 16px; opacity: 0.7; }
.state h4 { color: var(--text); margin-bottom: 6px; }

/* ---- Custom scrollbar --------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: rgba(138, 61, 255, 0.5) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: linear-gradient(var(--purple), var(--cyan-deep)); border-radius: 999px; border: 3px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(var(--magenta), var(--purple)); }
::selection { background: rgba(25, 227, 255, 0.3); color: #fff; }

/* ---- Scroll-to-top ------------------------------------------------------ */
.to-top {
  position: fixed; right: 26px; bottom: 26px; z-index: var(--z-overlay);
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px); color: var(--cyan-bright);
  opacity: 0; transform: translateY(20px) scale(0.8); pointer-events: none;
  transition: all var(--t) var(--ease-spring); box-shadow: var(--shadow-soft);
}
.to-top.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.to-top:hover { box-shadow: var(--glow-cyan); border-color: var(--border-glow); }

/* ---- Custom cursor (subtle, desktop only) ------------------------------- */
.cursor-glow {
  position: fixed; top: 0; left: 0; width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle, rgba(25, 227, 255, 0.55), transparent 70%);
  pointer-events: none; z-index: var(--z-toast); transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background 0.2s; mix-blend-mode: screen; will-change: transform;
}
.cursor-glow.is-hover { width: 52px; height: 52px; background: radial-gradient(circle, rgba(255, 54, 197, 0.5), transparent 70%); }
@media (hover: none) { .cursor-glow { display: none; } }

/* ---- Toast -------------------------------------------------------------- */
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 20px;
  border-radius: var(--r-pill); background: var(--surface-solid);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop);
  color: var(--text); font-size: 14px; font-weight: 500;
  animation: pop-in 0.3s var(--ease-spring); backdrop-filter: blur(12px);
}
.toast__ico { color: var(--cyan-bright); display: grid; place-items: center; }

/* ---- Utilities ---------------------------------------------------------- */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-dim); }
.center { text-align: center; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--border-strong), transparent); border: 0; margin: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-pad-top { padding-top: calc(var(--nav-h) + 40px); }
