/* apis.css - HUMMBL APIs documentation hub.
   Page-specific styles; depends on shared.css design tokens.
   CSP: style-src 'self' -> no inline styles, all rules live here. */

/* --- Page chrome (self-sufficient; landing.css is not loaded on this page) --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: 0.85rem 1.5rem;
  background: rgba(10, 10, 15, 0.9);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  text-decoration: none;
}

.brand img {
  display: block;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin: 0 0 0 auto;
  padding: 0;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.25rem 0.1rem;
  border-bottom: 2px solid transparent;
  transition:
    color 0.15s ease,
    border-color 0.15s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text-primary);
  border-bottom-color: var(--accent-green);
}

/* --- Two-column layout: sticky sidebar + scrolling content --- */
.apis-layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.api-sidebar {
  position: sticky;
  top: 4.5rem;
  align-self: start;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  padding-right: 0.5rem;
  border-right: 1px solid var(--border-subtle);
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin: 0 0 0.5rem;
}

.sidebar-group {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-green);
  margin: 1.1rem 0 0.25rem;
}

.sidebar-link {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.18rem 0.25rem;
  border-left: 2px solid transparent;
  transition:
    color 0.12s ease,
    border-color 0.12s ease;
}

.sidebar-link:hover {
  color: var(--text-primary);
  border-left-color: var(--accent-green);
}

/* --- Hero --- */
.api-hero {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 2rem;
}

.api-hero .eyebrow {
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.api-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.api-hero .lede {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 60ch;
  margin-bottom: 1.25rem;
}

.hero-cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

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

.btn-ghost:hover {
  background: rgba(27, 122, 61, 0.12);
}

.hero-meta {
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

.hero-meta code {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.hero-meta a {
  color: var(--text-secondary);
}

/* --- Family sections --- */
.api-family {
  margin-bottom: 2.75rem;
  scroll-margin-top: 4.5rem;
}

.family-heading {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin-bottom: 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.family-blurb {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 65ch;
  margin-bottom: 1.25rem;
}

/* --- Card grid (mirrors Wolfram's API card layout) --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.api-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.15rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  color: var(--text-primary);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    background 0.15s ease;
}

.api-card:hover {
  border-color: var(--border-prominent);
  transform: translateY(-2px);
  background: #20202c;
}

.api-card h3 {
  font-size: 1.02rem;
  font-family: var(--font-sans);
  font-weight: 600;
  margin: 0;
}

.api-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
  flex-grow: 1;
}

.card-tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent-green);
  margin-top: 0.25rem;
}

/* --- Resources + footer --- */
.api-resources {
  scroll-margin-top: 4.5rem;
}

.api-foot {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.api-foot a {
  color: var(--text-secondary);
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-tertiary);
  font-size: 0.82rem;
  border-top: 1px solid var(--border-subtle);
}

/* --- Responsive: collapse sidebar on narrow screens --- */
@media (max-width: 860px) {
  .apis-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .api-sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 1rem;
  }

  .nav-links {
    gap: 0.85rem;
  }
}
