/* ============================================================
   게시판 — 목록·보기·쓰기·갤러리·항만책자·항만 데이터
   ============================================================ */
.board-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.board-total { margin: 0; font-size: var(--text-body-sm); color: var(--color-text-muted); }
.board-total strong { color: var(--color-primary); }

.board-table { border-top: 2px solid var(--color-primary); }
.board-table th, .board-table td { padding: 12px 10px; vertical-align: middle; }
.board-table .col-no, .board-table .col-hits { width: 64px; text-align: center; color: var(--color-text-subtle); font-variant-numeric: tabular-nums; }
.board-table .col-attach { width: 72px; text-align: center; white-space: nowrap; }
.board-table .col-date { width: 110px; white-space: nowrap; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.board-table .col-writer { width: 100px; color: var(--color-text-muted); }
.board-table .col-title a { color: var(--color-text); font-weight: var(--weight-medium); }
.board-table .col-title a:hover { color: var(--color-accent-ink); }
.board-table thead th { text-align: center; white-space: nowrap; }
.board-table thead th.col-title { text-align: left; }
.attach-icon { display: inline-flex; padding: 4px; border-radius: var(--radius-sm); color: var(--color-text-subtle); }
.attach-icon:hover { color: var(--color-accent-ink); background: var(--color-surface-sunken); }
.attach-icon svg { width: 16px; height: 16px; }
@media (max-width: 640px) {
  .board-table thead { display: none; }
  .board-table tr { display: grid; grid-template-columns: 1fr auto; padding: 12px 4px; border-bottom: 1px solid var(--color-border); gap: 2px 8px; }
  .board-table td { display: block; border: 0; padding: 0; width: auto !important; text-align: left !important; }
  .board-table .col-no, .board-table .col-writer, .board-table .col-hits { display: none; }
  .board-table .col-title { grid-column: 1; }
  .board-table .col-attach { grid-column: 2; grid-row: 1; }
  .board-table .col-date { grid-column: 1; font-size: var(--text-caption); }
  .board-table tbody td.empty { grid-column: 1 / -1; }
}

.board-search { display: flex; gap: 6px; justify-content: center; margin-top: var(--space-6); flex-wrap: wrap; }
.board-search select, .board-search input { height: var(--btn-height-sm); padding: 0 10px; border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); font-size: 0.875rem; }
.board-search input { min-width: 220px; }
.board-search--inline { justify-content: flex-start; margin: 0 0 var(--space-6); }
.board-search--inline input { min-width: min(320px, 100%); }
/* 줄바꿈은 flex 로 늘어난 뒤 폭이 아니라 "기준 폭" 으로 판정된다. 기준이 160px 이면
   select(108) + 160 + 버튼(68) + 간격(12) = 348px 가 필요해 372px 보다 좁은 화면에서 버튼이 밀려난다.
   기준만 낮추면 한 줄로 들어오고, 입력칸은 남는 공간을 그대로 채워 실제 폭은 줄지 않는다. */
@media (max-width: 640px) { .board-search input { flex: 1 1 90px; min-width: 0; } }

/* 보기 */
.post-head { padding-bottom: var(--space-4); border-bottom: 1px solid var(--color-border); margin-bottom: var(--space-4); }
.post-title { font-size: var(--text-h2); margin-bottom: var(--space-3); }
.post-meta { display: flex; flex-wrap: wrap; gap: var(--space-4); font-size: var(--text-caption); color: var(--color-text-muted); }
.post-meta span { color: var(--color-text-subtle); margin-right: 6px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.7rem; }
.post-files { display: grid; gap: 6px; padding: var(--space-3) var(--space-4); background: var(--color-surface-alt); border-radius: var(--radius-md); margin-bottom: var(--space-6); font-size: var(--text-body-sm); }
.post-files a { display: inline-flex; align-items: center; gap: 6px; font-weight: var(--weight-medium); }
.post-files .file-icon { display: inline-flex; flex-shrink: 0; color: var(--color-text-subtle); }
.post-files .file-icon svg { width: 15px; height: 15px; }
.post-files .muted { margin-left: 8px; font-size: var(--text-caption); }
.post-body { min-height: 160px; line-height: var(--leading-relaxed); overflow-wrap: anywhere; }
.post-body img { height: auto; max-width: 100%; }
.post-body table { max-width: 100%; }
.post-body p { margin-bottom: 1em; }
.post-image { margin: 0 0 var(--space-4); }
.post-image img { border-radius: var(--radius-md); }
.post-nav { display: grid; gap: 2px; margin-top: var(--space-10); border-top: 1px solid var(--color-border); }
.post-nav-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--space-3); padding: 12px 8px; border-bottom: 1px solid var(--color-border); color: var(--color-text); font-size: var(--text-body-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-nav-item span { color: var(--color-text-subtle); font-size: var(--text-caption); text-transform: uppercase; letter-spacing: 0.06em; }
.post-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-6); flex-wrap: wrap; }
.notice-box { padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--color-accent-soft); color: var(--color-accent-ink); font-size: var(--text-body-sm); }

/* 항만책자 글 본문 — 옛 사이트의 'General infomation' 탭 머리와 Word 표 */
.post-body .tab_blue { display: inline-block; padding: 6px 16px; background: var(--color-primary); color: #fff; font-weight: var(--weight-semibold); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.post-body .tab_blue * { color: #fff !important; font-family: inherit !important; font-size: 0.9rem !important; }
.post-body table { width: 100% !important; border-collapse: collapse; font-size: var(--text-body-sm); }
.post-body table td, .post-body table th { padding: 6px 10px !important; border: 1px solid var(--color-border-strong) !important; vertical-align: middle; }
.post-body table font { font-family: inherit !important; font-size: inherit !important; }

/* 갤러리 */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-5); }
.gallery-grid a { display: block; color: var(--color-text); }
.gallery-thumb { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface-sunken); margin-bottom: 10px; border: 1px solid var(--color-border); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s var(--ease); }
.gallery-grid a:hover img { transform: scale(1.05); }
.gallery-grid a:hover { text-decoration: none; }
.gallery-noimg { display: grid; place-items: center; height: 100%; color: var(--color-text-subtle); font-size: var(--text-caption); }
.gallery-title { display: block; font-weight: var(--weight-medium); font-size: var(--text-body-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-grid time { font-size: var(--text-caption); color: var(--color-text-subtle); }
.gallery-grid .empty { grid-column: 1 / -1; }

/* 항만책자 · 항만 데이터 */
/* 사용 안 하는 Port Data 페이지(info/directory.html, site_menu 에서 visible=False)가
   아직 이 클래스를 쓴다. 다시 켜도 화면이 깨지지 않게 남겨둔다. */
.directory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.directory-grid li[hidden] { display: none; }
.directory-grid a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text); font-weight: var(--weight-medium); font-size: var(--text-body-sm); transition: border-color var(--duration), background var(--duration); }
.directory-grid a:hover { border-color: var(--color-accent); background: var(--color-accent-soft); text-decoration: none; color: var(--color-accent-ink); }
.directory-grid a span { overflow-wrap: normal; word-break: normal; }
.directory-grid small { color: var(--color-text-subtle); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; }
.directory-grid .empty { grid-column: 1 / -1; }

/* ── 항만책자 (67개 항만) ─────────────────────────────────── */
.port-filter { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-5); }
.port-filter input[type="search"] { flex: 0 1 320px; min-width: 0; height: var(--btn-height); padding: 0 var(--space-3); border: 1px solid var(--color-border-strong); border-radius: var(--radius-sm); font-size: var(--text-body-sm); }
.port-filter input[type="search"]:focus { outline: 2px solid var(--color-accent); outline-offset: -1px; border-color: var(--color-accent); }
.port-count { margin: 0; font-size: var(--text-caption); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.port-count strong { color: var(--color-heading); }

/* 있는 글자는 누를 수 있고, 없는 글자는 회색 — 어느 글자가 비었는지 그대로 보인다 */
.alpha-nav span { min-width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); color: var(--color-border-strong); font-size: var(--text-caption); font-weight: var(--weight-semibold); }

/* [글자 | 그 글자의 항만들] 한 줄씩 — 67개를 18줄로 줄여 한눈에 훑을 수 있다 */
.port-index { border-top: 1px solid var(--color-border); }
.port-index-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--space-4); align-items: baseline; padding: var(--space-4) 0; border-bottom: 1px solid var(--color-border); scroll-margin-top: calc(var(--header-h) + 16px); }
.port-index-row[hidden] { display: none; }
.port-index-letter { font-size: var(--text-h3); font-weight: var(--weight-bold); color: var(--color-primary); line-height: 1; }
.port-index-names { display: flex; flex-wrap: wrap; gap: 6px; }
.port-index-names li[hidden] { display: none; }
.port-index-names a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--color-border); border-radius: var(--radius-full); color: var(--color-text); font-weight: var(--weight-medium); font-size: var(--text-body-sm); white-space: nowrap; transition: border-color var(--duration), background var(--duration), color var(--duration); }
.port-index-names a:hover { border-color: var(--color-accent); background: var(--color-accent-soft); color: var(--color-accent-ink); text-decoration: none; }
.port-index-names small { display: inline-grid; place-items: center; min-width: 17px; height: 17px; border-radius: var(--radius-full); background: var(--color-surface-sunken); color: var(--color-text-subtle); font-size: 0.65rem; font-weight: var(--weight-semibold); }
.port-index .empty { padding: var(--space-4) 0; color: var(--color-text-muted); }
.port-empty { margin-top: var(--space-5); color: var(--color-text-muted); font-size: var(--text-body-sm); }

@media (max-width: 560px) {
  .port-index-row { grid-template-columns: minmax(0, 1fr); gap: var(--space-2); padding: var(--space-3) 0; }
  .port-index-letter { font-size: var(--text-caption); letter-spacing: var(--tracking-label); color: var(--color-text-subtle); }
}
.alpha-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--space-6); }
.alpha-nav a { min-width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); background: var(--color-surface-alt); color: var(--color-text-muted); font-size: var(--text-caption); font-weight: var(--weight-semibold); }
.alpha-nav a:hover { background: var(--color-primary); color: #fff; text-decoration: none; }
.alpha-group { margin-bottom: var(--space-6); }
.alpha-group h2 { font-size: var(--text-h3); color: var(--color-primary); margin-bottom: var(--space-3); padding-bottom: 6px; border-bottom: 1px solid var(--color-border); }

.port-detail-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.port-detail-head h2 { font-size: var(--text-h2); }
.tabs { margin-top: var(--space-5); }
.tab-list { display: flex; gap: 2px; border-bottom: 2px solid var(--color-primary); margin-bottom: var(--space-4); overflow-x: auto; }
.tab-list button { padding: 10px 18px; border: 0; background: var(--color-surface-alt); color: var(--color-text-muted); font-weight: var(--weight-semibold); font-size: var(--text-body-sm); border-radius: var(--radius-sm) var(--radius-sm) 0 0; white-space: nowrap; }
.tab-list button[aria-selected="true"] { background: var(--color-primary); color: #fff; }
.table-def th { width: 18%; background: var(--color-surface-alt); overflow-wrap: normal; }  /* 항목명은 단어 중간에서 끊지 않음 (열 2개 × 18%) */
@media (max-width: 640px) { .table-def th { width: auto; } .table-def th, .table-def td { padding: 10px 8px; } }  /* 폰: 항목 열은 내용만큼만 */
.table-def thead th { width: auto; }
.table-def td { white-space: pre-line; }

/* ── Q&A 답변 ─────────────────────────────────────────────── */
.post-answer { margin-top: var(--space-8); padding: var(--space-5) var(--space-6); border-left: 4px solid var(--color-primary); border-radius: var(--radius-md); background: var(--color-surface-alt); }
.post-answer-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
.post-answer-head h3 { font-size: var(--text-h3); color: var(--color-primary); }
.post-answer-head .muted { font-size: var(--text-caption); color: var(--color-text-muted); }
.post-answer .post-body { min-height: 0; }
.col-title .answered { margin-left: 6px; vertical-align: 1px; }
.col-title .pinned { margin-right: 6px; vertical-align: 1px; }

/* 검색칸도 누르면 iOS 가 확대하지 않도록 (tokens.css 의 같은 보정과 한 쌍) */
@media (max-width: 768px) {
  .board-search input, .board-search select, .port-filter input[type="search"] { font-size: 16px; }
}
