/* =========================================================
   YH Image Gallery (NO MASONRY) — CLEAN v2
   - PC: 2열(꽉 채움), 1장 자동 1열
   - Mobile: 1열
   - Image: 비율 유지(크롭 X)
   - 기본: PC에서는 여백 최소(사진이 칸을 채움)
   - 옵션: "원본 크기 유지" 모드(.yh-ig-fit) 지원
========================================================= */

/* ---------- Card ---------- */
.yh-ig-card{
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  margin: 0 0 22px;
}

.yh-ig-head{
  text-align: center;
  padding: 12px 14px;
  font-weight: 800;
  font-size: 16px;
  color: #0f172a;
  background: #f8fafc;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

/* ---------- Grid ---------- */
.yh-ig-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); /* ✅ PC 2열 꽉 채움 */
  gap: 12px;
  padding: 12px;
  box-sizing: border-box;
  align-items: start;
  justify-content: stretch;
  justify-items: stretch; /* ✅ 아이템이 칸을 꽉 쓰게 */
  grid-auto-flow: row;
}

/* ✅ 1장일 때 자동 1열 */
.yh-ig-grid:has(> .yh-ig-item:only-child){
  grid-template-columns: 1fr;
}

/* ---------- Item ---------- */
.yh-ig-item{
  display: block;
  width: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  overflow: hidden;
}

/* ✅ 기본(권장): PC에서도 여백 없이 칸을 채움 (크롭 X) */
.yh-ig-item img{
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0;
  border-radius: 14px;
  box-shadow: 0 6px 14px rgba(0,0,0,.10);
  transform: translateZ(0);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

/* ---------- Optional Mode: 원본 크기 유지(작으면 그대로, 크면 줄어듦) ----------
   사용법: <div class="yh-ig-card yh-ig-fit"> ... </div>
*/
.yh-ig-card.yh-ig-fit .yh-ig-grid{
  justify-items: center; /* 원본이 작을 때 중앙 정렬 */
}
.yh-ig-card.yh-ig-fit .yh-ig-item img{
  width: auto;       /* 강제 확대 X */
  max-width: 100%;   /* 부모 넘치면 축소 */
  margin: 0 auto;    /* 원본 크기일 때 중앙 */
}

/* ---------- Hover (PC only) ---------- */
@media (hover:hover){
  .yh-ig-item:hover img{
    transform: scale(1.015);
    box-shadow: 0 10px 22px rgba(0,0,0,.14);
    filter: saturate(1.03);
  }
}

/* ---------- Mobile: always 1 column ---------- */
@media (max-width:768px){
  .yh-ig-grid{
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce){
  .yh-ig-item img{ transition: none; }
}

/* =========================================================
   Masonry Safety (disable)
========================================================= */
.yh-ig-grid.yh-ig-masonry{
  display: grid !important;
  column-count: initial !important;
  column-gap: initial !important;
}

/* =========================================================
   Head 2-Column (Before / After)
========================================================= */
.yh-ig-head.yh-ig-head-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 12px;
  position: relative;
  padding: 12px 14px;
}

/* center divider */
.yh-ig-head.yh-ig-head-2::after{
  content: "";
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 50%;
  width: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(22,145,121,.85),
    transparent
  );
}

.yh-ig-head.yh-ig-head-2 .yh-ig-head-col{
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  padding: 4px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width:768px){
  .yh-ig-head.yh-ig-head-2{
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .yh-ig-head.yh-ig-head-2::after{
    display: none;
  }
  .yh-ig-head.yh-ig-head-2 .yh-ig-head-col{
    white-space: normal;
  }
}