/* 修改 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-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;
}

.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 跟著向上移動一點點 */

/* 桌面側欄：隱藏 nav title，避免內容上捲時標題列造成位移。
   不可在手機一併隱藏——進到分類後，.md-nav__title 就是返回上一層的按鈕。 */
@media screen and (min-width: 76.25em) {
  .md-nav__title {
    display: none;
  }
}

/* 手機抽屜：回首頁／回上一層列改成與一般 Navbar 選項同高，不要佔 5.6rem。 */
@media screen and (max-width: 76.1875em) {
  .md-nav--primary .md-nav__title {
    display: flex;
    align-items: center;
    height: auto;
    min-height: 0;
    padding: 0.6rem 0.8rem;
    line-height: 1.5;
    font-size: 0.8rem;
  }

  .md-nav--primary .md-nav__title .md-nav__icon {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0 0.45rem 0 0;
    flex-shrink: 0;
  }

  .md-nav--primary .md-nav__title .md-logo {
    position: static;
    left: auto;
    right: auto;
    top: auto;
    display: inline-flex;
    align-items: center;
    padding: 0;
    margin: 0 0.45rem 0 0;
  }

  .md-nav--primary .md-nav__title .md-nav__button.md-logo img,
  .md-nav--primary .md-nav__title .md-nav__button.md-logo svg {
    width: 1.15rem;
    height: 1.15rem;
    max-width: 1.15rem;
  }
}

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

/* 隱藏 div.mermaid 的原始文字 */
div.mermaid {
    color:transparent;
}

/* 修正 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;  /* 預設正文大小 */
}

/* 窄螢幕：頁尾版權與社交圖示維持左右，不要因為 copyright 寬度 100% 而上下疊。 */
.md-footer-meta__inner {
  flex-wrap: nowrap;
  align-items: center;
}

.md-footer-meta .md-copyright {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
}

.md-footer-meta .md-social {
  flex-shrink: 0;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

/* 手機：主題預設隱藏「上一頁」標題，只留箭頭。改回兩邊都顯示頁名。 */
@media screen and (max-width: 44.984375em) {
  .md-footer__link {
    min-width: 0;
    max-width: 50%;
  }

  .md-footer__link--prev {
    flex-shrink: 1;
  }

  .md-footer__link--prev .md-footer__title {
    display: block;
  }
}

/* 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);
}

/* YouTube／官方影音 iframe（16:9） */
.md-typeset .video-wrapper {
  position: relative;
  display: block;
  width: 100%;
  height: 0;
  margin: 0.75em 0 1.25em;
  padding: 0 0 56.25%;
  overflow: hidden;
  background: #000;
  border-radius: 0.2rem;
}

.md-typeset .video-wrapper > iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
/* =====================================================================
   IB Physics：SL / HL 標示（全站）
   - 段落層級：自訂 admonition `!!! sl`、`!!! hl`（含 `??? hl` 可折疊）
   - 頁面層級：front matter `level: SL+HL` 或 `level: HL`，由 content.html 輸出徽章
   - 只看 SL：<html> 加上 .ib-sl-only 時隱藏所有 HL 區塊（extra.js 切換並記住）
   ===================================================================== */
:root {
    --ib-sl-color: #1e88e5;
    --ib-hl-color: #e65100;
    --md-admonition-icon--sl: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11 7a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2v2H9v2h4a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-2V9h4V7zm1-5a10 10 0 0 1 10 10 10 10 0 0 1-10 10A10 10 0 0 1 2 12 10 10 0 0 1 12 2"/></svg>');
    --md-admonition-icon--hl: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2a10 10 0 0 1 10 10 10 10 0 0 1-10 10A10 10 0 0 1 2 12 10 10 0 0 1 12 2M9 7v10h2v-4h2v4h2V7h-2v4h-2V7z"/></svg>');
}

.md-typeset .admonition.sl,
.md-typeset details.sl {
    border-color: var(--ib-sl-color);
}
.md-typeset .sl > .admonition-title,
.md-typeset .sl > summary {
    background-color: rgb(30 136 229 / 10%);
}
.md-typeset .sl > .admonition-title::before,
.md-typeset .sl > summary::before {
    background-color: var(--ib-sl-color);
    -webkit-mask-image: var(--md-admonition-icon--sl);
    mask-image: var(--md-admonition-icon--sl);
}

.md-typeset .admonition.hl,
.md-typeset details.hl {
    border-color: var(--ib-hl-color);
}
.md-typeset .hl > .admonition-title,
.md-typeset .hl > summary {
    background-color: rgb(230 81 0 / 10%);
}
.md-typeset .hl > .admonition-title::before,
.md-typeset .hl > summary::before {
    background-color: var(--ib-hl-color);
    -webkit-mask-image: var(--md-admonition-icon--hl);
    mask-image: var(--md-admonition-icon--hl);
}

/* 行內小徽章：表格或段落中標示 SL / HL，例如 <span class="ib-badge ib-badge--hl">HL</span> */
.md-typeset .ib-badge {
    display: inline-block;
    padding: 0 0.5em;
    border-radius: 999px;
    font-size: 0.72em;
    font-weight: 700;
    line-height: 1.6;
    letter-spacing: 0.04em;
    color: #fff;
    vertical-align: middle;
    white-space: nowrap;
}
.md-typeset .ib-badge--sl { background: var(--ib-sl-color); }
.md-typeset .ib-badge--hl { background: var(--ib-hl-color); }

/* 頁面等級列（content.html 輸出）：徽章 + 只看 SL 切換 */
.md-typeset .ib-level {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    margin: 0 0 1rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    background: var(--md-code-bg-color, #f5f5f5);
    font-size: 0.75rem;
}
.md-typeset .ib-level__label { font-weight: 600; }
.md-typeset .ib-level__switch {
    margin-left: auto;
    display: inline-flex;
    border: 1px solid var(--md-default-fg-color--lighter);
    border-radius: 999px;
    overflow: hidden;
}
.md-typeset .ib-level__switch button {
    padding: 0.15rem 0.75rem;
    font: inherit;
    color: var(--md-default-fg-color--light);
    background: transparent;
    cursor: pointer;
}
.md-typeset .ib-level__switch button[aria-pressed="true"] {
    color: #fff;
    background: var(--md-primary-fg-color, #4051b5);
}
.md-typeset .ib-level__hidden-note {
    display: none;
    width: 100%;
    color: var(--ib-hl-color);
}

/* 只看 SL 模式 */
.ib-sl-only .md-typeset .admonition.hl,
.ib-sl-only .md-typeset details.hl,
.ib-sl-only .md-typeset .ib-hl-only {
    display: none;
}
.ib-sl-only .md-typeset .ib-level__hidden-note { display: block; }
.ib-sl-only .md-typeset .ib-level--hl .ib-level__hidden-note::after {
    content: "（本頁為 HL 專屬內容，修 SL 的同學可以略過整頁。）";
}

/* HL 專屬內容區塊（例如 HL 影片）：左側橘色細線提示 */
.md-typeset .ib-hl-only {
    border-left: 3px solid var(--ib-hl-color);
    padding-left: 0.9rem;
    margin: 1.2em 0;
}
