/* Kubernetes: the Pod Network. Loaded after k8s.css, which holds everything
   the viewers share; these are the parts only this page draws: the node
   network along the bottom of the cluster, each node's kernel routes and
   filters, the network plug-in, and packets in flight. */

:root { --cni: #16866a; --pkt-outer: #c96a12; }
@media (prefers-color-scheme: dark) { :root { --cni: #4fd1a5; --pkt-outer: #f0a050; } }

/* Room between the rows for the manage nodes' drops, and under the workers
   for the node network. */
.kv-cluster { row-gap: 64px; padding-bottom: 46px; }
@media (min-width: 641px) { .kv-cluster { grid-template-rows: minmax(0, 0.62fr) minmax(0, 1fr); } }
@media (min-width: 1101px) { .kv-stage { grid-template-rows: 204px minmax(0, 1fr) minmax(0, 1fr); } }

/* The node network, and each node's drop from eth0 to it */
#kv-wires .bus { stroke: var(--pkt-outer); stroke-width: 5; stroke-linecap: round; opacity: 0.75; }
#kv-wires .drop { fill: none; stroke: var(--pkt-outer); stroke-width: 2.5; stroke-linejoin: round; opacity: 0.7; }
#kv-wires .bus.lit, #kv-wires .drop.lit { opacity: 1; stroke-dasharray: 9 6; animation: kv-march 0.9s linear infinite; }
#kv-wires .bus-label { fill: var(--pkt-outer); font: 700 11px ui-monospace, Menlo, Consolas, monospace; }

/* A node's footer: containerd and the CNI program on one line, the computer
   and its address on the next */
.m-node .foot-text .foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.4rem; }
.eth { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; color: var(--pkt-outer);
  border: 1.5px solid color-mix(in srgb, var(--pkt-outer) 60%, var(--border)); border-radius: 5px; padding: 0 0.35rem; background: var(--card); }
.eth.act { background: var(--pkt-outer); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pkt-outer) 40%, transparent); }
.comp.cnib { --c: var(--cni); border-style: dashed; }  /* a file on disk, not a running process */
.comp.cnib.act, .kv-stage.spotlight .comp.cnib.act { background: var(--cni); border-color: color-mix(in srgb, var(--cni) 70%, #000); }
.comp.cnib.act b, .comp.cnib.act .desc { color: #fff; }

/* A node's pod range, in its header */
.range { display: inline-block; white-space: nowrap; font-weight: 700; color: var(--cni); border: 1.5px solid color-mix(in srgb, var(--cni) 60%, var(--border));
  border-radius: 5px; padding: 0 0.35rem; background: color-mix(in srgb, var(--cni) 8%, var(--card)); }
.range.act { background: var(--cni); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--cni) 40%, transparent); }

/* The system's pods, small: the control plane solid purple, kube-proxy teal,
   calico-node the plug-in's green */
.spods.small { margin-bottom: 0.2rem; }
.spod.small { display: inline-block; padding: 0 0.35rem; border-width: 1.5px; border-style: solid; font-size: 0.66rem; }
.spod.small.cp { background: var(--cp-strong); color: #fff; border-color: color-mix(in srgb, var(--cp-strong) 70%, #000); }
.spod.small.proxy { --c: var(--node); color: var(--node); }
.spod.small.cni { --c: var(--cni); color: var(--cni); font-weight: 700; }
.spod.small.cni.act { background: var(--cni); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--cni) 40%, transparent); }

/* Your pods: their address and their labels */
.pod.a-client { --a: var(--app-hello); } .pod.a-frontend { --a: var(--app-shop); }
.pod .ph .sym { width: 18px; height: 18px; }
.pod .addr { font: 0.72rem ui-monospace, Menlo, Consolas, monospace; margin-top: 0.1rem; }
.pod .addr b { color: var(--cni); }
.pod .addr .none { color: var(--dim); }
.pod { padding: 0.15rem 0.4rem 0.2rem; }
.pod .st { position: absolute; top: 0.15rem; right: 0.4rem; float: none; font-size: 0.58rem; }
.pod .ph { padding-right: 3.8rem; }
.pod .ph b { font-size: 0.72rem; }
/* The pod's network namespace: the pause process and eth0, in one box the
   container's process sits under */
.pod .netns { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.5rem; margin-top: 0.1rem;
  border: 1px dashed color-mix(in srgb, var(--cni) 55%, var(--border)); border-radius: 5px; padding: 0 0.35rem;
  background: color-mix(in srgb, var(--cni) 6%, var(--card)); font: 0.68rem ui-monospace, Menlo, Consolas, monospace; }
.pod .netns.none { color: var(--dim); border-color: var(--border); background: none; }
.pod .netns .pause em { font-style: normal; color: var(--dim); }
.pod .netns .gear { color: var(--cni); }
.pod .ctr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.35rem; margin-top: 0.1rem; padding: 0 0.4rem; font-size: 0.68rem; }
.pod .ctr small { display: inline; margin-left: auto; font-size: 0.64rem; color: var(--a); font-weight: 700;
  font-family: ui-monospace, Menlo, Consolas, monospace; }
.pods { margin-top: 0; }
.pod.act { box-shadow: 0 0 0 3px color-mix(in srgb, var(--a) 45%, transparent); }

/* The node's kernel: its routes as ip route prints them, and the filter */
.kernel { margin-top: 0.35rem; border: 1px solid var(--border); border-left: 4px solid var(--srv-edge); border-radius: 7px;
  background: var(--raw); padding: 0.25rem 0.4rem; font: 0.62rem/1.3 ui-monospace, Menlo, Consolas, monospace; position: relative; z-index: 1; }
.kernel h3 { margin: 0 0 0.15rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.kernel h3 code { text-transform: none; letter-spacing: 0; }
.kernel.act { border-left-color: var(--cni); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cni) 30%, transparent); }
.rt > span { display: inline-block; white-space: nowrap; }
.rt > span + span { padding-left: 0.8rem; }
.rt { border-radius: 3px; padding: 0 0.2rem; }
.rt i { font-style: normal; color: var(--dim); margin-left: 0.5rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.rt.now { background: color-mix(in srgb, var(--flash) 60%, transparent); }
.rt.act { background: color-mix(in srgb, var(--cni) 22%, var(--card)); outline: 1.5px solid var(--cni); }
.filter { margin-top: 0.3rem; border-top: 1px dashed var(--border); padding-top: 0.2rem; }
.filter h4 { margin: 0 0 0.1rem; font: 700 0.62rem -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--bad); }
.filter .ok { color: var(--ok); padding-left: 0.6rem; } .filter .no { color: var(--bad); padding-left: 0.6rem; }
.filter .ok i { font-style: normal; color: var(--dim); }
.filter.act { background: color-mix(in srgb, var(--bad) 10%, var(--card)); outline: 2px solid var(--bad); border-radius: 4px; }
.filter.now { background: color-mix(in srgb, var(--flash) 60%, transparent); }
.kv-stage.spotlight .kv-cluster .act h3 { opacity: 1; }

/* The networks card */
.plan { display: grid; gap: 0.25rem; }
.plan-row { border: 1px solid var(--border); border-left: 4px solid var(--c, var(--border)); border-radius: 6px; padding: 0.1rem 0.45rem;
  font-size: 0.72rem; color: var(--dim); position: relative; z-index: 1; background: var(--card); }
.plan-row b { color: var(--text); font-size: 0.78rem; margin-right: 0.35rem; }
.plan-row code { font-weight: 700; color: var(--c); }
.plan-row span { display: block; font-size: 0.68rem; }
.plan-row.n-node { --c: var(--pkt-outer); } .plan-row.n-pod { --c: var(--cni); } .plan-row.n-pol { --c: var(--bad); }
.plan-row.act { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 45%, transparent); animation: kv-pulse 1.1s ease-in-out 3; }
.plan-row.now { background: color-mix(in srgb, var(--flash) 50%, var(--card)); }
.kv-plan { border-top-color: var(--cni); }

/* A packet in flight: the pod addresses, and when it crosses the node
   network, the outer header between the two nodes above them */
#kv-fly .msg.pkt { display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; background: var(--card);
  color: var(--text); border: 2px solid var(--cni); border-radius: 5px; font-size: 0.72rem; }
#kv-fly .msg.pkt .outer { background: var(--pkt-outer); color: #fff; padding: 0.05rem 0.45rem; }
#kv-fly .msg.pkt .inner { padding: 0.05rem 0.45rem; color: var(--cni); }
#kv-fly .trail.pkt polyline { stroke: var(--cni); }
#kv-fly .trail.pkt path { fill: var(--cni); }
#kv-fly .drop { position: fixed; background: var(--bad); color: #fff; font: 700 0.8rem ui-monospace, Menlo, Consolas, monospace;
  padding: 0.15rem 0.5rem; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }

/* Calico's choice: a tag on what another network plug-in does differently */
.choice { display: inline-block; margin-left: 0.3rem; padding: 0 0.3rem; border-radius: 4px; vertical-align: middle;
  border: 1px solid color-mix(in srgb, var(--warn) 70%, var(--border)); background: color-mix(in srgb, var(--warn) 14%, var(--card));
  color: var(--warn); font: 700 0.56rem -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; line-height: 1.5; cursor: help; }
.rt-group { margin-top: 0.15rem; font: 700 0.58rem -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--dim); }
.plan-row span.choice { display: inline-block; margin-left: 0.2rem; font-size: 0.52rem; }
.kv-plan h2 code .choice { margin: 0 0.15rem 0 0; }
#kv-fly .msg.pkt .wrap { background: color-mix(in srgb, var(--pkt-outer) 80%, #000); color: #fff; padding: 0.05rem 0.45rem; font-size: 0.64rem; }
#kv-fly .msg.pkt .wrap .choice { margin-left: 0.2rem; }

