/* Likeli docs: GitBook-style documentation layout. */

/* Dark is the default, as on GitBook-hosted protocol docs; light is opt-in. */
:root {
  --bg: #1d1d1d;
  --bg-soft: #262626;
  --header-bg: rgba(29, 29, 29, 0.88);
  --text: #fefefe;
  --text-2: #ececec;
  --muted: rgba(255, 255, 255, 0.62);
  --border: rgba(255, 255, 255, 0.1);
  --accent: #ff7b80;
  --accent-bg: rgba(255, 123, 128, 0.1);
  --note-bg: rgba(96, 165, 250, 0.1);
  --note-border: rgba(96, 165, 250, 0.3);
  --note-icon: #7fb4ff;
  --warn-bg: rgba(250, 204, 21, 0.09);
  --warn-border: rgba(250, 204, 21, 0.3);
  --warn-icon: #f5c542;
  --green: #5fd38a;
  --red: #ff7b80;
  --code-bg: rgba(255, 255, 255, 0.08);
  --topbar-h: 64px;
  --tabs-h: 44px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f5f5f5;
  --header-bg: rgba(255, 255, 255, 0.9);
  --text: #171717;
  --text-2: #262626;
  --muted: rgba(0, 0, 0, 0.58);
  --border: rgba(0, 0, 0, 0.1);
  --accent: #d6313a;
  --accent-bg: rgba(214, 49, 58, 0.08);
  --note-bg: #eef5ff;
  --note-border: #c7dcfb;
  --note-icon: #2f6fd6;
  --warn-bg: #fff8e6;
  --warn-border: #f3dca0;
  --warn-icon: #b7860b;
  --green: #1a7f37;
  --red: #c4262e;
  --code-bg: #f1f1f1;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: calc(var(--topbar-h) + var(--tabs-h) + 20px); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.625;
  color: var(--text-2);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* Header: brand and search, then a row of tabs */
.header {
  position: sticky; top: 0; z-index: 30;
  background: var(--header-bg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar, .tabs { max-width: 1440px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; }
.topbar { height: var(--topbar-h); gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand svg { width: 22px; height: 22px; display: block; }
.brand-name { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.topbar-spacer { flex: 1; }
.search-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 176px; height: 40px; padding: 0 8px 0 12px;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--muted); font-size: 14px;
}
.search-trigger:hover { border-color: var(--muted); }
.search-trigger .kbd { margin-left: auto; }
.kbd {
  font-family: var(--font); font-size: 11px; line-height: 1;
  padding: 3px 5px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted);
}
.theme-toggle {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: 10px; color: var(--muted);
}
.theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.menu-toggle { display: none; width: 36px; height: 36px; place-items: center; color: var(--text); }

.tabs { height: var(--tabs-h); gap: 28px; font-size: 14px; }
.tab { height: 100%; display: flex; align-items: center; gap: 5px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tab svg { width: 12px; height: 12px; }

/* Layout */
.shell { display: flex; max-width: 1440px; margin: 0 auto; }
.sidebar {
  position: sticky; top: calc(var(--topbar-h) + var(--tabs-h));
  width: 300px; flex-shrink: 0;
  height: calc(100vh - var(--topbar-h) - var(--tabs-h));
  overflow-y: auto;
  padding: 28px 16px 40px 24px;
}
.nav-group { margin-bottom: 20px; }
.nav-group-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text); padding: 0 10px; margin-bottom: 6px;
}
.nav-item {
  display: block; padding: 6px 10px; border-radius: 6px;
  font-size: 14px; line-height: 1.45; color: var(--muted);
}
.nav-item:hover { color: var(--text); background: var(--bg-soft); }
.nav-item.active { color: var(--accent); font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; gap: 48px; padding: 28px 24px 80px 56px; }
article { flex: 1; max-width: 768px; min-width: 0; }

/* Article typography */
.crumb { font-size: 12px; font-weight: 500; color: var(--accent); margin: 6px 0 10px; }
article h1 { font-size: 36px; line-height: 1.25; font-weight: 700; color: var(--text); margin-bottom: 14px; letter-spacing: -0.02em; }
.lede { font-size: 18px; line-height: 1.55; color: var(--text-2); margin-bottom: 36px; }
article h2 { font-size: 24px; line-height: 1.3; font-weight: 700; color: var(--text); margin: 44px 0 14px; letter-spacing: -0.01em; }
article h3 { font-size: 18px; font-weight: 600; color: var(--text); margin: 30px 0 10px; }
article p { margin-bottom: 18px; }
article strong { color: var(--text); font-weight: 600; }
article a.link, article p a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
article a.link:hover, article p a:hover { text-decoration-color: var(--accent); }
article ul, article ol { margin: 0 0 18px; padding-left: 24px; }
article li { margin-bottom: 8px; padding-left: 4px; }
article li::marker { color: var(--muted); }
code { font-family: var(--mono); font-size: 0.875em; background: var(--code-bg); padding: 2px 6px; border-radius: 5px; }

/* Hints, with an icon like GitBook's info and warning blocks */
.hint {
  position: relative; margin: 24px 0; padding: 14px 16px 14px 46px;
  background: var(--note-bg); border: 1px solid var(--note-border); border-radius: 10px;
}
.hint::before {
  content: ""; position: absolute; left: 16px; top: 17px; width: 18px; height: 18px;
  background: var(--note-icon);
  -webkit-mask: var(--hint-icon) center / contain no-repeat; mask: var(--hint-icon) center / contain no-repeat;
  --hint-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
}
.hint p { margin-bottom: 0; }
.hint.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.hint.warn::before {
  background: var(--warn-icon);
  --hint-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 20h20L12 3z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E");
}

/* Tables */
.table-wrap { margin: 24px 0 28px; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-weight: 600; color: var(--text); padding: 12px 16px; border-bottom: 1px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.yes { color: var(--green); }
.no { color: var(--red); }

/* FAQ, styled like GitBook expandable blocks */
.faq { margin: 8px 0 28px; display: grid; gap: 8px; }
.faq-item { border: 1px solid var(--border); border-radius: 10px; }
.faq-q {
  width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 16px; font-size: 16px; font-weight: 500; color: var(--text);
}
.faq-mark { color: var(--muted); font-size: 18px; transition: transform 0.15s ease; }
.faq-item.open .faq-mark { transform: rotate(45deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.2s ease; }
.faq-a-inner { padding: 0 16px 16px; }
.faq-a-inner p:last-child { margin-bottom: 0; }

/* Previous / next cards */
.pagenav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 64px; }
.pagenav a {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border: 1px solid var(--border); border-radius: 10px;
}
.pagenav a:hover { border-color: var(--accent); }
.pagenav a:hover .arrow, .pagenav a:hover .t { color: var(--accent); }
.pagenav .label { flex: 1; min-width: 0; }
.pagenav .dir { font-size: 13px; color: var(--muted); }
.pagenav .t { font-size: 16px; font-weight: 500; color: var(--text); }
.pagenav .arrow { color: var(--muted); flex-shrink: 0; }
.pagenav .next { text-align: right; grid-column: 2; }
.page-meta { margin-top: 28px; font-size: 13px; color: var(--muted); }

/* On this page */
.toc {
  position: sticky; top: calc(var(--topbar-h) + var(--tabs-h) + 32px); align-self: flex-start;
  width: 224px; flex-shrink: 0; font-size: 14px;
}
.toc-label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--text); margin-bottom: 10px; }
.toc a { display: block; padding: 5px 0 5px 14px; color: var(--muted); border-left: 1px solid var(--border); line-height: 1.4; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* Footer */
.site-footer {
  display: flex; gap: 20px; align-items: center;
  max-width: 1440px; margin: 0 auto; padding: 24px 24px 32px 356px;
  font-size: 13px; color: var(--muted);
}
.site-footer a:hover { color: var(--text); }
.site-footer .sp { flex: 1; }

/* Search */
.search-overlay {
  position: fixed; inset: 0; z-index: 50; display: none;
  justify-content: center; align-items: flex-start; padding: 12vh 16px 16px;
  background: rgba(0, 0, 0, 0.5);
}
.search-overlay.open { display: flex; }
.search-box {
  width: 100%; max-width: 600px; max-height: 70vh; display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); overflow: hidden;
}
.search-box input {
  width: 100%; padding: 16px 18px; font: inherit; font-size: 16px;
  color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--border); outline: none;
}
.search-box input::placeholder { color: var(--muted); }
.search-results { overflow-y: auto; padding: 8px; }
.search-result { display: block; padding: 10px 12px; border-radius: 8px; }
.search-result.sel, .search-result:hover { background: var(--bg-soft); }
.sr-title { font-size: 15px; font-weight: 500; color: var(--text); }
.sr-title mark { background: none; color: var(--accent); }
.sr-crumb { font-size: 13px; color: var(--muted); }
.search-empty { padding: 16px 12px; font-size: 14px; color: var(--muted); }

/* Responsive */
@media (max-width: 1200px) { .toc { display: none; } }
@media (max-width: 900px) {
  .menu-toggle { display: grid; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .search-trigger .label, .search-trigger .kbd { display: none; }
  .sidebar {
    position: fixed; top: calc(var(--topbar-h) + var(--tabs-h)); left: 0; bottom: 0; z-index: 25;
    height: auto; width: 280px; background: var(--bg); transform: translateX(-100%); transition: transform 0.2s ease;
    border-right: 1px solid var(--border);
  }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45); }
  .main { padding: 24px 16px 64px; }
  .site-footer { padding: 20px 16px 28px; }
  article h1 { font-size: 30px; }
}
@media (max-width: 520px) {
  .topbar, .tabs { padding: 0 12px; }
  .topbar { gap: 8px; }
  .brand-name { font-size: 16px; }
  .tabs { gap: 20px; }
  .pagenav { grid-template-columns: 1fr; }
  .pagenav .next { grid-column: 1; }
}
.search-trigger .kbd + .kbd { margin-left: 2px; }

