/* ============================================================
   系列精選 — CSS
   ============================================================ */

/* --- 區塊 1: CSS 變數 --- */
:root {
  --series-card-width: 280px;
  --series-card-gap: 16px;
  --series-card-radius: 12px;
  --series-cover-height: 120px;
}

/* --- 區塊 2: 首頁精選卡片 --- */
.series-showcase {
  margin-bottom: 24px;
  min-height: 280px;
}

.series-showcase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.series-showcase-title {
  font-size: 1.2em;
  font-weight: 700;
  margin: 0;
}

.series-showcase-title i {
  margin-right: 6px;
}

.series-showcase-more {
  font-size: 0.85em;
  color: var(--theme-color, #49b1f5);
  text-decoration: none;
  transition: opacity 0.2s;
}

.series-showcase-more:hover {
  text-decoration: underline;
  opacity: 0.8;
}

.series-showcase-container {
  position: relative;
}

.series-showcase-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: var(--series-card-gap);
  padding: 4px 0 12px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.series-showcase-track::-webkit-scrollbar {
  display: none;
}

.series-card {
  flex-shrink: 0;
  width: var(--series-card-width);
  scroll-snap-align: start;
  border-radius: var(--series-card-radius);
  background: var(--card-bg, #fff);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
  display: block;
}

.series-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.series-card-cover {
  height: var(--series-cover-height);
  background: linear-gradient(135deg, var(--series-color), color-mix(in srgb, var(--series-color) 70%, #000));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.series-card-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.15) 100%);
}

.series-card-icon-overlay i {
  font-size: 2.5em;
  color: rgba(255, 255, 255, 0.3);
}

.series-card-body {
  padding: 16px;
}

.series-card-name {
  font-size: 1em;
  font-weight: 600;
  margin: 0 0 8px;
}

.series-card-desc {
  font-size: 0.85em;
  color: var(--font-color, #666);
  opacity: 0.7;
  margin: 0 0 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.series-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8em;
}

.series-card-count {
  color: var(--font-color, #666);
  opacity: 0.6;
}

.series-card-count i {
  margin-right: 4px;
}

.series-card-status {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75em;
  font-weight: 500;
}

.series-status-completed {
  background: #d4edda;
  color: #155724;
}

.series-status-in-progress {
  background: #fff3cd;
  color: #856404;
}

.series-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  color: #fff;
  font-size: 1.1em;
}

.series-scroll-btn:hover {
  background: rgba(0, 0, 0, 0.65);
  transform: translateY(-50%) scale(1.1);
}

.series-scroll-left {
  left: 8px;
}

.series-scroll-right {
  right: 8px;
}

/* --- 區塊 3: /series/ 總覽頁面 --- */
.series-page {
  max-width: 800px;
  margin: 0 auto;
}

.series-page-stats {
  text-align: center;
  margin-bottom: 36px;
  font-size: 0.95em;
  color: var(--font-color, #666);
  opacity: 0.7;
}

.series-stat-sep {
  margin: 0 12px;
}

.series-section {
  margin-bottom: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--hr-border, #eee);
}

.series-section:last-child {
  border-bottom: none;
}

.series-section-header {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

.series-section-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--series-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 1.4em;
}

.series-section-info {
  flex: 1;
  min-width: 0;
}

.series-section-name {
  font-size: 1.3em;
  margin: 0 0 6px;
  font-weight: 700;
}

.series-section-desc {
  font-size: 0.9em;
  color: var(--font-color, #666);
  opacity: 0.7;
  margin: 0 0 8px;
}

.series-section-meta {
  font-size: 0.85em;
  display: flex;
  gap: 12px;
  align-items: center;
}

.series-article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: article;
}

.series-article-item {
  counter-increment: article;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hr-border, #f0f0f0);
  transition: padding-left 0.2s;
}

.series-article-item::before {
  content: counter(article);
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--series-color, #eee);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8em;
  font-weight: 600;
  margin-right: 12px;
  flex-shrink: 0;
}

.series-article-item:hover {
  padding-left: 4px;
}

.series-article-item a {
  flex: 1;
  text-decoration: none;
  color: var(--font-color, #333);
  font-size: 0.95em;
}

.series-article-item a:hover {
  color: var(--series-color, var(--theme-color));
}

.series-article-item time {
  font-size: 0.8em;
  color: var(--font-color, #999);
  opacity: 0.5;
  flex-shrink: 0;
  margin-left: 12px;
}

.series-show-all,
.series-toggle-btn {
  display: block;
  text-align: center;
  padding: 10px;
  margin-top: 12px;
  color: var(--theme-color, #49b1f5);
  text-decoration: none;
  font-size: 0.9em;
  border: 1px dashed var(--theme-color, #49b1f5);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  transition: background 0.2s, color 0.2s;
}

.series-show-all:hover,
.series-toggle-btn:hover {
  background: var(--theme-color, #49b1f5);
  color: #fff;
}

/* --- 區塊 4: CLS 防護（已合併在 .series-showcase） --- */

/* --- 區塊 5: 深色模式 --- */
[data-theme="dark"] .series-card {
  background: var(--card-bg, #1d1d1d);
}

[data-theme="dark"] .series-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .series-scroll-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

[data-theme="dark"] .series-scroll-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .series-status-completed {
  background: #1a3a2a;
  color: #7dcea0;
}

[data-theme="dark"] .series-status-in-progress {
  background: #3a2e1a;
  color: #f0c040;
}

[data-theme="dark"] .series-section {
  border-bottom-color: var(--hr-border, #333);
}

[data-theme="dark"] .series-article-item {
  border-bottom-color: var(--hr-border, #333);
}

/* --- 區塊 6: RWD --- */
@media (max-width: 768px) {
  .series-showcase {
    min-height: 240px;
  }

  :root {
    --series-card-width: 220px;
  }

  .series-scroll-btn {
    display: none !important;
  }

  .series-section-header {
    flex-direction: column;
    gap: 12px;
  }

  .series-section-icon {
    width: 48px;
    height: 48px;
    font-size: 1.2em;
  }

  .series-article-item {
    flex-wrap: wrap;
  }

  .series-article-item time {
    width: 100%;
    margin-left: 40px;
    margin-top: 2px;
  }
}
