:root {
  --bg: #16161a;
  --fg: #e2e8f0;
  --purple: #6d28d9;
  --green: #059669;
  --rose: #be123c;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--fg);
  font-family: 'Space Mono', ui-monospace, monospace;
  background: var(--bg) linear-gradient(135deg, #121214, #1a1a24 50%, #201a24) 0 50% / 400% 400%;
  animation: drift 20s ease infinite;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

main {
  position: relative;
  z-index: 10;
  max-width: 50rem;
  padding: 2rem;
  text-align: center;
  pointer-events: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.thought {
  max-width: 34ch;
  min-height: 6em;
  margin: 0 auto;
  font-size: clamp(1.2rem, 3vw, 2.1rem);
  line-height: 1.5;
  text-wrap: balance;
  opacity: 0;
  filter: blur(.3px);
  transition: opacity 2s ease-in-out, color .3s, text-shadow .3s;
  pointer-events: auto;
}

.thought.visible { opacity: .9; }

.thought.glitch {
  transform: translate(2px, 1px) skew(-4deg);
  text-shadow: 4px 0 var(--rose), -4px 0 var(--purple);
  transition: none;
}

.thought:hover {
  color: #fff;
  text-shadow: 2px 0 var(--purple), -2px 0 var(--green);
}

.thought a { color: inherit; }

.layer {
  position: fixed;
  inset: 0;
  transition: transform .6s var(--ease);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .4;
  mix-blend-mode: screen;
}

.purple {
  top: 20%;
  left: 10%;
  width: 300px;
  height: 300px;
  background: var(--purple);
  animation: float-a 15s ease-in-out infinite;
}

.green {
  right: 15%;
  bottom: 10%;
  width: 400px;
  height: 400px;
  background: var(--green);
  animation: float-b 20s ease-in-out infinite reverse;
}

.rose {
  top: 40%;
  left: 50%;
  width: 250px;
  height: 250px;
  background: var(--rose);
  animation: float-c 18s ease-in-out infinite;
}

.grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(to right, rgb(255 255 255 / .03) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(255 255 255 / .03) 1px, transparent 1px);
  background-size: 50px 50px;
  transform: perspective(500px) rotateX(60deg) translateY(-100px) translateZ(-200px);
  animation: scroll 20s linear infinite;
  pointer-events: none;
}

.particle {
  position: fixed;
  z-index: 5;
  border-radius: 50%;
  background: rgb(255 255 255 / .5);
  pointer-events: none;
}

.ripple {
  position: fixed;
  z-index: 100;
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  border: 1px solid rgb(255 255 255 / .8);
  border-radius: 50%;
  pointer-events: none;
  animation: ripple 1s var(--ease) forwards;
}

@keyframes drift {
  50% { background-position: 100% 50%; }
}

@keyframes float-a {
  50% { transform: translate(50px, 100px) scale(1.1); }
}

@keyframes float-b {
  50% { transform: translate(-80px, -50px) scale(.9); }
}

@keyframes float-c {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-30%, 80px) scale(1.2) rotate(45deg); }
}

@keyframes scroll {
  to { background-position: 0 50px; }
}

@keyframes ripple {
  from { transform: scale(.05); opacity: 1; }
  to { transform: scale(1); opacity: 0; border-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .layer { transition: none; }
  .thought { transition-duration: .01s; }
}
