/* Arc CMS developer docs. One stylesheet for every page; no build step. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-code: #f1f3f6;
  --text: #1c2330;
  --text-soft: #536072;
  --line: #dfe3ea;
  --brand: #3b5bdb;
  --brand-soft: #e7ecff;
  --note: #1c7ed6;
  --note-bg: #e7f1fb;
  --warn: #d9480f;
  --warn-bg: #fdeee6;
  --trap: #862e9c;
  --trap-bg: #f5eafa;
  --good: #2b8a3e;
  --header-h: 3.5rem;
  --sidebar-w: 17rem;
  --toc-w: 14rem;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d;
    --bg-soft: #1a2029;
    --bg-code: #1d2430;
    --text: #e6e9ef;
    --text-soft: #a2adbd;
    --line: #2b3441;
    --brand: #8da2fb;
    --brand-soft: #232c4d;
    --note: #74b9ff;
    --note-bg: #16283a;
    --warn: #ff9f6b;
    --warn-bg: #3a2216;
    --trap: #d6a2e8;
    --trap-bg: #2e1f38;
    --good: #69db7c;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12161d;
  --bg-soft: #1a2029;
  --bg-code: #1d2430;
  --text: #e6e9ef;
  --text-soft: #a2adbd;
  --line: #2b3441;
  --brand: #8da2fb;
  --brand-soft: #232c4d;
  --note: #74b9ff;
  --note-bg: #16283a;
  --warn: #ff9f6b;
  --warn-bg: #3a2216;
  --trap: #d6a2e8;
  --trap-bg: #2e1f38;
  --good: #69db7c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- layout (built by docs.js around <main>) ---------- */

.arc-header {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.arc-brand { font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.arc-brand span { color: var(--brand); }
.arc-header .spacer { flex: 1; }
.arc-btn {
  font: inherit; font-size: .9rem; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .35rem .7rem; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem;
}
.arc-btn:hover { border-color: var(--brand); }
.arc-btn kbd {
  font: .75rem var(--mono); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; color: var(--text-soft); background: var(--bg);
}
.arc-menu-btn { display: none; }

.arc-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  max-width: 88rem; margin: 0 auto;
}
.arc-sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 1.25rem 1rem 3rem; border-right: 1px solid var(--line);
  font-size: .92rem;
}
.arc-sidebar details { margin-bottom: .35rem; }
.arc-sidebar summary {
  cursor: pointer; font-weight: 650; padding: .3rem .4rem; border-radius: 6px; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.arc-sidebar summary::-webkit-details-marker { display: none; }
.arc-sidebar summary::after { content: "+"; color: var(--text-soft); font-weight: 400; }
.arc-sidebar details[open] > summary::after { content: "\2212"; }
.arc-sidebar summary:hover { background: var(--bg-soft); }
.arc-sidebar ul { list-style: none; margin: .1rem 0 .5rem; padding: 0 0 0 .4rem; border-left: 1px solid var(--line); margin-left: .6rem; }
.arc-sidebar li a {
  display: block; padding: .22rem .6rem; color: var(--text-soft); text-decoration: none; border-radius: 6px;
}
.arc-sidebar li a:hover { color: var(--text); background: var(--bg-soft); }
.arc-sidebar li a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); font-weight: 600; }

main {
  min-width: 0; padding: 2rem 2.25rem 4rem; max-width: 50rem; width: 100%; margin: 0 auto;
}
.arc-toc {
  position: sticky; top: var(--header-h); align-self: start;
  max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 2rem 1rem 2rem .5rem; font-size: .85rem;
}
.arc-toc h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-soft); margin: 0 0 .5rem; border: 0; padding: 0; }
.arc-toc a { display: block; color: var(--text-soft); text-decoration: none; padding: .15rem 0 .15rem .6rem; border-left: 2px solid transparent; }
.arc-toc a:hover { color: var(--text); }
.arc-toc a.h3 { padding-left: 1.4rem; }
.arc-toc a.active { color: var(--brand); border-left-color: var(--brand); }

/* ---------- content ---------- */

main:not(.home) > h1:first-child, main h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 .5rem; }
main h2 { font-size: 1.45rem; line-height: 1.3; margin: 2.6rem 0 .75rem; padding-top: .4rem; border-top: 1px solid var(--line); }
main h3 { font-size: 1.15rem; margin: 1.8rem 0 .5rem; }
main h4 { font-size: 1rem; margin: 1.4rem 0 .4rem; }
main p, main li { overflow-wrap: anywhere; }
main .lead { font-size: 1.15rem; color: var(--text-soft); margin: 0 0 1.5rem; }
main .crumbs { font-size: .85rem; color: var(--text-soft); margin: 0 0 .75rem; }
main .crumbs a { color: var(--text-soft); }
main ul, main ol { padding-left: 1.4rem; }
main li { margin: .3rem 0; }
main li > p { margin: .3rem 0; }
main hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

code, kbd, samp { font-family: var(--mono); font-size: .88em; }
:not(pre) > code { background: var(--bg-code); border: 1px solid var(--line); border-radius: 5px; padding: .08em .35em; overflow-wrap: anywhere; }
pre {
  position: relative; background: var(--bg-code); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; overflow-x: auto; margin: 1rem 0; line-height: 1.5;
}
pre code { font-size: .86rem; }
pre .copy {
  position: absolute; top: .4rem; right: .4rem; font: .75rem var(--font); color: var(--text-soft);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .15rem .5rem; cursor: pointer; opacity: 0;
}
pre:hover .copy, pre .copy:focus-visible { opacity: 1; }
@media (hover: none) { pre .copy { opacity: 1; } }

.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; vertical-align: top; padding: .5rem .7rem; border: 1px solid var(--line); }
th { background: var(--bg-soft); font-weight: 650; }

.note, .warn, .trap {
  border-left: 4px solid; border-radius: 0 var(--radius) var(--radius) 0;
  padding: .7rem 1rem; margin: 1.2rem 0;
}
.note > :first-child, .warn > :first-child, .trap > :first-child { margin-top: 0; }
.note > :last-child, .warn > :last-child, .trap > :last-child { margin-bottom: 0; }
.note { background: var(--note-bg); border-color: var(--note); }
.warn { background: var(--warn-bg); border-color: var(--warn); }
.trap { background: var(--trap-bg); border-color: var(--trap); }
.note::before, .warn::before, .trap::before {
  display: block; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .2rem;
}
.note::before { content: "Note"; color: var(--note); }
.warn::before { content: "Careful"; color: var(--warn); }
.trap::before { content: "Trap"; color: var(--trap); }

.steps { counter-reset: step; list-style: none; padding-left: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; margin: 1.1rem 0; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: .05rem; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand); font-weight: 700; text-align: center; line-height: 1.9rem;
}

.pager { display: flex; gap: 1rem; justify-content: space-between; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.pager a {
  display: block; flex: 1; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; text-decoration: none; color: var(--text);
}
.pager a:hover { border-color: var(--brand); }
.pager small { display: block; color: var(--text-soft); }
.pager .next { text-align: right; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.card {
  display: block; border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; text-decoration: none; color: var(--text);
  background: var(--bg-soft);
}
.card:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.card strong { display: block; font-size: 1.05rem; color: var(--brand); margin-bottom: .25rem; }
.card span { color: var(--text-soft); font-size: .92rem; }
.card.soon { opacity: .75; cursor: default; }
.card.soon:hover { border-color: var(--line); box-shadow: none; }

main.home .hero { padding: 1.5rem 0 .5rem; }
main.home .hero h1 { font-size: 2.4rem; }

.tag { display: inline-block; font-size: .72rem; font-weight: 650; padding: .05rem .5rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand); vertical-align: middle; }

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

.arc-search {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 20, .55); display: none; align-items: flex-start; justify-content: center; padding: 8vh 1rem 1rem;
}
.arc-search.open { display: flex; }
.arc-search-box { width: 100%; max-width: 38rem; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); overflow: hidden; }
.arc-search input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text);
  font: inherit; font-size: 1.05rem; padding: .9rem 1rem; outline: none;
}
.arc-search ul { list-style: none; margin: 0; padding: .4rem; max-height: 55vh; overflow-y: auto; }
.arc-search li a { display: block; padding: .5rem .7rem; border-radius: 6px; text-decoration: none; color: var(--text); }
.arc-search li a[aria-selected="true"], .arc-search li a:hover { background: var(--brand-soft); }
.arc-search li small { display: block; color: var(--text-soft); }
.arc-search .empty { padding: 1rem; color: var(--text-soft); }

/* ---------- small screens ---------- */

@media (max-width: 1100px) {
  .arc-layout { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .arc-toc { display: none; }
}
@media (max-width: 800px) {
  .arc-layout { grid-template-columns: minmax(0, 1fr); }
  .arc-menu-btn { display: inline-flex; }
  .arc-sidebar {
    position: fixed; top: var(--header-h); left: 0; bottom: 0; width: min(20rem, 86vw); height: auto; z-index: 25;
    background: var(--bg); transform: translateX(-100%); transition: transform .18s ease; box-shadow: 0 0 30px rgba(0, 0, 0, .25);
  }
  body.menu-open .arc-sidebar { transform: none; }
  main { padding: 1.25rem 1rem 3rem; }
  main h1 { font-size: 1.65rem; }
  main.home .hero h1 { font-size: 1.9rem; }
  .arc-btn .label { display: none; }
  .pager { flex-direction: column; }
}

@media print {
  .arc-header, .arc-sidebar, .arc-toc, .pager, pre .copy { display: none !important; }
  .arc-layout { display: block; }
  main { max-width: none; padding: 0; }
}
