* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  color: #f5f5f5;
  background: #111;
}

main {
  width: min(1100px, 90%);
  margin-inline: auto;
}

section {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 2rem;
}

h2 {
  margin: 0;
  font-size: 2rem;
}

/* -------------------- */
/* RANDOM TRANSITIONS   */
/* -------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  margin: 0 auto;
  width: 100%;
  gap: 1rem;
}

.card {
  padding: 1.5rem;
  border: 1px solid #333;
  border-radius: 0.75rem;
  background: #1b1b1b;

  translate: 0;
  opacity: 1;
  rotate: 0;

  transition:
    translate 600ms ease,
    rotate 600ms ease,
    opacity 600ms ease;

  transition-delay: 50ms;
  transition-delay: random(0ms, 200ms);

  @starting-style {
    translate: 0 40px;
    opacity: 0;
    rotate: random(-8deg, 8deg, 2deg);
  }
}


.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.card p {
  margin: 0;
  color: #aaa;
  line-height: 1.5;
}


/* -------------------- */
/* RANDOM PARTICLES     */
/* -------------------- */

.particle-container {
  position: relative;
  height: 500px;
  overflow: hidden;

  border: 1px solid #333;
  border-radius: 0.75rem;
  background: #171717;
}

/* Fallbacks If Random() is not supported */
.particle {
  top: 50%;
  left: 50%;
  scale: 1;

  animation-delay: 0s;
  animation-duration: 4s;

  background-color: hsl(210 70% 60%);
}

/* Actual Random Particle Styles */
.particle {
  position: absolute;
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;

  top: random(0%, 100%);
  left: random(0%, 100%);
  scale: random(0.5, 1.5);
  
  animation-name: float;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;

  animation-delay: random(0s, 5s);
  animation-duration: random(2s, 6s);

  background-color: hsl(
    random(190, 230)
    70%
    60%
  );
}

@keyframes float {
  to {
    transform: translateY(-30px);
  }
}

/* -------------------- */
/* RESPONSIVE           */
/* -------------------- */

@media (width < 700px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}