/* ===== CSS Variables ===== */
:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --border: #e0e0e0;
  --accent: #000000;
  --muted: #666666;
  --hover: #f5f5f5;
  --section-alt: #fafafa;

  --premium: #fbbf24;
  --comfortable: #22d3ee;
  --adventure: #34d399;
  --success: #10b981;
  --error: #ef4444;

  --maxw: 1100px;
}

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

html {
  font-size: clamp(14px, 1vw, 16px);
  scroll-behavior: smooth;
}

body {
  font-family: 'JetBrains Mono', monospace;
  background-color: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background-color: var(--bg);
  z-index: 100;
}

.topbar h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  text-decoration: none;
}

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

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

.btn-primary:hover {
  opacity: 0.9;
}

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

.btn-large {
  padding: 1rem 2rem;
  font-size: 1rem;
}

/* ===== Container ===== */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ===== Hero Section ===== */
.hero {
  padding: 6rem 0;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Sections ===== */
.section {
  padding: 5rem 0;
}

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

.section-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--muted);
  text-align: center;
  margin-bottom: 3rem;
}

/* ===== Features Grid - Pyramid Layout (3+2) ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.features-pyramid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.features-pyramid .feature-card:nth-child(4),
.features-pyramid .feature-card:nth-child(5) {
  grid-column: span 1;
}

/* Center the last 2 cards */
.features-pyramid::after {
  content: '';
  grid-column: 1;
}

@supports (display: grid) {
  .features-pyramid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
  }

  .features-pyramid .feature-card:nth-child(1) { grid-column: 1 / 3; }
  .features-pyramid .feature-card:nth-child(2) { grid-column: 3 / 5; }
  .features-pyramid .feature-card:nth-child(3) { grid-column: 5 / 7; }
  .features-pyramid .feature-card:nth-child(4) { grid-column: 2 / 4; }
  .features-pyramid .feature-card:nth-child(5) { grid-column: 4 / 6; }
}

.feature-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 0.2s ease;
  text-align: center;
}

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

.feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.feature-source {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* ===== Steps (How it Works) ===== */
.steps {
  max-width: 700px;
  margin: 0 auto;
}

.step {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.step:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.step-number {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--accent);
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.25rem;
}

.step-content h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.step-content p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===== Pricing Tiers ===== */
.tiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tier-card {
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  border-top: 4px solid var(--border);
}

.tier-premium { border-top-color: var(--premium); }
.tier-comfortable { border-top-color: var(--comfortable); }
.tier-adventure { border-top-color: var(--adventure); }

.tier-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.75rem;
  border-radius: 2px;
  margin-bottom: 1rem;
}

.tier-premium .tier-badge {
  background-color: var(--premium);
  color: #000;
}

.tier-comfortable .tier-badge {
  background-color: var(--comfortable);
  color: #000;
}

.tier-adventure .tier-badge {
  background-color: var(--adventure);
  color: #000;
}

.tier-card h3 {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.tier-card ul {
  list-style: none;
}

.tier-card li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.tier-card li:last-child {
  border-bottom: none;
}

.tier-card li::before {
  content: "→ ";
  color: var(--muted);
}

/* ===== Algorithm Section - 3x2 Grid ===== */
.algo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.algo-grid-3x2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.algo-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.algo-card:hover {
  border-color: var(--accent);
}

.algo-card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.algo-card p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ===== API Grid - 3x2 Layout ===== */
.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.api-grid-3x2 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.api-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.2s ease;
}

.api-card:hover {
  border-color: var(--accent);
}

.api-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.api-card p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.api-type {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  background-color: var(--hover);
  border-radius: 2px;
}

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

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.success-message {
  padding: 1rem;
  border: 1px solid var(--success);
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-radius: 4px;
  text-align: center;
}

.error-message {
  padding: 1rem;
  border: 1px solid var(--error);
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-radius: 4px;
  text-align: center;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.footer p {
  margin-bottom: 0.5rem;
}

.footer a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
}

.footer a:hover {
  opacity: 0.7;
}

.footer-credit {
  font-size: 0.8rem;
}

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

  .features-pyramid .feature-card:nth-child(1),
  .features-pyramid .feature-card:nth-child(2),
  .features-pyramid .feature-card:nth-child(3),
  .features-pyramid .feature-card:nth-child(4),
  .features-pyramid .feature-card:nth-child(5) {
    grid-column: auto;
  }

  .algo-grid-3x2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .api-grid-3x2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .topbar {
    padding: 1rem;
  }

  .hero {
    padding: 4rem 0;
  }

  .section {
    padding: 3rem 0;
  }

  .step {
    flex-direction: column;
    text-align: center;
  }

  .step-number {
    margin: 0 auto;
  }

  .features-pyramid,
  .algo-grid-3x2,
  .api-grid-3x2 {
    grid-template-columns: 1fr;
  }
}

/* ===== Animations ===== */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}
