/*
 * 銷波快 CIS × WordPress 銜接樣式（mb-wp.css）
 *
 * 載入順序：theme.json 全域樣式 → assets/cis/site.css（CIS 原檔，不改）→ 本檔。
 * 規則：
 *   - CIS 原檔不改；銜接、覆寫、預覽新增的元件都寫在這裡。
 *   - 自訂 class 一律 mb- 前綴（PLAN 11-12 踩雷：.side 與 CIS 撞名）。預覽裡沒前綴的自訂 class
 *     （.dd .sf-sub .sf-soc2 .soc-g .soc-h .plain .cl .amb）在主題改名為 mb- 版本，樣式值逐字不變。
 *   - 第 1 段＝預覽共用頁首頁尾樣式（preview/404.html 與其他 32 頁相同的 <style> 0～6、#mb-hs-css、#mb-rsp-css），
 *     由 scratchpad/build_mbwp.py 逐字抽出後改名；第 2 段＝WordPress 結構的銜接（範本組件外層、區塊間距等）。
 *   - 頁面專用樣式放在各 block 的 style.css（只在該 block 出現時載入）。
 */

/* ═════ 1. 預覽共用：頁首下拉、頁尾、頁首搜尋、響應修正 ═════ */
/* 取自首頁預覽：頁首下拉＋頁尾 */
/* ---- 頁首「節目」下拉（CIS 沒有，用 CIS 視覺語言做最小版） ---- */
.mb-dd { position: relative; }
.mb-dd-btn { background: none; border: 0; padding: 6px 0; font: 500 15px/1.8 var(--zh); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.mb-dd-btn::after { content: ""; border: 4px solid transparent; border-top: 5px solid currentColor; border-bottom: 0; transition: transform .2s; }
.mb-dd.open .mb-dd-btn::after { transform: rotate(180deg); }
.mb-dd-btn:hover, .mb-dd.open .mb-dd-btn { color: var(--blue); }
.mb-dd-menu { display: none; position: absolute; top: calc(100% + 14px); left: -16px; min-width: 232px; margin: 0; padding: 8px 0; list-style: none; background: var(--paper); border: 1px solid var(--line); box-shadow: 0 14px 30px -18px rgba(12, 42, 64, .35); z-index: 60; }
.mb-dd-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -16px; height: 16px; }
.mb-dd.open .mb-dd-menu { display: block; }
.mb-dd-menu a { display: flex; align-items: center; gap: 14px; padding: 9px 18px; border: 0 !important; color: var(--ink); }
.mb-dd-menu a::after { display: none !important; }
.mb-dd-menu a:hover, .mb-dd-menu a:focus-visible { background: rgba(20, 71, 107, .06); color: var(--blue); }
.mb-dd-menu b { display: grid; place-items: center; width: 32px; height: 32px; background: var(--blue); color: #fff; font-size: 16px; font-weight: 900; line-height: 1; outline: 1px solid #fff; outline-offset: -3px; flex: none; }
.mb-dd-menu span { font-family: var(--road); font-weight: 600; font-size: 13px; letter-spacing: .12em; }
@media (max-width: 860px) {
  .mb-dd { border-bottom: 1px solid var(--line); }
  .mb-dd-btn { width: 100%; justify-content: space-between; padding: 13px 0; }
  .mb-dd-menu { position: static; min-width: 0; box-shadow: none; border: 0; background: transparent; padding: 0 0 8px; }
  .mb-dd-menu::before { display: none; }
  .mb-dd-menu a { padding: 9px 0 9px 8px; }
}


/* ---- 頁尾 ---- */
.mb-sf-sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: clamp(32px, 4vw, 48px); margin-bottom: clamp(32px, 4vw, 48px); border-bottom: 1px solid rgba(255, 255, 255, .14); }
.mb-sf-sub h3 { font-size: clamp(24px, 3vw, 34px); line-height: 1.4; }
.mb-sf-sub p { color: #b9c7d1; margin-top: 10px; font-size: 15px; }
.btn.mb-amb { background: var(--amber); border-color: var(--amber); color: var(--deep); }
.btn.mb-amb:hover { background: #ffbf5c; border-color: #ffbf5c; }
.sf-bot a:hover { color: var(--amber); }

/* 11-12 使用者：頁尾社群不要全部直排 → 兩組橫排圖示鈕（收聽／追蹤） */
.mb-soc{margin:20px 0 0;display:flex;flex-direction:column;gap:12px}
.mb-soc .mb-soc-g{display:flex;align-items:center;gap:12px}
.mb-soc .mb-soc-h{font-size:12px;letter-spacing:.12em;color:#9fb0bb;min-width:2.6em}
.mb-soc ul{list-style:none;margin:0;padding:0;display:flex;gap:8px;flex-wrap:wrap}
.mb-soc a{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;border:1px solid rgba(255,255,255,.24);color:#dfe6ea}
.mb-soc a i{display:block;width:17px;height:17px;background:currentColor;-webkit-mask:var(--ic) center/contain no-repeat;mask:var(--ic) center/contain no-repeat}
.mb-soc a:hover,.mb-soc a:focus-visible{border-color:var(--amber);color:var(--amber)}

/* 11-12 選單：純文字項目（非系列）樣式 */
#nav .mb-dd-menu a.mb-plain{padding:10px 18px;font-size:14.5px;font-weight:500}
#nav .mb-dd-menu{min-width:200px}

/* 11-12 換行只落在標點後：每個短句不拆開 */ .mb-cl{display:inline-block}

/* 11-12 頁尾訂閱帶改輸入框（使用者同意）：文字左、表單右；手機上下；小字與首頁一致。正式版接 marketblock_subscribe_form()＋subscribe.js */
footer .mb-sfsub{display:grid;grid-template-columns:1fr minmax(320px,440px);gap:24px 40px;align-items:center}
footer .mb-sfform .form{display:flex;gap:0}
footer .mb-sfform input{flex:1;min-width:0;height:48px;padding:0 14px;border:1px solid rgba(255,255,255,.35);border-right:0;background:#fff;color:#1b2a33;font-size:15px;border-radius:0}
footer .mb-sfform .btn{height:48px;border-radius:0}
footer .mb-sfnote{margin:8px 0 0;font-size:12.5px;color:#9fb0bb;letter-spacing:.04em}
.mb-vh{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
@media (max-width:860px){footer .mb-sfsub{grid-template-columns:1fr}}

/* 11-12 使用者：手機版訂閱表單尺寸怪 → CIS 在 ≤860px 把 .form 改上下排列，但 input 的 flex:1 在直向會把高度壓到 23px。保留 CIS 上下排列，輸入框固定 48px（與按鈕同高）、框線補齊；頁尾訂閱帶標題手機 20px */
@media (max-width:860px){.form input[type=email]{flex:none!important;height:48px!important;box-sizing:border-box}.form .btn{flex:none;height:48px}footer .mb-sfform input{border-right:1px solid rgba(255,255,255,.35)!important;border-bottom:0!important}footer .mb-sfsub h3{font-size:20px;line-height:1.45}}

/* 11-12 使用者：手機選單鈕只用「三」圖示（直角三條線），打開變 ✕。CIS site.js 開關時會改寫按鈕 textContent（選單／關閉），所以圖示用 ::before 遮罩畫、文字以 font-size:0 隱藏；名稱固定 aria-label「選單」＋aria-expanded，讀屏念「選單 已展開／已收合」。正式主題可改成不寫 textContent */
.nav-tg{width:40px;padding:0;justify-content:center;font-size:0;color:var(--ink,#1b2a33)}.nav-tg::before{content:"";width:22px;height:22px;background:currentColor;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='2.4'/%3E%3Crect x='3' y='10.8' width='18' height='2.4'/%3E%3Crect x='3' y='16.6' width='18' height='2.4'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='2.4'/%3E%3Crect x='3' y='10.8' width='18' height='2.4'/%3E%3Crect x='3' y='16.6' width='18' height='2.4'/%3E%3C/svg%3E") center/contain no-repeat}.nav-tg[aria-expanded="true"]::before{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5l14 14M19 5L5 19' stroke='black' stroke-width='2.4' stroke-linecap='square' fill='none'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 5l14 14M19 5L5 19' stroke='black' stroke-width='2.4' stroke-linecap='square' fill='none'/%3E%3C/svg%3E")}

/* ── 頁首搜尋（使用者 11-13；正式主題的共用頁首要加）：放大鏡＝Lucide search、1.5 線寬、堤藍；按鈕 40×40 與手機選單鈕同尺寸；展開面板用 CIS .form ── */ .sh .nav{margin-left:auto} .mb-hs-btn{display:inline-flex;align-items:center;justify-content:center;flex:none;width:40px;height:40px;padding:0;background:none;border:1px solid var(--line);color:var(--blue);cursor:pointer;transition:border-color .2s} .mb-hs-btn:hover,.mb-hs-btn[aria-expanded="true"]{border-color:var(--blue)} .mb-hs-btn:focus-visible{outline:2px solid var(--amber);outline-offset:2px} .mb-hs-btn .mb-ico{width:20px;height:20px} .mb-hs{position:absolute;left:0;right:0;top:100%;background:var(--mist);border-bottom:1px solid var(--line);padding:16px 0} .mb-hs[hidden]{display:none} .mb-sform{max-width:640px} .mb-sform .btn:focus-visible,.mb-sform input:focus-visible{outline:2px solid var(--amber);outline-offset:2px} @media (max-width:860px){.mb-hs-btn{order:2;margin-left:auto}.nav-tg{order:3}.sh-in{gap:10px}.sh .nav{margin-left:0} .mb-sform input{flex:none!important;height:48px!important;box-sizing:border-box}.mb-sform .btn{height:48px}}

/* 11-13 使用者裁定響應修正（隨共用頁尾帶入全站；正式主題併入共用 CSS）。點擊範圍門檻＝WCAG 2.2 AA 24×24 */ /* ⑤ 頁尾連結、版權列連結、麵包屑：上下各撐 3px 點擊範圍，再用負 margin 抵銷，版面與間距不變 */ .sf ul a,.sf-bot a,.crumb a{padding-block:3px;margin-block:-3px} /* ⑥ 系列小牌 .plate.sm：CIS site.css 原為 66px 寬／編號 19px／英文 9.5px → 等比放大到 76px／22px／11px（與 CIS 手機版 .g5 小牌 78px／11px 同級）；用到的格線欄寬在各頁建置程式同步改 76px */ .plate.sm{width:76px;padding:8px 0 7px}.plate.sm b{font-size:22px}.plate.sm span{font-size:11px;margin-top:5px}

/* ═════ 2. WordPress 銜接 ═════ */

/* 範本組件外層（<header>／<footer class="wp-block-template-part">）：CIS 的 .sh 是 sticky，
   但 sticky 只在父層範圍內有效，外層與 .sh 等高 → 改由外層 sticky（.sh 本身維持 CIS 原樣）。 */
.wp-site-blocks > header.wp-block-template-part { position: sticky; top: 0; z-index: 50; }
.admin-bar .wp-site-blocks > header.wp-block-template-part { top: var(--wp-admin--admin-bar--height, 0px); }
/* theme.json blockGap 會在頁首、內容、頁尾之間插 margin；CIS 版面自己管間距 */
.wp-site-blocks > * + * { margin-block-start: 0; }
.wp-site-blocks { padding: 0; }
main.mb-cis-main { display: block; }

/* 品牌標記改用 <img>（SVG 檔在主題 assets/cis/），高度照 CIS .brand／.sf-brand */
.brand img, .sf-brand img { height: 100%; width: auto; display: block; }

/* 麵包屑：讀 Rank Math＋外掛輸出（marketblock_crumbs_html），外觀照 CIS .crumb */
nav.crumb ol { display: contents; list-style: none; margin: 0; padding: 0; }
nav.crumb li { display: inline; }

/* 頁尾版權列「站得住」不斷行（11-13 響應修正 ⑦） */
.mb-nowrap { white-space: nowrap; }

/* 頁首搜尋面板以 .sh 為定位基準 */
.sh { position: sticky; }

/* 減少動態：CIS 卡片浮起、插畫帶與下拉的轉場一律停 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  a.card:hover { transform: none; }
}

/* ═════ 3. 共用頁面元件（多種頁型共用；值照預覽頁 <style> 原文） ═════ */

/* .label 裡的 H2（預覽把方框小標籤包成 H2：實體標題給 SEO，外觀維持 CIS .label b） */
.label h2 { margin: 0; font-size: inherit; line-height: inherit; display: contents; }

/* 中文換行：每個以標點結尾的短句不拆開（marketblock_cl()；11-12） */
.mb-cl { display: inline-block; }

/* 隱藏但讀屏可讀 */
.mb-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 主題 chips（404、搜尋無結果、hub）＝404.html／搜尋結果.html */
.mb-chips a.chip { height: 34px; padding: 0 14px; font-size: 14px; color: var(--ink); text-decoration: none; transition: border-color .2s, color .2s; }
.mb-chips a.chip:hover { border-color: var(--blue); color: var(--blue); }
.mb-chips a.chip:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mb-chips a.chip.on { color: #fff; }
.mb-chips-label { margin: 0 0 14px; font-size: 14px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }

/* 頁內搜尋框（404、無結果）：CIS .form input 是白框（原設計放深色帶），放白底區塊時框線改 --line */
.mb-psearch { margin-top: 28px; }
.sec.white .mb-sform input { border-color: var(--line); }

/* 最近更新的內容（.post 列）、五系列卡（.card.serie） */
.post .post-d { font-family: var(--road); }
.mb-series a.card.serie { text-decoration: none; color: inherit; }
.mb-recent .post { transition: background .2s; }
.mb-recent .post:hover { background: #f3f8fc; }


/* 主持／關於頁共用的按鈕列 */
.mb-acts { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }

/* theme.json 全域樣式的連結色、標題色（舊設計：連結堤藍、標題墨色）會蓋掉 CIS 的「繼承」寫法
   （深色帶的頁尾標題、連結變成深色）→ 換回 CIS：連結與標題顏色繼承父層；有 class 的 CIS 規則照樣優先。 */
body a:where(:not(.wp-element-button)) { color: inherit; }
body a:where(:not(.wp-element-button)):hover { text-decoration: none; }
html body :where(h1, h2, h3, h4, h5, h6) { color: inherit; }
.dark :where(h1, h2, h3, h4) { color: inherit; }

/* 訂閱表單：蜜罐欄位移出畫面（不能 display:none，見 functions.php marketblock_subscribe_form 註解）；送出結果提示 */
.mb-sub-hp-wrap { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.mb-sub-msg { margin: 8px 0 0; font-size: 14px; line-height: 1.6; }
.mb-sub-msg:empty { display: none; }
.dark .mb-sub-msg { color: #e7edf0; }
.mb-sub-msg[data-state="invalid"], .mb-sub-msg[data-state="error"], .mb-sub-msg[data-state="rate_limited"], .mb-sub-msg[data-state="unconfigured"] { color: var(--amber); }

/* 批 4：單獨一行的文字連結（.more「看全部 →」「節目列表 →」「← 回到術語表」）點擊範圍 ≥24px（WCAG 2.2 AA；11-13 響應修正同一作法：上下撐 3px 再用負 margin 抵銷，版面不變） */
p > a.more:only-child { display: inline-block; padding-block: 3px; margin-block: -3px; }
