 
/* 사용자가 선택한 다크 테마 */
[data-theme="dark"] {
    --bg-color: #141414;
    --text-color: #e0e0e0;
    --article-bg: #171717;
    --article-hover-bg: #1f1f1f;
    --border-color: #2a2a2a;
    --border-hover-color: #3a3a3a;
    --nav-color: #aaa;
    --nav-hover-color: #fff;
    --date-color: #aaa;
    --category-bg: #333;
    --category-color: #ccc;
    --footer-color: #aaa;
    --divider-color: #2a2a2a;
    --link-color: #66b3ff;
    --link-hover-color: #99ccff;
    --link-visited-color: #cc99ff;
}

/* 사용자가 선택한 라이트 테마 */
[data-theme="light"] {
    --bg-color: #fff;
    --text-color: #000;
    --article-bg: #fafafa;
    --article-hover-bg: #f5f5f5;
    --border-color: #e0e0e0;
    --border-hover-color: #ccc;
    --nav-color: #666;
    --nav-hover-color: #000;
    --date-color: #666;
    --category-bg: #e8e8e8;
    --category-color: #555;
    --footer-color: #666;
    --divider-color: #eee;
    --link-color: #0066cc;
    --link-hover-color: #004499;
    --link-visited-color: #551a8b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: var(--bg-color);
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem;
    font-size: 16px;
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    margin-bottom: 4rem;
    text-align: left;
    border-bottom: none;
    padding-bottom: 0;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 a {
    color: inherit;
    text-decoration: none;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    line-height: 1.4;
}

h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem 0;
    line-height: 1.4;
}

h5 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    line-height: 1.4;
}

h6 {
    font-size: 0.75rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    line-height: 1.4;
}

nav {
    margin-top: 2rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: flex-start;
    gap: 2rem;
    padding: 0;
}

nav a {
    color: var(--nav-color);
    text-decoration: none;
    font-weight: 400;
    font-size: 16px;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--nav-hover-color);
}

main {
    margin-bottom: 4rem;
}

article {
    margin-bottom: 4rem;
    padding: 2rem;
    background: var(--article-bg);
    border-radius: 8px;
    border-left: 2px solid var(--border-color);
    transition: all 0.2s ease;
}

/* 호버 효과 제거 */

article h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

article h2 a {
    color: inherit;
    text-decoration: none;
}

article h2 a:hover {
    text-decoration: underline;
}

.date {
    color: var(--date-color);
    font-size: 14px;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--divider-color);
}

.category {
    background: var(--category-bg);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--category-color);
}

.theme-switch {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: var(--article-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.theme-switch:hover {
    background: var(--article-hover-bg);
    border-color: var(--border-hover-color);
    transform: scale(1.1);
}

.theme-switch::before {
    content: "☀️";
}

[data-theme="dark"] .theme-switch::before {
    content: "🌙";
}

p {
    margin-bottom: 1.5rem;
    line-height: 1.7;
    text-align: justify;
    hyphens: auto;
}

/* 목록 스타일 */
ul, ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
    line-height: 1.7;
}

li {
    margin-bottom: 0.25rem;
}

/* 최상위 목록 아이템만 더 큰 간격 */
article > ul > li,
article > ol > li {
    margin-bottom: 0.5rem;
}

/* 인용구 스타일 */
blockquote {
    margin: 2rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--border-color);
    background: var(--article-bg);
    font-style: italic;
    line-height: 1.6;
}

blockquote p {
    margin-bottom: 0.5rem;
}

blockquote p:last-child {
    margin-bottom: 0;
}

/* 코드 블록 스타일 */
pre {
    background: var(--article-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
}

code {
    background: var(--article-bg);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9em;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

/* Pygments 코드 하이라이팅 스타일 */
.highlight {
    background: var(--article-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.highlight pre {
    background: none;
    border: none;
    margin: 0;
    padding: 1rem;
}

/* 라이트 테마 하이라이팅 */
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #000000; font-weight: bold } /* Keyword */
.highlight .o { color: #000000; font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold; font-style: italic } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #000000; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #000000; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #000000; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #000000; font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { color: #000000; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d01040 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .nd { color: #3c5d5d; font-weight: bold } /* Name.Decorator */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nl { color: #990000; font-weight: bold } /* Name.Label */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { color: #000000; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d01040 } /* Literal.String.Backtick */
.highlight .sc { color: #d01040 } /* Literal.String.Char */
.highlight .sd { color: #d01040 } /* Literal.String.Doc */
.highlight .s2 { color: #d01040 } /* Literal.String.Double */
.highlight .se { color: #d01040 } /* Literal.String.Escape */
.highlight .sh { color: #d01040 } /* Literal.String.Heredoc */
.highlight .si { color: #d01040 } /* Literal.String.Interpol */
.highlight .sx { color: #d01040 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d01040 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */

/* 다크 테마 코드 하이라이팅 - 부드러운 색상 */
[data-theme="dark"] .highlight .hll { background-color: #2d3748 }
[data-theme="dark"] .highlight .c { color: #718096; font-style: italic } /* Comment */
[data-theme="dark"] .highlight .err { color: #e53e3e; background-color: #742a2a } /* Error */
[data-theme="dark"] .highlight .k { color: #63b3ed; font-weight: bold } /* Keyword */
[data-theme="dark"] .highlight .o { color: #63b3ed; font-weight: bold } /* Operator */
[data-theme="dark"] .highlight .cm { color: #718096; font-style: italic } /* Comment.Multiline */
[data-theme="dark"] .highlight .cp { color: #718096; font-weight: bold; font-style: italic } /* Comment.Preproc */
[data-theme="dark"] .highlight .c1 { color: #718096; font-style: italic } /* Comment.Single */
[data-theme="dark"] .highlight .cs { color: #718096; font-weight: bold; font-style: italic } /* Comment.Special */
[data-theme="dark"] .highlight .gd { color: #e2e8f0; background-color: #742a2a } /* Generic.Deleted */
[data-theme="dark"] .highlight .ge { color: #e2e8f0; font-style: italic } /* Generic.Emph */
[data-theme="dark"] .highlight .gr { color: #fc8181 } /* Generic.Error */
[data-theme="dark"] .highlight .gh { color: #718096 } /* Generic.Heading */
[data-theme="dark"] .highlight .gi { color: #e2e8f0; background-color: #2a742a } /* Generic.Inserted */
[data-theme="dark"] .highlight .go { color: #4a5568 } /* Generic.Output */
[data-theme="dark"] .highlight .gp { color: #718096 } /* Generic.Prompt */
[data-theme="dark"] .highlight .gs { font-weight: bold } /* Generic.Strong */
[data-theme="dark"] .highlight .gu { color: #718096 } /* Generic.Subheading */
[data-theme="dark"] .highlight .gt { color: #fc8181 } /* Generic.Traceback */
[data-theme="dark"] .highlight .kc { color: #63b3ed; font-weight: bold } /* Keyword.Constant */
[data-theme="dark"] .highlight .kd { color: #63b3ed; font-weight: bold } /* Keyword.Declaration */
[data-theme="dark"] .highlight .kn { color: #63b3ed; font-weight: bold } /* Keyword.Namespace */
[data-theme="dark"] .highlight .kp { color: #63b3ed; font-weight: bold } /* Keyword.Pseudo */
[data-theme="dark"] .highlight .kr { color: #63b3ed; font-weight: bold } /* Keyword.Reserved */
[data-theme="dark"] .highlight .kt { color: #4fd1c7; font-weight: bold } /* Keyword.Type */
[data-theme="dark"] .highlight .m { color: #f6ad55 } /* Literal.Number */
[data-theme="dark"] .highlight .s { color: #f687b3 } /* Literal.String */
[data-theme="dark"] .highlight .na { color: #4fd1c7 } /* Name.Attribute */
[data-theme="dark"] .highlight .nb { color: #63b3ed } /* Name.Builtin */
[data-theme="dark"] .highlight .nc { color: #4fd1c7; font-weight: bold } /* Name.Class */
[data-theme="dark"] .highlight .no { color: #4fd1c7 } /* Name.Constant */
[data-theme="dark"] .highlight .nd { color: #63b3ed; font-weight: bold } /* Name.Decorator */
[data-theme="dark"] .highlight .ni { color: #d69e2e } /* Name.Entity */
[data-theme="dark"] .highlight .ne { color: #fc8181; font-weight: bold } /* Name.Exception */
[data-theme="dark"] .highlight .nf { color: #fc8181; font-weight: bold } /* Name.Function */
[data-theme="dark"] .highlight .nl { color: #fc8181; font-weight: bold } /* Name.Label */
[data-theme="dark"] .highlight .nn { color: #718096 } /* Name.Namespace */
[data-theme="dark"] .highlight .nt { color: #63b3ed } /* Name.Tag */
[data-theme="dark"] .highlight .nv { color: #4fd1c7 } /* Name.Variable */
[data-theme="dark"] .highlight .ow { color: #63b3ed; font-weight: bold } /* Operator.Word */
[data-theme="dark"] .highlight .w { color: #2d3748 } /* Text.Whitespace */
[data-theme="dark"] .highlight .mf { color: #f6ad55 } /* Literal.Number.Float */
[data-theme="dark"] .highlight .mh { color: #f6ad55 } /* Literal.Number.Hex */
[data-theme="dark"] .highlight .mi { color: #f6ad55 } /* Literal.Number.Integer */
[data-theme="dark"] .highlight .mo { color: #f6ad55 } /* Literal.Number.Oct */
[data-theme="dark"] .highlight .sb { color: #f687b3 } /* Literal.String.Backtick */
[data-theme="dark"] .highlight .sc { color: #f687b3 } /* Literal.String.Char */
[data-theme="dark"] .highlight .sd { color: #f687b3 } /* Literal.String.Doc */
[data-theme="dark"] .highlight .s2 { color: #f687b3 } /* Literal.String.Double */
[data-theme="dark"] .highlight .se { color: #f687b3 } /* Literal.String.Escape */
[data-theme="dark"] .highlight .sh { color: #f687b3 } /* Literal.String.Heredoc */
[data-theme="dark"] .highlight .si { color: #f687b3 } /* Literal.String.Interpol */
[data-theme="dark"] .highlight .sx { color: #f687b3 } /* Literal.String.Other */
[data-theme="dark"] .highlight .sr { color: #68d391 } /* Literal.String.Regex */
[data-theme="dark"] .highlight .s1 { color: #f687b3 } /* Literal.String.Single */
[data-theme="dark"] .highlight .ss { color: #d69e2e } /* Literal.String.Symbol */
[data-theme="dark"] .highlight .bp { color: #718096 } /* Name.Builtin.Pseudo */
[data-theme="dark"] .highlight .vc { color: #4fd1c7 } /* Name.Variable.Class */
[data-theme="dark"] .highlight .vg { color: #4fd1c7 } /* Name.Variable.Global */
[data-theme="dark"] .highlight .vi { color: #4fd1c7 } /* Name.Variable.Instance */
[data-theme="dark"] .highlight .il { color: #f6ad55 } /* Literal.Number.Integer.Long */


/* 테이블 스타일 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 14px;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--article-bg);
    font-weight: 600;
}

tr:hover {
    background: var(--article-hover-bg);
}

/* 체크박스 스타일 */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    accent-color: var(--link-color);
}

/* 할 일 목록 스타일 */
.task-list-item {
    list-style: none;
    position: relative;
    padding-left: 0;
    margin-left: -1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.task-list-item input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.task-list-item.task-list-item-checked span {
    text-decoration: line-through;
    opacity: 0.7;
}

/* 하이라이트 텍스트 스타일 */
mark {
    background-color: #ffeb3b;
    color: #000;
    padding: 2px 4px;
    border-radius: 3px;
}

[data-theme="dark"] mark {
    background-color: #ffd54f;
    color: #000;
}

/* 중체된 목록 간격 조정 */
ul ul,
ol ol,
ul ol,
ol ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* 정의 목록 스타일 */
dl {
    margin: 1.5rem 0;
}

dt {
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
}

dd {
    margin-left: 2rem;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    border-left: 3px solid var(--border-color);
}

/* 코드 블록 컴테이너 및 복사 버튼 */
.code-container {
    position: relative;
}

.copy-button {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--article-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 0 6px 0 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0.8;
    margin: 0;
}

.copy-button:hover {
    background: var(--article-hover-bg);
    border-color: var(--border-hover-color);
    opacity: 1;
}

.copy-button.copied {
    background: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

.code-container pre {
    margin: 0;
    position: relative;
    border-radius: 6px;
    overflow: hidden;
}

/* 각주 스타일 */
.footnote {
    margin-bottom: 0.5rem;
    font-size: 0.9em;
    line-height: 1.4;
}

.footnote p {
    margin-bottom: 0.5rem;
}

.footnote-backref {
    margin-left: 0.5rem;
    text-decoration: none;
    color: var(--link-color);
}

.footnote-ref {
    text-decoration: none;
    color: var(--link-color);
    font-size: 0.8em;
    vertical-align: super;
}

/* 각주 구분선 */
hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

figure {
    margin: 2rem 0;
    text-align: center;
}

figure img {
    max-width: 100%;
    height: auto;
    max-height: 600px;
    min-height: 300px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 링크 스타일 */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

a:visited {
    color: var(--link-visited-color);
}

/* 내비게이션과 헤더 링크는 기본 색상 유지 */
nav a,
h1 a,
header a {
    color: inherit;
}

nav a:visited,
h1 a:visited,
header a:visited {
    color: inherit;
}

/* 푸터 링크도 예외 */
footer a {
    color: var(--link-color);
}

footer a:visited {
    color: var(--link-visited-color);
}

footer {
    text-align: left;
    color: var(--footer-color);
    font-size: 16px;
    border-top: none;
    padding-top: 0;
    margin-top: 4rem;
}

@media (max-width: 600px) {
    body {
        padding: 2rem 1rem;
        font-size: 17px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    nav ul {
        flex-direction: column;
        gap: 1rem;
    }
    
    article h2 {
        font-size: 1.4rem;
    }
    
    .theme-switch {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* === Mermaid 다이어그램 스타일 === */
.mermaid {
    margin: 2rem 0;
    text-align: center;
    background: var(--article-bg);
    border-radius: 6px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.mermaid svg {
    transition: all 0.3s ease;
}

.mermaid.loading {
    opacity: 0.7;
    pointer-events: none;
}

.mermaid-converted {
    position: relative;
}

/* 다크 테마 Mermaid 스타일 */
[data-theme="dark"] .mermaid {
    background: var(--article-bg);
    border-color: var(--border-color);
}

[data-theme="dark"] .mermaid svg {
    background: var(--article-bg) !important;
}

[data-theme="dark"] .mermaid .label,
[data-theme="dark"] .mermaid .messageText,
[data-theme="dark"] .mermaid .titleText {
    color: var(--text-color) !important;
    fill: var(--text-color) !important;
    stroke: var(--text-color) !important;
}

[data-theme="dark"] .mermaid .node rect,
[data-theme="dark"] .mermaid .node circle,
[data-theme="dark"] .mermaid .node ellipse,
[data-theme="dark"] .mermaid .node polygon {
    fill: var(--article-bg) !important;
    stroke: var(--border-color) !important;
}

[data-theme="dark"] .mermaid .edgePath .path,
[data-theme="dark"] .mermaid .arrowheadPath {
    stroke: var(--border-color) !important;
    fill: var(--border-color) !important;
}

/* Gantt 차트 텍스트 가독성 개선 */
.mermaid .taskText,
.mermaid .taskTextOutsideLeft,
.mermaid .taskTextOutsideRight {
    font-weight: bold !important;
    font-size: 12px !important;
}

[data-theme="dark"] .mermaid .taskText {
    fill: #000000 !important;
}

[data-theme="dark"] .mermaid .taskTextOutsideLeft,
[data-theme="dark"] .mermaid .taskTextOutsideRight {
    fill: #ffffff !important;
}

[data-theme="light"] .mermaid .taskText {
    fill: #ffffff !important;
}

[data-theme="light"] .mermaid .taskTextOutsideLeft,
[data-theme="light"] .mermaid .taskTextOutsideRight {
    fill: #000000 !important;
} 