:root {
  --color-background: #02030a;
  --color-surface: #050816;
  --color-surface-strong: #0b1020;
  --color-primary: #8765ff;
  --color-primary-soft: #4c9dff;
  --color-accent: #00e0ff;
  --color-success: #4ade80;
  --color-warning: #facc15;
  --color-error: #fb7185;
  --color-text: #e5e7eb;
  --color-text-muted: #9ca3af;
}

body {
  background: radial-gradient(circle at 10% -10%, #050816 0, #02030a 38%, #000 100%);
  color: var(--color-text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* Subtle patterned overlay behind the main app for depth (dots + soft squares) */
#app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -20;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: overlay;
  /* Square grid background (matches map grid style) */
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px;
  background-color: transparent;
  filter: blur(0.6px) saturate(110%);
}

/* Slightly stronger pattern near top to accent hero area */
@media (min-width: 768px) {
  #app::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: 360px;
    z-index: -19;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(135,101,255,0.04), transparent 40%);
    mix-blend-mode: screen;
    opacity: 0.9;
    pointer-events: none;
  }
}

.font-display {
  font-family: "Orbitron", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* Utility surfaces */
.bg-surface {
  background-color: color-mix(
    in srgb,
    var(--color-surface) 96%,
    rgba(255, 255, 255, 0.02)
  );
}

.bg-surface-strong {
  background-color: color-mix(
    in srgb,
    var(--color-surface-strong) 96%,
    rgba(255, 255, 255, 0.02)
  );
}

.text-primary {
  color: var(--color-primary);
}

.bg-primary {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-soft) 55%,
    var(--color-accent) 100%
  );
}

.bg-accent {
  background-color: var(--color-accent);
}

.bg-success {
  background-color: var(--color-success);
}

.bg-warning {
  background-color: var(--color-warning);
}

.bg-error {
  background-color: var(--color-error);
}

/* Glassmorphism card */
.glass {
  background: linear-gradient(
    135deg,
    rgba(10, 16, 30, 0.82),
    rgba(5, 10, 24, 0.96)
  );
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  /* Frosted glass border — subtle colored rim with inner highlight */
  border-radius: 12px;
  position: relative;
  border: 1px solid rgba(129, 140, 248, 0.06);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.02) inset,
    0 8px 30px rgba(2,6,23,0.6);
}
/* subtle rim using pseudo element for a slightly iridescent edge */
.glass::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: -1px;
  border-radius: 13px;
  background: linear-gradient(90deg, rgba(129,140,248,0.06), rgba(56,189,248,0.03));
  mask: linear-gradient(#000, #000);
  mix-blend-mode: overlay;
  opacity: 0.8;
}

/* Section layout helpers */
.section {
  scroll-margin-top: 96px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.section-eyebrow {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #6b7280;
}

.section-title {
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 1.25rem;
  line-height: 1.4;
  color: #e5e7eb;
  letter-spacing: 0.03em;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 1.5rem;
  }
}

.section-subtitle {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Cards */
.section-card {
  border-radius: 1.25rem;
  /* softened cool-toned rim to replace the old white seam */
  border: 1px solid rgba(76, 157, 255, 0.06);
  background: linear-gradient(
      135deg,
      rgba(12, 18, 34, 0.96),
      rgba(6, 10, 18, 0.98)
    );
  /* subtle inner highlight using primary-soft tint to keep edges feeling glassy */
  box-shadow:
    0 1px 0 rgba(76, 157, 255, 0.02) inset,
    0 10px 22px rgba(2, 6, 23, 0.6);
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-ghost,
.toggle-pill,
.nav-link,
.social-pill {
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1.1rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 160ms ease-out;
  outline: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-soft) 50%,
    var(--color-accent) 100%
  );
  color: #0b1020;
  box-shadow: 0 10px 25px rgba(79, 70, 229, 0.5);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 35px rgba(79, 70, 229, 0.6);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.45);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(76, 157, 255, 0.06);
  color: #e5e7eb;
}

.btn-secondary:hover {
  background: rgba(15, 23, 42, 1);
  border-color: rgba(148, 163, 184, 0.7);
}

.btn-ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.25);
  color: #9ca3af;
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(148, 163, 184, 0.45);
  color: #e5e7eb;
}

.nav-link {
  background: transparent;
  border-color: transparent;
  color: #9ca3af;
  padding-inline: 0.25rem;
}

.nav-link:hover {
  color: #e5e7eb;
}

.nav-link.is-active {
  color: var(--color-primary);
}

.toggle-pill {
  padding-inline: 0.9rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(255, 255, 255, 0.035);
  color: #9ca3af;
}

.toggle-pill.is-active {
  background: linear-gradient(
    135deg,
    rgba(129, 140, 248, 0.2),
    rgba(96, 165, 250, 0.2)
  );
  border-color: rgba(129, 140, 248, 0.75);
  color: var(--color-primary-soft);
}

.social-pill {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(148, 163, 184, 0.4);
  color: #e5e7eb;
  padding-inline: 0.75rem;
}

.social-pill:hover {
  background: rgba(15, 23, 42, 1);
  border-color: rgba(148, 163, 184, 0.7);
}

/* Magnetic buttons */
.magnetic {
  position: relative;
  will-change: transform;
}

/* Range input */
.range-input {
  width: 100%;
  cursor: pointer;
  -webkit-appearance: none;
  background: transparent;
}

.range-input:focus {
  outline: none;
}

.range-input::-webkit-slider-runnable-track {
  height: 6px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
}
.range-input::-moz-range-track {
  height: 6px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-accent) 100%
  );
  border: 2px solid #020617;
  margin-top: -6px;
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.3);
}
.range-input::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border-radius: 999px;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-accent) 100%
  );
  border: 2px solid #020617;
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.3);
}

/* Metric cards & bars */
.metric-card {
  border-radius: 0.9rem;
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.98),
    rgba(2, 6, 23, 1)
  );
  border: 1px solid rgba(129, 140, 248, 0.3);
  padding: 0.55rem 0.7rem;
}

.metric-bar {
  margin-top: 0.25rem;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(30, 64, 175, 0.6);
}

.metric-bar-inner {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  transform-origin: left;
  transition: transform 220ms ease-out;
}

/* Ping dot */
.ping-dot {
  display: inline-flex;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background-color: var(--color-success);
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.8);
  animation: ping-pulse 1.3s infinite;
}

/* Loader line */
.loader-line {
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(129, 140, 248, 0),
    rgba(129, 140, 248, 0.9),
    rgba(59, 130, 246, 0)
  );
  animation: loader-slide 2.4s ease-in-out infinite;
}

/* Fields */
.field-group {
  font-size: 0.75rem;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.field-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;

}

.field-label-meta {
  font-size: 0.7rem;
  color: #6b7280;
}

/* Toggle chips */
.chip {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.9);
  color: #9ca3af;
  padding: 0.4rem 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  transition: all 160ms ease-out;
}

.chip span:first-child {
  font-size: 0.75rem;
  color: #e5e7eb;
  margin-left: 0.35rem;
}

.chip-description {
  display: block;
  font-size: 0.65rem;
  color: #6b7280;
  margin-left: 0.35rem;
}

.chip.is-active {
  border-color: rgba(129, 140, 248, 0.9);
  color: #e5e7eb;
  background: linear-gradient(
    135deg,
    rgba(129, 140, 248, 0.32),
    rgba(56, 189, 248, 0.24)
  );
}

/* Feature icon */
.feature-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: radial-gradient(
      circle at top left,
      rgba(129, 140, 248, 0.3),
      transparent 60%
    ),
    rgba(15, 23, 42, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-soft);
}

/* Feature card */
.feature-card {
  border-radius: 1rem;
  border: 1px solid rgba(15, 23, 42, 0.9);
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.98),
    rgba(2, 6, 23, 1)
  );
  padding: 1rem;
  font-size: 0.75rem;
  color: #9ca3af;
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out,
    border-color 180ms ease-out;
}

.feature-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(
    135deg,
    rgba(129, 140, 248, 0.18),
    transparent 40%,
    rgba(56, 189, 248, 0.18)
  );
  opacity: 0;
  transition: opacity 220ms ease-out;
  pointer-events: none;
}

.feature-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
  border-color: rgba(55, 65, 81, 0.9);
}

.feature-card:hover::before {
  opacity: 1;
}

/* Map grid overlay */
.map-grid-overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      rgba(15, 23, 42, 0.6) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(15, 23, 42, 0.6) 1px,
      transparent 1px
    );
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
  opacity: 0.35;
}

/* Map markers & routes */
.map-marker {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: radial-gradient(circle at center, var(--color-accent), #020617);
  border: 1px solid rgba(15, 23, 42, 0.9);
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.22);
  transform: translate(-50%, -50%);
}

.map-marker::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  border: 1px solid rgba(56, 189, 248, 0.32);
  animation: ping-soft 1.8s infinite;
}

.map-route {
  position: absolute;
  pointer-events: none;
}

/* Panel */
.panel-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
}

.panel-terminal {
  background: linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.98),
      rgba(2, 6, 23, 1)
    );
  border-radius: 0.8rem;
  border: 1px solid rgba(30, 64, 175, 0.6);
  padding: 0.5rem;
  height: 176px;
  overflow: hidden;
}
@media (min-width: 768px) {
  .panel-terminal {
    height: 210px;
  }
}

.panel-terminal-inner {
  color: #d1fae5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 100%;
  padding-right: 6px;
  -webkit-font-smoothing: antialiased;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

/* Players */
.player-chip {
  border-radius: 0.7rem;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: rgba(15, 23, 42, 0.95);
  padding: 0.3rem 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #e5e7eb;
}

/* Performance graphs */
.perf-card {
  border-radius: 0.9rem;
  border: 1px solid rgba(31, 41, 55, 0.9);
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.98),
    rgba(2, 6, 23, 1)
  );
  padding: 0.7rem;
}

.perf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #e5e7eb;
  margin-bottom: 0.35rem;
}

.perf-graph {
  position: relative;
  height: 52px;
  border-radius: 0.6rem;
  background: rgba(15, 23, 42, 0.96);
  overflow: hidden;
  border: 1px solid rgba(30, 64, 175, 0.7);
}

/* Links */
.link-muted {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #9ca3af;
  transition: color 140ms ease-out;
}
.link-muted:hover {
  color: #e5e7eb;
}

/* Smooth custom scrollbar for the dark theme */
:root {
  --scroll-bg: rgba(10,12,18,0.45);
  --scroll-thumb: rgba(79,70,229,0.22);
  --scroll-thumb-hover: rgba(79,70,229,0.34);
}

/* WebKit-based browsers */
*::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
  margin-block: 6px;
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), var(--scroll-thumb));
  border-radius: 999px;
  border: 2px solid rgba(2,6,23,0.6);
  min-height: 24px;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), var(--scroll-thumb-hover));
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) transparent;
}

/* Fade-in sections */
.fade-section {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 420ms ease-out, transform 420ms ease-out;
  will-change: opacity, transform;
}
.fade-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile menu */
#mobile-menu {
  transform-origin: top;
  transform: scaleY(0);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
  will-change: transform, opacity;
}

/* Animations */
@keyframes ping-pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(74, 222, 128, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

@keyframes ping-soft {
  0% {
    transform: scale(0.9);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes loader-slide {
  0% {
    transform: translateX(-40%);
  }
  50% {
    transform: translateX(20%);
  }
  100% {
    transform: translateX(120%);
  }
}

@keyframes perf-line {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes terminal-scroll {
  0% {
    transform: translateY(10px);
  }
  100% {
    transform: translateY(-10px);
  }
}

@keyframes pulse-soft {
  0% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.5;
  }
}

.animate-pulse-slow {
  animation: pulse-soft 1.8s ease-in-out infinite;
}

/* Performance graph lines */
.perf-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  background-image: radial-gradient(
    circle at 0 80%,
    rgba(129, 140, 248, 0.8) 0,
    transparent 25%
  );
  background-position: 0 0;
  background-size: 40px 100%;
  opacity: 0.7;
  animation: perf-line 4s linear infinite;
}

.perf-line.secondary {
  background-image: radial-gradient(
    circle at 0 40%,
    rgba(56, 189, 248, 0.7) 0,
    transparent 25%
  );
  opacity: 0.8;
  animation-duration: 5.5s;
}

.perf-line.latency {
  background-image: radial-gradient(
    circle at 0 60%,
    rgba(248, 250, 252, 0.6) 0,
    transparent 25%
  );
  opacity: 0.9;
  animation-duration: 6s;
}

/* Metric rows */
.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: #cbd5f5;
}

/* Misc */
.link-muted:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-ghost:focus-visible,
.toggle-pill:focus-visible {
  outline: 2px solid rgba(129, 140, 248, 0.9);
  outline-offset: 2px;
}

/* Mobile-specific adjustments to fix layout, spacing and overflow on small viewports */
@media (max-width: 640px) {
  /* Reduce header padding and make nav glass fit comfortably */
  header nav.glass {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    border-radius: 12px;
  }

  /* Make hero and panels stack cleanly and reduce gaps */
  #hero .grid,
  main > .section > .grid,
  .grid.gap-8,
  .grid.gap-6 {
    gap: 0.75rem !important;
  }

  /* Ensure hero visuals and card scale nicely */
  #hero .lg\\:grid-cols-\\[minmax\\(0,1.1fr\\)_minmax\\(0,0.9fr\\)\\] {
    grid-template-columns: 1fr !important;
  }

  /* Tighten typographic sizes for mobile */
  .font-display { font-size: 1rem; }
  h1 { font-size: 1.6rem; }
  .section-title { font-size: 1.05rem; }
  .section-subtitle, .text-xs { font-size: 0.78rem; }

  /* Mobile-friendly server selector card full width */
  #server-selector {
    padding: 0.75rem !important;
  }

  /* Reduce map SVG max height and ensure markers align */
  #locations svg {
    max-height: 180px;
    height: auto;
  }
  .map-marker {
    width: 10px;
    height: 10px;
  }

  /* Ensure routes don't overflow and remain visible */
  .map-route {
    opacity: 0.8;
  }

  /* Make mobile menu span full width with comfortable insets */
  #mobile-menu {
    left: 0.5rem !important;
    right: 0.5rem !important;
    top: calc(3.75rem) !important;
    transform-origin: top;
  }

  /* Shrink panel terminal height so it fits within mobile viewport */
  .panel-terminal {
    height: 140px;
  }

  /* Make performance graphs slightly shorter */
  .perf-graph {
    height: 44px;
  }

  /* Buttons and chips — ensure tap targets are big enough and wrap */
  .chip, .btn-primary, .btn-ghost, .btn-secondary {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    min-height: 44px;
  }

  /* Reduce outer page padding so content fits one screen height better */
  .section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Avoid unexpected horizontal overflow from shadows/pseudo elements */
  .glass::after, .feature-card::before {
    display: none;
  }

  /* Slightly increase scroll-thumb contrast on mobile for visibility */
  *::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255,255,255,0.04), var(--scroll-thumb-hover));
  }
}

/* --- Hero square grid + animated squares (matches map grid look) --- */
#hero {
  position: relative;
  overflow: visible;
}

/* Layered square grid inside hero using repeating-linear-gradients for crisp squares */
#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -5;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px;
  transform-origin: center;
  filter: blur(0.4px) saturate(115%);
  will-change: transform, opacity;
  transition: opacity 420ms ease-out, transform 8000ms linear;
  animation: hero-grid-drift 18s linear infinite;
}

/* Subtle radial vignette to focus hero content */
#hero::after {
  content: "";
  position: absolute;
  inset: -40% -10% auto -10%;
  height: 360px;
  z-index: -6;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(135,101,255,0.035), transparent 35%);
  mix-blend-mode: screen;
  opacity: 1;
}

/* Small floating square elements for depth — painted by CSS using multiple layered box-shadows */
.hero-floating {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: -4;
  opacity: 0.7;
  mix-blend-mode: screen;
}

/* Use multiple tiny glowing squares via box-shadow to avoid DOM bloat — animated gently */
.hero-floating::before {
  content: "";
  position: absolute;
  left: 10%;
  top: 18%;
  width: 8px;
  height: 8px;
  background: rgba(129,140,248,0.08);
  box-shadow:
    40px 60px 0 0 rgba(56,189,248,0.06),
    92px 10px 0 0 rgba(76,157,255,0.05),
    180px 48px 0 0 rgba(76,157,255,0.04),
    240px 120px 0 0 rgba(56,189,248,0.03),
    320px 30px 0 0 rgba(129,140,248,0.03);
  border-radius: 2px;
  transform-origin: center;
  animation: hero-squares-wobble 6.8s ease-in-out infinite;
  filter: blur(0.2px);
}

/* Secondary layer with different timing and positions for parallax */
.hero-floating::after {
  content: "";
  position: absolute;
  left: 45%;
  top: 60%;
  width: 6px;
  height: 6px;
  background: rgba(76,157,255,0.06);
  box-shadow:
    -64px -48px 0 0 rgba(56,189,248,0.04),
    28px -90px 0 0 rgba(129,140,248,0.04),
    140px -20px 0 0 rgba(56,189,248,0.03),
    -200px 30px 0 0 rgba(129,140,248,0.025);
  border-radius: 2px;
  animation: hero-squares-wobble 9.2s ease-in-out infinite reverse;
  filter: blur(0.3px);
}

/* Gentle drift animation for the grid to make it feel alive */
@keyframes hero-grid-drift {
  0% { transform: translateY(0) rotate(0.01deg); }
  50% { transform: translateY(-6px) rotate(0.03deg); }
  100% { transform: translateY(0) rotate(0.01deg); }
}

/* Soft wobble for floating squares */
@keyframes hero-squares-wobble {
  0% { transform: translate3d(0,0,0) scale(1); opacity: 0.9; }
  25% { transform: translate3d(6px,-4px,0) scale(1.03); opacity: 1; }
  50% { transform: translate3d(0,6px,0) scale(0.98); opacity: 0.85; }
  75% { transform: translate3d(-5px,-2px,0) scale(1.02); opacity: 1; }
  100% { transform: translate3d(0,0,0) scale(1); opacity: 0.9; }
}

/* Slight tilt/hover nudge when user moves pointer inside hero (desktop) */
@media (hover: hover) and (pointer: fine) {
  #hero:hover::before {
    transform: translateY(-12px) rotate(0.04deg);
    opacity: 0.22;
  }
}

/* Make sure mobile keeps subtlety and performance */
@media (max-width: 640px) {
  #hero::before { opacity: 0.12; background-size: 26px 26px, 26px 26px; }
  .hero-floating::before { box-shadow: none; opacity: 0.6; }
  .hero-floating::after { box-shadow: none; opacity: 0.5; }
}