:root {
  /* annotations must stand out from the app's own red, blue and orange */
  --annot: #ffcf33;
  --annot-ink: #17130a;
  --pin: 26px;
  --note: #3d7bf2;
  --tip: #2e9e5b;
  --warn: #f57e25;
}

/* layout */
.docs {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 56px;
  width: min(1240px, 100% - 32px);
  margin-inline: auto;
  padding: 40px 0 96px;
}

.docs-side {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  padding-right: 8px;
}
.side-title {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted);
}
.side-group + .side-group { margin-top: 22px; }
.side-group ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.side-group a {
  display: block;
  margin-left: -1px;
  padding: 6px 12px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.94rem;
}
.side-group a:hover { color: var(--text); }
.side-group a[aria-current='true'] { color: var(--text); border-left-color: var(--accent); background: linear-gradient(90deg, rgba(245, 126, 37, 0.1), transparent); }

.docs-main { min-width: 0; max-width: 860px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; font-size: 0.9rem; color: var(--muted); }
.crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }

/* mobile contents bar */
.docs-bar { display: none; }

/* typography */
.docs-main h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.docs-intro { margin: 14px 0 0; font-size: 1.12rem; color: var(--tagline); }
.doc-section { padding-top: 56px; }
.doc-section + .doc-section { margin-top: 8px; border-top: 1px solid var(--line); }
.doc-section > h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); }
.doc-section h3 { margin: 32px 0 0; font-size: 1.2rem; }
.doc-section h2, .doc-section h3 { position: relative; }
.anchor { margin-left: 10px; color: var(--line); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity 0.15s; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
.anchor:hover { color: var(--accent); }
.docs-main p, .docs-main li { color: var(--tagline); }
.docs-main p { margin: 14px 0 0; }
.docs-main b, .docs-main strong { color: var(--text); font-weight: 600; }
.docs-main a:not(.btn):not(.anchor) { color: #8fb0ff; text-underline-offset: 3px; }
.docs-main ul, .docs-main ol:not(.legend):not(.crumbs):not(.doc-steps) { margin: 14px 0 0; padding-left: 22px; display: grid; gap: 6px; }

.ui {
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92em;
  white-space: nowrap;
}
kbd {
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  background: var(--surface);
  color: var(--text);
  font: 600 0.85em Consolas, ui-monospace, monospace;
}

/* numbered steps */
.doc-steps { list-style: none; counter-reset: step; margin: 20px 0 0; padding: 0; display: grid; gap: 18px; }
.doc-steps > li { counter-increment: step; position: relative; padding-left: 46px; }
.doc-steps > li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red) 0 50%, var(--blue) 50% 100%);
  color: #fff;
  font-family: var(--display); font-weight: 800; font-size: 0.95rem;
}
.doc-steps > li > p:first-child { margin-top: 0; }

/* tables */
.table-wrap { margin-top: 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.docs-main table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.docs-main th, .docs-main td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.docs-main th { background: var(--surface); color: var(--text); font-weight: 600; white-space: nowrap; }
.docs-main td { color: var(--tagline); }
.docs-main tr:last-child td { border-bottom: 0; }
.docs-main td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; }

/* admonitions */
.admonition {
  margin-top: 22px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 9%, var(--bg));
  overflow: hidden;
}
.admonition.note { --c: var(--note); }
.admonition.tip { --c: var(--tip); }
.admonition.warning { --c: var(--warn); }
.admonition-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 !important;
  padding: 9px 16px;
  background: color-mix(in srgb, var(--c) 22%, transparent);
  color: var(--text) !important;
  font-family: var(--display); font-weight: 700; font-size: 0.95rem;
}
.admonition-title svg { width: 18px; height: 18px; fill: var(--c); }
.admonition > :not(.admonition-title) { margin: 0; padding: 12px 16px 14px; }
.admonition > ul { padding-left: 36px !important; }

/* annotated screenshots */
.shot { margin: 26px 0 0; }
.shot-frame {
  position: relative;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--line), 0 24px 50px -28px rgba(0, 0, 0, 0.9);
}
.shot-frame img { width: 100%; height: auto; border-radius: 10px; cursor: zoom-in; }
.shot-narrow { max-width: 560px; }
.shot-small { max-width: 680px; }
.shot figcaption { margin-top: 12px; font-size: 0.9rem; color: var(--muted); text-align: center; }

.hl {
  position: absolute;
  left: var(--x); top: var(--y); width: var(--w); height: var(--h);
  border: 3px solid var(--annot);
  border-radius: 9px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.55), inset 0 0 0 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.pin {
  position: absolute;
  left: var(--x); top: var(--y);
  width: var(--pin); height: var(--pin);
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--annot);
  color: var(--annot-ink);
  font: 800 0.8rem/1 var(--display);
  box-shadow: 0 0 0 3px #12151c, 0 6px 14px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.arrow { position: absolute; pointer-events: none; --len: 56px; }
.arrow::before { content: ''; position: absolute; background: var(--annot); border-radius: 2px; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45); }
.arrow::after { content: ''; position: absolute; border: 8px solid transparent; filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.8)); }
.arrow b {
  position: absolute;
  width: max-content;
  max-width: var(--lw, 15em);
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--annot);
  color: var(--annot-ink);
  font: 600 0.82rem/1.3 'Segoe UI', system-ui, sans-serif;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 8px 18px rgba(0, 0, 0, 0.5);
}
.arrow em {
  display: inline-block;
  width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px;
  border-radius: 50%;
  background: var(--annot-ink); color: var(--annot);
  font: 800 0.7rem/18px var(--display);
  font-style: normal;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* label to the right, arrow pointing left at (x, y) */
.arrow.to-r { left: var(--x); top: var(--y); width: var(--len); height: 0; }
.arrow.to-r::before { left: 10px; right: 0; top: -1.5px; height: 3px; }
.arrow.to-r::after { left: -4px; top: -8px; border-right: 13px solid var(--annot); border-left-width: 0; }
.arrow.to-r b { left: 100%; top: 0; transform: translateY(-50%); }

.arrow.to-l { left: calc(var(--x) - var(--len)); top: var(--y); width: var(--len); height: 0; }
.arrow.to-l::before { left: 0; right: 10px; top: -1.5px; height: 3px; }
.arrow.to-l::after { right: -4px; top: -8px; border-left: 13px solid var(--annot); border-right-width: 0; }
.arrow.to-l b { right: 100%; top: 0; transform: translateY(-50%); }

.arrow.to-b { left: var(--x); top: var(--y); width: 0; height: var(--len); }
.arrow.to-b::before { top: 10px; bottom: 0; left: -1.5px; width: 3px; }
.arrow.to-b::after { top: -4px; left: -8px; border-bottom: 13px solid var(--annot); border-top-width: 0; }
.arrow.to-b b { top: 100%; left: 0; transform: translateX(-50%); }

.arrow.to-t { left: var(--x); top: calc(var(--y) - var(--len)); width: 0; height: var(--len); }
.arrow.to-t::before { top: 0; bottom: 10px; left: -1.5px; width: 3px; }
.arrow.to-t::after { bottom: -4px; left: -8px; border-top: 13px solid var(--annot); border-bottom-width: 0; }
.arrow.to-t b { bottom: 100%; left: 0; transform: translateX(-50%); }

.legend { list-style: none; counter-reset: pin; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.legend li { counter-increment: pin; position: relative; padding-left: 38px; }
.legend li::before {
  content: counter(pin);
  position: absolute; left: 0; top: 1px;
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--annot); color: var(--annot-ink);
  font: 800 0.8rem/1 var(--display);
}
.legend-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }

/* image viewer */
.viewer {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 24px; border: 0;
  background: rgba(8, 10, 14, 0.94);
  display: none; place-items: center;
}
.viewer[open] { display: grid; }
.viewer::backdrop { background: transparent; }
.viewer img { max-width: 100%; max-height: calc(100vh - 48px); border-radius: 8px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8); cursor: zoom-out; }
.viewer-close {
  position: fixed; top: 16px; right: 16px;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 1.4rem; cursor: pointer;
}

.back-top { display: inline-block; margin-top: 48px; color: var(--muted) !important; font-size: 0.9rem; }

/* responsive */
@media (max-width: 960px) {
  .docs { grid-template-columns: 1fr; gap: 0; padding-top: 0; }
  .docs-bar {
    position: sticky; top: 64px; z-index: 40;
    display: flex; align-items: center; gap: 10px;
    margin: 0 -16px 8px; padding: 10px 16px;
    background: rgba(18, 21, 28, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .docs-bar button {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 12px; border-radius: 8px;
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  }
  .docs-bar button svg { width: 18px; height: 18px; fill: currentColor; }
  .docs-bar span { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .docs-side {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    width: min(300px, 85vw); max-height: none;
    padding: 24px 20px;
    background: var(--bg-alt);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
  }
  .docs-side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55); }
  .crumbs { margin-top: 24px; }
}

@media (max-width: 640px) {
  :root { --pin: 20px; }
  .doc-section { padding-top: 44px; }
  .arrow { --len: 22px !important; }
  .arrow b { padding: 2px; border-radius: 50%; }
  .arrow b span { display: none; }
  .arrow em { margin: 0; }
  .arrow::after { border-width: 6px; }
  .arrow.to-r::after { border-right-width: 10px; top: -6px; }
  .arrow.to-l::after { border-left-width: 10px; top: -6px; }
  .arrow.to-b::after { border-bottom-width: 10px; left: -6px; }
  .arrow.to-t::after { border-top-width: 10px; left: -6px; }
  .hl { border-width: 2px; border-radius: 6px; }
  .legend-cols { grid-template-columns: 1fr; }
  .docs-main th, .docs-main td { padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-side { transition: none; }
}

/* address bar with labelled parts */
.url-anatomy { margin: 18px 0 0; }
.url-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0b0d12;
  color: var(--muted);
  font: clamp(0.7rem, 2.4vw, 0.95rem)/1.4 Consolas, 'Cascadia Mono', ui-monospace, monospace;
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 8px;
}
.url-bar .url-host, .url-bar .url-path { white-space: nowrap; }
.url-bar .url-host { margin-right: -10px; }
.url-bar svg { width: 16px; height: 16px; flex: none; fill: var(--muted); }
.url-bar .seg {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--annot);
  color: var(--annot-ink);
  font-weight: 700;
}
.url-bar .seg em {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--annot-ink); color: var(--annot);
  font: 800 0.65rem/16px var(--display);
  font-style: normal;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.url-bar .seg i {
  position: absolute; left: 50%; top: calc(100% + 8px);
  transform: translateX(-50%);
  color: var(--annot);
  font: 600 0.78rem 'Segoe UI', system-ui, sans-serif;
  font-style: normal;
}

/* keep headings clear of the nav and the Contents bar after a jump */
@media (max-width: 960px) {
  html { scroll-padding-top: 128px; }
}

/* numbered boxes: the number sits centered on the box's top edge (or bottom edge with .pin-b) */
.hl[data-n]::after {
  content: attr(data-n);
  position: absolute;
  left: 50%; top: -1.5px;
  width: var(--pin); height: var(--pin);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--annot);
  color: var(--annot-ink);
  font: 800 0.8rem/var(--pin) var(--display);
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 3px #12151c, 0 6px 14px rgba(0, 0, 0, 0.6);
}
.hl.pin-b::after { top: calc(100% + 1.5px); }

.shot-notes { margin-top: 16px !important; }
.legend li::before { display: block; text-align: center; line-height: 26px; font-variant-numeric: tabular-nums; }
