/* 修改 mkdocs-material 的 Grid Card 背景顏色 */
.grid.cards li {
    background-color: #ecfbf1; /* 你想要的背景顏色 */
}

/* 側邊導覽：頁面 icon 與標題對齊，讓選單更醒目 */
.md-nav--primary .md-nav__link {
    align-items: center;
    gap: 0.45rem;
}

.md-nav--primary .md-nav__link svg {
    width: 1.15rem;
    height: 1.15rem;
    fill: var(--md-primary-fg-color, #4051b5);
    flex-shrink: 0;
}

.md-nav--primary .md-nav__item--active > .md-nav__link svg {
    fill: var(--md-accent-fg-color, #ff2b2b);
}

.md-nav--primary .md-nav__item--nested > .md-nav__link {
    font-weight: 600;
}

.md-nav--primary .md-nav__item--nested > .md-nav__link .md-nav__icon {
    margin-left: auto;
}

/* 標題：主標題跟頂欄同色系、淡底；次標題淺灰底＋柔和紅條 */
.md-content .md-typeset :is(h1, h2, h3, h4, h5, h6) {
    --heading-accent: #e25555;
    --heading-bg: #f6f6f7;
    position: relative;
    letter-spacing: 0.02em;
    line-height: 1.45;
}

.md-content .md-typeset h1 {
    font-size: 2em;
    font-weight: 700;
    color: var(--md-primary-fg-color, #4051b5);
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 12%, #ffffff) 0%,
        color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 5%, #ffffff) 72%,
        #ffffff 100%
    );
    border-left: 4px solid var(--md-primary-fg-color, #4051b5);
    padding: 0.4em 1em 0.4em 0.85em;
    margin: 0.1em 0 0.85em;
    border-radius: 0 10px 10px 0;
    box-shadow: none;
}

.md-content .md-typeset h2 {
    font-weight: 700;
    color: #2c2c2c;
    background: var(--heading-bg);
    border-left: 4px solid var(--heading-accent);
    padding: 0.3em 0.9em 0.3em 0.8em;
    margin-top: 2.1em;
    margin-bottom: 0.7em;
    border-radius: 0 8px 8px 0;
}

.md-content .md-typeset h3 {
    font-weight: 700;
    color: #2c2c2c;
    background: #f8f8f8;
    border-left: 3px solid var(--heading-accent);
    padding: 0.24em 0.75em 0.24em 0.7em;
    margin-top: 1.7em;
    margin-bottom: 0.55em;
    border-radius: 0 6px 6px 0;
}

.md-content .md-typeset :is(h4, h5, h6) {
    font-weight: 600;
    color: #333;
    background: none;
    border-left: 2px solid var(--heading-accent);
    padding: 0.1em 0 0.1em 0.6em;
    margin-top: 1.45em;
    margin-bottom: 0.45em;
    border-radius: 0;
}

/* 正文節奏：中文較舒適的行高，標題靠近所屬內容、段落之間留白 */
.md-content .md-typeset {
    line-height: 1.75;
}

.md-content .md-typeset p:not(.admonition-title),
.md-content .md-typeset li {
    line-height: 1.8;
}

.md-content .md-typeset p:not(.admonition-title) {
    margin-block: 0.8em 1.15em;
}

/* Admonition 標題是 <p class="admonition-title">，不要套用正文段落間距 */
.md-content .md-typeset .admonition-title,
.md-content .md-typeset details > summary {
    margin-block: 0;
    line-height: 1.3;
}

.md-content .md-typeset .admonition > p:not(.admonition-title),
.md-content .md-typeset details > p {
    margin-block: 0.35em 0.5em;
}

.md-content .md-typeset .admonition > :last-child,
.md-content .md-typeset details > :last-child {
    margin-bottom: 0.5em;
}

.md-content .md-typeset :is(h1, h2, h3) + p {
    margin-top: 0.15em;
}

.md-content .md-typeset .grid.cards {
    margin: 0.9em 0 0.3em;
}

/* Front matter 日期列（標題上方：主色圖示） */
.md-content__inner.md-typeset > .doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    margin: 0 0 0.85em;
    padding: 0.15em 0.15em 0;
    color: var(--md-default-fg-color--light, #666);
    font-size: 0.82em;
}

.md-content__inner.md-typeset > .doc-meta .doc-meta__item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.md-content__inner.md-typeset > .doc-meta .twemoji {
    width: 0.95em;
    height: 0.95em;
}

.md-content__inner.md-typeset > .doc-meta .twemoji svg {
    fill: var(--md-primary-fg-color, #4051b5);
}

.md-content .md-typeset pre,
.md-content .md-typeset .highlight {
    margin-block: 0.7em 1.25em;
}

.md-content .md-typeset :is(h1, h2, h3) .twemoji {
    display: inline-flex;
    align-items: center;
    margin-right: 0.4em;
    vertical-align: -0.18em;
}

.md-content .md-typeset h1 .twemoji {
    width: 1.05em;
    height: 1.05em;
}

.md-content .md-typeset :is(h2, h3) .twemoji {
    width: 0.95em;
    height: 0.95em;
}

.md-content .md-typeset h1 .twemoji svg {
    fill: currentColor;
}

.md-content .md-typeset :is(h2, h3) .twemoji svg {
    fill: var(--heading-accent);
}

[data-md-color-scheme="slate"] .md-content .md-typeset :is(h1, h2, h3, h4, h5, h6) {
    --heading-accent: #ff5252;
    --heading-bg: rgba(255, 255, 255, 0.07);
    color: var(--md-default-fg-color);
}

[data-md-color-scheme="slate"] .md-content .md-typeset h1 {
    color: #c5cae9;
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 28%, transparent) 0%,
        color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 8%, transparent) 100%
    );
    box-shadow: none;
}

[data-md-color-scheme="slate"] .md-content .md-typeset h2,
[data-md-color-scheme="slate"] .md-content .md-typeset h3 {
    color: var(--md-default-fg-color);
    background: var(--heading-bg);
}

[data-md-color-scheme="slate"] .md-content .md-typeset :is(h4, h5, h6) {
    color: var(--md-default-fg-color);
}

[data-md-color-scheme="slate"] .md-nav--primary .md-nav__link svg {
    fill: #c5cae9;
}

[data-md-color-scheme="slate"] .md-nav--primary .md-nav__item--active > .md-nav__link svg {
    fill: var(--md-accent-fg-color, #ff5252);
}

/* 可以根據需要調整 margin 的數值 */
.md-typeset a.md-button {
    margin: 4px;
    padding: 4px 8px;
}

/* .md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
    padding: 4px 4px;
    margin: 4px 4px;
} */

/* table {
    width: auto;  
    font-size: 12px; 
    line-height: 1.0;
}

table th {
    padding: 2px 2px;  
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
}

table td {
    padding: 2px 2px;  
    text-align: left;
    white-space: nowrap; 
}

table, th, td {
    border: 1px solid #ddd;
    border-collapse: collapse;  
} */


/* table {
    width: 100%;
    table-layout: fixed;
}

table th:nth-child(1), table td:nth-child(1) {
    width: 90px; 
}

.md-typeset table:not([class]) {
    display: table;
} */

/* 

table {
    width: auto;  
    font-size: 12px; 
    line-height: 1.0;
}

th, td {
    border: 1px solid var(--md-typeset-table-color);
    border-spacing: 0;
    border-bottom: none;
    border-left: none;
    border-top: none;
    width: auto;
}
*/

.md-typeset__table {
    line-height: 1.6;
    width: auto;
}

.md-typeset__table table:not([class]) {
    font-size: .74rem;
    border: 1px solid black;
}

.md-typeset__table table:not([class]) td,
.md-typeset__table table:not([class]) th {
    padding: 8px 10px;
    line-height: 1.6;
    border: 1px solid gray;
    min-width: 30px;
}

.md-typeset__table tr:nth-child(2n) {
    background-color: #f8f8f8;
}

[data-md-color-scheme="slate"] .md-typeset__table tr:nth-child(2n) {
    background-color: hsla(var(--md-hue),25%,25%,1)
} 


/* 底下的設定是為了不讓 content 上捲時， Nav Bar 跟著向上移動一點點 */

/* 只藏最上層重複的選單標題，保留分區摺疊按鈕 */
.md-nav--primary > .md-nav__title {
    display: none;
}

/* 設定 md-main__inner 的 margin 和 padding 為 0 */
.md-main__inner.md-grid {
    margin-top: 0 !important;
    /* padding: 0 !important; */
}

/* 手繪 SVG 流程圖：比 mermaid 更穩的字級、間距與主題色 */
.flow-wrap {
    margin: 1.25em 0 1.7em;
}

.md-typeset .flow-svg {
    display: block;
    width: min(100%, 22rem);
    height: auto;
    margin-inline: auto;
    overflow: visible;
    font-family: inherit;
}

.md-typeset .flow-svg--wide {
    width: min(100%, 32rem);
}

.flow-svg {
    --flow-line: color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 55%, #8a8a8a);
    --flow-card-fill: color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 11%, #ffffff);
    --flow-card-stroke: color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 62%, #ffffff);
    --flow-text: #2c2c2c;
    --flow-sub: #5a5a5a;
    --flow-num-fill: var(--md-primary-fg-color, #4051b5);
    --flow-process-fill: color-mix(in srgb, #e25555 10%, #ffffff);
    --flow-process-stroke: #e25555;
    --flow-ok-fill: color-mix(in srgb, #2e7d32 12%, #ffffff);
    --flow-ok-stroke: #2e7d32;
}

.flow-svg .flow-card {
    fill: var(--flow-card-fill);
    stroke: var(--flow-card-stroke);
    stroke-width: 1.5;
}

.flow-svg .flow-card--process,
.flow-svg .flow-decision {
    fill: var(--flow-process-fill);
    stroke: var(--flow-process-stroke);
    stroke-width: 1.6;
}

.flow-svg .flow-card--ok {
    fill: var(--flow-ok-fill);
    stroke: var(--flow-ok-stroke);
}

.flow-svg .flow-card--root {
    fill: color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 18%, #ffffff);
    stroke: var(--md-primary-fg-color, #4051b5);
    stroke-width: 1.8;
}

.flow-svg .flow-num {
    fill: var(--flow-num-fill);
}

.flow-svg .flow-num-text {
    fill: #ffffff;
    font-size: 13px;
    font-weight: 700;
}

.flow-svg .flow-label {
    fill: var(--flow-text);
    font-size: 15px;
    font-weight: 650;
}

.flow-svg .flow-sublabel,
.flow-svg .flow-edge-label {
    fill: var(--flow-sub);
    font-size: 12.5px;
    font-weight: 500;
}

.flow-svg .flow-connector {
    stroke: var(--flow-line);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.flow-svg .flow-arrow-head {
    fill: var(--flow-line);
}

[data-md-color-scheme="slate"] .flow-svg {
    --flow-card-fill: color-mix(in srgb, var(--md-primary-fg-color, #4051b5) 22%, #1b1b1f);
    --flow-text: var(--md-default-fg-color);
    --flow-sub: color-mix(in srgb, var(--md-default-fg-color) 72%, transparent);
    --flow-process-fill: color-mix(in srgb, #ff5252 18%, #1b1b1f);
    --flow-ok-fill: color-mix(in srgb, #81c784 16%, #1b1b1f);
}

/* 隱藏 div.mermaid 的原始文字；圖本身放大節點字、避免橫向被壓扁 */
div.mermaid,
pre.mermaid {
    color: transparent;
}

.md-typeset pre.mermaid,
.md-typeset .mermaid {
    overflow-x: auto;
    margin: 1.2em 0 1.6em;
}

.md-typeset pre.mermaid svg,
.md-typeset .mermaid svg {
    max-width: 100%;
    height: auto;
}

.md-typeset .mermaid .nodeLabel,
.md-typeset .mermaid .label,
.md-typeset .mermaid .edgeLabel,
.md-typeset pre.mermaid .nodeLabel,
.md-typeset pre.mermaid .label,
.md-typeset pre.mermaid .edgeLabel {
    font-size: 1.05rem !important;
    line-height: 1.45 !important;
}

.md-typeset .mermaid .nodeLabel p,
.md-typeset pre.mermaid .nodeLabel p {
    font-size: 1.05rem !important;
    line-height: 1.45 !important;
    margin: 0;
}

/* 修正 inline <code> 裡面的 css，凸顯他的顯示 */
.md-typeset code:not(pre code) {
    /* font-family: "Courier New", Consolas, monospace; 改字體 */
    font-family: "JetBrains Mono", "Source Code Pro", Consolas, Menlo, monospace;
    font-size: 1em;   
    color: red;
    background-color: #f0f0f0;  /* 底色淡粉紅 (可選) */
    /* font-weight: bold;      */
    padding: 0.1em 0.25em; /* 讓字不會太擠 */
    border-radius: 3px;    /* 圓角 */
}

/* 讓 admonition 裡的文字恢復正常字體大小 */
.md-typeset .admonition,
.md-typeset details {
  font-size: 1em;  /* 預設正文大小 */
}