/* ============================================================
   IEM Unified UI — shared design system for all pages
   Pair with assets/js/iem-motion.js
   Tokens · canonical header/nav/footer · buttons · cards ·
   section headers · badges · reveal/tilt bases · particles bg
   ============================================================ */
:root {
  --iem-bg: #060D1F;
  --iem-bg-alt: #080F20;
  --iem-surf: #0D1A30;
  --iem-surf2: #0F2040;
  --iem-border: rgba(255, 255, 255, .07);
  --iem-border-2: rgba(255, 255, 255, .12);
  --iem-gold: #F0A500;
  --iem-gold-2: #F5BF3C;
  --iem-up: #00C896;
  --iem-down: #FF4B55;
  --iem-blue: #5882FF;
  --iem-text: #E8EDF5;
  --iem-muted: rgba(255, 255, 255, .5);
  --iem-faint: rgba(255, 255, 255, .35);
  --iem-footer: #030810;
  --iem-radius: 12px;
  --iem-radius-lg: 16px;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-display: 'Manrope', 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

/* ---------- Particle background canvas ---------- */
canvas.iem-particles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: .5;
}
.iem-content-above { position: relative; z-index: 1; }

/* ---------- Canonical header ---------- */
.iem-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(6, 13, 31, .92);
  border-bottom: 1px solid var(--iem-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.iem-header .iem-container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.iem-navbar { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.iem-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.iem-logo-mark {
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--iem-gold); color: var(--iem-bg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 900; font-size: 14px;
  box-shadow: 0 0 18px rgba(240, 165, 0, .35);
}
.iem-logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.iem-logo-text strong { color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 14px; }
.iem-logo-text span { color: rgba(255, 255, 255, .45); font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; }
.iem-nav-links { display: flex; align-items: center; gap: 2px; }
.iem-nav-links a {
  color: rgba(255, 255, 255, .7); text-decoration: none;
  padding: 8px 11px; font-size: 13px; font-weight: 600;
  border-radius: 7px; white-space: nowrap; transition: color .15s, background .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.iem-nav-links a:hover { color: var(--iem-gold); background: rgba(240, 165, 0, .07); }
.iem-nav-links a.active { color: var(--iem-gold); }
.iem-nav-links a.active::after { content: ''; display: block; position: absolute; }
.iem-ai-badge {
  font-size: 9px; font-weight: 800; font-family: var(--mono);
  padding: 2px 5px; border-radius: 4px; letter-spacing: .5px;
  background: linear-gradient(135deg, rgba(240, 165, 0, .25), rgba(0, 200, 150, .25));
  border: 1px solid rgba(240, 165, 0, .4); color: var(--iem-gold);
}
.iem-nav-cta {
  background: var(--iem-gold); color: var(--iem-bg) !important;
  font-weight: 700 !important; border-radius: 7px;
  padding: 9px 16px !important; margin-left: 8px;
  transition: background .15s, transform .15s !important;
}
.iem-nav-cta:hover { background: var(--iem-gold-2) !important; transform: translateY(-1px); }
.iem-hamburger {
  display: none; background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 5px; padding: 8px;
}
.iem-hamburger span { width: 22px; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }

/* Mobile fullscreen nav */
.iem-mobile-nav {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(6, 13, 31, .98); backdrop-filter: blur(10px);
  flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.iem-mobile-nav.open { display: flex; }
.iem-mobile-nav a {
  color: rgba(255, 255, 255, .85); text-decoration: none;
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  padding: 10px 24px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 8px;
}
.iem-mobile-nav a:hover { color: var(--iem-gold); }
.iem-mobile-nav .iem-mn-cta { margin-top: 14px; background: var(--iem-gold); color: var(--iem-bg); font-size: 17px; }
.iem-mobile-close {
  position: absolute; top: 20px; right: 22px;
  background: none; border: none; color: rgba(255, 255, 255, .6);
  font-size: 26px; cursor: pointer; padding: 8px;
}
@media (max-width: 960px) {
  .iem-nav-links { display: none; }
  .iem-hamburger { display: flex; }
}

/* ---------- Section scaffolding ---------- */
.iem-section { padding: 88px 0; position: relative; }
.iem-section-alt { background: var(--iem-bg-alt); }
.iem-container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.iem-sec-label {
  font-size: 11px; font-weight: 700; letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--iem-up); margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
  font-family: var(--mono);
}
.iem-sec-label::before { content: ''; width: 22px; height: 2px; background: var(--iem-up); border-radius: 2px; }
.iem-sec-label.gold { color: var(--iem-gold); }
.iem-sec-label.gold::before { background: var(--iem-gold); }
.iem-sec-title { font-family: var(--font-display); font-size: 34px; font-weight: 800; color: #fff; margin-bottom: 10px; letter-spacing: -.5px; }
.iem-sec-sub { font-size: 15.5px; color: var(--iem-muted); max-width: 640px; margin-bottom: 44px; line-height: 1.65; }
.iem-grad-text {
  background: linear-gradient(100deg, var(--iem-gold) 10%, var(--iem-up) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Buttons ---------- */
.iem-btn-gold {
  display: inline-block; background: var(--iem-gold); color: var(--iem-bg);
  font-weight: 700; font-size: 15px; padding: 14px 28px; border-radius: 9px;
  border: none; cursor: pointer; text-decoration: none;
  transition: background .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 4px 24px rgba(240, 165, 0, .25);
}
.iem-btn-gold:hover { background: var(--iem-gold-2); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(240, 165, 0, .35); }
.iem-btn-ghost {
  display: inline-block; background: transparent; color: #fff;
  font-weight: 600; font-size: 15px; padding: 14px 28px; border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .22); cursor: pointer; text-decoration: none;
  transition: border-color .2s, background .2s, transform .2s;
}
.iem-btn-ghost:hover { border-color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .05); transform: translateY(-2px); }

/* ---------- Cards ---------- */
.iem-card {
  background: var(--iem-surf); border: 1px solid var(--iem-border);
  border-radius: var(--iem-radius-lg); padding: 30px;
  position: relative; overflow: hidden;
  transition: transform .25s, border-color .25s, box-shadow .25s;
  will-change: transform;
}
.iem-card:hover { border-color: rgba(240, 165, 0, .3); box-shadow: 0 12px 40px rgba(0, 0, 0, .4); }
.iem-card.teal:hover { border-color: rgba(0, 200, 150, .35); }
.iem-glow-top::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--iem-gold), transparent);
  opacity: 0; transition: opacity .3s;
}
.iem-glow-top:hover::before { opacity: 1; }

/* ---------- Badges ---------- */
.iem-badge { font-size: 11px; font-weight: 700; font-family: var(--mono); padding: 3px 9px; border-radius: 20px; letter-spacing: .3px; display: inline-block; }
.iem-badge.up { background: rgba(0, 200, 150, .14); color: var(--iem-up); }
.iem-badge.gold { background: rgba(240, 165, 0, .14); color: var(--iem-gold); }
.iem-badge.down { background: rgba(255, 75, 85, .14); color: var(--iem-down); }
.iem-badge.blue { background: rgba(88, 130, 255, .14); color: var(--iem-blue); }
.iem-dot-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--iem-up); font-family: var(--mono); letter-spacing: 1px; }
.iem-dot-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--iem-up); animation: iemPulse 1.6s infinite; }
@keyframes iemPulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 200, 150, .5); } 50% { opacity: .6; box-shadow: 0 0 0 6px rgba(0, 200, 150, 0); } }

/* ---------- Reveal (scroll) ---------- */
[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.16, 1, .3, 1), transform .7s cubic-bezier(.16, 1, .3, 1); }
[data-reveal="left"] { transform: translateX(-32px); }
[data-reveal="right"] { transform: translateX(32px); }
[data-reveal="scale"] { transform: scale(.94); }
[data-reveal].revealed { opacity: 1; transform: none; }

/* ---------- 3D tilt ---------- */
.tilt-ready { transform-style: preserve-3d; transition: transform .35s cubic-bezier(.16, 1, .3, 1); }
.tilt-glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s; z-index: 2; }

/* ---------- Canonical footer ---------- */
.iem-footer { background: var(--iem-footer); border-top: 1px solid var(--iem-border); padding: 64px 0 0; position: relative; z-index: 1; }
.iem-footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 48px; }
.iem-footer-desc { color: rgba(255, 255, 255, .45); font-size: 13.5px; line-height: 1.7; margin: 16px 0; max-width: 320px; }
.iem-footer-title { color: rgba(255, 255, 255, .85); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 16px; font-family: var(--font-display); }
.iem-footer-link { display: block; color: rgba(255, 255, 255, .45); text-decoration: none; font-size: 13.5px; padding: 5px 0; transition: color .15s; }
.iem-footer-link:hover { color: var(--iem-gold); }
.iem-footer-social { display: flex; gap: 10px; }
.iem-social-link {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--iem-border-2);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, .6); text-decoration: none; font-size: 14px; transition: all .15s;
}
.iem-social-link:hover { border-color: var(--iem-gold); color: var(--iem-gold); }
.iem-footer-bottom { border-top: 1px solid var(--iem-border); padding: 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.iem-footer-bottom-text { color: rgba(255, 255, 255, .35); font-size: 12.5px; }
.iem-footer-legal { display: flex; gap: 18px; }
.iem-footer-legal .iem-footer-link { padding: 0; font-size: 12.5px; }
@media (max-width: 960px) { .iem-footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .iem-footer-grid { grid-template-columns: 1fr; } }

/* ---------- Scroll top ---------- */
.iem-scroll-top {
  position: fixed; bottom: 26px; right: 26px; z-index: 900;
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--iem-surf); border: 1px solid var(--iem-border-2);
  color: #fff; font-size: 17px; cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.iem-scroll-top.visible { opacity: 1; pointer-events: auto; }
.iem-scroll-top:hover { border-color: var(--iem-gold); color: var(--iem-gold); transform: translateY(-3px); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .iem-dot-live::before { animation: none; }
  * { scroll-behavior: auto !important; }
}
