:root {
  --bg: #030712;
  --bg-card: rgba(17, 24, 39, 0.5);
  --border: rgba(255, 255, 255, 0.08);
  --border-a: rgba(56, 189, 248, 0.4);
  --border-light: rgba(255, 255, 255, 0.05);
  --tx: #f8fafc;
  --tx2: #94a3b8;
  --tx3: #64748b;
  --blue: #38bdf8;
  --cyan: #22d3ee;
  --emerald: #34d399;
  --amber: #fbbf24;
  --violet: #a78bfa;
  --rose: #fb7185;
  --orange: #fb923c;
  --grad: linear-gradient(135deg, #38bdf8, #818cf8, #c084fc);
  --glass: rgba(17, 24, 39, 0.65);
  --glow: rgba(56, 189, 248, 0.15);
  --r: 20px;
  --rs: 12px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--tx);
  line-height: 1.7;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--blue); color: #fff; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

a { color: var(--blue); text-decoration: none; }

/* ANIMATIONS */
@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.05); }
}
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* NAV */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(16px, 4vw, 32px);
  display: flex; align-items: center; height: 64px; gap: 16px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.3);
}
.topnav-brand {
  font-weight: 800; font-size: clamp(16px, 4vw, 18px);
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-size: 200% auto; animation: gradientFlow 5s ease infinite;
  letter-spacing: -0.5px; display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.topnav-links {
  display: flex; gap: 4px; margin-left: auto; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  mask-image: linear-gradient(to right, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
  padding-right: 24px; scroll-snap-type: x mandatory;
}
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-links a {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--tx2); transition: 0.3s; white-space: nowrap;
  scroll-snap-align: start;
}
.topnav-links a:hover, .topnav-links a.active {
  background: rgba(56, 189, 248, 0.1); color: var(--blue);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

/* HERO */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center;
  padding: clamp(100px, 15vh, 140px) clamp(16px, 5vw, 32px) clamp(40px, 8vh, 60px);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -20vh; right: -10vw; width: 60vw; height: 60vw; min-width: 500px;
  background: radial-gradient(circle, rgba(56,189,248,0.15) 0%, transparent 60%);
  border-radius: 50%; filter: blur(40px); animation: pulseGlow 8s ease-in-out infinite alternate;
}
.hero::after {
  content: ''; position: absolute; bottom: -20vh; left: -10vw; width: 50vw; height: 50vw; min-width: 400px;
  background: radial-gradient(circle, rgba(167,139,250,0.12) 0%, transparent 60%);
  border-radius: 50%; filter: blur(40px); animation: pulseGlow 10s ease-in-out infinite alternate-reverse;
}
.hero-icon {
  font-size: 72px; margin-bottom: 24px; position: relative; z-index: 1;
  filter: drop-shadow(0 0 40px rgba(56, 189, 248, 0.4)); animation: float 6s ease-in-out infinite;
}
.hero h1 {
  font-size: clamp(40px, 7vw, 76px); font-weight: 900; letter-spacing: -2px;
  background: var(--grad); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-size: 200% auto; animation: gradientFlow 5s ease infinite;
  margin-bottom: 16px; position: relative; z-index: 1;
  text-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.hero .sub {
  font-size: clamp(15px, 2vw, 19px); color: var(--tx2); max-width: 600px;
  line-height: 1.8; margin-bottom: 40px; position: relative; z-index: 1;
  text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 24px;
  border-radius: 100px; border: 1px solid var(--border-a);
  background: rgba(56, 189, 248, 0.08); color: var(--cyan);
  font-size: 13px; font-weight: 700; letter-spacing: 1px; margin-bottom: 40px;
  position: relative; z-index: 1; backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 8px 20px rgba(0,0,0,0.3);
}
.hero-meta {
  display: flex; gap: 28px; color: var(--tx3); font-size: 13px; font-weight: 600;
  border-top: 1px solid var(--border); padding-top: 28px; position: relative;
  z-index: 1; flex-wrap: wrap; justify-content: center;
}
.hero-meta span { display: flex; align-items: center; gap: 6px; }

/* SECTIONS */
.section { max-width: 1200px; margin: 0 auto; padding: clamp(60px, 10vw, 100px) clamp(20px, 5vw, 40px); }
.section-num {
  font-size: 12px; font-weight: 800; color: var(--blue); text-transform: uppercase;
  letter-spacing: 4px; margin-bottom: 8px; font-family: var(--mono);
}
.section-title { font-size: clamp(28px, 5vw, 42px); font-weight: 800; letter-spacing: -1.5px; margin-bottom: 16px; }
.section-desc { font-size: 16px; color: var(--tx2); margin-bottom: 48px; max-width: 700px; line-height: 1.8; }
h3 { font-size: 20px; font-weight: 700; margin: 40px 0 20px; display: flex; align-items: center; gap: 12px; color: var(--tx); }
h4 { font-size: 15px; font-weight: 700; margin: 24px 0 12px; color: var(--tx); }

/* DIVIDER */
.divider {
  height: 1px; max-width: 1200px; margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  opacity: 0.4; box-shadow: 0 0 16px var(--blue);
}

/* CARDS - ULTRA PREMIUM */
.card {
  background: linear-gradient(180deg, rgba(30,41,59,0.5) 0%, rgba(15,23,42,0.7) 100%);
  border: 1px solid var(--border); border-radius: var(--r); padding: 28px;
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--border-light), 0 8px 30px rgba(0,0,0,0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative; overflow: hidden;
}
.card::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  transform: skewX(-20deg); transition: 0.6s; pointer-events: none;
}
.card:hover {
  transform: translateY(-6px);
  border-color: var(--border-a);
  box-shadow: inset 0 1px 0 var(--border-light), 0 20px 40px var(--glow);
}
.card:hover::before { left: 200%; }

.card-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.card-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 24px; flex-shrink: 0; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 4px 10px rgba(0,0,0,0.2);
}
.card-icon.blue { background: linear-gradient(135deg, rgba(56,189,248,0.2), rgba(56,189,248,0.05)); }
.card-icon.emerald { background: linear-gradient(135deg, rgba(34,211,153,0.2), rgba(34,211,153,0.05)); }
.card-icon.amber { background: linear-gradient(135deg, rgba(251,191,36,0.2), rgba(251,191,36,0.05)); }
.card-icon.violet { background: linear-gradient(135deg, rgba(167,139,250,0.2), rgba(167,139,250,0.05)); }
.card-icon.rose { background: linear-gradient(135deg, rgba(251,113,133,0.2), rgba(251,113,133,0.05)); }
.card-icon.orange { background: linear-gradient(135deg, rgba(251,146,60,0.2), rgba(251,146,60,0.05)); }
.card-icon.cyan { background: linear-gradient(135deg, rgba(34,211,238,0.2), rgba(34,211,238,0.05)); }
.card-title { font-size: 16px; font-weight: 700; color: var(--tx); }
.card-subtitle { font-size: 12px; color: var(--tx3); font-weight: 600; margin-top: 2px; }

/* MINI CARDS */
.mini { padding: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.mini .icon { font-size: 32px; margin-bottom: 12px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)); }
.mini .label { font-size: 13px; font-weight: 800; margin-bottom: 6px; color: var(--tx); letter-spacing: 0.5px; }
.mini p { font-size: 12px; text-align: center; color: var(--tx2); line-height: 1.6; margin: 0; }

/* GRIDS */
.g2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.g4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media(max-width: 900px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
@media(min-width: 901px) and (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }

/* TABLES - MOBILE OPTIMIZED & SOTA */
table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; margin: 20px 0;
  display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch;
  background: rgba(15,23,42,0.4); border-radius: var(--rs); border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--border-light), 0 8px 24px rgba(0,0,0,0.2);
}
th {
  text-align: left; padding: 16px 20px; background: rgba(255,255,255,0.03);
  color: var(--tx); font-weight: 700; font-size: 11px; text-transform: uppercase;
  letter-spacing: 1.5px; border-bottom: 1px solid var(--border);
}
th:first-child { border-top-left-radius: var(--rs); }
th:last-child { border-top-right-radius: var(--rs); }
td { padding: 14px 20px; border-bottom: 1px solid rgba(255,255,255,0.02); color: var(--tx2); font-weight: 500; transition: background 0.2s; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(56,189,248,0.04); color: var(--tx); }

/* CODE & TERMINAL */
code {
  font-family: var(--mono); font-size: 12px; background: rgba(0,0,0,0.4);
  padding: 3px 8px; border-radius: 6px; color: var(--cyan); border: 1px solid var(--border);
}
.codeblock {
  background: #000; border: 1px solid var(--border); border-radius: var(--rs);
  padding: 24px; font-family: var(--mono); font-size: 13px; line-height: 1.9;
  color: #a1a1aa; margin: 24px 0; overflow-x: auto; white-space: pre;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.3);
  position: relative;
}
.codeblock::before {
  content: '•••'; position: absolute; top: 12px; left: 16px; color: #3f3f46;
  font-size: 24px; letter-spacing: -2px; line-height: 0;
}
.codeblock { padding-top: 40px; }
.kw { color: #c084fc; font-weight: 600; }
.str { color: #34d399; }
.cmt { color: #52525b; font-style: italic; }
.fn { color: #38bdf8; }

/* ARCHITECTURE DIAGRAM */
.arch {
  background: linear-gradient(180deg, rgba(15,23,42,0.4), rgba(3,7,18,0.8));
  border: 1px solid var(--border); border-radius: var(--r); padding: 48px;
  margin: 32px 0; text-align: center; box-shadow: inset 0 0 40px rgba(0,0,0,0.5);
  position: relative; overflow: hidden;
}
.arch::before {
  content: ''; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(56,189,248,0.05), transparent 70%); pointer-events: none;
}
.arch-label { font-size: 11px; text-transform: uppercase; letter-spacing: 3px; color: var(--tx3); font-weight: 700; margin-bottom: 28px; }
.arch-row { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 16px 0; flex-wrap: wrap; }
.arch-box {
  display: inline-flex; flex-direction: column; align-items: center; padding: 18px 24px;
  border-radius: var(--rs); border: 1px solid; min-width: 140px; font-size: 13px; font-weight: 700;
  transition: 0.3s; box-shadow: 0 4px 10px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
  backdrop-filter: blur(8px);
}
.arch-box:hover { transform: translateY(-4px) scale(1.05); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }
.arch-conn { color: var(--tx3); font-size: 14px; letter-spacing: 2px; font-weight: 700; margin: 12px 0; animation: pulseGlow 2s infinite alternate; }
.arch-arrow { color: var(--tx3); font-size: 20px; font-weight: 800; padding: 0 8px; }

/* PILLS & BADGES */
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px;
  border-radius: 100px; font-size: 12px; font-weight: 700; margin: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2); backdrop-filter: blur(4px);
}
.pill.blue { background: rgba(56,189,248,.1); color: var(--blue); border: 1px solid rgba(56,189,248,.3); }
.pill.emerald { background: rgba(34,211,153,.1); color: var(--emerald); border: 1px solid rgba(34,211,153,.3); }
.pill.amber { background: rgba(251,191,36,.1); color: var(--amber); border: 1px solid rgba(251,191,36,.3); }
.pill.violet { background: rgba(167,139,250,.1); color: var(--violet); border: 1px solid rgba(167,139,250,.3); }
.pill.rose { background: rgba(251,113,133,.1); color: var(--rose); border: 1px solid rgba(251,113,133,.3); }
.pill.orange { background: rgba(251,146,60,.1); color: var(--orange); border: 1px solid rgba(251,146,60,.3); }

.badge {
  padding: 4px 12px; border-radius: 6px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.5px; display: inline-block; margin: 4px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.badge.blue { background: rgba(56,189,248,.15); color: var(--blue); border: 1px solid rgba(56,189,248,.3); }
.badge.emerald { background: rgba(34,211,153,.15); color: var(--emerald); border: 1px solid rgba(34,211,153,.3); }
.badge.amber { background: rgba(251,191,36,.15); color: var(--amber); border: 1px solid rgba(251,191,36,.3); }
.badge.violet { background: rgba(167,139,250,.15); color: var(--violet); border: 1px solid rgba(167,139,250,.3); }
.badge.rose { background: rgba(251,113,133,.15); color: var(--rose); border: 1px solid rgba(251,113,133,.3); }
.badge.orange { background: rgba(251,146,60,.15); color: var(--orange); border: 1px solid rgba(251,146,60,.3); }
.badge.cyan { background: rgba(34,211,238,.15); color: var(--cyan); border: 1px solid rgba(34,211,238,.3); }

/* FLOW STEPS */
.flow { display: flex; flex-direction: column; gap: 0; margin: 20px 0; }
.flow-step {
  display: flex; align-items: flex-start; gap: 20px; padding: 20px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05); transition: background 0.3s;
}
.flow-step:hover { background: rgba(255,255,255,0.02); border-radius: 8px; padding-left: 16px; padding-right: 16px; margin-left: -16px; margin-right: -16px; }
.flow-step:last-child { border-bottom: none; }
.flow-num {
  width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, rgba(56,189,248,0.2), rgba(56,189,248,0.05));
  color: #fff; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border: 1px solid rgba(56,189,248,.3); box-shadow: 0 4px 10px rgba(0,0,0,0.2); text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.flow-content { flex: 1; }
.flow-content strong { color: var(--tx); font-weight: 700; font-size: 15px; display: block; margin-bottom: 4px; }
.flow-content p { color: var(--tx2); font-size: 14px; margin: 0; }

/* HIGHLIGHT */
.hl {
  border-left: 4px solid var(--blue); padding: 20px 24px;
  background: linear-gradient(90deg, rgba(56,189,248,.08), rgba(56,189,248,.02));
  border-radius: 0 var(--rs) var(--rs) 0; margin: 24px 0; font-size: 14px; color: var(--tx);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.hl strong { color: var(--blue); font-weight: 700; }
.hl.warn { border-color: var(--amber); background: linear-gradient(90deg, rgba(251,191,36,.08), transparent); }
.hl.warn strong { color: var(--amber); }
.hl.ok { border-color: var(--emerald); background: linear-gradient(90deg, rgba(34,211,153,.08), transparent); }
.hl.ok strong { color: var(--emerald); }

/* SCORE BARS */
.score-bar { height: 10px; border-radius: 5px; background: rgba(0,0,0,0.3); box-shadow: inset 0 1px 3px rgba(0,0,0,0.5); overflow: hidden; margin-top: 6px; }
.score-fill { height: 100%; border-radius: 5px; transition: width 1s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; }
.score-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,0.1), transparent); }

/* LISTS */
ul { padding-left: 24px; margin: 12px 0; }
li { margin: 8px 0; color: var(--tx2); font-size: 14px; }
li strong { color: var(--tx); font-weight: 700; }
p { font-size: 15px; color: var(--tx2); margin: 8px 0; line-height: 1.8; }

/* FOOTER */
footer {
  text-align: center; padding: 60px 32px; color: var(--tx3); font-size: 13px;
  border-top: 1px solid var(--border); background: rgba(0,0,0,0.3);
}

/* SCROLL ANIMATIONS */
.reveal { opacity: 0; transform: translateY(40px); transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* SMOOTH SCROLL */
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
