/* =============================== 基礎設定 & 變數================================ */
:root {
    --bg: #eef4f7;
    --text: #000000;
    --muted: #6d6d6d;
    --link: rgb(26, 77, 179);
    --sidebar-bg: #e4e9eb;
    --menu: #d5d8ea;
    --shadow: rgba(247, 247, 247, 0.1);
    --code-bg: #354863;
    --code-bg-dark: #e6e6e6;
    --radius: 10px;
    --gap: 20px;
    --sidebar-width: 20%;
    --content-width: calc(100% - var(--sidebar-width));
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: "Chiron Hei HK", sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    line-height: 1.2em;
    display: flex;
    flex-wrap: nowrap;
    padding-left: 50px;
    padding-right: 0px;
    margin: 0;
    text-autospace: normal;
    line-height: 1.2em;
    width: 100%;
    text-align: justify;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: "Chiron Hei HK", sans-serif;
    line-height: 1.2em;
}

h1 {
    font-weight: 800;
}

h2 {
    font-weight: 600;
    margin-block-start: 3em;
    border-bottom: 1px solid var(--text);
    padding-bottom: 10px;
}

h3 {
    margin-top: 46px;
    font-weight: 500;
}

h3::before {
    content: "*";
    color: rgb(255, 255, 255);
    position:relative;
    top:4px;
    padding-right: 5px;
}

/* Google Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' -25, 'opsz' 24;
}

/* =============================== 排版 & 連結================================ */
a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

p {
    font-weight: 300;
    margin-left: 1em;
    line-height: 1.8em;
    text-autospace: normal;
}

iframe {
    margin-left: 2em;
}

hr {
    margin: 30px 0;
}

table {
    border-collapse: collapse;
    border-left: 1px solid rgb(7, 7, 7);
    padding: 2px;
    border: 1px solid rgb(7, 7, 7);
    margin-left: 2em;
    font-size: 0.8em;
    width: inherit;
}

th {
    background-color: rgb(235, 235, 235);
    padding: 15px;
    border: 1px solid rgb(7, 7, 7);
    min-width:100px;
}

td {
    text-align: center;
    padding: 15px;
    border: 1px solid rgb(7, 7, 7);
}
ol{
        padding-inline-start:20px;
}
blockquote {
    background-color: rgb(48, 48, 48);
    padding: 10px;
    border-radius: 5px;
    border-left: 10px solid rgb(216, 216, 216);
    margin-inline-start: 2em;
    margin-inline-end: 0px;
}

blockquote>p {
    margin-left: 10px;
    margin-block-start: 0em;
    margin-block-end: 0em;
    font-family: 'GenRyuMin2TW-M', serif;
}

strong {
    font-weight: 600;
}

mark {
    background-color: #6f0064;
    /* color: #3e3e46; */
    color: rgb(255, 255, 255);
    font-weight: 360;
}

/* =============================== 版面結構================================ */
main {
    margin: 60px 0px;
}

.doc-switchers {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    margin: 10px 0 20px;
}

.sidebar_box {
    width: var(--sidebar-width);
    padding: var(--gap);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    background-color: var(--sidebar-bg);
    box-shadow: 2px 0 5px var(--shadow);
}

#sidebar {
    width: 100%;
    color: aliceblue;
    position: sticky;
    top: 0;
    overflow-y: auto;
    font-weight: 500;
}

#sidebar a {
    display: block;
    margin-bottom: 10px;
    color: var(--text);
    font-weight: normal;
}

#sidebar a.indent-h3 {
    margin-left: 20px;
    font-size: 90%;
    opacity: 0.85;
}

#content {
    width: var(--content-width);
    max-width: 800px;
    padding: 20px;
    margin-left: calc(var(--sidebar-width));
    overflow-x: hidden;
}

.tips-tip {
    background-color: rgb(9, 58, 9);
    padding: 10px;
    border-radius: 5px;
    border-left: 6px solid rgb(48, 145, 48);
    text-align: left;

}

.tips-warning {
    background-color: #300303;
    padding: 10px;
    border-radius: 5px;
    border-left: 6px solid #ea1e1e;
    text-align: left;

}

.tips-info {
    background-color: rgb(26, 39, 71);
    padding: 10px;
    border-radius: 5px;
    border-left: 6px solid rgb(51, 63, 175);
    text-align: left;
}

/* =============================== 圖片與展示================================ */
.imgBox,
.img-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.imgBox {
    padding: 10px 20px;
    width: 100%;
}

.img-container {
    width: 80%;
    margin: 0 auto;
    text-align: center;
}

img {
    width: 100%;
    border-radius: var(--radius);
}

.showImage {
    width: 100%;
    cursor: pointer;
    transition: all 0.3s;
}

.showImage:hover {
    opacity: 0.7;
}

.showImageHint {
    font-weight: 200;
    font-size: 12px;
}

.disabled {
    color: #adadad;
    background-color: #575757;
    padding: 2px 10px;
    border-radius: 100px;
}

/* 圖片燈箱 */
dialog {
    position: fixed;
    inset: 0;
    border: none;
    padding: 0;
    width: auto;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgb(141 141 141 / 49%);
    backdrop-filter: blur(5px);
    z-index: 1000;
}

dialog img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

code {
    background-color: #343447;
    color: #ecf4ff;
    padding: 2px 6px;
    border-radius: 2px;
    font-family: "JetBrains Mono", monospace;
    font-weight: 350;
    font-size: 0.98em;
    font-style: italic;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 1001;
}

/* =============================== 程式碼區塊/摺疊================================ */
.codeDisplay {
    background-color: var(--code-bg);
    padding: 1em;
    margin: 0.5em 0;
    border-radius: 0.3em;
    overflow: auto;
    line-height: 20px;
}

.code-container {
    margin-left: 20px;
}

details summary {
    cursor: pointer;
    margin-bottom: 8px;
}

pre {
    margin-left: 2em;
}

details pre {
    background: var(--code-bg-dark);
    color: #f8f8f2;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
}

/* =============================== 目錄（頁內 TOC）================================ */
.page-toc {
    width: fit-content;
    display: flex;
    flex-wrap: wrap;
    padding: 5px 20px;
    background-color: var(--menu);
    border-radius: 5px;
}

.page-toc>ol,
ul,
li {
    margin: 1em 2em;
    margin: 10px;
}

.toc-h3 {
    margin: 0px;
}

.page-toc>a {
    width: 100%;
    line-height: 2em;
    text-decoration: underline;
    color: rgb(142, 202, 255);
}

/* =============================== 分頁================================ */
.pagination {
    text-align: center;
    margin-top: 50px;
}

.pagination a,
.pagination span.current {
    margin: 0 10px;
    padding: 2px 8px;
    border: 1px solid var(--text);
    color: var(--text);
    border-radius: 4px;
}

.pagination a:hover {
    background-color: var(--text);
    color: #000;
}

.pagination span.current {
    background-color: #000;
}

/* =============================== 其他================================ */
.jx-knightlab {
    display: none;
    z-index: 0;
}

/* 浮動漢堡按鈕（行動版顯示） */
.hamburger {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--sidebar-bg);
    color: var(--text);
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
    border: none;
}

.hamburger div {
    width: 30px;
    height: 3px;
    background-color: var(--text);
    margin: 5px 0;
}

.current {}

.capsule {
    border: 1px solid var(--text);
    border-radius: 200px;
    padding: 2px 10px;
    color: white;
    background-color: #000;
    font-size: 0.8em;
    font-weight: 400;
}

.img1 {
    width: 200px;
}

#sidebarResizer {
    width: 10px;
    cursor: col-resize;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    margin-left: -5px;
    bottom: 0;
    z-index: 1001; /* Higher than sidebar */
    transition: background-color 0.2s;
}

#sidebarResizer:hover, #sidebarResizer.resizing {
    background-color: rgba(0, 0, 0, 0.2);
}

/* =============================== DL List Accordion ================================ */
dl {
    margin: 20px 0;
}

dt {
    cursor: pointer;
    font-weight: bold;
    padding: 10px;
    background-color: var(--sidebar-bg);
    border-radius: 5px;
    margin-bottom: 5px;
    position: relative;
    padding-left: 30px;
    transition: background-color 0.3s;
    user-select: none;
}

dt::before {
    content: '▶';
    font-size: 0.8em;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s;
}

dt.active::before {
    transform: translateY(-50%) rotate(90deg);
}

dt:hover {
    filter: brightness(0.95);
}

dd {
    display: none;
    padding: 10px 20px;
    margin: 0 0 10px 0;
    border-left: 3px solid var(--sidebar-bg);
}

dd.active {
    display: block;
    animation: slideDown 0.3s ease-in-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================== RWD================================ */
@media (max-width: 600px) {
    #sidebarResizer {
        display: none;
    }

    body {
        padding: 20px;
    }

    .sidebar_box {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .sidebar_box.active {
        display: block;
        width: 60%;
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 999;
        background-color: var(--sidebar-bg);
        padding: var(--gap);
        box-shadow: 2px 0 5px var(--shadow);
    }

    #content {
        width: 100%;
        margin-left: 0;
        padding: 0;
        overflow-x: scroll;

    }

    .img-container {
        width: 90%;
    }

    li {
        font-size: 12px;
        line-height: 25px;
    }

    .li_margin {
        margin-top: 30px;
    }

    p,
    iframe,
    table,
    pre,
    .code-container {
        margin-left: 0em;
    }

    p {
        font-size: 0.9em;
    }

    ul {
        margin-left: 1em;
    }

    table {
        overflow-x: scroll;
        overflow-y: scroll;

    }

    .img1 {
        width: 100%;
    }

}