/* Marturia docs — shared design system.
   Mirrors the landing-page tokens (forest green + warm cream on near-black)
   so docs feel like the same product, not a different site.

   Layout: persistent left sidebar + scrollable content. Sidebar collapses
   to a hamburger under 900px so phone-reading the quickstart still works
   (a lot of "I'm at a customer's site verifying a receipt" flows happen
   on mobile). */

:root {
  --bg: #0a0e0a;
  --bg-soft: #0f1410;
  --bg-card: #131913;
  --fg: #f4f1e8;
  --fg-muted: #a0a09a;
  --fg-dim: #6a6a64;
  --accent: #1a6b3c;
  --accent-deep: #005129;
  --accent-hi: #2a8b53;
  --warn: #c08035;
  --danger: #c54a4a;
  --line: rgba(244, 241, 232, 0.08);
  --line-strong: rgba(244, 241, 232, 0.16);
  --code-bg: #0a0d0a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: -1px -1px;
}

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

code, pre {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.875em;
}

/* ── Top nav (matches landing page) ────────────────────────── */
.topnav {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 10, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topnav .wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.wordmark::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  margin-right: 0.5rem;
  transform: translateY(-2px);
}
.wordmark-suffix {
  color: var(--fg-muted);
  font-weight: 500;
  margin-left: 0.4rem;
}
.topnav-links a {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-left: 1.5rem;
}
.topnav-links a:hover { color: var(--fg); text-decoration: none; }
.topnav-cta {
  background: var(--accent);
  color: var(--fg) !important;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.875rem;
}
.topnav-cta:hover { background: var(--accent-hi); }

/* ── Layout: sidebar + content ─────────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  max-width: 1280px;
  margin: 0 auto;
  min-height: calc(100vh - 80px);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 2rem 1.25rem;
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
}

.sidebar-section {
  font-family: 'Manrope', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 1.25rem 0 0.5rem 0;
}
.sidebar-section:first-child { margin-top: 0; }

.sidebar a {
  display: block;
  color: var(--fg-muted);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin: 0.05rem 0;
  border-left: 2px solid transparent;
}
.sidebar a:hover {
  color: var(--fg);
  background: var(--bg-soft);
  text-decoration: none;
}
.sidebar a.active {
  color: var(--fg);
  border-left-color: var(--accent);
  background: var(--bg-soft);
  font-weight: 500;
}

.content {
  padding: 3rem 3rem 6rem 3rem;
  max-width: 880px;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Manrope', sans-serif;
  letter-spacing: -0.015em;
  color: var(--fg);
}
h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}
.lead {
  font-size: 1.125rem;
  color: var(--fg-muted);
  margin-bottom: 2.5rem;
  max-width: 60ch;
}
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 3rem 0 1rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
h2:first-of-type { border-top: none; padding-top: 0; }
h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 2rem 0 0.5rem 0;
}
h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem 0;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

p, ul, ol { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; }
li { margin-bottom: 0.35rem; }
li > ul, li > ol { margin-top: 0.35rem; margin-bottom: 0.5rem; }

strong { color: var(--fg); font-weight: 600; }

code {
  background: var(--bg-soft);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 0.85em;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 0.75rem 0 1.5rem 0;
  position: relative;
  line-height: 1.5;
}
pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--fg);
  font-size: 0.85rem;
}

/* Syntax-ish coloring (semantic spans, hand-applied) */
.k { color: #c08035; }       /* keyword */
.s { color: #a8c97a; }       /* string */
.c { color: var(--fg-dim); font-style: italic; } /* comment */
.n { color: #7eb6d6; }       /* number/literal */
.fn { color: #d6b67e; }      /* function name */
.url { color: #a8c97a; }     /* URL/path */

/* ── Step boxes ────────────────────────────────────────────── */
.step {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 1.25rem;
  margin: 2rem 0;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.step-num {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent-deep);
  color: var(--fg);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 1rem;
}
.step h3 { margin-top: 0; margin-bottom: 0.5rem; }
.step p:last-child, .step pre:last-child { margin-bottom: 0; }

/* ── Callouts ──────────────────────────────────────────────── */
.callout {
  border-left: 3px solid var(--accent);
  background: rgba(26, 107, 60, 0.08);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 0 4px 4px 0;
}
.callout-warn {
  border-left-color: var(--warn);
  background: rgba(192, 128, 53, 0.08);
}
.callout-danger {
  border-left-color: var(--danger);
  background: rgba(197, 74, 74, 0.08);
}
.callout strong { display: block; margin-bottom: 0.25rem; }

/* ── Tables ────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem 0;
  font-size: 0.9rem;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-soft);
}
td code { background: var(--bg); }

/* ── Method badges (API ref) ───────────────────────────────── */
.method {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.04em;
  margin-right: 0.5rem;
}
.m-get  { background: #1f3a5f; color: #7eb6d6; }
.m-post { background: #1f4a2e; color: #a8c97a; }
.m-public { background: #4a3a1f; color: #d6b67e; }

.endpoint-path {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ── Tabs (multi-language code blocks) ─────────────────────── */
.tabs { margin: 1rem 0 1.5rem 0; }
.tab-buttons {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line-strong);
}
.tab-btn {
  background: none;
  border: none;
  color: var(--fg-muted);
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--fg); }
.tab-btn.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content pre { margin-top: 0.5rem; border-top-left-radius: 0; border-top-right-radius: 0; border-top: none; }

/* ── Misc ──────────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }

.next-prev {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.next-prev-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: block;
  color: var(--fg) !important;
}
.next-prev-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.next-prev-label {
  font-size: 0.75rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}
.next-prev-title { font-weight: 600; }
.np-next { text-align: right; }

footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  text-align: center;
  color: var(--fg-dim);
  font-size: 0.85rem;
}

/* ── Mobile ────────────────────────────────────────────────── */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--fg);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 64px;
    left: 0; right: 0;
    height: auto;
    max-height: calc(100vh - 64px);
    background: var(--bg-soft);
    z-index: 20;
    transform: translateY(-110%);
    transition: transform 0.2s;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .sidebar.open { transform: translateY(0); }
  .menu-toggle { display: inline-block; }
  .topnav-links { display: none; }
  .content { padding: 2rem 1.25rem 4rem 1.25rem; }
  h1 { font-size: 1.75rem; }
}
