/* ============================================
   AlStableCoin — Global Theme & Design Tokens
   Gold / Orange Palette
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Background */
  --bg-deep: #0a0806;
  --bg-primary: #100e0a;
  --bg-card: rgba(25, 20, 10, 0.75);
  --bg-card-hover: rgba(35, 28, 15, 0.88);
  --bg-glass: rgba(255, 255, 255, 0.025);

  /* Foreground */
  --text-primary: #f0ece4;
  --text-secondary: #b8a88a;
  --text-dim: #6b5d4a;

  /* Accent — gold/orange gradient */
  --accent: #f0a500;
  --accent-light: #f5c842;
  --accent-glow: rgba(240, 165, 0, 0.45);
  --accent-2: #f97316;
  --accent-3: #fbbf24;
  --gradient-primary: linear-gradient(135deg, #f0a500, #f97316, #fbbf24);
  --gradient-dark: linear-gradient(135deg, #3d2e0a, #1f1406);

  /* Border */
  --border-color: rgba(240, 165, 0, 0.12);
  --border-glow: rgba(240, 165, 0, 0.3);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-2xl: 5rem;
  --section-gap: 5rem;

  /* Typography */
  --font-sans: "Inter", "SF Pro Display", -apple-system, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --font-math: "KaTeX_Main", "Times New Roman", serif;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Sizes */
  --nav-height: 72px;
  --max-width: 1200px;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  position: relative;
}

/* Prevent images/media from causing overflow */
img, svg, canvas, video, iframe {
  max-width: 100%;
  height: auto;
}

.katex {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

/* --- Background warm glow --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(240, 165, 0, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(249, 115, 22, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(251, 191, 36, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Grid overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(240, 165, 0, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 165, 0, 0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   Floating Orbs (decorative)
   ============================================ */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 8s ease-in-out infinite;
}

.orb-1 { width: 300px; height: 300px; background: rgba(240, 165, 0, 0.08); top: 20%; left: 0; animation-delay: 0s; }
.orb-2 { width: 250px; height: 250px; background: rgba(249, 115, 22, 0.06); bottom: 30%; right: 0; animation-delay: -3s; }
.orb-3 { width: 200px; height: 200px; background: rgba(251, 191, 36, 0.07); top: 50%; left: 40%; animation-delay: -5s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(30px, -20px) scale(1.08); }
  50%  { transform: translate(-15px, 25px) scale(0.94); }
  75%  { transform: translate(-25px, -10px) scale(1.05); }
}

/* ============================================
   Shimmer text animation
   ============================================ */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.shimmer-text {
  background: linear-gradient(90deg, var(--accent), var(--accent-3), var(--accent-2), var(--accent), var(--accent-3));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

/* ============================================
   Navigation — 3-column grid for true centering
   ============================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--space-xl);
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(10, 8, 6, 0.82);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}

.nav.scrolled {
  background: rgba(10, 8, 6, 0.96);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
  justify-self: start;
}

.nav-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
  justify-self: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.02em;
  position: relative;
  padding: var(--space-xs) 0;
  transition: color var(--transition-fast);
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 1px;
  transition: width var(--transition-smooth);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* --- Language Switch --- */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 3px;
  position: relative;
  overflow: hidden;
  justify-self: end;
}

.lang-switch::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-smooth);
  border-radius: 24px;
  pointer-events: none;
}

.lang-switch:hover {
  border-color: var(--border-glow);
}

.lang-switch:hover::before {
  opacity: 0.06;
}

.lang-switch button {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
  position: relative;
  z-index: 1;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.lang-switch button.active {
  background: var(--gradient-primary);
  color: #1a1000;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.lang-switch button:hover:not(.active) {
  color: var(--accent-light);
  background: rgba(240, 165, 0, 0.08);
}

/* ============================================
   Shared Section Layout
   ============================================ */
.section {
  position: relative;
  z-index: 1;
  padding: var(--section-gap) var(--space-xl);
  max-width: var(--max-width);
  margin: 0 auto;
  overflow: hidden;
}

.section-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-light);
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.section-header .section-title {
  margin-bottom: var(--space-sm);
}

.section-header .section-subtitle {
  margin: 0 auto;
}

/* --- Page Hero (shared) --- */
.page-hero {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-xl);
  padding-top: calc(var(--nav-height) + var(--space-2xl));
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.page-hero .section-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: var(--space-md);
}

.page-hero .section-subtitle {
  max-width: 680px;
  margin: 0 auto;
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.8;
}

/* --- Section Title & Subtitle --- */
.section-title {
  font-size: var(--text-4xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-md);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.8;
}

/* ============================================
   Feature Cards (shared)
   ============================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.feature-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: var(--space-lg);
  text-align: center;
  transition: all var(--transition-smooth);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.feature-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-smooth);
  z-index: -1;
  border-radius: 16px;
}

.feature-item:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px var(--accent-glow);
}

.feature-item:hover::before {
  opacity: 0.04;
}

.feature-item .feature-icon-box {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-md);
  border-radius: 14px;
  background: var(--gradient-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 1px solid var(--border-color);
}

.feature-item h3 {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  word-break: break-word;
}

.feature-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================
   CTA Banner (shared)
   ============================================ */
.cta-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: var(--space-xl);
  text-align: center;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0.05;
  z-index: -1;
}

.cta-banner h2 {
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.cta-banner p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  font-size: var(--text-lg);
}

.cta-banner .btn {
  margin: var(--space-xs);
}

/* ============================================
   How-It-Works Steps (shared)
   ============================================ */
.steps-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  position: relative;
}

.steps-row::before {
  content: "";
  position: absolute;
  top: 40px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent), var(--accent-2), transparent);
  z-index: 0;
}

.step-card {
  text-align: center;
  position: relative;
  z-index: 1;
  padding: var(--space-lg);
}

.step-card .step-num {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-md);
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--accent-light);
  transition: all var(--transition-smooth);
}

.step-card:hover .step-num {
  box-shadow: 0 0 28px var(--accent-glow);
  border-color: var(--accent);
  transform: scale(1.08);
}

.step-card h4 {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-xs);
  word-break: break-word;
}

.step-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ============================================
   Stats Bar (shared)
   ============================================ */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
  padding: var(--space-lg) 0;
}

.stat-pill {
  text-align: center;
  padding: var(--space-md) var(--space-lg);
}

.stat-pill .stat-num {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-pill .stat-label {
  font-size: var(--text-xs);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: var(--space-xs);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--space-xl);
  border-top: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: var(--text-xs);
}

.footer p + p {
  margin-top: var(--space-xs);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #1a1000;
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px var(--accent-glow);
}

.btn-outline {
  background: transparent;
  color: var(--accent-light);
  border: 1px solid var(--border-glow);
}

.btn-outline:hover {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================
   Formula Card (shared)
   ============================================ */
.formula-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-smooth);
}

.formula-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--transition-smooth);
  z-index: -1;
  border-radius: 16px;
}

.formula-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 40px var(--accent-glow);
  transform: translateY(-2px);
}

.formula-card:hover::before {
  opacity: 0.04;
}

.formula-card .katex {
  font-size: 1.3rem;
}

/* ============================================
   Particles Canvas
   ============================================ */
.particles-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ============================================
   Mobile Nav Toggle — simple hamburger
   ============================================ */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  padding: 4px;
  z-index: 1001;
  position: relative;
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all 0.25s ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
  background: var(--accent);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
  background: var(--accent);
}

/* ============================================
   Responsive — 1024px
   ============================================ */
@media (max-width: 1024px) {
  .nav {
    padding: 0 var(--space-lg);
    grid-template-columns: auto 1fr auto;
  }

  .nav-links {
    gap: var(--space-md);
  }

  .section-title {
    font-size: 2rem;
  }

  .feature-grid,
  .steps-row {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }

  .steps-row::before {
    left: 15%;
    right: 15%;
  }
}

/* ============================================
   Responsive — 768px
   ============================================ */
@media (max-width: 768px) {
  :root {
    --space-xl: 2rem;
    --space-2xl: 3.5rem;
    --section-gap: 3.5rem;
    --nav-height: 60px;
  }

  .nav {
    position: fixed;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 0 var(--space-lg);
    height: var(--nav-height);
  }

  .nav-logo {
    flex: 1;
  }

  /* --- Mobile nav menu: fixed below nav, independent --- */
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    background: rgba(10, 8, 6, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    box-shadow: none;
    transition: max-height 0.3s ease, border-color 0.3s ease;
    z-index: 999;
  }

  .nav-links.open {
    max-height: 320px;
    overflow: visible;
    border-bottom-color: var(--border-color);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  }

  .nav-links a {
    display: block;
    padding: 13px var(--space-lg);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    transition: all var(--transition-fast);
    border-bottom: 1px solid rgba(240, 165, 0, 0.05);
  }

  .nav-links li:last-child a {
    border-bottom: none;
  }

  .nav-links a:hover,
  .nav-links a:active {
    color: var(--accent-light);
  }

  .nav-links a.active {
    color: var(--accent-light);
    background: rgba(240, 165, 0, 0.04);
  }

  .nav-links a::after {
    display: none;
  }

  .nav-toggle {
    display: flex;
    margin-left: var(--space-sm);
  }

  .section {
    padding: var(--section-gap) var(--space-lg);
  }

  .section-title {
    font-size: 1.8rem;
  }

  .section-subtitle {
    font-size: 0.95rem;
  }

  .page-hero {
    min-height: 40vh;
    padding: calc(var(--nav-height) + var(--space-xl)) var(--space-lg) var(--space-lg);
  }

  .page-hero .section-subtitle {
    font-size: 0.95rem;
  }

  .feature-grid,
  .steps-row {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .steps-row::before {
    display: none;
  }

  .cta-banner {
    padding: var(--space-lg);
  }

  .cta-banner h2 {
    font-size: var(--text-2xl);
  }

  .cta-banner .btn {
    display: block;
    width: 100%;
    justify-content: center;
    margin: var(--space-xs) 0;
    max-width: 100%;
  }

  .stats-bar {
    gap: var(--space-md);
  }

  .stat-pill .stat-num {
    font-size: var(--text-2xl);
  }

  /* Hide orbs on mobile */
  .orb {
    display: none;
  }
}

/* ============================================
   Responsive — 480px
   ============================================ */
@media (max-width: 480px) {
  :root {
    --space-xl: 1.5rem;
    --space-2xl: 2.5rem;
    --section-gap: 2.5rem;
  }

  .nav-logo span {
    font-size: 1rem;
  }

  .section {
    padding: var(--section-gap) var(--space-md);
  }

  .section-title {
    font-size: 1.5rem;
  }

  .section-subtitle {
    font-size: 0.9rem;
  }

  .page-hero {
    min-height: 35vh;
    padding: calc(var(--nav-height) + var(--space-lg)) var(--space-md) var(--space-lg);
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.85rem;
  }

  .lang-switch button {
    padding: 5px 12px;
    font-size: 0.72rem;
  }

  .stats-bar {
    flex-direction: column;
    gap: var(--space-sm);
  }
}
