/* SnowyPlover docs. One accent colour, system fonts, nothing that moves unless you drag it. */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f7;
  --fg: #1c1c1f;
  --muted: #6c6c73;
  --line: #e7e7ea;
  --line-strong: #cfcfd4;
  --accent: #e2620e;
  --accent-soft: #fdf0e7;
  --link: #1c1c1f;
  --code-bg: #f3f3f5;

  --node-bg: #ffffff;
  --node-head: #fafafa;
  --node-stroke: #c9c9cf;
  --wire: #a3a3ab;
  --port: #8a8a92;
  --btn-bg: #f0f0f2;

  --side-w: 248px;
  --top-h: 52px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416;
    --bg-soft: #1b1b1e;
    --fg: #e9e9ec;
    --muted: #9a9aa3;
    --line: #2a2a2e;
    --line-strong: #3b3b41;
    --accent: #f2812f;
    --accent-soft: #2e1e12;
    --link: #e9e9ec;
    --code-bg: #212125;
    --node-bg: #1d1d20;
    --node-head: #222226;
    --node-stroke: #45454c;
    --wire: #6d6d76;
    --port: #8c8c95;
    --btn-bg: #2a2a2f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141416;
  --bg-soft: #1b1b1e;
  --fg: #e9e9ec;
  --muted: #9a9aa3;
  --line: #2a2a2e;
  --line-strong: #3b3b41;
  --accent: #f2812f;
  --accent-soft: #2e1e12;
  --link: #e9e9ec;
  --code-bg: #212125;
  --node-bg: #1d1d20;
  --node-head: #222226;
  --node-stroke: #45454c;
  --wire: #6d6d76;
  --port: #8c8c95;
  --btn-bg: #2a2a2f;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
a { color: var(--link); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
code, kbd, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.88em; }
code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
pre:not(.diagram) { background: var(--code-bg); padding: 12px 14px; border-radius: 6px; overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; }
img { max-width: 100%; }

/* ---------------------------------------------------------------- top bar */

.top {
  position: sticky; top: 0; z-index: 20;
  height: var(--top-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.menu, .theme {
  border: 0; background: none; color: var(--muted); cursor: pointer;
  width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; padding: 0;
}
.menu:hover, .theme:hover { background: var(--bg-soft); color: var(--fg); }
.menu { display: none; }
.theme { margin-left: auto; }

.search { position: relative; margin-left: 24px; flex: 0 1 340px; }
.search input {
  width: 100%; height: 32px; padding: 0 30px 0 12px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg-soft); color: var(--fg);
  font: inherit; font-size: 14px; outline: none;
}
.search input:focus { border-color: var(--line-strong); background: var(--bg); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  position: absolute; right: 8px; top: 7px; font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; line-height: 16px; pointer-events: none;
}
.search input:focus + kbd { display: none; }
.results {
  position: absolute; top: 38px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.08); max-height: 60vh; overflow-y: auto;
}
.results li a { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 5px; text-decoration: none; font-size: 14px; }
.results li a small { color: var(--muted); margin-left: auto; font-size: 12px; }
.results li a.on, .results li a:hover { background: var(--bg-soft); }
.results li.none { padding: 8px; color: var(--muted); font-size: 14px; }
.results img { width: 16px; height: 16px; }
.results .dot { width: 16px; height: 16px; display: grid; place-items: center; color: var(--muted); }

/* ---------------------------------------------------------------- sidebar + main */

.wrap { display: flex; max-width: 1240px; margin: 0 auto; }
.side {
  position: sticky; top: var(--top-h); align-self: flex-start;
  width: var(--side-w); flex: none;
  height: calc(100vh - var(--top-h)); overflow-y: auto;
  padding: 24px 12px 48px 16px;
  font-size: 14px;
}
.nav-group + .nav-group { margin-top: 22px; }
.nav-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 8px 6px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side ul ul { margin: 2px 0 6px 10px; padding-left: 6px; border-left: 1px solid var(--line); }
.side a { display: block; padding: 3px 8px; border-radius: 5px; text-decoration: none; color: var(--muted); line-height: 1.45; }
.side a:hover { color: var(--fg); }
.side a[aria-current="page"] { color: var(--fg); background: var(--bg-soft); font-weight: 500; }
.side summary { cursor: pointer; padding: 3px 8px; color: var(--muted); list-style: none; border-radius: 5px; }
.side summary::-webkit-details-marker { display: none; }
.side summary::before { content: ""; display: inline-block; width: 5px; height: 5px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); margin: 0 8px 2px 0; transition: transform 0.15s; }
.side details[open] > summary::before { transform: rotate(45deg); }
.side summary:hover { color: var(--fg); }

main { flex: 1; min-width: 0; padding: 32px 40px 64px; max-width: 1000px; }
main > * { max-width: 740px; }
main > figure.diagram, main > .table, main > .wide { max-width: none; }

h1 { font-size: 30px; line-height: 1.25; letter-spacing: -0.02em; margin: 8px 0 12px; font-weight: 650; }
h2 { font-size: 21px; letter-spacing: -0.01em; margin: 44px 0 10px; font-weight: 620; }
h3 { font-size: 16.5px; margin: 28px 0 6px; font-weight: 620; }
p, ul, ol { margin: 0 0 14px; }
li + li { margin-top: 4px; }
.lead { font-size: 17px; color: var(--muted); }
.muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

.note {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 18px 0; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14.5px; color: var(--muted);
}
.note::before {
  content: ""; flex: none; width: 16px; height: 16px; margin-top: 3px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M8 7v4.5' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='4.8' r='1' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='7' fill='none' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M8 7v4.5' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='4.8' r='1' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
}
.note p { margin: 0; }
.note b, .note code { color: var(--fg); }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li { counter-increment: step; position: relative; padding-left: 36px; margin-bottom: 14px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600; color: var(--muted);
}

.cref { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-weight: 500; text-decoration: none; border-bottom: 1px solid var(--line-strong); line-height: 1.3; }
.cref:hover { border-bottom-color: var(--accent); }
.cref img { width: 16px; height: 16px; position: relative; top: 0; }

.foot { margin-top: 72px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot code { font-size: 12px; }

/* ---------------------------------------------------------------- home */

.hero h1 { font-size: 38px; margin-top: 12px; }
.hero .lead { font-size: 18px; max-width: 620px; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0 8px; }
.btn-main, .btn-plain {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 6px;
  text-decoration: none; font-weight: 550; font-size: 14.5px; border: 1px solid var(--line-strong);
}
.btn-main { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-main:hover { opacity: 0.88; }
.btn-plain:hover { background: var(--bg-soft); }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 8px; padding: 0; list-style: none; max-width: none !important; }
.grid3 li { margin: 0; }
.grid3 a { display: block; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; }
.grid3 a:hover { border-color: var(--line-strong); }
.grid3 b { display: block; font-weight: 600; margin-bottom: 2px; }
.grid3 span { color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------------- reference */

.crumb { font-size: 13px; color: var(--muted); margin: 0; }
.crumb a { color: var(--muted); }
.cname { display: flex; align-items: center; gap: 12px; }
.cname img { width: 28px; height: 28px; image-rendering: auto; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 13.5px; }
.meta code { font-size: 12.5px; color: var(--fg); }

.table { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
td:first-child { white-space: nowrap; }
.pname { font-weight: 600; }
.nick { color: var(--muted); font-size: 12.5px; font-family: ui-monospace, Menlo, Consolas, monospace; margin-left: 4px; }
.type { white-space: nowrap; }
.access { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 3px; padding: 0 4px; margin-left: 2px; white-space: nowrap; }
td code { white-space: nowrap; }
.values { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 6px; font-size: 13px; color: var(--muted); }

.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-width: none !important; }
.cards li { margin: 0; }
.cards a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; height: 100%; }
.cards a:hover { border-color: var(--line-strong); }
.cards img { margin-top: 2px; flex: none; }
.cards b { display: block; font-weight: 600; font-size: 14.5px; }
.cards small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; }
.pager a { display: block; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 550; min-width: 40%; }
.pager a:hover { border-color: var(--line-strong); }
.pager a span { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.pager a.next { text-align: right; margin-left: auto; }

/* ---------------------------------------------------------------- diagrams */

figure.diagram { margin: 20px 0 24px; }
figure.diagram .canvas {
  overflow-x: auto; padding: 20px; border: 1px solid var(--line); border-radius: 8px;
  background-color: var(--bg-soft);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 16px 16px;
}
figure.diagram svg { display: block; margin: 0 auto; max-width: 100%; height: auto; overflow: visible; }
figure.diagram figcaption { font-size: 13.5px; color: var(--muted); margin-top: 8px; }

svg.gh { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 12px; }
svg.gh text { fill: var(--fg); }
svg.gh .box { fill: var(--node-bg); stroke: var(--node-stroke); stroke-width: 1; }
svg.gh .comp .box { stroke-width: 1.2; }
svg.gh .sep { stroke: var(--line); }
svg.gh .name { font-weight: 600; font-size: 12.5px; }
svg.gh a:hover .name { fill: var(--accent); }
svg.gh .pl { font-size: 12px; }
svg.gh .pl.opt { fill: var(--muted); }
svg.gh .more { fill: var(--muted); font-size: 11.5px; font-style: italic; }
svg.gh .phit { fill: transparent; }
svg.gh .pin:hover .pl, svg.gh .pout:hover .pl { fill: var(--accent); }
svg.gh .port { fill: var(--node-bg); stroke: var(--port); stroke-width: 1.4; }
svg.gh .btn { fill: var(--btn-bg); stroke: var(--node-stroke); }
svg.gh .btntext { font-size: 11.5px; font-weight: 550; }

svg.gh .w { fill: none; stroke: var(--wire); stroke-width: 1.6; }
svg.gh .w.list { stroke-width: 4; }
svg.gh .w-in { fill: none; stroke: var(--bg-soft); stroke-width: 1.4; pointer-events: none; }
svg.gh .w.tree { stroke-dasharray: 6 4; stroke-width: 2.2; }
svg.gh .w.hot { stroke: var(--accent); }
svg.gh .wv { display: none; }
svg.gh .wv.on { display: block; }
svg.gh .wv rect { fill: var(--accent); }
svg.gh .wv text { fill: #fff; font-size: 10.5px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }

svg.gh .lbl { font-size: 12px; }
svg.gh .slider .track { stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; }
svg.gh .slider .knob { fill: var(--fg); }
svg.gh .slider.live .knob { fill: var(--accent); }
svg.gh .slider .val { font-variant-numeric: tabular-nums; font-weight: 600; }
svg.gh .slider .hit { fill: transparent; cursor: ew-resize; touch-action: none; }
svg.gh .slider.live .box { stroke: var(--accent); }
svg.gh .slider:focus { outline: none; }
svg.gh .slider.live:focus-visible .box, svg.gh .slider.live.dragging .box { stroke-width: 2.4; }
svg.gh .pill { fill: var(--btn-bg); stroke: var(--node-stroke); }
svg.gh .pill.on { fill: var(--accent); stroke: var(--accent); }
svg.gh .pilltext { font-size: 11px; font-weight: 600; }
svg.gh .pilltext.on { fill: #fff; }
svg.gh .panel .box { fill: var(--accent-soft); stroke: var(--node-stroke); }
svg.gh .ptext { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
svg.gh .evbg { fill: var(--bg-soft); }
svg.gh .evbar { fill: var(--line-strong); }
svg.gh .evbar.active { fill: var(--accent); }
svg.gh .playhead { stroke: var(--accent); stroke-width: 1.5; }

.live-hint { font-size: 13px; color: var(--accent); margin: -16px 0 24px; }

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

@media (max-width: 860px) {
  .menu { display: grid; }
  .side {
    position: fixed; top: var(--top-h); left: 0; bottom: 0; z-index: 15; height: auto;
    background: var(--bg); border-right: 1px solid var(--line);
    transform: translateX(-100%); transition: transform 0.2s;
  }
  body.nav-open .side { transform: none; }
  main { padding: 24px 16px 48px; }
  .search { margin-left: 4px; }
  .search kbd { display: none; }
  .grid3 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  h1, .hero h1 { font-size: 27px; }
  figure.diagram .canvas { padding: 14px; margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
}
@media (max-width: 480px) {
  .brand { font-size: 0; gap: 0; }
  .search { flex: 1; }
}
