/* ============================================
   智匯前線 AI-101.tech — 全站自訂樣式
   ============================================ */

/* --- 1. Logo & Header 全域 Fixed --- */
.header-logo .logo-link {
  display: flex !important;
  align-items: center;
  gap: 0.6rem;
  overflow: visible !important;
  text-overflow: clip !important;
}
.logo-img {
  height: 2.4rem;
  width: auto;
  border-radius: 6px;
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Header 固定頂部 (sticky 已內建，這裡強化視覺) */
.sticky-header {
  border-bottom: 2px solid rgba(100, 200, 255, 0.2) !important;
  box-shadow: 0 3px 16px rgba(0, 0, 0, 0.45);
  z-index: 1500 !important;
}

/* --- 2. Hero Section 自訂 (首頁) --- */
.hero-section-hero-img .hero-section { padding-top: 1rem; }
.hero-avatar-img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(100, 200, 255, 0.4);
  box-shadow: 0 0 24px rgba(100, 200, 255, 0.15);
  margin-bottom: 1rem;
  object-fit: contain;
  background: rgba(20, 20, 30, 0.5);
}
@media (max-width: 768px) {
  .hero-content { grid-template-columns: 1fr !important; text-align: center; }
  .hero-avatar-img { margin: 0 auto 1rem; }
  .hero-social { justify-content: center; }
}

/* --- 3. 文章卡片 (新聞列表) --- */
.post-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: rgba(18, 22, 34, 0.75);
  border: 1px solid rgba(100, 200, 255, 0.08);
  border-radius: 1rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: border-color 0.3s ease, transform 0.3s ease;
  color: inherit;
}
.post-card:hover {
  border-color: rgba(100, 200, 255, 0.35);
  transform: translateY(-3px);
}
.post-card-image img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
}
.post-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.post-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  color: #e0e8f0;
  line-height: 1.4;
}
.post-card-date {
  font-size: 0.8rem;
  color: #8a92a4;
  margin-bottom: 0.7rem;
}
.post-card-excerpt {
  font-size: 0.92rem;
  color: #a9b1bc;
  line-height: 1.65;
  margin-bottom: 0.8rem;
  flex: 1;
}
.read-more-btn {
  font-size: 0.85rem;
  color: #00bcd4;
  text-decoration: none;
  font-weight: 600;
}

/* --- 4. 文章單頁 — Hero Image --- */
.hero-image-section {
  width: 100%;
  margin: 0 0 1.5rem 0;
  padding: 0;
  border-radius: 0 0 1rem 1rem;
  overflow: hidden;
}
.hero-image-section img {
  width: 100%;
  height: 420px;
  object-fit: cover;
  display: block;
}
@media (max-width: 768px) {
  .hero-image-section img { height: 220px; }
}

/* 分類徽章 */
.post-category-badge {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: linear-gradient(135deg, #4a00e0, #8e2de2);
  color: #fff;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

/* --- 5. 上下篇文章導航 --- */
.post-navigation {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(100, 200, 255, 0.12);
  flex-wrap: wrap;
}
.post-nav-item {
  flex: 1;
  min-width: 200px;
  padding: 1rem 1.2rem;
  background: rgba(25, 30, 50, 0.6);
  border: 1px solid rgba(100, 200, 255, 0.1);
  border-radius: 0.8rem;
  text-decoration: none;
  transition: border-color 0.25s, background 0.25s;
}
.post-nav-item:hover {
  border-color: rgba(100, 200, 255, 0.4);
  background: rgba(40, 50, 80, 0.75);
}
.post-nav-item .nav-label {
  font-size: 0.72rem;
  color: #00b4d6;
  text-transform: uppercase;
  display: block;
}
.post-nav-item .nav-title {
  font-weight: 600;
  color: #e0e8f0;
  font-size: 0.92rem;
  margin-top: 4px;
  display: block;
}

/* --- 6. Table of Contents 增強 --- */
.post-toc {
  position: sticky !important;
  top: 80px !important;
  align-self: flex-start;
  max-width: 280px;
  width: 100%;
  z-index: 100;
  background: var(--bg-primary) !important;
  border: 1px solid rgba(100, 200, 255, 0.12) !important;
  border-radius: 0.8rem !important;
  padding: 0.5rem !important;
}
@media (max-width: 900px) {
  .post-toc { position: relative !important; top: 0; max-width: 100%; margin-top: 1.5rem; }
}

/* --- 7. Back to Top 按鈕美化 --- */
#scroll-to-top {
  background: linear-gradient(135deg, #4a00e0, #00bcd4) !important;
  width: 2.8rem !important;
  height: 2.8rem !important;
  border-radius: 50% !important;
  box-shadow: 0 3px 12px rgba(100, 200, 255, 0.25) !important;
  opacity: 0.85 !important;
}
#scroll-to-top:hover {
  transform: scale(1.1) !important;
  opacity: 1 !important;
}

/* --- 8. 通知推播 --- */
.notification-banner {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 300px;
  background: rgba(12, 16, 28, 0.94);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(100, 200, 255, 0.3);
  border-radius: 1rem;
  padding: 1.2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  z-index: 2900;
  color: #fff;
  display: none;
}
.notification-banner .notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.notification-banner .notif-title { font-weight: 700; font-size: 1rem; }
.notification-banner .notif-dismiss {
  background: none; border: none; color: #888; font-size: 1.2rem; cursor: pointer;
}
.notification-banner .notif-dismiss:hover { color: #fff; }
.notification-banner p { font-size: 0.85rem; color: #c0c8d4; margin: 0.3rem 0 0.8rem; }
.notification-banner .notif-enable {
  width: 100%;
  padding: 0.5rem;
  background: linear-gradient(135deg, #4a00e0, #8e2de2);
  border: none;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}
.notification-banner .notif-enable:hover {
  background: linear-gradient(135deg, #8e2de2, #4a00e0);
}
@media (max-width: 768px) {
  .notification-banner {
    width: calc(100% - 2rem);
    right: 1rem;
    bottom: 4rem;
  }
}

/* --- 9. 隨機推薦文章區塊 --- */
.related-posts-section {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(100, 200, 255, 0.15);
}
.related-posts-section h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--accent-light-purple);
  font-family: var(--font-heading);
}
.related-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 768px) {
  .related-posts-grid { grid-template-columns: 1fr; }
}
.related-post-card {
  background: rgba(25, 30, 45, 0.7);
  border: 1px solid rgba(100, 200, 255, 0.1);
  border-radius: 0.8rem;
  overflow: hidden;
  transition: transform 0.25s, background 0.25s;
}
.related-post-card:hover {
  transform: translateY(-4px);
  background: rgba(40, 50, 80, 0.85);
}
.related-post-card a { text-decoration: none; color: inherit; display: block; }
.related-post-card img {
  width: 100%; height: 110px; object-fit: cover;
}
.related-post-card .related-title {
  font-size: 0.85rem; font-weight: 700; margin: 6px 8px 4px; color: #e0e8f0;
  line-height: 1.35;
}
.related-post-card .related-date {
  font-size: 0.72rem; color: #8a92a4; margin: 0 8px 8px;
}

/* --- 10. 區塊 Section 樣式 --- */
.section-hero {
  padding: 2.5rem 1.5rem 1.5rem;
  background: linear-gradient(180deg, rgba(20, 25, 40, 0.9), transparent);
  margin-bottom: 1rem;
}
.section-container {
  max-width: 1200px;
  margin: 0 auto;
}
.section-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}
.section-description {
  color: #8a92a4;
  font-size: 1rem;
  max-width: 700px;
}
.posts-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  border-left: 4px solid #4a00e0;
  padding-left: 0.8rem;
}

/* 全域 body padding for sticky header */
body { padding-top: 0 !important; }

/* 確保 footer 樣式一致 */
footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
}

/* --- 11. Archives 存檔頁面簡潔列表 --- */

/* 確保文章區塊與標題區塊等寬 (1200px) */
.posts-section .section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem; /* 與 Hero Section 的 padding 一致 */
}

.posts-list-simple {
  display: flex;
  flex-direction: column;
  background: rgba(18, 22, 34, 0.4); /* 輕微背景色區分區域 */
  border-radius: 1rem;
  padding: 0.5rem 1.5rem;
  border: 1px solid rgba(100, 200, 255, 0.05);
}

.archive-item {
  display: flex;
  align-items: center;
  padding: 1.2rem 0;
  border-bottom: 1px solid rgba(100, 200, 255, 0.1);
  transition: all 0.2s ease;
}

.archive-item:last-child {
  border-bottom: none;
}

/* 懸停時整行發光效果，呼應你原本的卡片設計 */
.archive-item:hover {
  padding-left: 0.5rem;
  background: rgba(100, 200, 255, 0.03);
}

.archive-date {
  font-family: 'Outfit', monospace;
  font-size: 0.9rem;
  color: #8a92a4; /* 呼應你原本的 .post-card-date */
  width: 120px; /* 固定寬度讓標題對齊 */
  flex-shrink: 0;
}

.archive-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e0e8f0; /* 呼應 .post-card-title */
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.2s ease;
}

.archive-item:hover .archive-title {
  color: #00bcd4; /* 懸停時變為你定義的青藍色 */
}

/* 行動版調整 */
@media (max-width: 600px) {
  .archive-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
  .archive-date {
    width: auto;
    font-size: 0.8rem;
  }
}

/* 分類標籤基礎樣式 */
.archive-category {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 1rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* 新聞標籤：使用你原本的青藍色系 */
.badge-news {
  background: rgba(0, 188, 212, 0.15);
  color: #00bcd4;
  border: 1px solid rgba(0, 188, 212, 0.3);
}

/* 研究標籤：使用你原本的紫色漸層感 */
.badge-research {
  background: rgba(142, 45, 226, 0.15);
  color: #a25df2;
  border: 1px solid rgba(142, 45, 226, 0.3);
}

/* 預設標籤 */
.badge-default {
  background: rgba(138, 146, 164, 0.1);
  color: #8a92a4;
  border: 1px solid rgba(138, 146, 164, 0.2);
}

/* 調整行動版排版，確保標籤不會擠壓 */
@media (max-width: 600px) {
  .archive-item {
    position: relative;
    padding-top: 2.5rem; /* 為日期和標籤留空間 */
  }
  .archive-date {
    position: absolute;
    top: 0.8rem;
    left: 0;
  }
  .archive-category {
    position: absolute;
    top: 0.7rem;
    left: 100px; /* 放在日期旁邊 */
  }
}

/* 自定義換頁動畫 */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.4s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 舊頁面淡出並往上微移 */
::view-transition-old(root) {
  animation: 0.3s cubic-bezier(0.4, 0, 1, 1) both fade-out,
             0.3s cubic-bezier(0.4, 0, 0.2, 1) both slide-to-top;
}

/* 新頁面淡入並從下方滑入 */
::view-transition-new(root) {
  animation: 0.4s cubic-bezier(0, 0, 0.2, 1) 0.1s both fade-in,
             0.4s cubic-bezier(0.4, 0, 0.2, 1) both slide-from-bottom;
}

@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-to-top { from { transform: translateY(0); } to { transform: translateY(-20px); } }
@keyframes slide-from-bottom { from { transform: translateY(20px); } to { transform: translateY(0); } }

/* 分頁按鈕美化 */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
  list-style: none;
}

.pagination a, .pagination span {
  padding: 0.6rem 1rem;
  background: rgba(25, 30, 50, 0.8);
  border: 1px solid rgba(100, 200, 255, 0.1);
  border-radius: 8px;
  color: #8a92a4;
  text-decoration: none;
  transition: all 0.3s ease;
}

.pagination .active a, 
.pagination a:hover {
  background: linear-gradient(135deg, #4a00e0, #00bcd4);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 15px rgba(0, 188, 212, 0.3);
  transform: translateY(-2px);
}
