/* SmileCloud Public API docs — Stripe-inspired theme. */

:root {
  --accent: #2862b7;
  --accent-hover: #245d9f;
  --accent-soft: #eaf1fb;

  --bg: #ffffff;
  --bg-subtle: #f6f9fc;
  --bg-sidebar: #ffffff;
  --bg-code: #0b1020;
  --bg-code-header: #161b33;

  --text: #1a1f36;
  --text-muted: #5b6478;
  --text-faint: #8792a2;
  --border: #e6e9ee;
  --border-strong: #d5dbe3;

  --green: #1aae6f;
  --amber: #d97917;
  --red: #df1b41;
  --blue: #2563eb;

  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 272px;
  --toc-w: 232px;
  --topbar-h: 60px;
  --maxw: 768px;
  --mono: "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 4px 18px rgba(26, 31, 54, 0.08);
  --shadow-lg: 0 20px 60px rgba(26, 31, 54, 0.18);
}

[data-theme="dark"] {
  --accent: #3b81d2;
  --accent-hover: #5a98e0;
  --accent-soft: #122339;

  --bg: #0b0e17;
  --bg-subtle: #11151f;
  --bg-sidebar: #0b0e17;
  --bg-code: #05070d;
  --bg-code-header: #11151f;

  --text: #e8ebf2;
  --text-muted: #9aa3b5;
  --text-faint: #6b7488;
  --border: #1e2433;
  --border-strong: #2a3142;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  clip-path: none;
  inset-inline-start: 12px;
  top: 12px;
  z-index: 200;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--accent);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__text strong { font-size: 15px; letter-spacing: -0.01em; }
.brand__sub { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }

.topbar__spacer { flex: 1; }
.topbar__link { color: var(--text-muted); font-size: 14px; font-weight: 500; }
.topbar__link:hover { color: var(--text); text-decoration: none; }

.topbar__menu, .theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}
.topbar__menu { display: none; }
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 240px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-faint);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd, .search-modal kbd {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-faint);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--bg);
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1440px;
  margin: 0 auto;
}
.layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 28px 16px 24px 24px;
  border-right: 1px solid var(--border);
}

.nav__section { margin-bottom: 26px; }
.nav__section:last-child { margin-bottom: 0; }
.nav__heading {
  margin: 0 0 8px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}
.nav__list { list-style: none; margin: 0; padding: 0; }
.nav__link {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 450;
  line-height: 1.4;
}
.nav__link:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
.nav__link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-scrim { display: none; }

/* ---------- Content ---------- */
.content { min-width: 0; padding: 40px 56px 96px; }
.article { max-width: var(--maxw); margin: 0 auto; }

.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 18px;
}
.breadcrumb__sep { opacity: 0.6; }

.article h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  font-weight: 700;
}
.article h2 {
  font-size: 24px;
  letter-spacing: -0.01em;
  margin: 48px 0 16px;
  padding-top: 8px;
  font-weight: 650;
}
.article h3 {
  font-size: 18px;
  margin: 32px 0 12px;
  font-weight: 650;
}
.article h4 { font-size: 15px; margin: 24px 0 8px; font-weight: 650; }
.article p { margin: 0 0 16px; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 22px; }
.article li { margin: 6px 0; }
.article li::marker { color: var(--text-faint); }

.article hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

.article strong { font-weight: 650; color: var(--text); }

.heading { position: relative; }
.heading-anchor {
  position: absolute;
  left: -22px;
  color: var(--text-faint);
  opacity: 0;
  font-weight: 400;
  text-decoration: none;
}
.heading:hover .heading-anchor { opacity: 1; }

/* Inline code */
.article :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: #b5358d;
  white-space: nowrap;
}
[data-theme="dark"] .article :not(pre) > code { color: #ff8fd0; }

/* Lead paragraph */
.article > p:first-of-type, .lead {
  font-size: 18px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---------- Code blocks ---------- */
.code-block {
  margin: 0 0 20px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-code);
  box-shadow: var(--shadow);
}
.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-code-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.code-block__lang {
  font-family: var(--mono);
  font-size: 12px;
  color: #8b93b8;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.code-block__copy {
  font-size: 12px;
  font-family: var(--sans);
  color: #aeb6da;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.code-block__copy:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.code-block__copy.is-copied { color: #5ee6a8; border-color: rgba(94, 230, 168, 0.4); }

.code-block pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: #e6e9f5;
}
.code-block code { font-family: var(--mono); background: none; border: none; padding: 0; white-space: pre; }

/* Token colors */
.tok-key { color: #7fd3ff; }
.tok-str { color: #9ce29c; }
.tok-num { color: #f6b26b; }
.tok-bool { color: #c792ea; }
.tok-null { color: #c792ea; }
.tok-punc { color: #8b93b8; }
.tok-cmd { color: #7fd3ff; }
.tok-flag { color: #f6b26b; }
.tok-comment { color: #6b7488; font-style: italic; }
.tok-method { color: #c792ea; font-weight: 600; }
.tok-url { color: #9ce29c; }

/* Code group (tabs) */
.code-group { margin: 0 0 20px; }
.code-group .code-block { margin: 0; border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
.code-group__tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-code-header);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 6px 6px 0;
  overflow-x: auto;
}
.code-group__tab {
  font-family: var(--sans);
  font-size: 13px;
  color: #8b93b8;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.code-group__tab.is-active { color: #fff; border-bottom-color: var(--accent); }
.code-group .code-block { display: none; }
.code-group .code-block.is-active { display: block; }
.code-group .code-block__header { display: none; }
.code-group .code-block__copy-floating {
  position: absolute;
  top: 46px;
  right: 12px;
}
.code-group { position: relative; }

/* ---------- Callouts ---------- */
.callout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}
.callout__title { margin: 0; font-weight: 650; font-size: 14px; }
.callout__body { font-size: 14.5px; color: var(--text-muted); }
.callout__body > :last-child { margin-bottom: 0; }
.callout__body code { font-size: 0.85em; }
.callout--note .callout__title { color: var(--blue); }
.callout--info { background: var(--accent-soft); }
.callout--info .callout__title { color: var(--accent); }
.callout--success .callout__title { color: var(--green); }
.callout--warning .callout__title { color: var(--amber); }
.callout--danger .callout__title { color: var(--red); }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.card {
  display: block;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.card:hover {
  text-decoration: none;
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card__icon { font-size: 18px; }
.card__title { font-weight: 650; font-size: 15px; }
.card__body { font-size: 14px; color: var(--text-muted); }
.card__body > :last-child { margin-bottom: 0; }

/* ---------- Method badges ---------- */
.method {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 5px;
  vertical-align: middle;
  color: #fff;
}
.method--get { background: var(--green); }
.method--post { background: var(--blue); }
.method--delete { background: var(--red); }
.method--put, .method--patch { background: var(--amber); }

h2 .method, h3 .method { margin-right: 8px; }

/* ---------- Tables ---------- */
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 22px;
  font-size: 14px;
}
.article th {
  text-align: start;
  font-weight: 650;
  color: var(--text);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-strong);
  background: var(--bg-subtle);
}
.article td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article td code { white-space: nowrap; }
.article tr:last-child td { border-bottom: none; }

/* ---------- Pager ---------- */
.pager-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.pager {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 200px;
  max-width: 48%;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pager:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.pager--next { text-align: right; margin-left: auto; }
.pager__dir { font-size: 12px; color: var(--text-faint); }
.pager__title { font-weight: 600; color: var(--accent); }

/* ---------- TOC ---------- */
.toc-rail {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 44px 24px 60px 8px;
}
.no-toc .toc-rail { display: none; }
.toc__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin: 0 0 12px;
}
.toc__list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc__item a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.4;
}
.toc__item a:hover { color: var(--text); text-decoration: none; }
.toc__item--l3 a { padding-left: 26px; font-size: 12.5px; }
.toc__item a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 550; }

/* ---------- Search modal ---------- */
.search-modal { position: fixed; inset: 0; z-index: 120; }
.search-modal[hidden] { display: none; }
.search-modal__backdrop { position: absolute; inset: 0; background: rgba(10, 14, 23, 0.55); backdrop-filter: blur(2px); }
.search-modal__panel {
  position: relative;
  max-width: 600px;
  margin: 12vh auto 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-modal__input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
}
.search-modal__input input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
  font-family: var(--sans);
}
.search-modal__results { list-style: none; margin: 0; padding: 8px; max-height: 56vh; overflow-y: auto; }
.search-modal__results li { margin: 0; }
.search-result {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
}
.search-result:hover, .search-result.is-active { background: var(--accent-soft); text-decoration: none; }
.search-result__section { display: block; font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.search-result__title { display: block; font-weight: 600; font-size: 15px; }
.search-result__desc { display: block; font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.search-result mark { background: rgba(40, 98, 183, 0.22); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { padding: 24px; text-align: center; color: var(--text-faint); }

/* ---------- Hero (landing) ---------- */
.hero { margin: 8px 0 8px; }
.hero h1 { font-size: 40px; }
.hero__sub { font-size: 19px; color: var(--text-muted); max-width: 620px; }

/* ---------- Responsive ---------- */
/* ---------- Language switch ---------- */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-subtle);
}
.lang-switch__opt {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 550;
  color: var(--text-muted);
  background: transparent;
}
.lang-switch__opt:hover { color: var(--text); text-decoration: none; background: var(--bg); }
.lang-switch__opt.is-active { color: #fff; background: var(--accent); }
.lang-switch__opt.is-active:hover { background: var(--accent); color: #fff; }

/* ---------- RTL: keep code LTR, mirror the chrome ---------- */
.code-block pre, .code-block code, kbd, .method { direction: ltr; }
.code-block pre { text-align: left; }

[dir="rtl"] .sidebar { border-right: none; border-inline-end: 1px solid var(--border); }
[dir="rtl"] .heading-anchor { left: auto; right: -22px; }
[dir="rtl"] .toc__list { border-left: none; border-right: 1px solid var(--border); }
[dir="rtl"] .toc__item a { border-left: none; border-right: 2px solid transparent; padding-left: 0; padding-right: 14px; margin-left: 0; margin-right: -1px; }
[dir="rtl"] .toc__item--l3 a { padding-right: 26px; }
[dir="rtl"] .toc__item a.is-active { border-right-color: var(--accent); }
[dir="rtl"] .pager--next { text-align: left; margin-left: 0; margin-right: auto; }
[dir="rtl"] .code-group__copy-floating { right: auto; left: 12px; }

@media (max-width: 1180px) {
  .layout, .layout.no-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .toc-rail { display: none; }
  .content { padding: 36px 40px 80px; }
}

@media (max-width: 860px) {
  .topbar__menu { display: grid; }
  .search-trigger { width: auto; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .topbar__link { display: none; }
  .layout, .layout.no-toc { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    z-index: 80;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }
  [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(100%); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-scrim {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0;
    z-index: 70;
    background: rgba(10, 14, 23, 0.4);
  }
  .content { padding: 28px 20px 64px; }
  .article h1 { font-size: 28px; }
  .hero h1 { font-size: 32px; }
}
