/* Styles for assets/flow-view.js — the agent workflow diagram.
   Tokens come from falaq-2026.css (loaded directly on the home page, via the
   @import in company-pages.css everywhere else). No local :root here. */

.flow-canvas { max-width: 640px; margin: var(--x4) auto 0; }

.fx { display: grid; margin: 0; padding: 0; gap: 0; list-style: none; }

.fx-node {
  position: relative;
  padding: 12px var(--x3);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--s-1);
}

/* Connector between consecutive rows. */
.fx > li + li { margin-top: var(--x4); }
.fx > li + li::before {
  position: absolute;
  top: calc(var(--x4) * -1);
  inset-inline-start: 50%;
  width: 1px;
  height: var(--x4);
  background: linear-gradient(var(--line-hi), var(--acc));
  content: "";
}

.fx-label {
  display: block;
  color: var(--acc-lo);
  font-family: var(--f-data);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
}
html[dir="rtl"] .fx-label { letter-spacing: 0; text-transform: none; font-family: var(--f-body); font-weight: 700; }

.fx-text { display: block; margin-top: var(--x1); color: var(--ink-2); font-size: .875rem; line-height: 1.6; }

.fx-trigger { border-color: var(--line-hi); background: var(--s-2); }
.fx-decision { border-color: var(--line-accent); background: var(--acc-dim); }
.fx-log { border-style: dashed; background: transparent; }

/* Clickable service workflow — scoped so the home-page preview stays light. */
[data-flow-interactive] .fx-node,
[data-flow-interactive] .fx-branch {
  cursor: pointer;
  transition: border-color .22s ease, background-color .22s ease, box-shadow .22s ease, transform .22s ease, opacity .22s ease;
}
[data-flow-interactive] .fx-node:hover,
[data-flow-interactive] .fx-branch:hover,
[data-flow-interactive] :is(.fx-node,.fx-branch):focus-visible {
  z-index: 2; border-color: var(--acc-lo); background: var(--s-2); transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(77,163,255,.08), 0 14px 34px rgba(0,0,0,.24); outline: none;
}
[data-flow-interactive] :is(.fx-node,.fx-branch).is-past { border-color: rgba(77,163,255,.28); opacity: .78; }
[data-flow-interactive] :is(.fx-node,.fx-branch).is-active {
  z-index: 3; border-color: rgba(141,214,255,.72); background: linear-gradient(145deg,rgba(26,109,255,.18),rgba(77,163,255,.06)),var(--s-2);
  box-shadow: 0 0 0 1px rgba(141,214,255,.2),0 0 34px rgba(77,163,255,.22),inset 0 0 24px rgba(26,109,255,.08);
}
[data-flow-interactive] :is(.fx-node,.fx-branch).is-active .fx-label,
[data-flow-interactive] :is(.fx-node,.fx-branch).is-active .fx-tag { color: #dff5ff; }
[data-flow-interactive] :is(.fx-node,.fx-branch).fx-ping { animation: fxPing .62s ease both; }
@keyframes fxPing {
  0% { box-shadow: 0 0 0 0 rgba(77,163,255,.48),0 0 20px rgba(77,163,255,.18); }
  70% { box-shadow: 0 0 0 14px rgba(77,163,255,0),0 0 42px rgba(77,163,255,.34); }
  100% { box-shadow: 0 0 0 1px rgba(141,214,255,.2),0 0 34px rgba(77,163,255,.22); }
}

.fx-explain {
  position: relative; margin-top: var(--x4); padding: var(--x4); overflow: hidden;
  border: 1px solid var(--line-accent); border-radius: var(--r-lg);
  background: radial-gradient(circle at 90% 0,rgba(77,163,255,.12),transparent 42%),var(--s-1);
}
.fx-explain::before { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 3px; background: linear-gradient(var(--acc-lo),var(--acc)); content: ""; box-shadow: 0 0 18px var(--acc); }
.fx-explain-kicker { display: block; margin-bottom: var(--x2); color: var(--acc-lo); font-family: var(--f-data); font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
html[dir="rtl"] .fx-explain-kicker { font-family: var(--f-body); letter-spacing: 0; text-transform: none; }
.fx-explain strong { display: block; color: var(--ink); font-size: 1rem; }
.fx-explain p { margin: 7px 0 0 !important; color: var(--ink-2); font-size: .9rem !important; line-height: 1.7; }
.fx-explain small { display: block; margin-top: var(--x3); color: var(--ink-3); font-size: .72rem; }
.fx-explain-close { display: none; position: absolute; top: 10px; inset-inline-end: 10px; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line-hi); border-radius: 50%; background: var(--s-2); color: var(--ink); font-size: 1.1rem; cursor: pointer; }

/* The fork is where the guardrail becomes visible, so both outcomes sit at the
   same weight — the blocked branch is not styled as an error. */
.fx-fork { position: relative; }
.fx-branches { display: grid; margin: 0; padding: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--x2); list-style: none; }
.fx-branch { padding: 12px var(--x3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--s-1); }
.fx-tag { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); font-family: var(--f-data); font-size: .6875rem; font-weight: 600; }
.fx-yes { border-color: rgba(74, 222, 128, .3); }
.fx-yes .fx-tag { background: rgba(74, 222, 128, .12); color: var(--ok); }
.fx-no { border-color: rgba(251, 191, 36, .3); }
.fx-no .fx-tag { background: rgba(251, 191, 36, .12); color: var(--hold); }

.fx-in > .fx > li { animation: fxIn .34s ease both; }
.fx-in > .fx > li:nth-child(2) { animation-delay: .05s; }
.fx-in > .fx > li:nth-child(3) { animation-delay: .1s; }
.fx-in > .fx > li:nth-child(4) { animation-delay: .15s; }
.fx-in > .fx > li:nth-child(5) { animation-delay: .2s; }
.fx-in > .fx > li:nth-child(6) { animation-delay: .25s; }
@keyframes fxIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .fx-in > .fx > li { animation: none; }
  [data-flow-interactive] :is(.fx-node,.fx-branch).fx-ping { animation: none; }
  [data-flow-interactive] .fx-node,
  [data-flow-interactive] .fx-branch { transition: none; }
}

@media (max-width: 640px) {
  .fx-branches { grid-template-columns: minmax(0, 1fr); }
  .fx-explain { position: fixed; z-index: 180; inset-inline: 12px; bottom: 12px; max-height: min(46dvh,360px); margin: 0; padding: 22px; padding-inline-end: 52px; overflow-y: auto; opacity: 0; translate: 0 calc(100% + 24px); pointer-events: none; box-shadow: 0 24px 70px rgba(0,0,0,.72),0 0 0 1px rgba(141,214,255,.1); transition: opacity .22s ease,translate .22s ease; }
  .fx-explain.is-open { opacity: 1; translate: 0 0; pointer-events: auto; }
  .fx-explain-close { display: grid; }
}
