/* developer.refapp.com. Colors and typeface follow Refapp's visual identity:
   ink on Fog, white cards, Albert Sans, orange for one job at a time. */

@font-face { font-family: "Albert Sans"; font-weight: 400; font-display: swap; src: url("/assets/fonts/AlbertSans_400Regular.ttf") format("truetype"); }
@font-face { font-family: "Albert Sans"; font-weight: 500; font-display: swap; src: url("/assets/fonts/AlbertSans_500Medium.ttf") format("truetype"); }
@font-face { font-family: "Albert Sans"; font-weight: 600; font-display: swap; src: url("/assets/fonts/AlbertSans_600SemiBold.ttf") format("truetype"); }

:root {
  --ink: #191919;
  --fog: #FEF8F0;
  --warm: #F5F0E8;
  --orange: #FD954B;

  --bg: var(--fog);
  --panel: #FFFFFF;
  --text: var(--ink);
  --text-2: #3A3733;
  --muted: #5E5A54;
  --line: rgba(25, 25, 25, .10);
  --shadow: 0 2px 8px rgba(25, 25, 25, .06);
  --tint: rgba(253, 149, 75, .20);
  --ok: #2F7343;
  --flag: #D94A4A;
  --button-bg: var(--ink);
  --button-text: #FFFFFF;
  --backdrop: rgba(25, 25, 25, .35);

  --font: "Albert Sans", -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --topbar: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: var(--ink);
  --panel: rgba(245, 240, 232, .05);
  --text: var(--warm);
  --text-2: var(--warm);
  --muted: #9F998E;
  --line: rgba(245, 240, 232, .09);
  --shadow: none;
  --ok: #5FB876;
  --button-bg: var(--warm);
  --button-text: var(--ink);
  --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.6 var(--font); }
[hidden] { display: none !important; }
a { color: inherit; }
code, pre, kbd, textarea { font-family: var(--mono); }
button svg, .search-box svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--button-bg); color: var(--button-text); padding: 8px 16px; border-radius: 8px; z-index: 30; }
.skip-link:focus { left: 8px; }

/* ----- Top bar ----- */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: 24px; padding: 0 24px; background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; }
.brand img { height: 30px; width: auto; display: block; }
.brand .logo-dark, [data-theme="dark"] .brand .logo-light { display: none; }
[data-theme="dark"] .brand .logo-dark { display: block; }
.tabs { display: flex; gap: 24px; align-self: stretch; margin-right: auto; }
.tabs a { white-space: nowrap; display: flex; align-items: center; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--orange); }
.icon-button, .search-button, .text-button, .pill-button, .primary-button, .copy-code, .lang-tabs button { font: inherit; color: inherit; cursor: pointer; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: none; }
.icon-button:hover { background: var(--line); }
.icon-moon, [data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.menu-button { display: none; }
.search-button { display: flex; align-items: center; gap: 8px; height: 40px; min-width: 220px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); font-size: 15px; }
.search-button span { margin-right: auto; }
.search-button:hover { color: var(--text); }
kbd { font-size: 12px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }

/* ----- Layout ----- */
.layout { display: grid; grid-template-columns: 288px minmax(0, 1fr) 248px; max-width: 1520px; margin: 0 auto; }
[data-section="reference"] .layout { grid-template-columns: 288px minmax(0, 1fr) minmax(360px, 440px); }
.no-aside .layout, [data-section="reference"].no-aside .layout { grid-template-columns: 288px minmax(0, 1fr); }
.sidebar, .aside { position: sticky; top: var(--topbar); align-self: start; max-height: calc(100vh - var(--topbar)); overflow-y: auto; padding: 32px 24px 48px; }
.sidebar { border-right: 1px solid var(--line); }
main { min-width: 0; padding: 48px 48px 96px; }
article { max-width: 780px; margin: 0 auto; }

/* ----- Sidebar ----- */
.filter, .field input, .field textarea, .search-box input { width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.filter { font-size: 15px; margin-bottom: 8px; }
.nav-heading { font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 24px 0 8px; }
.nav-heading a { text-decoration: none; }
.nav-heading a:hover, .nav-heading a[aria-current] { color: var(--text); }
.nav-subheading { font-size: 14px; font-weight: 600; margin: 16px 0 4px; }
.sidebar-nav ul, .toc ul { list-style: none; margin: 0; padding: 0; }
.sidebar-nav ul ul { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.sidebar-nav li a, .toc a { display: block; padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--text-2); font-size: 15.5px; line-height: 1.35; }
.sidebar-nav li a:hover, .toc a:hover { background: var(--line); }
.sidebar-nav li a[aria-current] { color: var(--text); font-weight: 600; background: var(--tint); }
.sidebar-nav a.op-link, .op-link { display: flex; align-items: baseline; gap: 8px; }
.filter-empty { font-size: 15px; padding: 8px 12px; }
.toc a { font-size: 14.5px; color: var(--muted); }
.toc a:hover { color: var(--text); }
.toc .toc-3 a { padding-left: 24px; }

/* ----- Page head ----- */
.breadcrumb { margin: 0 0 8px; font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
h1 { font-size: 40px; line-height: 1.08; font-weight: 500; letter-spacing: -.01em; margin: 0; }
h1::after { content: ""; display: block; width: 64px; height: 4px; border-radius: 2px; background: var(--orange); margin-top: 16px; }
.page-actions { display: flex; gap: 8px; margin: 16px 0 32px -8px; }
.text-button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 8px; border-radius: 8px; font-size: 14.5px; color: var(--muted); text-decoration: none; }
.text-button:hover { color: var(--text); background: var(--line); }
.text-button svg { width: 16px; height: 16px; }

/* ----- Prose ----- */
.prose { color: var(--text-2); }
.prose h2, .prose h3, .prose h4 { color: var(--text); position: relative; line-height: 1.2; }
.prose h2 { font-size: 26px; font-weight: 500; margin: 48px 0 16px; }
.prose h3 { font-size: 20px; font-weight: 600; margin: 32px 0 8px; }
.prose h4 { font-size: 17px; font-weight: 600; margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { font-weight: 600; color: var(--text); }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin: 4px 0; }
.prose ul > li::marker { color: var(--orange); }
.anchor { position: absolute; left: -24px; width: 24px; color: var(--muted); text-decoration: none !important; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { opacity: 1; }
:not(pre) > code { font-size: .86em; padding: 2px 6px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); color: var(--text); overflow-wrap: anywhere; }
.code-block { position: relative; margin: 0 0 24px; }
pre.shiki, pre.mermaid { margin: 0; padding: 16px 20px; border-radius: 12px; background: var(--panel) !important; border: 1px solid var(--line); box-shadow: var(--shadow); overflow-x: auto; font-size: 14px; line-height: 1.55; color: var(--text); }
.shiki span { color: var(--shiki-light); }
[data-theme="dark"] .shiki span { color: var(--shiki-dark); }
pre.mermaid { margin: 0 0 24px; font-family: var(--font); text-align: center; }
pre.mermaid svg { height: auto; }
pre.mermaid:not([data-processed]) { white-space: pre; text-align: left; font-family: var(--mono); }
.copy-code { position: absolute; top: 8px; right: 8px; font-size: 12.5px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 100px; background: var(--bg); color: var(--muted); opacity: 0; }
.code-block:hover .copy-code, .copy-code:focus-visible { opacity: 1; }
.copy-code:hover { color: var(--text); }
.table-wrap { overflow-x: auto; margin: 0 0 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
th, td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--text); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.note { padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--orange); border-radius: 8px; }

/* ----- Page foot ----- */
.page-foot { margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
.feedback { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.feedback-question { font-weight: 500; }
.pill-button { padding: 4px 20px; border: 1px solid var(--muted); border-radius: 100px; background: none; }
.pill-button:hover:not(:disabled), .pill-button[aria-pressed="true"] { background: var(--button-bg); color: var(--button-text); border-color: var(--button-bg); }
.pill-button:disabled { cursor: default; opacity: .6; }
.pill-button[aria-pressed="true"]:disabled { opacity: 1; }
.updated { font-size: 14.5px; margin: 16px 0 0; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 32px; }
.pager a { display: block; padding: 16px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); text-decoration: none; font-weight: 500; }
.pager a:hover { border-color: var(--muted); }
.pager a span { display: block; font-size: 13px; font-weight: 400; }
.pager-next { text-align: right; grid-column: 2; }

/* ----- Reference ----- */
.method { font: 600 11.5px/1 var(--mono); letter-spacing: .04em; padding: 4px 6px; border: 1px solid var(--muted); border-radius: 6px; color: var(--text); flex: none; min-width: 42px; text-align: center; }
.op-address { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.op-address code { border: 0; padding: 0; background: none; font-size: 14.5px; }
.props { list-style: none; margin: 0 0 24px; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.props .props { margin: 12px 0 0; box-shadow: none; background: none; }
.prose .prop { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.prop:last-child { border-bottom: 0; }
.prop-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.prop-name { font-weight: 600; border: 0 !important; padding: 0 !important; background: none !important; font-size: 14.5px !important; }
.prop-type { font: 13.5px var(--mono); color: var(--muted); }
.prop-required { font-size: 12.5px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--text); }
.prop-desc { font-size: 15.5px; margin-top: 4px; }
.prop-desc p:last-child { margin-bottom: 0; }
.prop-facts { font-size: 14.5px; color: var(--muted); margin-top: 4px; }
.prop-children { margin-top: 8px; }
.prop-children > summary { cursor: pointer; font-size: 14.5px; font-weight: 500; color: var(--text); width: fit-content; }
.prop-children .code-block { margin: 12px 0 0; }
.responses { display: grid; gap: 12px; }
.response { padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.response-head { display: flex; align-items: baseline; gap: 12px; }
.status { font: 600 14.5px var(--mono); color: var(--text); }
.status::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--muted); }
.status-2::before { background: var(--ok); }
.status-4::before, .status-5::before { background: var(--flag); }
.op-list { list-style: none; padding: 0 !important; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.prose .op-list li { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px 16px; justify-content: space-between; align-items: baseline; }
.op-list li:last-child { border-bottom: 0; }
.op-list code { border: 0; background: none; padding: 0; color: var(--muted); }
.api-cards { display: grid; gap: 24px; }
.prose a.card { display: block; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); text-decoration: none; }
.card:hover { border-color: var(--muted); }
.card h2 { margin: 0 0 8px; font-size: 22px; }
.card p { margin: 0 0 8px; color: var(--text-2); }
.card p:last-child { margin: 0; font-size: 14.5px; }

/* ----- Try it ----- */
.aside { padding-left: 0; }
[data-section="docs"] .aside { padding-top: 56px; }
.panel { padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.panel-title { font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }
.panel-subtitle { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }
.panel .code-block { margin: 0; }
.panel pre.shiki { box-shadow: none; background: var(--bg) !important; font-size: 13px; max-height: 360px; padding: 12px 14px; }
[data-theme="dark"] .panel pre.shiki { background: rgba(0, 0, 0, .25) !important; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 14.5px; font-weight: 500; margin-bottom: 4px; }
.field input, .field textarea { font-size: 14px; background: var(--bg); }
[data-theme="dark"] .field input, [data-theme="dark"] .field textarea { background: rgba(0, 0, 0, .25); }
.field input, .field textarea { font-family: var(--mono); }
.field textarea { resize: vertical; line-height: 1.5; display: block; }
.field-hint { margin: 4px 0 0; font-size: 13.5px; line-height: 1.35; color: var(--muted); }
.lang-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.lang-tabs button { border: 0; background: none; padding: 2px 10px; border-radius: 100px; font-size: 14px; color: var(--muted); }
.lang-tabs button:hover { color: var(--text); }
.lang-tabs button[aria-selected="true"] { color: var(--button-text); background: var(--button-bg); }
.primary-button { width: 100%; margin-top: 16px; padding: 10px 16px; border: 0; border-radius: 100px; background: var(--button-bg); color: var(--button-text); font-weight: 500; }
.primary-button:disabled { opacity: .6; cursor: progress; }
.try-it-status { margin: 12px 0 0; font-size: 14.5px; color: var(--muted); }
.try-it-status:empty { display: none; }
.try-it-status[data-state="error"] { color: var(--text); padding-left: 12px; border-left: 3px solid var(--flag); }
.try-it-response .response-head { margin-bottom: 8px; }

/* ----- Search ----- */
.search-dialog { width: min(680px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 96px)); margin-top: 72px; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--text); box-shadow: 0 24px 64px rgba(25, 25, 25, .25); overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: var(--backdrop); }
.search-box { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-box input { border: 0; background: none; padding: 8px 0; font-size: 18px; outline: none; }
.search-results { overflow-y: auto; padding: 8px; }
.search-results:empty { display: none; }
.search-result { display: block; padding: 10px 12px; border-radius: 10px; text-decoration: none; }
.search-result:hover, .search-result.active { background: var(--tint); }
.search-sub { margin-left: 20px; }
.search-title { display: flex; align-items: baseline; gap: 12px; font-weight: 600; }
.search-sub .search-title { font-weight: 500; }
.search-section { font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.search-excerpt { display: block; font-size: 14.5px; color: var(--text-2); }
mark { background: var(--tint); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-message { padding: 16px 12px; margin: 0; }

/* ----- Narrow screens ----- */
@media (max-width: 1180px) {
  .layout, [data-section="reference"] .layout { grid-template-columns: 264px minmax(0, 1fr); }
  .aside { position: static; max-height: none; grid-column: 2; padding: 0 48px 64px; }
  [data-section="docs"] .aside { display: none; }
  .aside .panel { max-width: 780px; margin: 0 auto; }
  main { padding-bottom: 48px; }
}
@media (max-width: 820px) {
  body { font-size: 16px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .menu-button { display: grid; }
  .tabs { gap: 16px; font-size: 15px; margin-left: 8px; }
  .search-button { min-width: 0; width: 40px; padding: 0; justify-content: center; border: 0; background: none; color: var(--text); }
  .search-button span, .search-button kbd { display: none; }
  .layout, [data-section="reference"] .layout, .no-aside .layout { display: block; }
  .sidebar { display: none; position: fixed; inset: var(--topbar) 0 0 0; z-index: 15; max-height: none; background: var(--bg); border: 0; padding: 16px; }
  .menu-open .sidebar { display: block; }
  .menu-open { overflow: hidden; }
  main { padding: 32px 16px 48px; }
  .aside { padding: 0 16px 48px; }
  h1 { font-size: 32px; }
  .anchor { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: 1; }
}
@media (max-width: 480px) {
  .brand img { height: 22px; }
  .tabs { gap: 12px; font-size: 14px; margin-left: 4px; }
  .icon-button, .search-button { width: 36px; }
}
@media print {
  .topbar, .sidebar, .aside, .page-actions, .page-foot, .copy-code { display: none; }
  .layout { display: block; }
}
