/* ===== 기본 리셋 & 변수 ===== */
:root {
    --bg: #ffffff;
    --text: #24292f;
    --muted: #656d76;
    --primary: #0969da;
    --border: #d0d7de;
    --card-bg: #f6f8fa;
    --radius: 10px;
    --max-width: 1300px;
    --header-h: 56px;
    /* 첫 방문 기본 배경 틴트 = 파비콘 라이트 버전의 원 바탕색(#FEF2CB)을 옅게 깐 파스텔 톤.
       흰 배경 위에서 약 #FEF8E2 로 보인다.
       팔레트에서 색조를 바꾸거나 '흰색'을 고를 수 있고, ↺ 로 이 색에 돌아온다 */
    --accent-tint: rgba(254, 242, 203, 0.55);
}

/* ===== 다크 모드 (data-theme="dark" 일 때 색 변수만 교체) ===== */
:root[data-theme="dark"] {
    /* --bg: #0d1117; */
    --bg: #131415;
    --text: #e6edf3;
    --muted: #8b949e;
    --primary: #58a6ff;
    --border: #30363d;
    /* --card-bg: #161b22; */
    --card-bg: #101216;
    /* 다크에서는 연노랑을 아주 옅게만 — 라이트용 틴트를 그대로 쓰면 어두운 화면이 뿌옇게 덮인다 */
    --accent-tint: rgba(254, 242, 203, 0.05);
}
/* 변수로 안 묶인 일부 밝은 색들 다크용 보정 */
:root[data-theme="dark"] .post-summary,
:root[data-theme="dark"] .repo-desc { color: #adbac7; }
:root[data-theme="dark"] .cat-row:hover,
:root[data-theme="dark"] .page-link:hover,
:root[data-theme="dark"] .repo-card:hover { background: #21262d; }
:root[data-theme="dark"] .count { background: #30363d; color: #8b949e; }
:root[data-theme="dark"] .tag { background: rgba(56,139,253,0.15); color: #58a6ff; }
:root[data-theme="dark"] .post-content code,
:root[data-theme="dark"] .post-content pre { background: #161b22; }
:root[data-theme="dark"] .cat-tree .cat-tree { border-left-color: #30363d; }
:root[data-theme="dark"] .cat-row.lvl-3 { color: #adbac7; }
:root[data-theme="dark"] .page-link.disabled { color: #484f58; }

/* 부드러운 전환 */
body { transition: background 0.2s, color 0.2s; }

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
                 "Malgun Gothic", sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.65;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ===== 헤더 ===== */
.site-header {
    border-bottom: 1px solid var(--border);
    /* 기본 배경 위에 선택색 틴트를 덧칠 (틴트 transparent면 그냥 배경색) */
    background: linear-gradient(var(--accent-tint), var(--accent-tint)), var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
    height: var(--header-h);
}
.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 20px;
}
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); white-space: nowrap; }
.nav { display: flex; gap: 16px; flex: 1; margin-left: 48px; }  /* 숫자 키우면 더 오른쪽 */
.nav a { color: var(--text); font-weight: 600; font-size: 0.88rem; letter-spacing: 0.02em; }
.nav a:hover { color: var(--primary); text-decoration: none; }

/* 메뉴 래퍼 — 데스크톱에서는 존재하지 않는 것처럼(자식이 header-inner 의 flex 항목) */
.header-menu { display: contents; }
/* .theme-btn 의 display:inline-flex 가 뒤에 선언돼 있어 클래스 하나로는 덮인다 → 두 클래스로 특이도를 올린다 */
.theme-btn.menu-toggle { display: none; }
/* nav 안 아이콘: 글자 높이에 맞춰 정렬·크기 */
.nav a { display: inline-flex; align-items: center; }
.nav .material-symbols-outlined { font-size: 22px; }

.search-form { display: flex; margin-left: auto; }
.search-form input {
    border: 1px solid var(--border);
    border-radius: var(--radius) 0 0 var(--radius);
    padding: 5px 11px;
    outline: none;
    font-size: 0.9rem;
    width: 160px;
}
.search-form button {
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--card-bg);
    padding: 5px 10px;
    cursor: pointer;
}

/* 다크모드 토글 버튼 */
.theme-btn {
    border: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 38px; height: 34px;
    font-size: 1rem; cursor: pointer;
    line-height: 1;
}
.theme-btn:hover { border-color: var(--primary); }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; }
.theme-btn .material-symbols-outlined { font-size: 20px; }
/* 다크모드일 때 헤더 토글 아이콘들(해·팔레트)은 흰색 */
:root[data-theme="dark"] .theme-btn .material-symbols-outlined { color: #fff; }

/* ===== 테마 색상 피커 ===== */
.color-picker-wrap { position: relative; }
.color-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 280px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 30;
}
.color-panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cp-title {
    flex: 1; font-weight: 700;
    border-left: 4px solid var(--primary); padding-left: 8px;
}
.cp-reset {
    border: 1px solid var(--border); background: var(--bg);
    border-radius: 8px; padding: 3px 9px; cursor: pointer; color: var(--text);
}
.cp-reset:hover { border-color: var(--primary); }
.cp-value {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 3px 10px; font-size: 0.85rem; min-width: 44px; text-align: center;
}

/* 무지개(색상환) 슬라이더 */
.hue-slider {
    width: 100%; height: 14px; border-radius: 7px;
    -webkit-appearance: none; appearance: none; cursor: pointer; outline: none;
    background: linear-gradient(to right,
        hsl(0,70%,50%), hsl(60,70%,50%), hsl(120,70%,50%),
        hsl(180,70%,50%), hsl(240,70%,50%), hsl(300,70%,50%), hsl(360,70%,50%));
}
.hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; border: 1px solid rgba(0,0,0,0.25);
    box-shadow: 0 1px 4px rgba(0,0,0,0.35); cursor: pointer;
}
.hue-slider::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; border: 1px solid rgba(0,0,0,0.25); cursor: pointer;
}

/* ===== 3컬럼 레이아웃 ===== */
.container {
    max-width: var(--max-width);
    margin: 28px auto;
    padding: 0 0px;
    display: grid;
    grid-template-columns: 220px 1fr 220px;
    grid-template-areas: "left main right";
    gap: 48px;
    align-items: start;
}
.sidebar-left  { grid-area: left; }
.content       { grid-area: main; min-width: 0; }
.sidebar-right { grid-area: right; }

/* ===== 공통 사이드바 ===== */
.sidebar-left,
.sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: calc(var(--header-h) + 10px);
    max-height: calc(100vh - var(--header-h) - 20px);
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar-left::-webkit-scrollbar,
.sidebar-right::-webkit-scrollbar { display: none; }

/* ===== 카드 ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
/* 좌우 사이드바 카드: 선택색 틴트를 카드 배경 위에 덧칠 */
.sidebar-left .card,
.sidebar-right .card {
    background: linear-gradient(var(--accent-tint), var(--accent-tint)), var(--card-bg);
}
.card h3 {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* ===== 왼쪽: 프로필 카드 ===== */
.profile-card {
    text-align: center;
}
.avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
/* 프로필 사진 (avatar 설정 시) — .avatar와 동일 크기의 원형 */
.avatar-img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;          /* 비율 유지하며 원 안 꽉 채움 */
    display: block;
    margin: 0 auto 12px;
    border: 1px solid var(--border);
}
.profile-card h2 { font-size: 1.1rem; margin-bottom: 4px; }
.profile-card .muted { font-size: 0.82rem; line-height: 1.4; }

/* ===== 왼쪽: Contact 목록 ===== */
.contact-list { list-style: none; }
.contact-list li { padding: 4px 0; font-size: 0.88rem; }
.contact-list a { color: var(--text); }
.contact-list a:hover { color: var(--primary); text-decoration: none; }

/* ===== 공통: 사이드 리스트 ===== */
.side-list { list-style: none; }
.side-list li a {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    color: var(--text);
    font-size: 0.9rem;
}
.side-list li a:hover { color: var(--primary); text-decoration: none; }
.count {
    background: #eaeef2;
    color: var(--muted);
    border-radius: 20px;
    padding: 0 7px;
    font-size: 0.72rem;
    flex-shrink: 0;
}
.see-all { display: inline-block; margin-top: 10px; font-size: 0.82rem; }

/* ===== 오른쪽: 최근 글 목록 ===== */
.recent-list li a {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.88rem;
    padding: 5px 0;
    color: var(--text);
}
.recent-list li a:hover { color: var(--primary); text-decoration: none; }

/* ===== 태그 ===== */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    background: #ddf4ff;
    color: var(--primary);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.78rem;
}
.tag:hover { background: var(--primary); color: #fff; text-decoration: none; }
.tag-cloud.big .tag { font-size: 0.95rem; padding: 6px 14px; }

/* ===== 글 목록 ===== */
.page-title { font-size: 1.6rem; margin-bottom: 24px; }
.post-list { list-style: none; }
.post-item { padding: 22px 0; border-bottom: 1px solid var(--border); }
.post-item h2 { font-size: 1.25rem; color: var(--text); }
.post-link:hover h2 { color: var(--primary); }
/* 메타 = 날짜 · 카테고리 · (팀원) · 결과.
   카테고리 이름 자체에 '·' 가 들어가는 경우가 있어(예: 공모전 · 해커톤)
   구분자 대신 '형태'로 나눈다 — 날짜는 옅게, 카테고리는 알약, 결과는 세로선. */
.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  margin: 4px 0 8px;
  color: var(--meta-fg, #8c949e);
}
:root { --meta-fg: #8c949e; }
:root[data-theme="dark"] { --meta-fg: #7d868f; }

.meta-date { flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* 카테고리·팀원·결과 모두 앞에 얇은 세로선을 둬 경계를 만든다.
   배경이나 테두리를 쓰면 음영이 세서 제목보다 먼저 눈에 들어온다. */
.meta-cat {
  flex: 0 0 auto;
  color: var(--meta-fg);
  text-decoration: none;
}
.meta-cat:hover { color: var(--primary); text-decoration: none; }

.meta-cat, .meta-team, .meta-result {
  min-width: 0;
  padding-left: 8px;
  border-left: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 목록에서는 한 줄 유지 (길면 결과만 잘린다) */
.post-list .post-meta { flex-wrap: nowrap; overflow: hidden; }
/* 상세는 값이 길 수 있으니 줄바꿈 허용 */
.post-detail .post-meta { flex-wrap: wrap; row-gap: 4px; }
.post-detail .meta-team, .post-detail .meta-result { white-space: normal; }
.post-meta a { color: var(--muted); }
.post-summary { margin: 8px 0 12px; color: #444; }

/* ===== 글 상세 ===== */
.post-detail h1 { font-size: 2rem; margin-bottom: 8px; }
.post-content { margin-top: 24px; }
.post-content h1, .post-content h2, .post-content h3 {
  margin: 24px 0 12px;
  font-weight: 400;   /* 본문 안 제목은 크기로만 위계를 준다 (볼드는 글 제목에만) */
}
.post-content p { margin: 12px 0; }
.post-content ul, .post-content ol { margin: 12px 0 12px 24px; }
.post-content pre {
    background: #f6f8fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}
.post-content code {
    background: #eff1f3;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
}
.post-content pre code { background: none; padding: 0; }
.post-content blockquote {
    border-left: 4px solid var(--border);
    padding-left: 16px;
    color: var(--muted);
    margin: 16px 0;
}
.post-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}
.post-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    font-size: 0.9rem;
}
.post-content th, .post-content td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.post-content th { background: var(--card-bg); font-weight: 600; }

/* ===== 카테고리 목록 ===== */
.category-list { list-style: none; }
.category-list li a {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 1.1rem;
}

/* ===== 계층형 카테고리 트리 ===== */
.full-cat-tree { margin-top: 20px; }
/* 목록 기본 점(• ○ ■) 제거 — 토글 화살표(▸/▾)만 보이게 */
.cat-tree { list-style: none; padding-left: 0; margin: 0; }

.full-cat-tree > .cat-tree > li {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 18px 16px;
    margin-bottom: 16px;
}
.cat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text);
    line-height: 1.4;
}
.cat-row:hover { background: #e9eef4; text-decoration: none; }
.cat-row .cat-name { flex: 0 1 auto; }
.cat-row.lvl-1 { font-size: 1.18rem; font-weight: 400; color: var(--primary); }
.cat-row.lvl-2 { font-size: 1.02rem; font-weight: 400; }
.cat-row.lvl-3 { font-size: 0.92rem; font-weight: 400; color: #4a5568; }
.cat-row.lvl-3 .cat-name::before { content: "└ "; color: #aab4c0; }

/* 토글(details/summary) — 클릭하면 하위 펼침 */
.cat-toggle > summary { cursor: pointer; list-style: none; }
.cat-toggle > summary::-webkit-details-marker { display: none; }   /* 사파리 기본 마커 제거 */
/* 커스텀 화살표: 접힘 ▸ / 펼침 ▾ */
.cat-toggle > summary .cat-name::before {
    content: "▸";
    display: inline-block;
    width: 1em; margin-right: 4px;
    color: var(--muted); font-size: 0.85em;
}
.cat-toggle[open] > summary .cat-name::before { content: "▾"; }

.cat-tree .cat-tree {
    margin: 2px 0 2px 9px;
    padding-left: 16px;
    border-left: 2px solid #e2e8f0;
}
.cat-row .count { font-size: 0.72rem; }

/* ===== 카테고리 상세 ===== */
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.section-title {
    font-size: 1.2rem;
    margin: 28px 0 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.sub-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin: 20px 0;
}
.sub-cat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
}
.sub-cat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    text-decoration: none;
    border-color: var(--primary);
}

/* ===== 프로젝트(깃허브 저장소) ===== */
.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.repo-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    color: var(--text);
    transition: box-shadow .15s;
}
.repo-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); text-decoration: none; }
.repo-card h3 { color: var(--primary); margin-bottom: 8px; overflow-wrap: anywhere; }
/* 조직 저장소 표시 — 제목 위에 옅게 */
.repo-owner {
    display: block;
    margin-bottom: 2px;
    font-size: 0.72rem;
    color: var(--meta-fg);
    overflow-wrap: anywhere;
}
.repo-desc { font-size: 0.9rem; color: #444; min-height: 40px; }
.repo-meta { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); margin-top: 10px; }
.lang { font-weight: 600; }

/* ===== 프로젝트 상세 페이지 ===== */
.proj-header { margin-bottom: 18px; }
.proj-desc { color: #444; margin: 6px 0 12px; }
.proj-links { display: flex; gap: 10px; margin-top: 12px; }
.btn {
    display: inline-block; padding: 8px 16px; border-radius: 8px;
    background: var(--primary); color: #fff; font-size: 0.9rem; font-weight: 600;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }

.proj-og {
    width: 100%; max-width: 640px; border: 1px solid var(--border);
    border-radius: 12px; margin: 18px 0; display: block;
}

/* 그래프 + 표 2단 */
.proj-info { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 640px) { .proj-info { grid-template-columns: 1fr; } }

/* 언어 비율 막대 (라이브러리 없이 CSS만) */
.lang-bar {
    display: flex; height: 14px; border-radius: 7px; overflow: hidden;
    background: var(--border); margin: 6px 0 14px;
}
.lang-bar span { height: 100%; }
.lang-legend { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.lang-legend li { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.lang-legend .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

/* 메타데이터 표 */
.meta-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.meta-table th, .meta-table td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--border); }
.meta-table th { color: var(--muted); font-weight: 600; width: 40%; }

/* README 박스 */
.readme-card .readme-body { max-height: 640px; overflow-y: auto; }
.readme-body img { max-width: 100%; height: auto; }

/* ===== 글쓰기 폼 ===== */
.write-form { display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.write-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.write-form input,
.write-form select,
.write-form textarea {
    font: inherit; font-weight: 400;
    padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--bg); color: var(--text);
}
.write-form textarea { resize: vertical; min-height: 200px; font-family: "SF Mono", Menlo, Consolas, monospace; }
.write-form input:focus,
.write-form select:focus,
.write-form textarea:focus { outline: none; border-color: var(--primary); }
.write-actions { display: flex; gap: 10px; }

/* 글쓰기 - 카테고리 선택 트리 */
.cat-field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.cat-field-label small { font-weight: 400; }
.cat-select {
    max-height: 280px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 12px; background: var(--bg);
}
.cat-select-tree { list-style: none; padding-left: 0; margin: 0; font-weight: 400; }
/* 하위 들여쓰기 + 가이드선 */
.cat-select-tree .cat-select-tree {
    margin: 2px 0 2px 9px; padding-left: 14px; border-left: 2px solid var(--border);
}
/* 말단(라디오) 행 */
.cat-radio { cursor: pointer; }
/* .write-form label(세로배치)을 덮어 가로 배치: 라디오 왼쪽 · 텍스트 오른쪽 · 좌측 정렬 */
.cat-select .cat-radio { flex-direction: row; justify-content: flex-start; align-items: center; }
.cat-radio input { margin: 0 2px 0 0; }
.cat-radio input:checked + .cat-name { color: var(--primary); font-weight: 700; }

/* ===== 페이지네이션 ===== */
.pagination {
    display: flex; justify-content: center; gap: 6px;
    margin: 32px 0 8px;
}
.page-link {
    min-width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 10px; border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 0.9rem;
}
.page-link:hover { background: var(--card-bg); text-decoration: none; }
.page-link.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
    font-weight: 700;
}
.page-link.disabled {
    color: #c0c7ce; pointer-events: none;   /* 끝 페이지에서 클릭 막기 */
}

/* ===== 푸터 ===== */
.site-footer {
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 30px;
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 40px;
}

/* ===== 반응형 ===== */
/* 중간 화면: 왼쪽 사이드바 숨김 */
@media (max-width: 1100px) {
    .container {
        grid-template-columns: 1fr 220px;
        grid-template-areas: "main right";
        gap: 32px;
        padding: 0 24px;   /* 데스크톱 최대폭보다 좁아지면 화면 끝에 붙지 않게 */
    }
    .sidebar-left { display: none; }
}
/* ===== 모바일 (≤760px) ===== */
@media (max-width: 760px) {

    /* ── 헤더: 브랜드 + 팔레트·다크모드·메뉴 버튼만 한 줄에 */
    .header-inner { padding: 0 14px; gap: 8px; }
    .brand { margin-right: auto; font-size: 1.1rem; }
    .theme-btn.menu-toggle { display: inline-flex; }

    /* 메뉴·검색은 헤더 아래로 펼쳐지는 드롭다운 */
    .header-menu {
        display: none;
        position: absolute;
        top: var(--header-h);
        left: 0; right: 0;
        flex-direction: column;
        gap: 4px;
        padding: 10px 14px 16px;
        background: linear-gradient(var(--accent-tint), var(--accent-tint)), var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
    }
    .header-menu.open { display: flex; }
    .nav { flex-direction: column; gap: 0; margin-left: 0; }
    .nav a {
        display: block;
        padding: 11px 4px;              /* 손가락으로 누르기 좋은 높이 */
        font-size: 0.95rem;
        border-bottom: 1px solid var(--border);
    }
    .nav a:last-child { border-bottom: none; }
    .search-form { margin: 8px 0 0; width: 100%; }
    .search-form input { flex: 1; width: auto; font-size: 16px; } /* 16px 미만이면 iOS 가 확대한다 */

    .color-panel { width: min(280px, calc(100vw - 28px)); right: -46px; }

    /* ── 본문: 한 단 + 좌우 여백. 프로필·카테고리·연락처는 본문 아래로 */
    .container {
        grid-template-columns: 1fr;
        grid-template-areas: "main" "left";
        gap: 32px;
        margin: 18px auto 32px;
        padding: 0 16px;
    }
    .sidebar-left {
        display: flex;
        position: static;
        max-height: none;
        overflow: visible;
    }
    .sidebar-right { display: none; }   /* 최근 글은 홈 목록과 겹친다 */

    /* ── 글자 크기 */
    .page-title { font-size: 1.3rem; margin-bottom: 16px; }
    .post-item { padding: 18px 0; }
    .post-item h2 { font-size: 1.08rem; }
    .post-detail h1 { font-size: 1.5rem; line-height: 1.35; }

    /* ── 글 본문: 좁은 화면에서 넘치지 않게 */
    .post-content { overflow-wrap: anywhere; }            /* 긴 URL·플래그 문자열 */
    .post-content pre { padding: 12px; font-size: 0.82rem; margin: 12px -4px; }
    .post-content pre code { overflow-wrap: normal; }     /* 코드블록은 가로 스크롤 유지 */
    .post-content table { display: block; overflow-x: auto; white-space: nowrap; }
    .post-content ul, .post-content ol { margin-left: 18px; }
    .post-content details { padding: 8px 10px; }

    /* ── 상세 속성 */
    .post-facts { padding: 10px 12px; }
    .post-facts dt { flex-basis: 38px; }
}

/* ===== 글 선택 삭제 도구막대 (로컬 전용 UI) ===== */
.bulk-bar {
  display: block;
}
.bulk-bar > .bulk-check,
.bulk-bar > .btn-plain,
.bulk-bar > .bulk-count,
.bulk-bar > .btn-danger {
  vertical-align: middle;
  margin-right: .6rem;
}
.bulk-check {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  cursor: pointer;
  font-size: .9rem;
}
.bulk-count {
  font-size: .85rem;
}
.btn-plain {
  background: none;
  border: 1px solid var(--border, #d0d7de);
  border-radius: 6px;
  padding: .25rem .6rem;
  font-size: .85rem;
  cursor: pointer;
  color: inherit;
}
.btn-plain:hover {
  border-color: var(--accent, #0969da);
}
.btn-danger {
  background: #d1242f;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .3rem .8rem;
  font-size: .85rem;
  cursor: pointer;
}
.btn-danger:hover {
  background: #a40e26;
}

/* 체크박스가 붙은 글 항목 — 선택 삭제 폼 안에서만 가로 배치.
   (전역에 걸면 열람 전용 목록의 제목·날짜·요약까지 한 줄로 늘어선다) */
.bulk-bar .post-item {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}
.post-select {
  padding-top: .55rem;
  cursor: pointer;
}
.post-body {
  flex: 1;
  min-width: 0;
}

/* 삭제 결과 알림 */
.flash {
  margin: 0 0 1rem;
  padding: .6rem .9rem;
  border-radius: 6px;
  border: 1px solid var(--border, #d0d7de);
  background: var(--card, #f6f8fa);
  font-size: .9rem;
}

/* 글 상세의 삭제 버튼 */
.post-actions {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, #d0d7de);
}

/* ===== 글 본문의 토글 (Notion toggle → <details>) ===== */
.post-content details {
  margin: 14px 0;
  padding: 10px 14px;
  border: 1px solid var(--border, #d0d7de);
  border-radius: 8px;
  background: var(--card-bg, #f6f8fa);
}
.post-content details > summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}
.post-content details > summary::-webkit-details-marker { display: none; }
.post-content details > summary::before {
  content: "▸ ";
  color: var(--muted, #6b7280);
}
.post-content details[open] > summary::before { content: "▾ "; }
.post-content details[open] > summary { margin-bottom: 8px; }
/* 토글 안 첫/마지막 요소 여백 정리 */
.post-content details > :nth-child(2) { margin-top: 0; }
.post-content details > :last-child { margin-bottom: 0; }

/* ===== 대표작 슬라이더 (홈 상단) ===== */
.showcase {
  position: relative;
  margin: 0 0 28px;
}
.showcase-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;              /* 스크롤바 숨김 (파이어폭스) */
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}
.showcase-viewport::-webkit-scrollbar { display: none; }

.showcase-track {
  display: flex;
  gap: 14px;
  padding: 4px 2px 10px;
}

.showcase-card {
  position: relative;
  flex: 0 0 auto;
  width: 210px;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: #1c1f24;
  color: #fff;
  text-decoration: none;
  scroll-snap-align: start;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .16);
  transition: transform .18s ease, box-shadow .18s ease;
}
.showcase-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .24);
  text-decoration: none;
}
.showcase-card.no-link { cursor: default; }
.showcase-card.no-link:hover { transform: none; }

.showcase-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}
/* 카드를 끌 때 글자가 선택되면 클릭이 씹힌다 */
.showcase-card { user-select: none; -webkit-user-drag: none; }

/* 글자가 읽히도록 아래쪽에 그라데이션.
   글자가 카드 절반 이상을 차지하므로 짙은 구간을 길게 잡는다
   (짧으면 윗줄인 제목이 밝은 사진 위에 그대로 올라가 안 읽힌다) */
.showcase-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, .92) 0%,
    rgba(0, 0, 0, .82) 38%,
    rgba(0, 0, 0, .55) 62%,
    rgba(0, 0, 0, .12) 85%,
    rgba(0, 0, 0, 0) 100%
  );
}
/* 밝은 사진 위에서도 글자 윤곽이 살도록 옅은 그림자 */
.showcase-text { text-shadow: 0 1px 3px rgba(0, 0, 0, .55); }

.showcase-badge {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  font-size: .72rem;
  font-weight: 600;
}
.showcase-text {
  position: absolute;
  z-index: 2;
  left: 14px; right: 14px; bottom: 14px;
  max-height: calc(100% - 46px);   /* 배지 영역을 남기고 넘치면 자른다 */
  overflow: hidden;
}
.showcase-text h3 {
  margin: 0 0 4px;
  font-size: .95rem;
  line-height: 1.35;
  color: #fff;
}
.showcase-summary {
  margin: 0;
  font-size: .78rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, .82);
  /* 요약이 길면 두 줄까지만 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 날짜 / 팀원 / 결과 — 한 줄씩. 값이 있는 것만 렌더링된다 */
.showcase-meta {
  margin: 3px 0 0;
  font-size: .7rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, .66);
  /* 길면 두 줄까지만 (결과 문구가 긴 경우 대비) */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.showcase-meta:first-of-type { margin-top: 6px; }

/* 좌우 화살표 */
.showcase-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 34px; height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  color: #222;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .18s ease;
}
.showcase:hover .showcase-nav { opacity: 1; }
.showcase-nav.prev { left: -12px; }
.showcase-nav.next { right: -12px; }
.showcase-nav:disabled { opacity: 0 !important; }

/* 위치 표시 점 */
.showcase-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 2px;
}
.showcase-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border, #d0d7de);
  transition: background .2s ease, width .2s ease;
}
.showcase-dots span.active {
  width: 16px;
  border-radius: 3px;
  background: var(--primary, #7ac143);
}

/* 드래그 중에는 스냅을 끄고 커서를 바꾼다 */
.showcase-viewport.dragging {
  scroll-snap-type: none;
  scroll-behavior: auto;
  cursor: grabbing;
}
.showcase-viewport.dragging .showcase-card { pointer-events: none; }

@media (max-width: 640px) {
  .showcase-card { width: 160px; }
  /* 카드가 좁아 글자가 위로 많이 올라간다 → 요약은 한 줄만 */
  .showcase-summary { -webkit-line-clamp: 1; }
  .showcase-text h3 { font-size: .88rem; }
  .showcase-nav { display: none; }   /* 모바일은 스와이프로 */
}

/* 제목에 붙은 토글(Notion toggle heading) — 접히되 제목처럼 보이게.
   본문 제목과 같이 볼드는 쓰지 않는다 */
.post-content details.heading_1 > summary,
.post-content details.heading_2 > summary,
.post-content details.heading_3 > summary {
  font-weight: 400;
  color: var(--text);
}
.post-content details.heading_1 > summary { font-size: 1.45rem; }
.post-content details.heading_2 > summary { font-size: 1.2rem; }
.post-content details.heading_3 > summary { font-size: 1.05rem; }
/* 제목 토글은 박스 없이 담백하게 */
.post-content details.heading_1,
.post-content details.heading_2,
.post-content details.heading_3 {
  border: none;
  background: none;
  padding: 0;
  margin: 22px 0 10px;
}

/* 글 상세의 요약 — 본문 앞 리드 문단. 본문보다 조금 크고 옅게 */
.post-detail .post-lead {
  margin: 14px 0 4px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* ===== 글 상세: 속성 배치 =====
   항목이 많아 한 줄로 늘어놓으면 읽기 어렵다.
   1층 상태·날짜·카테고리 → 2층 요약 → 3층 팀·역할·결과 → 4층 태그 순으로 쌓는다. */

/* 상태: 작은 점 + 글자. 값에 따라 점 색만 달라진다 */
.meta-status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.meta-status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--meta-fg);
}
.meta-status[data-status="완료"]::before   { background: #2da44e; }
.meta-status[data-status="진행 중"]::before { background: #0969da; }
.meta-status[data-status="시작 전"]::before { background: #afb8c1; }

/* 세부 항목: 라벨 + 값을 표처럼 정렬 */
.post-facts {
  margin: 16px 0 4px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  font-size: 0.86rem;
}
.post-facts .fact {
  display: flex;
  gap: 12px;
  padding: 3px 0;
}
.post-facts dt {
  flex: 0 0 46px;
  color: var(--meta-fg);
  font-weight: 400;
}
.post-facts dd {
  margin: 0;
  color: var(--text);
  min-width: 0;
}

/* 태그는 본문 시작 전 마지막 층 */
.post-detail > .tag-cloud { margin: 14px 0 0; }
.post-detail .post-content { margin-top: 22px; }

/* 팔레트: 배경 흰색 토글 */
.cp-plain {
  width: 100%;
  margin-top: 8px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
}
.cp-plain:hover { border-color: var(--primary); color: var(--primary); }

/* ===== 방문자 수 — 모바일 푸터 (데스크톱은 사이드바에 있으므로 숨김) ===== */
.footer-visitors { display: none; margin: 0 0 6px; font-size: .8rem; color: var(--meta-fg); font-variant-numeric: tabular-nums; }
.footer-visitors strong { color: var(--text); font-weight: 600; }
@media (max-width: 760px) {
  .footer-visitors { display: block; }
}

/* ===== 방문자 수 (오른쪽 사이드바 하단) ===== */
.visitor-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}
.visitor-stats > div { display: flex; flex-direction: column; gap: 2px; }
.visitor-stats dt { font-size: 0.72rem; color: var(--meta-fg); letter-spacing: 0.04em; }
.visitor-stats dd { margin: 0; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ===== 반응: 좋아요 · 댓글 (보조 기능이라 작고 담백하게) ===== */
.post-reactions { display: flex; justify-content: center; gap: 8px; margin: 32px 0 8px; }
.like-btn, .comment-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--meta-fg);
  font-size: .82rem;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.like-btn:hover { border-color: #e5484d; color: #e5484d; }
.like-btn:active { transform: scale(.96); }
.like-btn:disabled { opacity: .6; cursor: default; }
.like-btn .like-icon { font-size: .95rem; line-height: 1; }
.like-btn.liked { border-color: #e5484d; color: #e5484d; }
.like-count { font-variant-numeric: tabular-nums; }
.comment-toggle:hover, .comment-toggle[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }

.comments { margin: 12px 0 20px; }
.comment-list { list-style: none; margin: 0 0 10px; padding: 0; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--border); }
.comment-head { display: flex; align-items: baseline; gap: 6px; }
.comment-nick { font-size: .8rem; font-weight: 600; }
.comment-date { font-size: .7rem; color: var(--meta-fg); font-variant-numeric: tabular-nums; }
.comment-delete {
  margin-left: auto; border: none; background: none; padding: 0;
  font-size: .7rem; color: var(--meta-fg); cursor: pointer; opacity: .7;
}
.comment-delete:hover { color: #e5484d; opacity: 1; }
/* 줄바꿈은 살리고 긴 문자열은 넘치지 않게 */
.comment-body { margin: 2px 0 0; font-size: .85rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }

.comment-form { display: flex; flex-direction: column; gap: 6px; }
.comment-form-row { display: flex; gap: 6px; }
.comment-form input, .comment-form textarea {
  font: inherit; font-size: .82rem;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  min-width: 0;
}
.comment-form-row input { flex: 1; }
.comment-form textarea { flex: 1; resize: vertical; min-height: 44px; }
.comment-form input:focus, .comment-form textarea:focus { outline: none; border-color: var(--primary); }
.comment-submit {
  flex: 0 0 auto; align-self: stretch;
  padding: 0 14px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card-bg); color: var(--text);
  font-size: .8rem; cursor: pointer;
}
.comment-submit:hover { border-color: var(--primary); color: var(--primary); }
.comment-submit:disabled { opacity: .6; cursor: default; }
.comment-msg { font-size: .75rem; color: #e5484d; min-height: 0; }
.comment-msg:empty { display: none; }
/* 봇 방지용 숨은 칸 — display:none 은 일부 봇이 건너뛰므로 화면 밖으로 뺀다 */
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 760px) {
  .comment-form input, .comment-form textarea { font-size: 16px; }   /* iOS 확대 방지 */
}
