:root {
    --bg: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-bg: #eff6ff;
    --danger: #dc2626;
    --success: #16a34a;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
    --max-width: 900px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f0f0f;
        --bg-secondary: #1a1a1a;
        --bg-card: #1e1e1e;
        --text: #e5e5e5;
        --text-secondary: #a0a0a0;
        --text-muted: #666666;
        --border: #2e2e2e;
        --accent: #60a5fa;
        --accent-hover: #93bbfd;
        --accent-bg: #1e293b;
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
        --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Noto Sans KR", "Malgun Gothic", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Header ── */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.site-header .inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.site-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}
.site-logo:hover { color: var(--accent); text-decoration: none; }
.breadcrumb {
    font-size: 14px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 6px; color: var(--text-muted); }

/* ── Container ── */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 20px;
}

/* ── Article (개별 게시글) ── */
.article-header {
    padding: 24px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.article-header h1 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    word-break: keep-all;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}
.article-meta .author { font-weight: 600; color: var(--text); }
.article-meta .stat { display: flex; align-items: center; gap: 4px; }
.article-category {
    display: inline-block;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.article-content {
    padding: 0 0 32px;
    font-size: 16px;
    line-height: 1.8;
    word-break: break-word;
    overflow-wrap: break-word;
}
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 12px 0;
}
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    overflow-x: auto;
    display: block;
}
.article-content td, .article-content th {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}
.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    margin: 16px 0;
    background: var(--bg-secondary);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.article-content pre, .article-content code {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 14px;
}
.article-content pre {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 16px 0;
}
.article-content a { word-break: break-all; }

/* ── Attachments ── */
.attachments {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 24px;
}
.attachments h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}
.attachments ul { list-style: none; }
.attachments li {
    padding: 4px 0;
    font-size: 14px;
}
.attachments .filesize {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 4px;
}

/* ── Comments ── */
.comments-section {
    border-top: 2px solid var(--border);
    padding-top: 24px;
}
.comments-header {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}
.comments-header .count {
    color: var(--accent);
}
.comment {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-meta {
    display: flex;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 8px;
}
.comment-meta .author { font-weight: 600; color: var(--text); }
.comment-meta .date { color: var(--text-muted); }
.comment-body {
    font-size: 15px;
    line-height: 1.7;
    word-break: break-word;
}
.comment-body img { max-width: 100%; height: auto; }
.comment.reply {
    margin-left: 24px;
    padding-left: 16px;
    border-left: 2px solid var(--border);
}

/* ── Board List (게시판 목록) ── */
.board-header {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}
.board-header h1 {
    font-size: 22px;
    font-weight: 700;
}
.board-header .count {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}
.post-list { margin-top: 8px; }
.post-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.post-item:hover {
    background: var(--bg-secondary);
    margin: 0 -12px;
    padding: 12px;
    border-radius: var(--radius);
}
.post-title {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }
.post-title .comment-count {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    margin-left: 4px;
}
.post-meta-inline {
    display: flex;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 24px 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}
.pagination a:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.pagination .current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* ── Main Index ── */
.main-hero {
    text-align: center;
    padding: 48px 0 32px;
}
.main-hero h1 { font-size: 28px; font-weight: 800; }
.main-hero p {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 16px;
}
.search-box {
    max-width: 500px;
    margin: 24px auto 0;
    position: relative;
}
.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    background: var(--bg-card);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}
.search-box input:focus { border-color: var(--accent); }

.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 32px;
}
.board-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: box-shadow 0.2s, transform 0.2s;
}
.board-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.board-card h2 { font-size: 18px; margin-bottom: 4px; }
.board-card h2 a { color: var(--text); }
.board-card h2 a:hover { color: var(--accent); text-decoration: none; }
.board-card .count {
    font-size: 14px;
    color: var(--text-muted);
}

/* ── Search Page ── */
.search-results { margin-top: 24px; }
.search-result-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.search-result-item h3 { font-size: 16px; margin-bottom: 4px; }
.search-result-item .excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.search-result-item .result-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}
.no-results {
    text-align: center;
    padding: 48px 0;
    color: var(--text-muted);
}

/* ── Footer ── */
.site-footer {
    text-align: center;
    padding: 32px 20px;
    margin-top: 48px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .container { padding: 12px; }
    .article-header h1 { font-size: 20px; }
    .post-item { flex-direction: column; gap: 4px; }
    .post-title { white-space: normal; }
    .post-meta-inline { font-size: 12px; }
    .board-grid { grid-template-columns: 1fr; }
    .comment.reply { margin-left: 12px; }
}
