/*!
 * obsidian — the renderer's structural stylesheet.
 *
 * THIS FILE IS THE LIBRARY'S, NOT THE BRAND'S, and the split matters. What is
 * here is layout and structure: the two-column shell, the sticky sidebar, the
 * table grid, the scroll containers, the type scale. Every COLOUR is a custom
 * property with a neutral fallback, and the brand's own `index.html` sets them.
 *
 * That is what keeps this a renderer rather than a second copy of one23pay: if
 * a future brand renders with it, it overrides the same dozen properties and
 * gets its own product, exactly as the four vendored libraries here allow.
 * A palette hardcoded in this file would be the "two brands, one vendor" tell
 * that `packages/docs-vendor/README.md` exists to prevent, with the vendor
 * being us.
 */

.ob-root {
  /* NEUTRAL DEFAULTS. Not a brand's palette — a plain grey, so that a page
     which sets nothing is legible and visibly unbranded. Every one of these
     is meant to be overridden by the brand's own `index.html`; one23pay, the
     first brand to render with this file, sets all of them. Leaving a real
     palette here instead was the "two brands, one vendor" tell the header
     above describes: the second brand would inherit the first brand's face
     for free, which is the whole thing packages/docs-vendor exists to stop. */
  --ob-bg: #16181A;
  --ob-panel: #1E2124;
  --ob-raised: #26292D;
  --ob-ink: #F2F3F4;
  --ob-ink-2: #B4B8BC;
  --ob-ink-3: #80868C;
  --ob-line: #303438;
  --ob-accent: #9AA0A6;
  --ob-side-bg: #16181A;
  --ob-side-line: #24272A;
  --ob-side-active: rgba(var(--ob-accent-rgb), 0.12);
  /* The accent and the two status tones AGAIN, as bare `r, g, b` triples.
     CSS cannot take a hex apart, and every translucent fill in this file is
     built as `rgba(<tone>, alpha)` — so a brand that set only the hex would
     get its own accent on the text and the default one behind it. */
  --ob-accent-rgb: 154, 160, 166;
  --ob-danger: #D98F8F;
  --ob-danger-rgb: 217, 143, 143;
  --ob-ok: #94BE86;
  --ob-ok-rgb: 148, 190, 134;
  --ob-sunken: rgba(0, 0, 0, 0.35);
  --ob-radius: 8px;
  --ob-radius-lg: 12px;
  --ob-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* The stack ends on two families that exist in the pinned screenshot image
     (Liberation Mono, DejaVu Sans Mono) rather than on the bare `monospace`
     generic, and that is a correctness fix, not a preference.
     Chromium resolves the generic against the ELEMENT'S LANGUAGE, so on a
     zh-CN page it first picks a CJK mono (WenQuanYi Zen Hei Mono) and then
     re-resolves to a Latin one (Liberation Mono) on the relayout that a
     full-page screenshot forces. Different metrics, so every mono chip and
     code span reflows and the document jumps 17545px -> 18000px between two
     captures of the same page — measured with CDP's
     CSS.getPlatformFontsForNode. Naming a family that is actually installed
     means the generic is never consulted and the choice cannot drift. */
  --ob-mono: "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --ob-side-w: 268px;

  display: grid;
  grid-template-columns: var(--ob-side-w) minmax(0, 1fr);
  align-items: start;
  min-height: 100vh;
  font-family: var(--ob-sans);
  color: var(--ob-ink-2);
}

.ob-root * { box-sizing: border-box; }

/* ---- sidebar ---------------------------------------------------------- */
.ob-side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: var(--ob-side-bg);
  box-shadow: inset -1px 0 0 var(--ob-side-line);
}
.ob-side-inner { padding: 22px 14px 40px; }
.ob-side::-webkit-scrollbar { width: 9px; }
.ob-side::-webkit-scrollbar-thumb { background: rgba(var(--ob-accent-rgb), 0.14); border-radius: 6px; }

.ob-side-cap {
  margin: 18px 10px 7px;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ob-ink-3);
}
.ob-side-cap:first-child { margin-top: 0; }

.ob-side-link {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: var(--ob-radius);
  text-decoration: none;
  color: var(--ob-ink-2);
  font-size: 0.78rem;
  line-height: 1.35;
  transition: background 0.15s ease, color 0.15s ease;
}
.ob-side-link:hover { background: var(--ob-side-active); color: var(--ob-ink); }
.ob-side-link.is-here { background: var(--ob-side-active); color: #ffffff; }
.ob-side-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ob-side-m {
  flex: none;
  width: 38px;
  font-family: var(--ob-mono);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ob-ink-3);
}

/* ---- main ------------------------------------------------------------- */
.ob-main {
  min-width: 0;
  padding: 40px clamp(20px, 4vw, 56px) 80px;
  max-width: 1000px;
}

.ob-hero { padding-bottom: 26px; border-bottom: 1px solid var(--ob-line); margin-bottom: 8px; }
.ob-h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--ob-ink);
}
.ob-hero-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ob-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ob-line);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: var(--ob-mono);
  font-size: 0.68rem;
  color: var(--ob-ink-2);
}
.ob-tag--host { color: var(--ob-accent); }
/* The contract digest is long and is read character by character or not at
   all, so it truncates rather than wrapping the meta row onto three lines. */
.ob-tag--digest {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ob-ink-3);
}
.ob-lede { margin-top: 18px; font-size: 0.88rem; line-height: 1.8; }

.ob-group { padding-top: 34px; }
.ob-h2 {
  margin: 0 0 6px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ob-accent);
}
.ob-group-desc { margin: 0 0 8px; font-size: 0.82rem; line-height: 1.7; }

/* ---- one operation ---------------------------------------------------- */
.ob-op {
  margin-top: 22px;
  padding: 20px 22px 18px;
  border: 1px solid var(--ob-line);
  border-radius: var(--ob-radius-lg);
  background: var(--ob-panel);
  scroll-margin-top: 20px;
}
.ob-op-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ob-method {
  flex: none;
  border-radius: var(--ob-radius);
  padding: 3px 9px;
  font-family: var(--ob-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
/* Methods are told apart by WEIGHT, not by hue — a monochrome renderer with
   four coloured verb chips is a monochrome renderer with four coloured verb
   chips. A brand that wants colour here sets these four properties. */
.ob-method--get { background: rgba(var(--ob-accent-rgb), 0.10); color: var(--ob-accent); }
.ob-method--post { background: rgba(var(--ob-accent-rgb), 0.20); color: #ffffff; }
.ob-method--put,
.ob-method--patch { background: rgba(var(--ob-accent-rgb), 0.14); color: var(--ob-ink); }
.ob-method--delete { background: rgba(var(--ob-danger-rgb), 0.14); color: var(--ob-danger); }

.ob-hook {
  flex: none;
  border-radius: 999px;
  padding: 2px 9px;
  border: 1px solid var(--ob-line);
  font-family: var(--ob-sans);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ob-ink-3);
}

.ob-path {
  font-family: var(--ob-mono);
  font-size: 0.84rem;
  color: var(--ob-ink);
  word-break: break-all;
}
.ob-op-title { margin: 14px 0 0; font-size: 0.98rem; font-weight: 600; color: var(--ob-ink); }
.ob-op-desc { margin: 8px 0 0; font-size: 0.82rem; line-height: 1.75; }

.ob-cap {
  margin: 22px 0 8px;
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ob-ink-3);
}

/* ---- tables ----------------------------------------------------------- */
/* Wide content scrolls inside its own container; the page never scrolls
   sideways. */
.ob-scroll { overflow-x: auto; max-width: 100%; }
.ob-scroll::-webkit-scrollbar { height: 9px; }
.ob-scroll::-webkit-scrollbar-thumb { background: rgba(var(--ob-accent-rgb), 0.16); border-radius: 6px; }

.ob-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 460px; }
.ob-table th {
  text-align: left;
  padding: 9px 12px;
  background: var(--ob-raised);
  border-bottom: 1px solid var(--ob-line);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--ob-ink-3);
  white-space: nowrap;
}
.ob-table th:first-child { border-top-left-radius: var(--ob-radius); }
.ob-table th:last-child { border-top-right-radius: var(--ob-radius); }
.ob-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--ob-line);
  font-size: 0.8rem;
  line-height: 1.6;
  vertical-align: top;
}
.ob-table tr:last-child td { border-bottom: 0; }

.ob-td-name { white-space: nowrap; }
.ob-field { font-family: var(--ob-mono); color: var(--ob-ink); }
.ob-req {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.56rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ob-danger);
}
.ob-td-type { font-family: var(--ob-mono); font-size: 0.74rem; color: var(--ob-ink-3); white-space: nowrap; }
.ob-td-desc { color: var(--ob-ink-2); }
.ob-constraint { margin-top: 5px; font-family: var(--ob-mono); font-size: 0.7rem; color: var(--ob-ink-3); }

/* ---- responses -------------------------------------------------------- */
.ob-resp { display: flex; align-items: baseline; gap: 10px; margin: 12px 0 8px; }
.ob-status {
  flex: none;
  border-radius: var(--ob-radius);
  padding: 3px 9px;
  font-family: var(--ob-mono);
  font-size: 0.68rem;
  font-weight: 700;
}
.ob-status--ok { background: rgba(var(--ob-ok-rgb), 0.14); color: var(--ob-ok); }
.ob-status--client,
.ob-status--server { background: rgba(var(--ob-danger-rgb), 0.14); color: var(--ob-danger); }
.ob-status--redirect,
.ob-status--other { background: rgba(var(--ob-accent-rgb), 0.12); color: var(--ob-accent); }
.ob-resp-desc { font-size: 0.8rem; line-height: 1.6; }

/* ---- markdown --------------------------------------------------------- */
/* These live under .ob-lede / .ob-group-desc / .ob-op-desc, which are the
   three places a spec's own prose lands. The type scale steps DOWN inside an
   operation: a chapter heading in `info.description` is a landmark, the same
   heading inside one endpoint's description is a label. */
.ob-p { margin: 0 0 12px; line-height: 1.8; }
.ob-p:last-child { margin-bottom: 0; }
.ob-strong { color: var(--ob-ink); font-weight: 650; }
.ob-link { color: var(--ob-accent); text-decoration: underline; text-underline-offset: 2px; }
.ob-link:hover { color: #ffffff; }

.ob-md-h { margin: 26px 0 10px; color: var(--ob-ink); font-weight: 650; letter-spacing: -0.01em; }
.ob-md-h1 { font-size: 1.05rem; }
.ob-md-h2 { font-size: 0.94rem; }
.ob-md-h3,
.ob-md-h4 { font-size: 0.85rem; }
.ob-lede > .ob-md-h:first-child { margin-top: 4px; }
.ob-op-desc .ob-md-h { margin: 18px 0 8px; font-size: 0.82rem; }

.ob-list { margin: 0 0 12px; padding-left: 20px; line-height: 1.8; }
.ob-list li { margin: 3px 0; }

/* A blockquote in these specs is always an aside — a caveat or a rule — so it
   reads as a marked-off passage rather than as a quotation. */
.ob-quote {
  margin: 14px 0;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--ob-line);
  color: var(--ob-ink-3);
}
.ob-quote .ob-p { margin-bottom: 8px; }

.ob-table--md { min-width: 380px; margin: 4px 0 14px; }
.ob-table--md td { font-size: 0.78rem; }
.ob-table--md td:first-child { white-space: nowrap; }

/* ---- code ------------------------------------------------------------- */
.ob-pre {
  margin: 10px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--ob-line);
  border-radius: var(--ob-radius);
  background: var(--ob-sunken);
  font-family: var(--ob-mono);
  font-size: 0.76rem;
  line-height: 1.65;
  color: var(--ob-ink);
  white-space: pre;
}
.ob-code {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(var(--ob-accent-rgb), 0.10);
  font-family: var(--ob-mono);
  font-size: 0.86em;
  color: var(--ob-ink);
}

/* ---- states ----------------------------------------------------------- */
.ob-loading { grid-column: 1 / -1; padding: 80px 0; text-align: center; letter-spacing: 0.3em; color: var(--ob-ink-3); }
.ob-fail { grid-column: 1 / -1; padding: 70px 24px; text-align: center; }
.ob-fail h3 { margin: 0 0 8px; font-size: 1rem; color: var(--ob-ink); }
.ob-fail p { margin: 0; font-family: var(--ob-mono); font-size: 0.78rem; color: var(--ob-danger); }
.ob-foot { margin-top: 48px; font-size: 0.68rem; letter-spacing: 0.05em; color: var(--ob-ink-3); }

/* ---- narrow ----------------------------------------------------------- */
@media (max-width: 900px) {
  .ob-root { grid-template-columns: minmax(0, 1fr); }
  /* The sidebar lies down as a scrolling strip rather than disappearing: on a
     phone it is still the only table of contents this page has. */
  .ob-side {
    position: static;
    height: auto;
    max-height: 42vh;
    box-shadow: inset 0 -1px 0 var(--ob-side-line);
  }
  .ob-side-inner { padding: 16px 12px; }
  .ob-main { padding: 26px 18px 60px; }
  .ob-op { padding: 16px 14px 14px; }
}
