/* api.html: the developer page, in the site's look (style.css's tokens) */

.doc { padding-top: 8px; }
.doc code { font-family: var(--font-mono); font-size: 0.86em; }
:not(pre) > code { background: var(--brand-tint); color: var(--brand-dark); padding: 1px 5px; border-radius: 5px; unicode-bidi: isolate; }

.doc-hero { padding: 18px 0 24px; border-bottom: 1px solid var(--line); }
.doc-hero h1 { font-size: 1.8rem; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lede { color: var(--ink-soft); font-size: 1.02rem; margin: 0; max-width: none; }
.lede strong { color: var(--ink); font-weight: 600; }
.agents { margin: 12px 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.agents a:hover { text-decoration: none; }

.doc-section { padding: 26px 0 6px; scroll-margin-top: 12px; }
.doc-section h2 { font-size: 1.25rem; margin: 0 0 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-section h2 code { font-size: 1rem; background: none; color: var(--ink); padding: 0; }
.doc-section h3 { font-size: 1rem; margin: 20px 0 8px; }
.doc-section p { margin: 0 0 10px; max-width: 70ch; }

.verb {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  background: var(--brand); color: #fff; border-radius: 6px; padding: 3px 8px; direction: ltr;
}
.req { font-size: 0.7rem; color: var(--danger); font-weight: 600; margin-inline-start: 4px; }


.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); margin: 0 0 12px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.doc th, .doc td { text-align: start; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { font-size: 0.78rem; color: var(--ink-muted); font-weight: 600; background: var(--surface); }
.doc tr:last-child td { border-bottom: 0; }
.doc td:first-child { white-space: nowrap; }

/* code blocks: dark, left to right, a language tag and a copy button */
.code { position: relative; margin: 0 0 12px; }
.code[data-lang]::before {
  content: attr(data-lang); position: absolute; top: 8px; inset-inline-start: 14px;
  font-size: 0.7rem; color: #a8a29e; font-family: var(--font-sans);
}
.code pre {
  margin: 0; padding: 30px 16px 14px; overflow-x: auto; border-radius: 12px;
  background: #f5f5f5; color: #1c1917; border: 1px solid #e7e5e4;
  font-size: 0.84rem; line-height: 1.65; text-align: left;
}
.code pre code { background: none; color: inherit; padding: 0; font-size: inherit; font-family: var(--font-mono); text-shadow: none; }
/* prism's colours, one palette for every language (as the JSON reads): text
   (strings) green; names brown; keywords blue; numbers amber; the rest grey */
.code .token.string, .code .token.attr-value, .code .token.template-string { color: #0f7b3e; }
.code .token.property, .code .token.literal-property,
.code .token.function, .code .token.builtin, .code .token.class-name, .code .token.constant, .code .token.symbol { color: #9a3412; }
.code .token.keyword, .code .token.boolean { color: #1e5fa8; }
.code .token.number { color: #b45309; }
.code .token.comment { color: #8a8580; font-style: italic; }
.code .token.punctuation, .code .token.operator { color: #57534e; background: none; }
/* one example, several languages (api.js): the dropdown sits where a block's label would */
.code-switch { position: relative; margin: 0 0 12px; }
.code-switch .code { margin: 0; }
.code-switch select {
  position: absolute; top: 6px; inset-inline-start: 10px; z-index: 1;
  border: 1px solid #e7e5e4; background: #fff; color: var(--ink-soft); border-radius: 6px;
  font: inherit; font-size: 0.75rem; padding: 1px 4px; cursor: pointer;
}
.code-switch select:focus { outline: none; border-color: var(--brand); }
.code-switch pre { padding-top: 36px; }

.copy {
  position: absolute; top: 6px; inset-inline-end: 8px;
  border: 1px solid #e7e5e4; background: #fff; color: #78716c; border-radius: 6px;
  font-size: 0.72rem; padding: 1px 9px; cursor: pointer;
}
.copy:hover { color: var(--ink); border-color: #a8a29e; }


/* try it */
.try { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.try input {
  flex: 1 1 240px; min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-raised);
}
.try input:focus, .try select:focus { outline: none; border-color: var(--brand); }
.try select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); font: inherit; }
.try button { border: 0; border-radius: 10px; padding: 8px 22px; background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; }
.try button:hover { background: var(--brand-dark); }
.try-out { max-height: 420px; }

@media (max-width: 600px) {
  .doc-hero h1 { font-size: 1.4rem; }
  .doc td:first-child { white-space: normal; }
}

/* ── the look of ocr.space/ocrapi: white page, Open Sans in slate grey, light
   headings, teal links, green table heads, grey bordered code ─────────────── */
.api-page {
  --brand: #08ab89; --brand-dark: #037455; --brand-tint: #eef8f5;
  --ink: #474d5d; --ink-soft: #5c6271; --ink-muted: #9aa0ab;
  --surface: #fff; --surface-raised: #fff; --line: #ddd;
  --font-sans: 'Open Sans', Arial, sans-serif;
  --font-mono: Monaco, Menlo, Consolas, 'Courier New', monospace;
  font-size: 14px; line-height: 1.6;
}
/* the header stays the home page's: its colours, font and size (right to left, api.html) */
.api-page .top {
  --brand: #c2410c; --brand-dark: #9a3412; --brand-tint: #fdf6f2;
  --ink: #1c1917; --ink-soft: #57534e; --line: #e7e5e4;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-size: 16px;
}
.api-page .doc-hero h1 { font-size: 34px; font-weight: 300; color: #2c3c69; }
.api-page .doc-hero h1 .accent { color: #de8216; font-weight: 700; }
.api-page .lede { font-size: 15px; }
.api-page .lede strong { font-weight: 500; }
.api-page .doc-section h2 { font-size: 22px; font-weight: 400; }
.api-page .doc-section h2 code { font-size: 19px; font-weight: 400; }
.api-page .doc-section h3 { font-weight: 600; }
.api-page .agents { font-size: 13px; }

/* inline code: pink on pale pink */
.api-page :not(pre) > code { color: #c7254e; background: #f9f2f4; border-radius: 4px; padding: 2px 4px; }
.api-page .doc-section h2 code { color: var(--ink); background: none; padding: 0; }

/* code blocks: light grey, a grey border, small corners */
.api-page .code pre { background: #fdfdfd; border: 1px solid #efefef; border-radius: 4px; font-size: 13px; color: #333; }

/* tables: a full grid, the head row dark green */
.api-page .table-wrap { border: 1px solid #ececec; border-radius: 0; }
.api-page .doc table { font-size: 14px; }
.api-page .doc th { background: #fffaf3; color: #474d5d; font-size: 13px; font-weight: 700; }
.api-page .doc th, .api-page .doc td { border: 1px solid #ececec; padding: 9px 10px; }

.api-page .verb { border-radius: 3px; }
.api-page .try input, .api-page .try select, .api-page .try button { border-radius: 4px; }
.api-page .try input, .api-page .try select { border-color: #ccc; }

/* every button orange */
.api-page .verb { background: #fdebd6; color: #c26a12; }
.api-page .try button { background: #fdebd6; color: #c26a12; }
.api-page .try button:hover { background: #fbdcb8; }
.api-page .copy { color: #e0954a; border-color: #f8dcbc; }
.api-page .copy:hover { color: #c26a12; border-color: #f0b77a; }
.api-page .code-switch select { color: #e0954a; border-color: #f8dcbc; }
.api-page .code-switch select:focus, .api-page .try input:focus, .api-page .try select:focus { border-color: #f0b77a; }

/* ── senior pass ─────────────────────────────────────────────────────────── */
/* one accent: links, focus rings and inputs in the same orange family as the
   buttons (dark enough to read on white: 4.7:1) */
.api-page { --brand: #b35c0b; --brand-dark: #8f4708; --brand-tint: #fef4e8; }

/* each endpoint is its own block: a hairline above it and room around it */
.api-page .doc-section + .doc-section { border-top: 1px solid #f0f0f0; margin-top: 22px; padding-top: 34px; }
/* the endpoint line: method and path, plain on the page */
.api-page h2.endpoint { margin-bottom: 10px; gap: 10px; }
.api-page h2.endpoint code { overflow-wrap: anywhere; }
/* a # after each heading on hover: a link to share that section (api.js) */
.api-page .anchor { margin-inline-start: 2px; color: #d6d3d1; font-weight: 400; text-decoration: none; opacity: 0; transition: opacity 0.15s; }
.api-page h2:hover .anchor, .api-page .anchor:focus-visible { opacity: 1; }
.api-page .anchor:hover { color: var(--brand); text-decoration: none; }

/* readable orange on the soft buttons and badges */
.api-page .verb, .api-page .try button { color: #a14f06; }
.api-page .copy, .api-page .code-switch select { color: #b35c0b; border-color: #f3d3ad; }
.api-page .try button { font-weight: 600; min-width: 92px; }
.api-page .try button:disabled { opacity: 0.6; cursor: progress; }

/* tables: the names in plain dark monospace (the pink chips are for prose) */
.api-page .doc td:first-child code { background: none; color: #2c3c69; font-weight: 600; padding: 0; }
.api-page .req { color: #b42318; background: #fef3f2; border-radius: 3px; padding: 1px 6px; font-size: 11px; margin-inline-start: 6px; }

/* try it: the status line coloured by outcome */
.api-page .try-status { margin: 0 0 8px; font-size: 13px; color: var(--ink-muted); }
.api-page .try-status b { font-weight: 600; }
.api-page .try-status .ok { color: #15803d; }
.api-page .try-status .bad { color: #b42318; }

@media (max-width: 600px) {
  .api-page .doc-hero h1 { font-size: 28px; }
  .api-page h2.endpoint { font-size: 15px; }
  .api-page h2.endpoint code { font-size: 15px; }
}

/* the language picker: a quiet pill with its own arrow instead of the browser's box */
.api-page .code-switch select {
  appearance: none; -webkit-appearance: none;
  top: 8px; inset-inline-start: 10px;
  padding: 3px 26px 3px 10px; border-radius: 999px;
  border: 1px solid #ececec; background-color: #fff; color: #474d5d;
  font-size: 12px; font-weight: 600; line-height: 1.4;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b35c0b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.api-page .code-switch select:hover { border-color: #f3d3ad; }
.api-page .code-switch select:focus { outline: none; border-color: #f0b77a; box-shadow: 0 0 0 3px #fef4e8; }
.api-page .code-switch pre { padding-top: 42px; }

/* ── dark: on a phone or tablet set to it, at night, as style.css (which
   darkens the shared names; these are the api page's own colours) ────────── */
@media (prefers-color-scheme: dark) and (pointer: coarse) and (max-width: 1366px) {
  :root.night .api-page {
    --brand: #f0954a; --brand-dark: #f6b073; --brand-tint: #2b1d15;
    --ink: #d9dce3; --ink-soft: #b4b9c4; --ink-muted: #7f8592;
    --surface: #141211; --surface-raised: #1d1a18; --line: #34302d;
  }
  /* the header: the home page's dark colours */
  :root.night .api-page .top {
    --brand: #e8692c; --brand-dark: #f08a52; --brand-tint: #2b1d15;
    --ink: #f2efed; --ink-soft: #c9c3be; --line: #322d2a;
  }
  :root.night .api-page .doc-hero h1 { color: #e3e7f1; }
  :root.night .api-page .doc-hero h1 .accent { color: #f0954a; }
  :root.night .api-page :not(pre) > code { color: #f38ba8; background: #2a1d22; }
  :root.night .api-page .doc td:first-child code { color: #e3e7f1; }
  :root.night .api-page .code pre { background: #1a1816; border-color: #2e2a27; color: #e7e5e4; }
  :root.night .api-page .table-wrap, :root.night .api-page .doc th, :root.night .api-page .doc td { border-color: #2e2a27; }
  :root.night .api-page .doc th { background: #241a12; color: #e3e7f1; }
  :root.night .api-page .doc-section + .doc-section { border-top-color: #2a2725; }
  :root.night .api-page .anchor { color: #57514c; }
  :root.night .api-page .try input, :root.night .api-page .try select { border-color: #3d3835; background: #1d1a18; color: var(--ink); }
  :root.night .api-page .verb, :root.night .api-page .try button { background: #3a2412; color: #f6b073; }
  :root.night .api-page .try button:hover { background: #4a2e16; }
  :root.night .api-page .copy, :root.night .api-page .code-switch select { background-color: #1d1a18; color: #f0954a; border-color: #4a3320; }
  :root.night .api-page .copy:hover, :root.night .api-page .code-switch select:hover { color: #f6b073; border-color: #6b4626; }
  :root.night .api-page .code-switch select:focus { border-color: #8a5a2e; box-shadow: 0 0 0 3px #2b1d15; }
  :root.night .api-page .req { color: #fca5a5; background: #3a1715; }
  :root.night .api-page .try-status .ok { color: #4ade80; }
  :root.night .api-page .try-status .bad { color: #f87171; }
  /* the code's colours, lighter for a dark block */
  :root.night .code .token.string, :root.night .code .token.attr-value, :root.night .code .token.template-string { color: #86d19a; }
  :root.night .code .token.property, :root.night .code .token.literal-property,
  :root.night .code .token.function, :root.night .code .token.builtin, :root.night .code .token.class-name, :root.night .code .token.constant, :root.night .code .token.symbol { color: #f5a97f; }
  :root.night .code .token.keyword, :root.night .code .token.boolean { color: #8ab4f8; }
  :root.night .code .token.number { color: #f9c97a; }
  :root.night .code .token.comment { color: #8c857f; }
  :root.night .code .token.punctuation, :root.night .code .token.operator { color: #b8b2ac; }
  :root.night .code[data-lang]::before { color: #8c857f; }
}
