/* ==============================================================
 * HC JOYN MAINPAGE - Content Section (추천 콘텐츠)
 *
 * Distinct from Live:
 *   - White card with thumb on top + text below (library/catalog feel)
 *   - Category pill on thumb, duration badge in corner
 *   - Tile variant for mosaic/bento (dark overlay) for visual variety
 *
 * Mobile  : horizontal scroll cards (card or tile style)
 * Desktop : 3 layouts — grid (uniform N-col), mosaic (1 large 2×2 + 4 small),
 *           bento (1 large + 2×2 grid)
 *
 * CSS vars set inline:
 *   --hcjm-content-card-w, --hcjm-content-thumb-ar, --hcjm-content-card-ar
 * ============================================================== */

/* ==============================================================
 * SHARED ELEMENTS (cards, tiles, overlays)
 * ============================================================== */

/* Category pill (sits on thumbnail) */
.hcjm-content-cat-pill{
  position:absolute;
  top:8px; left:8px;
  padding:3px 8px;
  background:rgba(0,0,0,.72);
  color:#fff;
  border-radius:6px;
  font-size:10.5px;
  font-weight:800;
  letter-spacing:.3px;
  z-index:2;
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
}

/* Category text (sits below, in meta area) */
.hcjm-content-cat-text{
  display:inline-block;
  color:var(--hcjm-primary);
  font-size:11px;
  font-weight:800;
  letter-spacing:.4px;
  margin-bottom:4px;
  text-transform:uppercase;
}

/* Duration badge */
.hcjm-content-duration{
  position:absolute;
  bottom:8px; right:8px;
  padding:2px 7px;
  background:rgba(0,0,0,.78);
  color:#fff;
  border-radius:5px;
  font-size:11px;
  font-weight:700;
  letter-spacing:.2px;
  z-index:2;
  font-variant-numeric:tabular-nums;
}

/* Play overlay (appears on hover/touch) */
.hcjm-content-play-overlay{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  background:linear-gradient(180deg, transparent 30%, rgba(0,0,0,.4));
  opacity:0;
  transition:opacity var(--hcjm-dur) ease;
  z-index:1;
}
.hcjm-content-play-overlay i{
  width:48px; height:48px;
  border-radius:50%;
  background:rgba(255,255,255,.95);
  color:var(--hcjm-primary);
  display:grid;
  place-items:center;
  font-size:24px;
  box-shadow:0 8px 20px rgba(0,0,0,.3);
  transform:scale(.85);
  transition:transform var(--hcjm-dur) var(--hcjm-ease);
}

/* ==============================================================
 * MOBILE
 * ============================================================== */
.hcjm-content{
  --hcjm-content-card-w:160px;
  --hcjm-content-thumb-ar:16/9;
}

.hcjm-content-row{
  display:flex;
  gap:14px;
  overflow-x:auto;
  padding:4px 0 8px;
  scrollbar-width:none;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
}
.hcjm-content-row::-webkit-scrollbar{display:none;}

.hcjm-content-card{
  flex:0 0 var(--hcjm-content-card-w);
  scroll-snap-align:start;
  transition:transform var(--hcjm-dur-fast) ease;
}
.hcjm-content-card:active{transform:scale(.97);}

.hcjm-content-card-link{
  display:block;
  text-decoration:none;
  color:inherit;
}

/* Thumb (mobile card variant) */
.hcjm-content .hcjm-content-thumb{
  position:relative;
  aspect-ratio:var(--hcjm-content-thumb-ar, 16/9);
  border-radius:12px;
  overflow:hidden;
  background:var(--hcjm-primary-faint);
  background-size:cover;
  background-position:center;
  margin-bottom:10px;
}

.hcjm-content-card:active .hcjm-content-play-overlay{opacity:1;}
.hcjm-content-card:active .hcjm-content-play-overlay i{transform:scale(1);}

/* Meta (text below thumb) */
.hcjm-content-meta b{
  display:block;
  font-size:14px;
  font-weight:800;
  letter-spacing:-0.3px;
  line-height:1.35;
  margin-bottom:3px;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
.hcjm-content-meta p{
  margin:0;
  font-size:11.5px;
  color:var(--hcjm-muted);
  font-weight:600;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

/* Tile variant on mobile (less common, but supported) */
.hcjm-content.is-style-tile .hcjm-content-card{
  position:relative;
}
.hcjm-content.is-style-tile .hcjm-content-card .hcjm-content-thumb{
  margin-bottom:0;
}
.hcjm-content.is-style-tile .hcjm-content-meta{
  position:absolute;
  left:10px; right:10px; bottom:10px;
  color:#fff;
  z-index:3;
  pointer-events:none;
}
.hcjm-content.is-style-tile .hcjm-content-card .hcjm-content-thumb::after{
  content:"";
  position:absolute; inset:0;
  background:linear-gradient(180deg, transparent 45%, rgba(0,0,0,.78));
  z-index:1;
}
.hcjm-content.is-style-tile .hcjm-content-meta b,
.hcjm-content.is-style-tile .hcjm-content-meta p{color:#fff;}
.hcjm-content.is-style-tile .hcjm-content-meta p{opacity:.88;}

/* Mobile 가치 제안(features) 2×2 */
.hcjm-content--mobile-features .hcjm-content-mobile-features-sub{
  margin:-4px 0 14px;
  font-size:13px;
  line-height:1.5;
  color:var(--hcjm-muted);
  font-weight:500;
  word-break:keep-all;
}
.hcjm-content--mobile-features .hcjm-content-mobile-features-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  grid-template-rows:repeat(2, auto);
  gap:10px;
  width:100%;
  min-width:0;
}
.hcjm-content--mobile-features .hcjm-content-feature-card{
  min-width:0;
  background:#fff;
  border:1px solid var(--hcjm-border, #E2E5EC);
  border-radius:12px;
  box-shadow:0 1px 4px rgba(0,0,0,.04);
}
.hcjm-content--mobile-features .hcjm-content-feature-card:active{
  transform:scale(.98);
}
.hcjm-content--mobile-features .hcjm-content-feature-link{
  display:block;
  padding:14px 12px;
  text-decoration:none;
  color:inherit;
  height:100%;
  box-sizing:border-box;
}
.hcjm-content--mobile-features .hcjm-content-feature-icon{
  width:40px;
  height:40px;
  border-radius:10px;
  border:1px solid;
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:10px;
}
.hcjm-content--mobile-features .hcjm-content-feature-icon i{
  font-size:20px;
  line-height:1;
}
.hcjm-content--mobile-features .hcjm-content-feature-cat{
  display:inline-block;
  padding:2px 8px;
  margin-bottom:8px;
  background:rgba(0,0,0,.06);
  color:var(--hcjm-muted);
  border-radius:6px;
  font-size:10px;
  font-weight:800;
  letter-spacing:.2px;
}
.hcjm-content--mobile-features .hcjm-content-feature-link h4{
  margin:0;
  font-size:13.5px;
  font-weight:800;
  letter-spacing:-0.25px;
  line-height:1.35;
  word-break:keep-all;
}

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

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

  /* Gap variants */
  .hcjm-content-desktop.is-gap-small  .hcjm-content-grid,
  .hcjm-content-desktop.is-gap-small  .hcjm-content-features-grid,
  .hcjm-content-desktop.is-gap-small  .hcjm-content-mosaic,
  .hcjm-content-desktop.is-gap-small  .hcjm-content-bento { gap:12px; }
  .hcjm-content-desktop.is-gap-medium .hcjm-content-grid,
  .hcjm-content-desktop.is-gap-medium .hcjm-content-features-grid,
  .hcjm-content-desktop.is-gap-medium .hcjm-content-mosaic,
  .hcjm-content-desktop.is-gap-medium .hcjm-content-bento { gap:20px; }
  .hcjm-content-desktop.is-gap-large  .hcjm-content-grid,
  .hcjm-content-desktop.is-gap-large  .hcjm-content-features-grid,
  .hcjm-content-desktop.is-gap-large  .hcjm-content-mosaic,
  .hcjm-content-desktop.is-gap-large  .hcjm-content-bento { gap:28px; }

  /* ============================================================
   * LAYOUT: GRID (uniform card grid)
   * ============================================================ */
  .hcjm-content-grid,
  .hcjm-content-features-grid{
    display:grid;
    width:100%;
    max-width:100%;
  }
  .hcjm-content-desktop.is-cols-3 .hcjm-content-grid,
  .hcjm-content-desktop.is-cols-3 .hcjm-content-features-grid{grid-template-columns:repeat(3, minmax(0, 1fr));}
  .hcjm-content-desktop.is-cols-4 .hcjm-content-grid{grid-template-columns:repeat(4, minmax(0, 1fr));}
  .hcjm-content-desktop.is-cols-5 .hcjm-content-grid{grid-template-columns:repeat(5, minmax(0, 1fr));}

  /* 가치 제안 카드 (3×2, 아이콘) */
  .hcjm-content-desktop.is-layout-features .hcjm-content-features-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }
  .hcjm-content-feature-card{
    min-width:0;
    background:#fff;
    border:1px solid var(--hcjm-border, #E2E5EC);
    border-radius:16px;
    transition:transform var(--hcjm-dur) ease, box-shadow var(--hcjm-dur) ease;
  }
  .hcjm-content-feature-card:hover{
    transform:translateY(-4px);
    box-shadow:var(--hcjm-shadow-lg);
  }
  .hcjm-content-feature-link{
    display:block;
    padding:24px 22px;
    text-decoration:none;
    color:inherit;
    height:100%;
    box-sizing:border-box;
  }
  .hcjm-content-feature-icon{
    width:48px;
    height:48px;
    border-radius:13px;
    border:1px solid;
    display:flex;
    align-items:center;
    justify-content:center;
    margin-bottom:14px;
  }
  .hcjm-content-feature-icon i{font-size:24px;line-height:1;}
  .hcjm-content-feature-cat{
    display:inline-block;
    padding:3px 9px;
    margin-bottom:10px;
    background:rgba(0,0,0,.06);
    color:var(--hcjm-muted);
    border-radius:6px;
    font-size:10.5px;
    font-weight:800;
    letter-spacing:.3px;
  }
  .hcjm-content-feature-link h4{
    margin:0 0 8px;
    font-size:17px;
    font-weight:800;
    letter-spacing:-0.35px;
    line-height:1.35;
    word-break:keep-all;
  }
  .hcjm-content-feature-link p{
    margin:0;
    font-size:13px;
    color:var(--hcjm-muted);
    font-weight:500;
    line-height:1.55;
    word-break:keep-all;
    display:-webkit-box;
    -webkit-line-clamp:4;
    -webkit-box-orient:vertical;
    overflow:hidden;
  }

  .hcjm-content-grid-card{
    transition:transform var(--hcjm-dur) ease;
  }
  .hcjm-content-grid-card:hover{
    transform:translateY(-4px);
  }
  .hcjm-content-grid-card .hcjm-content-link{
    display:block;
    text-decoration:none;
    color:inherit;
  }
  .hcjm-content-grid-card .hcjm-content-thumb{
    position:relative;
    border-radius:14px;
    overflow:hidden;
    background:var(--hcjm-primary-faint);
    background-size:cover;
    background-position:center;
    margin-bottom:12px;
    transition:box-shadow var(--hcjm-dur);
  }
  .hcjm-content-grid-card:hover .hcjm-content-thumb{
    box-shadow:var(--hcjm-shadow-lg);
  }
  .hcjm-content-grid-card:hover .hcjm-content-play-overlay{opacity:1;}
  .hcjm-content-grid-card:hover .hcjm-content-play-overlay i{transform:scale(1);}

  .hcjm-content-grid-card .hcjm-content-meta h4{
    margin:0 0 4px;
    font-size:16px;
    font-weight:800;
    letter-spacing:-0.4px;
    line-height:1.35;
    overflow:hidden;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
  }
  .hcjm-content-grid-card .hcjm-content-meta p{
    margin:0;
    font-size:13px;
    color:var(--hcjm-muted);
    font-weight:500;
    line-height:1.5;
    overflow:hidden;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
  }

  /* ============================================================
   * LAYOUT: MOSAIC (1 large 2×2 + 4 medium 1×1)
   * ============================================================ */
  .hcjm-content-mosaic{
    display:grid;
    grid-template-columns:repeat(4, 1fr);
    grid-auto-rows:1fr;
  }
  .hcjm-content-mosaic .hcjm-content-tile.is-featured{
    grid-column:span 2;
    grid-row:span 2;
    aspect-ratio:auto !important; /* override inline since spans fill the grid cell */
  }

  /* ============================================================
   * LAYOUT: BENTO (1 large + 2×2 grid)
   * ============================================================ */
  .hcjm-content-bento{
    display:grid;
    grid-template-columns:1.4fr 1fr;
  }
  .hcjm-content-desktop.is-featured-right .hcjm-content-bento{
    grid-template-columns:1fr 1.4fr;
  }
  .hcjm-content-desktop.is-featured-right .hcjm-content-tile.is-featured{order:2;}
  .hcjm-content-desktop.is-featured-right .hcjm-content-bento-side{order:1;}

  .hcjm-content-bento-side{
    display:grid;
    grid-template-columns:1fr 1fr;
    grid-auto-rows:1fr;
    gap:inherit;
  }

  /* ============================================================
   * TILE (dark overlay variant used in mosaic + bento)
   * ============================================================ */
  .hcjm-content-tile{
    position:relative;
    border-radius:16px;
    overflow:hidden;
    background-color:#1a1a3a;
    background-size:cover;
    background-position:center;
    transition:transform var(--hcjm-dur) ease;
  }
  .hcjm-content-tile:hover{transform:translateY(-2px);}

  .hcjm-content-tile .hcjm-content-link{
    display:block;
    width:100%; height:100%;
    text-decoration:none;
    color:inherit;
  }
  .hcjm-content-tile:hover .hcjm-content-play-overlay{opacity:1;}
  .hcjm-content-tile:hover .hcjm-content-play-overlay i{transform:scale(1);}

  .hcjm-content-tile-info{
    position:absolute;
    left:18px; right:18px; bottom:18px;
    color:#fff;
    z-index:2;
  }
  .hcjm-content-tile-info h3{
    margin:0 0 4px;
    font-size:18px;
    font-weight:800;
    letter-spacing:-0.4px;
    line-height:1.25;
    overflow:hidden;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
  }
  .hcjm-content-tile-info span,
  .hcjm-content-tile-info p{
    margin:0;
    font-size:13px;
    opacity:.88;
    line-height:1.5;
    display:inline-block;
  }

  /* Featured tile (larger text) */
  .hcjm-content-tile.is-featured .hcjm-content-tile-info{
    left:28px; right:28px; bottom:28px;
  }
  .hcjm-content-tile.is-featured .hcjm-content-tile-info h3{
    font-size:28px;
    letter-spacing:-0.8px;
    margin-bottom:8px;
    -webkit-line-clamp:3;
  }
  .hcjm-content-tile.is-featured .hcjm-content-tile-info p{
    font-size:14px;
    opacity:.92;
  }

  /* Tile category pill is brighter than card variant */
  .hcjm-content-tile .hcjm-content-cat-pill{
    background:var(--hcjm-primary);
    color:#fff;
  }

  /* ============================================================
   * NARROW DESKTOP TWEAKS
   * ============================================================ */
  @media (max-width:1199px){
    .hcjm-content-desktop{padding:48px 0;}
    .hcjm-content-desktop.is-cols-5 .hcjm-content-grid{grid-template-columns:repeat(4, 1fr);}
    .hcjm-content-tile.is-featured .hcjm-content-tile-info h3{font-size:22px;}
  }
}
