/* ==========================================
   1. 全域字型與主題變數定義 (CSS Variables)
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;700;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* 暖金色與深琥珀色調色彩系統 */
  --bg-gradient: radial-gradient(circle at 50% 0%, hsl(36, 18%, 10%) 0%, hsl(24, 12%, 4%) 100%);
  --panel-bg: rgba(30, 27, 24, 0.55); /* 玻璃貼背景，微帶暖灰色調 */
  --panel-border: rgba(240, 190, 81, 0.08); /* 帶有主色微光的細邊框 */
  --panel-hover-border: rgba(240, 190, 81, 0.25);
  
  --text-primary: hsl(40, 20%, 98%);   /* 暖白文字，較不刺眼 */
  --text-secondary: hsl(40, 12%, 82%); /* 次要說明文字 */
  --text-muted: hsl(40, 8%, 60%);     /* 暗淡輔助文字 */
  
  /* 核心主色與強調色 */
  --primary-color: #F0BE51;           /* 核心主色：黃金色 (代表股市繁榮與財富) */
  --accent-color: #f97316;            /* 輔助強調色：暖橙色 (代表活力與上漲動能) */
  
  /* 產業定位標籤漸層色 (在深色背景下特別優化的半透明發光漸層) */
  --tag-upstream: linear-gradient(135deg, rgba(239, 68, 68, 0.85), rgba(220, 38, 38, 0.9));    /* 上游：紅色 (熱情、核心) */
  --tag-midstream: linear-gradient(135deg, rgba(249, 115, 22, 0.85), rgba(217, 70, 239, 0.9));  /* 中游：橘紫 (關鍵過渡) */
  --tag-downstream: linear-gradient(135deg, rgba(56, 189, 248, 0.85), rgba(37, 99, 235, 0.9)); /* 下游：藍色 (應用、終端) */
  --tag-etf: linear-gradient(135deg, rgba(168, 85, 247, 0.85), rgba(124, 58, 237, 0.9));       /* ETF：紫色 (多元、平穩) */
  --tag-finance: linear-gradient(135deg, rgba(234, 179, 8, 0.85), rgba(202, 138, 4, 0.9));     /* 金融：金黃 (財富、穩健) */
  --tag-traditional: linear-gradient(135deg, rgba(139, 92, 26, 0.85), rgba(105, 68, 15, 0.9)); /* 傳產：棕褐 (歷史、厚實) */
  --tag-shipping: linear-gradient(135deg, rgba(20, 184, 166, 0.85), rgba(13, 148, 136, 0.9));  /* 航運：青綠 (海洋、通達) */
  
  /* 現代多層細緻陰影與金色發光效果 */
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(240, 190, 81, 0.12);
  
  --font-family: 'Outfit', 'Noto Sans TC', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================
   2. 基本排版與初始化
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  padding-bottom: 80px;
}

/* 背景動態金色微光效果 (左上與右下發光) */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(240, 190, 81, 0.08) 0%, rgba(240, 190, 81, 0) 70%);
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: absolute;
  bottom: 10%;
  right: 5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(249, 115, 22, 0.06) 0%, rgba(249, 115, 22, 0) 70%);
  filter: blur(60px);
  z-index: -1;
  pointer-events: none;
}

/* ==========================================
   3. 版面佈局與頁首 (Layout & Header)
   ========================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

header {
  text-align: center;
  padding: 50px 0 30px 0; /* 調整上下間距，提升整體呼吸感 */
}

/* 網頁橫幅圖片包覆器：設定圓角、外框、精緻發光與過渡動畫 */
.banner-wrapper {
  width: 100%;
  height: 260px; /* 固定高度，呈現電影感寬螢幕比例 */
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 35px;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  transition: var(--transition-smooth);
}

/* 橫幅懸停特效：輕微向上移動並加強發光邊框 */
.banner-wrapper:hover {
  transform: translateY(-5px);
  border-color: var(--panel-hover-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 35px rgba(240, 190, 81, 0.2);
}

/* 橫幅圖片本體：確保圖片填滿容器並呈現絕佳比例 */
.main-banner {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 自動裁切填滿 */
  object-position: center;
  filter: brightness(0.85) contrast(1.05); /* 稍微降低亮度提升質感 */
  transition: var(--transition-smooth);
}

/* 懸停時的圖片縮放微動畫 */
.banner-wrapper:hover .main-banner {
  transform: scale(1.03); /* 輕微放大 */
  filter: brightness(0.95) contrast(1.05); /* 恢復亮麗色彩 */
}

/* 主標題：白、金、橙漸層，高雅且具財富感 */
header h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff 10%, var(--primary-color) 60%, var(--accent-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

header p {
  color: var(--text-secondary);
  font-size: 1.15rem;
  font-weight: 300;
  letter-spacing: 0.5px;
}

/* ==========================================
   4. 搜尋功能與產業導覽列 (Search & Navigation)
   ========================================== */
.search-nav-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  margin-bottom: 50px;
}

/* 搜尋列包覆容器 */
.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
}

.search-input {
  width: 100%;
  padding: 16px 20px 16px 52px;
  border-radius: 99px;
  border: 1px solid var(--panel-border);
  background: rgba(30, 27, 24, 0.55);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  backdrop-filter: blur(8px);
  transition: var(--transition-smooth);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 25px rgba(240, 190, 81, 0.22);
  background: rgba(30, 27, 24, 0.85);
}

/* 搜尋圖示 */
.search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1.1rem;
}

/* 產業切換按鈕區域 */
.industry-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* 產業按鈕基本樣式 */
.industry-btn {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-secondary);
  padding: 12px 24px;
  border-radius: 99px; /* 膠囊狀圓角 */
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: var(--transition-smooth);
}

/* 按鈕懸停效果：輕微上升與邊框發光 */
.industry-btn:hover {
  border-color: var(--panel-hover-border);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(240, 190, 81, 0.08);
}

/* 按鈕點擊瞬間縮小回饋 */
.industry-btn:active {
  transform: translateY(-1px) scale(0.97);
}

/* 當前啟用的按鈕樣式：採用金黃至橙色漸層 */
.industry-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border-color: transparent;
  color: #1e1b18; /* 配合深暗色背景以提供極佳對比度 */
  font-weight: 700;
  box-shadow: 0 10px 20px -5px rgba(240, 190, 81, 0.35);
  transform: translateY(-2px);
}

/* ==========================================
   5. 產業介紹板塊 (Glassmorphism Info Panel)
   ========================================== */
.industry-info-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 35px;
  margin-bottom: 45px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.industry-info-panel h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary-color); /* 改為金黃主色，突顯焦點 */
  display: flex;
  align-items: center;
  gap: 10px;
}

.industry-info-panel h2::before {
  content: '⚡'; /* 點綴裝飾 */
  font-size: 1.4rem;
}

.industry-info-panel p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ==========================================
   6. 台股標的卡片網格 (Stocks Grid & Cards)
   ========================================== */
.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px; /* 增加間距，畫面更為舒朗 */
}

/* 股票卡片樣式：半透明玻璃擬物設計 */
.stock-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 28px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: fadeIn 0.5s ease-out forwards;
}

/* 卡片懸停特效：流暢放大、上移，並散發細緻金色微光 */
.stock-card:hover {
  transform: translateY(-6px) scale(1.015);
  border-color: var(--panel-hover-border);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7), 0 0 30px rgba(240, 190, 81, 0.15);
}

/* 卡片上方區域（代號、名稱、供應鏈定位） */
.stock-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.stock-title {
  display: flex;
  flex-direction: column;
}

/* 股票代號 */
.stock-code {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 1px;
}

/* 股票名稱 */
.stock-name {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 2px;
  color: var(--text-primary);
}

/* 供應鏈定位標籤 (上、中、下游、ETF、金融等) */
.chain-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 8px; /* 圓角調整 */
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* 提升文字對比度 */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* 定位標籤類別背景色 */
.chain-tag.upstream { background: var(--tag-upstream); }
.chain-tag.midstream { background: var(--tag-midstream); }
.chain-tag.downstream { background: var(--tag-downstream); }
.chain-tag.etf { background: var(--tag-etf); }
.chain-tag.finance { background: var(--tag-finance); }
.chain-tag.traditional { background: var(--tag-traditional); }
.chain-tag.shipping { background: var(--tag-shipping); }

/* 卡片主內容區域 */
.stock-body {
  flex-grow: 1;
  margin-bottom: 22px;
}

/* 代表角色定位 */
.stock-role {
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 12px;
  border-left: 3px solid var(--primary-color); /* 左側點綴條改為黃金色 */
  padding-left: 10px;
}

.stock-desc {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 15px;
  line-height: 1.6;
}

/* 標的優勢與亮點區塊 */
.stock-highlights {
  background: rgba(30, 27, 24, 0.5); /* 與整體暖色調背景呼應 */
  border: 1px solid rgba(240, 190, 81, 0.05);
  border-radius: 14px;
  padding: 16px;
}

.stock-highlights h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-color); /* 亮點標題改為主色黃金色 */
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stock-highlights ul {
  list-style: none;
}

.stock-highlights li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  position: relative;
  padding-left: 16px;
  margin-bottom: 5px;
}

.stock-highlights li:last-child {
  margin-bottom: 0;
}

/* 自訂清單小點點：精緻星芒符號 */
.stock-highlights li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--primary-color);
  font-size: 0.75rem;
}

/* ==========================================
   7. 進場動畫效果 (Keyframes)
   ========================================== */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(25px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================
   8. 響應式設計 (RWD) - 行動裝置最佳化
   ========================================== */
@media (max-width: 768px) {
  /* 調降手機版頁首的上下邊距 */
  header {
    padding: 30px 0 20px 0;
  }
  
  /* 行動裝置橫幅微調：降低高度並縮小圓角，更適合垂直螢幕閱讀 */
  .banner-wrapper {
    height: 160px;
    margin-bottom: 25px;
    border-radius: 16px;
  }
  
  header h1 {
    font-size: 2.1rem; /* 減小標題字型大小以免換行突兀 */
  }
  
  header p {
    font-size: 1rem;
  }
  
  .search-nav-container {
    gap: 20px;
    margin-bottom: 30px;
  }
  
  /* 搜尋列在手機上的尺寸微調 */
  .search-input {
    padding: 14px 18px 14px 48px;
    font-size: 0.95rem;
  }
  
  .search-icon {
    left: 18px;
    font-size: 1rem;
  }
  
  /* 手機版按鈕緊湊排列，防溢出 */
  .industry-nav {
    gap: 8px;
  }
  
  .industry-btn {
    padding: 10px 18px;
    font-size: 0.88rem;
  }
  
  .industry-info-panel {
    padding: 24px;
    margin-bottom: 30px;
    border-radius: 16px;
  }
  
  .industry-info-panel h2 {
    font-size: 1.4rem;
  }
  
  .industry-info-panel p {
    font-size: 0.95rem;
  }
  
  /* 股票卡片改為單欄排列 */
  .stocks-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .stock-card {
    padding: 24px;
    border-radius: 16px;
  }
  
  .stock-name {
    font-size: 1.3rem;
  }
}
