/* The API pages (api.html, api/docs.html, api/terms.html, api/acceptable-use.html). On top of style.css (and, on the
   first two, landing.css and guide.css): code samples with a Copy button and a JavaScript / Python switch, the word
   packs, the reference's column of contents, the error entries, and the notice that a legal page is still a draft. */
:root { --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* Code in a sentence, in the site's monospace (as research.css sets it). */
.api code, .api-ref code, .api-legal code { padding: 1px 5px; border-radius: 5px; background: var(--hair); font: .86em/1.4 var(--mono); overflow-wrap: anywhere; }

/* A code sample. Its head holds the language switch (or a label) and Copy, and keeps one height. The samples for
   each language lie in the same grid cell, so the box is as tall as the longest and nothing moves when the switch
   is pressed (js/api-page.js). Copy keeps one width whether it says Copy or Copied. */
.code { margin: 16px 0 24px; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.code-head { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 7px 0 6px; border-bottom: 1px solid var(--hair); }
.code-label { padding-left: 10px; color: var(--faint); font-size: 13px; }
.code .tabs { display: flex; gap: 2px; }
.code .tabs button { width: 96px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 13.5px; font-weight: 500; }
.code .tabs button:hover { color: var(--text); }
.code .tabs button[aria-selected="true"] { background: var(--hair); color: var(--text); }
.code-copy { flex: none; width: 84px; height: 30px; margin-left: auto; padding: 0; font-size: 13px; }
.code .panes { display: grid; }
.code .panes > pre { grid-area: 1 / 1; min-width: 0; margin: 0; padding: 16px 18px 18px; overflow-x: auto; font: 13.5px/1.6 var(--mono); white-space: pre; tab-size: 2; visibility: hidden; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.code .panes > pre.on { visibility: visible; }
.code pre code { padding: 0; border-radius: 0; background: none; font: inherit; overflow-wrap: normal; }
@media (min-width: 1140px) { .guide .code.wide { margin-left: -60px; margin-right: -60px; } }

/* The dark and light buttons of the API pages. */
.api-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 172px; height: 46px; padding: 0 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 16px; font-weight: 500; white-space: nowrap; text-decoration: none; }
.api-btn:hover { border-color: var(--muted); }
.api-btn.dark { border-color: var(--text); background: var(--text); color: var(--bg); -webkit-font-smoothing: antialiased; }
.api-btn.dark:hover { opacity: .88; }
.nav .nav-r .link { font-size: 15px; }

/* The product page (api.html): an AI draft rewritten in dots (js/api-dots.js), the headline, one button, one
   request with its answer, and a row of links. Everything else lives in the reference and on the keys page. */
.api-home { width: 100%; max-width: 920px; margin: 0 auto; padding: 28px 24px 28px; font-size: 17px; line-height: 1.5; text-align: center; }
.dots { margin: 0 0 4px; cursor: crosshair; }
.dots canvas { display: block; width: 100%; height: 270px; touch-action: pan-y; }
.api-home h1 { margin: 0 0 22px; font-size: clamp(30px, 4.4vw, 46px); font-weight: 600; letter-spacing: -0.045em; line-height: 1.02; }
.ah-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; margin: 0 0 36px; color: var(--muted); font-size: 16px; }
.ah-cta .api-btn { height: 50px; border-radius: 13px; font-size: 17px; }

/* The request and its answer: one card, dark in both themes, as tall as the sample that is showing. Nothing
   comes after it but the links, so nothing a reader is looking at moves when the language changes. */
.code.term { scroll-margin-top: 100px; --ink: #171614; --ink-2: #26241f; --ink-line: #36332f; --ink-text: #edece8; --ink-dim: #9c978e; max-width: 760px; margin: 0 auto; border-color: var(--ink-line); border-radius: 18px; background: var(--ink); color: var(--ink-text); text-align: left; box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .45); -webkit-font-smoothing: antialiased; }
.term .code-head { height: 48px; padding: 0 8px; border-bottom-color: var(--ink-line); }
.term .tabs button { color: var(--ink-dim); }
.term .tabs button:hover { color: var(--ink-text); }
.term .tabs button[aria-selected="true"] { background: var(--ink-2); color: var(--ink-text); }
.term .code-copy, .term .code-copy:hover:not(:disabled) { border-color: var(--ink-line); background: none; color: var(--ink-text); }
.term .code-copy:hover:not(:disabled) { border-color: var(--ink-dim); }
.term .code-copy.copied, .term .code-copy.copied:hover { border-color: #8fe0ae; background: none; color: #8fe0ae; }
.code.term .panes { display: block; }
.code.term .panes > pre { display: none; visibility: visible; }
.code.term .panes > pre.on { display: block; }
.term pre, .code.term .panes > pre { margin: 0; padding: 20px 22px 24px; font: 14px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-color: var(--ink-line) transparent; }
.term .term-out { border-top: 1px solid var(--ink-line); }
.term .term-out pre { padding-top: 16px; padding-bottom: 18px; }
.term pre code { padding: 0; background: none; font: inherit; overflow-wrap: anywhere; }
.term i { color: var(--ink-dim); font-style: normal; }
.term b { font-weight: inherit; }
.term .in { color: #ffb38f; }
.term .out { color: #8fe0ae; }
:focus-visible:is(.term *) { outline-color: var(--ink-text); }
.api-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 26px; padding: 28px 24px 0; color: var(--faint); font-size: 14.5px; }
.api-links a { color: inherit; text-decoration: none; }
.api-links a:hover { color: var(--text); }
.api-links + .lp-foot { padding-top: 22px; }
@media (max-width: 720px) {
  .api-home { padding: 12px 20px 20px; }
  .dots canvas { height: 340px; }
  .term pre, .code.term .panes > pre { padding: 16px 16px 18px; font-size: 12.5px; }
  .term .tabs button { width: auto; padding: 0 10px; }
  .term .code-copy { width: 72px; }
}

/* Tables on both pages. */
.tbl { overflow-x: auto; margin: 14px 0 24px; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.tbl th, .tbl td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--hair); text-align: left; vertical-align: top; }
.tbl th { border-bottom-color: var(--border); color: var(--muted); font-size: 13.5px; font-weight: 500; }
.tbl td:last-child, .tbl th:last-child { padding-right: 0; }
.tbl td code { white-space: nowrap; }

/* The reference (api/docs.html): its contents in a column that stays on the left, the text beside it. On a narrow
   screen the contents come first, as a list. */
.api-ref { display: grid; grid-template-columns: 200px minmax(0, 740px); justify-content: center; gap: 64px; max-width: 1168px; padding: 44px 24px 120px; }
.toc { position: sticky; top: 100px; align-self: start; max-height: calc(100vh - 124px); overflow-y: auto; font-size: 14px; line-height: 1.4; scrollbar-width: thin; }
.toc p { margin: 0 0 8px; color: var(--faint); font-size: 13px; }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc ol ol { margin: 0 0 4px; padding-left: 12px; }
.toc a { display: block; padding: 4px 0; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }
.doc .prose.ref-body { max-width: none; font-size: 16.5px; }
.doc .prose.ref-body .lead { margin: 0 0 8px; color: var(--muted); font-size: 19px; line-height: 1.5; }
.doc .prose.ref-body h2 { margin: 64px 0 12px; font-size: 28px; letter-spacing: -0.035em; line-height: 1.15; }
.doc .prose.ref-body h3 { margin: 32px 0 8px; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.ref-body [id] { scroll-margin-top: 100px; }
.ref-body .note { margin: 18px 0; padding: 12px 16px; border-left: 3px solid var(--border); color: var(--muted); font-size: 15.5px; }
@media (max-width: 1000px) {
  .api-ref { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .toc { position: static; max-height: none; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; }
  .toc > ol { columns: 2; column-gap: 24px; }
  .toc li { break-inside: avoid; }
}
@media (max-width: 760px) { .api-ref { padding: 26px 20px 80px; } .doc .prose.ref-body h2 { font-size: 24px; } .toc > ol { columns: 1; } }

/* One entry per error code. Each has the code as its id: an error's doc_url lands on it. */
.err { padding: 16px 0 4px; border-top: 1px solid var(--hair); }
.doc .prose.ref-body .err h4 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin: 0 0 6px; font-size: 17px; }
.err h4 code { font-size: .92em; }
.err .st { color: var(--muted); font-size: 14px; font-weight: 400; }
.doc .prose.ref-body .err p { margin: 0 0 10px; }
.err .msg { color: var(--muted); font-size: 15px; }
.err .msg::before { content: "Message, for example: "; color: var(--faint); }
.err .retry { font-size: 15px; }
.err:target { background: linear-gradient(var(--mark), var(--mark)) no-repeat 0 0 / 100% 100%; border-radius: 8px; padding-left: 12px; padding-right: 12px; }

/* The legal drafts: a box at the very top that says they are not in force, and each choice still to be made in
   square brackets, marked so it can't be missed. */
.draft-box { margin: 0 0 30px; padding: 14px 18px; border: 1.5px solid var(--warn); border-radius: 12px; background: color-mix(in srgb, var(--warn) 9%, var(--surface)); font-size: 15.5px; line-height: 1.5; }
.doc .prose .draft-box p { margin: 0; }
.doc .prose .draft-box p + p { margin-top: 6px; }
.draft-box b { color: var(--warn); }
.ph { padding: 0 3px; border-radius: 4px; background: var(--mark); font-weight: 500; }

/* The keys page (api/keys.html, js/keys.js): three numbered steps (a key, words, a first call) in cards like the
   packs, then the keys and the account cap. Buttons keep one size, and the line under each step's buttons is kept
   even when it has nothing to say, so the page never jumps. Renaming, capping and revoking a key happen in place. */
.keys-page { max-width: 880px; margin: 0 auto; padding: 40px 24px 80px; font-size: 16px; line-height: 1.5; }
.keys-page h1 { margin: 0 0 6px; font-size: 40px; font-weight: 600; letter-spacing: -0.03em; }
.keys-lede { margin: 0 0 28px; color: var(--muted); }
.keys-body { min-height: 420px; }
.keys-wait { color: var(--muted); }
.keys-card { margin: 0 0 16px; padding: 20px 22px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.keys-card h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.keys-card p { margin: 0 0 12px; }
.keys-card p:last-child { margin-bottom: 0; }
.keys-step h2 { display: flex; align-items: center; gap: 10px; }
.keys-n { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border: 1.5px solid var(--text); border-radius: 50%; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.keys-step.done .keys-n { border-color: var(--good); background: var(--good); color: var(--bg); }
.keys-balance { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin: 0 0 14px; }
.keys-num { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.keys-month { color: var(--muted); font-size: 14.5px; text-align: right; font-variant-numeric: tabular-nums; }
.faint { color: var(--faint); }
.keys-note { color: var(--muted); }
.keys-error { margin: 0 0 16px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 12px; background: var(--mark); }
.keys-notice { margin: 0 0 16px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--good) 45%, var(--border)); border-radius: 12px; background: color-mix(in srgb, var(--good) 9%, var(--surface)); }
.keys-waiting { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--hair); color: var(--text); }
.keys-waiting.slow { color: var(--muted); }
.keys-spin { flex: none; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.keys-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 12.5px; font-weight: 500; vertical-align: 1px; }
.keys-submit { width: 160px; min-width: 0; }
.keys-create { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.keys-create input, .keys-inline input { box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; }
.keys-create input { width: 220px; }
.keys-seg { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.keys-seg button { width: 72px; height: 38px; padding: 0; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-weight: 500; }
.keys-seg button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.keys-seg button:disabled { color: var(--faint); cursor: default; }
.keys-why { min-height: 1.5em; margin: 10px 0 0 !important; font-size: 14px; }
.keys-why a, .keys-plan a { color: inherit; }
.keys-step.done:has(.keys-secret code) { border-color: var(--text); }
.keys-secret { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; }
.keys-secret code, .keys-secret pre { flex: 1; min-width: 0; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--hair); font: 14px/1.5 var(--mono); overflow-x: auto; white-space: pre; }
.keys-secret pre.keys-curl, .keys-secret code { white-space: pre-wrap; overflow-wrap: anywhere; }
.keys-copy { flex: none; width: 84px; height: 40px; padding: 0; }
.keys-done { width: 84px; padding: 0; }
.keys-packs { display: flex; flex-wrap: wrap; gap: 10px; }
.keys-pack { display: grid; justify-items: start; gap: 2px; width: 188px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.keys-pack b { font-size: 22px; letter-spacing: -0.02em; }
.keys-pack span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.keys-pack .keys-pack-go { margin-top: 8px; color: var(--text); font-size: 14.5px; font-weight: 500; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.keys-pack:hover:not(:disabled) { border-color: var(--muted); }
.keys-pack:hover:not(:disabled) .keys-pack-go { text-decoration-color: currentColor; }
.keys-pack:disabled { opacity: .5; cursor: default; }
.keys-table table { font-size: 14.5px; }
.keys-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.keys-table td.end { text-align: right; }
.keys-table code { font: 13.5px/1.4 var(--mono); white-space: nowrap; }
.keys-table tr.editing td { background: color-mix(in srgb, var(--hair) 60%, transparent); }
.keys-link { padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; cursor: pointer; }
.keys-link:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.keys-revoke { width: 84px; padding: 0; }
.keys-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.keys-inline input { width: 160px; height: 32px; padding: 4px 10px; border-radius: 8px; font-size: 14.5px; }
.keys-inline .keys-cap-input { width: 110px; }
.keys-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; font-size: 14px; }
.keys-confirm > span { color: var(--muted); }
.keys-danger, .keys-danger:hover:not(:disabled) { width: 84px; padding: 0; border-color: var(--danger); color: var(--danger); }
.keys-revoked { margin-top: 10px; }
.keys-revoked summary { color: var(--muted); cursor: pointer; }
.keys-signin { display: grid; justify-items: start; gap: 14px; }
.keys-card.keys-signin h2 { margin: 0; }
.keys-plan { margin: 0; padding-left: 22px; color: var(--muted); }
.keys-plan li { margin: 0 0 4px; }
.keys-plan b { color: var(--text); font-weight: 500; }
@media (max-width: 640px) {
  .keys-page { padding-top: 24px; }
  .keys-page h1 { font-size: 32px; }
  .keys-card { padding: 18px 16px; }
  .keys-month { text-align: left; }
  .keys-create input { width: 100%; }
  .keys-pack { width: calc(50% - 5px); box-sizing: border-box; }
  .keys-secret { flex-direction: column; align-items: stretch; }
  .keys-secret .keys-copy { align-self: flex-end; }
  /* On a phone each key is a small block of its own instead of a row too wide to read. */
  .keys-table thead { display: none; }
  .keys-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
  .keys-table td { padding: 0; border: 0; }
  .keys-table td.end { grid-column: 1 / -1; text-align: left; }
  .keys-table tr.editing td { background: none; }
  .keys-confirm { justify-content: flex-start; }
}

/* The integration pages (integrations.html, integrations/*.html, embed.html): the guide layout, with one install
   button under the heading. It says "Coming soon" and does nothing until the listing is live (js/integrations.js). */
.integration .in-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; margin: -12px 0 44px; color: var(--muted); font-size: 16px; }
.integration .api-btn.soon { border-color: var(--border); background: var(--surface); color: var(--muted); cursor: default; }
.integration .api-btn.soon:hover { opacity: 1; }
.doc .prose.guide .in-steps li { margin-bottom: 10px; }
.integration code, .hubpage code { padding: 1px 5px; border-radius: 5px; background: var(--hair); font: .84em/1.4 var(--mono); overflow-wrap: anywhere; }
.integration .code pre code { padding: 0; background: none; font: inherit; overflow-wrap: normal; }
.doc .prose.guide.hubpage .hub-h { margin: 40px 0 0; color: var(--muted); font-size: 15px; font-weight: 500; letter-spacing: 0; }
.guide.hubpage .hub-h + .hub { margin-top: 10px; }
.guide.hubpage .hub-foot { margin-top: 32px; color: var(--muted); }

/* Connecting an AI assistant (/oauth/authorize, worker/oauth.js): one narrow column, the question and two buttons. */
.connect { max-width: 480px; margin: 12vh auto 48px; padding: 0 24px; font-size: 17px; line-height: 1.55; }
.connect h1 { margin: 0 0 14px; font-size: 30px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.15; }
.connect p { margin: 0 0 14px; }
.connect .connect-small { color: var(--muted); font-size: 15px; }
.connect .connect-can { margin: 0 0 18px; padding-left: 20px; }
.connect .connect-go, .connect .connect-dev { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; }
.connect .connect-go .api-btn { flex: 1; min-width: 0; }
.connect .connect-dev input { flex: 1; min-width: 180px; height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
.connect #connect-google { margin: 6px 0 4px; }
.connect .connect-error { color: var(--danger, #c0392b); font-size: 15px; }
