/* ==========================================================================
   Apate Security - scroll experience (Apple-style)
   --------------------------------------------------------------------------
   Everything here is progressive enhancement driven by scrolly.js:
     - hero:      the console shot flattens and rises as you scroll
     - tour:      a pinned section where the "camera" glides across the console
     - statement: a big sentence whose words light up as you read
     - subnav:    a slim section bar that appears once you leave the hero
   Without JavaScript, or with "reduce motion" turned on, none of it is pinned:
   the tour becomes a plain image with five short cards beneath it.
   ========================================================================== */

:root { --navh: 66px; --subh: 0px; }

/* ---------- hero ---------- */
.hero-zoom { transform-origin: 50% 0; will-change: auto; }
.hero-zoom.sc-on { will-change: transform; }
.hero-copy.sc-on { will-change: transform, opacity; }

/* ---------- section sub-nav (appears after the hero) ---------- */
.subnav {
  position: fixed; left: 0; right: 0; top: var(--navh); z-index: 49;
  height: 46px; display: flex; align-items: center;
  background: rgba(4, 9, 17, .82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--edge, rgba(120, 170, 220, .18));
  transform: translateY(-110%); opacity: 0; visibility: hidden;
  transition: transform .45s var(--ease, ease), opacity .3s linear, visibility 0s linear .45s;
}
.subnav[hidden] { display: none; }
.subnav.show { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
.subnav .wrap { display: flex; align-items: center; gap: 22px; width: 100%; }
.subnav-brand { font-weight: 700; letter-spacing: -.01em; color: var(--txt); white-space: nowrap; }
.subnav-links { display: flex; gap: 4px; margin-left: auto; }
.subnav-links a {
  position: relative; padding: 6px 12px; border-radius: 999px; font-size: 14px;
  color: var(--dim); transition: color .2s, background .2s;
}
.subnav-links a:hover { color: var(--txt); }
.subnav-links a.on { color: var(--txt); background: rgba(34, 211, 238, .12); }
.subnav .btn.sm { padding: 6px 14px; font-size: 13.5px; }
@media (max-width: 860px) { .subnav { display: none !important; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .subnav { background: rgba(4, 9, 17, .96); }
}
/* anchored sections clear the header and the sub-nav */
#tour, #check, #capabilities, #pricing, #faq { scroll-margin-top: calc(var(--navh) + 56px); }

/* ---------- tour: static layout (default, no JS / reduced motion) ---------- */
.tour { position: relative; padding: 8px 0 64px; }
.tour-pin { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column-reverse; gap: 28px; }
.tour-stage { width: 100%; }
.tour-frame {
  position: relative; overflow: hidden; border-radius: 18px; aspect-ratio: 1903 / 976;
  border: 1px solid rgba(34, 211, 238, .22);
  background: #04101d;
  box-shadow: 0 50px 120px -42px rgba(0, 0, 0, .88), 0 0 90px -34px rgba(34, 211, 238, .35);
}
.tour-img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; transform-origin: 0 0; }
.tour-dots-overlay { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; }

/* ---------- live radar blips over the console screenshot (hero + tour) ---------- */
.radar-live { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.rdot {
  position: absolute; left: var(--x); top: var(--y); width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: #2BF58C;
  animation: rdot-drift 6.5s ease-in-out infinite, rdot-pulse-ok 2.8s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.rdot-warn { background: #C084FC; animation-name: rdot-drift, rdot-pulse-warn; animation-duration: 5.5s, 1.7s; }
@keyframes rdot-drift {
  0%, 100% { transform: translate(0, 0); }
  22% { transform: translate(7px, -9px); }
  48% { transform: translate(-8px, 5px); }
  74% { transform: translate(6px, 7px); }
}
@keyframes rdot-pulse-ok {
  0% { box-shadow: 0 0 0 0 rgba(43, 245, 140, .55); }
  70% { box-shadow: 0 0 0 9px rgba(43, 245, 140, 0); }
  100% { box-shadow: 0 0 0 0 rgba(43, 245, 140, 0); }
}
@keyframes rdot-pulse-warn {
  0% { box-shadow: 0 0 0 0 rgba(192, 132, 252, .6); }
  70% { box-shadow: 0 0 0 8px rgba(192, 132, 252, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 132, 252, 0); }
}
@media (prefers-reduced-motion: reduce) { .rdot { animation: none; } }
.tour-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.tour-step {
  padding: 20px 20px 18px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(14, 30, 56, .7), rgba(8, 18, 34, .7));
  border: 1px solid rgba(120, 170, 220, .16);
}
.tour-k { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin: 0 0 8px; }
.tour-step h3 { margin: 0 0 8px; font-size: 21px; line-height: 1.2; letter-spacing: -.01em; }
.tour-step p:last-child { margin: 0; color: var(--dim); font-size: 15.5px; line-height: 1.55; }
.tour-dots { display: none; }
.tour-cta { display: inline-block; margin-top: 18px; color: var(--cyan); font-family: ui-monospace, Consolas, monospace; }

/* ---------- tour: pinned, scroll-driven (JS adds .on) ---------- */
.tour.on {
  --pin-top: calc(var(--navh) + var(--subh));
  padding: 0;
  /* one pinned screen plus 5 x 82vh of scrolling */
  height: calc((100vh - var(--pin-top)) + var(--steps, 5) * 82vh);
}
.tour.on .tour-pin {
  position: sticky; top: var(--pin-top);
  height: calc(100vh - var(--pin-top)); height: calc(100svh - var(--pin-top));
  max-width: 1420px; padding: 0 28px;
  display: grid; grid-template-columns: minmax(0, 3.7fr) minmax(0, 8.3fr);
  gap: clamp(24px, 4vw, 64px); align-items: center;
}
.tour.on .tour-stage { order: 2; }
.tour.on .tour-copy { order: 1; position: relative; }
.tour.on .tour-steps { display: grid; grid-template-columns: 1fr; gap: 0; }
.tour.on .tour-step {
  grid-area: 1 / 1; padding: 0; background: none; border: 0; border-radius: 0;
  opacity: 0; transform: translateY(26px); visibility: hidden;
  transition: opacity .5s var(--ease, ease), transform .6s var(--ease, ease), visibility 0s linear .6s;
  pointer-events: none;
}
.tour.on .tour-step.on { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; pointer-events: auto; }
.tour.on .tour-step h3 { font-size: clamp(28px, 3.1vw, 44px); line-height: 1.08; letter-spacing: -.02em; margin-bottom: 14px; }
.tour.on .tour-step p:last-child { font-size: clamp(16px, 1.25vw, 19px); line-height: 1.55; max-width: 34em; }
.tour.on .tour-frame { will-change: transform; }
.tour.on .tour-img { will-change: transform; image-rendering: auto; }
.tour.on .tour-dots {
  display: flex; gap: 10px; list-style: none; margin: 30px 0 0; padding: 0;
}
.tour-dots li { margin: 0; }
.tour-dots button {
  width: 34px; height: 6px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(157, 180, 206, .28); position: relative; overflow: hidden;
}
.tour-dots button::after {
  content: ""; position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(var(--fill, 0));
  background: linear-gradient(90deg, var(--cyan), var(--gold)); border-radius: inherit;
}
.tour-dots button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.tour.on .tour-cta { margin-top: 22px; }

@media (max-width: 860px) {
  .tour.on {
    --pin-top: var(--navh);
    height: calc((100vh - var(--pin-top)) + var(--steps, 5) * 70vh);
  }
  .tour.on .tour-pin {
    grid-template-columns: 1fr; gap: 20px; align-items: start;
    padding: 0 16px; align-content: center; grid-template-rows: auto auto;
  }
  .tour.on .tour-stage { order: 1; }
  .tour.on .tour-copy { order: 2; }
  .tour.on .tour-frame { border-radius: 12px; }
  .tour.on .tour-step h3 { font-size: clamp(24px, 6.6vw, 30px); margin-bottom: 8px; }
  .tour.on .tour-step p:last-child { font-size: 15.5px; }
  .tour.on .tour-dots { margin-top: 16px; }
  .tour.on .tour-cta { margin-top: 14px; }
}
@media (max-height: 560px) and (min-width: 861px) {
  .tour.on .tour-step h3 { font-size: 26px; }
  .tour.on .tour-step p:last-child { font-size: 15px; }
}

/* ---------- statement: words light up on scroll ---------- */
.statement { padding: clamp(72px, 14vh, 150px) 0; }
.statement-text {
  margin: 0 auto; max-width: 980px; text-align: left;
  font-size: clamp(28px, 4.6vw, 58px); line-height: 1.16; font-weight: 700; letter-spacing: -.025em;
  color: var(--txt);
}
.statement .statement-text .grad,
.statement .statement-text .grad .w { background: none; -webkit-text-fill-color: var(--cyan2); color: var(--cyan2); }
.statement.wr-on .statement-text .w { opacity: .42; transition: opacity .18s linear; }
.statement.wr-on .statement-text .w.lit { opacity: 1; }
@media (max-width: 560px) { .statement-text { font-size: clamp(25px, 7.4vw, 32px); } }

/* ---------- reduced motion: nothing pinned, nothing scrubbed ---------- */
@media (prefers-reduced-motion: reduce) {
  .subnav { transition: none; }
  .hero-zoom, .hero-copy { transform: none !important; opacity: 1 !important; }
  .tour.on .tour-step { transition: none; }
}
