@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap");

/* --------------------------------------------
   Root Tokens — Quantum Computing Theme
--------------------------------------------- */
:root {
  /* Brand - Quantum computing palette */
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #0d1117;
  --text: #f0f6fc;
  --muted: #8b949e;
  --accent: #7c3aed;
  --accent-2: #a78bfa;
  --accent-glow: rgba(124, 58, 237, 0.4);
  --quantum-blue: #3b82f6;
  --quantum-purple: #8b5cf6;
  --ok: #238636;
  --warn: #d29922;
  --danger: #f85149;

  /* Elevation & FX */
  --ring: rgba(124, 58, 237, 0.4);
  --shadow: 0 4px 20px rgba(0,0,0,0.15);
  --shadow-2: 0 8px 32px rgba(0,0,0,0.2);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --border: 1px solid #21262d;

  /* Layout - Ultra compact spacing */
  --maxw: 1200px;
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --gutter: 20px;

  /* Motion */
  --ts: 150ms;
  --ts-fast: 100ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --fs-1: clamp(2rem, 4vw, 2.5rem);
  --fs-2: clamp(1.25rem, 2.5vw, 1.5rem);
  --fs-3: 1rem;
  --mono: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Consolas, monospace;

  /* Gradients */
  --grad-accent: linear-gradient(135deg, var(--quantum-blue), var(--quantum-purple));
  --grad-quantum: linear-gradient(135deg, var(--quantum-blue), var(--accent));
  --panel-grad: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0) 100%);
}

/* Light theme */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --panel: #f8fafc;
    --panel-2: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: 1px solid #e2e8f0;
    --shadow: 0 4px 20px rgba(148, 163, 184, 0.1);
    --shadow-2: 0 8px 32px rgba(148, 163, 184, 0.15);
  }
}

/* Theme overrides */
html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #0d1117;
  --text: #f0f6fc;
  --muted: #8b949e;
  --border: 1px solid #21262d;
}

html[data-theme='light'] {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f8fafc;
  --panel-2: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: 1px solid #e2e8f0;
}

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

html, body { 
  height: 100%; 
  scroll-behavior: smooth;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Quantum grid background */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* --------------------------------------------
   Ultra-Compact Header
--------------------------------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(16px) saturate(180%);
  border-bottom: var(--border);
  margin-bottom: var(--space-lg);
  transition: all var(--ts-fast) var(--ease);
  height: 60px;
}

.header.scrolled {
  background: rgba(13, 17, 23, 0.98);
  box-shadow: var(--shadow);
  height: 56px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Enhanced Brand */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
  transition: all var(--ts-fast) var(--ease);
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--accent);
  transform: translateY(-1px);
}

.quantum-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grad-quantum);
  box-shadow: 0 0 12px var(--accent-glow);
  position: relative;
}

.quantum-dot::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: var(--grad-quantum);
  opacity: 0.6;
  animation: quantum-pulse 2s infinite;
}

@keyframes quantum-pulse {
  0%, 100% { 
    opacity: 0.6;
    transform: scale(1);
  }
  50% { 
    opacity: 0.3;
    transform: scale(1.8);
  }
}

/* Compact Navigation Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--ts-fast) var(--ease);
  position: relative;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--accent);
  font-weight: 600;
  background: rgba(124, 58, 237, 0.1);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--grad-quantum);
  border-radius: 1px;
}

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

/* Ultra-compact buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13px;
  line-height: 1;
  border: 1px solid transparent;
  transition: all var(--ts-fast) var(--ease);
  text-decoration: none;
  cursor: pointer;
  background: var(--panel);
  color: var(--text);
  border: var(--border);
}

.btn:hover {
  background: var(--panel-2);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--grad-quantum);
  color: white;
  border: none;
  font-weight: 600;
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* Mobile menu toggle - more compact */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin: 0;
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  background: var(--text);
  transition: all var(--ts-fast) var(--ease);
  border-radius: 1px;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --------------------------------------------
   Compact Typography
--------------------------------------------- */
h1 {
  font-size: var(--fs-1);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
  position: relative;
}

h1::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--grad-quantum);
  border-radius: 2px;
}

h2 {
  font-size: var(--fs-2);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--fs-3);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--accent);
}

.lead {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 500px;
  margin-bottom: var(--space-lg);
}

/* Compact content spacing */
p {
  margin-bottom: var(--space-sm);
  font-size: 0.9rem;
}

p + p,
p + ul,
ul + p,
p + ol,
ol + p,
p + pre,
pre + p {
  margin-top: var(--space-md);
}

ul, ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
  font-size: 0.9rem;
}

li {
  margin-bottom: var(--space-xs);
}

/* --------------------------------------------
   Compact Cards
--------------------------------------------- */
.card {
  background: var(--panel);
  border: var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  transition: all var(--ts) var(--ease);
  position: relative;
  overflow: hidden;
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--grad-quantum);
  opacity: 0;
  transition: opacity var(--ts) var(--ease);
}

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

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

.card > *:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------
   Compact Grid System
--------------------------------------------- */
.grid {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid > * {
  margin-bottom: 0;
}

/* --------------------------------------------
   Responsive Design
--------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --gutter: 16px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 20px;
    --space-2xl: 24px;
  }
  
  .header {
    height: 56px;
    margin-bottom: var(--space-md);
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--panel);
    border-top: var(--border);
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-xs);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--ts) var(--ease);
  }
  
  .nav-links.active {
    transform: translateY(-100%);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-link {
    width: 100%;
    text-align: center;
    padding: 10px;
    font-size: 14px;
  }
  
  .grid.cols-2,
  .grid.cols-3 {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .card {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }
}

@media (max-width: 480px) {
  .nav {
    padding: 0 var(--gutter);
  }
  
  .brand {
    font-size: 1rem;
  }
  
  .btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* --------------------------------------------
   Utilities
--------------------------------------------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

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

.text-muted {
  color: var(--muted);
}

.text-center {
  text-align: center;
}

/* Compact spacing utilities */
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

/* --------------------------------------------
   Animations
--------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s var(--ease);
}

/* Focus & Selection */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

::selection {
  background: var(--accent);
  color: white;
}
