/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --bg-alt: #f6f9fc;
  --fg: #0a2540;
  --fg-muted: #425466;
  --muted: #8898aa;
  --accent: #635bff;
  --accent-hover: #5851ea;
  --accent-light: rgba(99, 91, 255, 0.1);
  --success: #00d97e;
  --border: #e3e8ef;
  --border-hover: #cbd5e0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  
  /* Stripe-style gradient */
  --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(99, 91, 255, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Stripe-style gradient background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 600px;
  background: var(--gradient-hero);
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

/* Typography */
h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin-bottom: 1rem;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--fg);
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  color: var(--fg-muted);
  font-size: 1.125rem;
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

@media (max-width: 960px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Header */
.header {
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: all 0.3s ease;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.logo-text {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--fg);
}

.nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--fg-muted);
  padding: 0.5rem 0;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--fg);
}

/* Hero */
.hero {
  padding: 8rem 0 6rem;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.hero-inner {
  align-items: center;
}

.hero-title {
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.6s ease-out;
}

.hero-subtitle {
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  color: var(--fg-muted);
  margin-bottom: 2.5rem;
  max-width: 600px;
  line-height: 1.6;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-visual {
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  max-width: 400px;
  width: 100%;
}

.card-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--fg);
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-label {
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-family);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.button-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-md);
}

.button-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.button-secondary {
  background: white;
  color: var(--fg);
  border: 1px solid var(--border);
}

.button-secondary:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

/* Sections */
.section {
  padding: 6rem 0;
  position: relative;
  z-index: 1;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

.section-subtitle {
  text-align: center;
  font-size: 1.125rem;
  color: var(--fg-muted);
  margin-bottom: 3rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

/* Cards */
.card {
  padding: 2rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--border-hover);
}

.card h3 {
  margin-bottom: 1rem;
  color: var(--fg);
}

.card p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg-muted);
}

/* State Tree */
.tree-wrapper {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3rem;
  box-shadow: var(--shadow-md);
  margin-top: 2rem;
}

#state-tree {
  width: 100%;
  height: auto;
  min-height: 400px;
}

.tree-node {
  fill: white;
  stroke: var(--accent);
  stroke-width: 2;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tree-node:hover {
  fill: var(--accent-light);
  stroke-width: 3;
}

.tree-link {
  stroke: var(--border);
  stroke-width: 2;
  fill: none;
  transition: stroke 0.3s ease;
}

.tree-link.animated {
  stroke: var(--accent);
  stroke-dasharray: 5, 5;
  animation: dash 1s linear infinite;
}

@keyframes dash {
  to {
    stroke-dashoffset: -10;
  }
}

.tree-label {
  font-size: 0.875rem;
  fill: var(--fg);
  font-weight: 500;
  pointer-events: none;
}

.tree-label.root {
  font-size: 1rem;
  font-weight: 700;
  fill: var(--accent);
}

.tree-label.branch {
  font-weight: 600;
  fill: var(--fg-muted);
}

/* Progressive reveal */
.tree-hidden {
  opacity: 0;
  transform: translateY(6px);
}
.tree-show {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .45s ease, transform .45s ease;
}
/* Features list */
.features-list {
  list-style: none;
  max-width: 800px;
  margin: 0 auto;
}

.features-list li {
  padding: 0.75rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: 1.125rem;
  color: var(--fg-muted);
  transition: all 0.2s ease;
}

.features-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 600;
}

.features-list li:hover {
  padding-left: 2rem;
  color: var(--fg);
}

/* Playground */
.playground-grid {
  margin-top: 2rem;
}

.playground-samples h3,
.playground-client h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.samples-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sample-btn {
  width: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  background: white;
  color: var(--fg);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.sample-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.sample-btn .method {
  font-weight: 600;
  margin-right: 0.5rem;
  color: var(--accent);
}

.sample-btn .path {
  color: var(--fg-muted);
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
}

/* Form */
.playground-form {
  margin-bottom: 2rem;
}

.form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg);
}

.input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: var(--font-family);
  background: white;
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input-select {
  flex: 0 0 120px;
}

.input-path {
  flex: 1;
  font-family: 'Courier New', monospace;
}

.input-textarea {
  font-family: 'Courier New', monospace;
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 200px;
}

.form-actions {
  display: flex;
  gap: 1rem;
}

/* Response Panel */
.response-panel {
  margin-top: 2rem;
  border: 1px solid var(--border);
  padding: 1.5rem;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.response-status {
  font-weight: 600;
  font-family: 'Courier New', monospace;
  padding: 0.25rem 0.75rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
  font-size: 0.875rem;
}

.response-duration {
  font-size: 0.875rem;
  color: var(--muted);
  font-family: 'Courier New', monospace;
}

.response-headers {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-family: 'Courier New', monospace;
  color: var(--fg-muted);
  padding: 0.75rem;
  background: var(--bg-alt);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.response-body {
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  color: var(--fg);
  margin: 0;
  padding: 1rem;
  background: var(--bg-alt);
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Docs */
.docs-content {
  max-width: 900px;
  margin: 0 auto;
}

.docs-section {
  margin-bottom: 3rem;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.docs-section h3 {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.docs-section ul,
.docs-section ol {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}

.docs-section li {
  margin-bottom: 0.75rem;
  line-height: 1.7;
  color: var(--fg-muted);
}

.docs-section code {
  font-family: 'Courier New', monospace;
  font-size: 0.9375em;
  background: var(--bg-alt);
  padding: 0.125rem 0.375rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
}

/* Community */
.community-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Footer */
.footer {
  padding: 4rem 0 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  position: relative;
}

.footer-content {
  text-align: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.footer-logo .logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--muted);
}

/* Diagram */
.diagram-container {
  margin-top: 3rem;
  text-align: center;
  position: relative;
}

.diagram {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1.5rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .nav {
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero {
    padding: 4rem 0 3rem;
  }

  .section {
    padding: 4rem 0;
  }

  .form-row {
    flex-direction: column;
  }

  .input-select {
    flex: 1;
  }

  .button {
    width: 100%;
  }
}
