/* ── Cantrip Marketing Site ─────────────────────────────────────── */
/* No framework. Just CSS. Dark/light via prefers-color-scheme.      */

@import url("tokens.css");

/* Page-specific overrides */
:root { --max-w: 1080px; }

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

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

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; }

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

/* ── Skip link ────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
}

.skip-link:focus {
  top: 0.75rem;
  color: #fff;
}

/* ── Focus styles ─────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}

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

.btn-sm {
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
}

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

/* ── Navigation ────────────────────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

@supports not (backdrop-filter: blur(10px)) {
  nav { background: var(--bg); }
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.nav-links a:hover { color: var(--text); }

/* ── Mobile nav toggle ────────────────────────────────────────── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1.5rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    gap: 0;
  }

  .nav-links.open { display: flex; }

  .nav-links a {
    padding: 0.7rem 0;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links a:last-of-type { border-bottom: none; }

  .nav-links .btn-sm {
    margin-top: 0.5rem;
    text-align: center;
    justify-content: center;
  }
}

/* ── Theme Switcher ───────────────────────────────────────────── */
.theme-switcher {
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 0;
}

.theme-switcher button {
  background: none;
  border: none;
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
  white-space: nowrap;
}

.theme-switcher button:hover {
  color: var(--text);
}

.theme-switcher button[aria-pressed="true"] {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  .theme-switcher {
    align-self: center;
    margin-top: 0.5rem;
  }
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: 10rem 0 6rem;
  text-align: center;
}

.hero-logo {
  width: clamp(140px, 16vw, 200px);
  height: auto;
  margin-bottom: 2rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  margin-bottom: 1.25rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero-subtitle {
  max-width: 560px;
  margin: 0 auto 2rem;
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

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

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

section h2 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 3rem;
  font-size: 1.05rem;
}

/* ── Features ──────────────────────────────────────────────────── */
.features { background: var(--bg-subtle); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 650;
  margin-bottom: 0.4rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ── How It Works ──────────────────────────────────────────────── */
.steps {
  max-width: 640px;
  margin: 0 auto;
  list-style: none;
  counter-reset: step;
}

.step {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  counter-increment: step;
}

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

.step::before {
  content: counter(step);
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 50%;
}

.step-content h3 {
  font-size: 1.05rem;
  font-weight: 650;
  margin-bottom: 0.25rem;
}

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

/* ── Ecosystem ─────────────────────────────────────────────────── */
.ecosystem { background: var(--bg-subtle); }

.ecosystem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  max-width: 700px;
  margin: 0 auto;
}

.eco-item {
  text-align: center;
  padding: 1.25rem 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
}

.eco-item:hover { border-color: var(--accent); }

.eco-item strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.eco-item span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Quick Start ───────────────────────────────────────────────── */
.code-block {
  max-width: 580px;
  margin: 0 auto 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--code-border);
  box-shadow: var(--shadow-lg);
}

.code-header {
  display: flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--code-bg);
  border-bottom: 1px solid var(--code-border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.code-block pre {
  background: var(--code-bg);
  padding: 1.25rem;
  margin: 0;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  background: none;
  border: none;
  padding: 0;
}

.prompt { color: var(--accent); }
.comment { color: var(--text-muted); }
.dim { opacity: 0.6; }

.quickstart-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Interfaces ────────────────────────────────────────────────── */
.interfaces { background: var(--bg-subtle); }

.interface-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 1.25rem;
}

.interface-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  text-align: center;
  transition: transform 0.15s ease;
}

.interface-card:hover { transform: translateY(-2px); }

.interface-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.interface-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.interface-card code {
  display: inline-block;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ── Footer ────────────────────────────────────────────────────── */
footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

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

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.footer-sep { color: var(--text-muted); }
.footer-left span:last-child { color: var(--text-muted); font-weight: 400; }

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

/* ── Animations ────────────────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.feature-grid .fade-in:nth-child(2) { transition-delay: 0.05s; }
.feature-grid .fade-in:nth-child(3) { transition-delay: 0.1s; }
.feature-grid .fade-in:nth-child(4) { transition-delay: 0.15s; }
.feature-grid .fade-in:nth-child(5) { transition-delay: 0.2s; }
.feature-grid .fade-in:nth-child(6) { transition-delay: 0.25s; }
.feature-grid .fade-in:nth-child(7) { transition-delay: 0.3s; }
.feature-grid .fade-in:nth-child(8) { transition-delay: 0.35s; }
.feature-grid .fade-in:nth-child(9) { transition-delay: 0.4s; }

.steps .fade-in:nth-child(2) { transition-delay: 0.05s; }
.steps .fade-in:nth-child(3) { transition-delay: 0.1s; }
.steps .fade-in:nth-child(4) { transition-delay: 0.15s; }

/* ── Reduced motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  html { scroll-behavior: auto; }
  .fade-in { opacity: 1; transform: none; }
}
