/**
 * 傳統編輯器內文樣式（前台與後台編輯器共用同一份）
 *
 * 前台：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;
  }
}
