/* public_html/assets/common/board.css
   Board (list / view / gallery) — Ultimate v1 (Stable)
   - 목표: 가독성/유지보수성 개선(섹션화 + 중복 제거) + 브레이크포인트 1040/640 통일
   - 원칙: 기존 UI/동작 최대 유지 (값/구조는 유지하고, 중복/패치만 정리)
*/

/* =========================================================
   B0. SHARED (container + minor defaults)
========================================================= */

.board,
.board-view {
  background: transparent;
}

.board .site-container,
.board-view .site-container {
  max-width: var(--container, 1040px);
  margin: 0 auto;
  padding: 0 16px;
}

/* =========================================================
   B1. LIST PAGE
========================================================= */

.board {
  padding: 0 0 60px;
}

/* Title (left) + Search (right) */
.board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 0 14px;
}

.board__title {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--color-secondary, var(--color-accent, var(--c-ink, #111)));
}

/* Search pill + icon button inside */
.board__search {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
}

.board__searchInput {
  width: 380px;
  max-width: 44vw;
  height: 50px; /* final */
  padding: 0 60px 0 18px; /* space for icon button */
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  font-size: 15px;
  outline: none;
}

.board__searchInput:focus {
  border-color: rgba(0, 0, 0, 0.28);
}

.board__searchBtn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background-color: #111;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  cursor: pointer;
  z-index: 2; /* input 위로 */
  text-indent: -9999px; /* text hide */
  overflow: hidden;
  white-space: nowrap;
}

/* Table wrap */
.board__tableWrap {
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.board__table {
  width: 100%;
  border-collapse: collapse;
}

.board__th,
.board__td {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 15px;
}

.board__th {
  background: #e9eaee;
  font-weight: 800;
  text-align: center;
}

.board__td {
  background: #fff;
}

/* Column widths */
.board__th--type,
.board__td--type {
  width: 120px;
  text-align: center;
  white-space: nowrap;
}

.board__th--date,
.board__td--date {
  width: 140px;
  text-align: center;
  white-space: nowrap;
}

.board__th--views,
.board__td--views {
  width: 110px;
  text-align: center;
  white-space: nowrap;
}

.board__th--title,
.board__td--title {
  text-align: left;
}

/* Header label: show "No." */
.board__th--type {
  font-size: 0;
}
.board__th--type::before {
  content: "No.";
  font-size: 15px;
}

/* Link */
.board__link {
  color: inherit;
  text-decoration: none;
}
.board__link:hover {
  text-decoration: underline;
}

/* Notice row + badge */
.board__row--notice .board__td {
  font-weight: 700;
}

.board__badge {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  background: #0b74ff;
  color: #fff;
}

/* Row hover */
.board__row:hover .board__td {
  background: #f7f8fc;
}

/* Numbering for normal rows */
.board__table tbody {
  counter-reset: row;
}
.board__row:not(.board__row--notice) {
  counter-increment: row;
}
.board__row:not(.board__row--notice) .board__td--type {
  font-size: 0;
}
.board__row:not(.board__row--notice) .board__td--type::before {
  content: counter(row);
  font-size: 15px;
  font-weight: 700;
  color: #111;
}

/* Attachment icon */
.board__clip {
  display: inline-block;
  width: 18px;
  height: 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.75;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48'/%3E%3C/svg%3E");
}

/* Pagination */
.board__pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 16px;
}

.board__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 999px;
  text-decoration: none;
  color: inherit;
  background: #fff;
}

.board__page.is-active {
  border-color: rgba(0, 0, 0, 0.35);
  background: rgba(0, 0, 0, 0.08);
}

/* =========================================================
   B2. VIEW PAGE
   (view.php에서 board-view__top을 삭제해도 문제 없음)
========================================================= */

.board-view {
  padding: 28px 0 80px;
}

/* Card */
.board-view__card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.06);
}

/* Head */
.board-view__head {
  padding: 34px 40px 22px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 1;
}

.board-view__boardTitle {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 900;
  color: var(--color-secondary, var(--color-accent, #0f766e));
  letter-spacing: -0.01em;
}

.board-view__title {
  margin: 0;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

/* Meta chips */
.board-view__meta {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.board-view__metaItem {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.72);
  white-space: nowrap;
}

/* Attachments */
.board-view__attachments {
  padding: 18px 40px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
}

.board-view__attachmentsTitle {
  font-weight: 900;
  font-size: 14px;
  margin: 0 0 10px;
}

/* list: 기본 1열, 2개 이상이면 유동 그리드(템플릿에서 is-multi 클래스 붙여주면 됨) */
.board-view__attachmentsList {
  list-style: none;
  margin: 0;
  padding: 0;

  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

.board-view__attachmentsList.is-multi {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* 한 개 파일 카드(링크/비링크 공통) */
.board-view__attachmentsLink,
.board-view__attachmentsText {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: #111;
  font-weight: 900;

  /* 긴 파일명 대비 */
  min-width: 0;
}

/* left file icon */
.board-view__attachmentsLink::before,
.board-view__attachmentsText::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.78;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3C/svg%3E");
}

/* right download icon (링크만 강하게) */
.board-view__attachmentsLink::after,
.board-view__attachmentsText::after {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.85;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
}

/* 링크 없는 경우(텍스트)는 다운로드 아이콘 약하게 */
.board-view__attachmentsText::after {
  opacity: 0.35;
}

.board-view__attachmentsLink:hover {
  border-color: rgba(0, 0, 0, 0.16);
}

/* Content */
.board-view__content {
  padding: 26px 40px 40px;
  line-height: 1.85;
  font-size: 15px;
}

.board-view__content p {
  margin: 0 0 12px;
}
.board-view__content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* Bottom button */
.board-view__bottom {
  padding: 18px 40px 26px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: center;
  background: #fff;
}

.board-view__backBtn {
  min-width: 220px;
  height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
  text-decoration: none;
  color: inherit;
  font-weight: 900;
}
.board-view__backBtn:hover {
  border-color: rgba(0, 0, 0, 0.26);
}

/* =========================================================
   B3. GALLERY LIST (Reference-like hover)
   Markup:
   <a class="board-gallery__item">
     <div class="board-gallery__thumb"><img/></div>
     <div class="board-gallery__title">...</div>
     <div class="board-gallery__meta">...</div>
   </a>
========================================================= */

.board-gallery {
  margin-top: 12px;
}

.board-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* Card */
.board-gallery__item {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

/* Thumb */
.board-gallery__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.board-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1);
  transition: transform 0.35s ease;
}

/* Hover overlay (full) */
.board-gallery__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Title/Meta overlay text */
.board-gallery__title,
.board-gallery__meta {
  position: absolute;
  left: 18px;
  right: 18px;
  z-index: 2;
  color: #fff;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
  margin: 0;
}

.board-gallery__title {
  top: 18px;
  font-weight: 900;
  letter-spacing: -0.02em;
  font-size: 26px;
  line-height: 1.12;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.board-gallery__meta {
  bottom: 18px;
  font-weight: 900;
  font-size: 14px;
}

/* Hover behavior */
.board-gallery__item:hover .board-gallery__thumb::after {
  opacity: 1;
}
.board-gallery__item:hover .board-gallery__thumb img {
  transform: scale(1.04);
}
.board-gallery__item:hover .board-gallery__title,
.board-gallery__item:hover .board-gallery__meta {
  opacity: 1;
  transform: translateY(0);
}

/* Touch devices: 항상 보여주기(hover 없음) */
@media (hover: none) {
  .board-gallery__thumb::after {
    opacity: 0.35;
  }
  .board-gallery__title,
  .board-gallery__meta {
    opacity: 1;
    transform: none;
  }
}

/* Placeholder */
.board-gallery__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  opacity: 0.7;
}

/* =========================================================
   B9. RESPONSIVE (1040 / 640)
========================================================= */

@media (max-width: 1040px) {
  /* LIST: head stacked */
  .board__head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .board__search {
    justify-content: flex-end;
  }
  .board__searchInput {
    width: 100%;
    max-width: none;
  }

  /* VIEW: paddings + title size */
  .board-view__head,
  .board-view__attachments,
  .board-view__content,
  .board-view__bottom {
    padding-left: 18px;
    padding-right: 18px;
  }
  .board-view__title {
    font-size: 30px;
  }

  /* GALLERY: 3 -> 2 */
  .board-gallery__grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .board-gallery__title {
    font-size: 22px;
  }
}

@media (max-width: 640px) {
  /* LIST: table compact + 안전 스크롤 */
  .board__tableWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .board__th,
  .board__td {
    padding: 12px;
    font-size: 14px;
  }
  .board__th--type,
  .board__td--type {
    width: 70px;
  }
  .board__th--views,
  .board__td--views {
    width: 70px;
  }
  .board__th--date,
  .board__td--date {
    width: 110px;
  }

  /* VIEW: attachments multi -> 1 */
  .board-view__attachmentsList.is-multi {
    grid-template-columns: 1fr;
  }

  /* GALLERY: 2 -> 1 */
  .board-gallery__grid {
    grid-template-columns: 1fr;
  }
  .board-gallery__title {
    font-size: 20px;
  }
}
