/* Layout idea: a left-to-right flow map on the left, a fixed-width detail panel on the right that never moves the map.
   Three categories, each with its own colour and shape: person (diamond), automated (circle), check on the checks (square). */
:root{
  --font:var(--kb-font-body); --mono:var(--kb-font-mono);
  --page:var(--kb-page); --surface:var(--kb-surface); --surface-hover:var(--kb-surface-hover); --well:var(--kb-well);
  --ink:var(--kb-ink); --muted:var(--kb-muted); --hairline:var(--kb-hairline); --zone:var(--kb-zone-frame); --edge:var(--kb-line);
  --person:var(--kb-brass); --person-edge:var(--kb-brass-edge); --person-sel:var(--kb-brass-sel);
  --auto:var(--kb-sage); --auto-edge:var(--kb-sage-edge); --auto-sel:var(--kb-sage-sel);
  --check:var(--kb-slate); --check-edge:var(--kb-slate-edge); --check-sel:var(--kb-slate-sel);
  --bad:var(--kb-line); --bad-tint:var(--kb-well);
  --shadow:var(--kb-shadow);
}

*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--page);color:var(--ink);font-family:var(--font);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
a{color:var(--kb-brass);text-decoration-thickness:1px;text-underline-offset:2px}
a:hover{color:var(--person)}
button{font-family:inherit;color:inherit}
:focus-visible{outline:var(--kb-focus-width) solid var(--kb-focus);outline-offset:2px}
.wrap{padding-bottom:40px}
h1,h2,h3{text-wrap:balance;margin:0}
.lede{max-width:72ch;margin:10px 0 0;color:var(--ink);font-size:16px}
.lede + .lede{margin-top:6px;color:var(--muted);font-size:15px}
.example-strip{margin-top:16px;display:flex;gap:10px;align-items:baseline;flex-wrap:wrap;max-width:110ch;padding:10px 14px;border-left:3px solid var(--auto-edge);background:var(--surface);border-radius:0 8px 8px 0}
.example-strip b{font-weight:600}
.tag{display:inline-block;font-size:12px;font-weight:600;padding:1px 8px;border-radius:999px;border:1px solid var(--edge);color:var(--muted);white-space:nowrap}

/* Terms box */
.terms{margin-top:22px;background:var(--surface);border:1px solid var(--hairline);border-radius:12px;padding:16px 18px 6px}
.terms h2{font-size:16px;font-weight:600;padding-bottom:8px;border-bottom:1px solid var(--hairline)}
.terms dl{margin:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));column-gap:28px}
.terms .t{padding:8px 0;border-bottom:1px solid var(--hairline);font-size:14px;line-height:1.45}
.terms dt{display:inline;font-weight:600}
.terms dd{display:inline;margin:0;color:var(--muted)}
.terms dt::after{content:": "}

/* Main two-column area */
.main{margin-top:22px;display:grid;grid-template-columns:minmax(0,1fr) 400px;gap:24px;align-items:start}
.map-zone{background:transparent;border:1px solid var(--zone);border-radius:14px;padding:16px;min-width:0}
.map-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap;padding-bottom:10px;border-bottom:1px solid var(--hairline);margin-bottom:16px}
.map-head h2{font-size:16px;font-weight:600}
.key{display:flex;flex-wrap:wrap;gap:6px 16px;margin:0;padding:0;list-style:none;font-size:13px;color:var(--muted)}
.key li{display:flex;align-items:center;gap:7px}
.scroller{overflow-x:auto;padding-bottom:4px}
.map{min-width:900px}

/* Markers (shape + colour) */
.mk{width:10px;height:10px;flex:0 0 auto;display:inline-block}
.mk.person{background:var(--person);transform:rotate(45deg) scale(.85)}
.mk.auto{background:var(--auto);border-radius:50%}
.mk.check{background:var(--check);border-radius:1px}
.mk.outside{border:1.5px dashed var(--muted);border-radius:2px}

.reach{display:grid;grid-template-columns:1.1fr 1.1fr 1.1fr 1.8fr 1fr 1.4fr 1fr;column-gap:26px;margin-bottom:8px}
.bracket{grid-column:3 / 6;position:relative;height:26px;border:2px solid var(--auto-edge);border-bottom:0;border-radius:6px 6px 0 0;top:10px}
.bracket span{position:absolute;left:50%;top:-11px;transform:translateX(-50%);background:var(--page);padding:0 8px;font-size:12px;font-weight:600;color:var(--auto);white-space:nowrap}
.flow{display:grid;grid-template-columns:1.1fr 1.1fr 1.1fr 1.8fr 1fr 1.4fr 1fr;column-gap:26px;align-items:start}
.col{position:relative;display:flex;flex-direction:column;gap:0;min-width:0}
.col.arrow::after{content:"";position:absolute;top:44px;right:-22px;width:18px;height:2px;background:var(--muted)}
.col.arrow::before{content:"";position:absolute;top:40px;right:-23px;border-left:7px solid var(--muted);border-top:5px solid transparent;border-bottom:5px solid transparent}

.node{display:flex;flex-direction:column;align-items:flex-start;gap:3px;width:100%;text-align:left;background:var(--surface);border:1px solid var(--edge);border-radius:8px;padding:10px 10px 11px;cursor:pointer;transition:background .15s,border-color .15s;box-shadow:var(--shadow)}
.node .nt{display:flex;align-items:flex-start;gap:7px;font-weight:600;font-size:14px;line-height:1.25}
.node .nt .mk{margin-top:4px}
.node .ns{font-size:12px;color:var(--muted);line-height:1.35}
.node.main{min-height:90px}
.node.person{border-color:var(--person-edge)} .node.person:hover{border-color:var(--person)}
.node.auto{border-color:var(--auto-edge)} .node.auto:hover{border-color:var(--auto)}
.node.check{border-color:var(--check-edge)} .node.check:hover{border-color:var(--check)}
.node.outside{border:1px dashed var(--edge);box-shadow:none}
.node:hover{background:var(--surface-hover)}
.node.selected{box-shadow:inset 0 0 0 2px var(--ink)}
.node.person.selected{background:var(--person-sel)}
.node.auto.selected{background:var(--auto-sel)}
.node.check.selected{background:var(--check-sel)}
.node.outside.selected{background:var(--well)}

/* A node that contains nested parts */
.group{border:1px solid var(--auto-edge);border-radius:10px;background:var(--surface);box-shadow:var(--shadow);overflow:hidden}
.group > .node{border:0;border-radius:0;box-shadow:none;background:transparent}
.group > .node.selected{box-shadow:inset 0 0 0 2px var(--ink)}
.group > .node.auto.selected{background:var(--auto-sel)}
.well{background:var(--well);margin:0 8px 8px;border-radius:7px;padding:8px;display:flex;flex-direction:column;gap:8px}
.well-label{font-size:11.5px;color:var(--muted);line-height:1.3;padding:0 2px}
.well .node{box-shadow:none}
.sub{display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--auto-edge);border-radius:8px;overflow:hidden}
.sub > .node{border:0;border-radius:0;background:transparent}
.sub > .node.auto.selected{background:var(--auto-sel)}
.sub .well{margin:0 6px 6px;padding:6px}

.beneath{display:flex;flex-direction:column;align-items:stretch}
.vline{width:2px;height:22px;margin:0 auto;background:repeating-linear-gradient(var(--muted) 0 4px,transparent 4px 8px)}
.beneath-label{font-size:11.5px;color:var(--muted);text-align:center;margin:2px 0 4px}

.loop{margin-top:18px;display:flex;gap:8px;align-items:flex-start;font-size:13px;color:var(--muted);border-top:1px solid var(--hairline);padding-top:10px}
.loop svg{flex:0 0 auto;margin-top:2px}

.outside-zone{margin-top:16px;border:1px dashed var(--zone);border-radius:12px;padding:12px;display:flex;gap:16px;align-items:center;flex-wrap:wrap}
.outside-zone .oz-text{flex:1 1 260px;font-size:13px;color:var(--muted)}
.outside-zone .node{width:220px}

/* Detail panel */
.panel{position:sticky;top:16px;max-height:calc(100vh - 32px);overflow:auto;background:var(--surface);border:1px solid var(--hairline);border-radius:12px;box-shadow:var(--shadow)}
.panel-inner{padding:18px 18px 16px}
.empty{border:1px dashed var(--hairline);border-radius:10px;padding:22px 18px;color:var(--muted)}
.empty p{margin:0 0 12px}
.p-cat{display:flex;align-items:center;gap:8px;font-size:12.5px;font-weight:600}
.p-cat.person{color:var(--person)} .p-cat.auto{color:var(--auto)} .p-cat.check{color:var(--check)} .p-cat.outside{color:var(--muted)}
.p-title{font-size:21px;font-weight:700;margin:6px 0 4px;line-height:1.2}
.p-pos{font-size:12.5px;color:var(--muted)}
.p-sum{margin:10px 0 0;font-size:15px}
.p-sec{margin-top:18px}
.p-sec h3{font-size:13px;font-weight:600;color:var(--muted);margin-bottom:6px}
.item{padding:9px 0;border-top:1px solid var(--hairline)}
.item:first-of-type{border-top:0;padding-top:2px}
.item b{display:block;font-weight:600;font-size:14.5px;margin-bottom:2px}
.item p{margin:0;font-size:14px;color:var(--ink)}
.item .src{display:block;margin-top:4px;font-size:12px;color:var(--muted)}
.ex{background:var(--well);border-radius:8px;padding:10px 12px;font-size:14px}
.ex p{margin:0 0 6px} .ex p:last-child{margin-bottom:0}
.ex .tag{margin-bottom:6px}
.ex + .ex{margin-top:8px}
.tag.real{border-color:var(--auto);color:var(--auto)}
.legend{margin-top:8px}
.legend .tag{margin-right:2px}
.ex table{width:100%;border-collapse:collapse;font-size:13px;margin:6px 0;font-variant-numeric:tabular-nums}
.ex th,.ex td{text-align:left;padding:4px 6px;border-bottom:1px solid var(--hairline);vertical-align:top}
.ex th{font-weight:600;color:var(--muted)}
.ex td.n,.ex th.n{text-align:right}
.ex .hi{font-weight:700}
.wrong{border-left:3px solid var(--bad);background:var(--bad-tint);border-radius:0 8px 8px 0;padding:10px 12px}
.wrong h3{color:var(--bad);margin-bottom:4px}
.wrong p{margin:0;font-size:14px}
.hw{margin:0;padding-left:18px;font-size:14px}
.hw li{margin:5px 0;padding-left:2px}
.hw li::marker{color:var(--muted)}
.hw b{font-weight:600}
.st{display:grid;grid-template-columns:104px minmax(0,1fr);gap:8px 12px;background:var(--well);border-radius:8px;padding:12px;font-size:14px}
.st .sl{color:var(--muted);font-size:12.5px;padding-top:1px}
.st .sv{min-width:0}
.st table{width:100%;border-collapse:collapse;font-size:12.5px;margin:4px 0 0;font-variant-numeric:tabular-nums}
.st th,.st td{text-align:left;padding:3px 4px;border-bottom:1px solid var(--hairline);vertical-align:top}
.st th{font-weight:600;color:var(--muted)}
.st .n{text-align:right;white-space:nowrap}
.st .hi{font-weight:700}
.tg{display:inline-block;font-size:11px;font-weight:600;padding:0 6px;border-radius:999px;border:1px solid var(--edge);color:var(--muted);margin-left:6px;vertical-align:1px;white-space:nowrap}
.tg.real{border-color:var(--auto);color:var(--auto)}
.wr{display:grid;grid-template-columns:104px minmax(0,1fr);gap:6px 12px;border-left:3px solid var(--bad);padding:4px 0 4px 12px;font-size:14px}
.lv{width:100%;border-collapse:collapse;font-size:13.5px}
.lv th,.lv td{text-align:left;padding:6px 6px 6px 0;border-bottom:1px solid var(--hairline);vertical-align:top}
.lv th{font-size:12.5px;font-weight:600;color:var(--muted)}
.lv td:first-child{font-weight:600;width:38%}
.lvn{margin:6px 0 0;font-size:12.5px;color:var(--muted)}
.wr + .wr{margin-top:12px}
.wr .wl{color:var(--bad);font-size:12.5px;font-weight:600;padding-top:1px}
.pnote{margin-top:16px;padding-top:10px;border-top:1px solid var(--hairline);font-size:13px;color:var(--muted)}
.pnote p{margin:0 0 4px}
.pnote b{font-weight:600;color:var(--ink)}
.related{display:flex;flex-wrap:wrap;gap:6px}
.chip{display:inline-flex;align-items:center;gap:6px;font-size:13px;padding:4px 10px;border-radius:999px;border:1px solid var(--edge);background:transparent;cursor:pointer}
.chip:hover{background:var(--surface-hover);border-color:var(--ink)}
.pn{display:flex;justify-content:space-between;gap:8px;margin-top:20px;padding-top:12px;border-top:1px solid var(--hairline)}
.btn{font-size:13.5px;font-weight:500;padding:7px 12px;border-radius:8px;border:1px solid var(--edge);background:transparent;cursor:pointer;max-width:48%;text-align:left;line-height:1.3}
.btn:hover:not([disabled]){background:var(--surface-hover);border-color:var(--ink)}
.btn[disabled]{opacity:.45;cursor:default}
.btn.next{text-align:right;margin-left:auto}
.btn small{display:block;font-size:11.5px;color:var(--muted)}
.btn.primary{background:var(--ink);color:var(--page);border-color:var(--ink)}
.btn.primary:hover{background:var(--ink);opacity:.9}
.close{display:none}

footer.src{margin-top:30px;padding-top:14px;border-top:1px solid var(--hairline);font-size:13px;color:var(--muted)}
footer.src ul{margin:6px 0 10px;padding-left:18px}
footer.src li{margin:3px 0}
footer.src p{margin:6px 0;max-width:90ch}

.scrim{display:none}

@media all{
  .main{grid-template-columns:minmax(0,1fr)}
  .panel{position:fixed;top:0;right:0;bottom:0;max-height:none;width:min(430px,92vw);border-radius:0;border:0;border-left:1px solid var(--hairline);z-index:20;transform:translateX(105%);transition:transform .22s ease;box-shadow:-12px 0 40px rgba(0,0,0,.25)}
  .panel.open{transform:translateX(0)}
  .close{display:inline-flex;position:sticky;top:0;float:right;margin:-4px -4px 0 8px;width:34px;height:34px;align-items:center;justify-content:center;border-radius:8px;border:1px solid var(--edge);background:var(--surface);cursor:pointer;font-size:18px;line-height:1;z-index:1}
  .scrim{display:block;position:fixed;inset:0;background:rgba(10,16,26,.35);opacity:0;pointer-events:none;transition:opacity .2s;z-index:19}
  .scrim.open{opacity:1;pointer-events:auto}
  .panel .empty{display:none}
}
@media (max-width:860px){ .terms dl{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (max-width:560px){
  .wrap{padding-bottom:32px}
  .terms dl{grid-template-columns:1fr}
  .map-zone{padding:12px}
}
@media (prefers-reduced-motion:reduce){ *{transition:none !important} }

/* Brand block. The page already follows the pattern: the map is an unfilled zone frame with a ruled heading, boxes
   are the one raised surface with a category edge and shaped marker, nested boxes sit in the well, and the A/B test
   is the dashed neutral style in a dashed zone. These rules align the rest. */

/* Opening (shared rhythm): 12px between the title and the intro paragraphs, the example 20px below, sections 24px apart */
.lede{margin-top:var(--kb-space-3)}
.lede + .lede{margin-top:var(--kb-space-3)}
.example-strip{margin-top:20px}
.terms,.main{margin-top:var(--kb-space-5)}

/* The running example is a callout: a neutral line rule, no fill */
.example-strip{background:transparent;border-left:3px solid var(--kb-line);border-radius:0;padding:4px 0 4px 14px}

/* Real and Illustrative are status labels, so neutral: Real is the filled tag, Illustrative the outline tag */
.tag,.tg{color:var(--ink);border-color:var(--kb-line);background:transparent}
.tag.real,.tg.real{color:var(--ink);border-color:var(--kb-muted);background:var(--kb-neutral-sel)}

/* Terms: a section ruled off by a hairline, not a raised card (as on OpenRouter) */
.terms{background:transparent;border:0;border-top:1px solid var(--kb-hairline);border-radius:0;padding:18px 0 0}

/* Spacing standards: zones 20px inside, boxes 12x14px inside and 12px apart. Boxes carry no shadow: the surface is enough. */
.map-zone{padding:20px}
.node{padding:12px 14px;box-shadow:none}
/* Where the map scrolls (below about 1100px) it sits at its 900px minimum, so boxes keep the page's own tighter
   padding and titles don't break more than in the original (as on OpenRouter) */
@media (max-width:1099px){ .node{padding:10px 10px 11px} }
.group{box-shadow:none}
.well{gap:var(--kb-space-3)}
.bracket{border-width:1.5px}

/* Outside the flow: the dashed neutral style, with no fill until selected */
.node.outside{background:transparent}
.node.outside:hover{background:var(--kb-surface-hover);border-color:var(--kb-muted)}
.node.outside.selected{background:var(--kb-surface)}

/* The slide-over: the page colour with the side shadow, over the site header */
.panel{z-index:60;background:var(--kb-page);border-left-color:var(--kb-hairline);box-shadow:var(--kb-shadow-side)}
.scrim{z-index:59}
.panel-inner{padding:var(--kb-space-5)}

/* Buttons: the shared standard. Primary is brass (Next); secondary is a ghost (Previous, Close). */
.btn{display:inline-flex;flex-direction:column;align-items:flex-start;justify-content:center;min-height:var(--kb-btn-h);padding:8px 14px;border-radius:var(--kb-btn-radius);border-color:var(--kb-line);font-size:var(--kb-btn-size);font-weight:var(--kb-btn-weight)}
.btn small{font-size:13px;font-weight:400}
.btn.next{align-items:flex-end}
.btn.next:not([disabled]),.btn.primary{background:var(--kb-brass);border-color:var(--kb-brass);color:var(--kb-on-fill)}
.btn.next:not([disabled]) small{color:var(--kb-on-fill)}
.btn.next:not([disabled]):hover,.btn.primary:hover{background:var(--kb-brass);border-color:var(--kb-brass);filter:brightness(1.06);opacity:1}
.close{width:var(--kb-btn-h);height:var(--kb-btn-h);border-radius:var(--kb-btn-radius);border-color:var(--kb-line);background:var(--kb-page)}
.close:hover{border-color:var(--kb-muted)}
.chip:hover{border-color:var(--kb-muted)}

/* If you get this wrong: a callout, a neutral line rule on the well; its labels muted, not red */
.wr{background:var(--kb-well);border-left:3px solid var(--kb-line);padding:10px 14px}
.wr .wl{color:var(--muted)}
