/* 文章側欄＋快速跳讀（cx-side-toc）1.0.0 — 2026-11-28（正本：html/astro_claude/_共用模板/side-toc/）
   一份樣式給靜態站與 WordPress 共用；每站只改最上面那幾個顏色與距離。
   寬螢幕：右邊一欄＝上面幾張介紹卡（跟著捲走）＋緊接在下面的「快速跳讀」（捲到頂就黏住，右欄不留空白）。
   窄螢幕：沒有右欄 → 左下角「快速跳讀」小按鈕（捲過文章開頭的目錄才出現），按了從下面拉出來。
   哪一種由下面的 --cxs-mode 決定（動作程式讀它，斷點只住這裡一份）。
   每站要改的顏色與距離：在這份樣式之後用 :root { --cxs-…: … } 蓋過去（靜態站寫在站的樣式、WordPress 外掛寫在設定）。 */

:root {
  --cxs-accent: #007038;               /* 主色：進度、圓點、色條 */
  --cxs-accent-soft: #e2efe6;          /* 主色淡底 */
  --cxs-accent-ink: var(--cxs-accent); /* 淡底上的字（主色太亮的站，例如晨星的琥珀黃，要另給深色） */
  --cxs-on-accent: #fff;               /* 主色實心底上的字 */
  --cxs-link: var(--cxs-accent);       /* 卡片裡連結的字色 */
  --cxs-btn-bg: var(--cxs-accent);     /* 按鈕底 */
  --cxs-btn-ink: #fff;                 /* 按鈕字 */
  --cxs-ink: #2b2621;                  /* 字 */
  --cxs-muted: #7a7065;                /* 次要字 */
  --cxs-card: #fffdf8;                 /* 卡片底 */
  --cxs-line: #e2d7c3;                 /* 線 */
  --cxs-head: #263852;                 /* 卡片標題字 */
  --cxs-serif: inherit;                /* 卡片標題字型 */
  --cxs-top: 24px;                     /* 黏住時離畫面頂端多遠（有黏住的頁首就加上頁首高度） */
  --cxs-bottom: 24px;                  /* 跳讀卡底下要留多少（右下角有浮動按鈕就留它的高度） */
  --cxs-side-w: 300px;                 /* 右欄寬 */
  --cxs-gap: 40px;                     /* 文章與右欄的間距 */
  --cxs-pill-bottom: 20px;             /* 手機「快速跳讀」按鈕離底部多遠（底下有浮動按鈕就要墊高） */
  --cxs-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 30px -18px rgba(0, 0, 0, .35);
  --cxs-mode: sheet;
}
@media (min-width: 1080px) {
  :root { --cxs-mode: side; }
}

/* ── 版面：文章＋右欄 ───────────────────────────── */
@media (min-width: 1080px) {
  .cxs-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--cxs-side-w);
    gap: var(--cxs-gap);
    align-items: stretch; /* 右欄跟文章一樣高，跳讀卡才能一路黏到文章結束 */
  }
}
.cxs-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 1079.98px) {
  .cxs-side { margin-top: 28px; }
}

/* ── 介紹卡 ───────────────────────────── */
.cxs-card {
  position: relative;
  background: var(--cxs-card);
  border: 1px solid var(--cxs-line);
  border-radius: 18px;
  padding: 20px 20px 18px;
  box-shadow: var(--cxs-shadow);
  color: var(--cxs-ink);
  font-size: 15px;
  line-height: 1.75;
  overflow: hidden;
}
.cxs-card p { margin: 0 0 10px; }
.cxs-card p:last-child { margin-bottom: 0; }
.cxs-kicker { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .16em; color: var(--cxs-muted); font-weight: 700; }
.cxs-h {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 12px; font-family: var(--cxs-serif); font-size: 18.5px; font-weight: 700; line-height: 1.4; color: var(--cxs-head);
}
.cxs-h::before { content: ""; flex: none; width: 4px; height: 1.05em; border-radius: 2px; background: var(--cxs-accent); }
.cxs-about-photo {
  display: block; width: calc(100% + 40px); max-width: none; margin: -20px -20px 16px;
  aspect-ratio: 16 / 11; object-fit: cover; object-position: 50% 22%;
  background: var(--cxs-accent-soft);
}
.cxs-about-name { margin: 0 0 2px; font-family: var(--cxs-serif); font-size: 20px; font-weight: 700; color: var(--cxs-head); line-height: 1.35; }
.cxs-about-role { margin: 0 0 10px; font-size: 13.5px; color: var(--cxs-muted); line-height: 1.5; }
.cxs-about-who { display: flex; align-items: center; gap: 14px; margin: 2px 0 12px; }
.cxs-about-who img {
  width: 68px; height: 68px; border-radius: 50%; object-fit: cover; flex: none;
  border: 3px solid var(--cxs-card); box-shadow: 0 0 0 2px var(--cxs-accent-soft), 0 6px 14px -8px rgba(0, 0, 0, .45);
}
.cxs-about-who .cxs-about-name { font-size: 19px; }
.cxs-about-who .cxs-about-role { margin: 0; }
.cxs-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cxs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 999px;
  font-size: 14.5px; font-weight: 700; text-decoration: none !important; line-height: 1.2;
  background: var(--cxs-btn-bg); color: var(--cxs-btn-ink) !important; border: 1px solid var(--cxs-btn-bg);
  box-shadow: 0 6px 14px -10px rgba(0, 0, 0, .55);
  transition: transform .15s ease, filter .15s ease;
}
.cxs-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.cxs-btn.is-line { background: #06c755; border-color: #06c755; color: #fff !important; }
.cxs-btn.is-ghost { background: transparent; color: var(--cxs-link) !important; border-color: var(--cxs-line); box-shadow: none; }
.cxs-btn.is-wide { flex: 1 1 100%; }

/* 卡片裡的連結清單（服務項目）：看得出可以點（網頁設計規則第 8 節） */
.cxs-links { list-style: none; margin: 0; padding: 0; }
.cxs-links li { border-top: 1px dashed var(--cxs-line); }
.cxs-links li:first-child { border-top: 0; }
.cxs-links a { display: flex; gap: 10px; align-items: center; padding: 10px 2px; text-decoration: none; color: var(--cxs-link); font-weight: 600; }
.cxs-links a span { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cxs-links a::after { content: "→"; margin-left: auto; color: var(--cxs-muted); transition: transform .15s ease; }
.cxs-links a:hover::after { transform: translateX(3px); color: var(--cxs-link); }
.cxs-more { display: inline-block; margin-top: 8px; font-weight: 700; font-size: 14.5px; color: var(--cxs-link); text-decoration: underline; text-underline-offset: 4px; }

/* 相關文章：縮圖＋兩行標題 */
.cxs-rel { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cxs-rel a { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: center; text-decoration: none; }
.cxs-rel img, .cxs-rel .ph {
  width: 84px; height: 60px; border-radius: 10px; object-fit: cover; display: block;
  background: linear-gradient(135deg, var(--cxs-accent-soft), var(--cxs-line));
  transition: transform .2s ease;
}
.cxs-rel a:hover img { transform: scale(1.04); }
.cxs-rel .tt {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 14.5px; line-height: 1.55; color: var(--cxs-link); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, var(--cxs-link) 45%, transparent);
}
.cxs-rel a:hover .tt { text-decoration-color: var(--cxs-link); }

/* 卡片標題下面一行小字（資料從哪來） */
.cxs-note { margin: -6px 0 12px !important; font-size: 12.5px; line-height: 1.5; color: var(--cxs-muted); }

/* 大家最常看：名次＋標題（跟相關文章的縮圖版刻意長得不一樣，一眼分得出兩塊） */
.cxs-top { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.cxs-top li { border-top: 1px dashed var(--cxs-line); }
.cxs-top li:first-child { border-top: 0; }
.cxs-top a { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: center; padding: 9px 0; text-decoration: none; }
.cxs-top .rk {
  font-family: var(--cxs-serif); font-size: 24px; font-weight: 700; line-height: 1; text-align: center;
  color: color-mix(in srgb, var(--cxs-accent) 45%, var(--cxs-line));
}
.cxs-top li:nth-child(-n+3) .rk { color: var(--cxs-accent); }
.cxs-top .tt {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 14.5px; line-height: 1.55; color: var(--cxs-link); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, var(--cxs-link) 45%, transparent);
}
.cxs-top a:hover .tt { text-decoration-color: var(--cxs-link); }

/* 客戶成效：真實截圖小縮圖＋誰、問了什麼、AI 怎麼推薦 */
.cxs-proof { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cxs-proof a {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 8px; margin: 0 -8px; border-radius: 12px; text-decoration: none; color: var(--cxs-ink);
  transition: background .15s ease;
}
.cxs-proof a:hover { background: color-mix(in srgb, var(--cxs-accent-soft) 70%, transparent); }
.cxs-proof img {
  width: 56px; height: 76px; border-radius: 8px; object-fit: cover; object-position: 50% 30%;
  border: 1px solid var(--cxs-line); background: #111; display: block;
}
.cxs-proof .pf { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cxs-proof b { font-size: 15px; color: var(--cxs-head); line-height: 1.4; }
.cxs-proof .pq { font-size: 13px; line-height: 1.5; color: var(--cxs-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cxs-proof .pr {
  align-self: flex-start; margin-top: 2px; padding: 2px 9px; border-radius: 999px;
  background: var(--cxs-accent-soft); color: var(--cxs-accent-ink); font-size: 12.5px; font-weight: 700; line-height: 1.5;
}
.cxs-proof .pr::before { content: "✓ "; }
.cxs-proof small { font-size: 11.5px; color: var(--cxs-muted); }

/* ── 快速跳讀卡 ───────────────────────────── */
.cxs-toc {
  background: var(--cxs-card);
  border: 1px solid var(--cxs-line);
  border-radius: 18px;
  box-shadow: var(--cxs-shadow);
  color: var(--cxs-ink);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cxs-toc-in { display: contents; }
.cxs-toc-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px 8px; }
.cxs-toc-ico {
  flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  background: var(--cxs-accent-soft); color: var(--cxs-accent-ink);
}
.cxs-toc-ico svg { width: 18px; height: 18px; }
.cxs-toc-title { margin: 0; font-family: var(--cxs-serif); font-size: 16.5px; font-weight: 700; color: var(--cxs-head); line-height: 1.3; }
.cxs-toc-count {
  margin-left: auto; padding: 3px 10px; border-radius: 999px;
  background: var(--cxs-accent-soft); color: var(--cxs-accent-ink);
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cxs-toc-close { display: none; }
.cxs-toc-bar { height: 4px; margin: 0 18px 6px; border-radius: 4px; background: var(--cxs-line); overflow: hidden; }
.cxs-toc-bar i { display: block; height: 100%; width: calc(var(--cxs-p, 0) * 100%); border-radius: 4px; background: var(--cxs-accent); transition: width .15s linear; }
.cxs-toc-list {
  position: relative; /* 程式用每一行離清單頂端多遠來捲清單，清單本身要當基準 */
  list-style: none; margin: 0; padding: 4px 10px 8px;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--cxs-line) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 10px, #000 calc(100% - 16px), transparent 100%);
}
/* 時間軸：每一節一顆圓點，用一條線串起來；讀過的線與圓點變主色 */
.cxs-toc-list li { position: relative; margin: 0; padding: 0; }
.cxs-toc-list li::before {
  content: ""; position: absolute; left: 22px; top: 0; bottom: 0; width: 2px; background: var(--cxs-line);
}
.cxs-toc-list li:first-child::before { top: 50%; }
.cxs-toc-list li:last-child::before { bottom: 50%; }
.cxs-toc-list li.is-read::before { background: var(--cxs-accent); }
.cxs-toc-list li.is-current::before { background: linear-gradient(var(--cxs-accent) 50%, var(--cxs-line) 50%); }
.cxs-toc-list li.is-current:first-child::before { background: var(--cxs-line); }
.cxs-toc-list a {
  position: relative; z-index: 1;
  display: flex; gap: 10px; align-items: center;
  padding: 6px 10px 6px 8px; border-radius: 12px;
  color: var(--cxs-ink); text-decoration: none;
  font-size: 14.5px; line-height: 1.5;
  transition: background .15s ease, color .15s ease;
}
.cxs-toc-list a:hover { background: color-mix(in srgb, var(--cxs-accent-soft) 70%, transparent); }
.cxs-toc-list .n {
  flex: none; width: 24px; height: 24px; margin-left: 3px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--cxs-card); border: 2px solid var(--cxs-line);
  color: var(--cxs-muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cxs-toc-list .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cxs-toc-list li.is-read a { color: var(--cxs-muted); }
.cxs-toc-list li.is-read .n { border-color: var(--cxs-accent); color: var(--cxs-accent-ink); background: var(--cxs-accent-soft); }
.cxs-toc-list a[aria-current="true"] { background: var(--cxs-accent-soft); color: var(--cxs-accent-ink); font-weight: 700; }
.cxs-toc-list a[aria-current="true"] .n {
  background: var(--cxs-accent); border-color: var(--cxs-accent); color: var(--cxs-on-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cxs-accent) 22%, transparent);
}
.cxs-toc-foot {
  /* 一行小按鈕（Jimmy 2026-11-29：「絕對不能是兩行，太占空間……就直接弄一行字，像按鈕的可以點就好了」）；放聯絡以外的下一步，聯絡下面已經有了 */
  display: block; flex: none; margin: 0 12px 10px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--cxs-accent) 38%, transparent);
  background: var(--cxs-accent-soft); color: var(--cxs-accent-ink);
  font-size: 14px; font-weight: 700; line-height: 1.5; text-align: center; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cxs-toc-foot:hover { border-color: var(--cxs-accent); }

/* 寬螢幕：緊接在介紹卡下面，捲到頂就黏住 */
@media (min-width: 1080px) {
  .cxs-toc {
    position: sticky; top: var(--cxs-top);
    max-height: calc(100vh - var(--cxs-top) - var(--cxs-bottom));
  }
  .cxs-pill, .cxs-shade { display: none !important; }
}

/* 窄螢幕：左下角「快速跳讀」按鈕＋從下面拉出來 */
@media (max-width: 1079.98px) {
  .cxs-toc {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1001;
    max-width: 640px; margin-inline: auto; /* 平板上不撐滿整個寬度 */
    max-height: min(72vh, 620px);
    border-radius: 20px 20px 0 0; border-bottom: 0;
    transform: translateY(105%); visibility: hidden;
    transition: transform .28s ease, visibility 0s linear .28s;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .cxs-toc.is-open { transform: none; visibility: visible; transition: transform .28s ease; }
  .cxs-toc-head { padding-top: 16px; }
  .cxs-toc-foot { padding-top: 8px; padding-bottom: 8px; }   /* 手機好按 */
  .cxs-toc-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; margin-left: 4px; border-radius: 50%;
    border: 1px solid var(--cxs-line); background: transparent; color: var(--cxs-ink);
    font-size: 20px; line-height: 1; cursor: pointer;
  }
  .cxs-toc-list a { padding-top: 9px; padding-bottom: 9px; font-size: 15.5px; }
  .cxs-shade {
    position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .35);
    opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
  }
  .cxs-shade.is-open { opacity: 1; visibility: visible; transition: opacity .25s ease; }
  .cxs-pill {
    position: fixed; left: 12px; bottom: var(--cxs-pill-bottom); z-index: 999;
    display: inline-flex; align-items: center; gap: 6px;
    height: 40px; padding: 0 14px 0 12px; border-radius: 999px;
    border: 1px solid var(--cxs-line); box-shadow: 0 8px 22px -8px rgba(0, 0, 0, .45);
    font-size: 14px; font-weight: 700; cursor: pointer;
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
  }
  .cxs-pill.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity .2s ease, transform .2s ease; }
  .cxs-pill small { color: var(--cxs-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
  .cxs-pill svg { width: 18px; height: 18px; }
}

/* 佈景主題常對所有 <button> 上色（WordPress 的 Astra 點過後會變主題色），這兩顆按鈕在任何狀態都維持自己的樣子 */
button.cxs-pill.cxs-pill,
button.cxs-pill.cxs-pill:hover,
button.cxs-pill.cxs-pill:focus,
button.cxs-pill.cxs-pill:active {
  background: var(--cxs-card); color: var(--cxs-accent-ink);
  font-family: inherit; text-transform: none; letter-spacing: normal; line-height: 1;
}
button.cxs-toc-close.cxs-toc-close,
button.cxs-toc-close.cxs-toc-close:hover,
button.cxs-toc-close.cxs-toc-close:focus,
button.cxs-toc-close.cxs-toc-close:active {
  background: transparent; color: var(--cxs-ink); padding: 0;
  font-family: inherit; text-transform: none; letter-spacing: normal; line-height: 1;
}
button.cxs-pill.cxs-pill:focus-visible,
button.cxs-toc-close.cxs-toc-close:focus-visible { outline: 2px solid var(--cxs-accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .cxs-toc, .cxs-pill, .cxs-shade, .cxs-toc-bar i, .cxs-btn, .cxs-rel img, .cxs-toc-list a, .cxs-toc-list .n { transition: none !important; }
}
