/* ==========================================================================
   docs.nunabot.com — matches nunabot.com (indigo + Space Grotesk)
   ========================================================================== */

:root {
  /* Brand palette — indigo accent on cream, matching nunabot.com */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --surface-offset: #eef2ff;
  --brand: #4f46e5;          /* indigo-600 — matches nunabot.com */
  --brand-hover: #3730a3;    /* indigo-800 */
  --brand-dark: #1e1b4b;     /* indigo-950 */
  --brand-highlight: #eef2ff;
  --ink: #1b1a16;
  --muted: #6e6a62;
  --faint: #a9a5a0;
  --line: #e6e2da;
  --line-strong: #d5d0c6;
  --danger: #9a3a3a;

  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.2vw, 0.8125rem);
  --text-sm: clamp(0.875rem, 0.82rem + 0.25vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.22vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1.03rem + 0.45vw, 1.3125rem);
  --text-xl: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  --text-2xl: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
  --text-hero: clamp(2.75rem, 1.8rem + 4.2vw, 5rem);

  /* Spacing */
  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem;
  --s-5: 1.25rem; --s-6: 1.5rem; --s-8: 2rem; --s-10: 2.5rem;
  --s-12: 3rem; --s-16: 4rem; --s-20: 5rem; --s-24: 6rem; --s-32: 8rem;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(27, 26, 22, 0.04), 0 0 0 1px rgba(27, 26, 22, 0.04);
  --shadow-md: 0 4px 14px rgba(27, 26, 22, 0.06), 0 0 0 1px rgba(27, 26, 22, 0.04);

  /* Space Grotesk for both heads and body — matches nunabot.com */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-body:    'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono:    ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}
p { max-width: 70ch; }
code, pre { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---- layout primitives ---- */
.container { width: min(1160px, 92vw); margin-inline: auto; }
.container-narrow { width: min(780px, 92vw); margin-inline: auto; }

/* ---- nav ---- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 247, 245, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 180ms ease, background 180ms ease;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-4) 0;
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  display: block; object-fit: cover;
}
.brand-tag {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  background: var(--brand-highlight);
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 4px;
}
.nav-links { display: flex; gap: var(--s-6); align-items: center; }
.nav-links a { color: var(--ink); font-size: var(--text-sm); font-weight: 500; }
.nav-links a:hover { color: var(--brand); }
.nav-cta {
  padding: 10px 18px; border-radius: 10px;
  background: var(--brand); color: #fff !important;
  font-size: var(--text-sm); font-weight: 600;
}
.nav-cta:hover { background: var(--brand-hover); }
@media (max-width: 720px) {
  .nav-links { gap: var(--s-4); }
  .nav-links a:not(.nav-cta) { display: none; }
  .brand-tag { display: none; }
}

/* ---- hero ---- */
.hero { padding: var(--s-20) 0 var(--s-16); text-align: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--s-5);
}
.hero h1 {
  font-size: var(--text-hero);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 18ch;
  margin: 0 auto var(--s-6);
}
.hero h1 em { font-style: normal; color: var(--brand); }
.hero-sub {
  font-size: var(--text-lg); color: var(--muted); max-width: 62ch;
  margin: 0 auto var(--s-8);
}
.hero-cta-row {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  justify-content: center;
}

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 12px 22px; border-radius: 10px;
  font-size: var(--text-sm); font-weight: 600;
  transition: background 180ms ease, color 180ms ease, transform 120ms ease;
  cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff !important; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; color: var(--ink) !important; border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--surface); border-color: var(--brand); color: var(--brand) !important; }

/* ---- section ---- */
section { padding: var(--s-16) 0; }

/* ---- pillar cards (3-up) ---- */
.pillars {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5);
}
@media (max-width: 900px) { .pillars { grid-template-columns: 1fr; } }
.pillar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--s-8);
  display: flex; flex-direction: column; gap: var(--s-4);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.pillar:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.pillar-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--brand-highlight); color: var(--brand);
  display: grid; place-items: center;
}
.pillar h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.015em;
}
.pillar p { color: var(--muted); font-size: var(--text-sm); line-height: 1.6; }
.pillar-link {
  margin-top: auto;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--brand);
  display: inline-flex; align-items: center; gap: 6px;
}

/* ---- anchor sections (MCP, Pipe, Soft) ---- */
.anchor-section {
  border-top: 1px solid var(--line);
  padding: var(--s-20) 0;
}
.anchor-section:nth-of-type(even) { background: var(--surface-2); }
.two-col {
  display: grid; grid-template-columns: 280px 1fr; gap: var(--s-12);
  align-items: start;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; gap: var(--s-8); } }
.two-col aside {
  position: sticky; top: 88px;
}
.two-col aside .tag {
  display: inline-block; font-size: var(--text-xs); font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  background: var(--brand-highlight); color: var(--brand);
  letter-spacing: 0.02em;
  margin-bottom: var(--s-3);
}
.two-col aside h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xl);
  letter-spacing: -0.025em;
  margin-bottom: var(--s-3);
}
.two-col aside p { font-size: var(--text-sm); color: var(--muted); }

/* ---- content blocks ---- */
.prose h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  letter-spacing: -0.02em;
  margin-top: var(--s-8);
  margin-bottom: var(--s-3);
}
.prose h3:first-child { margin-top: 0; }
.prose h4 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  margin-top: var(--s-5);
  margin-bottom: var(--s-2);
  color: var(--ink);
}
.prose p { margin-bottom: var(--s-4); color: var(--ink); }
.prose p.muted { color: var(--muted); }
.prose ul { margin: 0 0 var(--s-4) var(--s-5); }
.prose li { margin-bottom: var(--s-2); color: var(--ink); }
.prose li::marker { color: var(--brand); }
.prose strong { font-weight: 600; color: var(--ink); }
.prose code {
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-offset);
  color: var(--brand-dark);
  border: 1px solid #dbe0fb;
  font-weight: 500;
}

/* ---- code block ---- */
.code {
  margin: var(--s-4) 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #1e1b4b;        /* brand-dark */
  color: #e0e7ff;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: #2a2560;
  border-bottom: 1px solid #3b3580;
  font-family: var(--font-mono); font-size: 12px;
  color: #c7d2fe;
}
.code-lang { color: #a5b4fc; }
.code pre {
  padding: var(--s-4) var(--s-5);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
}
.code .tok-key { color: #c4b5fd; }
.code .tok-str { color: #a7f3d0; }
.code .tok-com { color: #818cf8; font-style: italic; }
.code .tok-num { color: #fbcfe8; }

/* ---- tool table ---- */
.tool-table {
  margin: var(--s-5) 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.tool-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
}
.tool-row:last-child { border-bottom: 0; }
.tool-name { font-family: var(--font-mono); font-size: 13px; color: var(--brand); font-weight: 600; }
.tool-desc { font-size: var(--text-sm); color: var(--muted); }
@media (max-width: 640px) { .tool-row { grid-template-columns: 1fr; gap: var(--s-1); } }

/* ---- flow diagram (OAuth) ---- */
.flow {
  margin: var(--s-5) 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--s-2);
}
.flow-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--s-4);
  position: relative;
  transition: border-color 180ms ease;
}
.flow-step:hover { border-color: var(--brand); }
.flow-step .n {
  font-family: var(--font-mono); font-size: 11px; color: var(--brand);
  font-weight: 600; letter-spacing: 0.04em;
}
.flow-step .t {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: var(--text-sm); font-weight: 600; color: var(--ink);
  letter-spacing: -0.01em;
}
.flow-step .d {
  margin-top: 4px;
  font-size: 12px; color: var(--muted); line-height: 1.45;
}
@media (max-width: 900px) { .flow { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .flow { grid-template-columns: 1fr; } }

/* ---- note box ---- */
.note {
  background: var(--brand-highlight);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius-sm);
  margin: var(--s-5) 0;
  font-size: var(--text-sm);
  color: var(--ink);
}
.note strong { color: var(--brand-dark); }

/* ---- footer ---- */
footer {
  border-top: 1px solid var(--line);
  padding: var(--s-12) 0;
  color: var(--muted);
  font-size: var(--text-sm);
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: var(--s-4);
}
.footer-links { display: flex; gap: var(--s-5); }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--brand); }

/* ---- reveal on scroll ---- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms ease, transform 600ms cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
