/* ============================================
   SWARM — swarm-software.ai
   Dark theme derived from project defaults
   ============================================ */

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

:root {
  /* Core palette — from project oklch mapped to hex */
  --bg:             #0a0a14;
  --bg-subtle:      #10101e;
  --surface:        #161628;
  --surface-hover:  #1e1e34;
  --card:           #1a1a30;
  --border:         #2a2a44;
  --border-light:   #33335a;

  --text:           #ececf0;
  --text-secondary: #9e9eaa;
  --text-muted:     #6e6e80;

  --primary:        #00d4ff;
  --primary-dim:    #0099bb;
  --primary-glow:   rgba(0, 212, 255, 0.15);
  --primary-glow-s: rgba(0, 212, 255, 0.06);

  --accent:         #5ba3ff;
  --accent-dim:     rgba(91, 163, 255, 0.12);

  --success:        #00d988;
  --warning:        #ffb347;
  --danger:         #ff6b5b;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-2xl: 8rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.3s;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

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

/* --- Canvas Background --- */
#swarm-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* --- Container --- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(10, 10, 20, 0.7);
  border-bottom: 1px solid rgba(42, 42, 68, 0.5);
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

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

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text);
}

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

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease);
}

.nav-links a:hover {
  color: var(--text);
}

.nav-cta {
  background: var(--primary);
  color: var(--bg) !important;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.825rem !important;
  transition: opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.nav-cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: var(--duration) var(--ease);
}

/* --- Hero --- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(64px + var(--space-xl)) var(--space-md) var(--space-xl);
}

.hero-inner {
  max-width: 800px;
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-glow);
  border: 1px solid rgba(0, 212, 255, 0.2);
  padding: 6px 18px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-lg);
  animation: fadeUp 0.8s var(--ease) both;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-md);
  animation: fadeUp 0.8s 0.1s var(--ease) both;
}

.hero-title-line {
  display: block;
}

.hero-title .accent {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--space-lg);
  line-height: 1.7;
  animation: fadeUp 0.8s 0.2s var(--ease) both;
}

.hero-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp 0.8s 0.3s var(--ease) both;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  transition: all var(--duration) var(--ease);
  cursor: pointer;
  border: none;
  font-family: inherit;
}

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

.btn-primary:hover {
  box-shadow: 0 0 30px var(--primary-glow);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

/* --- Metrics --- */
.hero-metrics {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  animation: fadeUp 0.8s 0.5s var(--ease) both;
}

.metric {
  text-align: center;
}

.metric-value {
  display: block;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.metric-suffix {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--primary);
}

.metric-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.metric-sep {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* --- Sections --- */
.section {
  position: relative;
  z-index: 1;
  padding: var(--space-2xl) 0;
}

.section-alt {
  background: var(--bg-subtle);
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto var(--space-xl);
}

.section-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--space-sm);
}

.section-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* --- Capabilities Grid --- */
.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.cap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md);
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
}

.cap-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, var(--primary-glow-s), transparent 70%);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}

.cap-card:hover {
  border-color: var(--border-light);
  transform: translateY(-4px);
}

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

.cap-icon {
  width: 40px;
  height: 40px;
  color: var(--primary);
  margin-bottom: var(--space-md);
  position: relative;
}

.cap-icon svg {
  width: 100%;
  height: 100%;
}

.cap-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  position: relative;
}

.cap-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
  position: relative;
}

/* --- Architecture Visual --- */
.arch-visual {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 1;
  margin: 0 auto;
}

.arch-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.arch-ring-outer {
  border: 1px solid var(--border);
  animation: ringRotate 60s linear infinite;
}

.arch-ring-inner {
  inset: 25%;
  border: 1px dashed rgba(42, 42, 68, 0.6);
  animation: ringRotate 30s linear infinite reverse;
}

/* Outer nodes — integrations */
.arch-node {
  position: absolute;
  width: 48px;
  height: 48px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  /* distribute 6 nodes around circle */
  top: 50%;
  left: 50%;
  transform: rotate(calc(var(--i) * 60deg)) translateY(calc(-50% - (min(280px, 40vw) - 24px))) rotate(calc(var(--i) * -60deg));
  animation: ringRotate 60s linear infinite reverse;
  transition: border-color var(--duration) var(--ease), color var(--duration) var(--ease);
}

.arch-node svg {
  width: 20px;
  height: 20px;
}

.arch-node::after {
  content: attr(data-label);
  position: absolute;
  bottom: -22px;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.arch-node:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Inner nodes — agents */
.arch-agent {
  position: absolute;
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: rotate(calc(var(--j) * 90deg)) translateY(calc(-50% - (min(140px, 20vw) - 18px))) rotate(calc(var(--j) * -90deg));
  animation: ringRotate 30s linear infinite;
}

.arch-agent::after {
  content: attr(data-label);
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--primary);
  white-space: nowrap;
}

.agent-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0;
  animation: pulse 3s var(--ease) infinite;
  animation-delay: calc(var(--j, 0) * 0.75s);
}

/* Center core */
.arch-core {
  position: absolute;
  width: 80px;
  height: 80px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--primary);
  z-index: 2;
}

.arch-core span {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--primary);
}

.core-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  z-index: -1;
}

/* --- Workflow Timeline --- */
.workflow-timeline {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  padding-left: 40px;
}

.workflow-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, var(--primary), var(--border));
}

.wf-step {
  position: relative;
  padding: 0 0 var(--space-xl) 0;
}

.wf-step:last-child {
  padding-bottom: 0;
}

.wf-dot {
  position: absolute;
  left: -36px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--primary);
}

.wf-step::before {
  content: attr(data-step);
  position: absolute;
  left: -76px;
  top: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.wf-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.wf-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* --- Code Demo --- */
.code-demo {
  max-width: 720px;
  margin: 0 auto;
}

.code-window {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.code-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red    { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green  { background: #28c840; }

.code-title {
  margin-left: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.code-body {
  padding: var(--space-md) var(--space-md) var(--space-lg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.8;
}

.code-line {
  margin-bottom: var(--space-sm);
}

.code-prompt {
  color: var(--text-muted);
  font-weight: 500;
}

.code-prompt::after {
  content: ' › ';
}

.code-prompt.agent {
  color: var(--primary);
}

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

.code-dim    { color: var(--text-muted); }
.code-accent { color: var(--primary); font-weight: 500; }
.code-success { color: var(--success); }
.code-muted   { color: var(--text-secondary); font-style: italic; }

.code-response {
  opacity: 0;
  animation: fadeUp 0.6s var(--delay, 0s) var(--ease) forwards;
}

/* --- Contact Form --- */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input:invalid:not(:placeholder-shown),
.form-group textarea:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
}

/* Honeypot — completely hidden from humans */
.form-hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

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

.form-status {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease);
}

.form-status.success {
  color: var(--success);
}

.form-status.error {
  color: var(--danger);
}

#cf-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* --- CTA --- */
.cta-section {
  text-align: center;
}

.cta-inner {
  padding: var(--space-xl) var(--space-lg);
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 50% 0%, var(--primary-glow), transparent 60%);
  border: 1px solid var(--border);
}

.cta-inner h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: var(--space-sm);
}

.cta-inner p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  font-size: 1.05rem;
}

.cta-divider {
  width: 60px;
  height: 1px;
  background: var(--border-light);
  margin: 0 auto var(--space-lg);
}

.cta-contact-heading {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 6px;
}

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

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.footer-tagline {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-copy {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-sep {
  margin: 0 0.4em;
  opacity: 0.4;
}

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

@keyframes ringRotate {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50%      { opacity: 0.3; transform: scale(1.6); }
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

/* --- Responsive --- */
@media (max-width: 900px) {
  .capabilities-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  :root {
    --space-2xl: 4rem;
  }

  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .hero-metrics {
    flex-direction: column;
    gap: var(--space-md);
  }

  .metric-sep {
    width: 40px;
    height: 1px;
  }

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

  .arch-visual {
    max-width: 320px;
  }

  .wf-step::before {
    display: none;
  }

  .workflow-timeline {
    padding-left: 32px;
  }

  .wf-dot {
    left: -28px;
  }

  .footer-inner {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}
