/* ==========================================================================
   영상 섹션 (index.html #videos)
   - 포스터 클릭 시에만 YouTube iframe을 로드하는 facade 패턴
   - 재생목록 / 앰비언트 배경 / 공식 채널 카드
   ========================================================================== */

.video-section {
  position: relative;
  overflow: hidden;
}

/* 헤더 ------------------------------------------------------------------ */
.vs-header {
  margin-bottom: var(--spacing-xl);
}

.vs-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--spacing-md);
  padding: 6px 14px;
  color: #c3c0ff;
  background: rgba(99, 91, 255, 0.14);
  border: 1px solid rgba(146, 141, 255, 0.35);
  border-radius: 999px;
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* 스테이지 (플레이어 + 재생목록) ---------------------------------------- */
.vs-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  box-shadow:
    0 40px 100px -40px rgba(99, 91, 255, 0.45),
    0 24px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

/* 현재 영상 포스터를 흐리게 깔아 색감이 배어 나오는 앰비언트 배경 */
.vs-ambient {
  position: absolute;
  inset: -60px;
  z-index: -1;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(70px) saturate(1.6);
  opacity: 0;
  transform: scale(1.2);
  transition: opacity 1s ease;
  pointer-events: none;
}

.vs-ambient.is-on {
  opacity: 0.5;
}

.vs-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(26, 30, 35, 0.35), rgba(26, 30, 35, 0.7));
  pointer-events: none;
}

/* 플레이어 -------------------------------------------------------------- */
.vs-player {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

.vs-poster {
  position: absolute;
  inset: 0;
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.4s ease;
}

.vs-poster img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.vs-poster::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.2) 65%, rgba(0, 0, 0, 0.8) 100%);
}

.vs-poster:hover img,
.vs-poster:focus-visible img {
  transform: scale(1.06);
}

.vs-poster:focus-visible {
  outline: 2px solid #928dff;
  outline-offset: -2px;
}

.vs-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 86px;
  height: 86px;
  margin: -43px 0 0 -43px;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding-left: 5px;
  color: #fff;
  font-size: 30px;
  background: linear-gradient(135deg, #7069ff 0%, #4a2899 100%);
  border-radius: 50%;
  box-shadow:
    0 18px 44px rgba(99, 91, 255, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.vs-play::before {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid rgba(146, 141, 255, 0.6);
  border-radius: 50%;
  animation: vs-pulse 2.2s ease-out infinite;
}

.vs-poster:hover .vs-play {
  transform: scale(1.08);
  box-shadow:
    0 24px 56px rgba(99, 91, 255, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

@keyframes vs-pulse {
  0%   { transform: scale(1);   opacity: 0.9; }
  100% { transform: scale(1.7); opacity: 0; }
}

.vs-caption {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 24px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.vs-caption-label {
  color: #c3c0ff;
  font-size: var(--font-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.vs-caption-title {
  color: #fff;
  font-size: clamp(1.05rem, 1.7vw, 1.4rem);
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  word-break: keep-all;
}

/* iframe 로딩 진행 바 */
.vs-loader {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, #635bff, #928dff);
  opacity: 0;
}

.is-loading .vs-loader {
  opacity: 1;
  animation: vs-load 1.1s ease-in-out infinite;
}

@keyframes vs-load {
  0%   { width: 0;   margin-left: 0; }
  50%  { width: 60%; }
  100% { width: 0;   margin-left: 100%; }
}

.vs-iframe {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
}

.is-playing .vs-poster {
  opacity: 0;
  pointer-events: none;
}

/* 재생목록 -------------------------------------------------------------- */
.vs-playlist {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgba(12, 14, 20, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  overflow: hidden;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.vs-playlist-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.vs-playlist-title {
  color: var(--text-primary);
  font-size: var(--font-sm);
  font-weight: 700;
}

.vs-playlist-count {
  color: var(--text-tertiary);
  font-size: var(--font-xs);
}

/* 목록 높이를 플레이어 높이에 맞추기 위해 절대 배치 */
.vs-list-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.vs-list {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 8px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.vs-list::-webkit-scrollbar {
  width: 6px;
}

.vs-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

.vs-item-wrap + .vs-item-wrap {
  margin-top: 2px;
}

.vs-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px 108px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 10px 8px 8px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 12px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.vs-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.vs-item:focus-visible {
  outline: 2px solid #928dff;
  outline-offset: -2px;
}

.vs-item.is-active {
  background: rgba(99, 91, 255, 0.16);
}

.vs-item.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: linear-gradient(180deg, #928dff, #635bff);
  border-radius: 3px;
}

.vs-item-index {
  color: var(--text-tertiary);
  font-size: var(--font-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* 재생 중 표시 (이퀄라이저) */
.vs-eq {
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 14px;
}

.vs-eq i {
  width: 3px;
  height: 40%;
  background: #928dff;
  border-radius: 2px;
}

.vs-item.is-active .vs-item-index {
  display: none;
}

.vs-item.is-active .vs-eq {
  display: flex;
}

.is-playing .vs-item.is-active .vs-eq i {
  animation: vs-eq 0.9s ease-in-out infinite;
}

.is-playing .vs-item.is-active .vs-eq i:nth-child(2) {
  animation-delay: 0.15s;
}

.is-playing .vs-item.is-active .vs-eq i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes vs-eq {
  0%, 100% { height: 30%; }
  50%      { height: 100%; }
}

.vs-item-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.vs-item-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.vs-item:hover .vs-item-thumb img {
  transform: scale(1.06);
}

.vs-item-duration {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 5px;
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.vs-item-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.vs-item-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: keep-all;
}

.vs-item-meta {
  color: var(--text-tertiary);
  font-size: var(--font-xs);
}

/* 공식 채널 카드 -------------------------------------------------------- */
.vs-channels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: var(--spacing-lg);
}

.vs-channel {
  --brand: #635bff;
  --brand-soft: rgba(99, 91, 255, 0.18);
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  text-decoration: none;
  transition:
    transform var(--transition-base),
    border-color var(--transition-base),
    background var(--transition-base),
    box-shadow var(--transition-base);
}

.vs-channel:hover,
.vs-channel:focus-visible {
  color: var(--text-primary);
  background: var(--brand-soft);
  border-color: var(--brand);
  box-shadow:
    0 18px 40px -12px var(--brand-soft),
    0 12px 30px rgba(0, 0, 0, 0.3);
  outline: none;
  transform: translateY(-3px);
}

.vs-channel-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  font-size: 1.15rem;
  transition: background var(--transition-base), transform var(--transition-base);
}

.vs-channel:hover .vs-channel-icon {
  background: var(--brand);
  transform: scale(1.06);
}

.vs-channel--instagram:hover .vs-channel-icon {
  background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7);
}

.vs-channel-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.vs-channel-name {
  font-size: var(--font-sm);
  font-weight: 700;
}

.vs-channel-handle {
  color: var(--text-tertiary);
  font-size: var(--font-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vs-channel-arrow {
  margin-left: auto;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  transition: transform var(--transition-base), color var(--transition-base);
}

.vs-channel:hover .vs-channel-arrow {
  color: #fff;
  transform: translate(2px, -2px);
}

.vs-channel--youtube   { --brand: #ff0033; --brand-soft: rgba(255, 0, 51, 0.16); }
.vs-channel--linkedin  { --brand: #0a66c2; --brand-soft: rgba(10, 102, 194, 0.2); }
.vs-channel--instagram { --brand: #dd2a7b; --brand-soft: rgba(221, 42, 123, 0.16); }
.vs-channel--facebook  { --brand: #1877f2; --brand-soft: rgba(24, 119, 242, 0.18); }

/* 반응형 --------------------------------------------------------------- */
@media (max-width: 1023px) {
  .vs-stage {
    grid-template-columns: 1fr;
    padding: 12px;
    border-radius: 22px;
  }

  /* 재생목록을 가로 스크롤 레일로 전환 */
  .vs-list-wrap {
    position: static;
    flex: none;
  }

  .vs-list {
    position: static;
    display: flex;
    gap: 10px;
    padding: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .vs-item-wrap {
    flex: 0 0 min(64vw, 220px);
    scroll-snap-align: start;
  }

  .vs-item-wrap + .vs-item-wrap {
    margin-top: 0;
  }

  .vs-item {
    grid-template-columns: 1fr;
    gap: 8px;
    height: 100%;
    padding: 6px;
  }

  .vs-item-index {
    display: none;
  }

  .vs-item.is-active::before {
    display: none;
  }

  .vs-item.is-active {
    box-shadow: inset 0 0 0 1px rgba(146, 141, 255, 0.5);
  }

  .vs-eq {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 1;
    padding: 4px 5px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
  }

  .vs-item-title {
    font-size: 0.85rem;
  }

  .vs-channels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .vs-caption {
    left: 18px;
    right: 18px;
    bottom: 16px;
  }

  .vs-play {
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    padding-left: 4px;
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .vs-channels {
    grid-template-columns: 1fr;
  }

  .vs-channel {
    padding: 12px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vs-play::before,
  .is-playing .vs-item.is-active .vs-eq i,
  .is-loading .vs-loader {
    animation: none;
  }

  .vs-poster img,
  .vs-play,
  .vs-channel,
  .vs-channel-icon,
  .vs-channel-arrow,
  .vs-item-thumb img,
  .vs-ambient {
    transition: none;
  }

  .vs-poster:hover img {
    transform: none;
  }
}
