/* ===== Media31 Specific Styles ===== */

/* ===== Media31 Story Section (Bento Grid) ===== */
.subsidiary__story {
  margin-bottom: 80px;
}

/* ===== Media31 Content Grid (same as Studio Bunga Raya design) ===== */
.media31-section__content {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4-column grid for desktop */
  gap: 30px; /* Reduced from 40px for tighter bento layout */
  margin-bottom: 80px;
  align-items: stretch;
}

/* ===== Media31-specific content block styles (scoped to avoid conflicts) ===== */
.media31-section__content .content-block:hover {
  background: var(--background-card-soft);
  box-shadow: var(--card-bg-hover-shadow);
}

.media31-section__content .content-block__title {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-color-light);
}

.media31-section__content .content-block__text {
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  line-height: 1.7;
  color: var(--text-color-medium);
  margin-bottom: 20px;
  text-align: justify;
}

/* ===== Section spacing between multiple sections ===== */
.media31-section__content + .media31-section__content {
  border-top: 1px solid var(--border-color-softer);
  padding-top: 60px;
}

/* ===== Featured Videos Section ===== */
.subsidiary__featured {
  margin-bottom: 60px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.featured-card {
  background: var(--background-card);
  border: 1px solid var(--border-color-softer);
  border-radius: 20px;
  padding: 30px;
  transition: all 0.3s ease;
}

.featured-card:hover {
  background: var(--background-card-soft);
  box-shadow: var(--card-bg-hover-shadow);
  transform: translateY(-5px);
}

.featured-card__title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color-light);
  margin-bottom: 25px;
  text-align: center;
  line-height: 1.4;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.featured-card__video {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.featured-card__thumbnail {
  width: 100%;
  height: 280px;
  object-fit: cover;
  transition: transform 0.3s ease;
  background: var(--skeleton-bg, #f0f0f0);
}

.featured-card .video-link:hover .featured-card__thumbnail {
  transform: scale(1.05);
}

.featured-card .play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid var(--text-color-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-color-light);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.featured-card .video-link:hover .play-button {
  border-color: #fff;
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  transform: translate(-50%, -50%) scale(1.1);
}

/* ===== Video Carousel Section (like Partners) ===== */
.subsidiary__videos {
  margin-bottom: 60px;
}

.videos__carousel {
  overflow: hidden;
  margin-top: 40px;
  position: relative;
  white-space: nowrap;
}

/* Gradient fade overlays on left and right edges */
.videos__carousel::before,
.videos__carousel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 120px;
  z-index: 10;
  pointer-events: none;
}

.videos__carousel::before {
  left: 0;
  background: linear-gradient(
    to right,
    var(--background-section) 0%,
    rgba(0, 0, 0, 0) 100%
  );
}

.videos__carousel::after {
  right: 0;
  background: linear-gradient(
    to left,
    var(--background-section) 0%,
    rgba(0, 0, 0, 0) 100%
  );
}

.videos__track {
  display: inline-flex;
  gap: 30px;
  align-items: center;
  animation: scroll-videos 40s linear infinite;
  will-change: transform;
}

.video-item {
  flex-shrink: 0;
  width: 320px;
  height: 240px;
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
  opacity: 0;
  animation: fadeInFromSide 0.8s ease-out forwards;
}

/* Alternate fade directions for visual interest */
.video-item:nth-child(odd) {
  animation: fadeInFromLeft 0.8s ease-out forwards;
}

.video-item:nth-child(even) {
  animation: fadeInFromRight 0.8s ease-out forwards;
}

/* Stagger animation delays */
.video-item:nth-child(1) {
  animation-delay: 0.1s;
}
.video-item:nth-child(2) {
  animation-delay: 0.2s;
}
.video-item:nth-child(3) {
  animation-delay: 0.3s;
}
.video-item:nth-child(4) {
  animation-delay: 0.4s;
}
.video-item:nth-child(5) {
  animation-delay: 0.5s;
}
.video-item:nth-child(6) {
  animation-delay: 0.6s;
}
.video-item:nth-child(7) {
  animation-delay: 0.7s;
}
.video-item:nth-child(8) {
  animation-delay: 0.8s;
}

@keyframes fadeInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInFromRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.video-item:hover {
  transform: translateY(-5px);
}

.video-link {
  display: block;
  position: relative;
  text-decoration: none;
  width: 100%;
  height: 100%;
}

.video-item__thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  background: var(--skeleton-bg, #f0f0f0);
}

.video-item__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 60%,
    rgba(0, 0, 0, 0.8) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-item:hover .video-item__overlay {
  opacity: 1;
}

.video-item:hover .video-item__thumbnail {
  transform: scale(1.05);
}

.play-button {
  width: 45px;
  height: 45px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid var(--text-color-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-color-light);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  margin-top: auto;
  margin-bottom: auto;
}

.video-item:hover .play-button {
  border-color: #fff;
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.video-item__info {
  margin-top: auto;
  text-align: center;
  width: 100%;
}

.video-item__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-color-light);
  line-height: 1.3;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Video carousel animation - seamless infinite scroll */
@keyframes scroll-videos {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-50% - 15px));
  }
}

/* Only pause animation when hovering the entire carousel container */
.videos__carousel:hover .videos__track {
  animation-play-state: paused;
}

/* ===== Responsive Design for Media31 ===== */
@media (max-width: 968px) {
  .media31-section__content {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .featured-grid {
    grid-template-columns: 1fr;
    gap: 30px;
    max-width: 600px;
  }

  .videos__track {
    gap: 25px;
    animation: scroll-videos 35s linear infinite;
  }

  .video-item {
    width: 280px;
    height: 210px;
  }
}

@media (max-width: 768px) {
  .subsidiary__story {
    margin-bottom: 60px;
  }

  .media31-section__content {
    margin-bottom: 60px;
  }

  .featured-grid {
    gap: 25px;
  }

  .featured-card {
    padding: 25px;
  }

  .featured-card__title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    min-height: 50px;
  }

  .featured-card__thumbnail {
    height: 220px;
  }

  .featured-card .play-button {
    width: 70px;
    height: 70px;
    font-size: 1.8rem;
    border-width: 2px;
  }

  .videos__track {
    gap: 20px;
    animation: scroll-videos 30s linear infinite;
  }

  .video-item {
    width: 250px;
    height: 180px;
  }

  .video-item__overlay {
    padding: 15px;
  }

  .play-button {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }

  .video-item__title {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .featured-card {
    padding: 20px;
  }

  .featured-card__title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    min-height: 45px;
  }

  .featured-card__thumbnail {
    height: 200px;
  }

  .featured-card .play-button {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  .videos__track {
    gap: 15px;
    animation: scroll-videos 25s linear infinite;
  }

  .video-item {
    width: 220px;
    height: 160px;
  }

  .video-item__overlay {
    padding: 10px;
  }

  .play-button {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    border-width: 1px;
  }

  .video-item__title {
    font-size: 0.75rem;
    -webkit-line-clamp: 1;
  }
}
