/* flaskapp/static/css/errors.css */

/* Full screen container --------------------------------------------------- */

.error-page {
  position: relative;
  min-height: calc(100vh - 120px); /* room for navbar + footer */
  padding: 4rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;

  background: #050910;
  color: var(--frosted-mint);
}

/* Repeating ERROR / CODE background (sparse) ----------------------------- */

.error-grid {
  position: absolute;
  inset: 0;
  display: grid;
  /* fixed 10 columns so the alternating pattern is perfect in every row */
  grid-template-columns: repeat(10, minmax(0, 1fr));
  row-gap: 40px;
  column-gap: 40px;
  padding: 4rem 4rem 3rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(218, 247, 220, 0.36); /* frosted-mint, low opacity */
  pointer-events: none;
  box-sizing: border-box;
}

.error-grid-item {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  animation: error-grid-fade 8s ease-in-out infinite;
  opacity: 0.6;
}

.error-grid-item--code {
  color: rgba(158, 228, 147, 0.6); /* light-green */
}

/* individual delays set in JS */
@keyframes error-grid-fade {
  0% {
    opacity: 0.4;
    transform: translateY(0);
  }
  50% {
    opacity: 0.9;
    transform: translateY(-4px);
  }
  100% {
    opacity: 0.4;
    transform: translateY(0);
  }
}

/* Center hero ------------------------------------------------------------ */

.error-hero {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 640px;
  padding: 2rem 1rem;
}

.error-code {
  margin: 0;
  font-size: clamp(4.2rem, 11vw, 6.2rem);
  line-height: 0.9;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;

  background: linear-gradient(120deg, var(--light-green), var(--sky-reflection));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;

  text-shadow:
    0 0 26px rgba(158, 228, 147, 0.85),
    0 0 38px rgba(134, 187, 216, 0.9);
}

.error-message {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(218, 247, 220, 0.8);
}

/* glitch effect on the central code ------------------------------------- */

.error-code--glitch {
  animation: error-code-glitch 0.26s steps(2, end);
}

@keyframes error-code-glitch {
  0% {
    transform: translate3d(0, 0, 0);
    text-shadow:
      0 0 24px rgba(158, 228, 147, 0.9),
      2px 0 rgba(134, 187, 216, 1),
      -2px 0 rgba(51, 102, 153, 1);
  }
  50% {
    transform: translate3d(-2px, -1px, 0);
    text-shadow:
      0 0 26px rgba(158, 228, 147, 1),
      -3px 0 rgba(134, 187, 216, 1),
      3px 0 rgba(51, 102, 153, 1);
  }
  100% {
    transform: translate3d(1px, 1px, 0);
    text-shadow:
      0 0 26px rgba(158, 228, 147, 0.9),
      0 0 32px rgba(134, 187, 216, 0.95);
  }
}

/* subtle hero fade-in ---------------------------------------------------- */

.error-page--ready .error-hero {
  animation: error-hero-in 520ms cubic-bezier(0.16, 0.9, 0.35, 1) forwards;
  opacity: 0;
  transform: translate3d(0, 16px, 0);
}

@keyframes error-hero-in {
  from {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 768px) {
  .error-page {
    padding: 3.5rem 1rem;
  }

  .error-grid {
    padding: 3.5rem 1.5rem 2.5rem;
    row-gap: 28px;
    column-gap: 28px;
    font-size: 0.7rem;
    letter-spacing: 0.35em;
  }
}
