:root {
  --ink: #181c1b;
  --earth: #3b4441;
  --muted: #5f6b67;
  --pine: #14342B;
  --sage: #598958;
  --sage-deep: #3f6e3f;
  --cream: #f6f8f6;
  --surface: #f4f6f4;
  --surface-alt: #ebf0ec;
  --card-bg: #ffffff;
  --code-bg: #111917;
  --code-ink: #e7efe9;
  --sage-soft: rgba(89, 137, 88, 0.12);
  --border: rgba(20, 52, 43, 0.15);
  --border-strong: rgba(20, 52, 43, 0.26);
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Consolas", monospace;

  --fs-hero: clamp(1.85rem, 3.8vw, 2.65rem);
  --fs-page-title: clamp(1.65rem, 3vw, 2.15rem);
  --fs-section: clamp(1.3rem, 2.2vw, 1.6rem);
  --fs-heading: 1.06rem;
  --fs-lede: 1.06rem;
  --fs-body: 0.975rem;
  --fs-ui: 0.9rem;
  --fs-small: 0.82rem;
  --fs-kicker: 0.74rem;

  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 6px;
  --sidebar-width: 232px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.6;
  padding-top: 0.65rem;
  padding-bottom: 1.5rem;
}

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}

h2 {
  font-size: var(--fs-section);
  margin-bottom: 0.5rem;
}

h3, h4 {
  font-size: var(--fs-heading);
  margin-bottom: 0.4rem;
  color: var(--pine);
}

p + p {
  margin-top: 0.75rem;
}

a {
  color: var(--pine);
  text-underline-offset: 0.16em;
}

a:hover {
  color: var(--sage-deep);
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Shift main content when sidebar is open on medium-wide viewports so it never overlaps */
@media (min-width: 1060px) and (max-width: 1380px) {
  body.sidebar-open .docs-main .wrap,
  body.sidebar-open footer.part-footer .wrap {
    margin-left: calc(var(--sidebar-width) + 2.5rem);
    margin-right: auto;
  }
}

/* ---------- Hero (Home Only) ---------- */
.part {
  position: relative;
  z-index: 1;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.part-hero {
  width: calc(100% - 1.5rem);
  margin: 0 auto;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--pine) 0%, #0f1f1a 100%);
  border: 1px solid rgba(20, 52, 43, 0.35);
  box-shadow: 0 4px 16px rgba(20, 52, 43, 0.14);
}

.hero {
  color: var(--cream);
  padding: 3.1rem 0 2.75rem;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-mono);
  color: var(--cream);
  font-size: var(--fs-hero);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.18;
  max-width: 26ch;
  margin: 0 auto 0.85rem;
}

.hero h1 em,
.hero p em {
  font-family: var(--font-mono);
  color: #82b980;
  font-style: normal;
}

.hero p {
  max-width: 58ch;
  margin: 0 auto 1.5rem;
  font-size: var(--fs-lede);
  color: rgba(246, 248, 246, 0.86);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.btn {
  display: inline-block;
  font-family: var(--font-sans);
  text-decoration: none;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: var(--fs-ui);
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--sage);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
  background: var(--sage-deep);
  color: #fff;
}

.btn-ghost {
  color: var(--cream);
  border: 1px solid rgba(246, 248, 246, 0.35);
}

.btn-ghost:hover {
  border-color: #82b980;
  color: #fff;
}

/* ---------- Sticky Root Bar + Left Hamburger & Sidebar ---------- */
.part-root-bar {
  position: sticky;
  top: 0.65rem;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 1rem;
  margin: 0.75rem 0 1.25rem;
  min-height: 2.65rem;
}

body:not(.has-hero) .part-root-bar {
  margin-top: 0;
}

.sidebar-shell {
  position: absolute;
  left: 0.75rem;
  top: 0;
  z-index: 35;
}

.sidebar-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 2.65rem;
  height: 2.65rem;
  padding: 0.55rem;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--pine) 0%, #10231d 100%);
  border: 1px solid rgba(20, 52, 43, 0.35);
  box-shadow: 0 4px 12px rgba(20, 52, 43, 0.16);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sidebar-toggle:hover {
  border-color: var(--sage);
}

.sidebar-toggle span {
  display: block;
  height: 2px;
  width: 16px;
  background: var(--cream);
  border-radius: 1px;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.sidebar-toggle[aria-expanded="true"] {
  border-color: rgba(130, 185, 128, 0.55);
}

.sidebar-toggle[aria-expanded="true"] span {
  background: #82b980;
}

.docs-sidebar {
  position: absolute;
  top: calc(2.65rem + 0.5rem);
  left: 0;
  width: var(--sidebar-width);
  max-height: calc(100vh - 4.25rem);
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 18px rgba(20, 52, 43, 0.1);
  padding: 0.75rem 0.65rem;
  display: none;
}

body.sidebar-open .docs-sidebar {
  display: block;
}

.sidebar-group + .sidebar-group {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.sidebar-page-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  letter-spacing: -0.01em;
}

.sidebar-page-link:hover {
  background: var(--surface-alt);
  color: var(--pine);
}

.sidebar-page-link.is-current {
  color: var(--pine);
  background: var(--sage-soft);
}

.sidebar-sublist {
  list-style: none;
  margin-top: 0.2rem;
  padding-left: 0.45rem;
  border-left: 1px solid var(--border);
  margin-left: 0.5rem;
}

.sidebar-sublist li + li {
  margin-top: 1px;
}

.sidebar-sublist a {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.24rem 0.5rem;
  border-radius: var(--radius-sm);
  line-height: 1.35;
  transition: color 0.12s ease, background 0.12s ease;
}

.sidebar-sublist a:hover {
  color: var(--pine);
  background: var(--surface);
}

.sidebar-sublist a.is-active {
  color: var(--pine);
  font-weight: 600;
  background: var(--sage-soft);
}

/* ---------- Top Pill Nav ---------- */
.nav-cluster {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* The bar's max-width is for the hamburger clearance. Inside the cluster it
   shrinks the nav under its own links and the abs-positioned tabs land on "SDKs". */
.nav-cluster .part-nav {
  max-width: none;
}

.part-nav {
  width: fit-content;
  max-width: calc(100% - 3.5rem);
  background: linear-gradient(160deg, var(--pine) 0%, #10231d 100%);
  border: 1px solid rgba(20, 52, 43, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(20, 52, 43, 0.16);
}

/* Hangs off the right of the centered nav without shifting it. */
.part-sdk-tabs {
  position: absolute;
  left: calc(100% + 0.6rem);
  top: 0;
  height: 100%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.35rem;
  background: linear-gradient(160deg, var(--pine) 0%, #10231d 100%);
  border: 1px solid rgba(20, 52, 43, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(20, 52, 43, 0.16);
  white-space: nowrap;
}

.sdk-tab {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(246, 248, 246, 0.78);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.sdk-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sdk-tab.is-active {
  color: #82b980;
  background: rgba(130, 185, 128, 0.14);
  border-color: rgba(130, 185, 128, 0.45);
}

.sdk-panel[hidden] {
  display: none;
}

.sdk-repo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.4rem;
}

.sdk-repo-head h2 {
  margin-bottom: 0;
}

.sdk-repo-link {
  font-family: var(--font-mono);
  font-size: var(--fs-ui);
  margin-bottom: 0.65rem;
}

.part-nav .nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1.15rem;
  gap: 1.35rem;
  min-height: 2.65rem;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 0.5rem;
}

.logo img {
  height: 24px;
  width: auto;
  display: block;
}

nav.links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem 1.1rem;
  font-size: var(--fs-ui);
  font-weight: 500;
}

nav.links a {
  color: rgba(246, 248, 246, 0.84);
  text-decoration: none;
  padding-bottom: 1px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

nav.links a:hover {
  color: #fff;
  border-color: var(--sage);
}

nav.links a.active {
  color: #fff;
  border-color: #82b980;
}

/* Grows so the footer sits at the bottom of the viewport on short pages. */
.docs-main {
  flex: 1 0 auto;
}

/* ---------- Page Header (Non-Hero Inner Pages) ---------- */
.page-header {
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.page-header .kicker {
  margin-bottom: 0.25rem;
}

.page-header h1 {
  font-family: var(--font-mono);
  font-size: var(--fs-page-title);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 0.45rem;
}

.page-header .lede {
  margin-bottom: 0;
}

.page-header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.25rem;
  margin-top: 0.85rem;
  font-size: var(--fs-small);
  color: var(--muted);
}

.page-header-meta a {
  font-weight: 600;
  text-decoration: none;
}

.page-header-meta a:hover {
  text-decoration: underline;
}

/* ---------- Sections & Layout ---------- */
section {
  padding: 1.65rem 0;
  scroll-margin-top: 4.5rem;
}

section + section {
  border-top: 1px solid var(--border);
}

.section-header {
  margin-bottom: 1.1rem;
}

.kicker {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--fs-kicker);
  color: var(--sage-deep);
  font-weight: 600;
  display: block;
  margin-bottom: 0.3rem;
}

.lede {
  font-size: var(--fs-lede);
  max-width: 70ch;
  color: var(--earth);
}

/* ---------- Grids, Boxes & Content Blocks ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.card-neutral {
  background: var(--surface-alt);
}

.card p {
  color: var(--earth);
  font-size: var(--fs-ui);
}

.card .card-link {
  margin-top: auto;
  padding-top: 0.75rem;
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
}

.card .card-link:hover {
  text-decoration: underline;
}

.card ul {
  margin-top: 0.55rem;
  padding-left: 1.1rem;
  color: var(--earth);
  font-size: var(--fs-ui);
}

.card li {
  margin-bottom: 0.3rem;
}

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
}

/* Prose / unboxed technical blocks */
.doc-block + .doc-block {
  margin-top: 1.35rem;
}

.doc-block p {
  color: var(--earth);
  max-width: 72ch;
}

.doc-block ul,
.doc-block ol {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
  color: var(--earth);
  max-width: 72ch;
}

.doc-block li {
  margin-bottom: 0.35rem;
}

.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  overflow: hidden;
}

.concept-cell {
  padding: 1.05rem 1.15rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.concept-cell h3 {
  font-size: 0.96rem;
  margin-bottom: 0.3rem;
}

.concept-cell p {
  font-size: var(--fs-ui);
  color: var(--earth);
}

.concept-cell .card-link {
  margin-top: auto;
  padding-top: 0.65rem;
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
}

.concept-cell .card-link:hover {
  text-decoration: underline;
}

/* ---------- Quickstart Steps ---------- */
.quickstart-steps {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.quickstart-step {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
}

.quickstart-step-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.step-num {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--sage-deep);
}

.quickstart-step p {
  color: var(--earth);
  font-size: var(--fs-ui);
}

/* ---------- Example List (Home) ---------- */
.example-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  overflow: hidden;
}

.example-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.9rem 1.15rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}

.example-row:last-child {
  border-bottom: none;
}

.example-row:hover {
  background: var(--surface);
}

.example-row-main h3 {
  margin-bottom: 0.15rem;
  font-size: 0.98rem;
}

.example-row-main p {
  color: var(--earth);
  font-size: var(--fs-ui);
}

.example-row-Action {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--sage-deep);
  white-space: nowrap;
}

/* ---------- Code & Pre ---------- */
code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--sage-soft);
  color: var(--pine);
  padding: 0.1rem 0.32rem;
  border-radius: var(--radius-sm);
}

.pre-wrap {
  position: relative;
  margin-top: 0.6rem;
}

pre {
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  padding: 0.95rem 1.15rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-top: 0.6rem;
  border: 1px solid rgba(20, 52, 43, 0.3);
}

.pre-wrap pre {
  margin-top: 0;
  padding-right: 4.5rem;
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(231, 239, 233, 0.78);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.copy-btn.is-copied {
  color: #82b980;
  border-color: rgba(130, 185, 128, 0.5);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin-top: 0.65rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.panel .table-wrap {
  border: none;
  border-radius: 0;
  margin-top: 0.35rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-ui);
}

th, td {
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface);
  font-weight: 600;
}

td {
  color: var(--earth);
}

/* ---------- Badges & Chips ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--pine);
  background: var(--sage-soft);
  border: 1px solid rgba(89, 137, 88, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.12rem 0.5rem;
}

.method {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.42rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.method-get {
  background: rgba(20, 52, 43, 0.1);
  color: var(--pine);
}

.method-post {
  background: rgba(89, 137, 88, 0.2);
  color: #265326;
}

.method-patch {
  background: rgba(180, 130, 40, 0.18);
  color: #6b4c10;
}

.method-delete {
  background: rgba(170, 50, 50, 0.15);
  color: #7a1f1f;
}

/* ---------- Callout ---------- */
.callout {
  background: var(--sage-soft);
  border: 1px solid rgba(89, 137, 88, 0.28);
  border-left: 3px solid var(--sage);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-top: 1rem;
  color: var(--earth);
  font-size: var(--fs-ui);
}

/* ---------- Footer ---------- */
footer.part-footer {
  width: calc(100% - 1.5rem);
  margin: 2.25rem auto 0;
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: rgba(246, 248, 246, 0.75);
  padding: 1.65rem 0;
  text-align: center;
  font-size: var(--fs-ui);
}

footer.part-footer p + p {
  margin-top: 0.5rem;
}

footer.part-footer a {
  color: #82b980;
  text-decoration: none;
}

footer.part-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .part-root-bar {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .nav-cluster {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
  }

  .part-sdk-tabs {
    position: static;
    height: auto;
  }

  .part-nav {
    max-width: calc(100% - 3.25rem);
  }

  .part-nav .nav {
    padding: 0.4rem 0.85rem;
    gap: 0.75rem;
  }

  nav.links {
    gap: 0.5rem 0.75rem;
    font-size: 0.84rem;
  }

  .example-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
}
