/* ============================================================
   Escalia — Stylesheet
   ============================================================ */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #050508;
  --bg-secondary: #0a0a0f;
  --bg-card: #0f0f16;
  --bg-card-hover: #14141e;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.15);

  --accent-1: #7c6ef7;
  --accent-2: #a78bfa;
  --accent-3: #c4b5fd;
  --accent-glow: rgba(124, 110, 247, 0.3);

  --text-primary: #f0f0f8;
  --text-secondary: #8888a8;
  --text-muted: #555568;

  --green: #34d399;
  --blue: #60a5fa;
  --orange: #fb923c;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* ===== UTILITIES ===== */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-3) 60%, #e879f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== NAVBAR ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 24px;
  background: rgba(5, 5, 8, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-slow);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 40px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.nav-logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  flex: 1;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
}

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

.nav-cta {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-2);
  transition: color var(--transition);
}

.nav-cta:hover {
  color: var(--accent-3);
}

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 64px;
  padding: 120px 64px 80px;
  max-width: 1280px;
  margin: 0 auto;
  overflow: hidden;
}

.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 110, 247, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 110, 247, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
  pointer-events: none;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
}

.hero-glow-1 {
  width: 600px;
  height: 400px;
  background: rgba(124, 110, 247, 0.12);
  top: 10%;
  left: -10%;
}

.hero-glow-2 {
  width: 400px;
  height: 400px;
  background: rgba(232, 121, 249, 0.08);
  top: 30%;
  right: 5%;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-2);
  background: rgba(124, 110, 247, 0.1);
  border: 1px solid rgba(124, 110, 247, 0.2);
  border-radius: 100px;
  padding: 6px 14px;
  margin-bottom: 28px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-2);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: 24px;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 40px;
  max-width: 480px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 56px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: opacity var(--transition), transform var(--transition);
  box-shadow: 0 8px 24px rgba(124, 110, 247, 0.3);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.03);
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 32px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
}

/* ===== HERO VISUAL ===== */
.hero-visual {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cluster-viz {
  position: relative;
  width: 380px;
  height: 380px;
}

.cluster-node {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition-slow);
}

.cluster-node span {
  font-size: 11px;
  text-align: center;
  color: var(--text-secondary);
}

.node-center {
  width: 80px;
  height: 80px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(124, 110, 247, 0.2), rgba(167, 139, 250, 0.1));
  border-color: rgba(124, 110, 247, 0.4);
  color: var(--accent-2);
  box-shadow: 0 0 40px rgba(124, 110, 247, 0.2);
  animation: float-center 4s ease-in-out infinite;
}

@keyframes float-center {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.05); }
}

.node-a { width: 72px; height: 72px; top: 8%; left: 50%; transform: translateX(-50%); animation: float-node 5s ease-in-out infinite 0s; }
.node-b { width: 64px; height: 64px; top: 25%; right: 5%; animation: float-node 5s ease-in-out infinite 0.8s; }
.node-c { width: 68px; height: 68px; bottom: 12%; right: 10%; animation: float-node 5s ease-in-out infinite 1.6s; }
.node-d { width: 60px; height: 60px; bottom: 10%; left: 12%; animation: float-node 5s ease-in-out infinite 2.4s; }
.node-e { width: 66px; height: 66px; top: 22%; left: 5%; animation: float-node 5s ease-in-out infinite 3.2s; }

@keyframes float-node {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.node-a { animation: float-nodeA 5s ease-in-out infinite 0s; }
@keyframes float-nodeA {
  0%, 100% { transform: translateX(-50%) translateY(0px); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

.cluster-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, rgba(124, 110, 247, 0.5), rgba(124, 110, 247, 0.1));
  transform-origin: left center;
  top: 50%;
  left: 50%;
}

.line-1 { width: 110px; transform: rotate(-85deg); }
.line-2 { width: 115px; transform: rotate(-30deg); }
.line-3 { width: 130px; transform: rotate(45deg); }
.line-4 { width: 125px; transform: rotate(130deg); }
.line-5 { width: 120px; transform: rotate(200deg); }

.cluster-badge {
  position: absolute;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 100px;
  padding: 4px 10px;
  animation: badge-pulse 3s ease-in-out infinite;
}

.badge-top { top: 4%; left: 65%; }
.badge-right { top: 28%; right: 0%; }

.badge-similarity {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}

@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== SECTIONS ===== */
.section {
  padding: 96px 0;
}

.section-dark {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-header {
  text-align: center;
  margin-bottom: 64px;
}

.section-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-2);
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.2;
  margin-bottom: 16px;
}

.section-desc {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ===== STEPS ===== */
.steps-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: start;
  gap: 16px;
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: all var(--transition);
}

.step-card:hover {
  border-color: rgba(124, 110, 247, 0.3);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.step-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-1);
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.step-icon {
  width: 44px;
  height: 44px;
  background: rgba(124, 110, 247, 0.1);
  border: 1px solid rgba(124, 110, 247, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-2);
  margin-bottom: 16px;
}

.step-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.step-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.step-tag {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent-3);
  background: rgba(124, 110, 247, 0.08);
  border: 1px solid rgba(124, 110, 247, 0.15);
  border-radius: 4px;
  padding: 3px 8px;
}

.step-arrow {
  font-size: 20px;
  color: var(--text-muted);
  margin-top: 80px;
  flex-shrink: 0;
}

/* ===== FEATURES ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
}

.feature-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.feature-large {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto 1fr;
  gap: 0 32px;
}

.feature-large .feature-icon {
  grid-row: 1;
  grid-column: 1;
}

.feature-large .feature-title {
  grid-row: 2;
  grid-column: 1;
}

.feature-large .feature-desc {
  grid-row: 3;
  grid-column: 1;
}

.feature-large .feature-metric {
  grid-row: 1 / 4;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(124, 110, 247, 0.08);
  border: 1px solid rgba(124, 110, 247, 0.15);
  border-radius: var(--radius-md);
  padding: 24px 32px;
  min-width: 140px;
}

.feature-highlight {
  background: linear-gradient(135deg, rgba(124, 110, 247, 0.1), rgba(167, 139, 250, 0.05));
  border-color: rgba(124, 110, 247, 0.25);
}

.feature-icon {
  width: 48px;
  height: 48px;
  background: rgba(124, 110, 247, 0.1);
  border: 1px solid rgba(124, 110, 247, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-2);
  margin-bottom: 20px;
}

.feature-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

.feature-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.metric-value {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -2px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

/* ===== TECH STACK ===== */
.tech-stack {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tech-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  transition: all var(--transition);
}

.tech-item:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.tech-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tech-fastapi  { background: rgba(0, 150, 136, 0.15); color: #00bfa5; }
.tech-postgres { background: rgba(51, 103, 145, 0.15); color: #4a9eda; }
.tech-redis    { background: rgba(220, 50, 47, 0.12); color: #e05252; }
.tech-openai   { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }
.tech-alembic  { background: rgba(124, 110, 247, 0.12); color: var(--accent-2); }
.tech-jwt      { background: rgba(251, 146, 60, 0.12); color: var(--orange); }

.tech-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tech-name {
  font-size: 15px;
  font-weight: 700;
}

.tech-role {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== API ===== */
.api-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.endpoint-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.endpoint-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent-2);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.endpoint-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.endpoint-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.method {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 48px;
  text-align: center;
}

.method-get  { background: rgba(96, 165, 250, 0.15); color: var(--blue); }
.method-post { background: rgba(52, 211, 153, 0.15); color: var(--green); }

.endpoint-path {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.endpoint-desc {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ===== CODE BLOCK ===== */
.api-example {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.code-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.code-lang {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 3px 8px;
  border-radius: 4px;
}

.code-block {
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}

.code-comment { color: #555580; }
.code-string  { color: var(--green); }
.code-key     { color: var(--accent-3); }

/* ===== FOOTER ===== */
.footer {
  padding: 64px 0 32px;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 64px;
  margin-bottom: 48px;
}

.footer-brand {
  max-width: 280px;
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  gap: 64px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.footer-link {
  font-size: 14px;
  color: var(--text-muted);
  transition: color var(--transition);
}

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

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.footer-powered strong {
  color: var(--text-secondary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 120px 32px 60px;
  }

  .hero-subtitle { max-width: 100%; }
  .hero-actions { justify-content: center; }
  .hero-stats { justify-content: center; }
  .hero-visual { display: none; }

  .steps-grid {
    grid-template-columns: 1fr;
  }

  .step-arrow { display: none; }

  .features-grid { grid-template-columns: 1fr 1fr; }
  .feature-large {
    grid-column: span 2;
    grid-template-columns: 1fr;
  }
  .feature-large .feature-metric {
    grid-row: auto;
    grid-column: auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
  }

  .tech-stack { grid-template-columns: 1fr 1fr; }
  .api-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-cta { display: none; }

  .section { padding: 64px 0; }
  .section-header { margin-bottom: 40px; }

  .features-grid { grid-template-columns: 1fr; }
  .feature-large { grid-column: auto; }

  .tech-stack { grid-template-columns: 1fr; }

  .endpoint-desc { display: none; }
  .endpoint-path { font-size: 11px; }

  .footer-content { flex-direction: column; gap: 32px; }
  .footer-links { gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 480px) {
  .hero { padding: 100px 20px 60px; }
  .hero-stats { flex-direction: column; gap: 16px; }
  .stat-divider { width: 40px; height: 1px; }
  .hero-actions { flex-direction: column; width: 100%; }
  .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
}
