@import url('https://fonts.googleapis.com/css?family=Roboto:700');

body {
  font-family: 'Roboto';
  background-color: #131417;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

p {
  text-shadow: 0 0 7px rgba(255, 255, 255, .3), 0 0 3px rgba(255, 255, 255, .3);
}

.container {
  color: #e5e5e5;
  font-size: 2.26rem;
  text-transform: uppercase;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 1rem;
  text-align: left;
}

.animation {
  height: 50px;
  overflow: hidden;
  margin-left: 1rem;
}

.animation > div > div {
  padding: 0.25rem 0.75rem;
  height: 2.81rem;
  margin-bottom: 2.81rem;
  display: inline-block;
  border-radius: 5px; /* Add rounded corners */
}

.animation div:first-child {
  animation: text-animation 6s infinite; /* Reduced duration from 16s to 8s */
}

.first div {
  background-color: #20a7d8;
}

.second div {
  background-color: #CD921E;
}

.third div {
  background-color: #c10528;
}

.fourth div {
  background-color: #2041ad;
}

/* @keyframes text-animation {
  0% { margin-top: 0; }
  20% { margin-top: 0; }
  25% { margin-top: -5.62rem; }
  37.5% { margin-top: -5.62rem; }
  50% { margin-top: -11.24rem; }
  62.5% { margin-top: -11.24rem; }
  75% { margin-top: -16.86rem; }
  87.5% { margin-top: -22.48rem; }
  100% { margin-top: -22.48rem; }
} */

@keyframes text-animation {
  0% { margin-top: 0; }
  20% { margin-top: 0; } /* Increased wait time at the start */
  25% { margin-top: -5.62rem; }
  45% { margin-top: -5.62rem; }
  50% { margin-top: -11.24rem; }
  75% { margin-top: -11.24rem; }
  95% { margin-top: -16.86rem; }
  100% { margin-top: -22.48rem; }
  /* 100% { margin-top: -22.48rem; } */
}

.tech-words {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.tech-words span {
  position: absolute;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.1);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
  animation: move 30s linear infinite;
  --direction-x: 1;
  --direction-y: 1;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 0.5rem 1rem;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

@keyframes move {
  0% {
    transform: translate(50vw, 0);
  }
  25% {
    transform: translate(calc(50vw + var(--direction-x) * 50vw - 50%), 0);
  }
  50% {
    transform: translate(calc(50vw + var(--direction-x) * 50vw - 50%), calc(var(--direction-y) * 100vh - 50%));
  }
  75% {
    transform: translate(50vw, calc(var(--direction-y) * 100vh - 50%));
  }
  100% {
    transform: translate(50vw, 0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    font-size: 1.5rem;
    padding: 0.5rem;
  }

  .animation {
    margin-left: 0;
  }

  .animation > div > div {
    height: 1rem;
    margin-bottom: 2rem;
  }

  .tech-words span {
    font-size: 1.5rem;
    padding: 0.25rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .container {
    font-size: 1.2rem;
  }

  .animation > div > div {
    height: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .tech-words span {
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
  }
}