/*── 引入字體 ─────────────────────────────────────────────────────────*/
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/*── 色彩變數 ─────────────────────────────────────────────────────────*/
:root {
  --color-primary: #004d40;      /* 深墨綠 */
  --color-secondary: #00695c;    /* 青綠 */
  --color-accent: #00bfa5;       /* 鮮明青綠 */
  --color-bg: #f0f4f3;           /* 乳白背景 */
  --color-surface: #ffffff;      /* 主要卡片底色 */
  --color-text: #263238;         /* 深灰文字 */
  --color-muted: #607d8b;        /* 次要文字 */
  --font-base: 'Poppins', sans-serif;
}

/*── 全域設定 ─────────────────────────────────────────────────────────*/
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}
html {
  font-size: 16px;
}
body {
  font-family: var(--font-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

/*── 標題樣式 ─────────────────────────────────────────────────────────*/
h1, h2, h3, h4 {
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 1rem;
  letter-spacing: 0.5px;
}
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

/*── 連結樣式 ─────────────────────────────────────────────────────────*/
a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color 0.3s;
}
a:hover {
  color: var(--color-accent);
}

/*── 頁首導覽 ─────────────────────────────────────────────────────────*/
header {
  position: sticky;
  top: 0;
  background: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 100;
}
header nav ul {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  padding: 1rem;
}
header nav li + li { margin-left: 2rem; }
header nav a {
  color: #fff;
  font-weight: 500;
  font-size: 1rem;
}
header nav a:hover {
  color: var(--color-accent);
}

/*── Carousel 淡入淡出動畫版本 ───────────────────────────────────*/
#carousel {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1200/545;
  overflow: hidden;
}

/* slides 容器 */
#carousel .slides {
  position: relative;
  width: 100%;
  height: 100%;
}

/* 所有 slide 固定覆蓋，但透明度控制顯示 */
#carousel .slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 0;                /* 隱藏層級 */
  transition: opacity 0.5s ease-in-out;  /* 淡入淡出 */
}

/* active slide 顯示 */
#carousel .slide.active {
  opacity: 1;
  z-index: 1;                /* 顯示層級 */
}

/* 圖片 */
#carousel .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Caption */
#carousel .caption {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  z-index: 2;
}

/* Prev/Next 按鈕 */
#carousel .prev,
#carousel .next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.4);
  color: #fff;
  border: none;
  font-size: 2rem;
  padding: 0.5rem;
  cursor: pointer;
  z-index: 3;
  transition: background 0.3s;
}
#carousel .prev:hover,
#carousel .next:hover {
  background: rgba(0,0,0,0.6);
}
#carousel .prev { left: 1rem; }
#carousel .next { right: 1rem; }

/*── 區塊標題 ─────────────────────────────────────────────────────────*/
section {
  padding: 4rem 1.5rem;
}
section:nth-child(even) {
  background: var(--color-surface);
}

/*── 最新消息 區塊 CSS ───────────────────────────────────────────────────*/
#news .news-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  list-style: none;
  margin-bottom: 1.5rem;    /* 保留底部間距，分頁獨立 */
}
#news .news-list li {
  background: var(--color-surface);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.3s, box-shadow 0.3s;
}
#news .news-list li:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 分頁按鈕 */
#news .pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 3rem;
}
#news .pagination a {
  padding: 0.5rem 1rem;
  background: var(--color-secondary);
  color: #fff;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.3s;
}
#news .pagination a:hover {
  background: var(--color-accent);
}

/*── 研究發表 區塊 - 完整排版 & 篩選 & 走馬燈 ─────────────────────────────────────────*/
/*── 篩選列 ─────────────────────────────────────────────────────────*/
#publications .filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
#publications .filters select,
#publications .filters input {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-muted);
  border-radius: 6px;
  font-size: 1rem;
}

/*── Slider 容器 ───────────────────────────────────────────────────*/
.pub-slider-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.pub-slider {
  display: flex;
  overflow: hidden;
  scroll-behavior: smooth;
  gap: 1.5rem;
  padding: 1rem 0;
  width: 100%;
}

/*── Card 樣式 ───────────────────────────────────────────────────*/
.pub-slider .card {
  flex: 0 0 auto;
  width: 400px;             /* 固定卡片寬度 */
  max-width: 400px;
  background: var(--color-surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.3s, box-shadow 0.3s;
  text-align: center;
}
.pub-slider .card:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.pub-slider .card img {
  width: 100%;
  height: 400px;
  object-fit: cover;
  display: block;
}
.pub-slider .card h3 {
  margin: 0.75rem 0;
  font-size: 1.2rem;
  color: var(--color-primary);
  padding: 0 0.5rem;
}
.pub-slider .card p {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}
@media (max-width: 480px) {
  .pub-slider .card img {
    height: 250px;
  }
}

/*── Prev/Next 按鈕 ─────────────────────────────────────────────────*/
.pub-nav {
  background: rgba(0,0,0,0.3);
  border: none;
  color: #fff;
  font-size: 2rem;
  padding: 0.5rem;
  cursor: pointer;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  transition: background 0.3s;
}
.pub-nav:hover {
  background: rgba(0,0,0,0.5);
}
#pub-prev { left: 0; }
#pub-next { right: 0; }

/*── 成員介紹 Slider ──────────────────────────────────────────────────*/
.member-slider {
  display: flex;
  justify-content: center;
  overflow-x: auto;
  gap: 1rem;
  padding-bottom: 1rem;
}
.member-card {
  flex: 0 0 200px;
  background: var(--color-surface);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  transition: transform 0.3s, box-shadow 0.3s;
}
.member-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.member-card h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
  color: var(--color-primary);
}
.member-card p {
  font-size: 0.9rem;
  color: var(--color-muted);
}

/*── 聯絡我們 表單 ───────────────────────────────────────────────────*/
form {
  max-width: 600px;
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}
input, textarea {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-muted);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}
button[type="submit"] {
  padding: 0.75rem 1.5rem;
  background: var(--color-secondary);
  color: #fff;
  border: none;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s;
}
button[type="submit"]:hover {
  background: var(--color-accent);
}

/*── 響應式調整 ──────────────────────────────────────────────────────*/
@media (max-width: 768px) {
  header nav ul { flex-direction: column; }
  #carousel { height: 40vh; }
  .news-list li { flex-direction: column; align-items: flex-start; }
}
/* style.css 增加：新聞頁美編 */
.news-article {
  max-width: 800px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--color-surface);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.news-image img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  margin-bottom: 1rem;
  object-fit: cover;
}
.news-article h2 {
  font-size: 2rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
}
.news-content {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}
.news-date {
  display: block;
  text-align: right;
  color: var(--color-muted);
}
