@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500&family=Space+Grotesk:wght@500;600;700&display=swap');

/* ==========================================================================
   DESIGN TOKENS & SYSTEM VARIABLES
   ========================================================================== */
:root {
  /* Colors */
  --bg-primary: #F7F7F5;          /* Titanium White */
  --bg-secondary: #E7E9EC;        /* Silver-Gray */
  --ink-primary: #14161C;         /* Midnight Slate */
  --ink-muted: #575C66;           /* Graphite Muted */
  --accent-copper: #B87333;       /* Burnished Copper */
  --accent-copper-hover: #9A5A22; /* Darker Copper */
  --accent-copper-light: rgba(184, 115, 51, 0.08);

  /* Typography Sizes */
  --fs-h1: 3.5rem;      /* 56px */
  --fs-h2: 2.25rem;     /* 36px */
  --fs-h3: 1.5rem;      /* 24px */
  --fs-body-lg: 1.125rem; /* 18px */
  --fs-body: 1rem;      /* 16px */
  --fs-mono: 0.81rem;   /* 13px */

  /* Borders & Shadows */
  --radius-sharp: 4px;
  --border-standard: 1px solid var(--bg-secondary);
  --border-accent: 1px solid var(--accent-copper);
  --shadow-subtle: 0 4px 20px -2px rgba(20, 22, 28, 0.04);
  --shadow-hover: 0 12px 30px -4px rgba(20, 22, 28, 0.08);

  /* Layout Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 64px;
  --space-xxl: 128px;
  --container-max: 1200px;

  /* Transitions */
  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: all 300ms var(--ease-premium);
  --transition-slow: all 800ms var(--ease-premium);
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--ink-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-normal);
}

li {
  list-style: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

img, svg {
  max-width: 100%;
  display: block;
}

/* Typography Styles */
h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--fs-h1);
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--fs-h2);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--fs-h3);
  font-weight: 500;
  letter-spacing: 0;
  margin-bottom: var(--space-sm);
}

p {
  font-size: var(--fs-body);
  color: var(--ink-muted);
  margin-bottom: var(--space-md);
}

p.lead {
  font-size: var(--fs-body-lg);
  line-height: 1.6;
}

.mono-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--fs-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-copper);
}

/* ==========================================================================
   LAYOUT STRUCTURE
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

section {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  section {
    padding-top: var(--space-xxl);
    padding-bottom: var(--space-xxl);
  }
}

/* ==========================================================================
   HEADER NAVIGATION
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 247, 245, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: var(--border-standard);
  transition: var(--transition-normal);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.logo-dot {
  width: 8px;
  height: 8px;
  background-color: var(--accent-copper);
  border-radius: 50%;
  display: inline-block;
}

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

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-muted);
  position: relative;
  padding: var(--space-xs) 0;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: var(--accent-copper);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 250ms var(--ease-premium);
}

.nav-link:hover, .nav-link.active {
  color: var(--ink-primary);
}

.nav-link:hover::after, .nav-link.active::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 24px;
  height: 24px;
  position: relative;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--ink-primary);
  position: absolute;
  left: 0;
  transition: var(--transition-normal);
}

.menu-toggle span:nth-child(1) { top: 4px; }
.menu-toggle span:nth-child(2) { top: 11px; }
.menu-toggle span:nth-child(3) { top: 18px; }

/* Mobile Menu Active States */
.menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 767px) {
  .menu-toggle {
    display: block;
  }

  .nav-menu {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: calc(100vh - 80px);
    background-color: var(--bg-primary);
    border-top: var(--border-standard);
    flex-direction: column;
    padding: var(--space-xl) var(--space-md);
    gap: var(--space-lg);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-normal);
    z-index: 99;
  }

  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }
}

/* ==========================================================================
   BUTTONS & CTAs
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px var(--space-md);
  border-radius: var(--radius-sharp);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-normal);
  cursor: pointer;
  border: none;
}

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

.btn-primary:hover {
  background-color: var(--accent-copper-hover);
}

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

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

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* ==========================================================================
   CARDS & GRIDS
   ========================================================================== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.grid-4 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background-color: var(--bg-secondary);
  border: var(--border-standard);
  border-radius: var(--radius-sharp);
  padding: var(--space-md);
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-subtle);
}

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

.card-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.card-icon {
  margin-bottom: var(--space-sm);
  color: var(--accent-copper);
}

.card-meta {
  margin-top: auto;
  padding-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-weight: 500;
  font-size: 0.9rem;
}

.card-arrow {
  transition: transform 200ms var(--ease-premium);
}

.card:hover .card-arrow {
  transform: translateX(4px);
}

/* ==========================================================================
   HERO SECTIONS
   ========================================================================== */
.hero {
  position: relative;
  padding-top: calc(var(--space-xl) + 40px);
  overflow: hidden;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: var(--space-xl);
}

@media (min-width: 1024px) {
  .hero-layout {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

.hero-content h1 {
  font-size: clamp(2.5rem, 5vw, var(--fs-h1));
  line-height: 1.1;
}

.hero-visual {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ==========================================================================
   NODE GRAPH / NETWORK SVG ANIMATION
   ========================================================================== */
.network-svg {
  width: 100%;
  max-width: 480px;
  height: auto;
}

/* SVG Line Drawing and Node Fading animations */
.net-grid {
  stroke: var(--bg-secondary);
  stroke-dasharray: 4;
}

.net-line {
  stroke: var(--ink-primary);
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.3;
}

.net-line.highlight {
  stroke: var(--accent-copper);
  stroke-width: 2.5;
  opacity: 1;
}

.net-node {
  fill: var(--bg-primary);
  stroke: var(--ink-primary);
  stroke-width: 2;
  transition: var(--transition-normal);
}

.net-node.highlight {
  stroke: var(--accent-copper);
  fill: var(--accent-copper-light);
}

.net-node.center {
  fill: var(--ink-primary);
  stroke: var(--ink-primary);
}

/* CSS Keyframes for Page-Load Draw-in */
@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes fadeInNode {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  opacity: 0;
  animation: drawLine 1.5s var(--ease-premium) forwards;
}

.animate-line.delay-1 { animation-delay: 300ms; }
.animate-line.delay-2 { animation-delay: 600ms; }

.animate-node {
  opacity: 0;
  transform: scale(0.5);
  transform-origin: center;
  animation: fadeInNode 600ms var(--ease-premium) forwards;
}

.animate-node.delay-1 { animation-delay: 100ms; }
.animate-node.delay-2 { animation-delay: 200ms; }
.animate-node.delay-3 { animation-delay: 400ms; }
.animate-node.delay-4 { animation-delay: 800ms; }

/* ==========================================================================
   INTERACTIVE SIMULATOR WIDGET
   ========================================================================== */
.simulator-section {
  background-color: var(--bg-secondary);
  border-top: var(--border-standard);
  border-bottom: var(--border-standard);
}

.simulator-box {
  background-color: var(--bg-primary);
  border: var(--border-standard);
  border-radius: var(--radius-sharp);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .simulator-box {
    grid-template-columns: 300px 1fr;
  }
}

.simulator-tabs {
  background-color: var(--bg-secondary);
  border-bottom: var(--border-standard);
  display: flex;
  flex-direction: row;
  overflow-x: auto;
}

@media (min-width: 768px) {
  .simulator-tabs {
    flex-direction: column;
    border-bottom: none;
    border-right: var(--border-standard);
    overflow-x: visible;
  }
}

.sim-tab-btn {
  background: none;
  border: none;
  padding: var(--space-md);
  text-align: left;
  cursor: pointer;
  transition: var(--transition-normal);
  color: var(--ink-muted);
  font-weight: 600;
  white-space: nowrap;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
}

@media (min-width: 768px) {
  .sim-tab-btn {
    white-space: normal;
    border-bottom: var(--border-standard);
  }
  .sim-tab-btn:last-child {
    border-bottom: none;
  }
}

.sim-tab-btn:hover {
  background-color: rgba(20, 22, 28, 0.02);
  color: var(--ink-primary);
}

.sim-tab-btn.active {
  background-color: var(--bg-primary);
  color: var(--ink-primary);
  box-shadow: inset 3px 0 0 0 var(--accent-copper);
}

.simulator-display {
  display: flex;
  flex-direction: column;
  height: 480px;
}

.sim-display-header {
  padding: var(--space-md);
  border-bottom: var(--border-standard);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sim-agent-profile {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sim-agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--accent-copper-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-copper);
}

.sim-agent-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.sim-agent-status {
  font-size: 0.8rem;
  color: #2e7d32;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.status-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #2e7d32;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(46, 125, 50, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}

.sim-chat-area {
  flex: 1;
  padding: var(--space-md);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background-color: #FAFAFA;
}

/* Chat bubble styling */
.chat-msg {
  max-width: 80%;
  padding: 12px var(--space-md);
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(10px);
  animation: msgShow 400ms var(--ease-premium) forwards;
}

@keyframes msgShow {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg.agent {
  background-color: var(--bg-secondary);
  color: var(--ink-primary);
  align-self: flex-start;
  border-bottom-left-radius: 2px;
}

.chat-msg.user {
  background-color: var(--ink-primary);
  color: var(--bg-primary);
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.sim-action-area {
  padding: var(--space-md);
  border-top: var(--border-standard);
  display: flex;
  gap: var(--space-sm);
  background-color: var(--bg-primary);
}

.sim-action-btn {
  flex: 1;
  padding: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px dashed var(--accent-copper);
  background-color: var(--accent-copper-light);
  color: var(--accent-copper);
  border-radius: var(--radius-sharp);
  cursor: pointer;
  transition: var(--transition-normal);
}

.sim-action-btn:hover {
  background-color: var(--accent-copper);
  color: var(--bg-primary);
  border-style: solid;
}

.sim-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   TIMELINES (HOW IT WORKS)
   ========================================================================== */
.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-md) 0;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 2px;
  background-color: var(--bg-secondary);
}

@media (min-width: 768px) {
  .timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-xl);
}

.timeline-item::after {
  content: '';
  display: table;
  clear: both;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  background-color: var(--bg-primary);
  border: 3px solid var(--accent-copper);
  border-radius: 50%;
  position: absolute;
  left: 13px;
  top: 6px;
  z-index: 1;
}

@media (min-width: 768px) {
  .timeline-dot {
    left: 50%;
    transform: translateX(-50%);
  }
}

.timeline-content {
  width: 100%;
  padding-left: 50px;
  float: right;
  position: relative;
}

@media (min-width: 768px) {
  .timeline-content {
    width: 45%;
    padding-left: 0;
  }
  .timeline-item:nth-child(odd) .timeline-content {
    float: left;
    text-align: right;
  }
  .timeline-item:nth-child(even) .timeline-content {
    float: right;
    text-align: left;
  }
}

.timeline-card {
  background-color: var(--bg-primary);
  border: var(--border-standard);
  border-radius: var(--radius-sharp);
  padding: var(--space-md);
  box-shadow: var(--shadow-subtle);
}

/* ==========================================================================
   STAT BLOCKS & METRICS
   ========================================================================== */
.stat-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
  .stat-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  background-color: var(--bg-primary);
  border-left: 3px solid var(--accent-copper);
  border-top: var(--border-standard);
  border-bottom: var(--border-standard);
  border-right: var(--border-standard);
  border-radius: var(--radius-sharp);
  padding: var(--space-md);
  box-shadow: var(--shadow-subtle);
}

.stat-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.stat-description {
  font-size: 0.85rem;
  margin-top: var(--space-xs);
  color: var(--ink-muted);
  margin-bottom: 0;
}

/* ==========================================================================
   MOTION SYSTEMS & SCROLL REVEAL
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 800ms var(--ease-premium), transform 800ms var(--ease-premium);
}

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

/* Stagger Grid Container Reveal */
.stagger-grid > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 800ms var(--ease-premium), transform 800ms var(--ease-premium);
}

.stagger-grid.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay classes (using nth-child rules for up to 6 children) */
.stagger-grid.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.stagger-grid.is-visible > *:nth-child(2) { transition-delay: 80ms; }
.stagger-grid.is-visible > *:nth-child(3) { transition-delay: 160ms; }
.stagger-grid.is-visible > *:nth-child(4) { transition-delay: 240ms; }
.stagger-grid.is-visible > *:nth-child(5) { transition-delay: 320ms; }
.stagger-grid.is-visible > *:nth-child(6) { transition-delay: 400ms; }

/* ==========================================================================
   SITE FOOTER
   ========================================================================== */
.site-footer {
  background-color: var(--ink-primary);
  color: var(--bg-primary);
  padding-top: var(--space-xl);
  padding-bottom: var(--space-lg);
  margin-top: auto;
  border-top: var(--border-standard);
}

.site-footer p {
  color: var(--bg-secondary);
  opacity: 0.8;
}

.footer-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

@media (min-width: 768px) {
  .footer-layout {
    grid-template-columns: 1.5fr repeat(3, 1fr);
  }
}

.footer-brand .logo {
  color: var(--bg-primary);
  margin-bottom: var(--space-sm);
}

.footer-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.footer-link {
  font-size: 0.9rem;
  color: var(--bg-secondary);
  opacity: 0.8;
}

.footer-link:hover {
  opacity: 1;
  color: var(--accent-copper);
}

.footer-bottom {
  border-top: 1px solid rgba(231, 233, 236, 0.1);
  padding-top: var(--space-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  opacity: 0.7;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
  }
}

/* ==========================================================================
   ACCESSIBILITY & PREFERS REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
    transform: none !important;
  }
  .reveal, .stagger-grid > *, .chat-msg {
    opacity: 1 !important;
    transform: none !important;
  }
}
