/* 06 / How it works, automation 08 (AI inbox assistant): overrides on top of flow.css.
   Gold key node, green team tags, a 6-column diagram whose one wide gap holds the "sales lead or
   support" label, the trace status line, the scroll hint, the dashed daily-summary key, and the
   example architecture (three lanes, four outputs from the triage agent). */

/* ---------- 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 .ia-flow-status {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--ash);
  min-height: 1.5em;
}

#how .ia-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;
}

#how .flow-ctl[data-ia-act="toggle"] {
  min-width: 96px;
}

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

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

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

/* ---------- Diagram grid ----------
   The nodes sit in the odd tracks (--c 1, 3, 5, 7, 9, 11 are the six node columns); the even tracks
   are 34px gaps where the arrows run. The gap between "classify" and "route" is wider (120px) so
   the two-line label "sales lead or support" sits on its own arrow. Every node has the same
   height, so each row's centres line up. Four rows: the accounts branch sits above, partnership
   and spam below. */

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

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

/* Key: "How to read it" fills the empty top-left cell, above the first node */
#how .flow-key {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  padding-top: 0;
}

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

/* Tags sit inside the card, above its label: a green one for a person, a gold one for the key */
#how .ia-flow-tag {
  align-self: flex-start;
  max-width: 100%;
  margin-bottom: 2px;
  padding: 2px 7px;
  border: 1px solid;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Focus can reach a control without it being hidden under the top bar */
#how .flow-dia-scroll,
#how .flow-canvas-scroll,
#how .flow-ctl,
#how .flow-seg-b {
  scroll-margin-top: 96px;
}

/* Done nodes: a lighter surface and a gold-tinted hairline, so the route taken reads at a glance */
#how .flow-node.is-done {
  background: var(--elev-2);
  border-color: rgb(255 255 255 / 0.4);
}

#how .flow-node.is-done .flow-node-l {
  color: var(--bone);
}

/* The route taken stays gold at reduced opacity, its arrowhead filled; untouched branches stay dim */
#how .flow-e.is-done:not(.ia-e-team) {
  stroke: rgb(255 255 255 / 0.55);
}

#how .flow-arrow.is-done:not(.ia-e-team) {
  fill: rgb(255 255 255 / 0.7);
  stroke: rgb(255 255 255 / 0.7);
}

#how .ia-flow-tag--team {
  border-color: hsl(152 60% 48% / 0.6);
  color: var(--ok);
}

#how .ia-flow-tag--key {
  border-color: rgb(255 255 255 / 0.6);
  color: var(--accent);
}

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

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

/* Team node: a person steps in */
#how .flow-node.ia-flow-node--team {
  border-color: hsl(152 60% 48% / 0.45);
}

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

#how .flow-node.ia-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);
}

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

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

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

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

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

/* The daily-summary key is a drawn swatch in the same dash pattern as the summary edge */
#how .flow-legend-r {
  margin-left: auto;
}

#how .ia-flow-loopkey {
  display: block;
  flex: none;
  width: 22px;
  height: 8px;
  color: var(--bone-70);
  overflow: visible;
}

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

#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);
}

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

@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;
    min-height: 44px;
    text-align: center;
  }

  #how .ia-flow-status {
    min-height: 3em;
  }
}

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

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

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

/* The triage agent is taller so its four outputs fan out with room between them */
#how .flow-cn[data-ia-an="agent"] {
  height: 120px;
}

/* 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;
}

/* The agent node label wraps rather than truncating */
#how .flow-cn[data-ia-an="agent"] .flow-cn-t b {
  white-space: normal;
  line-height: 1.25;
}

/* Phones: shorter node rows, so the diagram has less empty height below its first row */
@media (max-width: 640px) {
  #how .flow-dia {
    row-gap: 18px;
  }

  #how .flow-dia > .flow-node {
    height: 96px;
  }
}
