/* ==========================================================================
   "Follow the evidence." — header, controls and the animated SVG diagram
   (the SVG itself is generated by js/flow.js)
   ========================================================================== */

.evidence {
  margin-top: clamp(30px, 5vw, 44px);
  padding-top: clamp(22px, 3.4vw, 30px);
  border-top: 1px solid var(--line);
}

.evidence__head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 6px;
}

.evidence__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.6vw, 3.4rem);
  font-weight: var(--evidence-weight);
  line-height: 1.05;
  letter-spacing: -0.015em;
}

:root[data-theme="dark"] .evidence__title {
  letter-spacing: 0;
}

.evidence__controls {
  display: flex;
  gap: 8px;
}

.evidence__lead {
  grid-column: 1 / -1;
  font-size: clamp(0.95rem, 1.8vw, 1.06rem);
  color: var(--ink-soft);
}

.ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--ctrl-border);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.ctrl-btn .icon {
  font-size: 17px;
}

.ctrl-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.ctrl-btn:active {
  transform: scale(0.97);
}

.ctrl-btn[data-flow-action="replay"]:hover .icon {
  animation: spin 0.7s var(--ease-io) 1 reverse;
}

/* -------------------------------- Diagram -------------------------------- */

.flow {
  margin-top: clamp(8px, 2vw, 16px);
}

.flow__svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Background network */
.net-line {
  fill: none;
  stroke: var(--net-line);
  stroke-width: 1;
  transition: stroke 0.9s ease;
}

.net-node {
  animation: net-float var(--dur, 8s) ease-in-out var(--delay, 0s) infinite alternate;
}

.net-dot {
  fill: var(--net-dot);
}

.net-ring {
  fill: none;
  stroke: var(--net-dot);
  stroke-width: 1.2;
}

.net-icon__bg {
  fill: var(--bg);
  stroke: var(--net-icon);
  stroke-width: 1.2;
  transition: fill var(--theme-fade) ease;
}

.net-icon__glyph {
  fill: none;
  stroke: var(--net-icon);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Connectors */
.flow__main {
  transition: opacity 0.6s ease;
}

.evidence.is-fading .flow__main {
  opacity: 0;
}

.flow-link__ghost {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.2;
  stroke-dasharray: 2 7;
  stroke-linecap: round;
  opacity: 0.45;
}

.flow-link__line {
  fill: none;
  stroke: var(--flow-line);
  stroke-width: var(--flow-line-w);
}

.flow-link__dot {
  fill: var(--flow-line);
  stroke: var(--bg);
  stroke-width: 3;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.2);
  transition: opacity 0.3s ease, transform 0.5s var(--ease-back);
}

.flow-link__dot.is-on {
  opacity: 1;
  transform: scale(1);
}

.flow-link__chev {
  fill: none;
  stroke: var(--flow-line);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.flow-link__chev.is-on {
  opacity: 1;
}

.flow-link__pulse {
  fill: var(--flow-line);
  opacity: 0;
  filter: drop-shadow(0 0 7px var(--glow));
}

/* Nodes */
.node-disc {
  fill: var(--node-fill-idle);
  stroke: var(--node-stroke-idle);
  stroke-width: var(--node-stroke-w-idle);
  transition: fill 0.5s ease, stroke 0.5s ease, stroke-width 0.5s ease;
}

.node-inner {
  fill: none;
  stroke: var(--node-ring-inner);
  stroke-width: 1.2;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.node-icon {
  fill: none;
  stroke: var(--node-icon-idle);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--node-icon-idle);
  transition: stroke 0.5s ease, color 0.5s ease;
}

.node-halo {
  fill: none;
  stroke: var(--halo);
  stroke-width: 1;
  opacity: 0.35;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.7s ease;
}

.node-halo--inner {
  stroke-dasharray: 1 4;
  stroke-linecap: round;
  animation: spin 50s linear infinite;
}

.node-halo--outer {
  stroke-dasharray: 2 8;
  stroke-linecap: round;
  animation: spin 80s linear infinite reverse;
}

.node-pulse,
.node-ripple {
  fill: none;
  stroke: var(--flow-line);
  stroke-width: 1.5;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.flow-node-wrap.is-active .node-disc {
  fill: var(--node-fill);
  stroke: var(--node-stroke);
  stroke-width: var(--node-stroke-w);
}

.flow-node-wrap.is-active .node-inner {
  opacity: 0.8;
}

.flow-node-wrap.is-active .node-icon {
  stroke: var(--node-icon);
  color: var(--node-icon);
}

.flow-node-wrap.is-active .node-halo {
  opacity: 0.95;
}

.flow-node-wrap.is-active .node-pulse {
  animation: node-pop 1.1s var(--ease-out) 1 both;
}

.flow-node-wrap.is-active .node-disc,
.flow-node-wrap.is-active .node-icon {
  animation: node-bump 0.7s var(--ease-back) 1 both;
  transform-box: fill-box;
  transform-origin: center;
}

/* Labels */
.flow-num,
.flow-title,
.flow-sub {
  text-anchor: middle;
  transition: opacity 0.5s ease, fill 0.5s ease;
}

.flow-num {
  font-family: var(--font-mono);
  font-size: 15px;
  fill: var(--ink);
}

.flow-title {
  font-family: var(--flow-title-font);
  font-weight: var(--flow-title-weight);
  font-size: 17px;
  fill: var(--ink);
}

.flow-sub {
  font-family: var(--font-sans);
  font-size: 13.5px;
  fill: var(--ink-soft);
}

.flow-label {
  opacity: 0.4;
}

.flow-node-wrap.is-active .flow-label {
  opacity: 1;
}

/* "Evidence found" end state */
.evidence.is-complete .net-line {
  stroke: var(--net-line-on);
}

.evidence.is-complete .flow-node-wrap:last-of-type .node-ripple {
  animation: ripple 3s var(--ease-out) infinite;
}

.evidence.is-complete .flow-node-wrap:last-of-type .node-ripple--b {
  animation-delay: 1.5s;
}

.evidence.is-complete .flow-link__dot {
  animation: dot-pulse 2.4s ease-in-out infinite;
}

.evidence.is-complete .node-halo--outer {
  animation: spin 80s linear infinite reverse, halo-breathe 3s ease-in-out infinite;
}

/* Paused: freeze every CSS animation inside the section */
.evidence.is-paused .flow *,
.evidence.is-paused .flow *::before {
  animation-play-state: paused !important;
}
