/* API docs: standalone docs layout (sidebar, prose, sticky code panel). Light and dark themes; code panels are always dark. */
:root {
  --bg: #ffffff; --fg: #0f172a; --muted: #5b6472; --line: #e2e8f0; --side: #f8fafc; --soft: #f1f5f9; --accent: #0d6efd; --accent-soft: #e7f0ff;
  --ok: #15803d; --ok-bg: #ecfdf3; --warn: #b45309; --warn-bg: #fff6e6; --tip: #1d4ed8; --tip-bg: #eef3ff;
  --code-bg: #0f1218; --code-fg: #d7dbe3; --code-line: #232834; --code-muted: #8b93a3;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace; --sans: "Inter Tight", -apple-system, "Segoe UI", sans-serif;
  --top: 56px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0c0f; --fg: #ececee; --muted: #9aa1ab; --line: #22262c; --side: #0e1014; --soft: #14171c; --accent: #6ea0ff; --accent-soft: #162033;
  --ok: #4ade80; --ok-bg: #0f2418; --warn: #fbbf24; --warn-bg: #2a2010; --tip: #8db4ff; --tip-bg: #121c30;
  --code-bg: #0a0c10; --code-line: #1e232c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 20px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body.docs-body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code { font-family: var(--mono); font-size: 0.86em; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 0.08em 0.38em; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--bg); color: var(--muted); }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--fg); color: var(--bg); padding: 0.5rem 1rem; z-index: 100; }
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--top); display: flex; align-items: center; gap: 0.9rem; padding: 0 1.1rem; background: color-mix(in srgb, var(--bg) 96%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--fg); font-weight: 650; font-size: 1.02rem; white-space: nowrap; }
.brand b { font-weight: 400; color: var(--muted); }
.brand img { border-radius: 4px; }
:root[data-theme="dark"] .brand img { filter: invert(1) hue-rotate(180deg); }
.brand-tag { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }
.search-btn { display: flex; align-items: center; gap: 0.6rem; margin: 0 auto 0 1.2rem; min-width: 280px; max-width: 420px; flex: 1; height: 36px; padding: 0 0.7rem; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.search-btn:hover { border-color: color-mix(in srgb, var(--fg) 25%, var(--line)); }
.search-btn span { flex: 1; }
.top-links { display: flex; gap: 1.1rem; }
.top-links a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.top-links a:hover { color: var(--fg); }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--soft); color: var(--fg); }
.menu-btn { display: none; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
.signin { background: var(--fg); color: var(--bg); text-decoration: none; font-weight: 600; font-size: 14px; border-radius: 8px; padding: 0.42rem 0.95rem; white-space: nowrap; }
.signin:hover { opacity: 0.88; }

/* shell */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); max-width: 1640px; margin: 0 auto; }
.sidebar { position: sticky; top: var(--top); align-self: start; height: calc(100vh - var(--top)); overflow-y: auto; padding: 1.4rem 1rem 3rem 1.25rem; border-right: 1px solid var(--line); background: var(--side); font-size: 14.5px; }
.side-group { margin: 1.3rem 0 0.35rem; font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.side-group:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 0.32rem 0.7rem; margin: 1px 0; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 500; }
.sidebar a:hover { color: var(--fg); background: var(--soft); }
.sidebar a[aria-current="true"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.sidebar a.ext::after { content: " \2197"; font-size: 0.85em; opacity: 0.6; }
.scrim { position: fixed; inset: var(--top) 0 0 0; background: rgba(0,0,0,0.45); z-index: 39; }

/* content */
.content { min-width: 0; padding: 0 clamp(1.1rem, 3.2vw, 3rem) 4rem; }
.doc-section { padding: 3rem 0 2.2rem; border-bottom: 1px solid var(--line); }
.doc-section:last-of-type { border-bottom: 0; }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 540px); gap: clamp(1.5rem, 3.4vw, 3.4rem); align-items: start; }
.doc-row.no-aside { grid-template-columns: minmax(0, 780px); }
.doc-main { min-width: 0; }
.doc-aside { position: sticky; top: calc(var(--top) + 18px); min-width: 0; display: grid; gap: 14px; max-height: calc(100vh - var(--top) - 36px); overflow-y: auto; scrollbar-width: thin; }
h2 { font-size: clamp(1.7rem, 3vw, 2.15rem); line-height: 1.18; letter-spacing: -0.02em; margin: 0 0 0.7rem; font-weight: 700; position: relative; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; position: relative; letter-spacing: -0.01em; }
.anchor { position: absolute; left: -1.15em; color: var(--muted); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 0.8; }
.lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 1.3rem; max-width: 62ch; }
.doc-main p, .doc-main li { max-width: 70ch; }
.doc-main p { margin: 0.8rem 0; }
.endpoint { display: flex; align-items: center; gap: 0.6rem; margin: 1.2rem 0 0.5rem !important; }
.endpoint code { font-size: 0.95rem; background: var(--soft); padding: 0.25rem 0.6rem; }
.method { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 0.22rem 0.55rem; border-radius: 6px; letter-spacing: 0.03em; }
.m-post { background: #dcfce7; color: #166534; } .m-get { background: #dbeafe; color: #1e40af; }
:root[data-theme="dark"] .m-post { background: #12301d; color: #6ee7a0; } :root[data-theme="dark"] .m-get { background: #14284a; color: #8db4ff; }

/* lists, cards, callouts */
.checks { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.55rem; }
.checks li { position: relative; padding-left: 1.7rem; }
.checks li::before { content: ""; position: absolute; left: 0; top: 0.42em; width: 1em; height: 1em; background: var(--accent); mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat; }
.steps { counter-reset: step; list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.9rem; }
.steps li { counter-increment: step; position: relative; padding-left: 2.6rem; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.8rem; margin: 1.2rem 0; }
.card-link { display: grid; gap: 0.2rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--fg); background: var(--bg); transition: border-color .15s, transform .15s; }
.card-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-link span { color: var(--muted); font-size: 0.92rem; }
.callout { display: grid; gap: 0.15rem; margin: 1.2rem 0; padding: 0.85rem 1rem; border-radius: 10px; border: 1px solid; font-size: 0.95rem; }
.callout strong { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; }
.callout-note { background: var(--soft); border-color: var(--line); } .callout-note strong { color: var(--muted); }
.callout-tip { background: var(--tip-bg); border-color: color-mix(in srgb, var(--tip) 30%, transparent); } .callout-tip strong { color: var(--tip); }
.callout-warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); } .callout-warn strong { color: var(--warn); }
.price-card { display: inline-flex; align-items: baseline; gap: 0.7rem; padding: 0.9rem 1.2rem; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); margin: 0.6rem 0; }
.price { font-size: 2.2rem; font-weight: 750; letter-spacing: -0.02em; }

/* tables */
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--soft); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
td code { white-space: nowrap; }
.type { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.req, .opt { margin-left: 0.5rem; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.req { color: #c2410c; } .opt { color: var(--muted); font-weight: 600; }

/* code */
.code { border-radius: 12px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--code-line); color: var(--code-fg); }
.doc-main .code { margin: 1rem 0; }
.code-bar { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.5rem 0 0.9rem; min-height: 40px; border-bottom: 1px solid var(--code-line); background: rgba(255,255,255,0.02); }
.code-title { font-size: 12px; color: var(--code-muted); font-weight: 600; letter-spacing: 0.02em; margin-right: auto; }
.tablist { display: flex; gap: 2px; order: 2; }
.tab { background: none; border: 0; color: var(--code-muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 0.3rem 0.65rem; border-radius: 6px; cursor: pointer; }
.tab:hover { color: #fff; }
.tab[aria-selected="true"] { color: #fff; background: rgba(255,255,255,0.1); }
.copy { order: 3; background: none; border: 1px solid transparent; color: var(--code-muted); font: inherit; font-size: 12px; font-weight: 600; padding: 0.25rem 0.6rem; border-radius: 6px; cursor: pointer; }
.copy:hover { color: #fff; border-color: var(--code-line); }
.copy.done { color: #4ade80; }
.status { font-family: var(--mono); font-size: 11.5px; color: #4ade80; order: 2; }
.panel[hidden] { display: none; }
.code pre { margin: 0; padding: 0.95rem 1.1rem; overflow: auto; max-height: 520px; font-family: var(--mono); font-size: 12.8px; line-height: 1.65; tab-size: 2; }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; white-space: pre; }
.tk-s { color: #9fe0a8; } .tk-n { color: #f4b97a; } .tk-k { color: #c9a0ff; } .tk-c { color: #6c7686; font-style: italic; }
.tk-f { color: #7db4ff; } .tk-p { color: #7fdbca; } .tk-b { color: #ff9eb0; } .tk-v { color: #ffd479; }

/* try it */
.tryit-box .tryit-body { display: grid; gap: 0.7rem; padding: 0.95rem 1.1rem 1.1rem; }
.tryit-body label { display: grid; gap: 0.3rem; font-size: 12.5px; color: var(--code-muted); font-weight: 600; }
.tryit-body input[type="password"], .tryit-body input[type="text"] { height: 38px; padding: 0 0.7rem; border-radius: 8px; border: 1px solid var(--code-line); background: #0a0d12; color: var(--code-fg); font-family: var(--mono); font-size: 13px; }
.tryit-body input[type="file"] { color: var(--code-fg); font-size: 13px; }
.tryit-run { justify-self: start; height: 36px; padding: 0 1.1rem; border: 0; border-radius: 8px; background: #fff; color: #0b0c0f; font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.tryit-run[disabled] { opacity: 0.55; cursor: progress; }
.tryit-note { margin: 0; font-size: 12px; color: var(--code-muted); }
.tryit-out { margin: 0; max-height: 360px; overflow: auto; padding: 0.8rem; border-radius: 8px; background: #0a0d12; border: 1px solid var(--code-line); font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.tryit-out:empty { display: none; }
.tryit-out .bad { color: #ff9eb0; }

/* faq and footer */
.faq details { border-bottom: 1px solid var(--line); padding: 0.85rem 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::after { content: "+"; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; }
.faq summary::-webkit-details-marker { display: none; }
.doc-foot { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* search palette */
.palette { position: fixed; inset: 0; z-index: 90; display: grid; justify-items: center; align-items: start; padding: 12vh 1rem 1rem; background: rgba(5,6,10,0.55); backdrop-filter: blur(3px); }
.palette[hidden] { display: none; }
.palette-box { width: min(620px, 100%); background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,0.35); overflow: hidden; }
.palette-box input { width: 100%; height: 54px; border: 0; border-bottom: 1px solid var(--line); padding: 0 1.1rem; font: inherit; font-size: 1.05rem; background: transparent; color: var(--fg); outline: none; }
#palette-list { list-style: none; margin: 0; padding: 0.4rem; max-height: 50vh; overflow-y: auto; }
#palette-list li a { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; padding: 0.6rem 0.8rem; border-radius: 8px; text-decoration: none; color: var(--fg); }
#palette-list li a small { color: var(--muted); font-size: 12px; white-space: nowrap; }
#palette-list li a[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
#palette-list .empty { padding: 1rem; color: var(--muted); }
.palette-hint { margin: 0; padding: 0.55rem 1rem; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; gap: 0.5rem; align-items: center; }

/* responsive */
@media (max-width: 1220px) {
  .doc-row { grid-template-columns: minmax(0, 1fr); }
  .doc-aside { position: static; max-height: none; overflow: visible; }
  .anchor { display: none; }
}
@media (max-width: 960px) {
  .top-links, .brand-tag { display: none; }
  .search-btn { min-width: 0; margin-left: auto; }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { flex: 0 0 36px; width: 36px; padding: 0; justify-content: center; }
  .menu-btn { display: grid; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: var(--top); left: 0; bottom: 0; width: min(300px, 86vw); height: auto; z-index: 40; transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,0.25); }
}
@media (max-width: 520px) { .topbar { gap: 0.4rem; padding: 0 0.7rem; } .brand span { display: none; } .signin { padding: 0.4rem 0.7rem; } .content { padding-bottom: 3rem; } h2 { font-size: 1.55rem; } }
@media print { .topbar, .sidebar, .doc-aside .tryit-box, .palette { display: none !important; } .shell { display: block; } .doc-row { display: block; } }

/* parameter tables: let descriptions wrap, stack the required badge under the type */
table.params { table-layout: auto; }
table.params td:nth-child(1) { width: 1%; }
table.params td:nth-child(2) { width: 1%; white-space: nowrap; }
table.params td:nth-child(3) { min-width: 220px; overflow-wrap: anywhere; }
table.params td:nth-child(3) code { white-space: normal; }
table.params .req, table.params .opt { display: block; margin: 0.1rem 0 0; }
.cards { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.doc-row.no-aside { grid-template-columns: minmax(0, 900px); }

/* Try it: friendlier file button */
.tryit-body input[type="file"]::file-selector-button { margin-right: 0.8rem; height: 32px; padding: 0 0.9rem; border: 1px solid var(--code-line); border-radius: 8px; background: #161b24; color: #fff; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.tryit-body input[type="file"]::file-selector-button:hover { background: #1d2430; }
.tryit-body input[type="file"] { padding: 0.5rem; border: 1px dashed var(--code-line); border-radius: 10px; background: #0a0d12; }
/* dscvry family: lighter, tighter headings as on dscvryai.com */
.docs-body h1, .docs-body h2, .docs-body h3 { font-weight: 500; letter-spacing: -0.03em; }
.docs-body h1 { letter-spacing: -0.04em; }
