/* ==========================================================================
   Kodiak Defense - premium FX layer
   Constellation canvas, spotlight cards, magnetic buttons, 3D tilt,
   scroll progress, marquee, bento, threat map, aurora, gradient text.
   Pairs with fx.js. All effects degrade gracefully + respect reduced motion.
   ========================================================================== */

/* ---- Scroll progress bar ---- */
#kd-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  z-index: 200;
  background: linear-gradient(90deg, rgb(var(--c-primary) / 1), rgb(var(--c-accent) / 1));
  box-shadow: 0 0 12px rgb(var(--c-accent) / 0.6);
  transition: width 80ms linear;
}

/* ---- Constellation canvas (hero) ---- */
.kd-constellation {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ---- Aurora blobs ---- */
.aurora {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.38;
  will-change: transform;
}
.aurora .a1 {
  width: 50vw; height: 50vw; max-width: 620px; max-height: 620px;
  top: -10%; left: -8%;
  background: radial-gradient(circle, rgb(var(--c-accent) / 0.40), transparent 65%);
  animation: aurora-1 22s ease-in-out infinite alternate;
}
.aurora .a2 {
  width: 44vw; height: 44vw; max-width: 540px; max-height: 540px;
  bottom: -14%; right: -6%;
  background: radial-gradient(circle, rgb(var(--c-primary) / 0.42), transparent 65%);
  animation: aurora-2 26s ease-in-out infinite alternate;
}
.aurora .a3 {
  width: 36vw; height: 36vw; max-width: 460px; max-height: 460px;
  top: 30%; left: 45%;
  background: radial-gradient(circle, rgb(var(--c-accent-soft) / 0.22), transparent 70%);
  animation: aurora-3 30s ease-in-out infinite alternate;
}
@keyframes aurora-1 { to { transform: translate3d(8%, 12%, 0) scale(1.15); } }
@keyframes aurora-2 { to { transform: translate3d(-10%, -8%, 0) scale(1.2); } }
@keyframes aurora-3 { to { transform: translate3d(-6%, 10%, 0) scale(1.1); } }

/* ---- Gradient text ---- */
.gradient-text {
  background: linear-gradient(120deg,
    rgb(var(--c-text-strong) / 1) 0%,
    rgb(var(--c-accent) / 1) 50%,
    rgb(var(--c-text-strong) / 1) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradient-pan 8s ease-in-out infinite;
}
@keyframes gradient-pan {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* ---- Spotlight cards (mouse-follow radial glow) ---- */
.spotlight {
  position: relative;
  overflow: hidden;
}
.spotlight::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    320px circle at var(--mx, 50%) var(--my, 0%),
    rgb(var(--c-accent) / 0.16),
    transparent 60%);
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
  z-index: 0;
}
.spotlight:hover::before { opacity: 1; }
.spotlight > * { position: relative; z-index: 1; }

/* ---- 3D tilt ---- */
.tilt {
  transform-style: preserve-3d;
  transition: transform 240ms cubic-bezier(0.2, 0.7, 0.2, 1.0);
  will-change: transform;
}

/* ---- Magnetic (transition only; transform set by JS) ---- */
.magnetic { transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1.0); will-change: transform; }

/* ---- Marquee ---- */
.marquee {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  gap: 3.5rem;
  align-items: center;
  animation: marquee 32s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---- Bento grid ---- */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}
.bento-item {
  position: relative;
  border: 1px solid rgb(var(--c-line) / 1);
  border-radius: 16px;
  background: rgb(var(--c-surface) / 1);
  overflow: hidden;
}
.bento-item.col-3 { grid-column: span 3; }
.bento-item.col-2 { grid-column: span 2; }
.bento-item.col-4 { grid-column: span 4; }
.bento-item.row-2 { grid-row: span 2; }
@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .bento-item.col-3, .bento-item.col-2, .bento-item.col-4 { grid-column: span 2; }
  .bento-item.row-2 { grid-row: auto; }
}
@media (max-width: 560px) {
  .bento { grid-template-columns: 1fr; }
  .bento-item.col-3, .bento-item.col-2, .bento-item.col-4 { grid-column: span 1; }
}

/* ---- Scroll cue ---- */
.scroll-cue {
  width: 24px; height: 38px;
  border: 2px solid rgb(var(--c-muted) / 0.6);
  border-radius: 12px;
  position: relative;
}
.scroll-cue::after {
  content: "";
  position: absolute;
  top: 6px; left: 50%;
  width: 3px; height: 7px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: rgb(var(--c-accent) / 1);
  animation: scroll-cue 1.8s ease-in-out infinite;
}
@keyframes scroll-cue {
  0%   { opacity: 0; transform: translateY(0); }
  30%  { opacity: 1; }
  60%  { opacity: 1; transform: translateY(12px); }
  100% { opacity: 0; transform: translateY(12px); }
}

/* ---- kbd badge ---- */
.kbd {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid rgb(var(--c-line) / 1);
  border-radius: 6px;
  color: rgb(var(--c-muted-soft) / 1);
  background: rgb(var(--c-surface) / 0.6);
}

/* ==========================================================================
   Global threat map
   ========================================================================== */
.threat-map { position: relative; width: 100%; }
.threat-map svg { width: 100%; height: auto; display: block; overflow: visible; }

/* dotted continents */
.tm-dot { fill: rgb(var(--c-muted) / 0.32); }

/* live nodes */
.tm-node {
  fill: rgb(var(--c-accent) / 1);
}
.tm-node-ring {
  fill: none;
  stroke: rgb(var(--c-accent) / 0.9);
  transform-box: fill-box;
  transform-origin: center;
  transform-origin: 50% 50%;
  animation: tm-ping 2.6s ease-out infinite;
}
.tm-node-ring.d1 { animation-delay: 0.0s; }
.tm-node-ring.d2 { animation-delay: 0.6s; }
.tm-node-ring.d3 { animation-delay: 1.2s; }
.tm-node-ring.d4 { animation-delay: 1.8s; }
.tm-node-ring.d5 { animation-delay: 0.9s; }
.tm-node-ring.d6 { animation-delay: 1.5s; }
@keyframes tm-ping {
  0%   { r: 4; opacity: 0.9; stroke-width: 2; }
  100% { r: 26; opacity: 0; stroke-width: 0.4; }
}

/* attack arcs - draw + fade, looping like packets in flight */
.tm-arc {
  fill: none;
  stroke: rgb(var(--c-accent) / 0.9);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 14 320;
  filter: drop-shadow(0 0 4px rgb(var(--c-accent-glow) / 0.7));
  animation: tm-stream 3.6s linear infinite;
}
.tm-arc.a2 { animation-delay: 0.7s; animation-duration: 4.1s; }
.tm-arc.a3 { animation-delay: 1.3s; animation-duration: 3.2s; }
.tm-arc.a4 { animation-delay: 2.0s; animation-duration: 4.4s; }
.tm-arc.a5 { animation-delay: 0.4s; animation-duration: 3.9s; }
.tm-arc.a6 { animation-delay: 1.7s; animation-duration: 3.4s; }
@keyframes tm-stream {
  0%   { stroke-dashoffset: 334; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

/* faint static arc underlay */
.tm-arc-base {
  fill: none;
  stroke: rgb(var(--c-accent) / 0.14);
  stroke-width: 1;
}

@media (prefers-reduced-motion: reduce) {
  .aurora span,
  .gradient-text,
  .marquee-track,
  .scroll-cue::after,
  .tm-node-ring,
  .tm-arc { animation: none !important; }
  .gradient-text { -webkit-text-fill-color: rgb(var(--c-text-strong) / 1); color: rgb(var(--c-text-strong) / 1); }
  .tm-arc { stroke-dasharray: none; opacity: 0.5; }
  #kd-progress { transition: none; }
}

/* ==========================================================================
   Page hero band (inner pages) - image + gradient wash + grid
   ========================================================================== */
.page-hero { position: relative; overflow: hidden; }
.page-hero .ph-media {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.18;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}
.page-hero .ph-wash {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 80% 10%, rgb(var(--c-accent) / 0.16), transparent 60%),
    linear-gradient(180deg, rgb(var(--c-bg) / 0.2), rgb(var(--c-bg) / 0.85));
}

/* ==========================================================================
   Image frame - tasteful, premium picture treatment
   ========================================================================== */
.img-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgb(var(--c-line) / 1);
  background: rgb(var(--c-surface) / 1);
  isolation: isolate;
}
.img-frame img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 700ms cubic-bezier(0.2,0.7,0.2,1), filter 700ms ease;
  filter: saturate(0.9);
}
.img-frame:hover img { transform: scale(1.04); filter: saturate(1.05); }
.img-frame::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgb(var(--c-surface-deep) / 0.55) 100%);
  pointer-events: none;
}
.img-frame .img-tag {
  position: absolute; left: 14px; bottom: 12px; z-index: 1;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgb(var(--c-text-strong) / 1);
  background: rgb(var(--c-bg) / 0.6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgb(var(--c-line) / 1);
  padding: 4px 9px; border-radius: 6px;
}

/* ==========================================================================
   Interactive timeline / numbered steps
   ========================================================================== */
.step {
  position: relative;
  padding: 24px 22px;
  border: 1px solid rgb(var(--c-line) / 1);
  border-radius: 14px;
  background: rgb(var(--c-surface) / 0.5);
  overflow: hidden;
  transition: transform 320ms cubic-bezier(0.2,0.7,0.2,1), border-color 320ms ease, background-color 320ms ease, box-shadow 320ms ease;
}
.step::before { /* accent wash that wipes in on hover */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgb(var(--c-accent) / 0.10), transparent 55%);
  opacity: 0; transition: opacity 320ms ease; pointer-events: none;
}
.step:hover {
  transform: translateY(-6px);
  border-color: rgb(var(--c-accent) / 0.5);
  background: rgb(var(--c-surface) / 0.9);
  box-shadow: 0 24px 48px -28px rgb(var(--c-accent-glow) / 0.4);
}
.step:hover::before { opacity: 1; }
.step .step-num {
  position: relative;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  border: 1px solid rgb(var(--c-accent) / 0.6);
  color: rgb(var(--c-accent) / 1);
  background: transparent;
  transition: background-color 320ms ease, color 320ms ease, transform 320ms ease, box-shadow 320ms ease;
  flex-shrink: 0;
}
.step:hover .step-num {
  background: rgb(var(--c-accent) / 1);
  color: rgb(var(--c-bg) / 1);
  transform: scale(1.08);
  box-shadow: 0 0 0 6px rgb(var(--c-accent) / 0.14);
}
.step .step-line {
  height: 2px; flex: 1; border-radius: 2px;
  background: rgb(var(--c-line) / 1);
  position: relative; overflow: hidden;
}
.step .step-line::after {
  content: ""; position: absolute; inset: 0;
  width: 0%; background: rgb(var(--c-accent) / 1);
  transition: width 420ms cubic-bezier(0.2,0.7,0.2,1);
}
.step:hover .step-line::after { width: 100%; }
.step .step-arrow {
  opacity: 0; transform: translateX(-6px);
  transition: opacity 320ms ease, transform 320ms ease;
}
.step:hover .step-arrow { opacity: 1; transform: translateX(0); }
.step.step-final { border-color: rgb(var(--c-accent) / 0.4); background: rgb(var(--c-surface) / 0.8); }
.step.step-final .step-num { background: rgb(var(--c-accent) / 1); color: rgb(var(--c-bg) / 1); }

/* ==========================================================================
   Animated FAQ accordion (replaces native <details> look)
   ========================================================================== */
.faq-item {
  border: 1px solid rgb(var(--c-line) / 1);
  border-radius: 14px;
  background: rgb(var(--c-surface) / 0.6);
  overflow: hidden;
  transition: border-color 240ms ease, background-color 240ms ease, box-shadow 240ms ease;
}
.faq-item:hover { border-color: rgb(var(--c-accent) / 0.4); }
.faq-item.is-open {
  border-color: rgb(var(--c-accent) / 0.5);
  background: rgb(var(--c-surface) / 0.95);
  box-shadow: 0 18px 40px -28px rgb(var(--c-accent-glow) / 0.35);
}
.faq-q {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 22px;
  background: transparent; border: 0; cursor: pointer;
  text-align: left;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600; font-size: 16px; letter-spacing: -0.01em;
  color: rgb(var(--c-text-strong) / 1);
  transition: color 200ms ease;
}
.faq-icon {
  position: relative; flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgb(var(--c-line) / 1);
  display: flex; align-items: center; justify-content: center;
  transition: background-color 240ms ease, border-color 240ms ease, transform 360ms cubic-bezier(0.2,0.7,0.2,1);
}
.faq-icon::before, .faq-icon::after {
  content: ""; position: absolute;
  background: rgb(var(--c-accent) / 1);
  border-radius: 2px;
  transition: transform 360ms cubic-bezier(0.2,0.7,0.2,1), opacity 240ms ease;
}
.faq-icon::before { width: 11px; height: 2px; }   /* horizontal */
.faq-icon::after  { width: 2px; height: 11px; }    /* vertical   */
.faq-item.is-open .faq-icon { background: rgb(var(--c-accent) / 1); border-color: rgb(var(--c-accent) / 1); transform: rotate(180deg); }
.faq-item.is-open .faq-icon::before { background: rgb(var(--c-bg) / 1); }
.faq-item.is-open .faq-icon::after  { transform: scaleY(0); opacity: 0; }  /* becomes a minus */
.faq-a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 360ms cubic-bezier(0.2,0.7,0.2,1);
}
.faq-a > div { overflow: hidden; }
.faq-item.is-open .faq-a { grid-template-rows: 1fr; }
.faq-a p {
  padding: 0 22px 22px;
  color: rgb(var(--c-muted-soft) / 1);
  font-size: 15px; line-height: 1.65;
}
@media (prefers-reduced-motion: reduce) {
  .step, .step *, .faq-item, .faq-a, .faq-icon, .img-frame img { transition: none !important; }
}

/* ==========================================================================
   Premium footer
   ========================================================================== */
.kd-footer { position: relative; overflow: hidden; }
.kd-footer .foot-status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  background: rgb(var(--c-surface) / 0.7);
  border: 1px solid rgb(var(--c-line) / 1);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.kd-footer a.foot-link { position: relative; transition: color 200ms ease, padding-left 200ms ease; }
.kd-footer a.foot-link::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%) scale(0);
  width: 4px; height: 4px; border-radius: 50%; background: rgb(var(--c-accent) / 1);
  transition: transform 200ms ease;
}
.kd-footer a.foot-link:hover { color: rgb(var(--c-accent) / 1); padding-left: 10px; }
.kd-footer a.foot-link:hover::before { transform: translateY(-50%) scale(1); }
.kd-top {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgb(var(--c-line) / 1);
  background: rgb(var(--c-surface) / 0.7);
  color: rgb(var(--c-text) / 1);
  cursor: pointer;
  transition: transform 200ms ease, border-color 200ms ease, color 200ms ease, background-color 200ms ease;
}
.kd-top:hover { transform: translateY(-3px); border-color: rgb(var(--c-accent) / 0.6); color: rgb(var(--c-accent) / 1); }

/* ==========================================================================
   Self-assessment scorecard (resources)
   ========================================================================== */
.assess-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; text-align: left;
  padding: 16px 18px; border-radius: 12px;
  border: 1px solid rgb(var(--c-line) / 1);
  background: rgb(var(--c-surface) / 0.6);
  cursor: pointer;
  transition: border-color 220ms ease, background-color 220ms ease, transform 220ms ease;
  font-family: 'Inter', system-ui, sans-serif;
  color: rgb(var(--c-text) / 1);
}
.assess-toggle:hover { border-color: rgb(var(--c-accent) / 0.45); transform: translateY(-2px); }
.assess-check {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px;
  border: 1.5px solid rgb(var(--c-line) / 1);
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}
.assess-toggle.is-yes { border-color: rgb(var(--c-accent) / 0.6); background: rgb(var(--c-accent) / 0.08); }
.assess-toggle.is-yes .assess-check { background: rgb(var(--c-accent) / 1); border-color: rgb(var(--c-accent) / 1); color: rgb(var(--c-bg) / 1); }
.assess-ring { transform: rotate(-90deg); }
.assess-ring .track { stroke: rgb(var(--c-line) / 1); }
.assess-ring .meter { stroke: rgb(var(--c-accent) / 1); stroke-linecap: round; transition: stroke-dashoffset 700ms cubic-bezier(0.2,0.7,0.2,1); }

/* ==========================================================================
   Hero spotlight grid - faint technical grid that a cursor glow reveals.
   Replaces the dated particle-network. Subtly interactive, light, modern.
   ========================================================================== */
.hero-grid, .hero-grid-glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(to right, rgb(var(--c-accent) / var(--g)) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(var(--c-accent) / var(--g)) 1px, transparent 1px);
  background-size: 46px 46px;
}
/* base grid: very faint, fades out toward the edges */
.hero-grid {
  --g: 0.05;
  -webkit-mask: radial-gradient(ellipse 78% 78% at 50% 38%, #000 32%, transparent 100%);
          mask: radial-gradient(ellipse 78% 78% at 50% 38%, #000 32%, transparent 100%);
}
/* bright grid revealed only around the cursor */
.hero-grid-glow {
  --g: 0.42;
  -webkit-mask: radial-gradient(250px circle at var(--hx, 72%) var(--hy, 34%), #000 0%, transparent 72%);
          mask: radial-gradient(250px circle at var(--hx, 72%) var(--hy, 34%), #000 0%, transparent 72%);
}
/* soft accent glow that follows the cursor */
.hero-spot {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(460px circle at var(--hx, 72%) var(--hy, 34%), rgb(var(--c-accent) / 0.12), transparent 60%);
}
/* a single, very soft ambient wash for depth (not animated) */
.hero-wash {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 60% 50% at 78% 18%, rgb(var(--c-accent) / 0.10), transparent 60%),
    radial-gradient(ellipse 55% 50% at 12% 88%, rgb(var(--c-primary) / 0.12), transparent 60%);
}
@media (prefers-reduced-motion: reduce) {
  .hero-grid-glow { -webkit-mask: radial-gradient(250px circle at 72% 34%, #000 0%, transparent 72%); mask: radial-gradient(250px circle at 72% 34%, #000 0%, transparent 72%); }
}
