:root {
  color-scheme: light;
  --ink: #18201b;
  --muted: #66736b;
  --paper: #ffffff;
  --canvas: #f1f4ef;
  --line: #d7ded8;
  --line-strong: #b9c5bc;
  --night: #111713;
  --night-soft: #1b241e;
  --green: #3f7f52;
  --green-soft: #e4f0e7;
  --amber: #b87924;
  --amber-soft: #fbefd9;
  --blue: #316c7d;
  --red: #a94343;
  --code: #101512;
  --code-ink: #dce8df;
  --sidebar: 236px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 86px;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0;
}

button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
code, pre { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  color: #fff;
  background: var(--night);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  color: #f5f8f5;
  background: var(--night);
  border-bottom: 1px solid #2a352d;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #142019;
  background: #b7ca8e;
  border: 1px solid #d3dfb4;
  font-family: Georgia, serif;
  font-size: 21px;
}

.brand strong, .brand small { display: block; line-height: 1.1; }
.brand strong { font-family: Georgia, serif; font-size: 16px; font-weight: 600; }
.brand small { margin-top: 4px; color: #aebbb2; font-size: 11px; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; gap: 18px; }
.header-link { color: #d7e0d9; font-size: 13px; text-decoration: none; }
.header-link:hover { color: #fff; }

.health {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #c9d2cc;
  font-size: 12px;
}
.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8e9a92;
}
.health[data-health="ready"] .health-dot { background: #68b87b; box-shadow: 0 0 0 3px rgba(104, 184, 123, .15); }
.health[data-health="down"] .health-dot { background: #dc6b60; }

.app-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 66px;
  height: calc(100vh - 66px);
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: #e8ede7;
}

.environment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}
.environment code { color: var(--green); font-size: 12px; }

.sidebar nav { display: grid; gap: 3px; }
.nav-link {
  position: relative;
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 7px 11px;
  color: #4d5a52;
  border-left: 2px solid transparent;
  text-decoration: none;
  font-size: 13px;
}
.nav-link:hover { color: var(--ink); background: rgba(255, 255, 255, .55); }
.nav-link.is-active { color: #1f5f36; background: #f8faf7; border-left-color: var(--green); font-weight: 650; }

.sidebar-note {
  position: absolute;
  right: 22px;
  bottom: 26px;
  left: 22px;
  padding-top: 15px;
  color: #6d7971;
  border-top: 1px solid var(--line-strong);
  font-size: 12px;
  line-height: 1.5;
}

.content {
  min-width: 0;
  padding: 0 56px 32px;
  background: var(--paper);
}

.section {
  width: min(900px, 100%);
  padding: 66px 0;
  border-bottom: 1px solid var(--line);
}

.intro-section { padding-top: 76px; }
.eyebrow {
  margin-bottom: 14px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.05;
  font-weight: 500;
}
.lead { max-width: 770px; margin-bottom: 30px; color: #526057; font-size: 18px; line-height: 1.65; }

.base-url {
  max-width: 700px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 15px;
  background: #f7f9f6;
  border: 1px solid var(--line-strong);
}
.field-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.base-url code { color: #214d30; font-size: 14px; overflow-wrap: anywhere; }

.copy-button, .code-copy {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 7px 11px;
  color: #fff;
  background: var(--green);
  border: 1px solid #336c44;
  border-radius: 4px;
  cursor: pointer;
  font: 650 12px/1 "Segoe UI", Arial, sans-serif;
}
.copy-button:hover, .code-copy:hover { background: #346f47; }

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 34px 0 0;
  padding: 1px;
  background: var(--line);
}
.facts div { min-width: 0; padding: 16px; background: #fafbf9; }
.facts dt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.facts dd { margin: 5px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.facts code { color: var(--blue); font-size: 12px; }

.section-heading {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 30px;
}
.section-index { padding-top: 5px; color: var(--amber); font: 700 12px/1 "Cascadia Code", monospace; }
h2 { margin-bottom: 5px; font-family: Georgia, serif; font-size: 30px; line-height: 1.2; font-weight: 550; }
.section-heading p { margin: 0; color: var(--muted); }
h3 { margin-bottom: 12px; font-size: 15px; }

.steps { margin: 0 0 28px; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.steps li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.steps li > span { width: 28px; height: 28px; display: grid; place-items: center; color: #fff; background: var(--night-soft); font-size: 12px; }
.steps strong { display: block; margin-bottom: 3px; }
.steps p { margin: 0; color: var(--muted); }

.code-workbench, .split-code pre, .webhook-layout pre, .error-shape { background: var(--code); color: var(--code-ink); }
.code-workbench { overflow: hidden; border: 1px solid #273229; }
.code-toolbar { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 14px; border-bottom: 1px solid #2c3930; }
.code-tabs { display: flex; gap: 4px; }
.code-tabs button {
  min-height: 32px;
  padding: 6px 10px;
  color: #94a39a;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 650;
}
.code-tabs button[aria-selected="true"] { color: #e8efe9; border-bottom-color: #8db49a; }
.code-copy { color: #d9e4dc; background: #26342b; border-color: #3b4d40; }
.code-workbench pre { min-height: 220px; margin: 0; padding: 22px; overflow: auto; }
pre { font-size: 13px; line-height: 1.65; tab-size: 2; }
pre code { white-space: pre; }

.security-note { margin: 14px 0 0; padding: 12px 14px; color: #654716; background: var(--amber-soft); border-left: 3px solid var(--amber); font-size: 13px; }

.endpoint-list { border-top: 1px solid var(--line-strong); }
.endpoint {
  min-height: 62px;
  display: grid;
  grid-template-columns: 58px minmax(210px, .9fr) minmax(220px, 1fr);
  gap: 14px;
  align-items: center;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
}
.endpoint.important { background: #f2f7f3; }
.endpoint > code { color: #203c2a; font-weight: 700; overflow-wrap: anywhere; }
.endpoint p { margin: 0; color: var(--muted); font-size: 13px; }
.method { width: 48px; display: inline-flex; justify-content: center; padding: 4px 5px; color: #fff; border-radius: 3px; font: 750 10px/1.2 "Cascadia Code", monospace; }
.method.get { background: var(--blue); }
.method.post { background: var(--green); }
.method.put { background: var(--amber); }
.method.delete { background: var(--red); }

.split-code { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.split-code > div { min-width: 0; }
.code-title { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; color: #354139; background: #e8ece7; border: 1px solid var(--line); border-bottom: 0; font-size: 12px; font-weight: 700; }
.code-title code { color: var(--green); font-size: 11px; }
.split-code pre { height: 400px; margin: 0; padding: 18px; overflow: auto; }
.reference-subhead { margin-top: 30px; }
.data-note { display: grid; grid-template-columns: 90px 1fr; gap: 12px; margin-top: 14px; padding: 13px 15px; background: #edf3f5; border-left: 3px solid var(--blue); font-size: 13px; }

.principles { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.principles div { min-height: 155px; padding: 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.principles strong { display: block; margin-bottom: 8px; }
.principles p { margin: 0; color: var(--muted); }

.webhook-layout { display: grid; grid-template-columns: .8fr 1.2fr; gap: 36px; }
.webhook-layout > * { min-width: 0; }
.event-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.event-list li { display: grid; gap: 3px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.event-list code { color: var(--green); font-weight: 700; overflow-wrap: anywhere; }
.event-list span { color: var(--muted); font-size: 13px; }
.webhook-layout pre { margin: 0 0 12px; padding: 16px; overflow: auto; }
.webhook-layout p { color: var(--muted); font-size: 13px; }

.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; min-width: 680px; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #536057; background: #eef2ed; font-size: 11px; text-transform: uppercase; }
td:first-child { width: 66px; color: var(--muted); font-weight: 700; }
td:nth-child(2) { width: 230px; }
tbody tr:last-child td { border-bottom: 0; }
td code { color: #285b38; font-size: 12px; font-weight: 700; }
.error-shape { margin: 14px 0 0; padding: 18px; overflow: auto; }

.architecture-section figure { margin: 0; }
.architecture-section img { width: 100%; height: auto; display: block; border: 1px solid #303a32; background: var(--night); }
.architecture-section figcaption { padding: 10px 0; color: var(--muted); font-size: 12px; }

footer { width: min(900px, 100%); display: flex; justify-content: space-between; gap: 20px; padding: 26px 0 8px; color: var(--muted); font-size: 12px; }

button:focus-visible, a:focus-visible { outline: 3px solid #d59a41; outline-offset: 2px; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .content { padding-inline: 34px; }
  .sidebar { padding-inline: 16px; }
  .sidebar-note { right: 16px; left: 16px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .split-code { grid-template-columns: 1fr; }
  .split-code pre { height: auto; min-height: 310px; }
}

@media (max-width: 720px) {
  body { overflow-x: hidden; }
  html { scroll-padding-top: 64px; }
  .topbar { height: 58px; padding-inline: 14px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand small, .header-link { display: none; }
  .health-label { max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-shell { display: block; }
  .sidebar {
    position: sticky;
    top: 58px;
    z-index: 15;
    width: 100%;
    height: auto;
    padding: 8px 12px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line-strong);
  }
  .environment, .sidebar-note { display: none; }
  .sidebar nav { display: flex; width: max-content; max-width: none; gap: 4px; }
  .nav-link { min-height: 34px; padding: 6px 10px; border: 1px solid transparent; white-space: nowrap; }
  .nav-link.is-active { border-color: var(--line-strong); border-left-color: var(--green); }
  .content { padding: 0 18px 24px; }
  .section { padding: 48px 0; }
  .intro-section { padding-top: 48px; }
  h1 { font-size: 38px; }
  .lead { font-size: 16px; }
  .base-url { align-items: flex-end; }
  .copy-button span { display: none; }
  .section-heading { grid-template-columns: 32px 1fr; gap: 8px; }
  h2 { font-size: 25px; }
  .endpoint { grid-template-columns: 52px minmax(0, 1fr); gap: 8px; }
  .endpoint p { grid-column: 2; }
  .principles, .webhook-layout { grid-template-columns: 1fr; }
  .webhook-layout { gap: 28px; }
  footer { display: grid; }
}

@media (max-width: 430px) {
  .facts { grid-template-columns: 1fr; }
  .base-url { align-items: center; }
  .base-url code { font-size: 12px; }
  .code-toolbar { align-items: stretch; }
  .code-tabs { min-width: 0; overflow-x: auto; }
  .code-copy { width: 38px; padding-inline: 5px; overflow: hidden; }
  .code-copy .copy-label { display: none; }
  .code-workbench pre { min-height: 250px; padding: 16px; }
  .data-note { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
