/* --- 基礎背景設定 --- */
body {
  font-family: "Microsoft JhengHei", Arial, sans-serif;
  /* 如果你有背景圖，可以在這裡設定 */
  background-color: #f4f7f6;
  color: #333;
}

/* 1. 基礎重設：移除瀏覽器預設的邊距 */
* {
  margin: 0;
  padding: 0;
  /* 移除全域 padding，改由子容器決定 */
  box-sizing: border-box;
}

body {
  font-family: "Microsoft JhengHei", Arial, sans-serif;
  background-color: #f4f7f6;
  color: #333;
}

/* 2. 導覽列容器樣式 */
nav {
  background-color: rgba(44, 62, 80, 0.9);
  /* 使用 RGBA，0.9 是微透明 */
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 50px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  /* 下方陰影 */
}

nav.main-nav {
  background-color: #2c3e50;
  /* 核心修改：回到最初的深藍色 */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  /* 加強陰影，讓它跟背景圖區隔開 */
  width: 100%;
  position: sticky;
  /* 使用固定定位確保不擋住內容，但隨捲軸移動 */
  top: 0;
  z-index: 1000;
  height: 60px;
  display: flex;
  align-items: center;
}

/* 3. 清單樣式：使用 Flexbox 讓項目橫向排列 */
nav ul {
  display: flex;
  list-style: none;
  /* 移除圓點 */
  margin: 0;
  padding: 0;
  justify-content: flex-start;
  /* 讓選單置中，若要靠左請改為 flex-start */
}

/* 4. 選單項目間距 */
nav ul li {
  margin: 0 15px;
}

/* 5. 連結文字樣式 */
nav ul li a {
  text-decoration: none;
  /* 移除下劃線 */
  padding: 10px 15px;
  color: #ecf0f1;
  font-size: 1.1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  /* 加入平滑動畫 */
  display: block;
  /* 增加點擊範圍 */
}

/* 6. 滑鼠懸停效果 (Hover) */
nav ul li a:hover {
  color: #1abc9c !important;
  /* 改為明顯的淺藍色，避免跟背景色太像 */
}

/* 7. 內容區域樣式 */
main {
  padding: 40px;
  text-align: left;
}

/* 主容器：水平排列 */
.main-container {
  display: flex;
  background-color: rgba(0, 0, 0, 0.1) !important;
  /* 10% 透明度的黑 */
  justify-content: space-around;
  backdrop-filter: blur(8px);
  /* 增加毛玻璃感，讓背景圖不干擾文字 */
  min-height: auto;
  /* 佔據大部分視窗高度 */
  max-width: 1200px;
  background-color: #f4f7f6;
  margin: 0 auto;
  align-items: center;
  /* 垂直居中 */
  padding: 80px 50px;
  gap: 60px;
  /* 左右間距 */
}

/* 左側區塊：佔 40% 寬度 */
.left-side {
  flex: 0 0 40%;
  display: flex;
  justify-content: center;
}

/* 1. 增加標題、描述、標籤之間的垂直距離 */
.right-side .title {
  font-size: 2.5rem;
  color: #38bdf8;
  /* 使用更明亮的藍色 */
  margin-bottom: 30px;
  /* 增加標題與下方文字的距離 */
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  /* 加入陰影 */
}

.right-side .subtitle {
  font-size: 1.1rem;
  color: #e2e8f0;
  /* 改為淺灰色/白色 */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  line-height: 1.8;
  /* 增加行距，讓文字不擁擠 */
  margin-bottom: 50px;
  /* 關鍵：增加這段文字與下方標籤 (#JavaScript) 的距離 */
  max-width: 500px;
  /* 限制寬度，避免文字太長不好閱讀 */
}

/* 右側區塊：佔 60% 寬度 */
.right-side {
  flex: 1;
}

.right-side h1 {
  font-size: 2.5rem;
  margin-bottom: 20px;
  color: #38bdf8;
}

/* 2. 調整標籤容器 */
.tech-tags {
  display: flex;
  gap: 15px;
  /* 增加標籤之間的水平間距 */
  flex-wrap: wrap;
  /* 確保手機版會自動換行 */
}

.tag {
  background: #1e293b;
  color: #38bdf8;
  padding: 8px 16px;
  /* 增加標籤內襯，讓標籤看起來更大方 */
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: transform 0.2s;
  /* 加入一點互動感 */
}

.tech-tags span {
  background: #1e293b;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.9rem;
  margin-right: 10px;
  color: #94a3b8;
}



/* 響應式：手機版變成上下排列 */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
    text-align: center;
    padding-top: 50px;
  }

  .left-side {
    width: 100%;
  }
}

main h1 {
  color: #2c3e50;
  margin-bottom: 10px;
}

main ul {
  list-style-type: none;
  margin: 20px 0;
  padding: 0;
  width: 250px;
  /* 這裡設定寬度就不會影響 nav */
  background-color: #f1f1f1;
  text-align: left;
  /* 讓作品名稱靠左 */
}

main ul li a {
  display: block;
  color: #333;
  padding: 12px 16px;
  text-decoration: none;
  border-bottom: 1px solid #eee;
}

main ul li:last-child a {
  border-bottom: none;
}

main ul li a:hover {
  background-color: #f1f1f1;
  color: #2c3e50;
  padding-left: 25px;
}

main li a {
  display: block;
  color: black;
  padding: 8px 16px;
  text-decoration: none;
}

main li a.active {
  background-color: #04AA6D;
  color: white;
}

main li a:hover:not(.active) {
  background-color: #555555;
  color: white;
}

.portfolio-container {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  /* 選單與內容的間距 */
  margin-top: 20px;
}

.portfolio-content {
  display: flex;
  /* 啟用彈性佈局 */
  align-items: flex-start;
  gap: 20px;
  /* 設定選單與顯示區的間距 */
  margin-top: 20px;
}

/* 左側選單固定寬度 */
.portfolio-list {
  width: 200px;
  flex-shrink: 0;
  /* 防止選單被擠壓 */
  margin: 0 !important;
  /* 確保靠左 */
}

/* 右側 iframe 容器撐開剩餘空間 */
.content-display {
  flex-grow: 1;
  height: 500px;
  /* 設定顯示區高度 */
  background-color: white;
  border: 1px solid #ddd;
}

.content-display iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.api-hero-section {
  background-color: transparent;
  padding-top: 40px;
  padding-bottom: 60px;
}

/* 確保 iframe 區塊獨立於上方英雄區，垂直排列 */
.iframe-display-section {
  width: 100%;
  padding: 20px 20px;
  margin-top: -30px;
  /* 關鍵：使用負向外距讓整個區塊往上提，靠近英雄區 */
  align-items: center;
  /* 水平置中內部的 h2 和 news-container */
  background-color: transparent !important;
  border-top: 1px solid #e2e8f0;
}

/* 「每日新聞」標題調整 */
.iframe-display-section h2 {
  text-align: center;
  color: #ffffff !important;
  /* 強制改為白色 */
  text-shadow: 0 4px 15px rgba(0, 0, 0, 1);
  margin-top: 0px;
  margin-bottom: 25px;
  /* 縮減標題與下方新聞卡片的距離 */
}

/* 作品集顯示區 (獨立於天氣 API 之外) */
.iframe-section {
  padding: 50px;
  background-color: transparent !important;
  border-top: 1px solid #e2e8f0;
}


/* 左側 API 選單固定寬度且不跑版 */
.api-list {
  width: 200px;
  flex-shrink: 0;
  /* 防止被擠壓 */
  list-style: none;
  padding: 0;
  margin: 0 !important;
  /* 確保靠左 */
}

/* 右側 iframe 容器 */
.display-area {
  flex-grow: 100px;
  /* 佔滿剩餘寬度 */
  height: 600px;
  /* 設定顯示高度 */
  border: 1px solid #ddd;
  background-color: #fff;
}

.display-area iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* 確保導覽列始終在最上方 */
nav {
  width: 100%;
  background-color: #2c3e50;
  z-index: 1000;
}

/* --- 下拉選單基礎設定 --- */
.dropdown {
  background-color: #2c3e50;
  /* 下拉選單也跟著變深藍色 */
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  /* 讓子選單相對於此項定位 */
  display: inline-block;
}

/* 下拉選單內容容器 (預設隱藏) */
.dropdown-content {
  display: none;
  /* 隱藏 */
  position: absolute;
  /* 絕對定位在標籤下方 */
  background-color: #ffffff;
  min-width: 160px;
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  /* 確保在最上層 */
  top: 100%;
  /* 緊貼在導覽列下方 */
  left: 0;
  list-style: none;
  padding: 0;
}

/* 下拉選單內的項目樣式 */
.dropdown-content li {
  margin: 0;
  /* 移除導覽列原本的間距 */
}

.dropdown-content li a {
  color: #333 !important;
  /* 強制改為深色字 */
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
  font-size: 0.9rem;
  border-bottom: 1px solid #eee;
}

/* 滑鼠移入下拉項目時的顏色 */
.dropdown-content li a:hover {
  background-color: #f1f1f1;
}

/* --- 關鍵：當滑鼠移到 .dropdown 上時，顯示 .dropdown-content --- */
.dropdown:hover .dropdown-content {
  display: block;
}

.weather-provider {
  display: flex;
  justify-content: center;
  padding: 50px;
  background: #0f172a;
  /* 深藍底色 */
  font-family: 'Inter', sans-serif;
}

/* 毛玻璃卡片 */
.weather-card {
  background: rgba(30, 57, 59);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 30px;
  width: 320px;
  text-align: center;
  color: #f8fafc;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2),
    0 10px 10px -5px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.weather-card h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #38bdf8;
  /* 天藍色 */
}

.weather-info {
  margin: 20px 0;
}

#temp {
  font-size: 3rem;
  font-weight: bold;
}

#description {
  color: #94a3b8;
  text-transform: capitalize;
}

/* API 標籤樣式 */
.api-tag {
  display: inline-block;
  background: #1e293b;
  color: #10b981;
  /* 成功綠 */
  padding: 5px 12px;
  border-radius: 12px;
  font-family: monospace;
  font-size: 0.8rem;
  border: 1px solid #10b981;
}

.progress-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  margin-top: 25px;
  margin-bottom: 15px;
  /*更新進度條與api-tag標籤的間距*/
  border-radius: 2px;
  overflow: hidden;
}

#progress-bar {
  width: 0%;
  height: 100%;
  background: #38bdf8;
  transition: width 0.5s linear;
  /* 平滑過渡 */
}

/* 容器：設定寬度與溢出隱藏 */
.marquee-wrapper {
  width: 100%;
  background-color: rgba(51, 51, 51, 0.3);
  /* 黑色半透明 */
  color: rgb(168, 212, 97);
  padding: 10px;
  overflow: hidden;
  /* 隱藏超出邊框的內容 */

  white-space: nowrap;
  /* 確保文字不換行 */
  position: relative;
}

/* 內容：定義動畫 */
.marquee-content {
  display: inline-block;
  padding-left: 100%;
  /* 從容器右側開始 */
  animation: marquee-run 25s linear infinite;
  /* 25秒跑一次，線性，無限循環 */
  font-size: 1.2rem;
}

.marquee-wrapper:hover .marquee-content {
  animation-play-state: paused;
}

/* 針對跑馬燈內容中的所有超連結 */
.marquee-content a {
  text-decoration: none;
  /* 去除底線 */
}

/* 定義位移動畫 */
@keyframes marquee-run {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-100%);
  }
}

:root {
  --card-bg: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --accent-color: #3b82f6;
  /* 科技藍 */
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-fullscreen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
  overflow: hidden;
  padding: 40px 20px;
}

/* 數據流動背景感 (裝飾用) */
.bg-data-lines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(var(--accent-color) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.1;
  mask-image: linear-gradient(to bottom, transparent, black, transparent);
}

.main-content {
  position: relative;
  z-index: 10;
  max-width: 900px;
  text-align: center;
}

.main-title {
  font-size: 60px;
  /* 字體隨螢幕大小縮放 */
  color: var(--text-primary);
  margin-bottom: 1rem;
  letter-spacing: -1px;
}

.name-glow {
  color: var(--accent-color);
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.sub-title {
  font-size: 25px;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

.accent-box {
  background: var(--accent-color);
  color: white;
  padding: 0.2rem 0.8rem;
  border-radius: 8px;
  display: inline-block;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 3rem 0;
}

.feature-item {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  /* 玻璃擬態效果 */
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  background: #dcfce7;
  color: #166534;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2rem;
}

.dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 8px;
  animation: blink 1.5s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.about-section {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
  background: #f8fafc;
  /* 極淺藍灰底色 */
}

.about-card {
  max-width: 800px;
  background: var(--card-bg);
  padding: 40px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  transition: var(--transition);
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.about-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(59, 130, 246, 0.12);
}

.highlight {
  color: var(--accent-color);
  font-weight: 800;
}

.accent-text {
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 2px;
}

.content-divider {
  height: 2px;
  width: 50px;
  background: var(--accent-color);
  margin: 24px 0;
}

.skills-focus {
  background: #f1f5f9;
  padding: 20px;
  border-radius: 12px;
  margin: 20px 0;
}

.focus-item {
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

/* 暗黑模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --card-bg: #1e1e1e;
    --text-primary: #f5f5f5;
    --text-secondary: #aaaaaa;
  }
}

.news-card {
  background: rgba(255, 255, 255, 0.95) !important;
  /* 提高白色的不透明度到 95% */
  width: 100%;
  max-width: 350px;
  border-radius: var(--border-radius);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

/* 懸停效果：提升位移與陰影 */
.news-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border-color: var(--accent-color);
}

/* 圖片處理：固定比例與縮放 */
.news-image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.news-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.news-card:hover .news-image {
  transform: scale(1.05);
}

/* 標籤設計 */
.news-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(59, 130, 246, 0.9);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  backdrop-filter: blur(4px);
}

/* 內容區間距與排版 */
.news-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

time {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.news-title {
  font-size: 1.25rem;
  color: var(--text-primary);
  line-height: 1.4;
  /* 限制標題兩行，超過顯示省略號 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-excerpt {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-footer {
  margin-top: auto;
  padding-top: 15px;
}

.read-more {
  color: var(--accent-color);
  font-weight: 600;
  font-size: 0.9rem;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.news-container {
  display: grid;
  /* 這裡維持響應式，但加入 justify-content 讓整體在中間 */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  justify-content: center;
  /* 網格內容水平置中 */
  justify-items: center;
  /* 讓每一張卡片自己在格子裡也置中 */
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  /* 限制最大寬度，避免在大螢幕拉得太開 */
  margin: 0 auto;
  /* 容器本身置中 */
  padding: 20px;
}

.styled-table {
  border-collapse: collapse;
  margin: 25px auto;
  font-size: 0.9em;
  font-family: sans-serif;
  min-width: 400px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  width: 90%;
  border-radius: 8px;
  overflow: hidden;
  /* For rounded corners */
}

.styled-table thead tr {
  background-color: #004298;
  color: #ffffff;
  text-align: left;
}

.styled-table th,
.styled-table td {
  padding: 12px 15px;
}

.styled-table tbody tr {
  border-bottom: 1px solid #dddddd;
}

.styled-table tbody tr:nth-of-type(even) {
  background-color: #f3f3f3;
}

.styled-table tbody tr:last-of-type {
  border-bottom: 2px solid #009879;
}

.styled-table tbody tr.active-row {
  font-weight: bold;
  color: #009879;
}

/* Specific column adjustments */
.styled-table td:first-child {
  /* Assuming Content column is first or last, we will fix HTML next */
  /* But generally for long content: */
  max-width: 300px;
  white-space: normal;
  line-height: 1.5;
}

.api-content {
  text-align: center;
}