/* assets/css/prose.css — 文章內文樣式（2026-11-10；Figma 06-1文章內頁 4720:9504 的「檢測」區塊＋療程示意 4695:3444）
 *
 * 套在哪：
 *   前台：.ng-prose（single.php 衛教新知／案例故事、single-ng_treatment.php 療程文章的 the_content() 外框）
 *   後台：.editor-styles-wrapper（區塊編輯器畫布），所見即所得。
 *   兩邊都用 :is(.ng-prose, .editor-styles-wrapper) 開頭。載入方式見 functions.php §15（前台只在文章頁載、後台用 enqueue_block_assets）。
 *
 * ⚠️ 後台畫布沒有載 style.css，:root 的色票變數不存在，所以每個 var() 都帶後備色碼（和 style.css :root 同值）。
 *    改色票時兩邊一起改。
 *
 * 使用者 2026-11-10 定案：
 *   - H2 30（主色、自動帶 5px 強調色左條）；H3～H6 28／26／24／22 內文色；字距 0.1em。手機（≤759）28／22／20／18／16。
 *   - 內文段落 16px、400、行高 2.0、字距 0.05em（全站內文標準；設計稿標 18 不採用）。
 *   - 衛教新知、案例故事、療程文章三種共用這一份。
 */

:is(.ng-prose, .editor-styles-wrapper) {
  color: var(--color-text, #3E3E3E);
  font-family: "Noto Sans TC", sans-serif;
  font-size: 1rem; font-weight: 400; line-height: 2; letter-spacing: .05em;
}

/* 左右外距歸零只給前台（瀏覽器預設 blockquote／figure 左右各 40）。
   ⚠️ 不能寫進 .editor-styles-wrapper：編輯器靠 auto 左右外距把每個區塊置中在內容寬度裡，
   寫 0 會讓引文、詩句、表格、圖片貼到畫布最左邊，和段落對不齊（使用者 2026-11-10 回報）。 */
.ng-prose :is(.wp-block-quote, .wp-block-pullquote, .wp-block-verse, .wp-block-image, .wp-block-table, figure, blockquote) { margin-inline: 0; }

/* ── 垂直節奏：區塊之間 24（用 rem，不跟著區塊自己的字級變）；標題前 60、標題到內文 20（療程示意稿） ── */
.ng-prose > * { margin-block: 0; }
.ng-prose > * + * { margin-top: 1.5rem; }
.ng-prose > :is(h2, h3, h4, h5, h6):not(:first-child) { margin-top: 60px; }
.ng-prose > :is(h2, h3, h4, h5, h6) + * { margin-top: 20px; }

:is(.ng-prose, .editor-styles-wrapper) :is(p, li, td, th, dd, dt) {
  font-size: 1rem; font-weight: 400; line-height: 2; letter-spacing: .05em;
}
:is(.ng-prose, .editor-styles-wrapper) p { margin-bottom: 0; }

/* ── 標題 H2～H6（4720:9562）── */
:is(.ng-prose, .editor-styles-wrapper) :is(h2, h3, h4, h5, h6) {
  color: var(--color-text, #3E3E3E); font-weight: 700; line-height: 1.5; letter-spacing: .1em;
}
:is(.ng-prose, .editor-styles-wrapper) h2 {
  padding-left: 15px; border-left: 5px solid var(--color-accent, #E638A4);
  color: var(--color-main, #14426A); font-size: 1.875rem;   /* 30 */
}
:is(.ng-prose, .editor-styles-wrapper) h3 { font-size: 1.75rem; }    /* 28 */
:is(.ng-prose, .editor-styles-wrapper) h4 { font-size: 1.625rem; }   /* 26 */
:is(.ng-prose, .editor-styles-wrapper) h5 { font-size: 1.5rem; }     /* 24 */
:is(.ng-prose, .editor-styles-wrapper) h6 { font-size: 1.375rem; }   /* 22 */

/* ── 行內：粗體、斜體、刪除線照內文色；連結強調色＋底線（4720:9581～9585）── */
:is(.ng-prose, .editor-styles-wrapper) :is(strong, b) { font-weight: 700; }
:is(.ng-prose, .editor-styles-wrapper) a:not(.wp-block-button__link) {
  color: var(--color-accent, #E638A4); text-decoration: underline; text-underline-offset: 3px;
}
:is(.ng-prose, .editor-styles-wrapper) a:not(.wp-block-button__link):hover { color: var(--color-accent-hover, #BA0F79); }
:is(.ng-prose, .editor-styles-wrapper) code { font-family: inherit; }   /* 稿上「embed in code」和內文同字型 */

/* ── 清單（4720:9591）：條列用「・」，編號照常；縮排 27 ── */
/* ⚠️ 這裡不寫 margin-block：權重和上面「標題到下一塊 20」「區塊之間 24」相同又排在後面，會把清單的上距蓋成 0
      （使用者 2026-11-10 回報 H2 到清單太近）。直接子層的上下外距已由 .ng-prose > * 管，巢狀清單由下面 li > :is(ul, ol) 管。 */
:is(.ng-prose, .editor-styles-wrapper) :is(ul, ol) { padding-left: 27px; }
/* 框、表格、引文裡的清單不要瀏覽器預設的上下 1em（審查 877f1de 建議）。用 :where() 權重 0，
   .ng-prose 直接子層的「區塊之間 24」「標題到下一塊 20」仍會蓋過它。只給前台：編輯器的區塊間距規則也是權重 0，不去碰。 */
:where(.ng-prose) :where(ul, ol) { margin-block: 0; }
:is(.ng-prose, .editor-styles-wrapper) ul { list-style: none; }
:is(.ng-prose, .editor-styles-wrapper) ul > li { position: relative; }
:is(.ng-prose, .editor-styles-wrapper) ul > li::before { content: "・"; position: absolute; left: -1.2em; }
:is(.ng-prose, .editor-styles-wrapper) ol > li::marker { font-weight: 700; }
:is(.ng-prose, .editor-styles-wrapper) li > :is(ul, ol) { margin-top: 0; }

/* ── 小引文＝預設的引文（core/quote，4720:9508）：左 5px 強調色條、間距 15、18 Bold ── */
:is(.ng-prose, .editor-styles-wrapper) .wp-block-quote {
  padding: 0 0 0 15px; border-left: 5px solid var(--color-accent, #E638A4);
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-quote :is(p, li) { font-size: 1.125rem; font-weight: 700; line-height: 1.85; letter-spacing: .1em; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-quote cite,
:is(.ng-prose, .editor-styles-wrapper) .wp-block-pullquote cite {
  display: block; margin-top: 10px; color: var(--color-muted, #6D7078); font-size: .875rem; font-style: normal; font-weight: 400;
}

/* ── 重要引文（引文的「重要引文」樣式＋core/pullquote，4720:9553）：
      上下 2px 強調色線、上方 40 的圓形標誌、20 Bold 置中 ── */
:is(.ng-prose, .editor-styles-wrapper) :is(.wp-block-quote.is-style-ng-key, .wp-block-pullquote) {
  padding: 30px 0; border: 0;
  border-top: 2px solid var(--color-accent, #E638A4); border-bottom: 2px solid var(--color-accent, #E638A4);
  text-align: center;
}
:is(.ng-prose, .editor-styles-wrapper) :is(.wp-block-quote.is-style-ng-key, .wp-block-pullquote)::before {
  content: ""; display: block; width: 40px; height: 40px; margin: 0 auto 10px;
  background: url("../img/about-mark.svg") center / contain no-repeat;
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-pullquote blockquote { margin: 0; padding: 0; border: 0; }
:is(.ng-prose, .editor-styles-wrapper) :is(.wp-block-quote.is-style-ng-key, .wp-block-pullquote) p {
  font-size: 1.25rem; font-weight: 700; line-height: 1.85; letter-spacing: .1em;
}
/* 重要引文的「引述內容」（編輯器裡標題下方那一欄，HTML 是 cite）：16 內文色（使用者 2026-11-10 指定；小引文的 cite 維持 14 次要灰） */
:is(.ng-prose, .editor-styles-wrapper) :is(.wp-block-quote.is-style-ng-key, .wp-block-pullquote) cite {
  color: var(--color-text, #3E3E3E); font-size: 1rem; line-height: 2;
}

/* ── 詩句（core/verse）：淺灰底、圓角 5、18 Bold 主色，前後加引號
      使用者 2026-11-10 改用療程示意稿的引言樣式（4695:4495），取代文章稿 4720:9590 的淺粉底 Medium 深藍；字級使用者指定 18（稿 20） ── */
:is(.ng-prose, .editor-styles-wrapper) .wp-block-verse {
  padding: 10px 20px; border-radius: 5px; background: var(--color-bg-alt, #F3F5F7);
  color: var(--color-main, #14426A); font-family: inherit;
  font-size: 1.125rem; font-weight: 700; line-height: 1.85; letter-spacing: .05em; white-space: pre-wrap;
}
.ng-prose .wp-block-verse::before { content: "“ "; }
.ng-prose .wp-block-verse::after { content: " ”"; }

/* ── 重點框（群組的「重點框」樣式；療程示意 4695:4493）：2px 強調色虛線、圓角 5、內距 20 ── */
:is(.ng-prose, .editor-styles-wrapper) .wp-block-group.is-style-ng-highlight {
  padding: 20px; border: 2px dashed var(--color-accent, #E638A4); border-radius: 5px;
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-group.is-style-ng-highlight > * + * { margin-top: 1em; }

/* ── 分隔線（core/separator，4720:9560）：1px 次要灰 ── */
:is(.ng-prose, .editor-styles-wrapper) hr.wp-block-separator,
.ng-prose hr {
  height: 0; margin-block: 40px; border: 0; border-top: 1px solid var(--color-muted, #6D7078); opacity: 1;
}

/* ── 圖片、圖說、圖庫（4720:9570）：圖說 14 Regular、行高 1.5、次要灰；圖庫間距 10 ── */
:is(.ng-prose, .editor-styles-wrapper) .wp-block-image img { height: auto; }
:is(.ng-prose, .editor-styles-wrapper) figcaption,
:is(.ng-prose, .editor-styles-wrapper) .wp-element-caption {
  margin: 10px 0 0; color: var(--color-muted, #6D7078); font-size: .875rem; line-height: 1.5; letter-spacing: .05em; text-align: left;
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-gallery { --wp--style--gallery-gap-default: 10px; gap: 10px; }

/* ── 表格（稿上沒有；定稿有三欄比較表）：表頭淺灰底主色粗體、1px 卡片灰框。
   不超出畫面（使用者 2026-11-17：正式站手機要左右滑才看得到，改掉）：表格寬度跟著內文欄、不設最小寬，
   儲存格裡的長字（網址、英文）可以斷行；手機內距縮小。overflow-x 只留著當保險（真的放不下時才捲）。 ── */
:is(.ng-prose, .editor-styles-wrapper) .wp-block-table { overflow-x: auto; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-table table { width: 100%; border-collapse: collapse; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-table :is(th, td) {
  padding: 10px 15px; border: 1px solid var(--color-brand-card-base, #8DA9C4); vertical-align: top; text-align: left; line-height: 1.85;
  overflow-wrap: anywhere;
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-table thead { border-bottom: 0; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-table th,
:is(.ng-prose, .editor-styles-wrapper) .wp-block-table thead td {
  background: var(--color-bg-alt, #F3F5F7); color: var(--color-main, #14426A); font-weight: 700;
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-table :is(th, td) :is(ul, ol) { padding-left: 1.4em; }

/* ── 按鈕（core/button，4720:9593）：主色底白字、內距 15×20、圓角 5、18 Medium；滑過換強調色 ── */
:is(.ng-prose, .editor-styles-wrapper) .wp-block-button__link {
  padding: 15px 20px; border-radius: 5px; background: var(--color-main, #14426A); color: #fff;
  font-size: 1.125rem; font-weight: 500; line-height: 1; letter-spacing: .05em; text-decoration: none;
  transition: background .2s ease-out;
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-button__link:hover { background: var(--color-accent, #E638A4); color: #fff; }

/* ── FAQ（core/details）：同門診資訊頁 FAQ 的開合樣式（全形＋／－、展開主色底白字） ── */
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details {
  border: 1px solid var(--color-brand-card-base, #8DA9C4); border-radius: 5px; overflow: hidden;
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details + .wp-block-details { margin-top: -1px; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details > summary {
  display: flex; gap: 10px; align-items: baseline; padding: 15px 22px; list-style: none; cursor: pointer;
  color: var(--color-text, #3E3E3E); font-weight: 500; line-height: 1.5;
}
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details > summary::-webkit-details-marker { display: none; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details > summary::before { content: "＋"; content: "＋" / ""; flex: none; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details[open] > summary { background: var(--color-main, #14426A); color: #fff; font-weight: 700; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details[open] > summary::before { content: "－"; content: "－" / ""; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details > :not(summary) { margin: 0; padding: 10px 22px; background: var(--color-bg-alt, #F3F5F7); }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details > summary + * { padding-top: 15px; }
:is(.ng-prose, .editor-styles-wrapper) .wp-block-details > :not(summary):last-child { padding-bottom: 15px; }

/* ── 醫師的話（blocks/doctor-quote，4720:9622）：頭像 150 ｜ 對話框（--color-line 底、16 白字、左邊小三角）；名字在頭像下 ── */
.ng-doctor-quote { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; column-gap: 23px; }
.ng-doctor-quote__who { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ng-doctor-quote__photo { display: block; width: 150px; height: 150px; border-radius: 50%; object-fit: cover; }
.ng-doctor-quote__name { margin: 0; color: var(--color-main, #14426A); font-size: 1.125rem; font-weight: 700; line-height: 1.85; letter-spacing: 0; text-align: center; }
.ng-doctor-quote__bubble {
  position: relative; margin: 0; padding: 20px 30px; border-radius: 5px; background: var(--color-line, #3D6D97);
  color: #fff; font-size: 1rem; line-height: 1.85; letter-spacing: .05em; text-align: justify;
}
.ng-doctor-quote__bubble::before {   /* 指向頭像的小三角（稿 14×18） */
  content: ""; position: absolute; top: 50%; left: -13px; translate: 0 -50%;
  border-block: 9px solid transparent; border-right: 14px solid var(--color-line, #3D6D97);
}
.ng-doctor-quote__bubble p { margin: 0; color: inherit; line-height: inherit; }
.ng-doctor-quote__bubble p + p { margin-top: .8em; }

/* ── 手機（≤759，同 style.css §5 的斷點）── */
@media (max-width: 759px) {
  :is(.ng-prose, .editor-styles-wrapper) h2 { font-size: 1.75rem; }    /* 28 */
  :is(.ng-prose, .editor-styles-wrapper) h3 { font-size: 1.375rem; }   /* 22 */
  :is(.ng-prose, .editor-styles-wrapper) h4 { font-size: 1.25rem; }    /* 20 */
  :is(.ng-prose, .editor-styles-wrapper) h5 { font-size: 1.125rem; }   /* 18 */
  :is(.ng-prose, .editor-styles-wrapper) h6 { font-size: 1rem; }       /* 16 */
  .ng-prose > :is(h2, h3, h4, h5, h6):not(:first-child) { margin-top: 48px; }
  :is(.ng-prose, .editor-styles-wrapper) .wp-block-table :is(th, td) { padding: 8px 10px; }   /* 表格擠進手機寬，內距縮小（字仍 16） */
  /* 醫師的話：頭像縮成 100、對話框改到下面，三角朝上 */
  .ng-doctor-quote { grid-template-columns: minmax(0, 1fr); row-gap: 20px; }
  .ng-doctor-quote__photo { width: 100px; height: 100px; }
  .ng-doctor-quote__bubble { padding: 16px 20px; }
  .ng-doctor-quote__bubble::before {
    top: -13px; left: 50%; translate: -50% 0;
    border-block: 0; border-inline: 9px solid transparent; border-bottom: 14px solid var(--color-line, #3D6D97); border-right-color: transparent;
  }
}
