/**
 * WebBiz Toolkit - 重點摘要框（編輯器畫布與前台共用）
 *
 * 顏色一律讀 CSS 自訂屬性並附後備值，沒有動態 CSS 時也能完整顯示：
 *   --webbiz-summary-border     嵌題的框線
 *   --webbiz-summary-accent     清單標記；書背的色塊與外框
 *   --webbiz-summary-on-accent  書背色塊上的標題文字
 * 嵌題的後備值是 currentColor：沒調過顏色時（動態 CSS 不輸出等於預設的欄位）框線與清單標記
 * 跟著文字顏色，深色版面也看得到。書背的後備值是預設色。
 * 不設底色、不指定內文字色，兩者跟著佈景主題。
 */

/* ---------- 共用 ---------- */

.webbiz-summary {
    box-sizing: border-box;
    line-height: 1.7;
}

/* 上下外距用兩層 class，避免被佈景主題的區塊間距蓋掉（嵌題的標題突出在框線上方，需要這段距離） */
.webbiz-summary.webbiz-summary--inset,
.webbiz-summary.webbiz-summary--spine {
    margin-top: 1.9em;
    margin-bottom: 1.9em;
}

.webbiz-summary .webbiz-summary__title {
    margin: 0;
    font-size: 1em;
    font-weight: 700;
    line-height: 1.4;
}

.webbiz-summary .webbiz-summary__body > ul,
.webbiz-summary .webbiz-summary__body > ol {
    margin: 0;
    padding: 0;
    padding-inline-start: 1.3em;
}

.webbiz-summary .webbiz-summary__body > ul {
    list-style-type: disc;
}

.webbiz-summary .webbiz-summary__body > ol {
    list-style-type: decimal;
}

.webbiz-summary .webbiz-summary__body li {
    margin: 0.3em 0;
    padding: 0;
}

.webbiz-summary .webbiz-summary__body li:first-child {
    margin-top: 0;
}

.webbiz-summary .webbiz-summary__body li:last-child {
    margin-bottom: 0;
}

/* 第二層清單：同樣的左內距，與上一條保持項目間距 */
.webbiz-summary .webbiz-summary__body li > ul,
.webbiz-summary .webbiz-summary__body li > ol {
    margin: 0.3em 0 0;
    padding: 0;
    padding-inline-start: 1.3em;
}

/* 長網址、長英文單字這類中間不能斷行的字，放不下時從字中間換行，不撐出框、手機頁面不變寬。
   嵌題的標題和兩側線段排成一列，要這條才縮得進框；書背的直排標題不處理 */
.webbiz-summary--inset .webbiz-summary__title,
.webbiz-summary__body {
    overflow-wrap: anywhere;
}

/* ---------- 嵌題：標題嵌在上框線中間 ---------- */

.webbiz-summary--inset {
    display: flow-root; /* 擋掉外距合併，標題才會真的往上移到框線的位置 */
    padding: 0 1.25em 1.1em;
    border: 1.5px solid var(--webbiz-summary-border, currentColor);
    border-top: 0;
}

.webbiz-summary.webbiz-summary--inset {
    margin-top: 2.5em;
}

.webbiz-summary--inset .webbiz-summary__title {
    display: flex;
    align-items: flex-start; /* 標題換行時，線段仍對齊第一行，上框線貼齊框頂 */
    gap: 0.7em;
    margin: -0.7em -1.25em 0.35em; /* 左右抵掉框的內距：標題剛好橫跨左右兩條框線之間 */
    letter-spacing: 0.15em;
}

/* 上框線由標題兩側的線段構成：左段 1.25em，右段延伸到右框線；標題長到換行時右段至少保留 1.25em，
   右上角不會開口。線段的上緣放在第一行的中間（行高 1.4 的一半），也就是框頂；左右框線同樣從框頂開始，
   兩個上角由左右框線補滿。線段不伸到左右框線上，瀏覽器把 1.5px 框線畫成幾個螢幕像素，角落都不會凸出或缺角 */
.webbiz-summary--inset .webbiz-summary__title::before,
.webbiz-summary--inset .webbiz-summary__title::after {
    content: "";
    margin-top: 0.7em;
    border-top: 1.5px solid var(--webbiz-summary-border, currentColor);
}

.webbiz-summary--inset .webbiz-summary__title::before {
    flex: 0 0 1.25em;
}

.webbiz-summary--inset .webbiz-summary__title::after {
    flex: 1 0 1.25em;
}

.webbiz-summary--inset .webbiz-summary__body li::marker {
    color: var(--webbiz-summary-accent, currentColor);
}

/* ---------- 書背：標題直排在左側色塊裡 ---------- */

.webbiz-summary--spine {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--webbiz-summary-accent, #1e3a5f);
}

.webbiz-summary--spine .webbiz-summary__title {
    flex: none;
    writing-mode: vertical-rl;
    text-align: center;
    padding: 1.3em 0.6em 1em;
    background-color: var(--webbiz-summary-accent, #1e3a5f);
    color: var(--webbiz-summary-on-accent, #ffffff);
    font-size: 0.95em;
    line-height: 1.2;
    letter-spacing: 0.08em;
}

/* 網站語言是中日韓文時加大字距 */
.webbiz-summary--spine .webbiz-summary__title:lang(zh),
.webbiz-summary--spine .webbiz-summary__title:lang(ja),
.webbiz-summary--spine .webbiz-summary__title:lang(ko) {
    letter-spacing: 0.3em;
}

.webbiz-summary--spine .webbiz-summary__body {
    flex: 1;
    min-width: 0;
    align-self: center;
    padding: 1em 1.25em;
}

.webbiz-summary--spine .webbiz-summary__body li::marker {
    color: var(--webbiz-summary-accent, #1e3a5f);
}
