/* ============================================================
 * Grovyn Blog · List/Archive 樣式（從 blog.css 拆出）
 * 涵蓋：Header + Hero featured + Blog section + Card grid + Pagination + Eyebrow/Crumb
 * 適用：home / category / tag / sense taxonomy
 * 拆檔日期：2026-05-19
 * ============================================================ */

/* ============================================================
 * 縮時森林 · Blog · v3
 * Editorial × Cinematic × Botanical
 * Adapted from internal demo (React → PHP),
 * compatible with main site header/footer (uses .grovyn-blog-frame instead of .page-frame)
 * ============================================================ */

/* Blog 區外殼 — 在主站 header / footer 之間提供置中 max-width 框架
   padding-top 預留主站 fixed header（top:16 + height:54 = 70px）的空間 + 呼吸 */
.grovyn-blog-frame {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(96px, 8vw, 130px) 24px 48px;
  background: #F5F1EC; /* 霧色（mist）— 統一輕霧調 */
  color: var(--ts-navy);
  font-family: var(--ts-font-sans-zh);
}
@media (max-width: 720px) { .grovyn-blog-frame { padding: 90px 12px 32px; } }

/* 整站套用 blog 系列頁時的 body 底色 */
body.grovyn-blog-page { background: #F5F1EC; }

/* ============================================================
 * HERO FEATURED — fullscreen cinematic（跳出 max-width container）
 * ============================================================ */
.hero-feature {
  position: relative;
  /* 跳出 .grovyn-blog-frame 的 max-width: 1240px + padding: 24px */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-top: clamp(-130px, -8vw, -96px); /* 抵消 frame 的 padding-top，讓 hero 真的貼到頁首底下 */
  height: 100vh;
  min-height: 600px;
  border-radius: 0;
  overflow: hidden;
  background: var(--ts-forest-deep);
  cursor: pointer;
  isolation: isolate;
  display: block;
  text-decoration: none;
  color: inherit;
}
@media (max-width: 720px) {
  .hero-feature {
    height: 70vh;
    min-height: 480px;
    margin-top: -90px;
  }
}
/* Scroll cue — 提示繼續滾 */
.hero-feature::after {
  content: "Scroll ↓";
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-family: var(--ts-font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: rgba(238, 234, 231, 0.72);
  animation: hero-cue-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes hero-cue-pulse {
  0%, 100% { opacity: 0.35; transform: translate(-50%, 0); }
  50%      { opacity: 1;    transform: translate(-50%, 4px); }
}
body.grovyn-anim-ready .hero-feature[data-cue-fade="true"]::after { opacity: 0; transition: opacity 400ms; }

.hero-feature img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: transform var(--ts-dur-drift) var(--ts-ease-natural);
}
.hero-feature:hover img { transform: scale(1.02); }

.hero-feature::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(40, 44, 60, 0.45) 0%,
    rgba(40, 44, 60, 0.12) 28%,
    rgba(40, 44, 60, 0.05) 55%,
    rgba(40, 44, 60, 0.78) 100%);
  z-index: 2;
  pointer-events: none;
}

/* v2 (2026-05-22)：hero-inner wrapper 對齊 frame 1240px 邊界，不再貼 viewport
   - pill 從左上 absolute 改成 bottom row 右側 inline flex
   - dots 從左下 absolute 改成 title/excerpt 下方 inline flex
   - 移除 author/avatar/date 區塊 */
.hero-feature .hero-inner {
  position: absolute;
  inset: 0;
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 24px;
  pointer-events: none; /* slide 在底層接 click 跳頁，inner 透傳 */
  z-index: 3;
}
.hero-feature .hero-inner > * { pointer-events: auto; }

.hero-feature .hero-bottom {
  position: absolute;
  left: 24px; right: 24px;
  bottom: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  color: var(--ts-cream);
}
.hero-feature .hero-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
}

.hero-feature .hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(40, 44, 60, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  color: var(--ts-cream);
  font-family: var(--ts-font-sans-zh);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  flex-shrink: 0;
  white-space: nowrap;
}
.hero-feature .hero-pill .dot {
  width: 6px; height: 6px;
  background: var(--ts-sun);
  border-radius: 50%;
}

.hero-feature .hero-title {
  font-family: var(--ts-font-serif-zh);
  font-weight: 500;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  line-height: 1.32;
  letter-spacing: 0.04em;
  color: var(--ts-cream);
  margin: 0;
  text-wrap: pretty;
}
.hero-feature .hero-excerpt {
  font-size: 0.92rem;
  line-height: 1.7;
  color: rgba(238, 234, 231, 0.82);
  margin: 0;
  letter-spacing: 0.02em;
}

/* Hero carousel — slides 只放 img */
.hero-feature .hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 800ms var(--ts-ease-natural);
  pointer-events: none;
}
.hero-feature .hero-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Dots 從 absolute 改成 inline，在 title/excerpt 下方 */
.hero-feature .hero-dots {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  align-items: center; /* 防 flex stretch 把 dot 拉撐到容器高 → background-clip:content-box 看不見 */
}

@media (max-width: 720px) {
  .hero-feature .hero-inner { padding: 16px; }
  .hero-feature .hero-pill { padding: 5px 10px; font-size: 0.72rem; }
  .hero-feature .hero-bottom {
    left: 16px; right: 16px; bottom: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .hero-feature .hero-left { max-width: 100%; }
  .hero-feature .hero-title { font-size: 1.35rem; line-height: 1.4; }
}
.hero-feature .hero-dot {
  box-sizing: content-box; /* 主題全域 border-box 會讓 padding 40 吃掉 height 2 → 強制 content-box */
  width: 20px; height: 2px;
  background: rgba(238, 234, 231, 0.4); /* cream 40% — 不 active */
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: width var(--ts-dur-base) var(--ts-ease-natural),
              height var(--ts-dur-base) var(--ts-ease-natural),
              background var(--ts-dur-base) var(--ts-ease-natural);
  padding: 20px 0; /* 觸控面積撐 ≥44px，視覺高度由 background-clip 維持 */
  background-clip: content-box;
  -webkit-background-clip: content-box;
}
.hero-feature .hero-dot.active {
  width: 32px; height: 4px;
  background: var(--ts-cream); /* cream 100% — active 加長加亮 */
  background-clip: content-box;
  -webkit-background-clip: content-box;
}

/* ============================================================
 * BLOG SECTION
 * ============================================================ */
.blog-section { padding: 64px 4px 48px; }

.blog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.blog-head h2 {
  font-family: var(--ts-font-serif-zh);
  font-weight: 500;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: 0.05em;
  color: var(--ts-navy);
  margin: 0 0 8px;
}
.blog-head .blog-intro {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ts-ink-soft);
  margin: 0;
  max-width: 540px;
  letter-spacing: 0.02em;
}

.filter-bar {
  display: block;
  border-bottom: 1px solid var(--ts-line);
  padding-bottom: 14px;
  margin-bottom: 28px;
}
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-tabs--children {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--ts-line);
  gap: 4px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 200ms var(--ts-ease-natural), transform 200ms var(--ts-ease-natural);
}
.filter-tabs--children.is-open {
  opacity: 1;
  transform: translateY(0);
}
.filter-tab {
  background: none;
  border: none;
  padding: 8px 14px;
  font-family: var(--ts-font-sans-zh);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  color: var(--ts-ink-soft);
  cursor: pointer;
  border-radius: 999px;
  transition: background var(--ts-dur-base) var(--ts-ease-natural), color var(--ts-dur-base) var(--ts-ease-natural);
  text-decoration: none;
  white-space: nowrap;
}
.filter-tab:hover { color: var(--ts-navy); background: rgba(40, 44, 60, 0.04); }
.filter-tab.active {
  background: var(--ts-navy);
  color: var(--ts-cream);
  font-weight: 500;
}
.filter-tab--child {
  font-size: 0.82rem;
  padding: 6px 12px;
}

/* hidden attribute 真的 hide（修 .filter-tabs { display: flex } specificity override 問題）
   涵蓋 root 跟 children 兩種狀態切換 */
.filter-tabs[hidden] { display: none; }

/* Result count（同頁 AJAX filter 後顯示「共 N 篇 · {分類}」）*/
.result-count {
  font-size: 0.78rem;
  color: var(--ts-ink-soft);
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}
.result-count[hidden] { display: none; }

/* Card grid loading state（AJAX 進行中半透明） */
.card-grid.is-loading {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s ease;
}


.filter-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ts-font-sans-zh);
  font-size: 0.82rem;
  color: var(--ts-ink-soft);
  letter-spacing: 0.04em;
}
.filter-sort select {
  background: none;
  border: 1px solid var(--ts-line);
  border-radius: 6px;
  padding: 6px 28px 6px 12px;
  font-family: inherit;
  font-size: inherit;
  color: var(--ts-navy);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 4l3 3 3-3' fill='none' stroke='%23282C3C' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ----- Card grid ----- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px 24px;
}
@media (max-width: 1000px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .card-grid { grid-template-columns: 1fr; } }

.card {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-decoration: none;
}

.card .card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  border-radius: 12px;
  overflow: hidden;
  background: var(--ts-forest-deep);
}
.card .card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--ts-dur-breath) var(--ts-ease-natural);
}
.card:hover .card-img img { transform: scale(1.04); }

.card .card-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: rgba(40, 44, 60, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: var(--ts-cream);
  font-family: var(--ts-font-sans-zh);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
}
.card .card-pill .pill-glyph {
  font-family: var(--ts-font-serif-zh);
  color: var(--ts-sun);
  font-weight: 500;
}

.card .card-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: var(--ts-font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--ts-ink-mute);
  padding: 0 4px;
}
.card .card-meta .dot { opacity: 0.5; }

.card .card-title {
  font-family: var(--ts-font-serif-zh);
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  line-height: 1.45;
  color: var(--ts-navy);
  margin: 0;
  padding: 0 4px;
  text-wrap: pretty;
  transition: color var(--ts-dur-quick) var(--ts-ease-natural);
}
.card:hover .card-title { color: var(--ts-forest); }

.card .card-excerpt {
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--ts-ink-soft);
  margin: 0;
  padding: 0 4px;
  letter-spacing: 0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .card-author {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 0;
}
.card .card-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--ts-warm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ts-font-serif-zh);
  font-size: 0.74rem;
  color: var(--ts-forest);
  font-weight: 500;
}
.card .card-author-name {
  font-family: var(--ts-font-sans-zh);
  font-size: 0.82rem;
  color: var(--ts-ink-soft);
  letter-spacing: 0.04em;
}
.card .card-author-name .role { color: var(--ts-ink-mute); }

/* ----- Pagination ----- */
.pagination,
.grovyn-blog-frame .nav-links,
.grovyn-blog-frame .page-numbers-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 56px;
  flex-wrap: wrap;
}
/* AJAX filter 後 blog.js 設 pagination.hidden = true 時，要強化 specificity
   蓋掉上面 display: flex（CLAUDE.md §5 #8 hidden 被 display: flex override 陷阱）*/
.pagination[hidden] { display: none; }
.grovyn-blog-frame .page-numbers {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--ts-font-mono);
  font-size: 0.84rem;
  color: var(--ts-ink-soft);
  cursor: pointer;
  transition: all var(--ts-dur-quick) var(--ts-ease-natural);
  text-decoration: none;
}
.grovyn-blog-frame a.page-numbers:hover { background: rgba(40, 44, 60, 0.06); color: var(--ts-navy); }
.grovyn-blog-frame .page-numbers.current {
  background: var(--ts-navy);
  color: var(--ts-cream);
  border-color: var(--ts-navy);
}
.grovyn-blog-frame .page-numbers.dots { border: none; cursor: default; }

/* ============================================================
 * EYEBROW / CRUMB
 * ============================================================ */
.eyebrow {
  font-family: var(--ts-font-serif-en);
  font-style: italic;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ts-ink-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 24px 4px 16px;
}
.eyebrow .crumb-link {
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  color: var(--ts-ink-soft);
  letter-spacing: inherit;
  padding: 0;
  text-decoration: none;
  transition: color var(--ts-dur-quick) var(--ts-ease-natural);
}
.eyebrow .crumb-link:hover { color: var(--ts-forest); }
.eyebrow .crumb-sep { opacity: 0.5; }
.eyebrow .crumb-current { color: var(--ts-navy); }

/* ============================================================
 * SPARSE CTA — 稀疏分類（文章<3）grid 下方引導，填補空白
 * ============================================================ */
.sparse-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  margin: 44px auto 8px;
  padding: 48px 32px;
  max-width: 520px;
  border: 1px dashed var(--ts-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: border-color var(--ts-dur-base) var(--ts-ease-natural),
              background var(--ts-dur-base) var(--ts-ease-natural);
}
.sparse-cta:hover { border-color: var(--ts-forest); background: rgba(255, 255, 255, 0.7); }
.sparse-cta__hint {
  font-family: var(--ts-font-sans-zh);
  font-size: 0.88rem;
  color: var(--ts-ink-soft);
  letter-spacing: 0.06em;
}
.sparse-cta__link {
  font-family: var(--ts-font-serif-zh);
  font-size: 1.1rem;
  color: var(--ts-forest);
  letter-spacing: 0.06em;
  transition: transform var(--ts-dur-quick) var(--ts-ease-natural);
}
.sparse-cta:hover .sparse-cta__link { transform: translateX(4px); }

/* ============================================================
 * RWD 響應式優化（2026-06-01）— iPad 直向 + 手機
 * 鐵則：只用斷點覆寫，桌機 (>880px) base 規則一律不動。
 * 平板用 banded query (721–880) 避免 append 於尾端時反向蓋掉
 * 既有 ≤720 手機區塊（source-order 陷阱）。iPad 橫向(1024)>880 維持桌機。
 * ============================================================ */

/* ---------- iPad 直向 (721–880px) ---------- */
@media (min-width: 721px) and (max-width: 880px) {
  .hero-feature { height: 72vh; min-height: 460px; }
  .hero-feature .hero-bottom { flex-direction: column; align-items: flex-start; gap: 14px; }
  .hero-feature .hero-left { max-width: 100%; }
  .blog-head h2 { font-size: 2.1rem; }
  .blog-section { padding-top: 40px; }
  .blog-head { margin-bottom: 24px; }
}

/* ---------- 手機 (≤720px) 補強：接在既有 720 區塊之後覆寫 ---------- */
@media (max-width: 720px) {
  .blog-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .blog-head h2 { font-size: 1.6rem; }
  .blog-section { padding-top: 36px; }
  .filter-tabs--root,
  .filter-tabs--children {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 8px;
  }
  .filter-tab { min-height: 44px; display: inline-flex; align-items: center; }
  .grovyn-blog-frame .page-numbers { width: 44px; height: 44px; }
  .pagination { gap: 2px; }
  .sparse-cta { padding: 36px 24px; margin-top: 28px; }
}

