/* ═══════════════════════════════════════════════════════════════
   DESIGN SYSTEM — Quantitative Terminal
   Dark, mathematical, financial-grade aesthetic
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Outfit:wght@200;300;400;500;600;700;800&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap');

:root {
  /* Palette */
  --bg-primary:    #07090e;
  --bg-secondary:  #0c1018;
  --bg-card:       #0f1420;
  --bg-elevated:   #141a28;
  --surface:       #1a2235;
  --border:        rgba(56, 189, 248, 0.08);
  --border-hover:  rgba(56, 189, 248, 0.2);

  --text-primary:   #e8ecf4;
  --text-secondary: #8892a8;
  --text-muted:     #4a5568;

  --accent-cyan:    #38bdf8;
  --accent-green:   #22d3a7;
  --accent-amber:   #f59e0b;
  --accent-red:     #ef4444;
  --accent-violet:  #a78bfa;

  --glow-cyan:      0 0 30px rgba(56, 189, 248, 0.15);
  --glow-green:     0 0 30px rgba(34, 211, 167, 0.15);

  /* Typography */
  --font-display:  'Outfit', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
  --font-serif:    'Crimson Pro', serif;

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

  /* Layout */
  --max-width: 1280px;
  --nav-height: 72px;

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-display);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

::selection {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Grid Background ───────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(56, 189, 248, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.015) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(56, 189, 248, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ── Navigation ────────────────────────────────────────────── */
.nav {
  position: sticky;
  position: -webkit-sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.nav.scrolled {
  background: rgba(7, 9, 14, 0.85);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 1px 0 var(--border);
}

.nav-inner {
  width: 100%;
  max-width: var(--max-width);
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-logo .blink {
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.nav-logo .bracket {
  color: var(--text-muted);
  font-weight: 300;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: relative;
  padding: 0.4rem 0;
  transition: color 0.3s ease;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-cyan);
  transition: width 0.4s var(--ease-out-expo);
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link.active {
  color: var(--accent-cyan);
}

.nav-link.active::after {
  width: 100%;
}

.nav-social {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav-social a {
  color: var(--text-muted);
  transition: color 0.3s ease, transform 0.3s ease;
}

.nav-social a:hover {
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* ── Hamburger ─────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  z-index: 1001;
}

.nav-hamburger span {
  width: 24px;
  height: 2px;
  background: var(--text-secondary);
  transition: all 0.3s ease;
  border-radius: 1px;
}

/* ── Container / Layout ────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  position: relative;
  z-index: 1;
}

.section {
  padding: var(--space-2xl) 0;
}

/* ── Section Headers ───────────────────────────────────────── */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-label::before {
  content: '//';
  color: var(--text-muted);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--space-md);
}

.section-subtitle {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 300;
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.8;
  font-style: italic;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.85rem 1.8rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.35s var(--ease-out-expo);
  background: transparent;
  color: var(--text-primary);
  text-transform: uppercase;
}

.btn:hover {
  border-color: var(--accent-cyan);
  box-shadow: var(--glow-cyan);
  color: var(--accent-cyan);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent-cyan);
  color: var(--bg-primary);
  border-color: var(--accent-cyan);
}

.btn-primary:hover {
  background: #5bcefa;
  color: var(--bg-primary);
  box-shadow: var(--glow-cyan);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-lg);
  transition: all 0.4s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);
}

.card:hover::before {
  opacity: 1;
}

/* ── Tags ──────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.tag.cyan  { border-color: rgba(56, 189, 248, 0.3); color: var(--accent-cyan); }
.tag.green { border-color: rgba(34, 211, 167, 0.3); color: var(--accent-green); }
.tag.amber { border-color: rgba(245, 158, 11, 0.3); color: var(--accent-amber); }
.tag.violet { border-color: rgba(167, 139, 250, 0.3); color: var(--accent-violet); }

/* ── Scroll Animations ─────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* stagger children */
.stagger-children .reveal:nth-child(1) { transition-delay: 0.05s; }
.stagger-children .reveal:nth-child(2) { transition-delay: 0.12s; }
.stagger-children .reveal:nth-child(3) { transition-delay: 0.19s; }
.stagger-children .reveal:nth-child(4) { transition-delay: 0.26s; }
.stagger-children .reveal:nth-child(5) { transition-delay: 0.33s; }
.stagger-children .reveal:nth-child(6) { transition-delay: 0.40s; }

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-xl) 0;
  margin-top: var(--space-2xl);
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: var(--accent-cyan);
}

/* ── Math Decoration ───────────────────────────────────────── */
.math-watermark {
  position: absolute;
  font-family: var(--font-serif);
  font-size: clamp(6rem, 15vw, 14rem);
  font-weight: 300;
  font-style: italic;
  color: rgba(56, 189, 248, 0.02);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  line-height: 1;
}

/* ── Utility ───────────────────────────────────────────────── */
.text-cyan { color: var(--accent-cyan); }
.text-green { color: var(--accent-green); }
.text-amber { color: var(--accent-amber); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: var(--font-mono); }
.font-serif { font-family: var(--font-serif); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --nav-height: 64px;
  }

  .nav-links, .nav-social {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  .nav-links.mobile-open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 9, 14, 0.97);
    backdrop-filter: blur(20px);
    justify-content: center;
    align-items: center;
    gap: var(--space-xl);
    z-index: 999;
  }

  .nav-links.mobile-open .nav-link {
    font-size: 1.1rem;
  }

  .section {
    padding: var(--space-xl) 0;
  }

  .container {
    padding: 0 var(--space-md);
  }
}
