/* ==========================================================
   Video Showcase — Sora-style autoplay tile grid
   ========================================================== */

/* ---- Section ---- */
.video-showcase {
  position: relative;
  padding: 0;
  background: var(--color-black);
  overflow: hidden;
}

.video-showcase__header {
  text-align: center;
  max-width: 700px;
  padding: var(--space-section-y) 0;
  margin: auto;
}

.video-showcase__label {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  font-weight: var(--weight-semibold);
  color: var(--color-primary-lighter);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: auto;
  margin-bottom: var(--space-md);
}

.video-showcase__title {
  font-family: var(--font-display);
  font-size: var(--text-section-title);
  font-weight: var(--weight-black);
  color: #fff;
  line-height: 1.1;
  margin-bottom: var(--space-lg);
}

.video-showcase__subtitle {
  font-size: var(--text-body-lg);
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.7;
  max-width: 540px;
  margin: 0 auto;
}

.video-showcase__grid-wrap {
  position: relative;
}

/* ---- Masonry Grid ---- */
.video-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: auto;
  gap: 6px;
  padding: 0 6px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Give certain tiles more visual weight for masonry effect */
.video-tile:nth-child(1) {
  grid-row: span 2;
}
.video-tile:nth-child(5) {
  grid-column: span 2;
}
.video-tile:nth-child(9) {
  grid-row: span 2;
}

/* ---- Individual Tile ---- */
.video-tile {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #111;
  cursor: pointer;
  transform: translateZ(0); /* GPU layer */
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.video-tile:hover {
  transform: scale(1.02) translateZ(0);
  box-shadow: 0 8px 40px rgba(108, 43, 217, 0.25);
  z-index: 2;
}

/* ---- Video element ---- */
.video-tile__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.video-tile__video--loaded {
  opacity: 1;
}

/* Poster / placeholder while loading */
.video-tile__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: opacity 0.6s ease;
}

.video-tile__video--loaded ~ .video-tile__poster,
.video-tile--playing .video-tile__poster {
  opacity: 0;
  pointer-events: none;
}

/* ---- Overlay gradient + label ---- */
.video-tile__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.65) 0%,
    rgba(0, 0, 0, 0) 50%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-lg);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.video-tile:hover .video-tile__overlay {
  opacity: 1;
}

.video-tile__name {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--weight-semibold);
  color: #fff;
  margin-bottom: 2px;
}

.video-tile__category {
  font-family: var(--font-body);
  font-size: var(--text-caption);
  color: rgba(255, 255, 255, 0.6);
}

/* ---- Loading shimmer ---- */
.video-tile__shimmer {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(110deg, #1a1a1a 30%, #252525 50%, #1a1a1a 70%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.video-tile--playing .video-tile__shimmer {
  display: none;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---- Bottom fade out to white (transition to next section) ---- */
.video-showcase__fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top, var(--color-bg) 0%, transparent 100%);
  z-index: 5;
  pointer-events: none;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .video-tile:nth-child(5) {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    padding: 0 4px;
    height: auto;
  }
  .video-tile:nth-child(1) {
    grid-row: span 1;
  }
  .video-tile:nth-child(9) {
    grid-row: span 1;
  }
  .video-tile:nth-child(5) {
    grid-column: span 2;
  }

  .video-tile__overlay {
    opacity: 1; /* always show labels on mobile */
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.5) 0%,
      rgba(0, 0, 0, 0) 40%
    );
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  .video-grid {
    grid-template-columns: 1fr 1fr;
  }
  .video-tile:nth-child(5) {
    grid-column: span 1;
  }
}
