/* ────────────────────────────────────────────────────────────
   article.css ｜ 文章相關元件
   依賴 site.css（或 index.html 內嵌）提供的設計 token。
   這裡只用 token，不重新定義，確保首頁與文章頁共用同一套變數。
   用於：① 首頁「燈下手札」區塊 ② 文章總覽頁 ③ 單篇文章頁 ④ 推薦閱讀
   ──────────────────────────────────────────────────────────── */

/* ── 首頁手札區塊（#articles）──────────────── */
.journal {
  background: var(--bg-surface);
  border-top: 1px solid rgba(var(--line-rgb), 0.03);
  border-bottom: 1px solid rgba(var(--line-rgb), 0.03);
}
.journal-header {
  text-align: center;
  margin-bottom: clamp(3rem, 7vh, 5rem);
}
.journal-header .eyebrow { justify-content: center; }
.journal-header h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.3;
}
.journal-lede {
  max-width: 620px;
  margin: 1.5rem auto 0;
  color: var(--text-muted);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  font-weight: 300;
}
.journal-foot {
  text-align: center;
  margin-top: clamp(2.5rem, 5vh, 4rem);
}

/* ── 文章卡片格線（首頁 / 總覽 / 推薦閱讀共用）── */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 1.5rem;
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(var(--line-rgb), 0.06);
  border-radius: 3px;
  padding: 2.25rem 2rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.5s var(--ease-cinematic), border-color 0.4s ease, background 0.4s ease;
}
/* 頂部一道微光,與首頁 fear-card 呼應 */
.article-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-warm), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.article-card:hover {
  transform: translateY(-6px);
  border-color: rgba(var(--accent-warm-rgb), 0.3);
  background: var(--bg-elevated);
}
.article-card:hover::before { opacity: 0.5; }
.article-card:focus-visible { outline-offset: 5px; }

.article-cat {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  color: var(--accent-warm);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.article-cat::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}
.article-card .article-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  line-height: 1.5;
  color: var(--text-main);
  letter-spacing: 0.03em;
  transition: color 0.3s ease;
}
.article-card:hover .article-title { color: var(--accent-warm); }
.article-excerpt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.85;
  flex: 1;
}
.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.article-more {
  color: var(--text-muted);
  transition: transform 0.3s var(--ease-cinematic), color 0.3s ease;
}
.article-card:hover .article-more {
  color: var(--accent-warm);
  transform: translateX(4px);
}

/* ── 文章閱讀頁 ─────────────────────────── */
.article-main {
  /* 留出固定導覽列高度 */
  padding-top: clamp(7rem, 14vh, 10rem);
  padding-bottom: clamp(4rem, 8vh, 7rem);
  position: relative;
}
.article-wrap {
  width: min(680px, 90vw);
  margin-inline: auto;
  position: relative;
  z-index: 10;
}

/* 麵包屑：方便返回的第一道入口 */
.breadcrumb {
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 2.5rem;
  line-height: 1.8;
}
.breadcrumb a {
  color: var(--text-muted);
  transition: color 0.3s ease;
}
.breadcrumb a:hover { color: var(--accent-warm); }
.breadcrumb .sep { margin: 0 0.5rem; opacity: 0.5; }
.breadcrumb [aria-current="page"] { color: var(--text-main); }

.article-head { margin-bottom: clamp(2.5rem, 5vh, 3.5rem); }
.article-head .article-cat { margin-bottom: 1.5rem; }
.article-head h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 1.25rem;
}
.article-sub {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.7;
  margin: 0 0 1.75rem;
}
.article-meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding-top: 1.5rem;
  border-top: 1px solid rgba(var(--line-rgb), 0.08);
}

/* ── 內文 prose ─────────────────────────── */
.prose { color: var(--text-read); font-size: 1.05rem; line-height: 1.85; }
/* 先把所有直屬元素歸零,再用相鄰選擇器給穩定的段落流間距
   （單獨寫 .prose p{margin:0} 會因優先級壓過段落流,害段落黏在一起）*/
.prose > * { margin: 0; }
.prose > * + * { margin-top: 1.55rem; }
.prose h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  line-height: 1.5;
  color: var(--text-main);
  margin-top: 2.75rem;
  margin-bottom: 0;
  letter-spacing: 0.04em;
  scroll-margin-top: 6rem;
}
.prose h2::before {
  content: "";
  display: block;
  width: 32px;
  height: 1px;
  background: var(--accent-warm);
  opacity: 0.6;
  margin-bottom: 0.95rem;
}
/* 標題與緊接的首段貼近,讓段落明顯歸屬該標題 */
.prose h2 + p, .prose h2 + ul, .prose h2 + ol { margin-top: 0.9rem; }
.prose h3 + p { margin-top: 0.5rem; }
.prose h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  color: var(--text-main);
  margin-top: 2.5rem;
  margin-bottom: 0.25rem;
  letter-spacing: 0.03em;
}
.prose strong { color: var(--text-main); font-weight: 500; }
.prose em { font-style: italic; color: var(--text-main); }
.prose a {
  color: var(--accent-warm);
  border-bottom: 1px solid rgba(var(--accent-warm-rgb), 0.4);
  transition: border-color 0.3s ease, opacity 0.3s ease;
}
.prose a:hover { border-color: var(--accent-warm); opacity: 0.85; }
.prose ul, .prose ol { padding-left: 1.5rem; }
.prose li { margin-bottom: 0.6rem; padding-left: 0.35rem; line-height: 1.8; }
.prose li::marker { color: var(--accent-warm); }
.prose blockquote {
  margin: 2rem 0;
  padding: 0.5rem 0 0.5rem 1.75rem;
  border-left: 2px solid rgba(var(--accent-warm-rgb), 0.4);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-main);
}
.prose hr {
  border: none;
  border-top: 1px solid rgba(var(--line-rgb), 0.08);
  margin: 3rem 0;
}

/* 提示框（注意事項用）*/
.note {
  background: rgba(var(--accent-warm-rgb), 0.06);
  border: 1px solid rgba(var(--accent-warm-rgb), 0.2);
  border-left-width: 3px;
  border-radius: 3px;
  padding: 1.5rem 1.75rem;
  font-size: 0.98rem;
  line-height: 1.85;
  color: var(--text-read);
}
.note .note-label {
  display: block;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  color: var(--accent-warm);
  margin-bottom: 0.5rem;
}
.note p { margin: 0; }

/* ── 文末柔性 CTA（SEO → 諮詢的橋）─────────── */
.article-cta {
  margin-top: 3.5rem;
  padding: clamp(2rem, 5vw, 3rem);
  text-align: center;
  background: radial-gradient(circle at 50% 0%, rgba(var(--accent-warm-rgb), 0.08), transparent 70%), var(--bg-surface);
  border: 1px solid rgba(var(--line-rgb), 0.08);
  border-radius: 4px;
}
.article-cta h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  color: var(--text-main);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.article-cta p {
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto 2rem;
  font-size: 1rem;
}
.article-cta .btn-group { justify-content: center; }

/* ── 返回列 + 推薦閱讀 ───────────────────── */
.back-row {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(var(--line-rgb), 0.08);
}
.related { margin-top: 4rem; }
.related-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--text-main);
  text-align: center;
  margin-bottom: 2rem;
  letter-spacing: 0.1em;
}

/* ── 文章總覽頁 head ────────────────────── */
.hub-head {
  text-align: center;
  margin-bottom: clamp(3rem, 7vh, 4.5rem);
}
.hub-head .eyebrow { justify-content: center; }
.hub-head h1 {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  color: var(--text-main);
  line-height: 1.3;
}
.hub-head .journal-lede { margin-top: 1.5rem; }

@media (max-width: 600px) {
  .article-card { padding: 1.85rem 1.5rem; }
}

/* ── 文章圖庫 gallery + lightbox ─────────── */
.prose .gallery {
  margin: 2.25rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.prose .gallery-item {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(var(--line-rgb), 0.08);
  background: var(--bg-surface);
  cursor: zoom-in;
}
.prose .gallery-item:hover { border-color: rgba(var(--accent-warm-rgb), 0.45); }
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease-cinematic), filter 0.4s ease;
}
.prose .gallery-item:hover img { transform: scale(1.06); filter: brightness(1.08); }
@media (max-width: 640px) {
  .prose .gallery { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* 點圖放大檢視 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vmin;
  background: rgba(8, 9, 12, 0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox.in { opacity: 1; }
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.55);
}
