/* ============================================================
   鑽井工程完整技術視覺化指南 - 共用樣式
   ============================================================ */

/* --- 基本重置 & 字型 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:     #0a3d6b;
  --primary-mid: #1565a8;
  --primary-light:#2196f3;
  --accent:      #00bcd4;
  --accent2:     #ff9800;
  --bg-dark:     #0d1b2a;
  --bg-mid:      #112240;
  --bg-light:    #f0f6ff;
  --card-bg:     #ffffff;
  --text-dark:   #1a2332;
  --text-mid:    #4a6080;
  --text-light:  #e8f4fd;
  --border:      #cce0f5;
  --success:     #2e7d32;
  --warning:     #f57c00;
  --danger:      #c62828;
  --radius:      12px;
  --shadow:      0 4px 20px rgba(10,61,107,.12);
  --shadow-lg:   0 8px 40px rgba(10,61,107,.2);
  --transition:  all .3s ease;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', Arial, sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.7;
  font-size: 16px;
}

/* --- 捲軸美化 --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #e8f0fe; }
::-webkit-scrollbar-thumb { background: var(--primary-mid); border-radius: 4px; }

/* ============================================================
   導航列
   ============================================================ */
.site-nav {
  position: sticky; top: 0; z-index: 1000;
  background: var(--bg-dark);
  box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.nav-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center;
  padding: 0 24px; height: 64px; gap: 8px;
}
.nav-logo {
  font-size: 1.1rem; font-weight: 700;
  color: var(--accent); text-decoration: none;
  white-space: nowrap; margin-right: 16px;
  display: flex; align-items: center; gap: 8px;
}
.nav-logo span { font-size: 1.4rem; }
.nav-links {
  display: flex; flex-wrap: wrap; gap: 2px;
  list-style: none; flex: 1;
}
.nav-links a {
  color: #aac4e8; text-decoration: none;
  padding: 6px 10px; border-radius: 6px;
  font-size: .82rem; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active {
  background: var(--primary-mid); color: #fff;
}
.nav-home { color: var(--accent) !important; }

/* ============================================================
   頁面英雄區
   ============================================================ */
.page-hero {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-mid) 50%, var(--primary) 100%);
  color: #fff; padding: 64px 24px 48px;
  position: relative; overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.page-hero-inner { max-width: 1200px; margin: 0 auto; position: relative; }
.page-hero .badge {
  display: inline-block;
  background: rgba(0,188,212,.2); border: 1px solid var(--accent);
  color: var(--accent); border-radius: 20px;
  padding: 4px 16px; font-size: .8rem; font-weight: 600;
  letter-spacing: .5px; margin-bottom: 16px;
}
.page-hero h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800; line-height: 1.2;
  margin-bottom: 16px;
}
.page-hero p {
  font-size: 1.05rem; color: #b0c8e8;
  max-width: 700px; line-height: 1.8;
}

/* ============================================================
   主要內容區
   ============================================================ */
.page-content { max-width: 1200px; margin: 0 auto; padding: 40px 24px 80px; }

/* ============================================================
   區塊標題
   ============================================================ */
.section-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--primary); margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--primary-light);
  display: flex; align-items: center; gap: 10px;
}
.section-title .icon { font-size: 1.6rem; }

.subsection-title {
  font-size: 1.2rem; font-weight: 700;
  color: var(--primary-mid); margin: 28px 0 16px;
  padding-left: 14px;
  border-left: 4px solid var(--primary-light);
}

/* ============================================================
   卡片
   ============================================================ */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; margin-bottom: 32px;
}
.card-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 32px;
}

.info-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  border-left: 5px solid var(--primary-light);
  margin-bottom: 16px;
}
.info-card.warning { border-left-color: var(--warning); }
.info-card.danger  { border-left-color: var(--danger); }
.info-card.success { border-left-color: var(--success); }
.info-card.accent  { border-left-color: var(--accent); }

.info-card h4 {
  font-size: 1rem; font-weight: 700;
  color: var(--primary); margin-bottom: 8px;
}
.info-card.warning h4 { color: var(--warning); }
.info-card.danger h4  { color: var(--danger); }
.info-card.success h4 { color: var(--success); }
.info-card.accent h4  { color: #007c8a; }

/* ============================================================
   表格
   ============================================================ */
.table-wrapper {
  overflow-x: auto; margin: 20px 0 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem;
}
thead tr {
  background: var(--primary);
  color: #fff;
}
thead th {
  padding: 14px 16px; text-align: left;
  font-weight: 600; font-size: .85rem;
  letter-spacing: .3px;
}
tbody tr { border-bottom: 1px solid #e8f0fe; }
tbody tr:nth-child(even) { background: #f5f9ff; }
tbody tr:hover { background: #e3f0ff; }
tbody td { padding: 12px 16px; vertical-align: top; }
.td-center { text-align: center; }
.td-num { font-weight: 600; color: var(--primary-mid); }

/* ============================================================
   標籤和說明
   ============================================================ */
.tag {
  display: inline-block;
  padding: 3px 10px; border-radius: 12px;
  font-size: .75rem; font-weight: 600;
  margin: 2px;
}
.tag-blue { background: #e3f0ff; color: var(--primary); }
.tag-cyan { background: #e0f7fa; color: #006064; }
.tag-orange { background: #fff3e0; color: #e65100; }
.tag-red { background: #ffebee; color: #b71c1c; }
.tag-green { background: #e8f5e9; color: #1b5e20; }
.tag-purple { background: #f3e5f5; color: #4a148c; }

/* ============================================================
   公式區塊
   ============================================================ */
.formula-box {
  background: linear-gradient(135deg, #e8f4fd 0%, #f0f8ff 100%);
  border: 1px solid #b3d4f5;
  border-radius: var(--radius);
  padding: 20px 24px; margin: 16px 0;
}
.formula-box .formula {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem; font-weight: 700;
  color: var(--primary); text-align: center;
  background: #fff; border-radius: 8px;
  padding: 12px; margin: 8px 0;
  border: 1px solid #c5dff8;
}
.formula-box .formula-note {
  font-size: .85rem; color: var(--text-mid);
  margin-top: 8px;
}

/* ============================================================
   流程圖/步驟
   ============================================================ */
.step-flow {
  display: flex; flex-wrap: wrap;
  align-items: center; gap: 8px;
  margin: 20px 0;
}
.step-item {
  background: var(--primary);
  color: #fff; border-radius: 8px;
  padding: 10px 18px; font-size: .9rem; font-weight: 600;
  text-align: center; flex: 1; min-width: 120px;
}
.step-item.alt { background: var(--primary-mid); }
.step-item.accent { background: var(--accent); color: var(--text-dark); }
.step-arrow {
  font-size: 1.4rem; color: var(--primary-light);
  flex-shrink: 0;
}

/* ============================================================
   比較表格（雙欄）
   ============================================================ */
.compare-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px; margin: 20px 0;
}
.compare-col {
  border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--border);
}
.compare-col.left  { background: #e8f4fd; border-color: var(--primary-light); }
.compare-col.right { background: #fff3e0; border-color: var(--accent2); }
.compare-col h4 {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 2px solid currentColor;
}
.compare-col.left h4  { color: var(--primary); }
.compare-col.right h4 { color: var(--warning); }
.compare-col ul { list-style: none; padding: 0; }
.compare-col ul li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,.07);
  font-size: .9rem;
  display: flex; align-items: flex-start; gap: 8px;
}
.compare-col ul li::before { content: '▶'; font-size: .7rem; margin-top: 4px; flex-shrink: 0; }
.compare-col.left ul li::before  { color: var(--primary); }
.compare-col.right ul li::before { color: var(--warning); }

/* ============================================================
   數據視覺化橫條
   ============================================================ */
.bar-item {
  display: flex; align-items: center;
  gap: 12px; margin: 8px 0;
}
.bar-label { width: 140px; font-size: .85rem; flex-shrink: 0; }
.bar-track {
  flex: 1; background: #e8f0fe;
  border-radius: 6px; height: 22px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; padding-left: 8px;
  color: #fff; font-size: .75rem; font-weight: 600;
  transition: width 1s ease;
}
.bar-fill.orange { background: linear-gradient(90deg, #e65100, var(--accent2)); }
.bar-fill.cyan   { background: linear-gradient(90deg, #006064, var(--accent)); }
.bar-fill.green  { background: linear-gradient(90deg, #1b5e20, #4caf50); }

/* ============================================================
   提示框
   ============================================================ */
.alert {
  border-radius: 8px; padding: 14px 18px;
  margin: 16px 0; display: flex;
  align-items: flex-start; gap: 12px;
  font-size: .9rem;
}
.alert-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.alert.info    { background: #e3f0ff; border-left: 4px solid var(--primary-light); color: var(--primary); }
.alert.warning { background: #fff8e1; border-left: 4px solid #ffc107; color: #5d4037; }
.alert.danger  { background: #ffebee; border-left: 4px solid var(--danger); color: #b71c1c; }
.alert.success { background: #e8f5e9; border-left: 4px solid #4caf50; color: #1b5e20; }

/* ============================================================
   麵包屑
   ============================================================ */
.breadcrumb {
  max-width: 1200px; margin: 0 auto;
  padding: 12px 24px 0;
  font-size: .85rem; color: var(--text-mid);
  display: flex; align-items: center; gap: 8px;
}
.breadcrumb a { color: var(--primary-light); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #aaa; }

/* ============================================================
   頁尾
   ============================================================ */
.site-footer {
  background: var(--bg-dark); color: #aac4e8;
  text-align: center; padding: 32px 24px;
  font-size: .85rem; margin-top: 60px;
}
.site-footer .footer-links {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 16px; margin-bottom: 16px;
}
.site-footer .footer-links a {
  color: var(--accent); text-decoration: none;
}
.site-footer .footer-links a:hover { text-decoration: underline; }

/* ============================================================
   首頁特有樣式
   ============================================================ */
.home-hero {
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0d2a4a 40%, var(--primary) 100%);
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  color: #fff; text-align: center; padding: 60px 24px;
  position: relative; overflow: hidden;
}
.home-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(33,150,243,.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(0,188,212,.1) 0%, transparent 50%);
}
.home-hero-content { position: relative; z-index: 1; max-width: 900px; }
.home-hero .main-badge {
  display: inline-block;
  background: rgba(0,188,212,.15); border: 1px solid var(--accent);
  color: var(--accent); border-radius: 30px;
  padding: 8px 24px; font-size: .9rem; font-weight: 600;
  letter-spacing: 1px; margin-bottom: 24px;
}
.home-hero h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900; line-height: 1.15;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.home-hero p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: #b0c8e8; max-width: 680px; margin: 0 auto 36px;
  line-height: 1.8;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px; padding: 40px 24px;
  max-width: 1400px; margin: 0 auto;
}
.topic-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  text-decoration: none; color: inherit;
  transition: var(--transition);
  display: flex; flex-direction: column;
}
.topic-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}
.topic-card-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-mid) 100%);
  padding: 20px 24px; color: #fff;
  display: flex; align-items: center; gap: 14px;
}
.topic-card-header .num {
  background: rgba(255,255,255,.2); border-radius: 50%;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; flex-shrink: 0;
}
.topic-card-header h3 { font-size: 1rem; font-weight: 700; line-height: 1.4; }
.topic-card-body { padding: 18px 24px; flex: 1; }
.topic-card-body p { font-size: .88rem; color: var(--text-mid); line-height: 1.7; margin-bottom: 12px; }
.topic-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--primary-light);
  font-weight: 600; display: flex; align-items: center;
  justify-content: space-between;
}

/* ============================================================
   圖解框
   ============================================================ */
.diagram-box {
  background: linear-gradient(135deg, #f0f6ff 0%, #e8f0fe 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px; margin: 20px 0;
  text-align: center;
}
.diagram-box .diagram-title {
  font-size: .85rem; font-weight: 700;
  color: var(--text-mid); margin-bottom: 16px;
  text-transform: uppercase; letter-spacing: .5px;
}

/* 垂直時間軸 */
.timeline {
  position: relative; padding-left: 36px;
  margin: 24px 0;
}
.timeline::before {
  content: '';
  position: absolute; left: 12px; top: 0; bottom: 0;
  width: 3px; background: linear-gradient(180deg, var(--primary-light), var(--accent));
  border-radius: 2px;
}
.tl-item {
  position: relative; margin-bottom: 28px;
}
.tl-dot {
  position: absolute; left: -30px; top: 4px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--primary-light);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--primary-light);
}
.tl-year {
  font-size: .8rem; font-weight: 700;
  color: var(--primary-light); letter-spacing: .5px;
  margin-bottom: 4px;
}
.tl-content {
  background: #fff; border-radius: 8px;
  padding: 14px 18px; box-shadow: 0 2px 8px rgba(10,61,107,.08);
  border: 1px solid var(--border);
}
.tl-content h4 { font-size: .95rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.tl-content p  { font-size: .87rem; color: var(--text-mid); line-height: 1.6; }

/* 色塊標籤 */
.color-badge {
  display: inline-block; padding: 6px 14px;
  border-radius: 8px; font-weight: 700;
  font-size: .85rem; margin: 4px;
}

/* 響應式 */
@media (max-width: 768px) {
  .compare-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .step-flow { flex-direction: column; }
  .step-arrow { transform: rotate(90deg); }
  .card-grid, .card-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .page-hero { padding: 40px 16px 32px; }
  .page-content { padding: 24px 16px 60px; }
}
