/* =========================================================
   YH Product Gallery - Simple Version
   - PC: 1장=1열 / 2장=2열 / 3장 이상=3열
   - Mobile: 1열
   - 마지막 홀수 1개는 가운데
========================================================= */

.yh-pg-card{
  margin: 0 0 24px;
  padding: 20px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(0,0,0,.05);
  overflow: hidden;
}

.yh-pg-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

/* 1개 */
.yh-pg-grid:has(> .yh-pg-item:only-child){
  grid-template-columns: 1fr;
}

/* 2개 */
.yh-pg-grid:has(> .yh-pg-item:first-child:nth-last-child(2)),
.yh-pg-grid:has(> .yh-pg-item:first-child:nth-last-child(2) ~ .yh-pg-item){
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.yh-pg-item{
  text-align: center;
}

.yh-pg-item img{
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 220px;
  margin: 0 auto 12px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

/* 캡션 */
.yh-pg-item p{
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.45;
  color: #1f2937;
  word-break: keep-all;
}

/* hover */
@media (hover:hover){
  .yh-pg-item img{
    transition: transform .2s ease;
  }
  .yh-pg-item:hover img{
    transform: scale(1.02);
  }
}

/* PC 마지막 홀수 1개 가운데 */
@media (min-width:769px){
  .yh-pg-grid > .yh-pg-item:last-child:nth-child(odd):nth-child(n+4){
    grid-column: 2 / span 1;
  }
}

/* 모바일 */
@media (max-width:768px){
  .yh-pg-grid{
    grid-template-columns: 1fr !important;
  }

  .yh-pg-item img{
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 180px;
    margin-left: auto;
    margin-right: auto;
  }
}