/* =============================================================
   JET OPTO 凱銳光電 — Design System v2 "Sensory Motion"
   零框架 / 零 jQuery / 零外部字體 — 純現代 CSS
   ============================================================= */

/* ---------- Tokens ---------- */
:root {
  /* 底色系：深墨藍黑 + 中性層 */
  --ink-950: #04070d;
  --ink-900: #070b14;
  --ink-850: #0a101c;
  --ink-800: #0e1524;
  --ink-700: #16203a;
  --ink-600: #24314f;
  --line: rgba(148, 175, 220, .14);
  --line-strong: rgba(148, 175, 220, .28);

  --paper: #f4f6fb;
  --paper-dim: #e7ebf4;

  --txt: #eef3fb;
  --txt-dim: rgba(222, 232, 248, .72);
  --txt-mute: rgba(200, 214, 238, .48);
  --txt-ink: #0b1220;
  --txt-ink-dim: rgba(11, 18, 32, .68);

  /* 三產品線 */
  --ent: #F06FA7;      /* 車用娛樂 洋紅 */
  --ckpt: #38BDF8;     /* 智慧座艙 冰藍 */
  --safe: #34D399;     /* 行車安全 綠青 */
  --ent-rgb: 240, 111, 167;
  --ckpt-rgb: 56, 189, 248;
  --safe-rgb: 52, 211, 153;

  --accent: var(--ckpt);
  --accent-rgb: var(--ckpt-rgb);

  /* 字體：系統疊層，載入零延遲 */
  --font-sans: "Segoe UI", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
               -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;

  /* 節奏 */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-inout: cubic-bezier(.65, 0, .35, 1);
  --dur-fast: .35s;
  --dur: .7s;
  --dur-slow: 1.2s;

  --radius: 18px;
  --radius-lg: 28px;
  --gutter: clamp(20px, 4.5vw, 72px);
  --section-pad: clamp(84px, 12vh, 160px);
  --header-h: 76px;
  --container: 1440px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--ink-950);
  color: var(--txt);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
h1, h2, h3, h4, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
::selection { background: rgba(var(--accent-rgb), .35); color: #fff; }

/* 捲軸 */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink-950); }
::-webkit-scrollbar-thumb { background: var(--ink-600); border-radius: 99px; border: 2px solid var(--ink-950); }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--accent-rgb), .6); }

/* ---------- Layout ---------- */
.container { width: min(100% - var(--gutter) * 2, var(--container)); margin-inline: auto; }
.section { padding-block: var(--section-pad); position: relative; }

/* 區塊標籤（三線色標記點） */
.sec-label {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 13px; font-weight: 700; letter-spacing: .32em; text-transform: uppercase;
  color: var(--txt-mute); margin-bottom: 22px;
}
.sec-label::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--label-dot, var(--accent));
  box-shadow: 0 0 12px 2px rgba(var(--label-rgb, var(--accent-rgb)), .55);
}
.sec-title {
  font-size: clamp(30px, 4.6vw, 60px);
  font-weight: 800; line-height: 1.12; letter-spacing: -.02em;
}
.sec-title .thin { font-weight: 300; color: var(--txt-dim); }
.sec-lede { max-width: 640px; color: var(--txt-dim); font-size: clamp(15px, 1.25vw, 18px); margin-top: 18px; }

/* 漸層文字 */
.grad-text {
  background: linear-gradient(100deg, var(--ent) 0%, var(--ckpt) 52%, var(--safe) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 900;
  height: var(--header-h);
  display: flex; align-items: center;
  transition: transform .5s var(--ease-out), background .4s, border-color .4s, backdrop-filter .4s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: rgba(5, 8, 15, .72);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom-color: var(--line);
}
.site-header.hidden { transform: translateY(-100%); }
.header-inner {
  width: min(100% - var(--gutter) * 2, var(--container));
  margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.brand img { height: 40px; width: auto; }

/* 桌機導航 */
.nav-desktop { display: flex; align-items: center; gap: 4px; margin-left: auto; }  /* 選單靠右,與首頁/內頁一致(2026-07-28) */
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px; font-size: 14.5px; font-weight: 600;
  color: var(--txt-dim); border-radius: 10px;
  transition: color .3s, background .3s;
}
.nav-link:hover, .nav-item:focus-within .nav-link { color: #fff; background: rgba(255, 255, 255, .06); }
/* ── 極小實心三角 caret(2026-07-20 精巧版) ── */
.nav-link .caret {
  display: inline-block; width: 0; height: 0; margin-left: 1px; border-radius: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid currentColor;
  opacity: .28;
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), opacity .3s, border-top-color .3s;
}
.nav-item:hover .caret, .nav-item:focus-within .caret {
  opacity: 1; transform: rotate(180deg);
  border-top-color: var(--ckpt, #38BDF8);
}

.nav-drop {
  position: absolute; top: calc(100% + 14px); left: 50%;
  translate: -50% 0;
  min-width: 236px;
  background: rgba(10, 16, 28, .92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  opacity: 0; visibility: hidden; transform: translateY(12px) scale(.97);
  transform-origin: top center;
  transition: opacity .32s var(--ease-out), transform .32s var(--ease-out), visibility 0s .32s;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.nav-item:hover .nav-drop, .nav-item:focus-within .nav-drop {
  opacity: 1; visibility: visible; transform: translateY(0) scale(1);
  transition-delay: 0s;
}
.nav-drop a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--txt-dim);
  transition: color .25s, background .25s, padding-left .25s;
}
.nav-drop a:hover { color: #fff; background: rgba(var(--accent-rgb), .12); padding-left: 20px; }
.nav-drop a .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--drop-dot, var(--accent)); flex: none; opacity: .8; }

/* ── 多欄分組下拉(投資人 / ESG),與首頁/內頁的 mega 版型等效,靠右避免溢出(2026-07-28) ── */
.nav-drop.cols {
  left: auto; right: 0; translate: 0 0;
  display: flex; gap: 4px;
  min-width: auto; max-width: min(92vw, 780px);
  padding: 14px;
}
.nav-drop.cols .col { display: flex; flex-direction: column; min-width: 178px; }
.nav-drop.cols .grp {
  padding: 8px 14px 4px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--txt-mute);
}
.nav-drop.cols .col > .grp { margin-top: 10px; }
.nav-drop.cols .col > .grp:first-child { margin-top: 0; }
.nav-drop.cols a { padding: 8px 14px; font-size: 13.5px; white-space: nowrap; }

/* 語言切換：一律回該語系首頁 */
.lang-switch {
  display: flex; align-items: center; gap: 2px;
  border: 1px solid var(--line-strong); border-radius: 99px; padding: 3px;
  background: rgba(255, 255, 255, .04);
}
.lang-switch a {
  padding: 5px 12px; font-size: 12.5px; font-weight: 700; letter-spacing: .08em;
  border-radius: 99px; color: var(--txt-mute);
  transition: color .3s, background .3s, box-shadow .3s;
}
.lang-switch a:hover { color: #fff; }
.lang-switch a.active {
  color: #04121c;
  background: linear-gradient(120deg, #7fd8ff, var(--ckpt));
  box-shadow: 0 2px 14px rgba(var(--ckpt-rgb), .45);
}

/* 漢堡（圓形，兩線絕對置中、僅 transform 動畫，開關原地不位移，參考 Vigorplus） */
.nav-burger { position: relative; z-index: 1002; width: 46px; height: 46px; display: none; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); }
.nav-burger span { position: absolute; left: 50%; top: 50%; width: 18px; height: 2px; background: transparent; transform: translate(-50%, -50%); }
.nav-burger span::before, .nav-burger span::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 2px;
  background: #fff; transition: transform .4s var(--ease-out);
}
.nav-burger span::before { transform: translate(-50%, calc(-50% - 5px)); }
.nav-burger span::after { transform: translate(-50%, calc(-50% + 5px)); }
body.menu-open .nav-burger span::before { transform: translate(-50%, -50%) rotate(45deg); }
body.menu-open .nav-burger span::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* 行動全螢幕選單 */
.nav-mobile {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(4, 7, 13, .96);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  display: flex; flex-direction: column;
  padding: calc(var(--header-h) + 24px) var(--gutter) 48px;
  opacity: 0; visibility: hidden; transition: opacity .45s var(--ease-out), visibility 0s .45s;
  overflow-y: auto;
}
body.menu-open .nav-mobile { opacity: 1; visibility: visible; transition-delay: 0s; }
.nav-mobile-group { border-bottom: 1px solid var(--line); }
.nav-mobile-group > a, .nav-mobile-group > button {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  padding: 18px 0; font-size: 20px; font-weight: 700; text-align: left;
  transform: translateY(24px); opacity: 0;
  transition: transform .6s var(--ease-out), opacity .6s var(--ease-out);
}
body.menu-open .nav-mobile-group > a, body.menu-open .nav-mobile-group > button {
  transform: translateY(0); opacity: 1;
  transition-delay: calc(.08s + var(--i, 0) * .055s);
}
.nav-mobile-group > button .caret {
  display: inline-block; width: 0; height: 0; border-radius: 0;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-top: 5.5px solid var(--txt-mute);
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), border-top-color .3s;
}
.nav-mobile-group.open > button .caret {
  transform: rotate(180deg);
  border-top-color: var(--ckpt, #38BDF8);
}
.nav-mobile-sub { max-height: 0; overflow: hidden; transition: max-height .5s var(--ease-inout); }
.nav-mobile-group.open .nav-mobile-sub { max-height: 640px; }
.nav-mobile-sub a { display: block; padding: 10px 0 10px 18px; color: var(--txt-dim); font-size: 15.5px; border-left: 1px solid var(--line-strong); margin-left: 4px; transition: color .25s, border-color .25s; }
.nav-mobile-sub a:hover { color: #fff; border-color: var(--accent); }
.nav-mobile .lang-switch { margin-top: 28px; align-self: flex-start; }

/* ---------- 按鈕 ---------- */
.btn {
  --btn-rgb: var(--accent-rgb);
  position: relative; display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 30px; border-radius: 99px;
  font-size: 15px; font-weight: 700; letter-spacing: .02em;
  overflow: hidden; isolation: isolate;
  transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), color .3s;
  will-change: transform;
}
.btn .arr { transition: transform .45s var(--ease-out); }
.btn:hover .arr { transform: translateX(5px); }
.btn-primary { color: #051018; background: linear-gradient(120deg, #8fe0ff, rgb(var(--btn-rgb))); box-shadow: 0 8px 30px rgba(var(--btn-rgb), .35); }
.btn-primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, rgb(var(--btn-rgb)), #8fe0ff);
  opacity: 0; transition: opacity .45s;
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 16px 44px rgba(var(--btn-rgb), .5); }
.btn-primary:hover::after { opacity: 1; }
.btn-ghost { color: #fff; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .03); }
.btn-ghost:hover { transform: translateY(-3px); border-color: rgba(var(--btn-rgb), .8); box-shadow: 0 12px 34px rgba(var(--btn-rgb), .22); }

/* ---------- 卡片 ---------- */
.card {
  position: relative; border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--ink-850), var(--ink-900));
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .6s var(--ease-out), border-color .5s, box-shadow .6s var(--ease-out);
}
.card:hover { transform: translateY(-8px); border-color: rgba(var(--card-rgb, var(--accent-rgb)), .5); box-shadow: 0 30px 70px rgba(0, 0, 0, .55), 0 0 0 1px rgba(var(--card-rgb, var(--accent-rgb)), .25); }
.card .card-glow {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: radial-gradient(480px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--card-rgb, var(--accent-rgb)), .13), transparent 65%);
}
.card:hover .card-glow { opacity: 1; }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; position: relative; --marquee-dur: 36s; }
.marquee-track { display: flex; gap: 0; width: max-content; animation: marquee var(--marquee-dur) linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  border-top: 1px solid var(--line);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(var(--ckpt-rgb), .07), transparent 60%),
    radial-gradient(700px 380px at 10% 110%, rgba(var(--ent-rgb), .05), transparent 60%),
    var(--ink-900);
  padding: clamp(56px, 8vh, 96px) 0 0;
  overflow: hidden;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 48px; padding-bottom: 56px; }
.footer-brand img { height: 44px; margin-bottom: 20px; }
.footer-brand p { color: var(--txt-mute); font-size: 14px; max-width: 320px; }
.footer-col h4 { font-size: 13px; font-weight: 700; letter-spacing: .26em; text-transform: uppercase; color: var(--txt-mute); margin-bottom: 20px; }
.footer-col a { display: block; padding: 6px 0; color: var(--txt-dim); font-size: 14.5px; transition: color .25s, transform .25s; }
.footer-col a:hover { color: rgb(var(--accent-rgb)); transform: translateX(4px); }
.footer-bottom {
  border-top: 1px solid var(--line);
  padding: 22px 0; display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  color: var(--txt-mute); font-size: 13px;
}
.footer-bottom .tri { display: inline-flex; gap: 6px; }
.footer-bottom .tri i { width: 20px; height: 3px; border-radius: 3px; }
.footer-bottom .tri i:nth-child(1) { background: var(--ent); }
.footer-bottom .tri i:nth-child(2) { background: var(--ckpt); }
.footer-bottom .tri i:nth-child(3) { background: var(--safe); }
.footer-watermark {
  display: block; width: 100%; margin-top: -1vw;
  font-size: clamp(70px, 11.5vw, 190px); font-weight: 900; letter-spacing: -.03em; line-height: .82;
  text-align: center; white-space: nowrap; pointer-events: none; user-select: none;
  color: transparent;
  -webkit-text-stroke: 1px rgba(148, 175, 220, .12);
  transform: translateY(18%);
}

/* ---------- Reveal 動畫基底（JS 啟用 .anim-ready 才隱藏，無 JS 也能閱讀） ---------- */
.anim-ready [data-reveal] { opacity: 0; }
[data-reveal] { will-change: transform, opacity; }

/* 分行字幕遮罩 */
.line-mask { display: block; overflow: hidden; }
.line-mask > span { display: block; }

/* ---------- 頁面轉場簾幕 ---------- */
.page-veil {
  position: fixed; inset: 0; z-index: 2000; pointer-events: none;
  background: var(--ink-950);
  transform: scaleY(0); transform-origin: top;
}

/* ---------- 回頂 ---------- */
.to-top {
  position: fixed; right: 26px; bottom: 26px; z-index: 800;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(10, 16, 28, .8); border: 1px solid var(--line-strong);
  backdrop-filter: blur(10px);
  opacity: 0; visibility: hidden; transform: translateY(16px);
  transition: opacity .4s, transform .4s var(--ease-out), visibility 0s .4s, border-color .3s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.to-top:hover { border-color: rgba(var(--accent-rgb), .7); }
.to-top svg { width: 18px; height: 18px; stroke: #fff; }

/* ---------- 通用工具 ---------- */
.noselect { user-select: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- RWD ---------- */
@media (max-width: 1160px) {
  .nav-desktop { display: none; }
  .nav-burger { display: grid; }
  /* 語系切換移到漢堡左側（一起靠右），參考 Vigorplus */
  .header-lang { display: flex; margin-left: auto; }
  .nav-mobile .lang-switch { display: none; }  /* 隱藏 overlay 內重複語系 */
}
@media (min-width: 1161px) {
  .nav-mobile { display: none; }
}
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  :root { --header-h: 64px; }
  .brand img { height: 32px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .to-top { right: 16px; bottom: 16px; }
}

/* ---------- 動態偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .anim-ready [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* ===== 多欄群組下拉（Investor / ESG — 結構依 common/header.html 定案） ===== */
.nav-drop.cols { display: flex; gap: 4px; left: auto; right: 0; translate: 0 0; }
.nav-drop.cols .col { min-width: 190px; }
.nav-drop .grp {
  display: block; padding: 10px 14px 3px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: rgba(255, 255, 255, .38);
}
.nav-drop .grp.sub { padding-left: 26px; letter-spacing: .14em; }
.nav-drop a.sub { padding-left: 28px; font-size: 13px; }
.nav-mobile-sub .grp {
  display: block; padding: 10px 0 2px;
  font-size: 10px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
}
.nav-mobile-sub a.sub { padding-left: 14px; }

/* ══ CJK 標題防孤字(2026-07-20):行數平衡換行,避免行尾單一孤字 ══ */
:lang(zh-Hant) h1, :lang(zh-Hant) h2, :lang(zh-Hant) h3,
:lang(ja) h1, :lang(ja) h2, :lang(ja) h3 {
  text-wrap: balance;
}

/* ══ Footer 社群連結(2026-07-20) ══ */
.foot-social { display: flex; gap: 10px; margin-top: 18px; }
.foot-social a {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .92);
  transition: border-color .3s, background .3s, color .3s, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.foot-social a:hover {
  transform: translateY(-3px);
  color: #fff;
  border-color: var(--ckpt, #38BDF8);
  background: rgba(56, 189, 248, .16);
}
.foot-social svg { width: 17px; height: 17px; fill: currentColor; display: block; }

/* ══ 手機選單開啟時導航列提到全屏選單(z:1000)之上,關閉X與語系才可用且不跳位 ══ */
body.menu-open .site-header { z-index: 1010; background: transparent; box-shadow: none; }
