@charset "utf-8";
/* ============================================================
   업클릭 매거진 스킨 — 게시판 목록 (매소너리 / 페이지네이션)
   theme/upclick/skin/board/upc_magazine/style.css
   ------------------------------------------------------------
   · 모든 선택자는 #ugb_gall 하위로 스코프
     (메인 페이지의 .upc-* 와 충돌하지 않도록 접두사 분리)
   · 순수 CSS column-count 매소너리 — JS 의존 없음
   · 모바일 최소 2열 유지
   ============================================================ */

#ugb_gall {
  --ink:      #111111;
  --ink-60:   #666666;
  --ink-45:   #8c8c8c;
  --line:     #ececec;
  --bg:       #ffffff;
  --accent:   #0055ff;
  --radius:   14px;
  --gap:      clamp(.5rem, 1.6vw, 1.25rem);

  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#ugb_gall *,
#ugb_gall *::before,
#ugb_gall *::after { box-sizing: border-box; }

#ugb_gall img { display: block; max-width: 100%; }
#ugb_gall a { color: inherit; text-decoration: none; }

#ugb_gall :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── 카테고리 탭 ─────────────────────────────────────── */
.ugb-cate { margin-bottom: clamp(1.25rem, 3vw, 2rem); }

.ugb-cate__list {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ugb-cate__list li { margin: 0; }
.ugb-cate__list a {
  display: inline-block;
  padding-bottom: .5rem;
  border-bottom: 2px solid transparent;
  font-size: clamp(.9375rem, 1.8vw, 1.125rem);
  font-weight: 600;
  color: var(--ink-45);
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.ugb-cate__list a:hover { color: var(--ink); }
.ugb-cate__list a.bo_current {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* 모바일: 줄바꿈 대신 가로 스크롤 */
@media (max-width: 767px) {
  .ugb-cate__list {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .ugb-cate__list::-webkit-scrollbar { display: none; }
}

/* ── 상단 바 ─────────────────────────────────────────── */
.ugb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.ugb-total {
  margin: 0;
  font-size: .875rem;
  color: var(--ink-45);
}
.ugb-total strong { color: var(--ink); font-weight: 700; }
.ugb-total__page {
  margin-left: .5rem;
  padding-left: .625rem;
  border-left: 1px solid var(--line);
}

.ugb-tools { display: flex; gap: .375rem; margin: 0; padding: 0; list-style: none; }
.ugb-tools li { position: relative; margin: 0; }

.ugb-allchk { margin-bottom: .75rem; font-size: .8125rem; color: var(--ink-60); }

/* ============================================================
   매소너리 — CSS multi-column
   컬럼 안에서 위→아래로 채워지므로 카드 높이가 달라도
   전체 높이가 자동으로 균형을 맞춥니다.
   ============================================================ */
.ugb-masonry {
  column-count: 4;
  column-gap: var(--gap);
}

@media (max-width: 1279px) { .ugb-masonry { column-count: 3; } }
@media (max-width: 767px)  { .ugb-masonry { column-count: 2; } }

/* ── 카드 ────────────────────────────────────────────── */
.ugb-card {
  position: relative;
  display: block;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  margin-bottom: var(--gap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.ugb-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgb(0 0 0 / .10);
}
.ugb-card.is-current { border-color: var(--ink); }
.ugb-card--notice { border-color: #d9e4ff; background: #f7faff; }

.ugb-card__media { background: #f2f2f2; }
.ugb-card__thumb {
  width: 100%;
  height: auto;          /* width/height 속성 → 브라우저가 비율 계산 (CLS 방지) */
}

.ugb-card__body { padding: clamp(.75rem, 1.6vw, 1.125rem); }

.ugb-card__cat {
  display: inline-block;
  margin-bottom: .5rem;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #aaa;
}
.ugb-card__cat--notice { color: var(--accent); }

.ugb-card__title {
  margin: 0 0 .5rem;
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}
/* 카드 전체를 클릭 영역으로 (체크박스는 위로 띄움) */
.ugb-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.ugb-card:hover .ugb-card__title { text-decoration: underline; text-underline-offset: 3px; }

.ugb-new {
  display: inline-block;
  margin-left: .25rem;
  padding: 0 .3rem;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}

.ugb-card__text {
  margin: 0 0 .75rem;
  font-size: clamp(.8125rem, 1.4vw, .875rem);
  line-height: 1.7;
  color: var(--ink-45);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ugb-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem .375rem;
  font-size: .75rem;
  color: var(--ink-45);
}
.ugb-card__author { font-weight: 600; color: var(--ink-60); }
.ugb-card__dot { opacity: .5; }
.ugb-card__stats {
  display: inline-flex;
  gap: .625rem;
  margin-left: auto;
}

/* 체크박스는 카드 링크 위로 */
.ugb-card__chk {
  position: absolute;
  top: .625rem;
  left: .625rem;
  z-index: 2;
  padding: .125rem;
  border-radius: 6px;
  background: rgb(255 255 255 / .9);
}

/* 좁은 화면에서도 2열이 읽히도록 밀도만 조정 */
@media (max-width: 420px) {
  .ugb-card__body   { padding: .625rem .625rem .75rem; }
  .ugb-card__cat    { margin-bottom: .25rem; font-size: 10px; }
  .ugb-card__title  { font-size: .9375rem; line-height: 1.35; margin-bottom: .375rem; }
  .ugb-card__text   { font-size: .75rem; line-height: 1.6; -webkit-line-clamp: 2; margin-bottom: .5rem; }
  .ugb-card__meta   { font-size: .6875rem; }
  .ugb-card__stats  { margin-left: 0; width: 100%; }
}

/* ── 빈 목록 ─────────────────────────────────────────── */
.ugb-empty {
  padding: clamp(3rem, 10vw, 6rem) 1rem;
  text-align: center;
  color: var(--ink-45);
}
.ugb-empty a { color: var(--accent); font-weight: 600; }

/* ============================================================
   페이지네이션 — 그누보드 기본 마크업(.pg_wrap)에 스킨 적용
   ============================================================ */
.ugb-paging { margin-top: clamp(2rem, 5vw, 3.5rem); }

#ugb_gall .pg_wrap {
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 0;
}
#ugb_gall .pg {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem;
}
#ugb_gall .pg_page,
#ugb_gall .pg_current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.375rem;
  height: 2.375rem;
  padding: 0 .625rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-60);
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
#ugb_gall .pg_page:hover {
  border-color: var(--ink);
  color: var(--ink);
}
#ugb_gall .pg_current {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
#ugb_gall .pg_start,
#ugb_gall .pg_prev,
#ugb_gall .pg_next,
#ugb_gall .pg_end { font-weight: 500; }

@media (max-width: 480px) {
  #ugb_gall .pg_page,
  #ugb_gall .pg_current { min-width: 2rem; height: 2rem; font-size: .8125rem; }
}

/* ── 하단 버튼 영역 ──────────────────────────────────── */
#ugb_gall .bo_fx {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}
#ugb_gall .bo_fx .btn_bo_user {
  display: flex;
  gap: .375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ── 접근성 / 모션 ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ugb-card { transition: none; }
  .ugb-card:hover { transform: none; }
}

/* ── 디버그 ──────────────────────────────────────────── */
.ugb-debug {
  margin-top: 2rem;
  padding: 1rem;
  border: 1px dashed #f0a;
  border-radius: 8px;
  background: #fff8fc;
  font-size: 12px;
  white-space: pre-wrap;
  color: #a04;
}

/* ── 다크모드 ────────────────────────────────────────── */
html.dark #ugb_gall {
  --ink: #f3f4f6;
  --ink-60: #9ca3af;
  --ink-45: #8b929c;
  --line: #292f3d;
  --bg: #161f30;
}
html.dark .ugb-card--notice { border-color: #2a3a5c; background: #16233a; }
html.dark .ugb-card__media { background: #1f2634; }
html.dark .ugb-card__chk { background: rgb(22 31 48 / .9); }
html.dark #ugb_gall .pg_current { background: #f3f4f6; border-color: #f3f4f6; color: #111827; }
