/* ==============================================================
 * HC JOYN MAINPAGE - Live Section
 *
 * Mobile  : 3×2 grid (썸네일만, LIVE·YouTube 라벨 없음).
 * Desktop : bento (1 featured + 4 grid) or uniform 5-col grid.
 *
 * Card width/thumb height customized via CSS vars set inline:
 *   --hcjm-live-card-w, --hcjm-live-thumb-h
 * ============================================================== */

/* ==============================================================
 * MOBILE
 * ============================================================== */
.hcjm-live{
  --hcjm-live-card-w:116px;
  --hcjm-live-thumb-h:76px;
}

.hcjm-live-row{
  display:flex;
  gap:12px;
  overflow-x:auto;
  padding:2px 0 6px;
  scrollbar-width:none;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
}
.hcjm-live-row::-webkit-scrollbar{display:none;}

.hcjm-live-card{
  flex:0 0 var(--hcjm-live-card-w);
  scroll-snap-align:start;
  transition:transform var(--hcjm-dur-fast) ease;
}
.hcjm-live-card:active{transform:scale(.96);}
.hcjm-live-card-link{
  text-decoration:none;
  color:inherit;
  display:block;
}

.hcjm-live-thumb{
  position:relative;
  width:100%;
  aspect-ratio:16/9;
  border-radius:12px;
  overflow:hidden;
  background:var(--hcjm-primary-faint);
}
.hcjm-live-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.hcjm-live-thumb::after{
  content:"";
  position:absolute; inset:0;
  background:linear-gradient(180deg, transparent 40%, rgba(0,0,0,.55));
  pointer-events:none;
}

/* Badge */
.hcjm-live-badge{
  position:absolute;
  top:6px; left:6px;
  display:inline-flex;
  align-items:center;
  gap:4px;
  border-radius:999px;
  background:var(--hcjm-live);
  color:#fff;
  padding:3px 7px;
  font-size:10px;
  font-weight:800;
  letter-spacing:.3px;
  z-index:2;
}
.hcjm-live-badge.has-pulse::before{
  content:"";
  width:4px; height:4px;
  border-radius:50%;
  background:#fff;
  animation:hcjm-pulse 1.6s ease-in-out infinite;
}

/* Viewer count */
.hcjm-live-viewer{
  position:absolute;
  left:7px; bottom:6px;
  color:#fff;
  font-size:10.5px;
  font-weight:700;
  z-index:2;
  display:inline-flex;
  align-items:center;
  gap:3px;
}

.hcjm-live-card b{
  display:block;
  margin:8px 0 2px;
  font-size:13.5px;
  font-weight:800;
  letter-spacing:-0.2px;
  line-height:1.3;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
.hcjm-live-card p{
  margin:0;
  font-size:11.5px;
  color:var(--hcjm-muted);
  font-weight:600;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

/* Mobile 3×2 그리드 */
.hcjm-live--mobile-grid .hcjm-live-mobile-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  grid-template-rows:repeat(2, auto);
  gap:10px;
  width:100%;
  min-width:0;
}
.hcjm-live--mobile-grid .hcjm-live-card{
  flex:none;
  width:auto;
  min-width:0;
  scroll-snap-align:unset;
}
.hcjm-live--mobile-grid .hcjm-live-card-link{
  display:block;
}
.hcjm-live--mobile-grid .hcjm-live-thumb{
  border-radius:10px;
  aspect-ratio:16/9;
  width:100%;
}
.hcjm-live--mobile-grid .hcjm-live-thumb::after{
  display:none;
}
.hcjm-live--mobile-grid .hcjm-live-badge,
.hcjm-live--mobile-grid .hcjm-live-viewer,
.hcjm-live--mobile-grid .hcjm-live-card b,
.hcjm-live--mobile-grid .hcjm-live-card p{
  display:none !important;
}

/* ==============================================================
 * DESKTOP
 * ============================================================== */
.hcjm-live-desktop{
  display:none;
}

@media (min-width:1024px){
  .hcjm-live-desktop{
    display:block;
    padding:64px 0;
  }
  .hcjm-live-desktop.is-bg-white{background:#fff;}
  .hcjm-live-desktop.is-bg-bg   {background:var(--hcjm-bg);}
  .hcjm-live-desktop.is-bg-none {background:none;}

  /* Section head (shared structure across desktop sections) */
  .hcjm-desktop-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    margin-bottom:32px;
  }
  .hcjm-desktop-head h2{
    margin:0;
    font-size:34px;
    font-weight:900;
    letter-spacing:-1.5px;
    color:var(--hcjm-text);
  }
  .hcjm-desktop-head h2 em{
    font-style:normal;
    color:var(--hcjm-primary);
  }
  .hcjm-desktop-head p{
    margin:8px 0 0;
    color:var(--hcjm-muted);
    font-size:15px;
    font-weight:500;
  }
  .hcjm-desktop-head .more{
    display:inline-flex;
    align-items:center;
    gap:4px;
    color:var(--hcjm-primary);
    text-decoration:none;
    font-size:14px;
    font-weight:800;
    transition:gap var(--hcjm-dur);
  }
  .hcjm-desktop-head .more:hover{gap:8px;}

  /* 16:9 media (YouTube mqdefault) */
  .hcjm-live-media{
    position:relative;
    width:100%;
    aspect-ratio:16/9;
    overflow:hidden;
    background:#1a1a3a;
  }
  .hcjm-live-media img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
    vertical-align:middle;
  }
  .hcjm-live-media-shade{
    position:absolute;
    inset:0;
    background:linear-gradient(180deg, transparent 42%, rgba(0,0,0,.82));
    pointer-events:none;
    z-index:1;
  }
  .hcjm-live-media .hcjm-live-badge{
    position:absolute;
    top:10px;
    left:10px;
    z-index:2;
  }

  /* ---- Bento: 3열×2행 (좌 라지 2행 span = 우 2×2 높이 일치) ---- */
  .hcjm-live-desktop.is-layout-bento .hcjm-live-desktop-grid{
    display:grid;
    grid-template-columns:minmax(0,0.88fr) repeat(2, minmax(0,1fr));
    grid-template-rows:repeat(2, auto);
    gap:14px;
    align-items:stretch;
  }
  .hcjm-live-desktop.is-layout-bento .hcjm-live-grid-side{
    display:contents;
  }
  .hcjm-live-desktop.is-layout-bento .hcjm-live-featured{
    grid-column:1;
    grid-row:1 / -1;
    min-height:0;
  }
  .hcjm-live-desktop.is-layout-bento.is-featured-right .hcjm-live-desktop-grid{
    grid-template-columns:repeat(2, minmax(0,1fr)) minmax(0,0.88fr);
  }
  .hcjm-live-desktop.is-layout-bento.is-featured-right .hcjm-live-featured{
    grid-column:3;
    grid-row:1 / -1;
  }

  /* Featured card */
  .hcjm-live-featured{
    position:relative;
    border-radius:20px;
    overflow:hidden;
    box-shadow:var(--hcjm-shadow-md);
    transition:transform var(--hcjm-dur) ease;
  }
  .hcjm-live-featured:hover{transform:translateY(-2px);}
  .hcjm-live-featured-link{
    display:block;
    position:relative;
    text-decoration:none;
    color:inherit;
  }
  .hcjm-live-desktop.is-layout-bento .hcjm-live-featured-link{
    height:100%;
    min-height:0;
  }
  .hcjm-live-desktop.is-layout-bento .hcjm-live-featured .hcjm-live-media{
    position:absolute;
    inset:0;
    width:100%;
    height:100%;
    aspect-ratio:unset;
  }
  .hcjm-live-desktop.is-layout-bento .hcjm-live-grid-card{
    min-height:0;
  }
  .hcjm-live-desktop.is-layout-bento .hcjm-live-grid-card .hcjm-live-media{
    aspect-ratio:16/9;
  }
  .hcjm-live-featured-info{
    position:absolute;
    left:28px;
    right:28px;
    bottom:28px;
    color:#fff;
    z-index:2;
    pointer-events:none;
  }
  .hcjm-live-badge-lg{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:6px 12px;
    background:var(--hcjm-live);
    border-radius:999px;
    font-size:11px;
    font-weight:800;
    letter-spacing:.5px;
    margin-bottom:14px;
    color:#fff;
  }
  .hcjm-live-badge-lg.has-pulse::before{
    content:"";
    width:5px; height:5px;
    border-radius:50%;
    background:#fff;
    animation:hcjm-pulse 1.6s ease-in-out infinite;
  }
  .hcjm-live-featured h3{
    margin:0 0 6px;
    font-size:26px;
    font-weight:900;
    letter-spacing:-1px;
    line-height:1.1;
  }
  .hcjm-live-desktop.is-layout-bento .hcjm-live-featured-info{
    left:22px;
    right:22px;
    bottom:22px;
  }
  .hcjm-live-featured-meta{
    display:flex;
    gap:18px;
    font-size:13px;
    opacity:.9;
    flex-wrap:wrap;
  }
  .hcjm-live-featured-meta span{
    display:inline-flex;
    align-items:center;
    gap:5px;
  }

  .hcjm-live-grid-card{
    position:relative;
    border-radius:14px;
    overflow:hidden;
    transition:transform var(--hcjm-dur) ease;
  }
  .hcjm-live-grid-card:hover{transform:translateY(-2px);}
  .hcjm-live-grid-link{
    display:block;
    position:relative;
    text-decoration:none;
    color:inherit;
  }
  .hcjm-live-grid-info{
    position:absolute;
    left:14px;
    right:14px;
    bottom:12px;
    color:#fff;
    z-index:2;
    pointer-events:none;
  }
  .hcjm-live-grid-info b{
    display:block;
    font-size:15px;
    font-weight:800;
    margin-bottom:2px;
    letter-spacing:-0.3px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .hcjm-live-grid-info span{
    font-size:11.5px;
    opacity:.85;
    display:inline-flex;
    align-items:center;
    gap:4px;
  }

  /* ---- Uniform grid layout (5 columns) ---- */
  .hcjm-live-desktop.is-layout-grid .hcjm-live-desktop-uniform{
    display:grid;
    grid-template-columns:repeat(5, 1fr);
    gap:16px;
  }
  .hcjm-live-desktop.is-layout-grid .hcjm-live-grid-card{
    border-radius:16px;
  }

  /* Narrow desktop: bento collapses */
  @media (max-width:1199px){
    .hcjm-live-desktop{padding:48px 0;}
    .hcjm-live-desktop.is-layout-grid .hcjm-live-desktop-uniform{
      grid-template-columns:repeat(4, 1fr);
    }
    .hcjm-live-desktop.is-layout-bento .hcjm-live-desktop-grid{
      grid-template-columns:minmax(0,0.92fr) repeat(2, minmax(0,1fr));
    }
    .hcjm-live-featured h3{font-size:22px;}
  }
}

/* ==============================================================
 * YouTube 재생 모달 (mainpage-mini mpb-popup 동일)
 * ============================================================== */
.hcjm-live-play-trigger{
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}

.hcjm-live-popup{
  display:none;
  position:fixed!important;
  inset:0!important;
  width:100%!important;
  height:100%!important;
  z-index:999999!important;
  padding:20px;
  box-sizing:border-box;
  pointer-events:none;
  margin:0!important;
}
.hcjm-live-popup.is-active{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  animation:hcjm-live-popup-in .2s ease;
  pointer-events:auto!important;
}
.hcjm-live-popup__overlay{
  position:fixed!important;
  inset:0!important;
  background:rgba(0,0,0,.85)!important;
  z-index:1!important;
  pointer-events:auto!important;
  margin:0!important;
  padding:0!important;
}
.hcjm-live-popup__content{
  position:relative!important;
  width:90%!important;
  max-width:800px!important;
  border-radius:16px!important;
  overflow:hidden!important;
  box-shadow:0 20px 60px rgba(0,0,0,.5)!important;
  animation:hcjm-live-popup-scale .25s ease;
  z-index:2!important;
  background:#000!important;
  pointer-events:auto!important;
  margin:0 auto!important;
}
.hcjm-live-popup__close{
  position:absolute!important;
  top:-48px!important;
  right:0!important;
  width:40px!important;
  height:40px!important;
  background:rgba(255,255,255,.95)!important;
  border:none!important;
  border-radius:50%!important;
  cursor:pointer!important;
  padding:0!important;
  z-index:10!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  transition:transform .2s;
  -webkit-tap-highlight-color:transparent;
  box-shadow:0 2px 10px rgba(0,0,0,.3)!important;
  pointer-events:auto!important;
}
.hcjm-live-popup__close:hover,
.hcjm-live-popup__close:active{
  transform:scale(1.1);
}
.hcjm-live-popup__close svg{
  width:20px;
  height:20px;
  color:#333;
}
.hcjm-live-popup__player{
  aspect-ratio:16/9;
  background:#000;
  width:100%;
  border-radius:16px;
  overflow:hidden;
  position:relative;
  z-index:1;
}
.hcjm-live-popup__player iframe{
  width:100%;
  height:100%;
  border:none;
  display:block;
}
@keyframes hcjm-live-popup-in{
  from{opacity:0;}
  to{opacity:1;}
}
@keyframes hcjm-live-popup-scale{
  from{opacity:0;transform:scale(.95) translateY(10px);}
  to{opacity:1;transform:scale(1) translateY(0);}
}
@media (max-width:768px){
  .hcjm-live-popup{padding:16px;}
  .hcjm-live-popup__content{
    width:95%!important;
    max-width:100%!important;
    border-radius:12px!important;
  }
  .hcjm-live-popup__player{border-radius:12px;}
  .hcjm-live-popup__close{
    top:-44px!important;
    width:36px!important;
    height:36px!important;
  }
  .hcjm-live-popup__close svg{
    width:18px;
    height:18px;
  }
}
