/* ==========================================================================
   GENESIS VANGUARD — Neural Link Interface v2.0
   Military-Grade Trading Terminal Access Dialog
   Void Frame · Perimeter Laser · Liquid Distortion · EKG Bar
   ========================================================================== */

/* ── Overlay ── */
.vanguard-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  opacity: 0;
  visibility: hidden;
  transition: background 0.5s ease, opacity 0.5s ease, visibility 0.5s ease;
  padding: 20px;
}

.vanguard-overlay.vanguard-active {
  opacity: 1;
  visibility: visible;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.vanguard-overlay.vanguard-closing {
  opacity: 0;
  transition: opacity 0.5s ease;
}


/* ── Void Frame — Dual-Layer Glassmorphic Container ── */
.vanguard-border-wrap {
  position: relative;
  padding: 2px;
  border-radius: 18px;
  overflow: hidden;
  max-width: 560px;
  width: 100%;
  max-height: 92vh;
}

/* Perimeter Laser — high-speed data stream */
.vanguard-border-wrap::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    transparent 60%,
    rgba(1, 71, 81, 0.6) 72%,
    rgba(1, 71, 81, 0.9) 78%,
    rgba(1, 71, 81, 0.6) 84%,
    transparent 92%,
    transparent 100%
  );
  animation: vanguardLaser 2.8s linear infinite;
  filter: blur(0.5px);
}

/* Secondary data-stream layer — subtle counter-rotation */
.vanguard-border-wrap::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: conic-gradient(
    from 180deg,
    transparent 0%,
    transparent 68%,
    rgba(1, 71, 81, 0.25) 76%,
    rgba(1, 71, 81, 0.4) 80%,
    rgba(1, 71, 81, 0.25) 84%,
    transparent 90%,
    transparent 100%
  );
  animation: vanguardLaser 4.2s linear infinite reverse;
  filter: blur(1px);
}

@keyframes vanguardLaser {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}


/* ── Dialog Surface — Void Frame Interior ── */
.vanguard-dialog {
  position: relative;
  border-radius: 16px;
  background: rgba(7, 7, 8, 0.92);
  backdrop-filter: blur(40px) saturate(1.2);
  -webkit-backdrop-filter: blur(40px) saturate(1.2);
  overflow: hidden;
  max-height: calc(92vh - 4px);
  overflow-y: auto;
  clip-path: inset(0 0 100% 0);
  border: 1px solid rgba(1, 71, 81, 0.12);
}

.vanguard-active .vanguard-dialog {
  animation: vanguardScanIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes vanguardScanIn {
  from { clip-path: inset(0 0 100% 0); }
  to   { clip-path: inset(0 0 0% 0); }
}

/* Scan line — leading edge */
.vanguard-dialog::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(1, 71, 81, 0.7) 35%, rgba(1, 71, 81, 0.9) 50%, rgba(1, 71, 81, 0.7) 65%, transparent 95%);
  box-shadow: 0 0 20px rgba(1, 71, 81, 0.4), 0 0 60px rgba(1, 71, 81, 0.1);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
}

.vanguard-active .vanguard-dialog::after {
  animation: vanguardScanLine 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes vanguardScanLine {
  0%   { top: 0%;   opacity: 1; }
  85%  { top: 100%; opacity: 0.5; }
  100% { top: 100%; opacity: 0; }
}


/* ── Liquid Distortion Canvas (GLSL Background) ── */
.vanguard-liquid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  border-radius: 16px;
}


/* ── Close Button — Minimal ── */
.vanguard-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.3);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  line-height: 1;
  padding: 0;
}

.vanguard-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  border-color: rgba(1, 71, 81, 0.3);
}


/* ── Content Wrapper ── */
.vanguard-content {
  position: relative;
  z-index: 2;
  padding: 52px 44px 44px;
  text-align: center;
}


/* ── Protocol Header Badge ── */
.vanguard-protocol-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  border-radius: 4px;
  border: 1px solid rgba(1, 71, 81, 0.3);
  background: linear-gradient(
    135deg,
    rgba(1, 71, 81, 0.15) 0%,
    rgba(7, 7, 8, 0.8) 50%,
    rgba(1, 71, 81, 0.08) 100%
  );
  font-family: 'Inter', monospace;
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 6px;
  color: rgba(1, 71, 81, 0.9);
  text-transform: uppercase;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  perspective: 600px;
  animation: badgeFloat 6s ease-in-out infinite;
  transform-style: preserve-3d;
}

.vanguard-protocol-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(1, 71, 81, 0.7);
  animation: badgeDotPulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(1, 71, 81, 0.4);
}

@keyframes badgeDotPulse {
  0%, 100% { opacity: 0.4; box-shadow: 0 0 4px rgba(1, 71, 81, 0.2); }
  50%      { opacity: 1;   box-shadow: 0 0 12px rgba(1, 71, 81, 0.5); }
}

/* Holographic sweep */
.vanguard-protocol-badge::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.04) 50%, transparent 80%);
  animation: hologramSweep 4s ease-in-out infinite;
}

@keyframes badgeFloat {
  0%, 100% { transform: rotateY(-3deg) rotateX(1deg); }
  50%      { transform: rotateY(3deg) rotateX(-1deg); }
}

@keyframes hologramSweep {
  0%, 100% { transform: translateX(-120%); }
  50%      { transform: translateX(120%); }
}


/* ── Counter Section — OLED Neon ── */
.vanguard-counter-section {
  margin-bottom: 28px;
}

.vanguard-counter-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.52rem;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 4px;
}

/* Slot-machine wrapper */
.vanguard-counter-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  height: 4.5rem;
  line-height: 4.5rem;
}

.vanguard-counter {
  font-family: 'Inter', monospace;
  font-size: 4.2rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  margin: 8px 0;
  text-shadow:
    0 0 30px rgba(1, 71, 81, 0.6),
    0 0 80px rgba(1, 71, 81, 0.2),
    0 0 120px rgba(1, 71, 81, 0.08);
  position: relative;
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Chromatic aberration flash on counter change */
.vanguard-counter.vg-glitch {
  animation: counterGlitch 0.5s ease;
}

@keyframes counterGlitch {
  0%   { opacity: 1; transform: translateY(0); }
  8%   { opacity: 0.5; transform: translateY(-8px); text-shadow: -3px 0 rgba(255, 0, 64, 0.5), 3px 0 rgba(1, 71, 81, 0.8); }
  16%  { opacity: 0.7; transform: translateY(4px); text-shadow: 2px 0 rgba(255, 0, 64, 0.3), -2px 0 rgba(1, 71, 81, 0.6); }
  30%  { opacity: 0.8; transform: translateY(-2px); filter: blur(1px); }
  50%  { opacity: 1; transform: translateY(0); text-shadow: 0 0 40px rgba(1, 71, 81, 0.8); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0); text-shadow: 0 0 30px rgba(1, 71, 81, 0.6), 0 0 80px rgba(1, 71, 81, 0.2), 0 0 120px rgba(1, 71, 81, 0.08); }
}


/* ── EKG Progress Bar ── */
.vanguard-ekg-wrap {
  width: 100%;
  max-width: 320px;
  height: 24px;
  margin: 16px auto 0;
  position: relative;
  overflow: hidden;
}

.vanguard-ekg-track {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 1px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.vanguard-ekg-fill {
  height: 100%;
  background: rgba(1, 71, 81, 0.5);
  border-radius: 1px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* EKG pulse traveling along the bar */
.vanguard-ekg-pulse {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 24px;
  pointer-events: none;
  animation: ekgTravel 2.5s linear infinite;
  opacity: 0.8;
}

.vanguard-ekg-pulse svg {
  width: 100%;
  height: 100%;
}

.vanguard-ekg-pulse svg path {
  stroke: rgba(1, 71, 81, 0.8);
  stroke-width: 1.5;
  fill: none;
  filter: drop-shadow(0 0 4px rgba(1, 71, 81, 0.5));
}

@keyframes ekgTravel {
  0%   { left: -60px; opacity: 0; }
  10%  { opacity: 0.8; }
  80%  { opacity: 0.8; }
  100% { left: 100%; opacity: 0; }
}


/* ── Marketing Copy ── */
.vanguard-headline {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 3px;
  margin-bottom: 6px;
  text-transform: uppercase;
  line-height: 1.4;
}

.vanguard-headline-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1px;
  margin-bottom: 22px;
  line-height: 1.7;
}

.vanguard-offer {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.75;
  margin-bottom: 12px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.vanguard-offer strong {
  color: rgba(255, 255, 255, 0.75);
}

.vanguard-price-tag {
  font-weight: 900;
  font-size: 1.15rem;
  color: #fff;
  display: inline-block;
  text-shadow: 0 0 20px rgba(1, 71, 81, 0.4);
}

.vanguard-savings {
  color: #00c853;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}

.vanguard-hook {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
  margin-bottom: 28px;
  letter-spacing: 0.5px;
}

.vanguard-hook em {
  color: rgba(1, 71, 81, 0.8);
  font-style: italic;
  font-weight: 600;
}


/* ── CTA Button — Teal Gradient ── */
.vanguard-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 44px;
  background: linear-gradient(135deg, #014751, #02606e);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid rgba(1, 71, 81, 0.4);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 2px 20px rgba(1, 71, 81, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.vanguard-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(1, 71, 81, 0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.vanguard-cta:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 35px rgba(1, 71, 81, 0.35),
    0 0 60px rgba(1, 71, 81, 0.1);
  border-color: rgba(1, 71, 81, 0.6);
  color: #fff;
}

.vanguard-cta:hover::before {
  opacity: 1;
}

.vanguard-cta:active {
  transform: translateY(0);
}

.vanguard-cta i {
  font-size: 0.85rem;
  transition: transform 0.3s ease;
}

.vanguard-cta:hover i {
  transform: translateX(3px);
}


/* ── Staggered Element Entrance ── */
.vanguard-active .vanguard-protocol-badge   { animation: vgFadeUp 0.6s ease 0.15s both; }
.vanguard-active .vanguard-counter-section  { animation: vgFadeUp 0.6s ease 0.3s both; }
.vanguard-active .vanguard-headline         { animation: vgChromatic 0.7s ease 0.25s both; }
.vanguard-active .vanguard-headline-sub     { animation: vgFadeUp 0.5s ease 0.45s both; }
.vanguard-active .vanguard-offer            { animation: vgFadeUp 0.5s ease 0.55s both; }
.vanguard-active .vanguard-hook             { animation: vgFadeUp 0.5s ease 0.65s both; }
.vanguard-active .vanguard-cta              { animation: vgFadeUp 0.5s ease 0.75s both; }
.vanguard-active .vanguard-swipe            { animation: vgFadeUp 0.5s ease 0.85s both; }

@keyframes vgFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Chromatic Aberration on Headline */
@keyframes vgChromatic {
  0%   { opacity: 0; transform: translateY(18px); text-shadow: -3px 0 rgba(255, 0, 64, 0.3), 3px 0 rgba(1, 71, 81, 0.5); filter: blur(2px); }
  35%  { opacity: 1; transform: translateY(4px);  text-shadow: -1px 0 rgba(255, 0, 64, 0.1), 1px 0 rgba(1, 71, 81, 0.3); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0);    text-shadow: none; filter: blur(0); }
}


/* ── Swipe to Join (Mobile) ── */
.vanguard-swipe {
  display: none;
  margin-top: 24px;
}

.vanguard-swipe-track {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 52px;
  background: rgba(1, 71, 81, 0.06);
  border: 1px solid rgba(1, 71, 81, 0.15);
  border-radius: 26px;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}

.vanguard-swipe-thumb {
  position: absolute;
  left: 4px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #014751, #02606e);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  cursor: grab;
  z-index: 2;
  transition: left 0.1s ease;
  touch-action: none;
  box-shadow: 0 0 16px rgba(1, 71, 81, 0.3);
}

.vanguard-swipe-thumb:active {
  cursor: grabbing;
}

.vanguard-swipe-label {
  position: absolute;
  width: 100%;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 0.5rem;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  pointer-events: none;
  z-index: 1;
  animation: swipeShimmer 3s ease-in-out infinite;
}

@keyframes swipeShimmer {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 0.45; }
}


/* ── Mobile Centered Dialog ── */
@media (max-width: 767px) {
  .vanguard-overlay {
    padding: 16px;
    align-items: center;
    justify-content: center;
  }

  .vanguard-overlay.vanguard-active {
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
  }

  .vanguard-border-wrap {
    border-radius: 18px;
    max-width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    width: 100%;
  }

  .vanguard-dialog {
    border-radius: 16px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .vanguard-liquid {
    border-radius: 16px;
  }

  .vanguard-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    width: 44px;
    height: 44px;
  }

  .vanguard-content {
    padding: 20px 28px 24px;
  }

  .vanguard-headline {
    font-size: 0.95rem;
    letter-spacing: 2px;
  }

  .vanguard-headline-sub {
    font-size: 0.65rem;
  }

  .vanguard-counter {
    font-size: 3.2rem;
  }

  .vanguard-counter-wrap {
    height: 3.6rem;
    line-height: 3.6rem;
  }

  .vanguard-offer {
    font-size: 0.72rem;
  }

  .vanguard-hook {
    font-size: 0.68rem;
  }

  .vanguard-cta {
    display: none;
  }

  .vanguard-swipe {
    display: block;
    margin-bottom: 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (max-width: 480px) {
  .vanguard-content {
    padding: 40px 20px 24px;
  }

  .vanguard-headline {
    font-size: 0.82rem;
    letter-spacing: 1.5px;
  }

  .vanguard-counter {
    font-size: 2.6rem;
  }

  .vanguard-counter-wrap {
    height: 3rem;
    line-height: 3rem;
  }

  .vanguard-protocol-badge {
    font-size: 0.45rem;
    letter-spacing: 4px;
    padding: 6px 18px;
  }

  .vanguard-ekg-wrap {
    max-width: 240px;
  }
}


/* ── Scrollbar ── */
.vanguard-dialog::-webkit-scrollbar {
  width: 2px;
}

.vanguard-dialog::-webkit-scrollbar-track {
  background: transparent;
}

.vanguard-dialog::-webkit-scrollbar-thumb {
  background: rgba(1, 71, 81, 0.2);
  border-radius: 1px;
}
