/* Facia Docs. Neutral surfaces, one accent, gold only for VIP (same rule as the app). */
:root {
  --bg: #ffffff;
  --panel: #f7f8fa;
  --surface: #ffffff;
  --border: #e6e8ec;
  --border-strong: #d4d8de;
  --text: #15171c;
  --text-2: #4a505c;
  --text-3: #7b8290;
  --accent: #3d6bff;
  --accent-soft: rgba(61, 107, 255, 0.09);
  --accent-text: #2a55e8;
  --code-bg: #f4f5f8;
  --success: #12875a;
  --warn: #b25e09;
  --danger: #c93a3a;
  --vip: #a87a12;
  --shadow: 0 10px 40px rgba(17, 20, 28, 0.12);
  --radius: 10px;
  --top: 60px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014;
    --panel: #13161b;
    --surface: #171a20;
    --border: #23272f;
    --border-strong: #30353f;
    --text: #e9ebef;
    --text-2: #b0b6c1;
    --text-3: #7f8693;
    --accent: #6f8fff;
    --accent-soft: rgba(111, 143, 255, 0.12);
    --accent-text: #8fa7ff;
    --code-bg: #161a20;
    --success: #3cc68a;
    --warn: #e0a24a;
    --danger: #f06b6b;
    --vip: #d9ae4a;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014;
  --panel: #13161b;
  --surface: #171a20;
  --border: #23272f;
  --border-strong: #30353f;
  --text: #e9ebef;
  --text-2: #b0b6c1;
  --text-3: #7f8693;
  --accent: #6f8fff;
  --accent-soft: rgba(111, 143, 255, 0.12);
  --accent-text: #8fa7ff;
  --code-bg: #161a20;
  --success: #3cc68a;
  --warn: #e0a24a;
  --danger: #f06b6b;
  --vip: #d9ae4a;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
kbd {
  font: 11px var(--mono);
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--text-3);
  background: var(--surface);
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* ---- top bar ---- */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 500; color: var(--text-3); }
.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 320px;
  margin-left: 24px;
  height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text-3);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.search-btn span { flex: 1; text-align: left; }
.search-btn:hover { border-color: var(--border-strong); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.top-link { color: var(--text-2); font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.top-link:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--panel); color: var(--text); }
.menu-btn { display: none; margin-left: -8px; }

/* ---- layout ---- */
.wrap { display: flex; max-width: 1440px; margin: 0 auto; }
.side {
  position: sticky;
  top: var(--top);
  flex: 0 0 272px;
  height: calc(100vh - var(--top));
  overflow-y: auto;
  padding: 24px 12px 48px 20px;
  border-right: 1px solid var(--border);
  overscroll-behavior: contain;
}
.nav-group { margin-bottom: 22px; }
.nav-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 0 10px 6px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.45;
}
.side li a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.side li a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 550; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; gap: 48px; padding: 40px 48px 96px; }
.doc { flex: 1; min-width: 0; max-width: 780px; }
.toc {
  position: sticky;
  top: calc(var(--top) + 40px);
  align-self: flex-start;
  flex: 0 0 220px;
  max-height: calc(100vh - var(--top) - 80px);
  overflow-y: auto;
  font-size: 13.5px;
}
.toc-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc li a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--text-3); line-height: 1.4; }
.toc li.d3 a { padding-left: 26px; }
.toc li a:hover { color: var(--text); text-decoration: none; }
.toc li a.on { color: var(--accent-text); border-left-color: var(--accent); }

/* ---- content ---- */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent-text); font-weight: 550; margin-bottom: 6px; }
.doc h1 { font-size: 34px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 12px; font-weight: 700; }
.doc h1 + p { font-size: 18px; color: var(--text-2); }
.doc h2 { font-size: 23px; letter-spacing: -0.01em; margin: 44px 0 10px; padding-top: 4px; font-weight: 650; }
.doc h3 { font-size: 18px; margin: 30px 0 6px; font-weight: 620; }
.doc h4 { font-size: 15.5px; margin: 22px 0 4px; }
.doc h2, .doc h3, .doc h4 { position: relative; }
.anchor { position: absolute; left: -22px; padding-right: 6px; color: var(--text-3); opacity: 0; font-weight: 400; }
.doc h2:hover .anchor, .doc h3:hover .anchor { opacity: 1; text-decoration: none; }
.doc p, .doc ul, .doc ol { margin: 0 0 16px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
.doc img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.doc strong { font-weight: 620; }
.doc :not(pre) > code {
  font: 0.86em var(--mono);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.doc blockquote { margin: 0 0 16px; padding: 2px 16px; border-left: 3px solid var(--border-strong); color: var(--text-2); }

.code { margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg); overflow: hidden; }
.code-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px; border-bottom: 1px solid var(--border); font: 12px var(--mono); color: var(--text-3); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13.5px/1.6 var(--mono); }
.copy, .tool {
  font: 12.5px var(--font);
  color: var(--text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
}
.copy:hover { background: var(--surface); border-color: var(--border); color: var(--text); }

.table { margin: 0 0 20px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.doc table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.doc th, .doc td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.doc th { background: var(--panel); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.doc tr:last-child td { border-bottom: 0; }

.callout { margin: 0 0 20px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; color: var(--text-2); }
.callout-tip { border-color: color-mix(in srgb, var(--success) 35%, var(--border)); }
.callout-tip .callout-title { color: var(--success); }
.callout-warning { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.callout-warning .callout-title { color: var(--warn); }
.callout-beta .callout-title, .callout-ai .callout-title { color: var(--accent-text); }
.callout-beta, .callout-ai { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: var(--accent-soft); }

.pill { display: inline-block; font-size: 10.5px; font-weight: 650; line-height: 1; letter-spacing: 0.02em; padding: 4px 6px; border-radius: 99px; background: var(--panel); color: var(--text-3); border: 1px solid var(--border); white-space: nowrap; }
.pill-beta { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.pill-soon { color: var(--warn); }
.side .pill { margin-left: auto; }

/* Cards on the home page: write a list of links in a <div class="cards"> block. */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0 0 24px; }
.cards a { display: block; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.cards a:hover { border-color: var(--accent); text-decoration: none; }
.cards a strong { display: block; margin-bottom: 4px; }
.cards a span { display: block; font-size: 14px; color: var(--text-2); line-height: 1.5; }

.page-tools { display: flex; gap: 8px; margin: 48px 0 0; padding-top: 20px; border-top: 1px solid var(--border); }
.tool { border-color: var(--border); padding: 6px 12px; font-size: 13px; }
.tool:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.pager a { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-weight: 550; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager a span { display: block; font-size: 12.5px; color: var(--text-3); font-weight: 400; }
.pager .next { text-align: right; grid-column: 2; }

/* ---- search ---- */
.search { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 16, 0.45); display: flex; justify-content: center; padding: 10vh 16px 16px; }
.search[hidden] { display: none; }
.search-box { width: 100%; max-width: 620px; max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.search-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.search-input input { flex: 1; height: 52px; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 16px; }
.search-input input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-results li a { display: block; padding: 10px 12px; border-radius: 9px; color: var(--text); }
.search-results li a:hover, .search-results li a.sel { background: var(--accent-soft); text-decoration: none; }
.search-results .r-title { font-weight: 600; font-size: 14.5px; }
.search-results .r-path { font-size: 12px; color: var(--text-3); }
.search-results .r-text { font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-results mark { background: transparent; color: var(--accent-text); font-weight: 600; }
.search-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 14px; }

/* ---- smaller screens ---- */
@media (max-width: 1180px) {
  .toc { display: none; }
}
@media (max-width: 900px) {
  :root { --top: 56px; }
  .top { padding: 0 12px; gap: 8px; }
  .menu-btn { display: inline-grid; }
  .search-btn { margin-left: auto; flex: 0 0 auto; width: 36px; padding: 0; justify-content: center; border: 0; background: transparent; }
  .search-btn span, .search-btn kbd, .top-link { display: none; }
  .top-right { margin-left: 0; }
  .side {
    position: fixed;
    z-index: 40;
    top: 0;
    left: 0;
    height: 100%;
    width: min(300px, 85vw);
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    padding-top: 20px;
  }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 16, 0.4); }
  .main { padding: 28px 16px 72px; }
  .doc h1 { font-size: 28px; }
  .doc h2 { font-size: 21px; }
  .anchor { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}

/* ---- screenshots (::shot in the Markdown) ---- */
.shot { margin: 8px 0 28px; }
.shot-imgs { display: flex; gap: 14px; justify-content: center; }
.shot-imgs a { display: block; flex: 1 1 0; min-width: 0; }
.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(17, 20, 28, 0.06), 0 8px 28px rgba(17, 20, 28, 0.08);
  background: var(--panel);
}
.shot-phone .shot-imgs a { flex: 0 1 260px; }
.shot-phone img { border-radius: 22px; }
.shot figcaption { margin-top: 10px; text-align: center; font-size: 13.5px; color: var(--text-3); }
@media (max-width: 600px) {
  .shot-row:not(.shot-phone) .shot-imgs { flex-direction: column; }
  .shot-phone .shot-imgs { gap: 8px; }
  .shot img { border-radius: 10px; }
  .shot-phone img { border-radius: 14px; }
}
