
/* =========================================================
   ThinkX Shared Site
   Trilium Content + Tree Navigation Theme
   Light / Dark
   ========================================================= */


/* =========================================================
   1. Theme Variables
   ========================================================= */

:root {
    --tx-text: #202124;
    --tx-text-secondary: #4b5563;
    --tx-muted: #6b7280;

    --tx-border: #e5e7eb;
    --tx-border-light: #eef0f2;

    --tx-bg: #ffffff;
    --tx-sub-bg: #f8fafc;
    --tx-code-bg: #f6f8fa;

    --tx-accent: #2563eb;
    --tx-accent-hover: #1d4ed8;

    --tx-radius: 8px;
}


/* =========================================================
   2. Content Base
   ========================================================= */

#content {
    box-sizing: border-box;

    max-width: 920px;
    margin: 0 auto;

    padding: 40px 32px 80px;

    background: var(--tx-bg);
    color: var(--tx-text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans KR",
        "Apple SD Gothic Neo",
        Arial,
        sans-serif;

    font-size: 15px;
    line-height: 1.75;

    word-break: keep-all;
    overflow-wrap: break-word;
}

#content *,
#content *::before,
#content *::after {
    box-sizing: border-box;
}


/* =========================================================
   3. Headings
   ========================================================= */

#content h1,
#content h2,
#content h3,
#content h4 {
    font-weight: 700;
    line-height: 1.4;

    color: var(--tx-text);

    margin-top: 2em;
    margin-bottom: 0.7em;
}

#content h1 {
    font-size: 32px;

    margin-top: 0;
    margin-bottom: 1em;

    letter-spacing: -0.025em;
}

#content h2 {
    font-size: 24px;

    padding-bottom: 0.35em;

    border-bottom: 1px solid var(--tx-border);

    letter-spacing: -0.02em;
}

#content h3 {
    font-size: 19px;

    letter-spacing: -0.015em;
}

#content h4 {
    font-size: 16px;
}


/* =========================================================
   4. Paragraph
   ========================================================= */

#content p {
    margin: 0 0 1.15em;

    color: var(--tx-text);

    line-height: 1.8;
}


/* =========================================================
   5. Strong / Emphasis
   ========================================================= */

#content strong,
#content b {
    color: #111827;
    font-weight: 700;
}

#content em,
#content i {
    color: var(--tx-text-secondary);
}


/* =========================================================
   6. Links
   ========================================================= */

#content a {
    color: var(--tx-accent);

    text-decoration: none;

    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}

#content a:hover {
    color: var(--tx-accent-hover);
    text-decoration: underline;
}


/* =========================================================
   7. Lists
   ========================================================= */

#content ul,
#content ol {
    margin-top: 0.5em;
    margin-bottom: 1.2em;

    padding-left: 1.8em;
}

#content li {
    margin: 0.25em 0;

    color: var(--tx-text);
}

#content li::marker {
    color: var(--tx-muted);
}

#content ul ul,
#content ol ol,
#content ul ol,
#content ol ul {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}


/* =========================================================
   8. Blockquote
   ========================================================= */

#content blockquote {
    margin: 1.5em 0;
    padding: 14px 18px;

    background: var(--tx-sub-bg);

    border-left: 4px solid var(--tx-accent);

    border-radius: 0 var(--tx-radius) var(--tx-radius) 0;

    color: var(--tx-text-secondary);
}

#content blockquote p {
    margin-bottom: 0;

    color: var(--tx-text-secondary);
}


/* =========================================================
   9. Inline Code
   ========================================================= */

#content code {
    padding: 0.15em 0.4em;

    background: var(--tx-code-bg);

    border: 1px solid var(--tx-border-light);

    border-radius: 5px;

    color: #374151;

    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        Menlo,
        monospace;

    font-size: 0.9em;
}


/* =========================================================
   10. Code Block
   ========================================================= */

#content pre {
    margin: 1.5em 0;
    padding: 18px 20px;

    background: #f8fafc;

    border: 1px solid var(--tx-border);

    border-radius: var(--tx-radius);

    overflow-x: auto;

    line-height: 1.65;

    white-space: pre;

    -webkit-overflow-scrolling: touch;
}

#content pre code {
    display: block;

    padding: 0;

    background: transparent;

    border: 0;
    border-radius: 0;

    color: #1f2937;

    font-size: 13px;

    line-height: 1.65;
}


/* =========================================================
   11. Tables
   ========================================================= */

/* CKEditor / Trilium table wrapper */
#content figure.table {
    display: block;

    width: 100%;
    max-width: 100%;

    margin: 1.5em 0;

    overflow-x: auto;
    overflow-y: hidden;

    -webkit-overflow-scrolling: touch;
}

#content figure.table table {
    width: max-content;
    min-width: 100%;

    margin: 0;

    border-collapse: collapse;

    font-size: 14px;

    color: var(--tx-text);
}

/* Fallback for tables without figure.table wrapper */
#content > table,
#content .ck-content > table {
    display: block;

    width: 100%;
    max-width: 100%;

    margin: 1.5em 0;

    overflow-x: auto;

    border-collapse: collapse;

    font-size: 14px;

    color: var(--tx-text);

    -webkit-overflow-scrolling: touch;
}

#content th {
    padding: 10px 12px;

    background: #f8fafc;

    border-bottom: 2px solid var(--tx-border);

    text-align: left;

    font-weight: 700;

    color: var(--tx-text);

    white-space: nowrap;
}

#content td {
    min-width: 120px;

    padding: 10px 12px;

    border-bottom: 1px solid var(--tx-border-light);

    color: var(--tx-text);

    vertical-align: top;

    white-space: normal;
    overflow-wrap: break-word;
    word-break: keep-all;
}

#content tr:hover td {
    background: #fafafa;
}


/* =========================================================
   12. Images
   ========================================================= */

#content img {
    display: block;

    max-width: 100%;
    height: auto;

    margin: 1.5em auto;

    border-radius: var(--tx-radius);
}


/* =========================================================
   13. Figure
   ========================================================= */

#content figure {
    margin: 1.8em 0;
}

#content figure img {
    margin-bottom: 0.5em;
}

#content figcaption {
    margin-top: 8px;

    text-align: center;

    color: var(--tx-muted);

    font-size: 13px;
    line-height: 1.5;
}


/* =========================================================
   14. Horizontal Rule
   ========================================================= */

#content hr {
    margin: 2.5em 0;

    border: 0;
    border-top: 1px solid var(--tx-border);
}


/* =========================================================
   15. Checkbox
   ========================================================= */

#content input[type="checkbox"] {
    margin-right: 6px;

    accent-color: var(--tx-accent);

    vertical-align: middle;
}


/* =========================================================
   16. CKEditor
   ========================================================= */

#content.ck-content {
    background: var(--tx-bg);
    color: var(--tx-text);
}

#content.ck-content p,
#content.ck-content li {
    color: var(--tx-text);
}

#content.ck-content h1,
#content.ck-content h2,
#content.ck-content h3,
#content.ck-content h4 {
    color: var(--tx-text);
}


/* =========================================================
   17. LEFT TREE — Base
   ========================================================= */

#menu {
    font-size: 13px !important;

    line-height: 1.45 !important;
}


/* Tree item */

#menu li {
    position: relative;

    display: flex;
    flex-direction: column;

    list-style: none;

    cursor: pointer;

    max-width: 350px;

    margin: 0 !important;
    padding: 0 !important;

    font-size: 13px !important;
    line-height: 1.45 !important;
}


/* Tree nested list */

#menu ul {
    margin: 0 !important;

    padding-top: 0 !important;
    padding-bottom: 0 !important;
}


/* Nested items */

#menu li > ul {
    margin: 0 !important;

    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

#menu li > ul > li {
    margin: 0 !important;
    padding: 0 !important;

    font-size: 13px !important;
    line-height: 1.45 !important;
}


/* Tree text */

#menu li > div,
#menu li > a,
#menu li span {
    font-size: 13px !important;
    line-height: 1.45 !important;
}


/* Hover */

#menu li:hover {
    background: rgba(37, 99, 235, 0.055);
}


/* Selected / Active */

#menu li.selected,
#menu li.active {
    background: rgba(37, 99, 235, 0.10);
}


/* =========================================================
   18. RIGHT TOC — Generic
   ========================================================= */

.toc {
    font-size: 13px !important;

    line-height: 1.45 !important;
}

.toc ul,
.toc ol {
    margin: 0 !important;

    padding-left: 12px !important;
}

.toc li {
    margin: 0 !important;
    padding: 2px 0 !important;

    font-size: 13px !important;

    line-height: 1.45 !important;
}

.toc a {
    font-size: 13px !important;

    line-height: 1.45 !important;

    color: inherit;

    text-decoration: none;
}

.toc a:hover {
    color: var(--tx-accent) !important;
}


/* =========================================================
   19. RIGHT TOC — Common Trilium Selectors
   ========================================================= */

#right-pane {
    font-size: 13px !important;

    line-height: 1.45 !important;
}

#right-pane ul,
#right-pane ol {
    margin: 0 !important;

    padding-left: 12px !important;
}

#right-pane li {
    margin: 0 !important;
    padding: 2px 0 !important;

    font-size: 13px !important;

    line-height: 1.45 !important;
}

#right-pane a {
    font-size: 13px !important;

    line-height: 1.45 !important;
}


/* =========================================================
   20. RIGHT TOC — Heading Text
   ========================================================= */

#right-pane h1,
#right-pane h2,
#right-pane h3,
#right-pane h4 {
    font-size: 13px !important;

    line-height: 1.45 !important;

    margin: 0 !important;
}

#right-pane .toc-title {
    font-size: 13px !important;

    line-height: 1.45 !important;
}


/* =========================================================
   21. DARK THEME — Content
   ========================================================= */

html.theme-dark #content {
    background: #121416 !important;

    color: #e5e7eb !important;
}

html.theme-dark #content.ck-content {
    background: #121416 !important;

    color: #e5e7eb !important;
}


/* =========================================================
   22. DARK — Headings
   ========================================================= */

html.theme-dark #content h1,
html.theme-dark #content h2,
html.theme-dark #content h3,
html.theme-dark #content h4 {
    color: #e5e7eb !important;
}

html.theme-dark #content h2 {
    border-bottom-color: #343942 !important;
}


/* =========================================================
   23. DARK — Paragraph / List
   ========================================================= */

html.theme-dark #content p,
html.theme-dark #content li {
    color: #e5e7eb !important;
}

html.theme-dark #content li::marker {
    color: #9ca3af !important;
}


/* =========================================================
   24. DARK — Strong / Emphasis
   ========================================================= */

html.theme-dark #content strong,
html.theme-dark #content b {
    color: #f3f4f6 !important;
}

html.theme-dark #content em,
html.theme-dark #content i {
    color: #b8bec8 !important;
}


/* =========================================================
   25. DARK — Links
   ========================================================= */

html.theme-dark #content a {
    color: #60a5fa !important;
}

html.theme-dark #content a:hover {
    color: #93c5fd !important;
}


/* =========================================================
   26. DARK — Blockquote
   ========================================================= */

html.theme-dark #content blockquote {
    background: #1b1f24 !important;

    border-left-color: #60a5fa !important;

    color: #b8bec8 !important;
}

html.theme-dark #content blockquote p {
    color: #b8bec8 !important;
}


/* =========================================================
   27. DARK — Inline Code
   ========================================================= */

html.theme-dark #content code {
    background: #1b1f24 !important;

    border-color: #343942 !important;

    color: #e6edf3 !important;
}


/* =========================================================
   28. DARK — Code Block
   ========================================================= */

html.theme-dark #content pre {
    background: #181b1f !important;

    border-color: #343942 !important;

    color: #e6edf3 !important;
}

html.theme-dark #content pre code {
    background: transparent !important;

    border: 0 !important;

    color: #e6edf3 !important;
}


/* =========================================================
   29. DARK — Table
   ========================================================= */

html.theme-dark #content table {
    color: #e5e7eb !important;

    border-color: #343942 !important;
}

html.theme-dark #content th {
    background: #1b1f24 !important;

    border-color: #343942 !important;

    color: #e5e7eb !important;
}

html.theme-dark #content td {
    background: transparent !important;

    border-color: #2a2f36 !important;

    color: #e5e7eb !important;
}

html.theme-dark #content tr:hover td {
    background: #1a1e23 !important;
}


/* =========================================================
   30. DARK — Images / Figure
   ========================================================= */

html.theme-dark #content img {
    background: #181b1f !important;
}

html.theme-dark #content figcaption {
    color: #8b929d !important;
}


/* =========================================================
   31. DARK — HR / Checkbox
   ========================================================= */

html.theme-dark #content hr {
    border-top-color: #343942 !important;
}

html.theme-dark #content input[type="checkbox"] {
    accent-color: #60a5fa;
}


/* =========================================================
   32. DARK — CKEditor
   ========================================================= */

html.theme-dark #content.ck-content p,
html.theme-dark #content.ck-content li {
    color: #e5e7eb !important;
}

html.theme-dark #content.ck-content h1,
html.theme-dark #content.ck-content h2,
html.theme-dark #content.ck-content h3,
html.theme-dark #content.ck-content h4 {
    color: #e5e7eb !important;
}

html.theme-dark #content.ck-content strong,
html.theme-dark #content.ck-content b {
    color: #f3f4f6 !important;
}

html.theme-dark #content.ck-content em,
html.theme-dark #content.ck-content i {
    color: #b8bec8 !important;
}


/* =========================================================
   33. DARK — Left Tree
   ========================================================= */

html.theme-dark #menu {
    color: #d7dce2 !important;
}

html.theme-dark #menu li {
    color: #d7dce2 !important;
}

html.theme-dark #menu li > div,
html.theme-dark #menu li > a,
html.theme-dark #menu li span {
    color: #d7dce2 !important;

    font-size: 13px !important;
}

html.theme-dark #menu li:hover {
    background: rgba(96, 165, 250, 0.08);
}

html.theme-dark #menu li.selected,
html.theme-dark #menu li.active {
    background: rgba(96, 165, 250, 0.12);
}


/* =========================================================
   34. DARK — Right TOC
   ========================================================= */

html.theme-dark .toc {
    color: #cbd1d9 !important;
}

html.theme-dark .toc a {
    color: #cbd1d9 !important;
}

html.theme-dark .toc a:hover {
    color: #60a5fa !important;
}

html.theme-dark #right-pane {
    color: #cbd1d9 !important;
}

html.theme-dark #right-pane a {
    color: #cbd1d9 !important;
}

html.theme-dark #right-pane a:hover {
    color: #60a5fa !important;
}


/* =========================================================
   35. Mobile — 768px
   ========================================================= */

@media (max-width: 768px) {

    #content {
        max-width: 100%;

        padding: 30px 22px 60px;

        font-size: 15px;
    }

    #content h1 {
        font-size: 28px;
    }

    #content h2 {
        font-size: 22px;
    }

    #content h3 {
        font-size: 18px;
    }

    #content pre {
        margin-left: -4px;
        margin-right: -4px;

        padding: 15px;
    }

    #menu {
        font-size: 12.5px !important;
    }

    #menu li,
    #menu li > div,
    #menu li > a,
    #menu li span {
        font-size: 12.5px !important;
    }

    .toc,
    .toc li,
    .toc a,
    #right-pane,
    #right-pane li,
    #right-pane a {
        font-size: 12.5px !important;
    }
}


/* =========================================================
   36. Mobile — 480px
   ========================================================= */

@media (max-width: 480px) {

    #content {
        padding: 24px 16px 50px;

        font-size: 14px;

        line-height: 1.75;
    }

    #content h1 {
        font-size: 25px;
    }

    #content h2 {
        font-size: 21px;
    }

    #content h3 {
        font-size: 17px;
    }

    #content h4 {
        font-size: 15px;
    }

    #content pre {
        padding: 13px;

        font-size: 12px;
    }

    #content pre code {
        font-size: 12px;
    }

    #content th,
    #content td {
        padding: 8px 10px;
    }

    #menu {
        font-size: 12px !important;
    }

    #menu li,
    #menu li > div,
    #menu li > a,
    #menu li span {
        font-size: 12px !important;
    }

    .toc,
    .toc li,
    .toc a,
    #right-pane,
    #right-pane li,
    #right-pane a {
        font-size: 12px !important;
    }
}


/* =========================================================
   END — ThinkX Theme
   ========================================================= */
/* =========================================================
   ThinkX — Markdown Heading
   Final Slightly Smaller
   ========================================================= */

#content h1,
#content.ck-content h1 {
    font-size: 34px !important;
    line-height: 1.3 !important;
    font-weight: 750 !important;

    margin-top: 0 !important;
    margin-bottom: 1.2em !important;

    letter-spacing: -0.03em !important;
}

#content h2,
#content.ck-content h2 {
    font-size: 26px !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;

    margin-top: 2.2em !important;
    margin-bottom: 0.8em !important;

    letter-spacing: -0.025em !important;
}

#content h3,
#content.ck-content h3 {
    font-size: 21px !important;
    line-height: 1.4 !important;
    font-weight: 700 !important;

    margin-top: 1.8em !important;
    margin-bottom: 0.65em !important;

    letter-spacing: -0.02em !important;
}

#content h4,
#content.ck-content h4 {
    font-size: 18px !important;
    line-height: 1.45 !important;
    font-weight: 700 !important;

    margin-top: 1.5em !important;
    margin-bottom: 0.55em !important;

    letter-spacing: -0.015em !important;
}


/* Dark Theme */

html.theme-dark #content h1,
html.theme-dark #content h2,
html.theme-dark #content h3,
html.theme-dark #content h4,
html.theme-dark #content.ck-content h1,
html.theme-dark #content.ck-content h2,
html.theme-dark #content.ck-content h3,
html.theme-dark #content.ck-content h4 {
    color: #e5e7eb !important;
}