:root {
  color: var(--cp-black);
  background: var(--cp-cream);
  --header-height: 104px;
  --sidebar-width: 264px;
  --toc-width: 220px;
  --border: var(--cp-chalk);
  --muted: var(--cp-muted);
  --accent: var(--cp-sepia);
  --accent-soft: #f5eee7;
  --ink: var(--cp-black);
  --code: #1d1b19;
  --warning: #785412;
  --warning-soft: #fff7df;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--cp-cream); }
button, input { font: inherit; }
a { color: var(--cp-sepia); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--cp-sepia-hover); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 40px;
  border-bottom: 1px solid var(--cp-chalk);
  background: rgba(255, 251, 244, 0.97);
  backdrop-filter: blur(12px);
}
.brand { justify-self: center; color: var(--cp-black); }
.brand:hover { opacity: 0.7; }
.docs-label {
  justify-self: start;
  color: var(--cp-black);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 22px; }
.search-button {
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid var(--cp-sepia);
  border-radius: var(--cp-radius);
  background: transparent;
  color: var(--cp-sepia);
  cursor: pointer;
}
.search-button:hover { background: var(--cp-sepia); color: var(--cp-white); }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 780px) var(--toc-width);
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
}
.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 40px 28px 56px;
  border-right: 1px solid var(--border);
  background: var(--cp-cream);
}
.nav-group { margin-bottom: 32px; }
.nav-group h2,
.eyebrow,
.toc strong {
  margin: 0 0 10px;
  color: var(--cp-sepia);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.nav-group a {
  display: block;
  margin: 2px 0;
  padding: 8px 12px;
  border-left: 2px solid transparent;
  color: #4f4b47;
  font-size: 13px;
  text-decoration: none;
}
.nav-group a:hover { color: var(--cp-black); }
.nav-group a.active {
  border-left-color: var(--cp-sepia);
  background: var(--accent-soft);
  color: var(--cp-sepia);
  font-weight: 600;
}

.article { min-width: 0; padding: 64px 56px 96px; outline: 0; background: var(--cp-white); }
.article-header { margin-bottom: 48px; padding-bottom: 36px; border-bottom: 2px solid var(--border); }
h1 {
  margin: 10px 0 16px;
  font-family: var(--cp-heldane);
  font-size: 48px;
  font-weight: 400;
  line-height: 1.15;
}
.lede { max-width: 680px; margin: 0; color: var(--muted); font-size: 17px; line-height: 1.55; }
.article h2 {
  margin: 48px 0 16px;
  scroll-margin-top: 128px;
  font-family: var(--cp-heldane);
  font-size: 29px;
  font-weight: 400;
}
.article h3 { margin: 32px 0 10px; scroll-margin-top: 128px; font-size: 17px; font-weight: 500; }
.article p, .article li { color: #3e3b38; font-size: 15px; line-height: 1.7; }
.article ul, .article ol { padding-left: 22px; }
.article li + li { margin-top: 7px; }
.article strong { color: var(--ink); font-weight: 600; }
.article code:not(pre code) { padding: 2px 5px; border-radius: 3px; background: var(--accent-soft); color: var(--cp-sepia); font-size: 13px; }

.path-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 28px 0; border: 2px solid var(--border); border-radius: var(--cp-radius); overflow: hidden; }
.path-link { min-height: 166px; padding: 22px; border-right: 1px solid var(--border); color: var(--ink); text-decoration: none; }
.path-link:last-child { border-right: 0; }
.path-link:hover { background: var(--accent-soft); color: var(--ink); }
.path-link span { display: block; color: var(--cp-sepia); font-size: 10px; font-weight: 600; text-transform: uppercase; }
.path-link strong { display: block; margin: 12px 0 8px; font-family: var(--cp-heldane); font-size: 21px; font-weight: 400; }
.path-link p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.architecture { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; margin: 28px 0; }
.architecture div { min-height: 104px; display: grid; align-content: center; padding: 16px; border: 2px solid var(--border); border-radius: var(--cp-radius); background: var(--cp-cream); text-align: center; }
.architecture span { color: var(--cp-sepia); font-size: 11px; font-weight: 600; }
.architecture small { margin-top: 5px; color: var(--muted); }
.architecture b { padding: 0 9px; color: var(--cp-sepia); }

.callout { margin: 24px 0; padding: 18px 20px; border-left: 4px solid var(--cp-irish-green); background: #edf4ed; }
.callout.warning { border-left-color: var(--cp-speed-yellow); background: var(--warning-soft); }
.callout strong { display: block; margin-bottom: 5px; }
.callout p { margin: 0; font-size: 14px; }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0 30px; }
.status-grid > div { padding: 16px; border: 1px solid var(--border); background: #fff; }
.status-grid strong { display: block; margin: 10px 0 4px; }
.status-grid p { margin: 0; color: var(--muted); font-size: 13px; }
.maturity { display: inline-block; padding: 3px 7px; border: 1px solid currentColor; border-radius: 4px; font-size: 10px; font-weight: 700; line-height: 1; text-transform: uppercase; }
.maturity.available { color: #1d5b39; background: #edf4ed; }
.maturity.pilot { color: #6b4700; background: #fff5d6; }
.maturity.contract { color: #32516c; background: #edf4f8; }
.maturity.concept { color: #665d54; background: #f5f2ee; }

.steps { margin: 28px 0; counter-reset: docs-step; }
.step { position: relative; padding: 0 0 28px 50px; border-left: 1px solid var(--border); }
.step:last-child { border-left-color: transparent; }
.step::before { counter-increment: docs-step; content: counter(docs-step); position: absolute; left: -17px; top: 0; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--cp-sepia); color: var(--cp-white); font-size: 12px; font-weight: 600; }
.step h3 { margin-top: 0; }

.code-block { position: relative; margin: 20px 0 28px; }
.code-label { padding: 9px 14px; border-radius: var(--cp-radius) var(--cp-radius) 0 0; background: #2c2824; color: #d7d0c6; font-size: 11px; }
pre { margin: 0; overflow-x: auto; padding: 20px; border-radius: 0 0 var(--cp-radius) var(--cp-radius); background: var(--code); color: #fffaf3; font-size: 13px; line-height: 1.55; }
.copy-button { position: absolute; top: 6px; right: 8px; padding: 5px 9px; border: 1px solid #71685e; border-radius: 4px; background: transparent; color: var(--cp-white); font-size: 11px; cursor: pointer; }

.api-table, .prop-table { width: 100%; border-collapse: collapse; margin: 20px 0 30px; font-size: 13px; }
.api-table th, .api-table td, .prop-table th, .prop-table td { padding: 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.api-table th, .prop-table th { background: var(--cp-cream); color: #57524d; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.method { display: inline-block; min-width: 42px; color: var(--cp-irish-green); font-weight: 600; }
.checklist { padding: 0; list-style: none; }
.checklist li { position: relative; padding-left: 27px; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--cp-irish-green); font-weight: 600; }

.page-footer { display: flex; justify-content: space-between; gap: 18px; margin-top: 64px; padding-top: 28px; border-top: 2px solid var(--border); }
.page-footer a { max-width: 48%; font-size: 13px; }
.toc { position: sticky; top: var(--header-height); height: calc(100vh - var(--header-height)); padding: 64px 22px; overflow-y: auto; background: var(--cp-cream); }
.toc strong { display: block; }
.toc a { display: block; margin: 8px 0; color: #69645f; font-size: 12px; line-height: 1.4; text-decoration: none; }
.toc a:hover { color: var(--cp-sepia); }
.toc a.level-3 { padding-left: 10px; }

.menu-button { display: none; }
.search-dialog { width: min(680px, calc(100vw - 32px)); padding: 0; border: 2px solid var(--cp-chalk); border-radius: var(--cp-radius); background: var(--cp-cream); box-shadow: var(--cp-shadow); }
.search-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.search-dialog__header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.search-dialog__header label { font-family: var(--cp-heldane); font-size: 22px; }
.search-dialog__header button { border: 0; background: transparent; color: var(--cp-sepia); cursor: pointer; }
#searchInput { width: calc(100% - 40px); margin: 20px; padding: 13px 14px; border: 2px solid var(--cp-chalk); border-radius: var(--cp-radius); background: var(--cp-white); }
.search-results { max-height: 420px; overflow-y: auto; padding: 0 20px 20px; }
.search-result { display: block; padding: 14px 4px; border-top: 1px solid var(--border); text-decoration: none; }
.search-result strong { display: block; color: var(--ink); }
.search-result span { color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: var(--sidebar-width) minmax(0, 780px); }
  .toc { display: none; }
}
@media (max-width: 760px) {
  .status-grid { grid-template-columns: 1fr; }
  :root { --header-height: 128px; }
  .topbar { grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px; padding: 12px 16px; }
  .brand { justify-self: start; }
  .brand .cp-wordmark { width: 168px; height: auto; }
  .docs-label { display: none; }
  .topbar-actions { display: contents; }
  .topbar-actions .commerce-nav { grid-column: 1 / -1; grid-row: 2; }
  .topbar-actions .search-button { grid-column: 2; grid-row: 1; }
  .search-button { min-height: 36px; padding: 7px 11px; }
  .menu-button { position: sticky; top: var(--header-height); z-index: 15; display: block; width: 100%; min-height: 46px; border: 0; border-bottom: 1px solid var(--border); background: var(--cp-cream); color: var(--cp-sepia); text-align: left; padding: 0 18px; }
  .layout { display: block; }
  .sidebar { position: fixed; inset: calc(var(--header-height) + 46px) 0 0; z-index: 14; display: none; width: 100%; height: auto; border-right: 0; }
  .sidebar.open { display: block; }
  .article { padding: 42px 22px 68px; }
  h1 { font-size: 38px; }
  .path-grid { grid-template-columns: 1fr; }
  .path-link { min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  .path-link:last-child { border-bottom: 0; }
  .architecture { grid-template-columns: 1fr; gap: 8px; }
  .architecture b { transform: rotate(90deg); text-align: center; }
  .api-table, .prop-table { display: block; overflow-x: auto; }
}
