/* Obento docs: the app's paper, ink and lacquer, set for reading. Tokens follow src/theme.ts. */
@font-face { font-family: Rethink; font-weight: 400; font-display: swap; src: url(/docs/fonts/RethinkSans_400Regular.ttf) format('truetype'); }
@font-face { font-family: Rethink; font-weight: 600; font-display: swap; src: url(/docs/fonts/RethinkSans_600SemiBold.ttf) format('truetype'); }
@font-face { font-family: Rethink; font-weight: 700; font-display: swap; src: url(/docs/fonts/RethinkSans_700Bold.ttf) format('truetype'); }

:root {
  --paper: #FFFFFF;
  --ink: #0C0C0B;
  --body: #3F3F3B;
  --muted: #6E6E69;
  --soft: #8F8F8A;
  --line: rgba(12, 12, 11, 0.08);
  --line-strong: rgba(12, 12, 11, 0.16);
  --well: #F4F4F2;
  --lacquer: #121211;
  --vermilion: #C8402E;
  --rim: rgba(200, 64, 46, 0.5);
  --rice: #F4F2EC;
  --top: 60px;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 24px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font: 400 16.5px/1.7 Rethink, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
::selection { background: rgba(200, 64, 46, 0.18); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; cursor: pointer; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 30; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 10px; text-decoration: none; }
.skip:focus { top: 10px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: var(--top); padding: 0 20px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand svg { display: block; }
.brand .word { font-weight: 700; font-size: 21px; letter-spacing: -0.6px; }
.brand .label { font-weight: 600; font-size: 15px; color: var(--muted); padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--line-strong); line-height: 18px; }
.search {
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 10px 0 12px; min-width: 220px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); color: var(--muted);
  font-size: 15px; text-align: left;
}
.search:hover { border-color: var(--ink); color: var(--ink); }
.search .hint { flex: 1; }
.search kbd { font: 600 12px/1 var(--mono); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 6px; }
.open {
  display: inline-flex; align-items: center; height: 38px; padding: 0 16px;
  border-radius: 999px; background: var(--ink); color: var(--paper);
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.open:hover { background: #2A2A28; }
.menu { display: none; width: 38px; height: 38px; border: 0; background: none; padding: 0; margin-left: -8px; }
.menu span, .menu span::before, .menu span::after { display: block; width: 18px; height: 1.6px; background: var(--ink); border-radius: 2px; margin: 0 auto; position: relative; transition: transform 160ms ease; }
.menu span::before, .menu span::after { content: ''; position: absolute; left: 0; }
.menu span::before { top: -6px; }
.menu span::after { top: 6px; }
.menu[aria-expanded="true"] span { background: transparent; }
.menu[aria-expanded="true"] span::before { transform: translateY(6px) rotate(45deg); }
.menu[aria-expanded="true"] span::after { transform: translateY(-6px) rotate(-45deg); }

/* Three columns: the sidebar, the page and its contents */
.layout {
  display: grid;
  grid-template-columns: 244px minmax(0, 720px) 200px;
  justify-content: center;
  gap: 56px;
  max-width: 1320px; margin: 0 auto; padding: 0 28px;
}
.side { position: sticky; top: var(--top); align-self: start; height: calc(100vh - var(--top)); overflow-y: auto; padding: 32px 4px 40px 0; }
.group + .group { margin-top: 22px; }
.group p { margin: 0 0 6px 12px; font-weight: 600; font-size: 13px; color: var(--soft); }
.group ul { list-style: none; margin: 0; padding: 0; }
.group a {
  position: relative; display: block; padding: 6px 12px; border-radius: 10px;
  color: var(--body); text-decoration: none; font-size: 15px; line-height: 1.45;
}
.group a:hover { background: var(--well); color: var(--ink); }
.group a[aria-current="page"] { background: var(--well); color: var(--ink); font-weight: 600; }
.group a[aria-current="page"]::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--vermilion); }

main { padding: 40px 0 72px; min-width: 0; }
article { position: relative; }

/* Type */
h1, h2, h3 { color: var(--ink); font-weight: 700; text-wrap: balance; }
h1 { font-size: 44px; line-height: 1.04; letter-spacing: -1.6px; margin: 0 0 18px; padding-right: 168px; }
h1 + p { font-size: 19px; line-height: 1.6; color: var(--body); }
h2 { position: relative; font-size: 26px; line-height: 1.2; letter-spacing: -0.6px; margin: 52px 0 12px; }
h3 { position: relative; font-size: 19px; line-height: 1.3; letter-spacing: -0.2px; font-weight: 600; margin: 32px 0 8px; }
.anchor { position: absolute; left: -22px; top: 0; bottom: 0; width: 22px; opacity: 0; text-decoration: none; color: var(--soft); }
.anchor::before { content: '#'; font-weight: 600; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
p, ul, ol { margin: 0 0 16px; max-width: 68ch; }
li { margin: 0 0 6px; padding-left: 2px; }
li::marker { color: var(--soft); }
strong { color: var(--ink); font-weight: 600; }
article a, .foot a { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(12, 12, 11, 0.25); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
article a:hover, .foot a:hover { text-decoration-color: var(--vermilion); }
code { font: 500 0.88em/1.4 var(--mono); background: var(--well); color: var(--ink); padding: 2px 6px; border-radius: 6px; }

/* Code sits in the lacquer box, with its vermilion rim */
.code {
  position: relative; margin: 20px 0 24px; padding: 18px 20px;
  background: var(--lacquer); border-radius: 20px;
  outline: 1px solid var(--rim); outline-offset: -4px;
  box-shadow: 0 30px 40px -32px rgba(12, 12, 11, 0.5), 0 2px 6px rgba(12, 12, 11, 0.06);
}
.code pre { margin: 0; overflow-x: auto; }
.code code { background: none; padding: 0; color: var(--rice); font-size: 13.5px; line-height: 1.65; }
.code .copy { position: absolute; top: 12px; right: 12px; }
.copy, .copy-page {
  height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line-strong); background: var(--paper); color: var(--body);
}
.copy-page:hover { border-color: var(--ink); color: var(--ink); }
.code .copy { background: transparent; color: var(--rice); border-color: rgba(244, 242, 236, 0.22); }
.code .copy:hover { border-color: var(--rice); }
.page-tools { position: absolute; top: 8px; right: 0; }

/* Tables scroll on their own, never the page */
.table { margin: 18px 0 26px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.55; }
th { text-align: left; font-weight: 600; color: var(--ink); padding: 0 16px 10px 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td:first-child { color: var(--ink); font-weight: 600; min-width: 120px; }
td:first-child:has(br) { font-weight: 400; color: var(--body); }
tbody tr:last-child td { border-bottom: 0; }
.addr { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.addr code { font-size: 12.5px; }
.addr .copy { height: 24px; padding: 0 9px; font-size: 12px; }
td strong { display: inline-block; margin-bottom: 2px; }

/* The live box: the vault's rate beside the places it lends to, sized by share */
.live:empty { display: none; }
.box {
  display: flex; gap: 6px; margin: 26px 0 34px; padding: 7px; min-height: 196px;
  background: var(--lacquer); border-radius: 26px;
  outline: 1px solid var(--rim); outline-offset: -4px;
  box-shadow: 0 30px 40px -28px rgba(12, 12, 11, 0.5), 0 2px 6px rgba(12, 12, 11, 0.06);
}
.cell { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; padding: 16px; border-radius: 19px; overflow: hidden; }
.places .cell { min-width: 132px; }
.places .cell div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell.rate { flex: 0 0 34%; background: var(--paper); }
.cell.rate b { display: block; font-size: 44px; line-height: 1; letter-spacing: -1.6px; color: var(--vermilion); font-weight: 700; }
.cell.rate span, .cell .sub { font-size: 13.5px; line-height: 1.35; color: var(--muted); }
.places { flex: 1; display: flex; gap: 6px; min-width: 0; }
.cell .name { font-weight: 600; font-size: 15px; color: var(--ink); line-height: 1.25; }
.cell .sub { color: rgba(12, 12, 11, 0.58); }
.cell .pct { font-weight: 700; font-size: 26px; letter-spacing: -0.8px; color: var(--ink); line-height: 1; }
.cell .note { font-size: 12.5px; color: rgba(12, 12, 11, 0.58); margin-top: 4px; }
.live-foot { margin: -22px 0 30px; font-size: 13.5px; color: var(--soft); }
td .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: 0; }

/* Live status */
.status { margin: 22px 0 30px; padding: 18px 22px 6px; border: 1px solid var(--line-strong); border-radius: 20px; }
.status-head { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-weight: 600; color: var(--ink); font-size: 17px; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: #2F9E6B; box-shadow: 0 0 0 4px rgba(47, 158, 107, 0.15); }
.status.wait .dot { background: var(--vermilion); box-shadow: 0 0 0 4px rgba(200, 64, 46, 0.15); }
.status .table { margin: 8px 0 0; }

/* The journal */
.journal { list-style: none; margin: 22px 0 28px; padding: 0; max-width: none; border-top: 1px solid var(--line-strong); }
.journal li { display: grid; grid-template-columns: 128px 1fr auto; gap: 16px; align-items: baseline; margin: 0; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.journal time { color: var(--muted); font-size: 14px; }
.journal .what { color: var(--ink); }
.journal a { color: var(--muted); font-size: 14px; }
.journal-empty { margin: 22px 0 28px; padding: 18px 22px; border: 1px solid var(--line-strong); border-radius: 20px; color: var(--muted); }
@media (max-width: 900px) { .journal li { grid-template-columns: 1fr auto; } .journal time { grid-column: 1 / -1; } }

/* Previous and next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line-strong); border-radius: 16px; color: var(--ink); font-weight: 600; text-decoration: none; }
.pager a span { font-weight: 400; font-size: 13.5px; color: var(--muted); }
.pager a:hover { border-color: var(--ink); }
.pager .next { text-align: right; }
.foot { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.foot span { color: var(--ink); font-weight: 600; margin-right: auto; }

/* On this page */
.toc { position: sticky; top: var(--top); align-self: start; padding: 44px 0 0; font-size: 14px; }
.toc p { margin: 0 0 8px; font-weight: 600; font-size: 13px; color: var(--soft); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; padding: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); border-left-color: var(--ink); }

/* Search */
.finder { position: fixed; inset: 0; z-index: 40; background: rgba(12, 12, 11, 0.36); padding: 12vh 16px 16px; }
.finder-box { max-width: 620px; margin: 0 auto; background: var(--paper); border-radius: 20px; overflow: hidden; box-shadow: 0 30px 60px -20px rgba(12, 12, 11, 0.45); }
.finder input { width: 100%; height: 60px; padding: 0 22px; border: 0; border-bottom: 1px solid var(--line); font: 400 18px Rethink, sans-serif; color: var(--ink); outline: none; }
.results { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.results:empty { display: none; }
.results li { margin: 0; padding: 0; }
.results a { display: block; padding: 11px 16px; border-radius: 12px; text-decoration: none; }
.results a b { display: block; color: var(--ink); font-weight: 600; font-size: 15.5px; }
.results a span { display: block; color: var(--muted); font-size: 14px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results a[aria-selected="true"], .results a:hover { background: var(--well); }
.results .none { padding: 14px 16px; color: var(--muted); font-size: 15px; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 232px minmax(0, 720px); gap: 48px; }
  .toc { display: none; }
}
@media (max-width: 900px) {
  :root { --top: 56px; }
  .top { padding: 0 16px; gap: 8px; }
  .menu { display: block; }
  .search { min-width: 0; width: 38px; padding: 0; justify-content: center; border-color: transparent; }
  .search .hint, .search kbd { display: none; }
  .open { height: 34px; padding: 0 14px; font-size: 14px; }
  .brand .word { font-size: 20px; }
  .layout { display: block; padding: 0 16px; }
  .side { display: none; position: fixed; inset: var(--top) 0 0 0; z-index: 15; height: auto; padding: 18px 16px 40px; background: var(--paper); }
  .side.open { display: block; }
  main { padding-top: 28px; }
  h1 { font-size: 34px; letter-spacing: -1.1px; padding-right: 0; }
  h1 + p { font-size: 17.5px; }
  h2 { font-size: 23px; margin-top: 44px; }
  .anchor { display: none; }
  .page-tools { position: static; margin: 0 0 14px; }
  .box { flex-direction: column; min-height: 0; }
  .cell.rate { flex: none; }
  .places { min-height: 116px; }
  .places .cell { padding: 12px; min-width: 96px; }
  .cell .pct { font-size: 21px; }
  .places .sub, .note .long { display: none; }
  .addr { white-space: normal; flex-wrap: wrap; }
  .addr code { word-break: break-all; }
  .pager { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
