/* ==========================================================================
   DataRail entry overlay
   Shared by the entry screen at / and the video on /about. Pair with
   assets/intro.js, which reads its mode from the overlay element.

   Lifted out of the homepage when the overlay became two pages' business: a
   440-line block pasted into both is the second hand-kept copy that drifts.
   ========================================================================== */
/* DataRail intro overlay */
:root {
  --intro-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

#introOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.04), transparent 40%),
    rgba(5, 8, 14, 0.94);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  opacity: 1;
  visibility: visible;
  transition:
    opacity 700ms var(--intro-ease),
    visibility 0s linear 700ms;
}

#introOverlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#introOverlay::before,
#introOverlay::after {
  content: '';
  position: absolute;
  inset: -10%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 700ms var(--intro-ease), transform 1200ms var(--intro-ease), filter 1200ms var(--intro-ease);
}

#introOverlay::before {
  background:
    radial-gradient(circle at 30% 40%, rgba(72, 164, 255, 0.16), transparent 22%),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.12), transparent 18%);
}

#introOverlay::after {
  background-image:
    linear-gradient(115deg, rgba(255,255,255,0.10) 0%, transparent 24%),
    linear-gradient(245deg, rgba(255,255,255,0.08) 0%, transparent 20%),
    radial-gradient(circle, rgba(255,255,255,0.55) 0 1px, transparent 1.6px);
  background-size: auto, auto, 28px 28px;
  mix-blend-mode: screen;
  filter: blur(0px);
}

#introOverlay.is-dissipating::before,
#introOverlay.is-dissipating::after {
  opacity: 1;
  transform: scale(1.08);
  filter: blur(12px);
}

.intro-panel {
  position: relative;
  width: min(92vw, 1180px);
  min-height: min(78vh, 760px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  overflow: hidden;
  background: rgba(10, 14, 22, 0.88);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.intro-choice,
.intro-video-view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 4vw, 48px);
  transition:
    opacity 420ms var(--intro-ease),
    transform 420ms var(--intro-ease),
    visibility 0s linear 420ms;
}

.intro-choice {
  flex-direction: column;
  gap: 20px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)),
    radial-gradient(circle at top, rgba(93, 180, 255, 0.14), transparent 35%);
}

.intro-video-view {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.015);
  background: #020305;
}

#introOverlay.is-video-mode .intro-choice {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.985);
}

#introOverlay.is-video-mode .intro-video-view {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition-delay: 40ms;
}

.intro-copy {
  max-width: 760px;
}

.intro-kicker {
  margin: 0 0 14px;
  font-size: 0.88rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.75;
}

.intro-title {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 5.5rem);
  line-height: 0.94;
}

.intro-subtitle {
  margin: 18px auto 0;
  max-width: 40rem;
  font-size: clamp(1rem, 1.2vw, 1.18rem);
  line-height: 1.55;
  opacity: 0.82;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: 28px;
}

.replay-intro {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(66, 245, 255, 0.3);
  padding-bottom: 1px;
  transition: border-color var(--transition-fast);
}
.replay-intro:hover { border-bottom-color: var(--accent); }

/* ---------- Overlay circuit trace ----------
   A scaled-down take on the /events rails: instead of running down the page
   edges, the line draws around the panel, holds lit, then fades — the same
   70/10/20 rhythm, at 6s so a visitor sees it resolve before they click.
   Colour cycles through the full site palette on its own timer, kept in
   --intro-c so it never fights circuit.js's slower --circuit cycle. */

#introOverlay {
  --intro-pass: 6s;
  --intro-c: var(--circuit-cyan, #42f5ff);
}

.intro-trace {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  color: var(--intro-c);
  transition: color 900ms ease-in-out;
}
.intro-trace rect {
  fill: none;
  stroke: currentColor;
  vector-effect: non-scaling-stroke;
}
.intro-trace .t-static { stroke-width: 1; stroke-opacity: 0.16; }

.intro-trace .t-trail {
  stroke-width: 1.6;
  stroke-dasharray: 1000 1000;
  stroke-dashoffset: 1000;
  stroke-opacity: 0;
  filter: drop-shadow(0 0 3px currentColor) drop-shadow(0 0 9px currentColor);
  animation: introTrail var(--intro-pass) linear infinite;
}
.intro-trace .t-head {
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 30 970;
  stroke-dashoffset: 30;
  stroke-opacity: 0;
  filter: drop-shadow(0 0 4px currentColor) drop-shadow(0 0 13px currentColor);
  animation: introHead var(--intro-pass) linear infinite;
}
.intro-trace .t-nodes circle {
  fill: currentColor;
  fill-opacity: 0.5;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 0.8;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.6))
          drop-shadow(0 0 8px currentColor);
  animation: introNode 4.4s ease-in-out infinite;
}
.intro-trace .t-nodes circle:nth-child(2) { animation-delay: -1.1s; }
.intro-trace .t-nodes circle:nth-child(3) { animation-delay: -2.2s; }
.intro-trace .t-nodes circle:nth-child(4) { animation-delay: -3.3s; }

@keyframes introTrail {
  0%   { stroke-dashoffset: 1000; stroke-opacity: 0; }
  5%   { stroke-opacity: 0.5; }
  70%  { stroke-dashoffset: 0; stroke-opacity: 0.5; }
  80%  { stroke-dashoffset: 0; stroke-opacity: 0.5; }
  100% { stroke-dashoffset: 0; stroke-opacity: 0; }
}
@keyframes introHead {
  0%   { stroke-dashoffset: 30; stroke-opacity: 0; }
  5%   { stroke-opacity: 0.9; }
  70%  { stroke-dashoffset: -970; stroke-opacity: 0.9; }
  80%  { stroke-dashoffset: -970; stroke-opacity: 0.9; }
  100% { stroke-dashoffset: -970; stroke-opacity: 0; }
}
@keyframes introNode {
  0%, 100% { fill-opacity: 0.34; }
  50%      { fill-opacity: 0.92; }
}

/* Keep the choice and video views above the trace. */
.intro-choice, .intro-video-view { z-index: 1; }

/* The live button carries the cycling colour, so the eye lands on it even
   though it sits third. */
.intro-btn--events {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  border-color: color-mix(in srgb, var(--intro-c) 60%, transparent);
  background: color-mix(in srgb, var(--intro-c) 13%, rgba(255, 255, 255, 0.05));
  box-shadow: 0 0 20px color-mix(in srgb, var(--intro-c) 26%, transparent);
  transition: background 180ms ease, border-color 900ms ease-in-out,
              box-shadow 900ms ease-in-out, transform 180ms ease;
}
.intro-btn--events:hover {
  background: color-mix(in srgb, var(--intro-c) 24%, transparent);
  transform: translateY(-1px);
}
.intro-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--intro-c);
  box-shadow: 0 0 8px var(--intro-c);
  animation: introLive 2.4s ease-in-out infinite;
}
@keyframes introLive { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.intro-btn {
  min-width: 220px;
  min-height: 52px;
  padding: 14px 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  letter-spacing: 0.01em;
  background: rgba(255, 255, 255, 0.05);
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.intro-btn:hover,
.intro-btn:focus-visible {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.28);
}

.intro-btn--primary {
  background: rgba(255,255,255,0.95);
  color: #0b1020;
  border-color: transparent;
}

.intro-btn--primary:hover,
.intro-btn--primary:focus-visible {
  background: #ffffff;
}

.intro-video-shell {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
}

#introVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.intro-top-controls {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 10px;
  z-index: 3;
}

.intro-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.22);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0.18;
  transform: scale(0.94);
  transition:
    opacity 200ms ease,
    transform 200ms ease,
    background 200ms ease,
    border-color 200ms ease;
}

.intro-panel:hover .intro-icon-btn,
.intro-panel:focus-within .intro-icon-btn,
.intro-hit-area:hover + .intro-top-controls .intro-icon-btn,
.intro-hit-area:focus + .intro-top-controls .intro-icon-btn {
  opacity: 1;
  transform: scale(1);
}

.intro-icon-btn:hover,
.intro-icon-btn:focus-visible {
  opacity: 1;
  transform: scale(1);
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.28);
}

.intro-hit-area {
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  z-index: 2;
  background: transparent;
}

.intro-icon-btn svg {
  width: 22px;
  height: 22px;
  pointer-events: none;
}

.intro-sr-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .intro-panel {
    width: 100vw;
    min-height: 100dvh;
    border-radius: 0;
    border: 0;
  }

  .intro-choice,
  .intro-video-view {
    padding: 24px;
  }

  .intro-actions {
    flex-direction: column;
    width: 100%;
  }

  /* The header nav has no small-screen handling and overflows a phone
     viewport. Keep the live product and the contact CTA; the rest are a
     short scroll away in the page itself. */
  .nav-links { gap: 12px; }
  .nav-links .nav-link:not(.nav-link-live),
  .nav-cta-ghost { display: none; }

  .intro-btn {
    width: 100%;
    min-width: 0;
  }

  .intro-top-controls {
    top: 14px;
    right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #introOverlay,
  #introOverlay::before,
  #introOverlay::after,
  .intro-choice,
  .intro-video-view,
  .intro-btn,
  .intro-icon-btn {
    transition: none !important;
    animation: none !important;
  }
}
