/* Developer documentation (/docs). Loaded after app.css and site.css, whose tokens, buttons and
   eyebrow it reuses. Three columns on a wide screen (menu, text, code), one on a phone. */

.docs { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: clamp(24px, 3.4vw, 56px); align-items: start; padding-block: clamp(20px, 3vw, 40px) clamp(48px, 7vw, 96px); }
.docs-main { min-width: 0; }
.docs :is(h1, h2, h3) { color: var(--heading); }
.docs [id] { scroll-margin-top: 88px; }
.docs a:focus-visible, .docs button:focus-visible, .docs input:focus-visible, .docs pre:focus-visible, .docs summary:focus-visible { outline: 3px solid rgba(31, 207, 154, .7); outline-offset: 2px; border-radius: 6px; }

/* ---------- Menu ---------- */
.docs-menu-btn { display: none; }
.docs-nav { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain; padding: 4px 10px 24px 2px; font-size: .92rem; scrollbar-width: thin; }
.docs-nav h2 { font: 700 .72rem/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px 10px; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px 10px 10px 3px; color: var(--ink); font-weight: 600; text-decoration: none; }
.docs-nav a:hover { background: rgba(15, 46, 51, .06); }
.docs-nav a.is-on { background: var(--ink); color: #fff; }
.docs-nav-eps { display: none; margin: 2px 0 8px 10px !important; padding-left: 8px !important; border-left: 2px solid var(--line); }
.docs-nav-res.is-open > .docs-nav-eps { display: block; }
.docs-nav-eps a { font-weight: 500; font-size: .86rem; padding: 5px 8px; align-items: flex-start; }
.docs-nav-eps a span:last-child { min-width: 0; }
.docs-nav-eps .docs-method { margin-top: 2px; }
.docs-search { display: none; }
.js .docs-search { display: block; }
.docs-search input, .docs-filter input { width: 100%; height: 42px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 14px 14px 14px 4px; background: var(--surface); font: 500 .92rem var(--font-body); color: var(--text); }
.docs-search input:focus, .docs-filter input:focus { border-color: var(--jade); outline: 3px solid rgba(31, 207, 154, .35); outline-offset: 0; }
.docs-search-none { margin: 10px 4px 0; color: var(--muted); font-size: .86rem; }
/* While searching: every group opens, and only what matches stays. */
.docs-nav.is-searching [data-docs-nav-static] { display: none; }
.docs-nav.is-searching .docs-nav-eps { display: block; }
.docs-nav.is-searching [data-docs-ep][hidden], .docs-nav.is-searching [data-docs-res][hidden] { display: none; }

/* ---------- Method, scope and status marks ---------- */
.docs-method { flex: none; display: inline-block; min-width: 3.3em; padding: 3px 6px; border-radius: 6px 6px 6px 2px; font: 700 .66rem/1.2 var(--font-mono); letter-spacing: .04em; text-align: center; background: var(--jade-tint); color: #075F47; }
.docs-method.is-post { background: var(--blue-tint); color: #1B4C91; }
.docs-method.is-put { background: var(--amber-tint); color: #6E4A08; }
.docs-method.is-delete { background: var(--red-tint); color: #8E1F30; }
.docs-nav a.is-on .docs-method { background: rgba(255, 255, 255, .16); color: #fff; }
.docs-path { font: 500 .88rem var(--font-mono); color: var(--ink); background: none; border: 0; padding: 0; overflow-wrap: anywhere; }
.docs-scope { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font: 600 .74rem var(--font-body); color: var(--muted); text-decoration: none; white-space: nowrap; }
.docs-scope.is-write { background: var(--butter); border-color: #EEDB94; color: #5C4300; }
.docs-scope.is-read { background: var(--jade-tint); border-color: #BFE8D7; color: #075F47; }
a.docs-scope:hover { border-color: var(--ink); color: var(--ink); }
.docs-status { font: 700 .76rem var(--font-mono); color: var(--red); background: var(--red-tint); padding: 2px 6px; border-radius: 6px; }

/* ---------- Page heads and prose ---------- */
.docs-head { margin-bottom: clamp(24px, 3vw, 40px); }
.docs-head h1, .docs-hero h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.06; margin: 16px 0 0; }
.docs-lead { color: var(--muted); font-size: 1.08rem; line-height: 1.6; max-width: 68ch; margin: 14px 0 0; }
.docs-base { margin: 16px 0 0; font-size: .92rem; color: var(--muted); }
.docs-main code { font-family: var(--font-mono); font-size: .88em; overflow-wrap: anywhere; }
.docs-prose { max-width: 800px; margin-top: clamp(32px, 4vw, 52px); }
.docs-prose-wide { max-width: none; }
.docs-main h2.docs-h { font-size: clamp(1.35rem, 2.2vw, 1.7rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 0 0 12px; }
.docs-main h3 { font-size: 1rem; font-weight: 700; margin: 26px 0 10px; }
.docs-main h3.docs-h { font-size: 1.12rem; margin-top: 34px; }
.docs-prose p, .docs-prose li { line-height: 1.68; }
.docs-prose p { margin: 0 0 14px; }
.docs-prose ul, .docs-prose ol { padding-left: 22px; margin: 0 0 16px; }
.docs-prose li { margin-bottom: 8px; }
.docs-prose a, .docs-ep-text a, .docs-head a, .docs-small a { color: var(--jade-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.docs-prose a:hover, .docs-ep-text a:hover, .docs-head a:hover { color: var(--ink); }
.docs-prose .docs-code { margin: 16px 0 22px; }
.docs-anchor { opacity: 0; margin-left: 4px; color: var(--muted) !important; font-weight: 500 !important; text-decoration: none !important; }
.docs-h:hover .docs-anchor, .docs-anchor:focus-visible { opacity: 1; }
@media (hover: none) { .docs-anchor { opacity: .55; } }
.docs-h-note { margin-left: 6px; font: 600 .72rem var(--font-mono); color: var(--muted); letter-spacing: .02em; }
.docs-small { font-size: .86rem; color: var(--muted); margin-top: 12px; }
.docs-note { background: var(--butter); border-radius: var(--bubble); padding: 14px 18px; margin: 18px 0; line-height: 1.6; color: #3D2E00; }
.docs-note strong { color: #2B2000; }
.docs-steps { counter-reset: step; list-style: none; padding: 0 !important; }
.docs-steps > li { counter-increment: step; position: relative; padding-left: 46px; margin-bottom: 26px; }
.docs-steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 12px 12px 12px 4px; background: var(--ink); color: #fff; font: 700 .9rem var(--font-body); }
.docs-steps > li > h3 { margin-top: 0; }

/* ---------- Tables that stay readable on a phone ---------- */
.docs-table-wrap { overflow-x: auto; margin: 14px 0 22px; border: 1px solid var(--line); border-radius: 16px 16px 16px 5px; background: var(--surface); }
.docs-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.docs-table th, .docs-table td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.docs-table th { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: #F8FBFA; white-space: nowrap; }
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table td code { white-space: nowrap; }

/* ---------- Field lists ---------- */
.docs-fields { margin: 0; border-top: 1px solid var(--line); }
.docs-fields > div { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.docs-fields dt { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.docs-fields dt code { font-weight: 600; color: var(--ink); font-size: .9rem; }
.docs-fields dd { margin: 5px 0 0; color: var(--muted); font-size: .93rem; line-height: 1.58; overflow-wrap: anywhere; }
.docs-type { font: 500 .78rem var(--font-mono); color: var(--muted); }
.docs-type a { color: var(--jade-dark); }
.docs-req { font: 700 .66rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--papaya-dark); }

/* ---------- Code ---------- */
.docs-code { background: var(--ink); color: #D6F5EA; border-radius: 18px 18px 18px 5px; overflow: hidden; min-width: 0; box-shadow: var(--shadow-2); }
.docs-code + .docs-code { margin-top: 14px; }
.docs-code-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px 8px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); min-height: 46px; }
.docs-code-label { font: 600 .74rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: #9DBAB6; }
.docs-tabs { display: none; gap: 2px; flex-wrap: wrap; margin-left: auto; }
.docs-tabs + .docs-copy { margin-left: 0; }
.js .docs-tabs { display: flex; }
.docs-tabs button { min-height: 32px; padding: 4px 10px; border: 0; border-radius: 9px; background: transparent; color: #9DBAB6; font: 600 .8rem var(--font-body); cursor: pointer; }
.docs-tabs button:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.docs-tabs button[aria-selected="true"] { color: var(--ink); background: var(--jade-bright); }
.docs-code-panel { position: relative; }
.js .docs-code-panel[data-hidden] { display: none; }
html:not(.js) .docs-code-panel[data-label]::before { content: attr(data-label); display: block; padding: 12px 16px 0; font: 600 .74rem var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--jade-bright); }
.docs-code pre { margin: 0; padding: 16px 18px 18px; overflow-x: auto; max-height: 560px; font: 400 .82rem/1.62 var(--font-mono); color: inherit; background: none; tab-size: 2; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent; }
.docs-code pre code { font: inherit; background: none; border: 0; padding: 0; color: inherit; white-space: pre; overflow-wrap: normal; }
.docs-copy { display: none; margin-left: auto; min-height: 32px; padding: 4px 12px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 9px; background: transparent; color: #D6F5EA; font: 600 .76rem var(--font-body); cursor: pointer; }
.js .docs-copy { display: inline-block; }
.docs-copy:hover { background: var(--ink-3); color: #fff; }
.docs-copy.is-done { background: var(--jade-bright); border-color: var(--jade-bright); color: var(--ink); }

/* ---------- Home ---------- */
.docs-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.docs-hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; }
.docs-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: clamp(32px, 5vw, 64px); }
.docs-card { display: block; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px 20px 20px 6px; color: var(--text); text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.docs-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--jade); }
.docs-card h2 { font-size: 1.08rem; font-weight: 700; margin: 14px 0 6px; }
.docs-card p { margin: 0; color: var(--muted); font-size: .93rem; line-height: 1.55; }
.docs-card-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 14px 14px 14px 4px; background: var(--jade-tint); color: var(--jade-dark); }
.docs-res-grid, .docs-guide-list { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.docs-res-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.docs-res-grid a, .docs-guide-list a { display: block; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; text-decoration: none !important; color: var(--text) !important; font-weight: 400 !important; }
.docs-res-grid a:hover, .docs-guide-list a:hover { border-color: var(--jade); }
.docs-res-grid strong, .docs-guide-list strong { display: block; color: var(--ink); }
.docs-res-grid span, .docs-guide-list span { display: block; color: var(--muted); font-size: .88rem; }
.docs-res-grid li, .docs-guide-list li { margin: 0; }

/* ---------- Reference ---------- */
.docs-toc { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 2px; max-width: 760px; }
.docs-toc a { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 7px 10px; border-radius: 10px; text-decoration: none !important; color: var(--text) !important; font-weight: 500 !important; }
.docs-toc a:hover { background: rgba(15, 46, 51, .06); }
.docs-toc a span:last-child { color: var(--muted); font-size: .9rem; }
.docs-toc-plain { display: flex; flex-wrap: wrap; gap: 6px; }
.docs-toc-plain a { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font: 500 .84rem var(--font-mono) !important; }
.docs-filter { max-width: 560px; margin-bottom: 8px; display: none; }
.js .docs-filter { display: block; }
.docs-filter label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.docs-filter-count { margin: 8px 2px 0; font-size: .86rem; color: var(--muted); min-height: 1.3em; }
.docs-filter-none { color: var(--muted); margin-top: 28px; }
.docs-index { margin-top: clamp(28px, 3.4vw, 44px); }
.docs-index > p { margin: 0 0 12px; max-width: 72ch; line-height: 1.6; }
.docs-index-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 5px; overflow: hidden; }
.docs-index-list li + li { border-top: 1px solid var(--line-soft); }
.docs-index-list a { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; padding: 12px 16px; color: var(--text); text-decoration: none; }
.docs-index-list a:hover { background: #F8FBFA; }
.docs-index-title { color: var(--muted); font-size: .92rem; flex: 1 1 180px; }
.docs-ep { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; padding-block: clamp(28px, 4vw, 48px); border-top: 1px solid var(--line); }
.docs-ep-text { min-width: 0; }
.docs-ep-code { min-width: 0; }
.docs-ep-text > p { line-height: 1.66; margin: 0 0 12px; max-width: 72ch; }
.docs-ep-line { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; }
.docs-ep-line .docs-method { font-size: .74rem; }
.docs-ep-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.docs-ep-meta a { text-decoration: none !important; font-weight: 600 !important; color: var(--muted) !important; }
@media (min-width: 1240px) {
  .docs-ep { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 3vw, 48px); }
  .docs-ep-code { position: sticky; top: 88px; align-self: start; max-height: calc(100vh - 104px); overflow-y: auto; scrollbar-width: thin; padding: 0 4px 12px 0; }
  .docs-ep-code .docs-code pre { max-height: 46vh; }
}
.docs-pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
.docs-pager a { display: block; padding: 12px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 16px 5px; color: var(--ink); font-weight: 700; text-decoration: none; }
.docs-pager a.is-next { text-align: right; border-radius: 16px 16px 5px 16px; margin-left: auto; }
.docs-pager a:hover { border-color: var(--jade); }
.docs-pager a span { display: block; font: 600 .72rem var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.docs-object { max-width: 860px; }

/* ---------- Webhook events and changelog ---------- */
.docs-event { border: 1px solid var(--line); border-radius: 16px 16px 16px 5px; background: var(--surface); margin-bottom: 10px; }
.docs-event summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 12px 16px; cursor: pointer; list-style-position: outside; }
.docs-event summary code { font-weight: 600; color: var(--ink); }
.docs-event summary span { color: var(--muted); font-size: .92rem; }
.docs-event summary em { font-style: normal; margin-left: auto; font-size: .78rem; font-weight: 600; color: var(--jade-dark); white-space: nowrap; }
.docs-event > div { padding: 0 12px 12px; }
.docs-release { border-left: 3px solid var(--jade-bright); padding-left: clamp(16px, 2.4vw, 28px); margin-top: 36px; }
.docs-release time { font: 600 .8rem var(--font-mono); color: var(--muted); }
.docs-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font: 700 .68rem var(--font-body); letter-spacing: .06em; text-transform: uppercase; background: var(--jade-tint); color: #075F47; margin-right: 6px; }
.docs-tag.is-changed { background: var(--amber-tint); color: #6E4A08; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1000px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .docs-menu-btn { display: inline-flex; justify-self: start; border: 1px solid var(--line); background: var(--surface); }
  html:not(.js) .docs-menu-btn { display: none; }
  .docs-nav { position: static; max-height: none; padding: 6px 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 5px; }
  .js .docs-nav { display: none; }
  .js .docs-nav.is-open { display: block; }
  .docs-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .docs-code { border-radius: 14px 14px 14px 4px; }
  .docs-code pre { padding: 14px; font-size: .78rem; }
  .docs-index-list a, .docs-ep-line { padding: 10px 12px; }
  .docs-pager { flex-direction: column; }
  .docs-pager a.is-next { margin-left: 0; }
  .docs-event summary em { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-card, .docs * { transition: none !important; scroll-behavior: auto !important; }
  .docs-card:hover { transform: none; }
}
@media print {
  .docs { display: block; }
  .docs-nav, .docs-menu-btn, .docs-copy, .docs-filter { display: none !important; }
  .docs-code { box-shadow: none; }
  .docs-code-panel[data-hidden] { display: block !important; }
}
