/* Original CSS from maxdesalle.com - 완벽히 동일한 스타일 */
*,*:before,*:after{box-sizing:border-box}

/* 다크모드 CSS 변수 */
:root {
    --bg-color: #ffffff;
    --text-color: #313a3d;
    --text-secondary: #394548;
    --text-muted: #767676;
    --border-color: #d8d8d8;
    --code-bg: #f1f3f5;
    --code-border: #e9ecef;
    --code-text: #e83e8c;
    --blockquote-border: #2d2d2d;
    --box-content-bg: #fff;
    --sidebar-bg: transparent;
    --sidebar-border: #eee;
    --sidebar-hover-bg: #f8f9fa;
    --scrollbar-thumb: #ddd;
    --scrollbar-thumb-hover: #bbb;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #c0c0c0;
    --text-muted: #999;
    --border-color: #404040;
    --code-bg: #2d2d2d;
    --code-border: #404040;
    --code-text: #ff79c6;
    --blockquote-border: #888;
    --box-content-bg: #252525;
    --sidebar-bg: transparent;
    --sidebar-border: #404040;
    --sidebar-hover-bg: #2d2d2d;
    --scrollbar-thumb: #555;
    --scrollbar-thumb-hover: #777;
}

/* 박스 공통 스타일 */
.box {
    overflow: hidden;
    padding: 0;
    margin: 1.5em 0;
    border-radius: 8px;
    border-left: 4px solid;
    color: #333a3d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.box-title {
    font-weight: 600;
    font-size: 0.85em;
    padding: 10px 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.box-content {
    padding: 12px 16px 16px;
    background: var(--box-content-bg);
}
.box-content p:first-child { margin-top: 0; }
.box-content p:last-child { margin-bottom: 0; }
.box pre {
    background: #1e1e1e !important;
    border-radius: 6px;
    margin: 12px 0;
    width: 100%;
    box-sizing: border-box;
}

/* 예시 박스 - 녹색 */
.box-example {
    background: #f0fdf4;
    border-left-color: #22c55e;
}
[data-theme="dark"] .box-example {
    background: rgba(34, 197, 94, 0.1);
}
.box-example .box-title {
    background: rgba(34, 197, 94, 0.15);
    color: #166534;
}
[data-theme="dark"] .box-example .box-title {
    color: #86efac;
}

/* 정보 박스 - 파란색 */
.box-info {
    background: #eff6ff;
    border-left-color: #3b82f6;
}
[data-theme="dark"] .box-info {
    background: rgba(59, 130, 246, 0.1);
}
.box-info .box-title {
    background: rgba(59, 130, 246, 0.15);
    color: #1e40af;
}
[data-theme="dark"] .box-info .box-title {
    color: #93c5fd;
}

/* 참고 박스 - 회색 */
.box-note {
    background: #f8f9fa;
    border-left-color: #6c757d;
}
[data-theme="dark"] .box-note {
    background: rgba(108, 117, 125, 0.1);
}
.box-note .box-title {
    background: rgba(108, 117, 125, 0.15);
    color: #495057;
}
[data-theme="dark"] .box-note .box-title {
    color: #cbd5e1;
}

/* 팁 박스 - 보라색 */
.box-tip {
    background: #faf5ff;
    border-left-color: #a855f7;
}
[data-theme="dark"] .box-tip {
    background: rgba(168, 85, 247, 0.1);
}
.box-tip .box-title {
    background: rgba(168, 85, 247, 0.15);
    color: #7e22ce;
}
[data-theme="dark"] .box-tip .box-title {
    color: #c084fc;
}

/* 경고 박스 - 노란색 */
.box-warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
}
[data-theme="dark"] .box-warning {
    background: rgba(245, 158, 11, 0.1);
}
.box-warning .box-title {
    background: rgba(245, 158, 11, 0.15);
    color: #b45309;
}
[data-theme="dark"] .box-warning .box-title {
    color: #fcd34d;
}

/* 에러 박스 - 빨간색 */
.box-error {
    background: #fef2f2;
    border-left-color: #ef4444;
}
[data-theme="dark"] .box-error {
    background: rgba(239, 68, 68, 0.1);
}
.box-error .box-title {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}
[data-theme="dark"] .box-error .box-title {
    color: #fca5a5;
}

#TableOfContents a strong{font-weight:400!important}

html{font-size:62.5%}

body{
    font-size:16px;
    font-size:1.6rem;
    font-family:-apple-system,BlinkMacSystemFont,segoe ui,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol;
    color:var(--text-color);
    background-color:var(--bg-color);
    width:100%;
    margin:0 auto;
    padding:0 16px;
    line-height:1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

header#banner{margin-top:25px;margin-bottom:-20px;position:relative;width:100%;max-width:650px;margin-left:auto;margin-right:auto;padding:0 16px;box-sizing:border-box}
header#banner a{color:var(--text-color);text-decoration:none}
header#banner a:hover{text-decoration:underline}
header#banner h2{display:inline;font-size:21px;font-size:2.1rem;margin:0 8px 0 0}
header#banner nav{display:inline-block}
header#banner nav ul{list-style-type:none;font-size:1.05em;text-transform:lowercase;margin:0;padding:0}
header#banner nav ul li{display:inline;margin:0 3px}
header#banner nav ul li a{color:var(--text-secondary)}

/* 다크모드 토글 버튼 */
#dark-mode-toggle {
    position: absolute;
    top: 0;
    right: 16px;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#dark-mode-toggle:hover {
    background: var(--sidebar-hover-bg);
    transform: scale(1.1);
}

[data-theme="dark"] #dark-mode-toggle {
    background: var(--code-bg);
    border-color: var(--code-border);
}

main#content a{color:var(--text-color);text-decoration:none}
main#content a:hover{text-decoration:underline}
main#content h1,main#content h2,main#content h3,main#content h4,main#content h5,main#content h6{margin-bottom:0;line-height:1.15;color:var(--text-color)}
main#content h3{font-size:19px;font-size:1.9rem}
main#content h1+p,main#content h2+p,main#content h3+p,main#content h4+p,main#content h5+p,main#content h6+p{margin-top:5px}
main#content p{color:var(--text-secondary);margin:16px 0}
main#content hr{height:1px;border:0;background:var(--border-color)}
main#content abbr{cursor:help}

main#content ul#posts{list-style-type:none;font-size:16px;font-size:1.6rem;margin-top:0;padding:0}
main#content ul#posts li{margin:5px 0;padding:0;font-size:1.6rem}
main#content ul#posts small{font-size:.8em;color:var(--text-muted);margin-left:10px}
main#content ul#posts li a{text-decoration:none;color:var(--text-color)}
main#content ul#posts li a:hover{color:var(--text-color);text-decoration:underline}
main#content ul#posts li a:hover small{color:inherit}

main#content header#post-header h1{display:block;font-size:23px;font-size:2.3rem;font-weight:600;line-height:1.15;color:var(--text-color)}
main#content header#post-header>div{display:block;font-size:.85em;color:var(--text-muted)}

main#content #toc{border:1px solid var(--border-color);border-radius:1px;line-height:26px;margin:16px 0;padding:9px 14px;background:var(--box-content-bg)}
main#content #toc h4{font-size:1.06em;color:var(--text-color);margin:0}
main#content #toc nav#TableOfContents{margin-top:4px}
main#content #toc nav#TableOfContents>ul,main#content #toc nav#TableOfContents>ol{margin-left:-40px}
main#content #toc ul,main#content #toc ol{font-size:.98em;margin:0;padding:0 0 0 40px}
main#content #toc ul{list-style-type:none}
main#content #toc ol{counter-reset:item}
main#content #toc ol li{display:block}
main#content #toc ol li:before{content:counters(item,".")" ";counter-increment:item}
main#content #toc a{color:var(--text-color)}

main#content img{max-width:100%;margin:0 auto}
main#content figure{margin:16px 0}
main#content figure img{display:block;max-width:100%;margin:0 auto}
main#content figure figcaption{font-size:.92em;font-style:italic;line-height:22px;text-align:center;margin-top:6px;padding:0 10px;color:var(--text-muted)}
main#content figure figcaption h4{font-style:normal;display:inline;margin:0}
main#content figure figcaption p{display:inline;margin:0;padding-left:8px}

main#content blockquote{margin-top:10px;margin-bottom:10px;margin-left:0;padding-left:15px;border-left:3px solid var(--blockquote-border);color:var(--text-secondary)}

/* 역주, 참고, 팁, 예시 등 노트 스타일 */
main#content blockquote.note {
    background: var(--box-content-bg);
    border-left: 4px solid #6c757d;
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

main#content blockquote.note strong {
    display: inline-block;
    color: #495057;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 2px 8px;
    background: rgba(108, 117, 125, 0.1);
    border-radius: 4px;
}

/* 역주 스타일 - 파란색 */
main#content blockquote.note strong:first-child:not(:only-child) {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

main#content blockquote.note:has(strong:first-child) {
    border-left-color: #0d6efd;
}

/* 코드 인라인 스타일 */
main#content code,main#content pre{font-family:'SF Mono', Menlo, Monaco, 'Courier New', monospace}
main#content code{
    font-size: 0.88em;
    padding: 2px 6px;
    background: var(--code-bg);
    border-radius: 4px;
    color: var(--code-text);
    border: 1px solid var(--code-border);
}

/* 코드 블록 스타일 */
main#content pre{
    display: block;
    overflow-x: auto;
    font-size: 13px;
    font-size: 1.3rem;
    white-space: pre;
    margin: 20px 0;
    padding: 1.2rem 1.5rem;
    line-height: 1.5;
    background: #282c34;
    color: #abb2bf;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
main#content pre code{
    padding: 0;
    background: none;
    border: none;
    color: inherit;
    font-size: inherit;
}

main#content section.footnotes{font-size:.9em}

/* Lists */
main#content ul,main#content ol{margin:16px 0;padding-left:40px}
main#content li{margin:8px 0;color:var(--text-secondary)}

.further-reading-section{margin-top:3em}
.further-reading-section hr{margin-bottom:1.5em}
.further-reading h4{font-weight:600;margin:0 0 .5em}
.further-reading ul{list-style:none;margin:0;padding:0}
.further-reading li{margin:.4em 0;color:var(--text-secondary)}
.further-reading li::before{content:"\2013\00a0\00a0";color:#767676}

footer#footer{font-size:14px;font-size:1.4rem;font-weight:400;color:var(--text-muted);margin:40px 0}

.headlinks{margin-left:.3rem}
.headseparator{margin-left:.5rem}

.download-links{margin-top:.6rem;font-size:.9em;color:var(--text-muted)}
.download-links a{margin-right:1rem;text-decoration:none;color:var(--text-secondary)}
.download-links a:hover{color:var(--text-color)}
.download-note{font-size:.8em;color:var(--text-muted)}

.tight-link{margin-right:-.15em}
.tight-close{margin-left:0}
.no-gap{display:inline-block;margin-left:-.8em}

/* 추가 설명 박스 스타일 - 원문에 없는 추가 설명용 */
.explanation-box {
    background: #f0f7ff;
    border-left: 4px solid #0066cc;
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 0 4px 4px 0;
    font-size: 0.95em;
}
[data-theme="dark"] .explanation-box {
    background: rgba(0, 102, 204, 0.1);
}
.explanation-box strong {
    color: #0066cc;
}
[data-theme="dark"] .explanation-box strong {
    color: #60a5fa;
}

@media(min-width:770px){
    body{width:650px;line-height:1.5}
    main#content hr{width:100%}
    header#banner {
        padding: 0;
    }
    header#banner h2{font-size:25px;font-size:2.5rem}
    main#content h3{font-size:20px;font-size:2rem}
    main#content ul#posts{font-size:18px;font-size:1.8rem}
    main#content header#post-header h1{font-size:24px;font-size:2.4rem}
    main#content img{max-width:100%}
    main#content figure{margin-left:0}
    main#content figure img{max-width:100%}
    main#content pre{width:100%;padding:1.2rem 1.5rem}
    main#content blockquote.note{width:100%}
    .box{width:100%}
    .headlinks{margin-left:1.5rem}
    .headseparator{margin-left:2.5rem}
    #dark-mode-toggle {
        right: 0;
    }
}

/* ========================================
   우측 고정 목차 (사이드바)
   ======================================== */
#sidebar-toc {
    display: none;
}

@media (min-width: 1100px) {
    #sidebar-toc {
        display: block;
        position: fixed;
        top: 100px;
        right: calc((100vw - 650px) / 2 - 280px);
        width: 220px;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
        padding: 16px 0;
        font-size: 13px;
        z-index: 100;
    }

    #sidebar-toc::-webkit-scrollbar {
        width: 4px;
    }

    #sidebar-toc::-webkit-scrollbar-track {
        background: transparent;
    }

    #sidebar-toc::-webkit-scrollbar-thumb {
        background: var(--scrollbar-thumb);
        border-radius: 2px;
    }

    #sidebar-toc::-webkit-scrollbar-thumb:hover {
        background: var(--scrollbar-thumb-hover);
    }

    #sidebar-toc h4 {
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: var(--text-muted);
        margin: 0 0 12px 0;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--sidebar-border);
    }

    #sidebar-toc nav ul {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    #sidebar-toc nav li {
        margin: 0;
        padding: 0;
    }

    #sidebar-toc nav a {
        display: block;
        padding: 8px 12px;
        color: var(--text-muted);
        text-decoration: none;
        border-left: 2px solid transparent;
        transition: all 0.2s ease;
        line-height: 1.4;
    }

    #sidebar-toc nav a:hover {
        color: var(--text-color);
        background: var(--sidebar-hover-bg);
        border-left-color: var(--sidebar-border);
    }

    #sidebar-toc nav a.active {
        color: #0d6efd;
        background: rgba(13, 110, 253, 0.05);
        border-left-color: #0d6efd;
        font-weight: 500;
    }
}

/* 더 넓은 화면에서 사이드바 위치 조정 */
@media (min-width: 1300px) {
    #sidebar-toc {
        right: calc((100vw - 650px) / 2 - 320px);
        width: 250px;
    }
}
