.tag-square {
  display: inline-block;
  min-width: 40px; /* ensures even short tags have decent width */
  padding: 0 6px;
  height: 24px;
  line-height: 24px;
  font-size: 18px;
  color: #111;
  font-weight: bold;
  border-radius: 4px;
  margin: 2px;
  text-align: center;
  background-color: gray;
  opacity: 1;
}

/* specific tag colors */
.tag-square.game {
  background-color: #dc3a27;
}
.tag-square.unity {
  background-color: #bcc3c6;
} /* for C# */
.tag-square.jam {
  background-color: #ffc404;
}
.tag-square.webgl {
  background-color: #9c0808;
}
.tag-square.vr {
  background-color: #0886fb;
}
.tag-square.openxr {
  background-color: #723b8f;
}
.tag-square.academic {
  background-color: #cb532b;
}
.tag-square.processing {
  background-color: #6c9fca;
}
.tag-square.\33 rd {
  background-color: #8a5310;
}
.tag-square.\32 nd {
  background-color: #bcc3c6;
}
.tag-square.\31 st {
  background-color: #ffc404;
}

.overlay-image {
  position: relative; /* absolute so it doesn’t affect page flow */
  bottom: 0; /* stick to bottom of parent/container */
  top: 11vh;
  left: 50%; /* center horizontally */
  transform: translateX(-50%);
  max-width: 100%; /* prevent it from exceeding parent width */
  height: auto;
  z-index: 10;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .overlay-image {
    width: 95vw;
    top: 5.5vh;
  }
}

#previewContent img,
#previewContent video {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  display: block;
}

#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #111; /* dark background */
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999; /* on top of everything */
}

.loader {
  color: #fff;
  font-family: Consolas, Menlo, Monaco, monospace;
  font-weight: bold;
  font-size: 78px;
  opacity: 0.8;
}
.loader:before {
  content: "{";
  display: inline-block;
  animation: pulse 0.4s alternate infinite ease-in-out;
}
.loader:after {
  content: "}";
  display: inline-block;
  animation: pulse 0.4s 0.3s alternate infinite ease-in-out;
}

@keyframes pulse {
  to {
    transform: scale(0.8);
    opacity: 0.5;
  }
}

video {
  width: 100%;
  aspect-ratio: 16 / 9; /* default aspect ratio */
  object-fit: contain;
}

.extra-item {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.5s ease;
  pointer-events: none;
}

.extra-item.show {
  max-height: 500px; /* taller than tallest item */
  opacity: 1;
  pointer-events: auto;
}

.carousel-content {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 50vh;
}

.carousel-item img,
.carousel-item video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  max-width: 80%;
  max-height: 50vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .carousel-item img,
  .carousel-item video {
    left: 51%;
    max-width: 30vh;
    transform: translate(-50%, -70%);
    max-height: 20vh; /* smaller height on mobile */
  }
}

.video-wrapper {
  display: block;
  width: 100%;
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -100%);
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 9999;
  display: grid;
  place-items: center;
}

/* white triangle */
.play-overlay::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 18px solid white;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  display: block;
  transform-origin: center;
  transition: transform 0.18s;
}

/* hover reaction (visual only) */
.video-wrapper:hover .play-overlay::before {
  background: rgba(0, 0, 0, 0.7);
}
.video-wrapper:hover .play-overlay::after {
  transform: scale(1.08);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
