/* cyber-fx: optional "cyber" animations (hero network, heading decrypt,
   card scan, hero scan line). Paired with /assets/js/cyber-fx.js.
   To remove: set cyberFx: false in src/config.mjs and rebuild
   (or delete both files and their two tags in src/lib/templates.mjs). */

:root {
  --cfx-line: 127, 196, 187;      /* network links, site teal */
  --cfx-node: 143, 207, 196;
  --cfx-packet: 196, 238, 230;
  --cfx-shield: 127, 196, 187;
  --cfx-malware: 240, 112, 86;    /* coral: clearly not the amber "detection" colour */
  --cfx-flash: 242, 169, 59;      /* amber, same as "fired" on the site */
  --cfx-scan: 143, 207, 196;
}
:root[data-theme="light"] {
  --cfx-line: 15, 106, 98;
  --cfx-node: 15, 106, 98;
  --cfx-packet: 8, 92, 84;
  --cfx-shield: 15, 106, 98;
  --cfx-malware: 196, 66, 40;
  --cfx-flash: 200, 120, 10;
  --cfx-scan: 15, 106, 98;
}

/* The network takes over the hero stage; the original flow visual is hidden
   but keeps its box, so the layout does not change. */
.hero .hero-flow > canvas,
.hero .hero-flow > .flow-labels { display: none; }

.cfx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none;
  /* keep the text side calm: the network fades out behind the copy */
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.2) 0, rgba(0,0,0,.24) calc(100% - 19rem), #000 calc(100% - 14.5rem));
  mask-image: linear-gradient(180deg, rgba(0,0,0,.2) 0, rgba(0,0,0,.24) calc(100% - 19rem), #000 calc(100% - 14.5rem)); }
@media (min-width: 960px) {
  .cfx-canvas {
    -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.2) 0, rgba(0,0,0,.26) 38%, #000 58%);
    mask-image: linear-gradient(90deg, rgba(0,0,0,.2) 0, rgba(0,0,0,.26) 38%, #000 58%);
  }
}

/* terminal-style status line, bottom right of the hero */
.cfx-term {
  position: absolute; z-index: 2; right: var(--gutter); bottom: .9rem;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .04em; line-height: 1.4;
  color: var(--text-faint); white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s;
}
.cfx-term.is-on { opacity: 1; transform: none; }
.cfx-term .ok { color: rgb(var(--cfx-node)); }
.cfx-term .alert { color: var(--accent-text); }
.cfx-term .caret { display: inline-block; width: .55em; height: 1em; margin-left: .2em; vertical-align: -.15em; background: currentColor; opacity: .6; }
@media (min-width: 960px) {
  .cfx-term { right: max(var(--gutter), calc((100% - var(--page-width)) / 2)); bottom: 1.6rem; font-size: .75rem; }
}

/* service cards: fade in from below, thin scan line on hover */
.cfx-card { position: relative; overflow: hidden; }
.cfx-card::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(var(--cfx-scan), .85) 30%, rgba(var(--cfx-scan), .85) 70%, transparent);
  box-shadow: 0 0 10px rgba(var(--cfx-scan), .35);
}
.cfx-pending { opacity: 0; transform: translateY(18px); }
.cfx-shown { transition: opacity .7s var(--ease), transform .7s var(--ease); }

@media (prefers-reduced-motion: no-preference) {
  .cfx-card:hover::after { animation: cfx-card-scan 1.2s cubic-bezier(.45, .05, .55, .95) 1 both; }
}
@keyframes cfx-card-scan {
  0% { top: 0; opacity: 0; }
  12% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: calc(100% - 2px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cfx-pending { opacity: 1; transform: none; }
  .cfx-term { display: none; }
}
@media print { .cfx-canvas, .cfx-term { display: none !important; } }
