/* 06 / How it works, automation 06 (client reactivation agent): overrides on top of flow.css.
   A 6 x 4 diagram grid with a decision column, the gold "Reactivated" key node, green team nodes,
   a dashed skip node, the "How to read it" key in the top row, and the example architecture with
   its lanes. Every selector is scoped under #how. */

/* ---------- Trace ---------- */

/* The text and the status keep the room of the longest case (three lines of text, one line of
   status on wide screens, two on phones), so the diagram below never moves during a trace. */
#how .ra-flow-status {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ash);
  min-height: 1.5em;
}

#how .ra-flow-status.is-empty {
  visibility: hidden;
}

#how .flow-trace-text {
  max-width: 72ch;
  min-height: 4.05em;
  -webkit-line-clamp: 3;
}

#how .flow-caption {
  text-wrap: pretty;
}

/* ---------- Scroll hint: shown only where a region scrolls sideways ---------- */

#how .ra-flow-swipe {
  display: none;
  margin: 0 0 10px;
  padding: 12px 16px 0;
  color: var(--ash);
}

#how .ra-flow-swipe:has(+ .flow-scrollwrap.is-scrollable) {
  display: block;
}

/* ---------- Diagram grid: 6 node columns x 4 rows ----------
   Node columns are the odd tracks (1, 3, 5, 7, 9, 11). Track 6 (64px) gives the follow-up loop's
   label room; track 8 (184px) is the decision column where the four reply branches fan out. The
   empty top row between "export" and the branch column holds the "How to read it" key. */

#how .flow-dia {
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr) 64px minmax(0, 1fr) 184px minmax(0, 1fr) 34px minmax(0, 1fr);
  grid-template-rows: repeat(4, auto);
  column-gap: 0;
  row-gap: 34px;
  min-width: 1240px;
}

#how .flow-dia > .flow-node {
  align-self: center;
  height: 112px;
}

/* Key: "How to read it" sits in the empty top row, above the send and segment nodes */
/* The key sits in the empty bottom-left of the diagram (row 4), so the left column is balanced */
#how .flow-key {
  grid-column: 1 / span 4;
  grid-row: 4;
  align-self: end;
  padding-top: 0;
}

#how .ra-flow-key-sw--team {
  border-color: var(--ok);
  background: hsl(152 60% 48% / 0.14);
}

/* Skip: a dashed card, "never messaged". Lit states use the usual solid border. */
#how .flow-node.ra-flow-node--skip {
  border-style: dashed;
  border-color: hsl(34 10% 26%);
}

#how .flow-node.ra-flow-node--skip.is-done {
  border-style: solid;
  border-color: hsl(34 10% 24%);
}

#how .flow-node.ra-flow-node--skip.is-on {
  border-style: solid;
  border-color: var(--accent);
}

/* Key node: the booking that closes the loop is gold */
#how .flow-node.ra-flow-node--key {
  border-color: rgb(255 255 255 / 0.5);
}

#how .flow-node.ra-flow-node--key.is-done {
  border-color: rgb(255 255 255 / 0.7);
}

#how .ra-flow-tag-key {
  border-color: rgb(255 255 255 / 0.6);
  color: var(--accent);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  max-width: calc(100% - 12px);
  white-space: nowrap;
}

/* Team node: a person steps in. Its tag sits on the top edge, left-aligned, and never wraps. */
#how .flow-node.ra-flow-node--team {
  border-color: hsl(152 60% 48% / 0.45);
}

#how .flow-node.ra-flow-node--team.is-done {
  border-color: hsl(152 60% 48% / 0.6);
}

#how .flow-node.ra-flow-node--team.is-on {
  border-color: var(--ok);
  background: hsl(152 60% 48% / 0.07);
  box-shadow: 0 0 0 4px hsl(152 60% 48% / 0.12), 0 18px 40px -24px hsl(152 60% 48% / 0.6);
}

#how .ra-flow-tag-team {
  left: 8px;
  border-color: hsl(152 60% 48% / 0.6);
  color: var(--ok);
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Team edges: green when idle-but-reached, brighter once run */
#how .flow-e.ra-e-team {
  stroke: hsl(152 60% 48% / 0.35);
}

#how .flow-e.ra-e-team.is-done {
  stroke: hsl(152 60% 48% / 0.75);
}

#how .flow-run.ra-run-team {
  stroke: var(--ok);
}

/* ---------- Edge labels: ink pills on their own edge ---------- */

#how .flow-elabel {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  fill: var(--bone-70);
}

#how .flow-elab-bg {
  fill: var(--ink);
  stroke: var(--ink);
  stroke-width: 2;
}

/* ---------- Legend ---------- */

#how .flow-legend-r {
  margin-left: auto;
}

#how .ra-flow-dot--team {
  background: var(--ok);
}

/* The loop key is a drawn swatch in the same dash pattern as the loop edge */
#how .ra-flow-loopkey {
  display: block;
  flex: none;
  width: 22px;
  height: 8px;
  color: var(--bone-70);
  overflow: visible;
}

/* ---------- Segmented control: wraps cleanly on phones ---------- */

@media (max-width: 640px) {
  #how .flow-seg {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    border-radius: 18px;
  }

  #how .flow-seg-b {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* ---------- Example architecture ---------- */

#how .flow-canvas {
  width: 1200px;
  height: 460px;
}

#how .flow-cn {
  width: 200px;
}

/* Sub-nodes grow with their text, keeping 10px of air above and below it */
#how .flow-cn--sub {
  width: 172px;
  height: auto;
  min-height: 48px;
  padding: 10px 14px 10px 8px;
  border-radius: 24px;
}

#how .flow-cn--sub .flow-cn-t small {
  font-size: 12px;
  line-height: 1.3;
  text-wrap: balance;
}

/* ---------- Diagram, phone sizes ---------- */

@media (max-width: 640px) {
  #how .ra-flow-status {
    min-height: 3em;
  }

  #how .flow-dia {
    column-gap: 0;
    min-width: 1240px;
  }
}

/* Phones: the window title drops its lead, so "Example architecture" is never cut off */
@media (max-width: 600px) {
  #how .flow-win-lead {
    display: none;
  }
}

/* Phones: segment buttons keep a 44px tap height */
@media (max-width: 600px) {
  #how .flow-seg-b {
    min-height: 44px;
  }
}
