/* Network Builder (information-technology/network-builder.php). The page chrome is the one-screen layout in
   /css/resource.css; this is the stage: the devices palette, the canvas (filling the height) and the side panel
   (the task, a message's journey, the networks). On a laptop or desktop it fits one window (panels scroll inside
   themselves); on smaller screens it stacks. Theme tokens only: the canvas's own names for them are below. */

:root{
  --nb-wire:var(--ink-soft); --nb-wifi:var(--viz-6); --nb-path:var(--viz-7); --nb-packet:var(--viz-7);
  --nb-lan1:var(--viz-1-tint); --nb-lan2:var(--viz-3-tint); --nb-lan3:var(--viz-4-tint); --nb-lan4:var(--viz-8-tint);
  --nb-lan1-line:var(--viz-1); --nb-lan2-line:var(--viz-3); --nb-lan3-line:var(--viz-4); --nb-lan4-line:var(--viz-8);
  /* the internet side and the zones: a faint grey wash of --muted */
  --nb-wan:color-mix(in srgb, var(--muted) 17%, transparent); --nb-router:var(--viz-7-tint); --nb-zone:color-mix(in srgb, var(--muted) 6%, transparent);
}
#nbPending,#nbPacket{display:none}   /* network-builder.js shows them (display:inline) while they're needed */

/* ---------- the stage: palette, canvas, side panel ---------- */
.rp-main{gap:10px}
.nb-stage{flex:1;min-height:0;display:grid;grid-template-columns:168px minmax(0,1fr) minmax(300px,360px);gap:12px}

.nb-palette{padding:10px 10px 12px;min-height:0;overflow:auto;display:flex;flex-direction:column;gap:8px}
.nb-pal-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px}
.nb-pal{display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 4px 5px;border-radius:6px;border:1px solid var(--line-strong);background:var(--panel);color:var(--ink);
  font:600 11.5px/1.15 var(--font-display);cursor:grab;touch-action:none;text-align:center;min-height:58px}
.nb-pal svg{width:44px;height:32px;display:block}
.nb-pal:hover:not(:disabled){border-color:var(--accent);background:var(--accent-tint)}
.nb-pal[aria-pressed="true"]{border-color:var(--accent);background:var(--accent-tint);box-shadow:inset 0 0 0 1px var(--accent)}
.nb-pal:disabled{opacity:.4;cursor:default}
.nb-pal:focus-visible{outline:2px solid var(--focus);outline-offset:1px}
.nb-hint{margin:0;font-size:12.5px;line-height:1.4;color:var(--muted)}
.nb-ghost{position:fixed;z-index:50;width:64px;height:52px;margin:-26px 0 0 -32px;pointer-events:none;opacity:.85}
.nb-ghost svg{width:100%;height:100%}

/* the icons */
.nb-ic{fill:var(--panel);stroke:var(--ink);stroke-width:2.6;stroke-linejoin:round;stroke-linecap:round}
.nb-ic .nb-ic-fill{fill:var(--ink);stroke:none}
.nb-ic path{fill:none}
.nb-ic path[d$="Z"]{fill:var(--panel)}

/* the board */
.nb-board{display:flex;flex-direction:column;gap:6px;padding:8px 10px 10px;min-height:0;min-width:0}
.nb-tools{display:flex;align-items:center;justify-content:space-between;gap:6px 10px;flex-wrap:wrap;flex:none}
.nb-tool-btns{display:flex;gap:6px;flex-wrap:wrap}
.nb-canvas-box{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;border-radius:6px;background:var(--panel-2);border:1px solid var(--line)}
#nbSvg{display:block;width:100%;height:100%;max-height:100%;touch-action:none;user-select:none;-webkit-user-select:none}
#nbSvg.nb-armed{cursor:crosshair}
.nb-status{flex:none;margin:0;min-height:2.9em;font-size:13px;line-height:1.45;color:var(--ink-soft);padding:6px 10px;border-radius:6px;background:var(--panel-2);border-left:3px solid var(--line-strong)}
.nb-status.nb-ok{border-left-color:var(--ok)}
.nb-status.nb-bad{border-left-color:var(--bad)}
.nb-status.nb-warn{border-left-color:var(--warn)}
.nb-status strong{color:var(--ink)}
.nb-mono{font-family:var(--font-mono);font-size:.92em}

/* the canvas */
.nb-zone{fill:var(--nb-zone);stroke:var(--line-strong);stroke-width:2;stroke-dasharray:10 8}
.nb-zone-label{font:700 20px var(--font-display);fill:var(--muted)}
.nb-link{stroke-width:5;stroke-linecap:round}
.nb-wire{stroke:var(--nb-wire)}
.nb-wifi{stroke:var(--nb-wifi);stroke-dasharray:3 11;stroke-width:6}
.nb-link.nb-bad{stroke:var(--bad);stroke-dasharray:14 9}
.nb-link.nb-on{stroke:var(--nb-path);stroke-width:8}
.nb-wifi.nb-on{stroke-dasharray:3 11}
.nb-link-hit{stroke:transparent;stroke-width:26;cursor:pointer}
.nb-bad-dot{fill:var(--panel);stroke:var(--bad);stroke-width:3}
.nb-bad-x{font:700 17px var(--font-body);fill:var(--bad);text-anchor:middle;pointer-events:none}
.nb-pending{stroke:var(--accent);stroke-width:4;stroke-dasharray:8 7;pointer-events:none}
.nb-dev{cursor:grab;outline:none}
.nb-dev:focus-visible .nb-halo{stroke:var(--focus);stroke-width:4}
.nb-halo{stroke:transparent;stroke-width:3}
.nb-halo-lan1{fill:var(--nb-lan1);stroke:var(--nb-lan1-line)}
.nb-halo-lan2{fill:var(--nb-lan2);stroke:var(--nb-lan2-line)}
.nb-halo-lan3{fill:var(--nb-lan3);stroke:var(--nb-lan3-line)}
.nb-halo-lan4{fill:var(--nb-lan4);stroke:var(--nb-lan4-line)}
.nb-halo-lan1,.nb-halo-lan2,.nb-halo-lan3,.nb-halo-lan4{stroke-width:1.5;stroke-opacity:.5}
.nb-halo-wan{fill:var(--nb-wan)}
.nb-halo-router{fill:var(--nb-router)}
.nb-halo-none{fill:transparent}
.nb-lonely .nb-halo{fill:transparent;stroke:var(--line-strong);stroke-dasharray:6 6;stroke-width:2}
.nb-flag .nb-halo{stroke:var(--warn);stroke-width:4;stroke-dasharray:none}
.nb-first .nb-halo{stroke:var(--accent);stroke-width:5;stroke-dasharray:none}
.nb-dev-ic{transform:scale(1.15)}
.nb-dev-ic.nb-big{transform:scale(1.35)}
.nb-dev-label{font:600 17px var(--font-body);fill:var(--ink);paint-order:stroke;stroke:var(--panel-2);stroke-width:5px;stroke-linejoin:round}

.nb-packet{fill:var(--nb-packet);stroke:var(--panel);stroke-width:3;pointer-events:none}
#nbSvg[data-tool="delete"] .nb-dev,#nbSvg[data-tool="delete"] .nb-link-hit{cursor:not-allowed}
#nbSvg[data-tool="wired"] .nb-dev,#nbSvg[data-tool="wireless"] .nb-dev{cursor:pointer}

/* ---------- the side panel ---------- */
.nb-side{padding:10px 12px 12px;min-height:0;min-width:0;overflow:auto;display:flex;flex-direction:column;gap:10px}
.nb-tabs{align-self:flex-start;flex:none}
.nb-tab{display:flex;flex-direction:column;gap:8px}
.nb-h{margin:0;font:700 15.5px/1.3 var(--font-display);color:var(--ink)}
.nb-h4{margin:4px 0 0;font:700 13px/1.3 var(--font-display);color:var(--ink)}
.nb-p{margin:0;font-size:13.5px;line-height:1.45;color:var(--ink-soft)}
.nb-btns{display:flex;flex-wrap:wrap;gap:6px}
.nb-btns .btn{white-space:normal;text-align:left}

.nb-nav{display:flex;flex-wrap:wrap;gap:5px}
.nb-navb{min-width:34px;height:32px;padding:0 9px;border-radius:6px;border:1px solid var(--line-strong);background:var(--panel);color:var(--ink-soft);font:600 13px/1 var(--font-mono);cursor:pointer}
.nb-navb.nb-navr{font-family:var(--font-display)}
.nb-navb.current{outline:2px solid var(--accent);outline-offset:1px;color:var(--ink)}
.nb-navb.first{background:var(--ok);border-color:var(--ok);color:var(--on-viz)}
.nb-navb.later{background:var(--ok-tint);border-color:var(--ok);color:var(--ink)}
.nb-navb:focus-visible{outline:2px solid var(--focus);outline-offset:2px}

.nb-reqs,.nb-gen{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:5px}
.nb-reqs li{display:flex;gap:8px;font-size:13.5px;line-height:1.4;color:var(--ink);padding:6px 8px;border-radius:6px;background:var(--panel-2);border:1px solid var(--line)}
.nb-reqs li.ok{border-color:var(--ok);background:var(--ok-tint)}
.nb-reqs li.bad{border-color:var(--bad);background:var(--bad-tint)}
.nb-tick{flex:none;width:1.1em;font-weight:700;color:var(--muted)}
.nb-reqs li.ok .nb-tick{color:var(--ok)}
.nb-reqs li.bad .nb-tick{color:var(--bad)}
.nb-why{display:block;margin-top:3px;font-size:13px;color:var(--ink-soft)}
.nb-gen li{font-size:13px;line-height:1.4;color:var(--ink-soft);padding:5px 8px 5px 10px;border-left:3px solid var(--warn);background:var(--panel-2);border-radius:0 6px 6px 0}
.nb-gen li.bad{border-left-color:var(--bad)}
.nb-done{margin:0;font-size:13.5px;line-height:1.45;color:var(--ink);background:var(--ok-tint);border-radius:6px;padding:8px 10px}
.nb-done .btn{margin-top:6px}
.nb-note{margin:0;font-size:13px;line-height:1.45;color:var(--ink-soft);padding:6px 10px;border-left:3px solid var(--hint);background:var(--hint-tint);border-radius:0 6px 6px 0}
.nb-rv{display:flex;flex-direction:column;gap:5px;padding:8px 0;border-top:1px solid var(--line)}
.nb-rv-tag{font:500 11.5px/1 var(--font-mono);color:var(--muted);margin-left:4px}
.nb-rv.ok .nb-rv-tag{color:var(--ok)}
.nb-answer{margin:0;font-size:13px;line-height:1.45;color:var(--ink-soft)}

.nb-msg-form{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end}
.nb-msg-form label{display:flex;flex-direction:column;gap:2px;font:600 11px/1.2 var(--font-display);text-transform:uppercase;letter-spacing:.06em;color:var(--muted);flex:1 1 120px;min-width:0}
.nb-msg-form select{font:500 14px/1.2 var(--font-body);color:var(--ink);background:var(--panel);border:1px solid var(--line-strong);border-radius:6px;padding:6px 8px;min-height:34px;width:100%;text-transform:none;letter-spacing:0}
.nb-trace{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:5px;counter-reset:nb}
.nb-trace li{font-size:13px;line-height:1.45;color:var(--ink-soft);padding:6px 8px 6px 34px;border-radius:6px;border:1px solid var(--line);background:var(--panel-2);position:relative;counter-increment:nb;opacity:.55;transition:opacity .2s,border-color .2s}
.nb-trace li::before{content:counter(nb);position:absolute;left:8px;top:6px;width:19px;height:19px;border-radius:50%;background:var(--line-strong);color:var(--panel);font:700 11px/19px var(--font-mono);text-align:center}
.nb-trace li.past{opacity:1}
.nb-trace li.on{opacity:1;border-color:var(--nb-path);box-shadow:inset 3px 0 0 var(--nb-path)}
.nb-trace li.on::before,.nb-trace li.past::before{background:var(--nb-path);color:var(--on-viz)}
.nb-trace li.nb-fail{opacity:1;border-color:var(--bad);background:var(--bad-tint);padding-left:10px;color:var(--ink)}
.nb-trace li.nb-fail::before{display:none}
.nb-step-dev{display:block;font:700 12.5px/1.3 var(--font-display);color:var(--ink)}

.nb-net{padding:8px 10px;border-radius:6px;border:1px solid var(--line);border-left:4px solid var(--line-strong);background:var(--panel-2);display:flex;flex-direction:column;gap:4px}
.nb-net.nb-lan1{border-left-color:var(--nb-lan1-line)}
.nb-net.nb-lan2{border-left-color:var(--nb-lan2-line)}
.nb-net.nb-lan3{border-left-color:var(--nb-lan3-line)}
.nb-net.nb-lan4{border-left-color:var(--nb-lan4-line)}
.nb-net .nb-h4{margin:0}
.nb-net + .nb-net{margin-top:6px}
table.nb-addr{font-size:12px}
table.nb-addr td{padding:2px 6px 2px 0;border:0;white-space:nowrap}
#nbNets .nb-hint{margin-top:8px}

/* the explanation's subheadings */
#dlgObjectives h4{margin:14px 0 6px;font:700 14px/1.3 var(--font-display);color:var(--ink)}

/* ---------- laptops: a narrower palette and side ---------- */
@media (max-width:1300px){
  .nb-stage{grid-template-columns:150px minmax(0,1fr) minmax(280px,320px)}
}
@media (min-width:901px) and (max-width:1100px){
  .nb-stage{grid-template-columns:118px minmax(0,1fr) 270px;gap:8px}
  .nb-pal-grid{gap:4px}
  .nb-pal{min-height:46px;padding:3px 2px;font-size:10.5px}
  .nb-pal svg{width:32px;height:23px}
  .nb-palette .nb-hint{display:none}
}
@media (min-width:901px) and (max-height:700px){
  .nb-status{min-height:0;font-size:12.5px;padding:4px 8px}
  .nb-tools .seg-toggle button{padding:6px 10px}
}

/* ---------- tablets and phones: everything stacks and the page scrolls ---------- */
@media (max-width:900px){
  .nb-stage{display:flex;flex-direction:column}
  .nb-pal-grid{grid-template-columns:repeat(auto-fill,minmax(76px,1fr))}
  .nb-canvas-box{flex:none;aspect-ratio:1000/620;display:block}
  #nbSvg{height:100%}
  .nb-side{overflow:visible}
  .seg-toggle button{min-height:40px}
  .btn,.nb-navb{min-height:40px}
  .nb-navb{min-width:42px}
  .nb-msg-form select{min-height:40px}
  .rp-controls{width:100%}
}
@media (max-width:640px){
  .rp-main{padding-left:10px;padding-right:10px}
  .nb-board{padding:8px 6px}
  .nb-tools .seg-toggle{display:flex;width:100%}
  .nb-tools .seg-toggle button{flex:1 1 0;justify-content:center;padding:8px 4px;font-size:12.5px;white-space:normal;text-align:center;line-height:1.15}
  .nb-tool-btns{width:100%}
  .nb-tool-btns .btn{flex:1 1 0;justify-content:center;white-space:normal;text-align:center}
  .nb-tabs{display:flex;width:100%}
  .nb-tabs button{flex:1 1 0;justify-content:center;white-space:normal;text-align:center;line-height:1.15;padding:8px 4px}
  /* the canvas is drawn at a third of its size on a phone, so its labels are drawn bigger */
  .nb-dev-label{font-size:25px;stroke-width:6px}
  .nb-zone-label{font-size:28px}
}
@media (max-width:640px){
  .nb-dev-ic{transform:scale(1.55)}
  .nb-dev-ic.nb-big{transform:scale(1.6)}
  .nb-dev-label{font-size:27px}
}
@media (max-width:640px){
  .nb-dev-label{transform:translateY(16px)}
}

/* a narrow laptop window: compact panel tabs, and bigger labels on the smaller canvas */
@media (min-width:901px) and (max-width:1100px){
  .nb-tabs button{font-size:11.5px;padding:6px 6px}
  .nb-dev-label{font-size:22px;stroke-width:6px}
  .nb-navb{min-width:30px;padding:0 7px}
}
