/* ---- spark zip: the "Now entering" card it plays on ----------------------
   Ported from ng-extend (branch eyewire-ii-community),
   src/components/DatasetTransition.vue, the <style> block, de-scoped from
   .nge-dst-* to .holoentering-*. The sparks and the light are canvas and live
   in spark-zip.js; this is the box they zip up, carried whole because the
   panel a ported animation plays inside is part of the port.

   The one rule that belongs to the zip itself is the haze. It is a layer of
   its own under the card so it can fade out as the zip starts (a gradient
   background cannot transition, so upstream it used to blink off). Put
   .is-zip on the stage when you call holoSparkZip on the card.

   Deviations. Upstream the stage is a fixed full screen overlay at z-index
   9990; here it is an in-page block, since a demo cannot cover the page it
   is on. The loading pulses run only while .is-loading is on the stage,
   because a card at rest on a library page should not blink forever. The
   entrance keyframe is replayed by the demo after each zip, where upstream
   the card unmounts. The resume offset (--dst-in, the time already spent
   before a page reload) is kept, and defaults to 0. */

.holoentering-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 3.5rem 0 3rem;
}
.holoentering-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(2, 6, 14, 0.55), rgba(2, 6, 14, 0.2) 70%, transparent);
  transition: opacity 0.45s ease;
  pointer-events: none;
}
.holoentering-stage.is-zip::before { opacity: 0; }

/* scifi-ui holopanel surface, with the soft materialize the app uses. */
.holoentering {
  position: relative;
  width: min(560px, 88vw);
  max-width: 100%;
  padding: 20px 22px 18px;
  border-radius: 14px;
  border: 1px solid rgba(74, 150, 224, 0.35);
  background: linear-gradient(158deg, rgba(15, 18, 24, 0.97), rgba(6, 10, 18, 0.98));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 70px rgba(66, 213, 236, 0.10), inset 0 1px 0 rgba(196, 228, 255, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: left;
}
.holoentering.is-in { animation: holoentering-materialize 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes holoentering-materialize {
  0%   { opacity: 0; transform: scale(1.025) translateY(-8px); filter: blur(14px); }
  60%  { opacity: 1; transform: scale(0.995); filter: blur(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}

.holoentering-eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600;
  color: rgba(140, 200, 245, 0.95);
}
.holoentering-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #42d5ec;
  box-shadow: 0 0 10px #42d5ec;
}
.is-loading .holoentering-dot { animation: holoentering-pulse 1.1s ease-in-out infinite; }
@keyframes holoentering-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.holoentering-title {
  margin: 6px 0 14px; font-size: 26px; font-weight: 700; letter-spacing: -0.01em;
  color: #fff; text-shadow: 0 0 22px rgba(120, 190, 255, 0.35);
}

.holoentering-stats {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  margin: -6px 0 12px; font-size: 13.5px; color: rgba(214, 228, 242, 0.85);
}
.holoentering-stats-label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; color: rgba(201, 139, 255, 0.95); }
.holoentering-stat b { color: #fff; font-weight: 700; font-size: 15px; margin-right: 2px; }

.holoentering-thumb {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 9; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: #04070d;
}
.holoentering-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
/* Revealed top to bottom exactly as the scan line passes (same timing). */
.is-loading .holoentering-thumb img {
  animation: holoentering-wipe 0.95s cubic-bezier(0.4, 0, 0.3, 1) both;
  animation-delay: calc(var(--dst-in, 0ms) + 0.25s);
}
@keyframes holoentering-wipe {
  from { clip-path: inset(0 0 100% 0); filter: brightness(1.6); }
  to   { clip-path: inset(0 0 0 0); filter: brightness(1); }
}
/* One fast bright line down the image; the image appears behind it. Its
   top edge tracks the wipe's edge (same duration, easing and delay). */
.holoentering-scan {
  position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: rgba(200, 245, 255, 0.95);
  box-shadow: 0 0 14px 3px rgba(120, 220, 255, 0.8), 0 -18px 30px rgba(120, 220, 255, 0.25);
  opacity: 0;
}
.is-loading .holoentering-scan {
  animation: holoentering-sweep 0.95s cubic-bezier(0.4, 0, 0.3, 1) both;
  animation-delay: calc(var(--dst-in, 0ms) + 0.25s);
}
@keyframes holoentering-sweep {
  0%   { top: 0; opacity: 1; }
  92%  { opacity: 1; }
  100% { top: calc(100% - 2px); opacity: 0; }
}
.holoentering-grid {
  position: absolute; inset: 0; opacity: 0.18; pointer-events: none;
  background-image:
    linear-gradient(rgba(140, 210, 255, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 210, 255, 0.5) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 35%, #000 90%);
  mask-image: radial-gradient(ellipse at center, transparent 35%, #000 90%);
}

.holoentering-status {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 8px;
  font-size: 13px; color: rgba(214, 228, 242, 0.85);
}
.holoentering-dots { display: inline-flex; gap: 4px; }
.holoentering-dots i { width: 4px; height: 4px; border-radius: 50%; background: #42d5ec; }
.is-loading .holoentering-dots i { animation: holoentering-pulse 0.9s ease-in-out infinite; }
.is-loading .holoentering-dots i:nth-child(2) { animation-delay: 0.15s; }
.is-loading .holoentering-dots i:nth-child(3) { animation-delay: 0.3s; }
.holoentering-bar { height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.holoentering-bar span {
  display: block; height: 100%; width: 100%; transform-origin: left;
  background: linear-gradient(90deg, #42d5ec, #c98bff);
  box-shadow: 0 0 12px rgba(66, 213, 236, 0.7);
}
.is-loading .holoentering-bar span {
  animation: holoentering-fill 2.2s cubic-bezier(0.3, 0.1, 0.2, 1) both;
  animation-delay: var(--dst-in, 0ms);
}
@keyframes holoentering-fill { from { transform: scaleX(0.04); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  .holoentering.is-in, .is-loading .holoentering-thumb img, .is-loading .holoentering-scan,
  .is-loading .holoentering-dot, .is-loading .holoentering-dots i, .is-loading .holoentering-bar span { animation: none; }
  .holoentering-stage::before { transition: none; }
}
