/* ─────────────────────────────────────────────────────────────
   Mono-Pamaconu Design Systems — documentation site styles.
   Deliberately monochrome: the chrome should never compete with
   the package palettes we're explaining.
   ───────────────────────────────────────────────────────────── */

:root {
  --doc-bg: #fafaf9;
  --doc-surface: #ffffff;
  --doc-surface-2: #f4f4f3;
  --doc-ink: #1a1a1a;
  --doc-ink-muted: #5c5c5c;
  --doc-border: #e6e6e4;
  --doc-accent: #1f2937;
  --doc-code-bg: #0d1117;
  --doc-code-fg: #e6edf3;
  --doc-code-comment: #8b949e;
  --doc-code-string: #a5d6ff;
  --doc-code-keyword: #ff7b72;
  --doc-code-name: #d2a8ff;
  --doc-radius: 10px;
  --doc-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --doc-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--doc-font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--doc-ink);
  background: var(--doc-bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Navbar ──────────────────────────────────────────────── */
.docnav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--doc-border);
}
.docnav__inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px 24px;
}
.docnav__brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--doc-ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.docnav__brand-dot {
  width: 10px; height: 10px;
  background: var(--doc-ink);
  border-radius: 2px;
}
.docnav__links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}
.docnav__links a {
  color: var(--doc-ink-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background 120ms, color 120ms;
}
.docnav__links a:hover { background: var(--doc-surface-2); color: var(--doc-ink); }
.docnav__links a.is-active {
  background: var(--doc-ink);
  color: var(--doc-bg);
}

/* ── Layout ──────────────────────────────────────────────── */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--doc-border);
  margin-bottom: 40px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.hero p {
  margin: 0;
  font-size: 17px;
  color: var(--doc-ink-muted);
  max-width: 60ch;
}
.hero__eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--doc-ink-muted);
  margin-bottom: 12px;
}

/* ── Status badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.badge--done { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge--wip  { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.badge--plan { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge--shipped { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }

/* ── Sections ────────────────────────────────────────────── */
section { margin-top: 56px; }
section > h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
section > h2 + p {
  margin: 0 0 24px;
  color: var(--doc-ink-muted);
  max-width: 65ch;
}
section h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--doc-surface);
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  padding: 20px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Token swatches ──────────────────────────────────────── */
.swatch {
  background: var(--doc-surface);
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  overflow: hidden;
}
.swatch__chip {
  height: 64px;
  border-bottom: 1px solid var(--doc-border);
}
.swatch__body { padding: 10px 12px; }
.swatch__name {
  font-family: var(--doc-font-mono);
  font-size: 12px;
  color: var(--doc-ink);
  font-weight: 500;
}
.swatch__value {
  font-family: var(--doc-font-mono);
  font-size: 11px;
  color: var(--doc-ink-muted);
  margin-top: 2px;
}

/* ── Code blocks ─────────────────────────────────────────── */
pre.code {
  background: var(--doc-code-bg);
  color: var(--doc-code-fg);
  font-family: var(--doc-font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 18px 20px;
  border-radius: var(--doc-radius);
  overflow-x: auto;
  margin: 0;
}
pre.code .c  { color: var(--doc-code-comment); font-style: italic; }
pre.code .s  { color: var(--doc-code-string); }
pre.code .k  { color: var(--doc-code-keyword); }
pre.code .n  { color: var(--doc-code-name); }
pre.code .t  { color: #ffa657; }

.code-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.code-pair .code-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--doc-font-mono);
  font-size: 11px;
  color: var(--doc-ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.code-pair .code-label__tag {
  font-family: var(--doc-font);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.code-pair .before .code-label__tag { background: #fee2e2; color: #b91c1c; }
.code-pair .after  .code-label__tag { background: #dcfce7; color: #15803d; }
@media (max-width: 860px) {
  .code-pair { grid-template-columns: 1fr; }
}

/* ── Architecture diagrams ───────────────────────────────── */
.diagram {
  background: var(--doc-surface);
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  padding: 24px;
  display: grid;
  gap: 16px;
}
.diagram__row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.diagram__node {
  background: var(--doc-surface-2);
  border: 1px solid var(--doc-border);
  border-radius: 8px;
  padding: 12px 14px;
  position: relative;
}
.diagram__node--accent {
  background: var(--doc-ink);
  color: var(--doc-bg);
  border-color: var(--doc-ink);
}
.diagram__node--accent .diagram__node-sub { color: rgba(255,255,255,0.65); }
.diagram__node-title {
  font-family: var(--doc-font-mono);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}
.diagram__node-sub {
  font-size: 12px;
  color: var(--doc-ink-muted);
}
.diagram__arrow {
  text-align: center;
  color: var(--doc-ink-muted);
  font-size: 14px;
}

/* ── Steps / accordion ───────────────────────────────────── */
details.step {
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  background: var(--doc-surface);
  margin-bottom: 8px;
  overflow: hidden;
}
details.step[open] { box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
details.step summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 14.5px;
}
details.step summary::-webkit-details-marker { display: none; }
details.step summary::before {
  content: "+";
  font-family: var(--doc-font-mono);
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: var(--doc-ink-muted);
}
details.step[open] summary::before { content: "−"; }
details.step .step__num {
  font-family: var(--doc-font-mono);
  font-size: 11px;
  color: var(--doc-ink-muted);
  font-weight: 500;
  background: var(--doc-surface-2);
  padding: 2px 8px;
  border-radius: 4px;
}
details.step .step__body {
  padding: 0 18px 18px 50px;
  color: var(--doc-ink-muted);
  font-size: 14px;
}
details.step .step__body ul { margin: 8px 0; padding-left: 18px; }
details.step .step__body code {
  font-family: var(--doc-font-mono);
  font-size: 12.5px;
  background: var(--doc-surface-2);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--doc-ink);
}

/* ── Inline status grid (index page) ─────────────────────── */
.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.system-card {
  background: var(--doc-surface);
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 150ms, box-shadow 150ms;
}
.system-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}
.system-card h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.015em;
}
.system-card p {
  color: var(--doc-ink-muted);
  margin: 0;
  font-size: 14px;
}
.system-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.system-card__chips {
  display: flex;
  gap: 4px;
}
.system-card__chip {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.06);
}

/* ── Live component preview (for "after" snippet) ────────── */
.preview {
  background: var(--doc-surface);
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

/* Generic "core-btn" recipe rendered with whatever tokens the
   parent has set — used to demo theme swaps in the explainer. */
.core-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-family: var(--demo-font, var(--doc-font));
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter 150ms;
}
.core-btn--primary {
  background: hsl(var(--demo-accent, 0 0% 9%));
  color: hsl(var(--demo-accent-fg, 0 0% 100%));
}
.core-btn--primary:hover { filter: brightness(0.92); }
.core-btn--ghost {
  background: transparent;
  color: hsl(var(--demo-ink, 220 13% 9%));
  border-color: hsl(var(--demo-border, 0 0% 88%));
}

.core-card {
  background: hsl(var(--demo-surface, 0 0% 100%));
  border: 1px solid hsl(var(--demo-border, 0 0% 88%));
  border-radius: 12px;
  padding: 18px;
  color: hsl(var(--demo-ink, 220 13% 9%));
  min-width: 180px;
}
.core-card__title {
  font-family: var(--demo-display-font, var(--doc-font));
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 4px;
}
.core-card__body { color: hsl(var(--demo-ink-muted, 0 0% 40%)); font-size: 13px; }

/* ── Token-flow diagram (custom for index page) ─────────── */
.flow {
  background: var(--doc-surface);
  border: 1px solid var(--doc-border);
  border-radius: var(--doc-radius);
  padding: 28px;
  display: grid;
  gap: 18px;
}
.flow__title {
  font-family: var(--doc-font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--doc-ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Misc ────────────────────────────────────────────────── */
.kbd {
  font-family: var(--doc-font-mono);
  font-size: 12px;
  background: var(--doc-surface-2);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--doc-border);
}
.muted { color: var(--doc-ink-muted); }
.link {
  color: var(--doc-ink);
  text-decoration: underline;
  text-decoration-color: var(--doc-border);
  text-underline-offset: 3px;
}
.link:hover { text-decoration-color: var(--doc-ink); }
.footer {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--doc-border);
  color: var(--doc-ink-muted);
  font-size: 13px;
}

/* Section anchor offset for sticky nav */
section[id] { scroll-margin-top: 70px; }
