/* =====================================================================
   CMS 擴充樣式
   延續原有設計語言（紙質底色、朱紅品牌色、直角邊框、襯線標題）
   ===================================================================== */

/* ── 首頁輪播 ───────────────────────────────────────────── */
.hero-carousel {
  display: grid;
  position: relative;
  /* 覆寫 .hero 的 align-items: end，令投影片撐滿容器（避免手機版上方出現空白）*/
  align-items: stretch;
}

.hero-carousel::after {
  display: none;
}

.hero-slide {
  grid-area: 1 / 1;
  position: relative;
  min-height: min(88vh, 46rem);
  display: grid;
  align-items: end;
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}

.hero-carousel .hero-slide {
  opacity: 0;
  visibility: hidden;
  transition: opacity 700ms var(--ease);
}

.hero-carousel .hero-slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(12, 14, 20, 0.18) 0%, rgba(12, 14, 20, 0.78) 72%),
    linear-gradient(90deg, rgba(192, 18, 42, 0.22), transparent 42%);
}

.hero-slide .hero-title {
  color: #fff;
  font-family: var(--font-serif);
  font-size: clamp(2.15rem, 6vw, 4.1rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}

.hero-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(12, 14, 20, 0.35);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background var(--ease), border-color var(--ease);
  backdrop-filter: blur(2px);
}

.hero-nav:hover {
  background: var(--brand);
  border-color: var(--brand);
}

.hero-prev { left: clamp(0.5rem, 2vw, 1.5rem); }
.hero-next { right: clamp(0.5rem, 2vw, 1.5rem); }

.hero-dots {
  position: absolute;
  z-index: 3;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.55rem;
}

.hero-dot {
  width: 2.25rem;
  height: 3px;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}

.hero-dot.is-active {
  background: var(--brand);
  transform: scaleY(2);
}

@media (max-width: 640px) {
  .hero-nav { display: none; }
  .hero-slide { min-height: min(78vh, 34rem); }
}

/* ── 分頁 ───────────────────────────────────────────────── */
.pagination {
  margin-top: 3rem;
  text-align: center;
}

.pagination ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.pagination a,
.pagination span {
  display: inline-block;
  min-width: 2.6rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.pagination a:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.pagination .is-current {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pagination .gap span {
  border-color: transparent;
  background: transparent;
  min-width: auto;
  padding: 0.55rem 0.25rem;
}

.pagination-info {
  margin: 1rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

/* ── 網誌列表 ───────────────────────────────────────────── */
.blog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.blog-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  transition: all var(--ease);
}

.blog-chip span {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.blog-chip:hover,
.blog-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.blog-chip.is-active span,
.blog-chip:hover span { color: rgba(255, 255, 255, 0.7); }

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1.75rem;
}

.blog-card {
  background: var(--white);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: transform var(--ease), box-shadow var(--ease);
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.blog-card-media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease);
}

.blog-card:hover .blog-card-media img { transform: scale(1.05); }

.blog-card-body {
  padding: 1.35rem 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.blog-card-body h2,
.blog-card-body h3 {
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 0;
}

.blog-card-body h2 a,
.blog-card-body h3 a {
  color: var(--ink);
  text-decoration: none;
}

.blog-card-body h2 a:hover,
.blog-card-body h3 a:hover { color: var(--brand); }

.blog-card-body p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-muted);
  line-height: 1.8;
}

.blog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 0;
  letter-spacing: 0.02em;
}

.blog-cat {
  color: var(--brand);
  text-decoration: none;
  font-weight: 700;
}

.blog-more {
  margin-top: auto;
  padding-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

/* ── 文章內頁 ───────────────────────────────────────────── */
.article-wrap { max-width: 48rem; }

.article-meta {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.article-body h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  margin: 2.6rem 0 0.9rem;
  padding-left: 0.85rem;
  border-left: 3px solid var(--brand);
}

.article-body h3 {
  font-size: 1.15rem;
  margin: 1.9rem 0 0.6rem;
  color: var(--ink-soft);
}

.article-body p { margin: 0 0 1.1rem; }

.article-body ul,
.article-body ol { margin: 0 0 1.4rem; padding-left: 1.4rem; }

.article-body li { margin-bottom: 0.5rem; }

.article-body img {
  margin: 1.6rem 0;
  border: 1px solid var(--line);
}

.article-body blockquote {
  margin: 1.8rem 0;
  padding: 1.1rem 1.4rem;
  background: var(--paper-2);
  border-left: 3px solid var(--accent);
  font-size: 1.02rem;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

.article-body th,
.article-body td {
  border: 1px solid var(--line);
  padding: 0.65rem 0.85rem;
  text-align: left;
}

.article-body th { background: var(--paper-2); }

.article-tags {
  margin: 2.4rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.article-tags a {
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  color: var(--ink-muted);
  text-decoration: none;
}

.article-tags a:hover { border-color: var(--brand); color: var(--brand); }

.article-cta {
  margin-top: 3rem;
  padding: 2rem 2.2rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.article-cta h2 {
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
  font-size: 1.35rem;
}

.article-cta p { margin: 0 0 0.6rem; }

/* ── 站內搜尋 ───────────────────────────────────────────── */
.search-form {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 2.2rem;
  flex-wrap: wrap;
}

.search-form input[type="search"] {
  flex: 1;
  min-width: 15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  background: var(--white);
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
}

.search-form input[type="search"]:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.search-count { color: var(--ink-muted); margin-bottom: 1.2rem; }

.search-results { list-style: none; margin: 0; padding: 0; }

.search-results li {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.search-results a {
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
}

.search-results a:hover { color: var(--brand); }

.search-results p { margin: 0.4rem 0 0; color: var(--ink-muted); font-size: 0.94rem; }

.search-kind {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--ink-muted);
  margin-right: 0.6rem;
  vertical-align: 2px;
}

/* ── 網站地圖列表 ───────────────────────────────────────── */
.sitemap-list {
  columns: 2;
  column-gap: 2.5rem;
}

.sitemap-list li { break-inside: avoid; }

.sitemap-date {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-left: 0.6rem;
}

@media (max-width: 640px) {
  .sitemap-list { columns: 1; }
}

/* ── 表單送出提示 ───────────────────────────────────────── */
.form-alert {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-left: 3px solid;
  font-size: 0.98rem;
}

.form-alert strong { font-weight: 700; }

.form-alert.is-ok {
  background: #eaf6ee;
  border-color: #1f9e4b;
  color: #12653a;
}

.form-alert.is-err {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
}

/* ── 頁尾：網頁設計提供者 ───────────────────────────────── */
.footer-credit {
  padding: 0.9rem 0 1.6rem;
  text-align: center;
}

.footer-credit p {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.42);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-credit a {
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
  padding-bottom: 1px;
  transition: color var(--ease), border-color var(--ease);
}

.footer-credit a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.footer-social span { opacity: 0.4; }

/* ── 頁面副標題 ─────────────────────────────────────────── */
.page-hero-lede {
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.02rem;
  margin: 0.7rem 0 0;
  max-width: 44rem;
}

/* ── 自我診斷面板 ───────────────────────────────────────── */
.selftest-box {
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 0.88rem;
  margin: 1.5rem 0;
}

.selftest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.selftest-summary { color: var(--ink-muted); font-size: 0.82rem; }

.selftest-table { width: 100%; border-collapse: collapse; }

.selftest-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(215, 207, 192, 0.5);
  vertical-align: top;
}

.selftest-table .st-icon { width: 2rem; text-align: center; font-weight: 700; }
.selftest-table .st-name { width: 30%; font-weight: 500; }
.selftest-table .st-value { color: var(--ink-soft); }
.selftest-table .st-hint { color: var(--ink-muted); font-size: 0.82rem; }
