/* =============================================================================================
   SecNCode — interaction effects (both themes)
   Radar pings and new targets, hexagon spotlight,
   number count-up and divider draw-in. Driven by assets/js/effects.js.
   Mouse effects only run on devices with a precise pointer; everything is off for
   visitors who prefer reduced motion.
   ============================================================================================= */

/* ---------- Radar: pings when the sweep passes, and new targets ---------- */
.radar .is-pinged {
  animation: radarPing 0.9s var(--ease-out);
}
.radar .dot-blue.is-pinged {
  animation: radarPingBlue 0.9s var(--ease-out);
}
@keyframes radarPing {
  0% {
    fill: #ffffff;
  }
  25% {
    fill: var(--red);
  }
  100% {
    fill: var(--red);
  }
}
@keyframes radarPingBlue {
  0% {
    fill: var(--red);
    fill-opacity: 1;
  }
  100% {
    fill-opacity: 0.45;
  }
}
.radar .fx-echo {
  fill: none;
  stroke: var(--red);
  stroke-width: 1.5;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}
.radar .fx-echo.is-on {
  animation: radarEcho 1.1s var(--ease-out) forwards;
}
@keyframes radarEcho {
  0% {
    opacity: 0.9;
    transform: scale(0.4);
  }
  100% {
    opacity: 0;
    transform: scale(2.6);
  }
}
.radar .fx-target {
  fill: var(--blue);
  opacity: 0;
  transition:
    opacity 1.2s ease,
    fill 0.3s ease;
}
.radar .fx-target.is-visible {
  opacity: 0.5;
}
.radar .fx-target.is-pinged {
  fill: var(--red);
  opacity: 1;
  transition:
    opacity 0.2s ease,
    fill 0.15s ease;
}
.radar .fx-target.is-leaving {
  opacity: 0;
  transition: opacity 1.6s ease;
}
:root[data-theme="dark"] .radar .fx-target {
  fill: #a9baf5;
}
:root[data-theme="dark"] .radar .fx-target.is-pinged {
  fill: var(--red);
}

/* ---------- Hexagon spotlight (hexagon backgrounds glow around the cursor) ---------- */
.fx-hexhost {
  isolation: isolate;
}
.fx-hexspot {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 1 54 16v30L28 61 2 46V16z M28 61v36 M0 97V82 M56 97V82' fill='none' stroke='%23ffffff' stroke-opacity='.55' stroke-width='1.4'/%3E%3C/svg%3E");
  background-size: 56px 97px;
  -webkit-mask-image: radial-gradient(
    circle 190px at var(--fx-x, 50%) var(--fx-y, 50%),
    #000 0%,
    rgba(0, 0, 0, 0.35) 45%,
    transparent 75%
  );
  mask-image: radial-gradient(
    circle 190px at var(--fx-x, 50%) var(--fx-y, 50%),
    #000 0%,
    rgba(0, 0, 0, 0.35) 45%,
    transparent 75%
  );
  transition: opacity 0.35s ease;
}
.fx-hexhost.is-lit > .fx-hexspot {
  opacity: 1;
}
/* hexagons drawn in blue on light backgrounds (page headers, 404) */
.page-hero > .fx-hexspot,
.nf > .fx-hexspot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 1 54 16v30L28 61 2 46V16z M28 61v36 M0 97V82 M56 97V82' fill='none' stroke='%23273F99' stroke-opacity='.28' stroke-width='1.4'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .page-hero > .fx-hexspot,
:root[data-theme="dark"] .nf > .fx-hexspot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 1 54 16v30L28 61 2 46V16z M28 61v36 M0 97V82 M56 97V82' fill='none' stroke='%23A9BAF5' stroke-opacity='.3' stroke-width='1.4'/%3E%3C/svg%3E");
}

.fx-pos {
  position: relative;
}

/* ---------- Number count-up ---------- */
.fx-count {
  font-variant-numeric: tabular-nums;
}
.fx-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Divider draw-in: the red segment first, then the blue line ---------- */
.js .fx-draw {
  transform: none !important;
  clip-path: inset(0 100% 0 0);
}
.js .fx-draw.is-drawn {
  animation: drawRule 1.3s var(--ease-out) forwards;
}
@keyframes drawRule {
  0% {
    clip-path: inset(0 100% 0 0);
  }
  35% {
    clip-path: inset(0 70% 0 0);
  }
  55% {
    clip-path: inset(0 70% 0 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}
.js .rule--center.fx-draw {
  clip-path: inset(0 50% 0 50%);
}
.js .rule--center.fx-draw.is-drawn,
.js .nf .fx-draw.is-drawn,
.js .section-head--center .fx-draw.is-drawn {
  animation: drawRuleCenter 1s var(--ease-out) forwards;
}
.js .nf .fx-draw,
.js .section-head--center .fx-draw {
  clip-path: inset(0 50% 0 50%);
}
@keyframes drawRuleCenter {
  from {
    clip-path: inset(0 50% 0 50%);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* ---------- Reduced motion: no effects at all ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-hexspot,
  .radar .fx-target,
  .radar .fx-echo {
    display: none !important;
  }
  .js .fx-draw {
    clip-path: none !important;
    animation: none !important;
  }
  .radar .is-pinged {
    animation: none !important;
  }
}
