/**
 * 傳統編輯器內文樣式（前台與後台編輯器共用同一份）
 *
 * 前台：the_content() 外層加上 class="huProse"
 * 後台：TinyMCE 編輯區 <body> 也有 .huProse（includes/designhu-editor.php）
 * 顏色、字體、字級變數由 includes/designhu-editor.php 的 hu_editor_config() 輸出（--hu-prose-*），
 * 這裡只寫規則；換專案時改 hu_editor_config() 即可，不必改這個檔案。
 *
 * 注意主題的 Tailwind base 有 * { color; font-family } 與 p、a、h1~h6 的字級設定，
 * 這裡的規則需能覆蓋它們（見 :where 與 a 的 line-height）。
 */

/* ---------- 基本文字 ---------- */
.huProse {
  font-family: var(--hu-prose-font, "Noto Sans TC", sans-serif);
  font-size: var(--hu-prose-size, 17px);
  font-weight: 400;
  line-height: var(--hu-prose-line-height, 1.8);
  letter-spacing: var(--hu-prose-letter-spacing, 1px);
  color: var(--hu-prose-text, #222);
  word-break: break-word;
}

/* 子元素一律繼承（覆蓋主題 * { color; font-family }）
   :where() 讓權重只有 .huProse 一層，下方 h2、a 等設定可正常覆蓋 */
.huProse :where(*) {
  color: inherit;
  font-family: inherit;
  letter-spacing: inherit;
}

.huProse > *:first-child {
  margin-top: 0;
}
.huProse > *:last-child {
  margin-bottom: 0;
}

.huProse p,
.huProse li,
.huProse td,
.huProse th,
.huProse dd,
.huProse dt {
  font-size: var(--hu-prose-size, 17px);
  line-height: var(--hu-prose-line-height, 1.8);
}

.huProse p {
  margin: 0 0 1em;
}

/* ---------- 標題 ---------- */
.huProse h1,
.huProse h2,
.huProse h3,
.huProse h4,
.huProse h5,
.huProse h6 {
  margin: 1.6em 0 0.6em;
  line-height: 1.5;
}

.huProse h1,
.huProse h2 {
  font-size: 26px;
  font-weight: 500;
  color: var(--hu-prose-heading, #222);
}

.huProse h3 {
  font-size: 22px;
  font-weight: 400;
  color: var(--hu-prose-text, #222);
}

.huProse h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--hu-prose-text, #222);
}

.huProse h5,
.huProse h6 {
  font-size: 16px;
  font-weight: 700;
  color: var(--hu-prose-muted, #999);
}

/* ---------- 行內 ---------- */
.huProse strong,
.huProse b {
  font-weight: 700;
}

.huProse em,
.huProse i {
  font-style: italic;
}

.huProse a {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit; /* 主題 a 預設 line-height 100%，內文需跟隨段落 */
  color: var(--hu-prose-link, #222);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.3s;
}
.huProse a:hover {
  color: var(--hu-prose-link-hover, #999);
}

.huProse del,
.huProse s {
  text-decoration: line-through;
}

.huProse sup,
.huProse sub {
  font-size: 0.7em;
}

/* ---------- 清單 ---------- */
.huProse ul,
.huProse ol {
  margin: 0 0 1em;
  padding-left: 1.6em;
}
.huProse ul {
  list-style: disc;
}
.huProse ol {
  list-style: decimal;
}
.huProse ul ul {
  list-style: circle;
}
.huProse li {
  margin: 0.2em 0;
}
.huProse li::marker {
  color: var(--hu-prose-accent, #222);
}

/* ---------- 引言、分隔線 ---------- */
.huProse blockquote {
  margin: 1.4em 0;
  padding: 16px 24px;
  border-left: 3px solid var(--hu-prose-accent, #222);
  background: var(--hu-prose-bg, #f5f5f5);
}
.huProse blockquote p:last-child {
  margin-bottom: 0;
}

.huProse hr {
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--hu-prose-line, #ddd);
}

/* ---------- 表格 ---------- */
.huProse table {
  width: 100%;
  margin: 1.4em 0;
  border-collapse: collapse;
}
.huProse th,
.huProse td {
  padding: 10px 14px;
  border: 1px solid var(--hu-prose-line, #ddd);
  text-align: left;
  vertical-align: top;
}
.huProse th,
.huProse thead td {
  background: var(--hu-prose-bg, #f5f5f5);
  font-weight: 700;
}

/* ---------- 圖片（編輯器的對齊按鈕） ---------- */
.huProse img {
  max-width: 100%;
  height: auto;
}
.huProse .alignleft {
  float: left;
  margin: 0.4em 1.5em 1em 0;
}
.huProse .alignright {
  float: right;
  margin: 0.4em 0 1em 1.5em;
}
.huProse .aligncenter {
  display: block;
  margin: 1em auto;
}
.huProse .wp-caption {
  max-width: 100%;
}
.huProse .wp-caption-text {
  margin-top: 6px;
  font-size: 14px;
  color: var(--hu-prose-muted, #999);
  text-align: center;
}
.huProse::after {
  content: "";
  display: table;
  clear: both;
}

/* ---------- 編輯器「樣式」下拉選單 ---------- */
.huProse .huProse-lead {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--hu-prose-accent, #222);
}

.huProse .huProse-note {
  font-size: 14px;
  color: var(--hu-prose-muted, #999);
}

.huProse .huProse-box {
  margin: 1.4em 0;
  padding: 20px 24px;
  border-radius: 10px;
  background: var(--hu-prose-bg, #f5f5f5);
}

.huProse .huProse-tag {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 10px;
  background: var(--hu-prose-accent, #222);
  color: #fff;
  font-weight: 700;
}

.huProse a.huProse-btn {
  display: inline-block;
  padding: 8px 28px;
  border-radius: 60px;
  background: var(--hu-prose-btn, #222);
  color: #fff;
  text-decoration: none;
}
.huProse a.huProse-btn:hover {
  color: #fff;
  opacity: 0.85;
}

/* ---------- 手機 ---------- */
@media (max-width: 768px) {
  .huProse,
  .huProse p,
  .huProse li,
  .huProse td,
  .huProse th {
    font-size: var(--hu-prose-size-mobile, 15px);
  }
  .huProse h1,
  .huProse h2 {
    font-size: 22px;
  }
  .huProse h3 {
    font-size: 18px;
  }
  .huProse h4 {
    font-size: 16px;
  }
  .huProse .alignleft,
  .huProse .alignright {
    float: none;
    margin: 1em auto;
  }
}

/* ---------- 66 CHEESECAKE（Figma 最新消息內頁） ---------- */
.huProse h2 {
  position: relative;
  padding-left: 24px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 1px;
}
/* H2 左側黃色水滴（Figma Icon/Inline Drop 12×16，與文字間距 12） */
.huProse h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9.5px;
  width: 12px;
  height: 16px;
  background: url("../images/common/icon-drop.svg") no-repeat center / contain;
}
.huProse h3 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}
.huProse table {
  border-radius: 12px;
  overflow: hidden;
}
.huProse th {
  background: #40220f;
  color: #fffbf4;
  font-weight: 700;
}

/* ---------- 最新消息文章（.huProse--post，Figma NEWS 最新消息內頁 17688:12901） ----------
   內文棕色、段落間距 24、節與節間距 60；後台文章編輯區也有這個 class（designhu-editor.php） */
.huProse--post {
  color: #7c4b3b;
}
.huProse--post p {
  margin: 0 0 24px;
}
.huProse--post h2 {
  margin: 60px 0 24px;
  color: #40220f;
}
/* 導言（樣式選單「強調標語」）：中文/Lead 18px Medium 深棕，後面接的段落間距 16 */
.huProse--post .huProse-lead {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.8;
  letter-spacing: 1px;
  color: #40220f;
}
.huProse--post .huProse-lead + p {
  margin-top: -8px;
}

/* 編號小標（中標題）：01 看乳酪來源與乳含量／Q1：問題 */
.huProse--post h3 {
  margin: 24px 0 12px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.5px;
  color: #40220f;
}
.huProse .huProse-num {
  margin-right: 8px;
  font-family: Philosopher, serif;
  font-size: 20px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 1.5px;
  color: #40220f;
}

/* 表格（Figma 總覽表／乳種比較表）：深棕表頭、白底列、只有橫線 */
.huProse--post table {
  margin: 0 0 24px;
}
.huProse--post th,
.huProse--post td {
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--hu-prose-line, #fae6b4);
}
.huProse--post th,
.huProse--post thead td {
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 2.5px;
  color: #fffbf4;
  background: #40220f;
}
.huProse--post td {
  background: #fff;
  color: #7c4b3b;
}
.huProse--post td:first-child {
  color: #40220f;
}
.huProse--post tr:last-child td {
  border-bottom: 0;
}

/* 品牌卡片（樣式選單「品牌卡片」）：淡黃底圓角 12；中標題＝編號＋品牌名，段落＝「粗體標籤＋內容」 */
.huProse .huProse-card {
  margin: 0 0 24px;
  padding: 24px;
  border-radius: 12px;
  background: #fdf6e6;
}
.huProse .huProse-card h3 {
  display: flex;
  align-items: center;
  margin: 0 0 16px;
  padding: 0 0 12px 4px;
  border-bottom: 1px solid var(--hu-prose-line, #fae6b4);
  font-size: 20px;
  letter-spacing: 1px;
}
.huProse .huProse-card h3 .huProse-num {
  margin-right: 12px;
}
.huProse .huProse-card p {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}
.huProse .huProse-card p:last-child {
  margin-bottom: 0;
}
.huProse .huProse-card p > strong:first-child {
  flex-shrink: 0;
  width: 72px;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 2.5px;
  color: #7c4b3b;
}
/* 卡片內連結（官網）：底線按鈕＋右上箭頭（Figma Button Type=Link） */
.huProse .huProse-card a {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 0 2px 4px;
  border-bottom: 1px solid #7c4b3b;
  text-decoration: none;
  word-break: break-all;
}
.huProse .huProse-card a::after {
  content: "";
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  background: url("../images/common/arrow-12.svg") no-repeat center / contain;
}

/* 影片（designhu-66.php 的 YouTube 封面）：上方間距 60（與卡片 margin 重疊取大者），iframe 換上後同尺寸 */
.huProse .huVideo iframe {
  border: 0;
}

@media (max-width: 768px) {
  .huProse--post h2 {
    margin-top: 40px;
  }
  .huProse .huVideo {
    margin-top: 40px;
  }
  /* 四欄表格在手機改為左右滑動 */
  .huProse--post table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  .huProse .huProse-card {
    padding: 20px;
  }
  .huProse .huProse-card p {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}
