/* ============================================================
   Arcane Public API — documentation
   ============================================================ */

:root {
  --bg: #0d0c0b;
  --bg-soft: #100f0e;
  --surface: #141312;
  --surface-2: #191817;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e5e4e2;
  --text-dim: #a3a29f;
  --muted: #6e6d6b;
  --accent: #4f98a3;
  --accent-dim: rgba(79, 152, 163, 0.12);
  --accent-soft: rgba(79, 152, 163, 0.28);
  --green: #6daa45;
  --amber: #d9a84f;
  --red: #d9594f;
  --violet: #9b6dd6;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sidebar: 292px;
  --toc: 232px;
  --header: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 24px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(ellipse 900px 500px at 18% -10%, rgba(79, 152, 163, 0.10), transparent 65%);
  background-repeat: no-repeat;
}

::selection { background: var(--accent-soft); color: #fff; }

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

/* ---------- header ---------- */

header.top {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: rgba(13, 12, 11, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
  flex: none;
}

.brand .sep { color: var(--muted); font-weight: 400; }
.brand .sub { color: var(--text-dim); font-weight: 500; font-size: 13.5px; }

.top-spacer { flex: 1; }

.search-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 260px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.search-btn:hover { border-color: var(--border-strong); color: var(--text-dim); }

.kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
}

.menu-btn {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
}

.version-pill {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid var(--accent-soft);
  background: var(--accent-dim);
  color: var(--accent);
  white-space: nowrap;
}

/* ---------- layout ---------- */

.layout {
  display: flex;
  padding-top: var(--header);
  min-height: 100vh;
}

aside.sidebar {
  position: fixed;
  top: var(--header);
  bottom: 0;
  left: 0;
  width: var(--sidebar);
  overflow-y: auto;
  padding: 26px 16px 60px;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  z-index: 90;
}

aside.sidebar::-webkit-scrollbar { width: 8px; }
aside.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 8px; }

.nav-group { margin-bottom: 26px; }

.nav-group > .label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 9px;
}

aside.sidebar a.nav-link {
  display: block;
  padding: 6.5px 10px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.45;
  border-left: 2px solid transparent;
  transition: background .13s, color .13s;
}
aside.sidebar a.nav-link:hover { background: rgba(255,255,255,.035); color: var(--text); text-decoration: none; }
aside.sidebar a.nav-link.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
aside.sidebar a.nav-link .tag {
  float: right;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  padding-top: 3px;
}

main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar);
  padding: 44px 56px 120px;
  max-width: calc(100% - var(--sidebar));
}

main .wrap {
  max-width: 860px;
  margin: 0 auto;
}

/* ---------- typography ---------- */

.crumb {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 14px;
  font-family: var(--mono);
}
.crumb .s { padding: 0 7px; opacity: .5; }

h1 {
  font-size: 36px;
  line-height: 1.18;
  letter-spacing: -0.032em;
  font-weight: 700;
  margin: 0 0 14px;
}

h2 {
  font-size: 24px;
  letter-spacing: -0.022em;
  font-weight: 650;
  margin: 54px 0 16px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 17.5px;
  letter-spacing: -0.012em;
  font-weight: 650;
  margin: 34px 0 12px;
}

h4 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 26px 0 10px;
}

p { margin: 0 0 16px; color: var(--text-dim); }
p strong, li strong { color: var(--text); font-weight: 600; }

ul, ol { margin: 0 0 16px; padding-left: 22px; color: var(--text-dim); }
li { margin-bottom: 7px; }
li > code, p > code, td > code, th > code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1.5px 5.5px;
  color: #c9c7c4;
  white-space: nowrap;
}

hr { border: 0; border-top: 1px solid var(--border); margin: 34px 0; }

.lead {
  font-size: 17px;
  color: var(--text-dim);
  margin-bottom: 26px;
  line-height: 1.65;
}

/* ---------- code ---------- */

pre {
  position: relative;
  margin: 0 0 20px;
  padding: 16px 18px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: #0a0908;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.65;
}
pre code {
  font-family: var(--mono);
  color: #cfcdc9;
  white-space: pre;
  background: none;
  border: 0;
  padding: 0;
}
pre .cm { color: #5c5b59; font-style: italic; }
pre .st { color: #8fbf7f; }
pre .ky { color: #7fb4d6; }
pre .nm { color: #d9a84f; }
pre .fn { color: #b491d8; }

.copy {
  position: absolute;
  top: 8px; right: 8px;
  padding: 5px 9px;
  font-family: var(--sans);
  font-size: 11.5px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s;
}
pre:hover .copy { opacity: 1; }
.copy:hover { color: var(--accent); border-color: var(--accent-soft); }
.copy.done { color: var(--green); border-color: rgba(109,170,69,.4); }

/* ---------- tables ---------- */

.table-scroll { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--border); border-radius: 11px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--surface);
}
th {
  text-align: left;
  padding: 11px 15px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 15px;
  border-bottom: 1px solid rgba(255,255,255,.045);
  color: var(--text-dim);
  vertical-align: top;
}
tr:last-child td { border-bottom: 0; }
td:first-child { white-space: nowrap; }

.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------- badges ---------- */

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 2.5px 7px;
  border-radius: 5px;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}
.b-get    { background: rgba(109,170,69,.14);  color: #86c45f; border: 1px solid rgba(109,170,69,.3); }
.b-post   { background: rgba(79,152,163,.14);  color: #6cb6c2; border: 1px solid rgba(79,152,163,.3); }
.b-del    { background: rgba(217,89,79,.13);   color: #e0746b; border: 1px solid rgba(217,89,79,.3); }
.b-patch  { background: rgba(217,168,79,.13);  color: #e0bb6f; border: 1px solid rgba(217,168,79,.3); }
.b-auth   { background: rgba(155,109,214,.14); color: #b491d8; border: 1px solid rgba(155,109,214,.3); }
.b-pub    { background: rgba(255,255,255,.06); color: #a3a29f; border: 1px solid var(--border); }

.method-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--text);
  flex-wrap: wrap;
}
.method-row .desc { font-family: var(--sans); font-size: 13px; color: var(--muted); }

/* ---------- callouts ---------- */

.note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--text-dim);
}
.note .ico { flex: none; font-size: 15px; line-height: 1.5; }
.note p:last-child { margin-bottom: 0; }
.note.warn { border-left-color: var(--amber); }
.note.bad  { border-left-color: var(--red); }
.note.ok   { border-left-color: var(--green); }
.note strong { color: var(--text); }

/* ---------- cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 14px;
  margin: 0 0 26px;
}
.card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color .16s, transform .16s;
  display: block;
}
.card:hover { border-color: var(--accent-soft); text-decoration: none; transform: translateY(-1px); }
.card .t { font-weight: 650; font-size: 14.5px; color: var(--text); margin-bottom: 5px; }
.card .d { font-size: 13px; color: var(--muted); line-height: 1.55; }
.card .i { font-size: 17px; margin-bottom: 9px; display: block; }

/* ---------- prev/next ---------- */

.pager {
  display: flex;
  gap: 14px;
  margin-top: 70px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}
.pager a {
  flex: 1;
  padding: 15px 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color .15s;
}
.pager a:hover { border-color: var(--accent-soft); text-decoration: none; }
.pager .dir { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 4px; }
.pager .name { font-weight: 600; color: var(--text); font-size: 14.5px; }
.pager .next { text-align: right; }

/* ---------- footer ---------- */

footer.doc-foot {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- search modal ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: none;
  padding: 12vh 18px 18px;
}
.overlay.open { display: block; }

.search-panel {
  max-width: 620px;
  margin: 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: 0 24px 70px rgba(0,0,0,.65);
  overflow: hidden;
}
.search-panel input {
  width: 100%;
  padding: 17px 20px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  outline: none;
}
.search-panel input::placeholder { color: var(--muted); }
.search-results { max-height: 54vh; overflow-y: auto; padding: 8px; }
.sr {
  display: block;
  padding: 11px 13px;
  border-radius: 8px;
  color: var(--text-dim);
}
.sr:hover, .sr.sel { background: var(--accent-dim); text-decoration: none; }
.sr .g { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.sr .n { font-weight: 600; color: var(--text); font-size: 14px; }
.sr .x { font-size: 12.5px; color: var(--muted); }
.search-empty { padding: 26px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  main { padding: 36px 34px 100px; }
}

@media (max-width: 900px) {
  :root { --sidebar: 280px; }
  aside.sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.6);
  }
  body.nav-open aside.sidebar { transform: translateX(0); }
  main { margin-left: 0; max-width: 100%; padding: 28px 20px 90px; }
  .menu-btn { display: flex; }
  .search-btn { min-width: 0; flex: 1; max-width: 220px; }
  .search-btn .kbd { display: none; }
  h1 { font-size: 29px; }
  h2 { font-size: 21px; }
  .version-pill { display: none; }
}

@media (max-width: 560px) {
  .brand .sub, .brand .sep { display: none; }
  .search-btn span.placeholder { display: none; }
  .pager { flex-direction: column; }
  .pager .next { text-align: left; }
}
