/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #0f0f0f;
  color: #ffffff;
  font-family: sans-serif;
  padding: 20px;
}

.vid-experiment-wrapper {
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  margin-bottom: 30px;
  text-align: center;
  font-size: 1.8rem;
}

/* Thumbnail Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.video-thumbnail {
  position: relative;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.video-thumbnail:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Aspect ratio containers */
.video-thumbnail.portrait img {
  aspect-ratio: 9 / 16;
}

.video-thumbnail.landscape img {
  aspect-ratio: 16 / 9;
}

.video-thumbnail.square img {
  aspect-ratio: 1 / 1;
}

/* Play Overlay */
.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #000;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.video-thumbnail:hover .play-overlay {
  opacity: 1;
}

.thumbnail-caption {
  padding: 10px;
  text-align: center;
  font-size: 0.85rem;
  color: #aaa;
  background: #1a1a1a;
}

/* Fullscreen Video Modal */
.video-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.video-modal.active {
  display: flex;
}

.modal-content {
  position: relative;
  width: 90vw;
  height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 30px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 40px;
  cursor: pointer;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  transition: background 0.2s;
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Video Container Aspect Ratios */
#video-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#video-container iframe {
  border: none;
}

#video-container.landscape iframe {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
}

#video-container.portrait iframe {
  height: 100%;
  max-width: 100%;
  aspect-ratio: 9 / 16;
}

#video-container.square iframe {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  h1 {
    font-size: 1.4rem;
    margin-bottom: 20px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  .play-overlay {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .close-modal {
    top: 10px;
    right: 10px;
    font-size: 30px;
    width: 40px;
    height: 40px;
  }

  .modal-content {
    width: 95vw;
    height: 95vh;
  }
}

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

  .video-grid {
    grid-template-columns: 1fr;
  }
}
