/*
Theme Name: 台灣分析師聯盟
Theme URI: https://intsmtin.com/
Author: 台灣分析師聯盟
Description: 復刻自台灣分析師聯盟靜態站的自訂主題。人物誌使用「人物（person）」自訂文章類型，專區長文使用「專區（topic）」自訂文章類型，視覺完全沿用原站設計系統（深藍 #20364d／米白 #f5f3ee／琥珀 #c88d3e）。不依賴任何外掛。
Version: 1.3.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: intsmtin
Tags: custom-menu, custom-logo, featured-images, translation-ready
*/

/* ==========================================================================
   本檔案只放「WordPress 專用補丁」。
   原站的完整設計系統在 assets/css/site.css（由原 assets/style.css 逐字搬過來），
   首頁楊雲翔專區 .yyx-* 在 assets/css/home.css。
   載入順序：site.css → home.css（僅首頁）→ 本檔案。
   ========================================================================== */

/* ---------- 原站 CSS 的相對路徑修正 ---------- */
/* assets/css/site.css 是從原站 assets/style.css 逐字搬過來的（保持不動），
   但兩者所在目錄不同，原站的相對路徑會失效：

     原站  assets/style.css   →  url("../assets/home-hero.jpg")  解析成 /assets/home-hero.jpg ✅
     主題  assets/css/site.css →  url("../assets/home-hero.jpg")  解析成 /assets/assets/…❌

   首頁主視覺（.hero-visual 的背景圖）就是這張，只修這一條。 */
.hero-visual {
  background-image: url("assets/img/home-hero.jpg?v=20261013");
}

/* ---------- WordPress 導覽選單輸出結構 ---------- */
/* 原站的導覽是 <nav> 直接包一排 <a>（間距掛在 .main-nav 的 gap 上），
   inc/template-tags.php 的 intsmtin_nav() 就照這個結構輸出，不用 wp_nav_menu 的
   <ul><li>，所以這裡不需要任何 li 重置 —— 留著反而可能蓋掉 site.css 的間距。
   僅防禦性移除瀏覽器對 nav 內 ul 的預設樣式。*/
.main-nav ul,
.home-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------- WordPress 內容過濾器輸出 ---------- */
/* 匯入內容是「已排版好的 HTML」，關閉 wpautop / wptexturize 才不會被二次改寫。
   只對匯入的貼文生效（_intsmtin_raw_html = 1），一般新寫的貼文照常自動排版。*/
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.alignleft {
  float: left;
  margin: 0 24px 18px 0;
}
.alignright {
  float: right;
  margin: 0 0 18px 24px;
}
.aligncenter {
  display: block;
  margin: 0 auto 20px;
}
.wp-caption {
  max-width: 100%;
}

/* ---------- 內頁（部落格 / 搜尋結果）列表 ---------- */
/* 原站沒有文章列表樣式，這裡補一個與設計系統一致的版本。*/
.post-list {
  padding: 0 var(--pad-x) 80px;
}
.post-list-inner {
  max-width: 880px;
  margin: 0 auto;
}
.post-list-inner article {
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}
.post-list-inner .entry-kicker {
  margin: 0 0 10px;
  color: var(--gold-deep);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.25em;
}
.post-list-inner .entry-title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
}
.post-list-inner .entry-title a {
  color: var(--ink);
  text-decoration: none;
}
.post-list-inner .entry-title a:hover {
  color: var(--gold-deep);
}
.post-list-inner .entry-meta {
  margin: 0 0 14px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.1em;
}
.post-list-inner .entry-summary {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 2.1;
  letter-spacing: 0.04em;
  color: #46586b;
}
.empty-state {
  max-width: 880px;
  margin: 0 auto;
  padding: 90px 0 110px;
  text-align: center;
}
.empty-state p {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 2.1;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 40px 0 0;
}
.pagination .page-numbers {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-decoration: none;
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

/* ---------- 首頁：最新文章（5 篇全文） ---------- */
/* 內容由 inc/template-tags.php 的 intsmtin_home_latest_posts() 輸出。
   全部掛在 .latest-posts 命名空間下，不影響其他 24 頁；
   正文排版刻意與 .page-body-inner 對齊（同一套字級與行高），但獨立命名，
   以後改內頁樣式不會連帶改到首頁。*/
.latest-posts {
  padding: 80px var(--pad-x) 96px;
  background: var(--paper-alt);
  border-top: 1px solid var(--line);
}
.latest-posts-inner {
  max-width: 880px;
  margin: 0 auto;
}

.latest-posts-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 20px;
  padding-bottom: 22px;
  border-bottom: 2px solid var(--ink);
}
.latest-posts-kicker {
  flex: 0 0 100%;
  margin: 0;
  color: var(--gold-deep);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
}
.latest-posts-head h2 {
  flex: 1 1 auto;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.latest-posts-all {
  flex: 0 0 auto;
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-decoration: none;
}
.latest-posts-all:hover {
  color: var(--gold-deep);
}

.latest-post {
  padding: 40px 0 44px;
  border-bottom: 1px solid var(--line);
}
.latest-post:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.latest-post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}
.latest-post-index {
  color: var(--gold);
  font-weight: 700;
}
.latest-post-cats::before {
  content: "·";
  margin-right: 9px;
  color: var(--line-strong);
}
.latest-post-title {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.05em;
}
.latest-post-title a {
  color: var(--ink);
  text-decoration: none;
}
.latest-post-title a:hover {
  color: var(--gold-deep);
}

.latest-post-body {
  font-family: var(--serif);
  letter-spacing: 0.04em;
  color: #46586b;
}
.latest-post-body > *:first-child {
  margin-top: 0;
}
.latest-post-body p {
  margin: 0 0 18px;
  font-size: 15.5px;
  line-height: 2.15;
}
.latest-post-body h2 {
  margin: 36px 0 14px;
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.latest-post-body h3 {
  margin: 28px 0 12px;
  font-family: var(--serif);
  font-size: clamp(17px, 1.8vw, 20px);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}
/* 內文標題在首頁會整體下移兩級，文章的主要小節因此落在 h4，這裡把 h4 做得像正常小節。 */
.latest-post-body h4 {
  margin: 32px 0 12px;
  font-family: var(--serif);
  font-size: clamp(19px, 2vw, 23px);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.latest-post-body h5 {
  margin: 26px 0 10px;
  font-family: var(--serif);
  font-size: clamp(16px, 1.7vw, 18px);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink);
}
.latest-post-body h6 {
  margin: 22px 0 10px;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink);
}
.latest-post-body ul,
.latest-post-body ol {
  margin: 0 0 18px;
  padding-left: 22px;
}
.latest-post-body li {
  margin-bottom: 9px;
  font-size: 15.5px;
  line-height: 2.1;
}
.latest-post-body a {
  color: var(--gold-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.latest-post-body strong {
  color: var(--ink);
}
.latest-post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px auto;
}
.latest-post-body figure {
  margin: 24px 0;
}
.latest-post-body figcaption {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  text-align: center;
}
.latest-post-body blockquote {
  margin: 24px 0;
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--gold);
  color: var(--ink-mute);
}
.latest-post-body blockquote p:last-child {
  margin-bottom: 0;
}
.latest-post-body table {
  width: 100%;
  margin: 24px 0;
  border-collapse: collapse;
  font-size: 14px;
}
.latest-post-body th,
.latest-post-body td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.latest-post-body th {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
}
.latest-post-body hr {
  margin: 32px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.latest-post-body pre {
  overflow-x: auto;
  margin: 24px 0;
  padding: 16px 18px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.7;
}
.latest-post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

@media screen and (max-width: 760px) {
  .latest-posts {
    padding: 56px var(--pad-x) 64px;
  }
  .latest-posts-head {
    gap: 6px 12px;
  }
  .latest-post {
    padding: 32px 0 34px;
  }
  .latest-post-body p,
  .latest-post-body li {
    font-size: 15px;
    line-height: 2.05;
  }
  /* 內文表格在手機上橫向捲動，不撐破版面 */
  .latest-post-body table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ---------- 文章單頁（single.php） ---------- */
/* 頁首與正文直接沿用 .page-hero / .page-body，這裡只補「文章特有」的部分
   （kicker、日期分類、圖片與表格、回列表）。*/
.post-single-hero .post-single-kicker {
  margin: 0;
  color: var(--gold-soft);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
}
.post-single-hero h1 {
  margin: 16px 0 0;
}
.post-single-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 22px 0 0;
  color: var(--copy);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
}
.post-single-cats::before {
  content: "·";
  margin-right: 9px;
  color: var(--gold-soft);
}

.post-single-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 28px auto;
}
.post-single-body figure {
  margin: 28px 0;
}
.post-single-body figcaption {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  text-align: center;
}
.post-single-body blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 20px;
  border-left: 2px solid var(--gold);
  color: var(--ink-mute);
}
.post-single-body blockquote p:last-child {
  margin-bottom: 0;
}
.post-single-body table {
  width: 100%;
  margin: 28px 0;
  border-collapse: collapse;
  font-size: 14.5px;
}
.post-single-body th,
.post-single-body td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.post-single-body th {
  background: var(--paper-alt);
  color: var(--ink);
  font-weight: 600;
}
.post-single-body hr {
  margin: 36px 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.post-single-body pre {
  overflow-x: auto;
  margin: 28px 0;
  padding: 16px 18px;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.7;
}
.post-single-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.post-single-body a {
  color: var(--gold-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-single-foot {
  max-width: 880px;
  margin: 44px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.post-single-foot a {
  color: var(--ink-mute);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-decoration: none;
}
.post-single-foot a:hover {
  color: var(--gold-deep);
}

@media screen and (max-width: 760px) {
  .post-single-hero h1 {
    font-size: clamp(28px, 7vw, 40px);
  }
  .post-single-body table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ---------- 後台工具列 ---------- */
body.admin-bar .topbar {
  margin-top: 32px;
}
@media screen and (max-width: 782px) {
  body.admin-bar .topbar {
    margin-top: 46px;
  }
}