/* ===== 顏色設定：淺色為預設，深色模式在下方覆寫 ===== */
:root {
  --bg: #f5f8fc;
  --bg-alt: #e9eff7;
  --card: #ffffff;
  --text: #1a2433;
  --muted: #5a6880;
  --line: #d5deea;
  --brand: #1556b8;
  --brand-2: #10a5c9;
  --header: rgba(255, 255, 255, 0.78);
  --shadow: 0 6px 24px rgba(16, 40, 80, 0.08);
}

/* 使用者電腦設定為深色，而且沒有手動切成淺色時 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --bg-alt: #101a2c;
    --card: #142036;
    --text: #e6edf7;
    --muted: #9aaac2;
    --line: #24324b;
    --brand: #4f8ff0;
    --brand-2: #35c6e6;
    --header: rgba(11, 18, 32, 0.78);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }
}

/* 手動切成深色時 */
:root[data-theme="dark"] {
  --bg: #0b1220;
  --bg-alt: #101a2c;
  --card: #142036;
  --text: #e6edf7;
  --muted: #9aaac2;
  --line: #24324b;
  --brand: #4f8ff0;
  --brand-2: #35c6e6;
  --header: rgba(11, 18, 32, 0.78);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* ===== 基本設定 ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.7;
}
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.3; }
h2 { font-size: 1.8rem; margin: 0 0 1.2rem; }

/* 內容寬度，左右至少留 16px */
.wrap { width: min(1160px, 100% - 32px); margin: 0 auto; }
.narrow { width: min(860px, 100% - 32px); }

/* ===== 頁首：半透明玻璃效果 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo img { display: block; height: 36px; width: auto; background: #fff; border-radius: 6px; padding: 2px 6px; }
.site-nav { display: flex; gap: 22px; margin-left: auto; }
.site-nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.site-nav a:hover { color: var(--brand); }
.header-tools { display: flex; align-items: center; gap: 8px; }
.lang { font-weight: 600; text-decoration: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  cursor: pointer; font-size: 1rem;
}
.menu-btn { display: none; }

/* ===== 首頁大圖區（輪播） ===== */
/* 所有輪播頁疊在同一格，只有 is-active 那張看得到 */
.hero { display: grid; position: relative; color: #fff; background: #061432; overflow: hidden; }
.slide {
  grid-area: 1 / 1; position: relative; padding: 120px 0 110px;
  display: flex; align-items: center;
  opacity: 0; visibility: hidden; transition: opacity 0.8s, visibility 0.8s;
}
.slide.is-active { opacity: 1; visibility: visible; }
/* 第一張：公司介紹，用固定背景圖 */
.slide:first-child {
  background: linear-gradient(120deg, rgba(6, 20, 50, 0.85), rgba(10, 60, 130, 0.55)), url("hero-bg.jpg") center / cover;
}
/* 其他張：用後台上傳的圖片，再蓋一層深色讓字看得清楚 */
.slide-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slide:not(:first-child)::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(120deg, rgba(6, 20, 50, 0.88), rgba(10, 60, 130, 0.45));
}
.slide .hero-inner { position: relative; z-index: 2; }
.slide-title { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 16px; }
/* 輪播下方的小圓點 */
.dots { position: absolute; left: 0; right: 0; bottom: 24px; display: flex; justify-content: center; gap: 10px; z-index: 3; }
.dots button {
  width: 12px; height: 12px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid #fff; background: transparent;
}
.dots button[aria-current="true"] { background: #fff; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 16px; max-width: 16em; }
.eyebrow { color: #7fe3ff; letter-spacing: 0.08em; margin: 0 0 12px; }
.hero-text { max-width: 40em; color: #d6e2f5; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ===== 按鈕 ===== */
.btn {
  display: inline-block; padding: 10px 22px; border-radius: 999px; border: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #fff; text-decoration: none; font-weight: 600; cursor: pointer; font-size: 1rem;
}
.btn-light { background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.5); }
.btn-ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }

/* ===== 區塊 ===== */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-alt); }
.two-col { display: grid; grid-template-columns: 3fr 2fr; gap: 48px; }
.prose h3 { margin: 1.6rem 0 0.4rem; }

/* 大事記時間軸 */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--brand); }
.timeline li { display: flex; gap: 14px; padding: 0 0 14px 16px; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 8px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--brand-2);
}
.timeline .year { font-weight: 700; color: var(--brand); min-width: 3em; }

/* ===== 產品卡片 ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.card h3 { margin: 14px 0 6px; font-size: 1.15rem; }
.card > p { color: var(--muted); flex: 1; margin: 0 0 16px; }
.card .btn { align-self: flex-start; }
.card-img {
  height: 160px; border-radius: 10px; background: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-img img { max-height: 100%; object-fit: contain; }
.no-image { color: #8a96aa; }

/* 產品詳細彈窗 */
.product-dialog {
  width: min(960px, 100% - 32px); max-height: 88vh; padding: 0;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); color: var(--text);
}
.product-dialog::backdrop { background: rgba(5, 12, 25, 0.6); }
.dialog-head {
  position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.dialog-head h3 { margin: 0; }
.dialog-close { font-size: 1.6rem; background: none; border: 0; color: var(--text); cursor: pointer; }
.dialog-body { padding: 8px 20px 24px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.gallery figure, figure { margin: 0 0 12px; }
.gallery img, figure img { background: #fff; border-radius: 8px; }
figcaption { font-size: 0.9rem; color: var(--muted); }

/* 規格表：太寬時可以左右捲動 */
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; white-space: nowrap; }
th { background: var(--bg-alt); }

/* ===== 消息與常見問題（點標題展開） ===== */
details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; }
summary { cursor: pointer; padding: 14px 18px; display: flex; gap: 16px; font-weight: 500; }
summary time { color: var(--muted); white-space: nowrap; }
.news-body, .faq-item > div { padding: 0 18px 12px; }

/* 聯絡資訊 */
.contact-list { list-style: none; padding: 0; margin: 0 0 20px; }
.contact-list li { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact-list strong { min-width: 5em; }

.site-footer { padding: 28px 0; color: var(--muted); text-align: center; border-top: 1px solid var(--line); }

/* ===== 首頁大圖下方的公司小檔案 ===== */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 40px; max-width: 900px; }
.fact {
  padding: 12px 16px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.25);
}
.fact span { display: block; font-size: 0.85rem; color: #a9c4ea; }
.fact strong { font-size: 1.05rem; }

/* ===== 區塊內的小標題 ===== */
.sub-title { font-size: 1.4rem; margin: 64px 0 20px; padding-left: 12px; border-left: 4px solid var(--brand-2); }
.lead { font-size: 1.1rem; max-width: 48em; }
.muted { color: var(--muted); }

/* 小方塊：five 是一排五個，three 是一排三個 */
.tiles { display: grid; gap: 20px; align-items: start; }
.tiles.five { grid-template-columns: repeat(5, 1fr); }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; box-shadow: var(--shadow);
}
.tile h3 { margin: 0 0 8px; font-size: 1.1rem; color: var(--brand); }
.tile p { margin: 0 0 12px; }
.big { font-size: 1.8rem; font-weight: 700; }

/* 認證、專利的大數字 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 32px; }
.stat { text-align: center; padding: 20px; border-radius: 16px; background: var(--bg-alt); }
.stat strong {
  display: block; font-size: 2.6rem; line-height: 1.2;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat span { color: var(--muted); }
.two-col.even { grid-template-columns: 1fr 1fr; }

/* 合作夥伴 */
.partners { display: flex; flex-wrap: wrap; gap: 12px; }
.partner {
  padding: 12px 24px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text); text-decoration: none; font-weight: 600;
}
.partner:hover { border-color: var(--brand); color: var(--brand); }

/* 投資人專區的近期公告 */
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; flex-direction: column; padding: 6px 0; border-bottom: 1px solid var(--line); }
.recent time { font-size: 0.85rem; color: var(--muted); }
.recent a { color: var(--text); text-decoration: none; }
.recent a:hover { color: var(--brand); }

/* 檔案下載清單 */
.file-list { margin: 0; padding-left: 1.2em; }
.file-list li { padding: 4px 0; }

/* ===== 線上諮詢表單 ===== */
.inquiry {
  margin-top: 32px; padding: 24px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.inquiry h3 { margin: 0 0 4px; }
.inquiry label { display: block; margin-bottom: 14px; font-weight: 500; }
.inquiry input, .inquiry select, .inquiry textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-status { margin: 12px 0 0; font-weight: 600; }
/* 防垃圾留言的隱藏欄位：移到畫面外 */
.trap { position: absolute; left: -9999px; }

/* ===== 捲動時淡入（由 script.js 加上 show） ===== */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s, transform 0.6s; }
.reveal.show { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .slide { transition: none; }
}

/* 平板寬度：五格改成三格，避免太擠 */
@media (max-width: 1100px) {
  .tiles.five { grid-template-columns: repeat(3, 1fr); }
}

/* ===== 手機版 ===== */
@media (max-width: 860px) {
  .two-col, .two-col.even, .tiles.three { grid-template-columns: 1fr; }
  .tiles.five, .facts { grid-template-columns: 1fr 1fr; }
  .stats { gap: 10px; }
  .stat strong { font-size: 2rem; }
  .menu-btn { display: inline-block; }
  .header-tools { margin-left: auto; }
  .site-nav {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--card); border-bottom: 1px solid var(--line);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 14px 16px; border-top: 1px solid var(--line); }
  .slide { padding: 80px 0 70px; }
  .section { padding: 56px 0; }
  summary { flex-direction: column; gap: 2px; }
  .form-grid { grid-template-columns: 1fr; }
}
