/* Full-page cipher matrix background — DecodeCipher homepage */

body.has-page-matrix {
  position: relative;
  background: #080d18;
  padding: 0;
}

body.has-page-matrix #crypto-bg {
  display: none;
}

.page-matrix-bg,
.cipher-matrix-bg.page-matrix-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  display: grid;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.68;
  background:
    radial-gradient(ellipse 90% 80% at 50% 35%, rgba(37, 99, 235, 0.06), transparent 70%),
    radial-gradient(ellipse 100% 100% at 50% 50%, transparent 35%, rgba(8, 13, 24, 0.55) 100%);
  mask-image: radial-gradient(ellipse 95% 85% at 50% 42%, black 25%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 95% 85% at 50% 42%, black 25%, transparent 100%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
}

.page-shell > .matrix-hero,
.page-shell > .site-top-nav,
.page-shell > .card,
.page-shell > .education-promo,
.page-shell > .enigma-promo,
.page-shell > .section-shell,
.page-shell > .signal-lab,
.page-shell > .about-portal,
.page-shell > .ad-container,
.page-shell > .privacy-note,
.page-shell > .site-footer-nav,
.page-shell > .footer-contact {
  position: relative;
  z-index: 1;
}

/* Readable panels over matrix */
body.has-page-matrix .card,
body.has-page-matrix .about-portal,
body.has-page-matrix .education-promo-inner,
body.has-page-matrix .edu-promo-card,
body.has-page-matrix .enigma-promo-inner,
body.has-page-matrix .signal-pipeline-wrap {
  background: rgba(17, 24, 39, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* Hero (typography only — background is page-level) */
.matrix-hero {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin-bottom: 2.5rem;
  text-align: center;
}

.hero-content {
  position: relative;
  padding: 0.5rem 1.25rem 0;
}

.matrix-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #4f8ef7 0%, #3ecf8e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.matrix-hero p {
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-top: 0.4rem;
}

.matrix-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 14px;
  color: rgba(96, 165, 250, 0.32);
  opacity: calc(0.12 + var(--intensity, 0) * 0.95);
  text-shadow:
    0 0 calc(var(--intensity, 0) * 18px) rgba(56, 189, 248, 0.95),
    0 0 calc(var(--intensity, 0) * 34px) rgba(52, 211, 153, 0.45);
  transform: scale(calc(1 + var(--intensity, 0) * 0.28));
  transition:
    color 140ms ease,
    opacity 140ms ease,
    text-shadow 140ms ease,
    transform 140ms ease;
  user-select: none;
  pointer-events: none;
}

.matrix-tile.active {
  color: rgba(52, 211, 153, 0.98);
}

.matrix-tile.glitch {
  animation: matrix-glitch 220ms ease;
}

.matrix-tile.glitch-soft {
  animation: matrix-glitch-soft 180ms ease;
}

@keyframes matrix-glitch {
  0% {
    transform: scale(1);
    color: rgba(96, 165, 250, 0.5);
  }
  50% {
    transform: scale(1.38);
    color: rgba(255, 255, 255, 0.98);
    text-shadow: 0 0 20px rgba(125, 211, 252, 1);
  }
  100% {
    transform: scale(1);
    color: rgba(52, 211, 153, 0.9);
  }
}

@keyframes matrix-glitch-soft {
  0% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.55;
    color: rgba(125, 211, 252, 0.75);
  }
  100% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-matrix-bg {
    opacity: 0.24;
  }

  .matrix-tile {
    transition: none;
    animation: none !important;
    transform: none;
    opacity: 0.2;
  }
}

@media (max-width: 700px) {
  .matrix-tile {
    font-size: 12px;
  }

  .page-shell {
    padding: 1.5rem 0.75rem 3rem;
  }
}
