/* moonlight.dustball.com — one stylesheet, system fonts, no external anything. */
:root {
  color-scheme: dark light;
  --bg: #0a0e19;
  --bg2: #0e1424;
  --panel: #131b2e;
  --ink: #e7eaf3;
  --muted: #9ba6c0;
  --line: #28324d;
  --accent: #ead9a4;
  --accent-ink: #0a0e19;
  --code-bg: #0f1627;
  --glow: rgba(234, 217, 164, 0.10);
  --star: rgba(231, 234, 243, 0.55);
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f4ec;
    --bg2: #efece1;
    --panel: #ffffff;
    --ink: #19202f;
    --muted: #55607a;
    --line: #d8d4c4;
    --accent: #7d5f0c;
    --accent-ink: #ffffff;
    --code-bg: #efece1;
    --glow: rgba(125, 95, 12, 0.07);
    --star: rgba(25, 32, 47, 0.0);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  background-image:
    radial-gradient(ellipse 60% 40% at 85% -5%, var(--glow), transparent 70%),
    radial-gradient(1px 1px at 12% 18%, var(--star), transparent),
    radial-gradient(1px 1px at 33% 7%, var(--star), transparent),
    radial-gradient(1.5px 1.5px at 58% 22%, var(--star), transparent),
    radial-gradient(1px 1px at 77% 12%, var(--star), transparent),
    radial-gradient(1px 1px at 91% 31%, var(--star), transparent),
    radial-gradient(1px 1px at 22% 40%, var(--star), transparent);
  background-repeat: no-repeat;
  background-attachment: fixed;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* ---- layout */
.shell { display: grid; grid-template-columns: 1fr; max-width: 78rem; margin: 0 auto; }
.top { padding: 1rem 16px .25rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { font: 600 1.25rem/1 var(--serif); letter-spacing: .02em; }
.brand small { display: block; color: var(--muted); font: 400 .78rem/1.2 var(--sans); letter-spacing: .04em; }
nav.site { padding: .25rem 16px .75rem; border-bottom: 1px solid var(--line); }
nav.site ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .35rem; }
nav.site a { display: block; padding: .3rem .65rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .92rem; border: 1px solid transparent; }
nav.site a:hover { color: var(--ink); border-color: var(--line); }
nav.site a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); }
nav.site .agents { margin-top: .6rem; font-size: .8rem; color: var(--muted); display: none; }
main { padding: 1.25rem 16px 3rem; min-width: 0; }
article { max-width: 46rem; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 17rem minmax(0, 1fr); }
  .side { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding: 1.5rem 0 1.5rem 1.5rem; border-right: 1px solid var(--line); }
  .top { padding: 0 1.25rem .5rem 0; }
  nav.site { padding: .5rem 1.25rem 1rem 0; border-bottom: 0; }
  nav.site ul { flex-direction: column; flex-wrap: nowrap; gap: .1rem; }
  nav.site a { border-radius: 8px; padding: .4rem .7rem; font-size: .95rem; }
  nav.site .agents { display: block; }
  main { padding: 2.5rem 2.5rem 4rem; }
}

/* ---- type */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: .005em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.7rem); margin: 0 0 .5rem; }
h2 { font-size: 1.55rem; margin: 2.6rem 0 .6rem; padding-top: .4rem; border-top: 1px solid var(--line); }
h3 { font-size: 1.15rem; margin: 1.8rem 0 .4rem; }
h2 a.anchor, h3 a.anchor { color: var(--muted); text-decoration: none; margin-left: .35rem; opacity: 0; font-size: .8em; }
h2:hover a.anchor, h3:hover a.anchor, a.anchor:focus { opacity: 1; }
p, ul, ol, table, blockquote, pre, figure { margin: 0 0 1.1rem; }
.lede { color: var(--muted); font-size: 1.12rem; margin-bottom: 1.2rem; }
ul, ol { padding-left: 1.4rem; }
li { margin: .25rem 0; }
li > ul, li > ol { margin: .25rem 0; }
blockquote { border-left: 3px solid var(--accent); padding: .1rem 1rem; color: var(--muted); background: var(--bg2); border-radius: 0 8px 8px 0; }
blockquote p:last-child { margin-bottom: .2rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
code { font: .88em var(--mono); background: var(--code-bg); padding: .12em .35em; border-radius: 5px; }
pre { background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; overflow-x: auto; }
pre code { background: none; padding: 0; font-size: .85rem; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2rem; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap table { margin: 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: .55rem .8rem; border-bottom: 1px solid var(--line); }
th { background: var(--bg2); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

.toc { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1.1rem; margin: 1.2rem 0 1.6rem; font-size: .93rem; }
.toc b { color: var(--muted); font-weight: 600; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; }
.toc ol { margin: .35rem 0 0; padding-left: 1.2rem; columns: 2 14rem; }
.toc li { margin: .15rem 0; }

/* ---- diagrams */
figure.diagram { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1rem .7rem; margin: 1.6rem 0; }
figure.diagram figcaption, figure.shot figcaption { color: var(--muted); font-size: .88rem; text-align: center; margin-top: .6rem; }
.diagram-svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.diagram-svg.d-one { max-width: 26rem; }
.d-narrow { display: block; max-width: 26rem; }
.d-wide { display: none; }
@media (min-width: 700px) { .d-wide { display: block; } .d-narrow { display: none; } }
.d-box { fill: var(--bg2); stroke: var(--line); stroke-width: 1.5; }
.d-soft { fill: none; stroke-dasharray: 5 5; }
.d-hl { fill: var(--bg2); stroke: var(--accent); stroke-width: 2; }
.d-title { fill: var(--ink); font: 600 16px var(--sans); }
.d-sub { fill: var(--muted); font: 400 12.5px var(--sans); }
.d-line { stroke: var(--muted); stroke-width: 1.8; fill: none; }
.d-dash { stroke-dasharray: 6 5; }
.d-head { fill: var(--muted); }
.d-chev { stroke: var(--muted); stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---- gallery */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1.2rem; margin: 1.4rem 0; }
figure.shot { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .6rem .5rem; }
figure.shot img { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
figure.shot figcaption { text-align: left; }

/* ---- agents box + footers */
.for-agents { margin-top: 3rem; padding: 1rem 1.15rem; border: 1px dashed var(--accent); border-radius: 12px; background: var(--panel); font-size: .92rem; color: var(--muted); }
.for-agents { overflow-wrap: anywhere; }
.for-agents b { color: var(--ink); }
.for-agents p { margin: .3rem 0; }
.for-agents code { font-size: .85em; }
footer.site { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1rem; color: var(--muted); font-size: .84rem; }
footer.site p { margin: .2rem 0; }

@media (max-width: 420px) { body { font-size: 16px; } }
@media print { .side, nav.site { display: none; } body { background: #fff; color: #000; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
