:root {
    --bg: #ffffff;
    --surface: #f7f7f5;
    --text: #1a1a1a;
    --muted: #5c5c5c;
    --border: #dcdcd8;
    --accent: #1f5fbf;
    --code-bg: #f0f0ec;
}
:root[data-theme="dark"] {
    --bg: #121212;
    --surface: #1c1c1c;
    --text: #f0f0f0;
    --muted: #a8a8a8;
    --border: #3a3a3a;
    --accent: #7fb0ff;
    --code-bg: #242424;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
    line-height: 1.75;
    word-break: keep-all;
    overflow-wrap: break-word;
    transition: background 0.2s, color 0.2s;
}

a { color: var(--accent); }

.wrap {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px;
}

/* 헤더 / 내비게이션 */
.site-header {
    border-bottom: 1px solid var(--border);
}
.site-header .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    padding-top: 14px;
    padding-bottom: 14px;
}
.brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    text-decoration: none;
    margin-right: auto;
}
.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    font-size: 15px;
}
.site-nav a {
    color: var(--muted);
    text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
    color: var(--text);
}
.theme-toggle {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}

/* 본문 */
main { padding: 32px 0 48px; }

h1 { font-size: 30px; line-height: 1.35; margin: 0 0 12px; }
h2 { font-size: 22px; line-height: 1.4; margin: 40px 0 12px; }
h3 { font-size: 18px; margin: 28px 0 8px; }

.lead { font-size: 17px; color: var(--muted); }

.meta {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 28px;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--code-bg);
    padding: 2px 5px;
    border-radius: 4px;
}
pre {
    background: var(--code-bg);
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
    line-height: 1.55;
}
pre code { background: none; padding: 0; }

blockquote {
    margin: 20px 0;
    padding: 4px 16px;
    border-left: 3px solid var(--accent);
    color: var(--muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    display: block;
    overflow-x: auto;
}
th, td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}
th { background: var(--surface); }

.toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 15px;
}
.toc ol { margin: 6px 0; padding-left: 20px; }

/* 글 목록 */
.post-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.post-list li {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}
.post-list h3 { margin: 0 0 6px; }
.post-list h3 a { color: var(--text); text-decoration: none; }
.post-list h3 a:hover { text-decoration: underline; }
.post-list p { margin: 0 0 6px; color: var(--muted); }
.post-list .meta { margin: 0; }

.breadcrumb {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 16px;
}
.breadcrumb a { color: var(--muted); }

.author-box {
    margin-top: 48px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
}

.related { margin-top: 32px; font-size: 15px; }

/* 문의 폼 */
.contact-form label {
    display: block;
    margin: 16px 0 6px;
    font-size: 14px;
    font-weight: 600;
}
.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
.contact-form textarea { min-height: 160px; resize: vertical; }
.contact-form button {
    margin-top: 20px;
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 8px;
    background: var(--text);
    color: var(--bg);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.contact-form button:disabled { opacity: 0.6; cursor: default; }
.form-status { margin-top: 12px; font-size: 14px; }

/* 댓글 */
.comments {
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* 푸터 */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0 32px;
    font-size: 14px;
    color: var(--muted);
}
.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-bottom: 8px;
}
.site-footer a { color: var(--muted); }

@media (max-width: 480px) {
    h1 { font-size: 25px; }
    h2 { font-size: 20px; }
}
