repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
flow.cssCSS346 lines12.0 KiBraw download
/* ============================================================================
   Flow — native, on-theme flowcharts.

   These replace the old ```mermaid fences, which never rendered (Shiki has no
   mermaid grammar, so a fence printed its own source as a dead code listing).
   Nothing here is JavaScript and nothing fetches: a flow is hand-authored HTML
   (or inline SVG) drawn straight onto the page at build time.

   A flow reads as *terminal art*: the same dark plate the code panes ride, in
   both site themes, so a diagram sits in the same register as the listings it
   sits between (see prose.css — "terminal output pasted into a printed
   document"). The wrapper carries `.plate` (pins the Rosé Pine night palette
   for its subtree) and `.corners` (the cyberdeck brackets), exactly like a
   code pane, so every accent below — `--foam`, `--iris`, `--gold`, `--love`,
   `--pine` — resolves to its night value on the cream page without a single
   hardcoded hex.

   Two primitives, one look:
     • CSS-flow  — ranks of `.flow-node` boxes joined by `.flow-edge`
       connectors. Flexbox does the layout; there are no coordinates to get
       wrong. Use it for linear chains, decision fan-outs and merges.
     • SVG-flow  — an inline `<svg class="flow-svg">` using the shared node /
       edge / label classes. Use it only when the graph has back-edges, skip
       edges or many-into-one merges that a rank layout would misdraw.
   A `.flow-node` box and an `.fnode` rect share the same fill, hairline and
   font, so a reader can't tell which engine drew a given box.
   ========================================================================== */

/* ---- Wrapper ------------------------------------------------------------- */
.prose .flow {
  position: relative;
  margin-block: 1.7rem;
  max-width: min(100%, 94ch);
  background: var(--plate);
  border: 0;
  overflow: hidden;
  color: var(--fg);
}
/* Runs to the prose measure; a wide flow scrolls inside its own body rather
   than pushing the page. */
.prose .flow > * { position: relative; z-index: 2; }
.prose .flow > .scanlines { z-index: 1; opacity: 0.5; }

/* The caption behaves like a code pane's titlebar: a kind mark at the left,
   the flow direction at the right, both in the 9.5px terminal mono. */
.prose .flow__cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.15rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-term);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1;
}
.prose .flow__cap .flow__kind { color: var(--iris); }
.prose .flow__cap .flow__kind::before { content: '◇ '; opacity: 0.8; }
.prose .flow__cap .flow__dir { color: var(--fg-faint); }

.prose .flow__body {
  padding: clamp(1.05rem, 3.2vw, 1.9rem);
  overflow-x: auto;
}

/* ---- CSS-flow: ranks + edges -------------------------------------------- */
.prose .flow__diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: min-content;
}
.prose .flow__diagram[data-dir='td'] { flex-direction: column; }
.prose .flow__diagram[data-dir='lr'] { flex-direction: row; flex-wrap: wrap; }

/* A rank is one layer of the graph — a row (TD) or column (LR) of sibling
   nodes that sit at the same depth. */
.prose .flow-rank {
  display: flex;
  gap: clamp(0.7rem, 2.4vw, 1.6rem);
  align-items: stretch;
  justify-content: center;
}
.prose .flow__diagram[data-dir='lr'] .flow-rank { flex-direction: column; }

/* ---- Node --------------------------------------------------------------- */
.prose .flow-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  text-align: center;
  min-width: 8.5rem;
  max-width: 16rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--rule-hi);
  color: var(--text);
  font-family: var(--font-term);
  font-size: 12.5px;
  line-height: 1.32;
}
/* The second line of a node — what was `<br/>` in the mermaid source — reads
   as a caption under the label. Mark it up as `<span class="sub">`. */
.prose .flow-node .sub {
  color: var(--subtle);
  font-size: 10.5px;
  letter-spacing: 0.01em;
}
.prose .flow-node code {
  font-family: var(--font-term);
  font-size: 0.95em;
  background: none;
  border: 0;
  padding: 0;
  color: var(--foam);
}

/* Node roles — colour keyed the same way the SVG kit keys `.fnode` variants. */
.prose .flow-node.is-entry { border-color: var(--iris); }
.prose .flow-node.is-entry::before {
  content: 'START';
  font-size: 8px; letter-spacing: 0.2em; color: var(--iris);
  margin-bottom: 0.1rem;
}
.prose .flow-node.is-goal {
  background: color-mix(in srgb, var(--pine) 32%, var(--surface));
  border-color: var(--foam);
  color: var(--text);
}
.prose .flow-node.is-decision { border-color: var(--gold); }
.prose .flow-node.is-decision::before {
  content: '◆ DECIDE';
  font-size: 8px; letter-spacing: 0.18em; color: var(--gold);
  margin-bottom: 0.15rem;
}
.prose .flow-node.is-note {
  background: var(--overlay);
  border-style: dashed;
  color: var(--subtle);
}
.prose .flow-node.is-danger { border-color: var(--love); }
.prose .flow-node.is-danger::before {
  content: '! ';
  color: var(--love);
}

/* ---- Edge (connector) --------------------------------------------------- */
.prose .flow-edge {
  position: relative;
  align-self: center;
  flex: none;
  --edge: var(--foam);
}
/* Vertical connector (TD): a hairline with a triangle arrowhead. */
.prose .flow__diagram[data-dir='td'] > .flow-edge,
.prose .flow-lane > .flow-edge {
  width: 1px;
  height: 2.3rem;
  background: var(--edge);
  margin: 0.05rem 0;
}
.prose .flow__diagram[data-dir='td'] > .flow-edge::after,
.prose .flow-lane > .flow-edge::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -1px;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--edge);
}
/* Horizontal connector (LR). */
.prose .flow__diagram[data-dir='lr'] > .flow-edge {
  height: 1px;
  width: clamp(1.8rem, 5vw, 3rem);
  background: var(--edge);
  margin: 0 0.05rem;
}
.prose .flow__diagram[data-dir='lr'] > .flow-edge::after {
  content: '';
  position: absolute;
  top: 50%; right: -1px;
  transform: translateY(-50%);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--edge);
}
/* The label a mermaid `-->|text|` edge carried — a knockout chip centred on
   the connector so the line reads through it. */
.prose .flow-edge__label {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--plate);
  border: 1px solid var(--rule);
  color: var(--foam);
  font-family: var(--font-term);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  line-height: 1.1;
  padding: 0.1rem 0.4rem;
  white-space: nowrap;
  z-index: 3;
}
.prose .flow-edge.is-back { --edge: var(--love); background: none; }
.prose .flow-edge.is-back.is-vert,
.prose .flow__diagram[data-dir='td'] > .flow-edge.is-back { border-left: 1px dashed var(--love); width: 0; background: none; }
.prose .flow-edge.is-dotted { background: none; border-top: 1px dashed var(--foam); }

/* ---- Branch / merge ----------------------------------------------------- */
/* A decision fans out into lanes; each lane is its own little TD sub-flow
   (labelled edge → node → …). */
.prose .flow-branches {
  display: flex;
  gap: clamp(0.9rem, 4vw, 2.6rem);
  align-items: flex-start;
  justify-content: center;
}
.prose .flow-lane {
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* A join bar collects several lanes back into one node: a hairline spanning
   the lanes with a single arrow dropping to the shared node below. */
.prose .flow-join {
  position: relative;
  align-self: stretch;
  height: 1.6rem;
  margin-top: 0.1rem;
  /* Room for the drop line and arrowhead below; the diagram has no gap. */
  margin-bottom: 1.55rem;
  border-top: 1px solid var(--foam);
  border-left: 1px solid var(--foam);
  border-right: 1px solid var(--foam);
}
.prose .flow-join::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -1.5rem;
  width: 1px; height: 1.5rem;
  background: var(--foam);
  transform: translateX(-50%);
}
/* Arrowhead where the gather-bracket drops into the shared node below. */
.prose .flow-join::before {
  content: '';
  position: absolute;
  left: 50%; bottom: -1.55rem;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--foam);
  z-index: 1;
}

/* ---- SVG-flow ----------------------------------------------------------- */
/* One inline <svg class="flow-svg"> per complex graph, drawn on an orthogonal
   grid. Every colour comes from a token resolved in the `.plate` subtree, so
   the diagram flips with the theme like everything else. */
.prose .flow-svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  min-width: 0;
  font-family: var(--font-term);
  overflow: visible;
}
.prose .flow-svg text { fill: var(--text); }

/* Node box + label. */
.prose .flow-svg .fnode__box {
  fill: var(--surface);
  stroke: var(--rule-hi);
  stroke-width: 1;
}
.prose .flow-svg .fnode__label { fill: var(--text); font-size: 13px; }
.prose .flow-svg .fnode__label .sub { fill: var(--subtle); font-size: 11px; }

/* Node roles mirror the CSS-flow ones. */
.prose .flow-svg .is-entry .fnode__box { stroke: var(--iris); stroke-width: 1.4; }
.prose .flow-svg .is-goal .fnode__box { fill: color-mix(in srgb, var(--pine) 34%, var(--surface)); stroke: var(--foam); }
.prose .flow-svg .is-note .fnode__box { fill: var(--overlay); stroke: var(--rule); stroke-dasharray: 4 3; }
.prose .flow-svg .is-note .fnode__label { fill: var(--subtle); }
.prose .flow-svg .is-danger .fnode__box { stroke: var(--love); }

/* Decision diamond. */
.prose .flow-svg .fdecision__poly { fill: var(--overlay); stroke: var(--gold); stroke-width: 1; }
.prose .flow-svg .fdecision__label { fill: var(--text); font-size: 12px; }
/* A text-heavy decision that won't fit a diamond: a gold-bordered rect node,
   matching the CSS-flow `.is-decision` box. */
.prose .flow-svg .is-decision .fnode__box { fill: var(--overlay); stroke: var(--gold); }

/* Edges. `context-stroke` on the arrowhead makes one shared marker take each
   edge's own colour, so a foam forward edge and a love back-edge point in
   their own ink from a single <marker> def. */
.prose .flow-svg .fedge {
  fill: none;
  stroke: var(--foam);
  stroke-width: 1.5;
}
.prose .flow-svg .fedge.is-back { stroke: var(--love); stroke-dasharray: 5 3; }
.prose .flow-svg .fedge.is-dotted { stroke: var(--foam); stroke-dasharray: 2 3; }
.prose .flow-svg .fedge.is-thick { stroke: var(--iris); stroke-width: 2.4; }

/* Edge label — a knockout chip like the CSS-flow one. */
.prose .flow-svg .felabel__box { fill: var(--plate); stroke: var(--rule); stroke-width: 1; }
.prose .flow-svg .felabel__text { fill: var(--foam); font-size: 11px; }

/* The shared arrowhead marker lives once, hidden, in the sheet layout
   (see Base.astro). These fallbacks apply if a diagram ships its own <defs>. */
.prose .flow-svg .flow-arrow { fill: context-stroke; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 620px) {
  /* An LR chain becomes a TD stack on a phone: the row wraps and each edge
     turns to point down. */
  .prose .flow__diagram[data-dir='lr'] { flex-direction: column; }
  .prose .flow__diagram[data-dir='lr'] > .flow-edge {
    width: 1px;
    height: 1.9rem;
    margin: 0.05rem 0;
  }
  .prose .flow__diagram[data-dir='lr'] > .flow-edge::after {
    top: auto; right: auto;
    left: 50%; bottom: -1px;
    transform: translateX(-50%);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid var(--edge);
    border-bottom: 0;
  }
  .prose .flow-node { min-width: 7rem; font-size: 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  /* Motion is opt-in across the site; the flow is static furniture and adds
     none of its own. */
}