/* ==========================================================================
   TRIOXSEC — fx.css
   Visual polish + interaction layer: display type, contrast fixes, cursor
   spotlights, animated borders, hero network canvas, glitch, scroll progress.
   Loaded after base.css / sections.css. Everything degrades to the static
   design without JS, and collapses under prefers-reduced-motion.
   ========================================================================== */

/* ---------- self-hosted type (falls back to system stack if absent) ---------- */
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/SpaceGrotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/JetBrainsMono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

@property --ang {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

:root {
  --font-display: "Space Grotesk", var(--font-sans);
  /* lift the low-contrast greys — the old --faint was near-black on black */
  --muted: #a1979a;
  --faint: #7d7275;
}

h1, h2, h3, h4,
.brand__name,
.stat__value { font-family: var(--font-display); }

/* gradient headings */
.head h2,
.cta h2,
.page-head h1,
.hero h1 .line:first-child {
  background: linear-gradient(180deg, #ffffff 35%, #c7b9ba);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- brand: TRIOX white, SECURITY red — matches the logo ---------- */
.brand__name { color: #fff; }
.brand__sub { color: var(--red-hot); font-weight: 600; }
.brand__mark {
  filter: drop-shadow(0 0 6px rgba(216, 31, 31, 0.35));
  animation: markPulse 4.5s ease-in-out infinite;
}
.brand:hover .brand__mark {
  transform: rotate(-6deg) scale(1.08);
  filter: drop-shadow(0 0 12px rgba(216, 31, 31, 0.8));
}
@keyframes markPulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(216, 31, 31, 0.25)); }
  50% { filter: drop-shadow(0 0 12px rgba(216, 31, 31, 0.65)); }
}

.footer__logo { filter: drop-shadow(0 0 18px rgba(161, 13, 13, 0.25)); }

/* ---------- scroll progress ---------- */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 150;
  width: 100%;
  height: 2px;
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  background: linear-gradient(90deg, var(--red-dim), var(--red-hot));
  box-shadow: 0 0 12px var(--red-glow);
  pointer-events: none;
}

/* ---------- header ---------- */
.header.is-stuck {
  box-shadow: 0 1px 0 rgba(161, 13, 13, 0.25), 0 20px 40px -30px #000;
}
.nav a { transition: color 0.2s, background 0.2s; }
.nav a:hover { background: rgba(255, 255, 255, 0.04); }

/* ---------- cursor glow (pointer devices only) ---------- */
.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  z-index: -1;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(161, 13, 13, 0.16), transparent 62%);
  transform: translate3d(var(--cx, -999px), var(--cy, -999px), 0) translate(-50%, -50%);
  pointer-events: none;
}

.glow--top { animation: breathe 10s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.5; }
  50% { transform: translateX(-50%) scale(1.12); opacity: 0.68; }
}

/* ---------- hero ---------- */
.fx-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 90% 85% at 60% 45%, #000 35%, transparent 85%);
  mask-image: radial-gradient(ellipse 90% 85% at 60% 45%, #000 35%, transparent 85%);
}
.hero > .wrap,
.page-head > .wrap { position: relative; z-index: 1; }
.page-head { position: relative; overflow: hidden; }

.js .hero__copy > *,
.js .page-head .wrap > * {
  animation: rise 0.95s var(--ease) both;
}
.js .hero__copy > :nth-child(2),
.js .page-head .wrap > :nth-child(2) { animation-delay: 0.08s; }
.js .hero__copy > :nth-child(3),
.js .page-head .wrap > :nth-child(3) { animation-delay: 0.18s; }
.js .hero__copy > :nth-child(4) { animation-delay: 0.28s; }
.js .hero__copy > :nth-child(5) { animation-delay: 0.38s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(26px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* glitch on the hero accent word */
.hero h1 em { text-shadow: 0 0 28px rgba(216, 31, 31, 0.45); }
.hero h1 em[data-text]::before {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  animation: glitch 5.5s steps(1) infinite 1.4s;
}
@keyframes glitch {
  0%, 90%, 100% { opacity: 0; transform: none; clip-path: inset(0 0 100% 0); }
  91% { opacity: 0.85; transform: translate(-4px, 0); clip-path: inset(12% 0 58% 0); color: #ff4d4d; }
  93% { opacity: 0.85; transform: translate(4px, 0); clip-path: inset(62% 0 8% 0); color: #fff; }
  95% { opacity: 0.7; transform: translate(-2px, 0); clip-path: inset(38% 0 36% 0); color: #ff4d4d; }
  97% { opacity: 0; }
}

.hero__meta span::before { animation: dot 2.2s ease-in-out infinite; }
.hero__meta span:nth-child(2)::before { animation-delay: 0.4s; }
.hero__meta span:nth-child(3)::before { animation-delay: 0.8s; }
@keyframes dot {
  0%, 100% { box-shadow: 0 0 4px var(--red); }
  50% { box-shadow: 0 0 12px 2px var(--red-hot); background: var(--red-hot); }
}

/* ---------- 3D tilt wrappers ---------- */
.tilt {
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.5s var(--ease);
  will-change: transform;
}
.tilt.is-tilting { transition: transform 0.08s linear; }

/* ---------- terminal ---------- */
.terminal {
  background: linear-gradient(165deg, rgba(26, 14, 15, 0.92), rgba(7, 4, 4, 0.96) 60%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow:
    0 50px 100px -40px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(161, 13, 13, 0.22),
    0 0 80px -20px rgba(161, 13, 13, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.terminal::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 35%;
  background: linear-gradient(180deg, transparent, rgba(216, 31, 31, 0.07), transparent);
  animation: scan 6s linear infinite;
  pointer-events: none;
}
@keyframes scan {
  from { transform: translateY(-100%); }
  to { transform: translateY(300%); }
}
.terminal__dot:first-child { background: var(--red-hot); box-shadow: 0 0 8px var(--red-hot); }

/* ---------- buttons ---------- */
.btn { translate: var(--bx, 0) var(--by, 0); }
.btn--red { position: relative; overflow: hidden; isolation: isolate; }
.btn--red::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.32) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.75s var(--ease);
}
.btn--red:hover::before { transform: translateX(120%); }
.btn--ghost:hover { box-shadow: 0 0 0 1px var(--line-red), 0 12px 30px -16px var(--red-glow); }

/* ---------- grids: border glow follows the cursor ---------- */
.grid {
  background:
    radial-gradient(520px circle at var(--gx, -999px) var(--gy, -999px), rgba(216, 31, 31, 0.7), transparent 42%),
    var(--line);
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(216, 31, 31, 0.12), transparent 48%);
  opacity: 0;
  transition: opacity 0.35s;
}
.card:hover::after { opacity: 1; }
.card:hover .card__icon {
  transform: translateY(-3px) rotate(-6deg);
  filter: drop-shadow(0 0 10px rgba(216, 31, 31, 0.6));
}
.card__num { transition: color 0.3s; }
.card:hover .card__num { color: var(--red-hot); }
.card h3 { transition: color 0.3s; }
.card:hover h3 { color: #fff; }

/* ---------- methodology: timeline draws itself ---------- */
.steps::after {
  content: "";
  position: absolute;
  top: 21px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--red-hot), var(--red) 80%, transparent);
  box-shadow: 0 0 10px var(--red-hot);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.8s var(--ease) 0.2s;
}
.steps.is-drawn::after { transform: scaleX(1); }
.step::before { z-index: 1; }
.step.in::before { animation: ring 1.4s var(--ease) both; }
.step:hover::before { box-shadow: 0 0 22px var(--red-glow); }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(216, 31, 31, 0.6); }
  100% { box-shadow: 0 0 0 14px rgba(216, 31, 31, 0); }
}

/* ---------- panel / findings ---------- */
.panel { position: relative; overflow: hidden; }
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(216, 31, 31, 0.1), transparent 50%);
}
.finding { transition: background 0.25s, padding 0.3s var(--ease); border-radius: var(--radius); }
.finding:hover { background: rgba(161, 13, 13, 0.08); padding-inline: 0.6rem; }
.sev--crit { animation: critPulse 2.6s ease-in-out infinite; }
@keyframes critPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 87, 87, 0); }
  50% { box-shadow: 0 0 12px 0 rgba(255, 87, 87, 0.35); }
}

.feature__icon { transition: transform 0.4s var(--ease), background 0.3s, box-shadow 0.3s; }
.feature:hover .feature__icon {
  transform: rotate(-8deg) scale(1.08);
  background: rgba(161, 13, 13, 0.22);
  box-shadow: 0 0 18px var(--red-glow);
}

/* ---------- stats ---------- */
.stat { position: relative; transition: background 0.35s; }
.stat::before {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red-hot), transparent);
  opacity: 0;
  transition: opacity 0.35s;
}
.stat:hover { background: var(--ink-800); }
.stat:hover::before { opacity: 1; }
.stat__value { font-variant-numeric: tabular-nums; }

/* ---------- marquee & chips ---------- */
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__track span { transition: color 0.25s; }
.marquee__track span:hover { color: #fff; }
.chip { transition: border-color 0.25s, color 0.25s, background 0.25s, transform 0.3s var(--ease), box-shadow 0.3s; }
.chip:hover { transform: translateY(-3px); box-shadow: 0 10px 24px -14px var(--red-glow); }

/* ---------- CTA: rotating light around the border ---------- */
.cta { border-color: rgba(161, 13, 13, 0.25); }
.cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--ang), transparent 0 65%, var(--red-hot) 82%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin 6s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { --ang: 360deg; } }

/* ---------- quotes, forms ---------- */
.quote { transition: border-color 0.3s, background 0.3s, transform 0.4s var(--ease); }
.quote:hover { transform: translateY(-4px); }
.field input:focus,
.field select:focus,
.field textarea:focus { box-shadow: 0 0 0 3px rgba(161, 13, 13, 0.25); }

/* ---------- back to top ---------- */
.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 120;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-red);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--red-hot);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--ease), background 0.25s, color 0.25s;
}
.to-top.is-on { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--red); color: #fff; box-shadow: 0 0 20px var(--red-glow); }
.to-top svg { width: 16px; height: 16px; }

@media (max-width: 1024px) {
  .steps::after { display: none; }
}

@media (hover: none) {
  .cursor-glow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fx-canvas, .cursor-glow { display: none; }
  .js .hero__copy > *, .js .page-head .wrap > * { animation: none; }
  .tilt { transform: none; }
}
