/* 2026-08-05: 카테고리 썸네일형 게시판 (칸반 075)
   목록 = 상단 분류 탭 + 검색 + 썸네일 카드 / 상세 = 본문 + 주요 활동 사진 + 첨부파일
   사이트 공통 토큰(--accent-tertiary 등) 사용. */

/* ── 상단 카테고리 탭 ── */
.gallery-category-page .category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: var(--spacing-2xl, 32px);
  border: 1px solid var(--border-medium, #ddd);
  border-radius: 8px;
  overflow: hidden;
}
.gallery-category-page .category-tab {
  appearance: none;
  flex: 1 1 0;
  min-width: 120px;
  border: none;
  border-right: 1px solid var(--border-medium, #ddd);
  background: var(--bg-white, #fff);
  color: var(--text-light, #666);
  padding: 14px 18px;
  /* 2026-08-06: 토큰 한 단계 축소 (--font-body 18px → --font-small 16px). 칸반 079 */
  font-size: var(--font-small, 16px);
  font-weight: 600;
  cursor: pointer;
  transition: background .18s ease, color .18s ease;
}
.gallery-category-page .category-tab:last-child { border-right: none; }
.gallery-category-page .category-tab:hover { color: var(--accent-tertiary, #294579); }
.gallery-category-page .category-tab.active {
  background: var(--accent-tertiary, #294579);
  color: #fff;
}

/* ── 제목 + 검색 ── */
.gallery-category-page .category-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: var(--spacing-2xl, 32px) 0 var(--spacing-lg, 24px);
  padding-bottom: var(--spacing-md, 16px);
  border-bottom: 2px solid var(--border-dark, #333);
}
.gallery-category-page .category-list-title {
  margin: 0;
  /* 2026-08-06: base.css 의 전역 `h2 { font-size: ... !important }` 를 이겨야 선언값이 적용된다.
     토큰 한 단계 축소 (--font-h2 32px → --font-h3 24px). 칸반 079 */
  font-size: var(--font-h3, 24px) !important;
  font-weight: 700;
  color: var(--text-dark, #222);
}
.gallery-category-page .category-search {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.gallery-category-page .category-search select,
.gallery-category-page .category-search input {
  border: 1px solid var(--border-medium, #ddd);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: var(--font-small, 14px);
  color: var(--text-dark, #222);
  background-color: var(--bg-white, #fff);
}
/* 2026-08-06: 드롭다운 화살표 (칸반 079)
   components.css 의 전역 `select { appearance:none; background-image: 스프라이트 }` 를
   축약형 background 로 덮어버려 화살표가 사라졌었다. 여기서 SVG 로 직접 그린다.
   화살표 자리를 확보하려고 오른쪽 패딩·최소 너비를 함께 지정('제목+내용' 이 잘리지 않는 폭). */
.gallery-category-page .category-search select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666666' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 8px;
  padding-right: 32px;
  min-width: 112px;
  cursor: pointer;
}
.gallery-category-page .category-search input { min-width: 220px; }
.gallery-category-page .category-search-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  border: none;
  border-radius: 6px;
  background: var(--accent-tertiary, #294579);
  color: #fff;
  cursor: pointer;
}

/* ── 썸네일 카드 ── */
.gallery-category-page .category-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-lg, 24px);
}
.gallery-category-page .category-card {
  display: flex;
  flex-direction: column;
  color: inherit;
  text-decoration: none;
}
.gallery-category-page .category-card-thumb {
  display: block;
  width: 100%;
  /* 2026-08-06: 게시판 설정에서 주입되는 --card-ratio (미설정 시 4/3). 칸반 077 */
  aspect-ratio: var(--card-ratio, 4 / 3);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-light, #f4f5f7);
}
/* 2026-08-12: 게시판 설정(card_fit). contain 이면 잘리지 않고 전부 보이며 남는 곳은 썸네일 배경 (칸반 097) */
.gallery-category-page .category-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: var(--card-fit, cover);
  display: block;
  transition: transform .25s ease;
}
.gallery-category-page .category-card:hover .category-card-thumb img { transform: scale(1.04); }
.gallery-category-page .category-card-body {
  display: block;
  padding: 14px 4px 0;
}
.gallery-category-page .category-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: var(--font-body-lg, 18px);
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-dark, #222);
}
.gallery-category-page .category-card:hover .category-card-title { color: var(--accent-tertiary, #294579); }
.gallery-category-page .category-card-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  font-size: var(--font-small, 14px);
  line-height: 1.5;
  color: var(--text-light, #777);
}

.gallery-category-page .category-empty {
  padding: 60px 0;
  text-align: center;
  color: var(--text-light, #888);
}

@media (max-width: 1024px) {
  .gallery-category-page .category-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .gallery-category-page .category-tabs { border-radius: 6px; }
  .gallery-category-page .category-tab {
    flex: 1 1 50%;
    min-width: 50%;
    padding: 11px 10px;
    /* 2026-08-06: 모바일도 한 단계 축소 (--font-small → --font-xs). 칸반 079 */
    font-size: var(--font-xs, 14px);
    border-bottom: 1px solid var(--border-medium, #ddd);
  }
  .gallery-category-page .category-list-head { gap: 12px; }
  .gallery-category-page .category-search { width: 100%; }
  .gallery-category-page .category-search input { min-width: 0; flex: 1 1 auto; }
  .gallery-category-page .category-card-grid { grid-template-columns: repeat(2, 1fr); gap: var(--spacing-md, 16px); }
  .gallery-category-page .category-card-title { font-size: 15px; }
}

/* ── 상세: 주요 활동 사진 (detail.ejs 공용) ── */
.detail-images {
  margin-top: var(--spacing-2xl, 32px);
}
.detail-images .detail-images-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--spacing-md, 16px);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-dark, #333);
  font-size: var(--font-h4, 20px);
  font-weight: 700;
  color: var(--text-dark, #222);
}
.detail-images .detail-images-grid {
  display: grid;
  /* 2026-08-06: 3열 → 2열 (사진을 크게 보이도록). 칸반 078 */
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md, 16px);
}
.detail-images .detail-images-grid img {
  width: 100%;
  /* 2026-08-06: 게시판 설정에서 주입되는 --photo-ratio (미설정 시 4/3). 칸반 077 */
  aspect-ratio: var(--photo-ratio, 4 / 3);
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-light, #f4f5f7);
  display: block;
}
@media (max-width: 768px) {
  .detail-images .detail-images-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
/* 2026-08-06: 폰 폭에서는 1열 — 2열이면 사진이 너무 작아진다. 칸반 078 */
@media (max-width: 560px) {
  .detail-images .detail-images-grid { grid-template-columns: 1fr; }
}

/* ── 사진 확대 모달 (라이트박스, 2026-08-06 칸반 078) ── */
.detail-images .detail-images-grid img.is-zoomable {
  cursor: zoom-in;
  transition: opacity .18s ease;
}
.detail-images .detail-images-grid img.is-zoomable:hover { opacity: .88; }
.detail-images .detail-images-grid img.is-zoomable:focus-visible {
  outline: 3px solid var(--accent-tertiary, #294579);
  outline-offset: 2px;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 72px;
}
.photo-lightbox[hidden] { display: none; }
.photo-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .86);
}
.photo-lightbox__figure {
  position: relative;
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.photo-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  border-radius: 6px;
  background: #111;
}
.photo-lightbox__counter {
  color: rgba(255, 255, 255, .82);
  font-size: var(--font-small, 14px);
  letter-spacing: .04em;
}
.photo-lightbox__close,
.photo-lightbox__nav {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  transition: background .18s ease;
}
.photo-lightbox__close:hover,
.photo-lightbox__nav:hover { background: rgba(255, 255, 255, .3); }
.photo-lightbox__close {
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
}
.photo-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
}
.photo-lightbox__nav--prev { left: 14px; }
.photo-lightbox__nav--next { right: 14px; }
.photo-lightbox__nav[hidden],
.photo-lightbox__counter[hidden] { display: none; }
.photo-lightbox .material-symbols-outlined { font-size: 28px; }

@media (max-width: 768px) {
  .photo-lightbox { padding: 52px 12px; }
  .photo-lightbox__image { max-height: calc(100vh - 150px); }
  .photo-lightbox__nav { width: 42px; height: 42px; }
  .photo-lightbox__nav--prev { left: 6px; }
  .photo-lightbox__nav--next { right: 6px; }
  .photo-lightbox__close { top: 10px; right: 10px; width: 40px; height: 40px; }
}

/* ── 상세: 카테고리 썸네일형 헤더 / 안내 항목 (detail.ejs) ── */
.category-detail-header {
  padding-bottom: var(--spacing-lg, 24px);
  margin-bottom: var(--spacing-xl, 24px);
  border-bottom: 2px solid var(--border-dark, #333);
}
.category-detail-chip {
  display: inline-block;
  margin-bottom: 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-tertiary, #294579);
  color: #fff;
  font-size: var(--font-small, 14px);
  font-weight: 600;
}
.category-detail-sub {
  margin: 0 0 6px;
  color: var(--text-light, #777);
  font-size: var(--font-body, 16px);
  line-height: 1.6;
}
.category-detail-header .detail-title {
  margin: 0;
  font-size: var(--font-h2, 30px);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-dark, #222);
}
.category-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 10px 18px;
  border: 1px solid var(--accent-tertiary, #294579);
  border-radius: 999px;
  color: var(--accent-tertiary, #294579);
  font-size: var(--font-small, 14px);
  font-weight: 600;
  text-decoration: none;
}
.category-detail-link:hover {
  background: var(--accent-tertiary, #294579);
  color: #fff;
}

.category-detail-info {
  margin-bottom: var(--spacing-xl, 24px);
  border-top: 1px solid var(--border-medium, #ddd);
}
.category-detail-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid var(--border-light, #eee);
}
.category-detail-label {
  padding: 14px 16px;
  background: var(--bg-light, #f7f8fa);
  font-weight: 700;
  color: var(--text-dark, #222);
}
.category-detail-value {
  padding: 14px 16px;
  color: var(--text-body, #444);
  line-height: 1.6;
  white-space: pre-line;
}
@media (max-width: 768px) {
  .category-detail-header .detail-title { font-size: 22px; }
  .category-detail-row { grid-template-columns: 1fr; }
  .category-detail-label { padding: 10px 12px; }
  .category-detail-value { padding: 12px; }
}
