/* Spy-themed motion for the marketing site. Every rule here only applies once
   motion.js has switched motion on (html[data-motion="on"]), so with
   JavaScript off, with ?motion=off, or with reduced motion the page is the
   plain static page. Timings come from motion.config.js through the
   --sa-* custom properties; the values after the commas are the defaults. */

[data-motion="on"] {
  --sa-ink: #0E0919;
  --sa-ink-2: #1D1433;
  --sa-uv: #C7A6FF;
  --sa-uv-glow: #8A5CFF;
}

/* Text that is decoding: the real words stay in place, invisible, and the
   scramble is drawn over them. Screen readers read the real words. */
.sa-decoding { position: relative; }
.sa-decoding .sa-ghost { color: transparent; }
.sa-decoding .sa-scramble { position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none; }
/* Headline words wait, hidden, for their decode (the highlight stays). */
.sa-pending { color: transparent !important; }

/* Redaction bars. The words underneath stay in the page. */
.sa-redact { position: relative; }
.sa-redact::after {
  content: ""; position: absolute; inset: -.06em -.1em; border-radius: 3px; pointer-events: none;
  background: repeating-linear-gradient(135deg, var(--sa-ink) 0 9px, var(--sa-ink-2) 9px 18px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12);
  transform-origin: right center;
  transition: transform var(--sa-redact-ms, 650ms) cubic-bezier(.75, 0, .2, 1);
}
.sa-redact.sa-open::after { transform: scaleX(0); }
/* A stop note is a block inside the list, so the bar covers just its line. */
.stops small.sa-redact { display: inline-block; }

/* The SAMPLE stamp lands on the file. */
.sa-stamp { opacity: 0; scale: 2.3; }
.sa-stamp.sa-in { animation: sa-thump var(--sa-stamp-ms, 420ms) cubic-bezier(.2, .7, .3, 1.25) forwards; }
@keyframes sa-thump { 0% { opacity: 0; scale: 2.3; } 70% { opacity: 1; scale: .9; } 100% { opacity: 1; scale: 1; } }

/* Pictures develop like a print: dark and grainy, a flash, then clear. */
.sa-develop { filter: sepia(1) grayscale(.5) brightness(.28) contrast(1.6) blur(5px); }
.sa-develop.sa-developing { animation: sa-develop var(--sa-develop-ms, 1600ms) ease-out forwards; }
@keyframes sa-develop {
  0% { filter: sepia(1) grayscale(.5) brightness(.28) contrast(1.6) blur(5px); }
  10% { filter: sepia(.8) grayscale(.3) brightness(1.9) contrast(.8) blur(3px); }
  45% { filter: sepia(.6) grayscale(.2) brightness(.9) contrast(1.1) blur(1.5px); }
  100% { filter: none; }
}

/* Route tracer: a marker that walks the dotted route as the page scrolls. */
.sa-trail { fill: none; stroke: #FFD23F; stroke-width: 4; stroke-linecap: round; opacity: .9; }
.sa-tracer-halo { fill: #FFD23F; opacity: .22; animation: sa-breathe 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.sa-tracer-dot { fill: #FFFFFF; stroke: #FFD23F; stroke-width: 4; }
.sa-tracer-eye { fill: #2A1B4A; }
@keyframes sa-breathe { 0%, 100% { transform: scale(.8); opacity: .3; } 50% { transform: scale(1.15); opacity: .12; } }
.sa-pin { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .35s cubic-bezier(.3, 1.6, .5, 1), filter .35s ease; }
.sa-pin.sa-hit { transform: translateY(-4px) scale(1.12); filter: drop-shadow(0 0 6px rgba(255, 210, 63, .85)); }

/* The sample mission's stop list lights up as the marker reaches each stop. */
.stops li .num { transition: box-shadow .3s ease, transform .3s ease; }
.stops li.sa-reached .num { box-shadow: 0 0 0 3px var(--marker); transform: scale(1.06); }

/* How a mission works: the route inks in and each pin drops into place. */
.sa-route .stage { z-index: 1; }
.sa-route::after {
  content: ""; position: absolute; left: 4%; right: 4%; top: 26px; height: 3px; border-radius: 2px;
  background: var(--plum); transform-origin: left center; transform: scaleX(var(--sa-p, 0)); pointer-events: none;
}
.sa-route.sa-vertical::after { left: 26px; right: auto; top: 28px; bottom: 28px; width: 3px; height: auto; transform-origin: center top; transform: scaleY(var(--sa-p, 0)); }
.sa-route .stage .pinwrap { transition: box-shadow .35s ease; }
.sa-route .stage .pinwrap svg { opacity: .35; transform: translateY(-10px); transition: opacity .35s ease, transform .45s cubic-bezier(.3, 1.6, .5, 1); }
.sa-route .stage.sa-lit .pinwrap { box-shadow: 0 0 0 3px var(--marker); }
.sa-route .stage.sa-lit .pinwrap svg { opacity: 1; transform: none; }

/* Invisible ink on the sample map, visible only under the UV lamp. */
.sa-uv { --sa-x: 20%; --sa-y: 15%; }
.sa-uv .sa-ink {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle var(--sa-uv-r, 95px) at var(--sa-x) var(--sa-y), #000 45%, transparent 100%);
  mask-image: radial-gradient(circle var(--sa-uv-r, 95px) at var(--sa-x) var(--sa-y), #000 45%, transparent 100%);
  filter: drop-shadow(0 0 4px var(--sa-uv-glow));
}
.sa-ink-lines { stroke: var(--sa-uv); }
.sa-ink-words { fill: var(--sa-uv); }
.sa-uv .sa-lamp {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle calc(var(--sa-uv-r, 95px) * 1.15) at var(--sa-x) var(--sa-y), rgba(138, 92, 255, .38), rgba(138, 92, 255, .1) 60%, transparent 100%);
}
.sa-uv .sa-uv-tip {
  position: absolute; right: 12px; bottom: 12px; pointer-events: none;
  font-family: var(--f-mono); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--sa-uv); background: rgba(14, 9, 25, .72); border: 1px solid rgba(199, 166, 255, .35); border-radius: 999px; padding: 4px 10px;
  transition: opacity .3s ease;
}
.sa-uv.sa-uv-held .sa-uv-tip { opacity: 0; }
.sa-uv { cursor: crosshair; }

/* Reduced motion switched on while the page is open: show every final state. */
.sa-still .sa-redact::after,
.sa-still .sa-tracer, .sa-still .sa-trail,
.sa-still .sa-ink, .sa-still .sa-lamp, .sa-still .sa-uv-tip,
.sa-still .sa-route::after { display: none; }
.sa-still .sa-develop, .sa-still .sa-developing { filter: none; animation: none; }
.sa-still .sa-stamp { opacity: 1; scale: 1; animation: none; }
.sa-still .sa-pin, .sa-still .sa-route .stage .pinwrap svg { transform: none; opacity: 1; filter: none; transition: none; }

@media print {
  .sa-redact::after, .sa-tracer, .sa-trail, .sa-ink, .sa-lamp, .sa-uv-tip { display: none !important; }
  .sa-develop, .sa-developing { filter: none !important; animation: none !important; }
  .sa-stamp { opacity: 1 !important; scale: 1 !important; }
}
