/* lefekarli.local network guide
   Hue marks a VLAN and nothing else. Brightness marks whether something is up.
   One family, Recursive, in three registers: facts, notes (casual) and device output (mono). */

@font-face {
  font-family: "Recursive";
  src: url("fonts/recursive-latin.woff2") format("woff2");
  font-weight: 300 1000;
  font-style: oblique 0deg 15deg;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ground: #172126;
  --ground-raised: #1d2930;
  --rule: #2b3940;
  --ink: #e6edef;
  --ink-2: #a3b3ba;
  --ink-3: #6f8189;
  --unlit: #3a4a52;
  --routed: #dce6ea;
  --slot-a: #35c6d6;
  --slot-b: #a8e05f;
  --slot-c: #f0913a;
  --slot-m: #ee6a7b;

  --bar-h: 52px;
  --sans: "Recursive", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Recursive", "Cascadia Mono", Consolas, ui-monospace, monospace;
  --facts: "MONO" 0, "CASL" 0;
  --notes: "MONO" 0, "CASL" 0.6;
  --cli: "MONO" 1, "CASL" 0;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-padding-top: calc(var(--bar-h) + 12px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  font-variation-settings: var(--facts);
  font-kerning: normal;
}

a { color: inherit; text-decoration-color: var(--ink-3); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }

.slot-a { --slot: var(--slot-a); }
.slot-b { --slot: var(--slot-b); }
.slot-c { --slot: var(--slot-c); }
.slot-m { --slot: var(--slot-m); }
.slot-none { --slot: var(--unlit); }

.swatch {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 2px;
  background: var(--slot);
}

/* Top bar */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--bar-h);
  padding-inline: 24px;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}
.bar-name { font-weight: 650; text-decoration: none; white-space: nowrap; }
.bar-nav { display: flex; gap: 2px; }
.bar-nav a {
  padding: 5px 8px;
  border-radius: 3px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
}
.bar-nav a:hover, .bar-nav a[aria-current="true"] { color: var(--ink); background: var(--ground-raised); }
.bar-meta { margin-left: auto; color: var(--ink-2); font-size: 14px; white-space: nowrap; }
.bar-print {
  padding: 6px 12px;
  border: 1px solid var(--ink-3);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.bar-print:hover { border-color: var(--ink); }

/* Layout: sticky map on the left, the guide scrolls on the right */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
  grid-template-areas:
    "map intro"
    "map findings"
    "map chapters"
    "map addressing"
    "map about";
  align-items: start;
}
.intro { grid-area: intro; }
.map { grid-area: map; align-self: stretch; border-right: 1px solid var(--rule); }
.findings { grid-area: findings; }
.chapters { grid-area: chapters; }
.addressing { grid-area: addressing; }
.about { grid-area: about; }

.intro, .findings, .chapter, .addressing, .about { padding: 44px clamp(24px, 3.2vw, 56px); }
.findings, .chapter, .addressing, .about { border-top: 1px solid var(--rule); }

.intro h1 { font-size: 39px; font-weight: 800; letter-spacing: -0.015em; }
.summary { margin-top: 12px; max-width: 60ch; color: var(--ink-2); }

/* Map */

.map-inner {
  position: sticky;
  top: var(--bar-h);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--bar-h));
  padding: 12px 20px 18px;
}
.map-scroll { display: flex; flex: 1 1 auto; min-height: 0; }
.topology { display: block; width: 100%; height: 100%; }

.topology text { font-family: var(--sans); font-variation-settings: var(--facts); font-variant-numeric: tabular-nums; }
.link-label { font-size: 12.5px; fill: var(--ink-2); }
.node-name { font-size: 20px; font-weight: 750; fill: var(--ink); }
.node-switch .node-name { font-size: 18px; }
.node-model, .node-state { font-size: 12.5px; fill: var(--ink-2); }
.upstream-name { font-size: 13.5px; font-weight: 650; fill: var(--ink); }
.upstream-box { fill: none; stroke: var(--ink-3); stroke-dasharray: 4 4; }

.node-box { fill: var(--ground-raised); stroke: var(--ink-3); stroke-width: 1; }
.node-router.hsrp-active .node-box { stroke: var(--ink); stroke-width: 1.5; }
.node-router.hsrp-standby .node-box { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 5 4; }
.node { cursor: pointer; }
.node:focus { outline: none; }
.node:hover .node-box { stroke: var(--ink); }
.node:focus-visible .node-box,
.node.is-current .node-box {
  stroke: var(--ink);
  stroke-width: 2;
  filter: drop-shadow(0 0 6px rgba(230, 237, 239, 0.35));
}

.tap-tick { fill: var(--slot); }
.tap-label { font-size: 13px; fill: var(--ink-2); }
.tap-address { font-size: 13px; fill: var(--ink); }
.tap.is-down .tap-tick { opacity: 0.35; }

.strand { fill: none; stroke: var(--slot); stroke-width: 2; stroke-linecap: round; }
.halo { fill: none; stroke: var(--slot); stroke-width: 7; stroke-linecap: round; opacity: 0.16; }
.link.is-down .strand { opacity: 0.35; stroke-dasharray: 4 5; }
.cable { fill: none; stroke: var(--routed); stroke-width: 2; stroke-linecap: round; opacity: 0.85; }
.link-routed.is-down .cable { stroke: var(--unlit); stroke-dasharray: 4 5; opacity: 1; }
.bundle-ring { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }

.hsrp-box { fill: none; stroke: var(--ink-3); stroke-dasharray: 3 3; }
.hsrp-title { font-size: 13px; font-weight: 650; fill: var(--ink); }
.hsrp-link { fill: none; stroke: var(--routed); stroke-width: 1.5; }
.hsrp-link.is-standby { stroke: var(--ink-3); stroke-dasharray: 5 4; }

.stub-line { stroke: var(--slot); stroke-width: 2; stroke-linecap: round; }
.stub.is-down .stub-line { opacity: 0.38; stroke-dasharray: 3 4; }
.stub-host { fill: var(--slot); }
.stub-port { font-size: 12px; fill: var(--ink-3); }
.stub-caption { font-size: 12.5px; fill: var(--ink-2); }
.stub-caption.is-quiet { fill: var(--ink-3); }

/* Tracing one VLAN dims everything else on the map */
.v-el { transition: opacity 0.2s ease; }
.is-tracing .v-el:not(.is-traced) { opacity: 0.12; }
.is-tracing .halo.is-traced { opacity: 0.3; }
.is-tracing .cable,
.is-tracing .bundle-ring,
.is-tracing .hsrp-link { opacity: 0.35; }
.pulse { fill: none; stroke: #ffffff; stroke-width: 2.5; stroke-linecap: round; pointer-events: none; }

/* Legend */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 32px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.legend-title { margin-bottom: 6px; color: var(--ink-2); font-size: 12.8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.chip .swatch { margin-right: 0; }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] {
  border-color: var(--slot);
  background: var(--ground-raised);
  background: color-mix(in srgb, var(--slot) 14%, transparent);
}
.legend-help { flex-basis: 100%; color: var(--ink-3); font-size: 12.8px; }

/* Findings */

.findings h2, .addressing h2, .about h2 { margin-bottom: 20px; font-size: 25px; font-weight: 750; }
.finding-list { display: grid; gap: 22px; margin: 0; padding: 0; list-style: none; }
.finding { max-width: 68ch; padding-left: 16px; border-left: 2px solid var(--ink-3); }
.finding:target { border-left-color: var(--ink); }
.finding h3 { margin-bottom: 4px; font-size: 16px; font-weight: 700; }
.finding p { color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.finding-devices { margin-top: 6px; font-size: 14px; }
.all-clear { max-width: 60ch; color: var(--ink-2); }
.fixed-title { margin: 32px 0 10px; color: var(--ink-2); font-size: 14px; font-weight: 700; }
.fixed-list { display: grid; gap: 8px; max-width: 68ch; margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; }
.fixed-list li::marker { color: var(--ink-3); }

/* Device chapters */

.chapter { position: relative; }
.chapter.is-current { background: var(--ground-raised); }
.chapter.is-current::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--ink);
}
.hostname { font-size: 56px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.role { max-width: 36ch; margin-top: 14px; font-size: 20px; line-height: 1.4; }
.hardware { margin-top: 12px; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.chapter h3 { margin: 36px 0 12px; color: var(--ink-2); font-size: 14px; font-weight: 700; }

.faceplate { margin: 28px 0 0; }
.faceplate svg { display: block; width: auto; max-width: 100%; height: auto; }
.faceplate figcaption { max-width: 60ch; margin-top: 8px; color: var(--ink-3); font-size: 12.8px; }
.faceplate text { font-family: var(--sans); font-variation-settings: var(--facts); font-variant-numeric: tabular-nums; }
.port { stroke-width: 1.2; }
.port-access { fill: var(--slot); stroke: var(--slot); }
.port-access.is-down { fill-opacity: 0.25; stroke-opacity: 0.55; }
.port-trunk { fill: transparent; stroke: var(--routed); stroke-width: 1.6; }
.port-trunk.is-down { stroke: var(--ink-3); }
.port-unused { fill: transparent; stroke: var(--unlit); }
.port-empty { fill: transparent; stroke: var(--unlit); stroke-dasharray: 2 2; }
.port-parked { fill: transparent; stroke: var(--ink-3); }
.port-cross { stroke: var(--ink-3); stroke-width: 1.2; stroke-linecap: round; }
.port-routed, .port-switch, .port-serial { fill: transparent; stroke: var(--routed); stroke-width: 1.6; }
.port-routed.is-up, .port-switch.is-up, .port-serial.is-up { fill: rgba(220, 230, 234, 0.22); }
.port-routed.is-down, .port-switch.is-down, .port-serial.is-down { stroke: var(--ink-3); }
.port.is-shut { fill: transparent; stroke: var(--unlit); stroke-dasharray: 3 3; }
.port-number { font-size: 9.5px; fill: var(--ink-3); }
.faceplate-router .port-number { font-size: 11px; }
.port-group { font-size: 11px; fill: var(--ink-2); }
.bundle-bracket { fill: none; stroke: var(--ink-2); stroke-width: 1.2; }

.facts { display: grid; margin: 28px 0 0; }
.facts > div {
  display: grid;
  grid-template-columns: minmax(7.5rem, 10.5rem) minmax(0, 1fr);
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--rule);
}
.facts > div:last-child { border-bottom: 1px solid var(--rule); }
.facts dt { padding-top: 1px; color: var(--ink-2); font-size: 14px; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 14px 7px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
thead th { padding-top: 0; color: var(--ink-2); font-size: 12.8px; font-weight: 600; }
tbody th { font-weight: 600; white-space: nowrap; }
.num, .interfaces td:last-child { white-space: nowrap; }
tr.state-down, tr.state-shut-down { color: var(--ink-3); }
tr.state-down th, tr.state-shut-down th { color: var(--ink-2); }

.notes {
  display: grid;
  gap: 14px;
  max-width: 62ch;
  font-variation-settings: var(--notes);
  line-height: 1.65;
}
.notes strong { font-weight: 700; }

.cli {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  border-radius: 3px;
  background: var(--ground-raised);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-variation-settings: var(--cli);
  line-height: 1.5;
}
.chapter.is-current .cli { background: var(--ground); }
.cli code { font: inherit; }
.full-config { margin-top: 10px; }
.full-config summary { width: max-content; padding: 6px 0; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.full-config summary:hover { color: var(--ink); }
.full-config .cli { max-height: 32rem; margin-top: 8px; overflow: auto; }

.fix { margin-top: 16px; padding-left: 16px; border-left: 2px solid var(--ink-3); }
.fix-title { margin-bottom: 8px; font-weight: 600; }
.fix-title a { text-decoration: none; }
.fix-title a:hover { text-decoration: underline; }

.about p { max-width: 64ch; color: var(--ink-2); }
.about p + p { margin-top: 12px; }
.about a { color: var(--ink); }

/* Raw capture browser */

.captures { padding: 40px clamp(16px, 4vw, 56px) 80px; }
.captures h1 { font-size: 31px; font-weight: 800; }
.captures-grid { display: grid; grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr); gap: 40px; margin-top: 32px; }
.captures-nav h2 { margin: 20px 0 6px; font-size: 16px; }
.captures-nav h2:first-child { margin-top: 0; }
.captures-nav ul { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.captures-nav a { display: block; padding: 2px 0; color: var(--ink-2); text-decoration: none; }
.captures-nav a:hover, .captures-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

/* Narrow screens: the map sits under the intro and scrolls sideways */

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "map" "findings" "chapters" "addressing" "about";
  }
  .map { border-top: 1px solid var(--rule); border-right: 0; }
  .bar-meta { display: none; }
  .bar-print { margin-left: auto; white-space: nowrap; }
  .map, .map-inner { min-width: 0; }
  .map-inner { display: block; position: static; height: auto; padding: 16px clamp(16px, 3vw, 32px) 24px; }
  .map-scroll { display: block; overflow-x: auto; }
  .topology { min-width: 720px; height: auto; }
}

@media (max-width: 700px) {
  .bar { gap: 12px; padding-inline: 16px; }
  .bar-name, .bar-meta, .bar-print { display: none; }
  .bar-nav { overflow-x: auto; }
  .intro, .findings, .chapter, .addressing, .about { padding: 32px 16px; }
  .intro h1 { font-size: 31px; }
  .hostname { font-size: 44px; }
  .role { font-size: 18px; }
  .facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .captures-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .v-el { transition: none; }
}

/* Print: the dark screen becomes marker ink on white paper */

@page { size: A4 landscape; margin: 12mm; }

@media print {
  :root {
    --ground: #ffffff;
    --ground-raised: #f1f4f5;
    --rule: #c9d2d6;
    --ink: #1c2529;
    --ink-2: #4f5e65;
    --ink-3: #6b7a81;
    --unlit: #9aa7ad;
    --routed: #1c2529;
    --slot-a: #0f8c84;
    --slot-b: #4c8a1e;
    --slot-c: #c0620f;
    --slot-m: #c23a4c;
    color-scheme: light;
  }
  html, body { background: #ffffff; }
  body { font-size: 9.5pt; line-height: 1.45; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .bar, .legend-help, .full-config, .halos, .pulse { display: none !important; }
  .layout { display: block; }

  .intro { padding: 0 0 3mm; }
  .intro h1 { font-size: 20pt; }
  .summary { margin-top: 1mm; max-width: none; }

  .map { border: 0; }
  .map-inner { position: static; height: auto; padding: 0; }
  .topology { width: 100%; height: 132mm; }
  .node-box { fill: #ffffff; }
  .node.is-current .node-box { stroke-width: 1.5; filter: none; }
  .legend { padding-top: 2mm; }
  .chip { padding: 1mm 2.5mm; font-size: 8.5pt; }

  .findings, .chapter, .addressing, .about { padding: 0; border: 0; break-before: page; }
  .finding-list { gap: 4mm; }
  .finding { break-inside: avoid; max-width: none; }

  .chapter { columns: 2; column-gap: 10mm; background: none; }
  .chapter.is-current::before { display: none; }
  .chapter-head { column-span: all; margin-bottom: 4mm; }
  .hostname { font-size: 34pt; }
  .role { max-width: none; font-size: 12pt; }
  .chapter h3 { margin: 5mm 0 2mm; break-after: avoid; }
  .faceplate { margin-top: 0; break-inside: avoid; }
  .facts > div, tr, .notes p, .fix { break-inside: avoid; }
  table { font-size: 8.5pt; }
  th, td { padding: 1.2mm 3mm 1.2mm 0; }
  .table-scroll { overflow: visible; }
  .cli { padding: 2.5mm 3mm; font-size: 7.8pt; white-space: pre-wrap; overflow: visible; break-inside: avoid; }
  .chapter.is-current .cli { background: var(--ground-raised); }

  a { text-decoration: none; }
}
