/* Agent Utils documentation site.
   Direction: a workshop pegboard with label-maker tape. Each kind of tool hangs in its own
   section, labelled with embossed tape in that category's colour; tools are hanging tags.
   Atkinson Hyperlegible Next for reading, Atkinson Hyperlegible Mono for labels and code.

   Category tapes (one colour per family, shared with scripts/site/figures.py):
     speech red · screens blue · sessions black · fleet green · web yellow                  */

@font-face { font-family: "Atkinson Next"; src: url("fonts/atkinson-next.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("fonts/atkinson-next-italic.woff2") format("woff2"); font-weight: 400 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Atkinson Mono"; src: url("fonts/atkinson-mono.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }

:root {
  --board: #f3ead8;
  --hole: #e0d3b8;
  --card: #fffcf5;
  --ink: #1d1b17;
  --ink-2: #47433b;
  --ink-3: #5f594f;
  --rule: #d9cdb4;
  --speech: #c41e3a;
  --screens: #1f4fa3;
  --sessions: #1b1b1b;
  --fleet: #19734a;
  --web: #f0be2d;
  --tape: var(--sessions);
  --tape-ink: #fff;
  --code-bg: #23211d;
  --code-ink: #f1ead9;
  --body: "Atkinson Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Atkinson Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --measure: 45rem;
}
body[data-tape="speech"] { --tape: var(--speech); }
body[data-tape="screens"] { --tape: var(--screens); }
body[data-tape="fleet"] { --tape: var(--fleet); }
body[data-tape="web"] { --tape: var(--web); --tape-ink: #1d1b17; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0; color: var(--ink); font: 400 1.06rem/1.62 var(--body);
  background-color: var(--board);
  background-image: radial-gradient(circle at 12px 12px, var(--hole) 2.6px, transparent 3.2px);
  background-size: 28px 28px;
}
a { color: #8a1427; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--screens); outline-offset: 2px; }
strong, b { font-weight: 700; }
code, kbd, samp { font-family: var(--mono); font-size: 0.86em; font-variant-ligatures: none; }
:not(pre) > code { background: var(--card); border: 1px solid var(--rule); border-radius: 3px; padding: 0.02em 0.3em; overflow-wrap: anywhere; }
code.nb { white-space: nowrap; }
a > code { color: inherit; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: #fff; padding: 0.5rem 0.8rem; z-index: 10; font-weight: 700; }
.skip:focus { left: 0.5rem; }

/* ---------------------------------------------------------------- label-maker tape */
.tape, h2 {
  display: inline-block; position: relative; font: 800 1.08rem/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--tape-ink); background: var(--tape); padding: 0.42rem 1.1rem 0.4rem;
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%, 7px 50%);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 -1px 0 rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18), inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}
body[data-tape="web"] h2, .tape.web { text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45); }
.tape.speech { background: var(--speech); color: #fff; }
.tape.screens { background: var(--screens); color: #fff; }
.tape.sessions { background: var(--sessions); color: #fff; }
.tape.fleet { background: var(--fleet); color: #fff; }
.tape.web { background: var(--web); color: var(--ink); }

/* ---------------------------------------------------------------- masthead */
.bench { background: var(--ink); color: #f4eee2; }
.bench-in { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; max-width: 76rem; margin: 0 auto; padding: 0.95rem 2rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: #fff; text-decoration: none; }
.brand .tape { font-size: 1.05rem; padding: 0.45rem 1rem; transform: rotate(-1.5deg); background: var(--web); color: var(--ink); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4); }
.brand small { font: 400 0.78rem/1 var(--mono); color: #bdb5a5; }
.nav { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; margin-left: auto; }
.nav a { color: #e6dfcf; text-decoration: none; font-weight: 600; font-size: 0.96rem; padding: 0.2rem 0; border-bottom: 3px solid transparent; }
.nav a:hover { color: #fff; }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--web); }

/* ---------------------------------------------------------------- layout */
.page { display: grid; grid-template-columns: 12.5rem minmax(0, 1fr); gap: 3rem; max-width: 76rem; margin: 0 auto; padding: 0 2rem; }
.rail { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow-y: auto; padding: 2.8rem 0 2rem; scrollbar-width: thin; }
.rail p { margin: 0 0 0.8rem; }
.rail p .tape { font-size: 0.72rem; padding: 0.3rem 0.8rem; background: var(--ink); color: #fff; }
.rail ol { list-style: none; padding: 0; margin: 0; }
.rail li { margin: 0 0 0.25rem; }
.rail a { display: block; padding: 0.25rem 0.6rem; color: var(--ink-2); text-decoration: none; font-size: 0.93rem; line-height: 1.35; border-left: 3px solid var(--rule); background: rgba(255, 252, 245, 0.55); }
.rail a:hover { color: var(--ink); }
.rail a.on { color: var(--ink); border-left-color: var(--tape); background: var(--card); font-weight: 700; }
main { min-width: 0; padding: 2.6rem 0 5rem; }
main > * { max-width: var(--measure); }
main > figure.fig, main > .tags, main > .wide, main > .table.wide { max-width: 62rem; }

/* ---------------------------------------------------------------- type */
h1 { font: 800 clamp(2.5rem, 5vw, 4rem)/1.04 var(--body); letter-spacing: -0.025em; margin: 0.8rem 0 1.1rem; text-wrap: balance; }
.kicker { margin: 0; }
h2 { margin: 3.6rem 0 1.1rem; font-size: 1.1rem; transform: rotate(-0.6deg); }
h3 { font: 700 1.2rem/1.3 var(--body); margin: 2.2rem 0 0.5rem; }
p, ul, ol, dl { margin: 0 0 1.05rem; }
ul, ol { padding-left: 1.3rem; }
li { margin: 0.25rem 0; }
li::marker { color: var(--ink-3); }
.lede { font-size: 1.26rem; line-height: 1.52; color: var(--ink-2); margin-bottom: 1.7rem; }
.lede strong { color: var(--ink); }
dl.defs { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.5rem 1.4rem; }
dl.defs dt { font-weight: 700; }
dl.defs dt code { font-weight: 700; }
dl.defs dd { margin: 0; color: var(--ink-2); }

/* ---------------------------------------------------------------- code */
pre {
  position: relative; margin: 1.2rem 0 1.5rem; padding: 1rem 1.15rem; overflow-x: auto; background: var(--code-bg); color: var(--code-ink);
  border-radius: 6px; font: 400 0.85rem/1.62 var(--mono); scrollbar-width: thin; tab-size: 2; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}
pre code { font: inherit; background: none; border: 0; padding: 0; color: inherit; white-space: pre-wrap; overflow-wrap: break-word; }
pre .ln { display: block; padding-left: 2ch; text-indent: -2ch; }
pre .p { color: #fff; }
pre .p::before { content: "$ "; color: var(--web); font-weight: 700; }
pre .o { color: #d9d1bf; }
pre .c { color: #a49c8a; font-style: italic; }
pre .k { color: #9cc3ff; }
pre .s { color: #9fd9a8; }
pre .y { color: #ff9c8a; }
pre var { font-style: italic; color: #ffd66b; }
pre.light { background: var(--card); color: var(--ink); border: 1px solid var(--rule); box-shadow: none; }
pre.light .c { color: var(--ink-3); }
pre.light var { color: #8a5a00; }
pre[data-label] { padding-top: 2rem; }
pre[data-label]::before { content: attr(data-label); position: absolute; top: 0.55rem; left: 1.15rem; font: 700 0.7rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #bdb5a5; }
pre.light[data-label]::before { color: var(--ink-3); }
pre[data-scroll-more], .table[data-scroll-more], .fig-scroll[data-scroll-more] { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 3rem), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 3rem), transparent); }

/* ---------------------------------------------------------------- tables, notes, steps */
.table { overflow-x: auto; margin: 1.2rem 0 1.6rem; scrollbar-width: thin; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 0.2rem 0.9rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; line-height: 1.45; }
th { text-align: left; font: 700 0.72rem/1.2 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: 0.6rem 0.8rem 0.5rem 0; border-bottom: 2px solid var(--ink); white-space: nowrap; }
th code { background: none; border: 0; padding: 0; font: inherit; }
td { padding: 0.58rem 0.8rem 0.58rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
td:first-child { font-weight: 600; }
td code { white-space: nowrap; }
td.wrap code { white-space: normal; }
td.wrap code.nb { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.note, .warn { margin: 1.6rem 0; padding: 0.9rem 1.1rem; background: var(--card); border: 1px solid var(--rule); border-left: 6px solid var(--tape); border-radius: 0 6px 6px 0; }
.warn { border-left-color: var(--speech); }
.note > :last-child, .warn > :last-child { margin-bottom: 0; }
.note b:first-child, .warn b:first-child { font: 800 0.74rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; margin-right: 0.45rem; }
ol.steps { list-style: none; counter-reset: st; padding: 0; margin: 1.5rem 0 2rem; }
ol.steps > li { counter-increment: st; position: relative; padding: 0 0 1rem 3rem; margin: 0; }
ol.steps > li::before {
  content: counter(st); position: absolute; left: 0; top: 0; min-width: 2.1rem; padding: 0.3rem 0.4rem; text-align: center;
  font: 800 0.9rem/1 var(--mono); color: #fff; background: var(--tape); clip-path: polygon(0 0, 100% 0, calc(100% - 5px) 50%, 100% 100%, 0 100%, 5px 50%);
}
body[data-tape="web"] ol.steps > li::before { color: var(--ink); }
ol.steps > li > h3 { margin: 0.05rem 0 0.35rem; font-size: 1.07rem; }

/* ---------------------------------------------------------------- hanging tags */
.tags { display: grid; grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); gap: 1rem; margin: 1.3rem 0 2rem; padding: 0; list-style: none; }
.tags li { margin: 0; position: relative; background: var(--card); border: 1px solid var(--rule); border-top: 5px solid var(--tag, var(--tape)); border-radius: 4px 4px 8px 8px; padding: 0.95rem 1rem 0.85rem 1rem; box-shadow: 0 2px 0 rgba(60, 45, 20, 0.08); }
.tags li::before { content: ""; position: absolute; top: 0.6rem; right: 0.75rem; width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--board); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25); }
.tags b { display: block; font: 700 0.95rem/1.3 var(--mono); padding-right: 1.4rem; }
.tags span { display: block; margin-top: 0.35rem; font-size: 0.93rem; line-height: 1.45; color: var(--ink-2); }
.tags [data-tape="speech"] { --tag: var(--speech); }
.tags [data-tape="screens"] { --tag: var(--screens); }
.tags [data-tape="sessions"] { --tag: var(--sessions); }
.tags [data-tape="fleet"] { --tag: var(--fleet); }
.tags [data-tape="web"] { --tag: var(--web); }

/* ---------------------------------------------------------------- figures and shots */
figure.fig { margin: 2rem 0 2.4rem; }
.fig-scroll { overflow-x: auto; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 1.2rem; scrollbar-width: thin; }
.fig-scroll svg { display: block; width: 100%; height: auto; min-width: 620px; }
.fig-scroll img { display: block; max-width: 100%; height: auto; margin: 0 auto; border-radius: 4px; }
figcaption { margin-top: 0.8rem; font-size: 0.93rem; line-height: 1.5; color: var(--ink-2); max-width: var(--measure); }
figcaption b { color: var(--ink); margin-right: 0.35rem; }
figure:has(.fig-scroll[data-scroll-more]) figcaption::before { content: "Scroll sideways · "; font-weight: 700; color: var(--ink); }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.shots img { width: 100%; }
.only-narrow { display: none; }

svg.f { font-family: var(--body); }
svg.f .f-t { font: 700 14.5px var(--body); fill: var(--ink); }
svg.f .f-d { font: 800 15px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; fill: #fff; }
svg.f .f-s { font: 400 13px var(--body); fill: var(--ink-2); }
svg.f .f-xs { font: 700 11px var(--mono); fill: var(--ink-3); letter-spacing: 0.06em; }
svg.f .f-m { font: 400 12px var(--mono); fill: var(--ink); }
svg.f .f-w { fill: #fff; }
svg.f .f-ink { fill: var(--ink); text-shadow: none; }
svg.f .wire { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
svg.f .dash { stroke-dasharray: 6 5; }
svg.f .labbg { fill: var(--card); }
svg.f .s-speech { stroke: var(--speech); } svg.f .m-speech { fill: var(--speech); } svg.f .b-speech { fill: #f8dfe3; stroke: var(--speech); stroke-width: 1.5; }
svg.f .s-screens { stroke: var(--screens); } svg.f .m-screens { fill: var(--screens); } svg.f .b-screens { fill: #e0e8f7; stroke: var(--screens); stroke-width: 1.5; }
svg.f .s-sessions { stroke: var(--sessions); } svg.f .m-sessions { fill: var(--sessions); } svg.f .b-sessions { fill: #ebe6dc; stroke: var(--sessions); stroke-width: 1.5; }
svg.f .s-fleet { stroke: var(--fleet); } svg.f .m-fleet { fill: var(--fleet); } svg.f .b-fleet { fill: #dff0e6; stroke: var(--fleet); stroke-width: 1.5; }
svg.f .s-web { stroke: #b88a00; } svg.f .m-web { fill: var(--web); } svg.f .b-web { fill: #fdf3cf; stroke: #b88a00; stroke-width: 1.5; }
svg.f .s-ink { stroke: var(--ink); } svg.f .m-ink { fill: var(--ink); } svg.f .b-plain { fill: var(--card); stroke: var(--ink-3); stroke-width: 1.3; }

/* ---------------------------------------------------------------- home */
.hero-h1 { font-size: clamp(2.8rem, 6.2vw, 5rem); max-width: 14ch; }
.counts { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; margin: 0 0 1.6rem; padding: 0; list-style: none; }
.counts li { margin: 0; font-size: 0.95rem; color: var(--ink-2); }
.counts b { font: 800 1.9rem/1 var(--body); color: var(--ink); margin-right: 0.35rem; }

/* ---------------------------------------------------------------- footer */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; max-width: 76rem; margin: 0 auto; padding: 1.4rem 2rem 2.2rem; border-top: 1px solid var(--rule); color: var(--ink-3); font-size: 0.86rem; }
.foot a { color: var(--ink-2); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .page { display: block; padding: 0 1.25rem; }
  .rail { display: none; }
  .bench-in { padding: 0.85rem 1.25rem; gap: 0.8rem; }
  .nav { margin-left: 0; gap: 0.3rem 0.9rem; }
  main { padding-top: 1.8rem; }
}
@media (max-width: 600px) {
  body { font-size: 1rem; }
  h2 { font-size: 0.98rem; margin-top: 3rem; }
  .lede { font-size: 1.13rem; }
  pre { margin-left: -1.25rem; margin-right: -1.25rem; border-radius: 0; font-size: 0.8rem; }
  .fig-scroll { margin: 0 -1.25rem; border-radius: 0; padding: 0.8rem; }
  .shots { grid-template-columns: minmax(0, 1fr); }
  dl.defs { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  dl.defs dd { margin-bottom: 0.9rem; }
  .only-wide { display: none; }
  .only-narrow { display: block; }
  .only-narrow svg { min-width: 0; }
  .table { padding: 0.2rem 0.6rem; }
  .table table:has(th:nth-child(3)) { min-width: 34rem; }
  td code, td code.nb, td.wrap code.nb { white-space: normal; overflow-wrap: anywhere; }
  .foot { flex-direction: column; padding: 1.2rem 1.25rem 1.6rem; }
}
@media print {
  .bench, .rail, .skip, .foot { display: none !important; }
  .page { display: block; padding: 0; }
  body { background: #fff; font-size: 10.5pt; }
  main { padding: 0; }
  pre { background: #fff !important; color: #000 !important; border: 1px solid #999; -webkit-mask-image: none !important; mask-image: none !important; }
  pre * { color: #000 !important; }
  h2 { clip-path: none; background: #fff !important; color: #000 !important; border: 2px solid #000; text-shadow: none; }
  .fig-scroll { overflow: visible; }
  .fig-scroll svg { min-width: 0; }
  figure, pre, table, .tags li { break-inside: avoid; }
}
