/*
Theme Name: GeneratePress WikiDocs Child
Theme URI: https://generatepress.com/
Description: WikiDocs style documentation child theme for GeneratePress
Author: BroezDev
Template: generatepress
Version: 1.0.0
Text Domain: gp-wikidocs
*/


/* =========================================================
   1. 기본 변수
   ========================================================= */

:root {
    --wd-sidebar-width: 280px;
    --wd-content-max: 900px;

    --wd-bg: #ffffff;
    --wd-sidebar-bg: #f8f9fa;

    --wd-text: #333333;
    --wd-text-light: #6b7280;

    --wd-border: #e5e7eb;
    --wd-hover: #eef1f4;
    --wd-active: #e4e9ee;

    --wd-link: #337ab7;
    --wd-code-bg: #f6f8fa;

    --wd-radius: 6px;
}


/* =========================================================
   2. 사이트 전체
   ========================================================= */

html {
    scroll-behavior: smooth;
}

body {
    background: var(--wd-bg);
    color: var(--wd-text);
    font-size: 16px;
    line-height: 1.75;
}

.site.grid-container {
    max-width: 1280px;
}

.site-content {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}


/* =========================================================
   3. 헤더
   ========================================================= */

.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--wd-border);
}

.inside-header {
    padding-top: 12px;
    padding-bottom: 12px;
}

.site-branding .main-title {
    font-size: 20px;
    line-height: 1.4;
    font-weight: 700;
}

.site-branding .site-description {
    font-size: 13px;
    color: var(--wd-text-light);
}


/* =========================================================
   4. 메인 콘텐츠
   ========================================================= */

body.wd-book-page #primary {
    background: #ffffff;
}

body.wd-book-page .inside-article {
    max-width: var(--wd-content-max);
    padding: 42px 48px 60px;
    margin-left: auto;
    margin-right: auto;
}

body.wd-book-page .entry-content {
    margin-top: 25px;
}


/* =========================================================
   5. 제목
   ========================================================= */

body.wd-book-page .entry-title {
    font-size: 32px;
    line-height: 1.35;
    font-weight: 700;

    margin-top: 0;
    margin-bottom: 28px;

    letter-spacing: -0.02em;
}


/* =========================================================
   6. 본문 Typography
   ========================================================= */

body.wd-book-page .entry-content {
    font-size: 16px;
    line-height: 1.8;
}

body.wd-book-page .entry-content p {
    margin-bottom: 20px;
}

body.wd-book-page .entry-content h2 {
    font-size: 25px;
    line-height: 1.4;
    font-weight: 700;

    margin-top: 52px;
    margin-bottom: 20px;

    padding-bottom: 9px;

    border-bottom: 1px solid var(--wd-border);
}

body.wd-book-page .entry-content h3 {
    font-size: 21px;
    line-height: 1.45;

    margin-top: 40px;
    margin-bottom: 16px;
}

body.wd-book-page .entry-content h4 {
    font-size: 18px;

    margin-top: 32px;
    margin-bottom: 14px;
}


/* =========================================================
   7. 링크
   ========================================================= */

body.wd-book-page .entry-content a {
    color: var(--wd-link);
    text-decoration: none;
}

body.wd-book-page .entry-content a:hover {
    text-decoration: underline;
}


/* =========================================================
   8. 목록
   ========================================================= */

body.wd-book-page .entry-content ul,
body.wd-book-page .entry-content ol {
    margin-bottom: 24px;
}

body.wd-book-page .entry-content li {
    margin-bottom: 7px;
}


/* =========================================================
   9. 코드
   ========================================================= */

body.wd-book-page .entry-content pre {
    margin: 26px 0;

    padding: 18px 20px;

    overflow-x: auto;

    background: var(--wd-code-bg);

    border: 1px solid #e1e4e8;
    border-radius: var(--wd-radius);

    font-family:
        Consolas,
        Monaco,
        "Courier New",
        monospace;

    font-size: 14px;
    line-height: 1.65;
}

body.wd-book-page .entry-content pre code {
    background: transparent;
    padding: 0;
}

body.wd-book-page .entry-content p code,
body.wd-book-page .entry-content li code,
body.wd-book-page .entry-content td code {
    background: #f1f3f5;

    padding: 2px 6px;

    border-radius: 4px;

    font-family:
        Consolas,
        Monaco,
        "Courier New",
        monospace;

    font-size: 0.9em;
}


/* =========================================================
   10. 인용문
   ========================================================= */

body.wd-book-page .entry-content blockquote {
    margin: 26px 0;

    padding: 16px 20px;

    background: #f8f9fa;

    border-left: 4px solid #6c757d;

    color: #444;
}

body.wd-book-page .entry-content blockquote p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   11. 표
   ========================================================= */

body.wd-book-page .entry-content table {
    width: 100%;

    margin: 28px 0;

    border-collapse: collapse;

    font-size: 15px;
}

body.wd-book-page .entry-content th,
body.wd-book-page .entry-content td {
    padding: 10px 13px;

    border: 1px solid #dfe2e5;

    text-align: left;
    vertical-align: top;
}

body.wd-book-page .entry-content th {
    background: #f6f8fa;
    font-weight: 600;
}

body.wd-book-page .entry-content tbody tr:nth-child(even) {
    background: #fafafa;
}


/* =========================================================
   12. 이미지
   ========================================================= */

body.wd-book-page .entry-content img {
    max-width: 100%;
    height: auto;

    border-radius: 4px;
}

body.wd-book-page .entry-content figure {
    margin-top: 30px;
    margin-bottom: 30px;
}

body.wd-book-page .entry-content figcaption {
    margin-top: 8px;

    color: var(--wd-text-light);

    font-size: 13px;
    text-align: center;
}


/* =========================================================
   13. 좌측 WikiDocs 사이드바
   ========================================================= */

@media (min-width: 769px) {

    body.wd-book-page #left-sidebar {
        width: var(--wd-sidebar-width);

        background: var(--wd-sidebar-bg);

        border-right: 1px solid var(--wd-border);
    }

    body.wd-book-page #primary {
        width: calc(100% - var(--wd-sidebar-width));
    }

    body.wd-book-page #left-sidebar .inside-left-sidebar {
        padding: 0;
        margin: 0;
    }

}


/* =========================================================
   14. WikiDocs TOC
   ========================================================= */

.wd-toc {
    font-size: 14px;
    line-height: 1.45;
}

.wd-toc-desktop {
    position: sticky;

    top: 20px;

    max-height: calc(100vh - 40px);

    overflow-y: auto;
    overscroll-behavior: contain;

    padding: 22px 14px 30px;
}


/* 책 제목 */

.wd-book-title {
    margin-bottom: 18px;
    padding: 0 8px 14px;

    border-bottom: 1px solid var(--wd-border);
}

.wd-book-title a {
    display: block;

    color: #222;

    font-size: 16px;
    line-height: 1.4;
    font-weight: 700;

    text-decoration: none;
}

.wd-book-title a:hover {
    color: var(--wd-link);
}


/* =========================================================
   15. 목차 리스트
   ========================================================= */

.wd-tree,
.wd-tree ul {
    list-style: none;

    margin: 0;
    padding: 0;
}

.wd-tree ul {
    padding-left: 15px;
}

.wd-tree-item {
    position: relative;

    margin: 1px 0;
}


/* 행 */

.wd-tree-row {
    position: relative;

    display: flex;
    align-items: flex-start;

    min-width: 0;
}


/* 링크 */

.wd-tree-link {
    flex: 1;

    display: block;

    min-width: 0;

    padding: 6px 8px;

    color: #444;

    border-radius: 5px;

    text-decoration: none;

    word-break: keep-all;
    overflow-wrap: anywhere;
}

.wd-tree-link:hover {
    background: var(--wd-hover);

    color: #111;

    text-decoration: none;
}


/* 현재 페이지 */

.wd-tree-item.is-current > .wd-tree-row > .wd-tree-link {
    background: var(--wd-active);

    color: #111;

    font-weight: 700;
}


/* 현재 페이지 조상 */

.wd-tree-item.is-current-ancestor > .wd-tree-row > .wd-tree-link {
    color: #111;

    font-weight: 600;
}


/* =========================================================
   16. 접기 버튼
   ========================================================= */

.wd-tree-toggle {
    flex: 0 0 24px;

    width: 24px;
    height: 31px;

    padding: 0;

    border: 0;

    background: transparent;

    color: #777;

    cursor: pointer;

    font-size: 11px;
    line-height: 31px;

    text-align: center;
}

.wd-tree-toggle:hover {
    color: #111;
}

.wd-tree-toggle::before {
    content: "▶";
}

.wd-tree-item.is-open > .wd-tree-row .wd-tree-toggle::before {
    content: "▼";
}


/* 하위 메뉴 기본 닫힘 */

.wd-tree-item.has-children > .wd-tree-children {
    display: none;
}


/* 열린 메뉴 */

.wd-tree-item.has-children.is-open > .wd-tree-children {
    display: block;
}


/* 하위 페이지 없는 항목 정렬용 공간 */

.wd-tree-spacer {
    flex: 0 0 24px;

    width: 24px;
}


/* =========================================================
   17. 사이드바 스크롤바
   ========================================================= */

.wd-toc-desktop {
    scrollbar-width: thin;
    scrollbar-color: #c7cbd1 transparent;
}

.wd-toc-desktop::-webkit-scrollbar {
    width: 6px;
}

.wd-toc-desktop::-webkit-scrollbar-track {
    background: transparent;
}

.wd-toc-desktop::-webkit-scrollbar-thumb {
    background: #c7cbd1;

    border-radius: 10px;
}


/* =========================================================
   18. 이전 / 다음
   ========================================================= */

.wd-page-navigation {
    display: grid;

    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);

    gap: 18px;

    margin-top: 65px;
    padding-top: 28px;

    border-top: 1px solid var(--wd-border);
}

.wd-page-nav-item {
    min-width: 0;
}

.wd-page-nav-item.next {
    text-align: right;
}

.wd-page-nav-label {
    display: block;

    margin-bottom: 5px;

    color: var(--wd-text-light);

    font-size: 12px;
}

.wd-page-nav-link {
    display: block;

    padding: 12px 14px;

    color: #333;

    border: 1px solid var(--wd-border);
    border-radius: 6px;

    text-decoration: none;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.wd-page-nav-link:hover {
    background: #f8f9fa;

    border-color: #cfd4da;

    color: #111;

    text-decoration: none;
}

.wd-page-nav-title {
    display: block;

    font-size: 14px;
    font-weight: 600;

    overflow-wrap: anywhere;
}


/* 한쪽만 존재할 경우 */

.wd-page-nav-item.next:only-child {
    grid-column: 2;
}


/* =========================================================
   19. 모바일 목차 버튼
   ========================================================= */

.wd-mobile-toc-button {
    display: none;
}


/* =========================================================
   20. 모바일 Drawer 배경
   ========================================================= */

.wd-mobile-overlay {
    display: none;
}


/* =========================================================
   21. 모바일
   ========================================================= */

@media (max-width: 768px) {

    body.wd-book-page {
        overflow-x: hidden;
    }

    body.wd-book-page #left-sidebar {
        display: none;
    }

    body.wd-book-page #primary {
        width: 100%;
    }

    body.wd-book-page .inside-article {
        max-width: none;

        padding: 26px 20px 45px;
    }

    body.wd-book-page .entry-title {
        font-size: 27px;
    }

    body.wd-book-page .entry-content h2 {
        margin-top: 42px;

        font-size: 22px;
    }

    body.wd-book-page .entry-content h3 {
        font-size: 19px;
    }


    /* 목차 버튼 */

    .wd-mobile-toc-button {
        display: inline-flex;
        align-items: center;

        gap: 7px;

        margin-bottom: 22px;

        padding: 8px 13px;

        background: #ffffff;

        color: #333;

        border: 1px solid #d6d9dd;
        border-radius: 5px;

        cursor: pointer;

        font-size: 14px;
        font-weight: 600;
    }

    .wd-mobile-toc-button:hover {
        background: #f7f7f7;
    }


    /* Overlay */

    .wd-mobile-overlay {
        position: fixed;

        z-index: 99998;

        inset: 0;

        display: block;

        visibility: hidden;
        opacity: 0;

        background: rgba(0, 0, 0, 0.45);

        transition:
            opacity 0.2s ease,
            visibility 0.2s ease;
    }


    /* Drawer */

    .wd-mobile-drawer {
        position: fixed;

        z-index: 99999;

        top: 0;
        bottom: 0;
        left: 0;

        width: min(86vw, 340px);

        overflow-y: auto;

        padding: 20px 14px 35px;

        background: #ffffff;

        transform: translateX(-100%);

        transition: transform 0.22s ease;

        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
    }


    body.wd-toc-open .wd-mobile-overlay {
        visibility: visible;
        opacity: 1;
    }

    body.wd-toc-open .wd-mobile-drawer {
        transform: translateX(0);
    }

    body.wd-toc-open {
        overflow: hidden;
    }


    /* 모바일 Header */

    .wd-mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;

        gap: 10px;

        margin-bottom: 16px;
        padding-bottom: 12px;

        border-bottom: 1px solid var(--wd-border);
    }

    .wd-mobile-drawer-title {
        font-size: 16px;
        font-weight: 700;
    }

    .wd-mobile-close {
        width: 36px;
        height: 36px;

        padding: 0;

        background: transparent;

        border: 0;

        cursor: pointer;

        font-size: 25px;
        line-height: 36px;
    }


    /* Previous / Next */

    .wd-page-navigation {
        grid-template-columns: 1fr;

        gap: 10px;

        margin-top: 48px;
    }

    .wd-page-nav-item.next {
        text-align: left;
    }

    .wd-page-nav-item.next:only-child {
        grid-column: auto;
    }

}


/* =========================================================
   22. 접근성
   ========================================================= */

.wd-tree-toggle:focus-visible,
.wd-mobile-close:focus-visible,
.wd-mobile-toc-button:focus-visible,
.wd-tree-link:focus-visible,
.wd-page-nav-link:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}


/* =========================================================
   23. 프린트
   ========================================================= */

@media print {

    #left-sidebar,
    .wd-mobile-toc-button,
    .wd-mobile-drawer,
    .wd-mobile-overlay,
    .wd-page-navigation {
        display: none !important;
    }

    body.wd-book-page #primary {
        width: 100%;
    }

    body.wd-book-page .inside-article {
        max-width: none;

        padding: 0;
    }

}