/* 晙珈工業首頁 — 依原站版面：
   上方半透明 Logo 區 → 左側由深到淺的長條選單（固定寬度）→ 兩張產品小圖 → 疊在底圖上的頁尾 */
:root {
  --jj-ink: #4a4a4a;          /* Logo 主色 */
  --jj-ink-light: #8c8c8c;    /* Logo 次色、英文字 */
  --jj-band: rgba(236, 236, 236, 0.82); /* 上方 Logo 區 */
  --jj-paper: #f4f5f7;        /* 底圖沒載入時的底色 */
  --jj-line: rgba(70, 90, 120, 0.13);   /* 底圖替代用的藍圖線條 */
  --jj-accent: #d0101b;       /* 紅色點綴 */
  --jj-foot-text: #8a8a8a;    /* 頁尾文字 */
  --jj-icon: #a3a3a3;         /* 社群圓形圖示 */
  --jj-panel: #ffffff;        /* 內容面板左側白底 */
  --jj-panel-gray: #e4e4e4;   /* 內容面板右側灰底 */
  --jj-rule: #d2d2d2;         /* 標題與消息之間的細線 */
  --jj-text: #333333;         /* 內文 */
  --jj-news-red: #c9302c;     /* 消息標題 */
  /* 五條選單的顏色（由深到淺） */
  --jj-bar1: #242424;
  --jj-bar2: #303030;
  --jj-bar3: #6c6b67;
  --jj-bar4: #888786;
  --jj-bar5: #a1a1a1;
  --jj-font: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", sans-serif;
  --jj-font-foot: "Oswald", "Arial Narrow", "Noto Sans TC", sans-serif;
  --jj-font-serif: "Noto Serif TC", "PMingLiU", "MingLiU", "Songti TC", serif;
  color-scheme: light;
}

html, body { margin: 0; }
body { background: var(--jj-paper); color: var(--jj-ink); font-family: var(--jj-font); }

.jj-page { position: relative; overflow-x: hidden; }

/* ---------- 底圖 ---------- */
.jj-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    var(--jj-bg) center / cover no-repeat,
    /* 圖片沒載入時：淡藍色方格，近似原本的藍圖底圖 */
    radial-gradient(ellipse at 55% 45%, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 60%),
    linear-gradient(var(--jj-line) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--jj-line) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--jj-paper);
}

/* ---------- 上方 Logo 區：170px 高的半透明白色橫條 ---------- */
.jj-header {
  height: 170px;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  padding-top: 22px;
  padding-left: max(86px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--jj-band);
}
.jj-logo { margin: 0; line-height: 1; }
.jj-logo a { display: inline-block; text-decoration: none; }
.jj-logo img { display: block; max-width: 100%; height: auto; }
.jj-logo-text { display: block; font-size: 44px; font-weight: 700; letter-spacing: 2px; color: var(--jj-ink-light); }
.jj-logo-text b { color: var(--jj-ink); }
.jj-logo-en { display: block; margin-top: 8px; padding-left: 50px; font-size: 20px; font-weight: 400; color: var(--jj-ink-light); }

/* 版面：Logo 區 → 循環影片 → 產品小圖 → 頁尾，頁尾貼齊畫面底部 */
.jj-page { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
.jj-header { flex: none; }

/* 小紅點（原站畫面上的點綴） */
.jj-dot {
  position: absolute;
  left: 338px;
  top: 276px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--jj-accent);
}

/* ---------- 循環播放影片（量測錶畫面） ---------- */
.jj-video {
  position: relative;
  z-index: 1;
  width: min(1010px, calc(100% - 2 * 86px));
  margin: 48px auto 0;
  aspect-ratio: 1010 / 550;
  max-width: 100%;
  background: #111;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.jj-video video { display: block; width: 100%; height: 100%; object-fit: cover; }
/* 左上角紅色細線，呼應選單的紅色點綴 */
.jj-video::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 72px;
  height: 3px;
  background: var(--jj-accent);
  z-index: 1;
}

/* ---------- 懸浮漢堡按鈕：畫面右下方、距底部約 10% ---------- */
.jj-burger {
  position: fixed;
  z-index: 40;
  right: max(24px, env(safe-area-inset-right, 0px));
  bottom: calc(10% + env(safe-area-inset-bottom, 0px));
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background:
    radial-gradient(rgba(255,255,255,0.10) 1px, transparent 1.3px) 0 0 / 6px 6px,
    var(--jj-bar1);
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  transition: transform 0.2s ease;
}
.jj-burger:hover { transform: scale(1.06); }
.jj-burger:active { transform: scale(0.94); }
.jj-burger:focus-visible { outline: 2px solid var(--jj-accent); outline-offset: 3px; }
.jj-burger span,
.jj-burger span::before,
.jj-burger span::after {
  content: "";
  position: absolute;
  left: 19px;
  width: 22px;
  height: 2px;
  background: #fff;
  transition: transform 0.3s ease, background-color 0.3s ease;
}
.jj-burger span { top: 29px; }
.jj-burger span::before { left: 0; top: -7px; }
.jj-burger span::after { left: 0; top: 7px; }
.jj-menu-open .jj-burger span { background: transparent; }
.jj-menu-open .jj-burger span::before { transform: translateY(7px) rotate(45deg); }
.jj-menu-open .jj-burger span::after { transform: translateY(-7px) rotate(-45deg); }

/* 背景遮罩：選單打開時淡入，點一下就關閉 */
.jj-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(244, 245, 247, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.jj-menu-open .jj-backdrop { opacity: 1; visibility: visible; transition: opacity 0.3s ease; }

/* ---------- 長條選單：懸浮在按鈕上方，平常藏在畫面左側外 ---------- */
.jj-nav {
  position: fixed;
  z-index: 35;
  left: 0;
  right: 0;
  bottom: calc(10% + 60px + 16px + env(safe-area-inset-bottom, 0px));
  visibility: hidden;
  transition: visibility 0s linear 0.65s;
}
.jj-menu-open .jj-nav { visibility: visible; transition: none; }
.jj-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
/* 電腦版：原站的固定寬度、長短交錯、由深到淺 */
.jj-nav li:nth-child(1) { --w: 436px; --c: var(--jj-bar1); }
.jj-nav li:nth-child(2) { --w: 499px; --c: var(--jj-bar2); }
.jj-nav li:nth-child(3) { --w: 386px; --c: var(--jj-bar3); }
.jj-nav li:nth-child(4) { --w: 461px; --c: var(--jj-bar4); }
.jj-nav li:nth-child(5) { --w: 386px; --c: var(--jj-bar5); }

.jj-nav a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: var(--w);
  max-width: calc(100% - 16px);
  height: 64px;
  box-sizing: border-box;
  padding-right: 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  /* 底色加上細點網紋 */
  background:
    radial-gradient(rgba(255,255,255,0.10) 1px, transparent 1.3px) 0 0 / 6px 6px,
    var(--c);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateX(-105%);
  transition: transform 0.45s cubic-bezier(.2,.7,.2,1), width 0.35s ease, filter 0.25s ease;
}
/* 打開時由上到下依序滑出；關閉時由下到上依序收回 */
.jj-menu-open .jj-nav a { transform: translateX(0); }
.jj-menu-open .jj-nav li:nth-child(1) a { transition-delay: 0s; }
.jj-menu-open .jj-nav li:nth-child(2) a { transition-delay: 0.05s; }
.jj-menu-open .jj-nav li:nth-child(3) a { transition-delay: 0.1s; }
.jj-menu-open .jj-nav li:nth-child(4) a { transition-delay: 0.15s; }
.jj-menu-open .jj-nav li:nth-child(5) a { transition-delay: 0.2s; }
.jj-nav li:nth-child(1) a { transition-delay: 0.2s; }
.jj-nav li:nth-child(2) a { transition-delay: 0.15s; }
.jj-nav li:nth-child(3) a { transition-delay: 0.1s; }
.jj-nav li:nth-child(4) a { transition-delay: 0.05s; }
.jj-nav li:nth-child(5) a { transition-delay: 0s; }
/* 滑過時不再延遲，長條立即往右伸 */
.jj-menu-open .jj-nav a:hover, .jj-menu-open .jj-nav a:focus-visible { transition-delay: 0s; }

/* 滑過時長條往右伸、文字上下翻動（對應原站的雙標籤按鈕） */
.jj-nav a:hover, .jj-nav a:focus-visible { width: calc(var(--w) + 48px); filter: brightness(1.12); }
.jj-nav a:focus-visible { outline: 2px solid var(--jj-accent); outline-offset: 2px; }
.jj-roll { display: block; height: 1.5em; line-height: 1.5em; overflow: hidden; }
.jj-roll > span { display: block; transition: transform 0.3s ease; }
.jj-roll > span + span { text-decoration: underline; text-decoration-color: var(--jj-accent); text-underline-offset: 5px; text-decoration-thickness: 2px; }
.jj-nav a:hover .jj-roll > span,
.jj-nav a:focus-visible .jj-roll > span { transform: translateY(-100%); }

/* ---------- 產品小圖：影片下方，75×75 ---------- */
.jj-thumbs {
  list-style: none;
  display: flex;
  gap: 30px;
  margin: 40px 0 0;
  padding: 0 0 0 286px;
}
.jj-thumbs a { display: block; text-decoration: none; width: 75px; height: 75px; transition: transform 0.25s ease, box-shadow 0.25s ease; }
.jj-thumbs a:hover, .jj-thumbs a:focus-visible { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(0,0,0,0.18); }
.jj-thumbs a:focus-visible { outline: 2px solid var(--jj-accent); outline-offset: 2px; }
.jj-thumbs img, .jj-thumb-fallback {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: linear-gradient(135deg, #8e8e8e, #4b4b4b);
}
/* 圖片沒載入時，在灰色方塊上顯示產品名稱 */
.jj-thumb-fallback {
  box-sizing: border-box;
  padding: 6px;
  display: flex;
  align-items: flex-end;
  color: #fff;
  font-size: 11px;
  line-height: 1.3;
}

/* ---------- 頁尾：版權置中、社群圖示靠右，直接疊在底圖上 ---------- */
.jj-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: auto;
  padding-top: 32px;
  margin-bottom: 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.jj-copy {
  margin: 0;
  font-family: var(--jj-font-foot);
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--jj-foot-text);
}
.jj-copy a { color: inherit; text-decoration: none; }
.jj-copy a:hover { color: var(--jj-accent); }

.jj-social {
  position: absolute;
  right: max(210px, env(safe-area-inset-right, 0px));
  top: 50%;
  transform: translateY(-50%);
  list-style: none;
  display: flex;
  gap: 5px;
  margin: 0;
  padding: 0;
}
.jj-social a { display: block; text-decoration: none; transition: transform 0.2s ease; }
.jj-social a:hover { transform: translateY(-2px); }
.jj-social img, .jj-social-fallback { display: block; width: 26px; height: 26px; }
.jj-social-fallback {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--jj-icon);
  color: #fff;
  font: 700 12px/1 Arial, sans-serif;
}
.jj-social a:hover .jj-social-fallback { background: var(--jj-accent); }

/* 目前所在頁面：選單長條加一條紅色邊 */
.jj-nav a[aria-current="page"] { box-shadow: inset -4px 0 0 var(--jj-accent), 0 4px 12px rgba(0,0,0,0.12); }

/* ---------- 內頁共用：內容面板（左白右灰兩欄） ---------- */
.jj-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 52% 48%;
  width: min(1048px, calc(100% - 2 * 86px));
  margin: 106px auto 0;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}
.jj-sheet { min-width: 0; padding: 84px 40px 56px; }
.jj-sheet--white { background: var(--jj-panel); }
.jj-sheet--gray {
  /* 淺灰底加細紋，左側有一道柔和陰影，像紙張疊在一起 */
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #ececec, var(--jj-panel-gray));
  box-shadow: inset 14px 0 18px -14px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
}

.jj-title {
  margin: 0 0 40px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--jj-rule);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 1px;
  color: #8e8e8e;
}
.jj-title b { font-weight: 400; color: var(--jj-text); }

/* 公司介紹內文：原站使用明體粗體、字距較寬 */
.jj-about { font-family: var(--jj-font-serif); color: var(--jj-text); font-weight: 700; font-size: 15px; letter-spacing: 2px; }
.jj-about-lead { margin: 0; }
.jj-loading { color: #999; font-weight: 400; }
.jj-about-sub { margin: 120px 0 34px; font-size: 15px; font-weight: 700; }
.jj-about-list { list-style: none; margin: 0; padding: 0; counter-reset: jj-item; display: flex; flex-direction: column; gap: 36px; }
.jj-about-list li { counter-increment: jj-item; }
.jj-about-list li::before { content: counter(jj-item) "."; }

/* 最新消息：縮圖在左、紅色標題在右，每則之間以細線分隔 */
.jj-news-list { list-style: none; margin: 0; padding: 0; }
.jj-news-list li { border-bottom: 1px solid var(--jj-rule); padding-block: 44px; }
.jj-news-list li:first-child { padding-top: 4px; }
.jj-news-list a { display: flex; align-items: flex-start; gap: 18px; text-decoration: none; }
.jj-news-img { flex: none; width: 127px; height: 120px; background: #222; overflow: hidden; }
.jj-news-img img, .jj-news-noimg { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.jj-news-noimg { background: linear-gradient(135deg, #7a7a7a, #2e2e2e); }
.jj-news-list a:hover img, .jj-news-list a:hover .jj-news-noimg { transform: scale(1.05); }
.jj-news-title { font-size: 14px; line-height: 1.5; color: var(--jj-news-red); padding-top: 2px; }
.jj-news-list a:hover .jj-news-title { text-decoration: underline; }
.jj-news-list a:focus-visible { outline: 2px solid var(--jj-accent); outline-offset: 4px; }
.jj-news-more { margin: auto 0 0; padding-top: 40px; border-top: 1px solid var(--jj-rule); text-align: right; font-size: 13px; }
.jj-news-list + .jj-news-more { margin-top: 40px; }
.jj-news-more a { color: #444; text-decoration: none; }
.jj-news-more a::before { content: "›"; margin-right: 8px; }
.jj-news-more a:hover { color: var(--jj-accent); }

/* 內頁的產品小圖與面板保持距離 */
.jj-page--inner .jj-thumbs { margin-top: 24px; padding-left: 79px; }

/* ---------- 內頁共用元件 ---------- */
.jj-panel--wide { grid-template-columns: 64% 36%; width: min(1180px, calc(100% - 2 * 86px)); }

/* 灰底清單中目前所在的項目 */
.jj-news-list a[aria-current="page"] .jj-news-title { color: var(--jj-text); font-weight: 700; }
.jj-news-list a[aria-current="page"] .jj-news-img { outline: 3px solid var(--jj-accent); outline-offset: -3px; }

/* 按鈕：與選單長條同樣的深色細點網紋 */
.jj-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  color: #fff;
  font: 700 14px/1 var(--jj-font);
  letter-spacing: 1px;
  text-decoration: none;
  cursor: pointer;
  background:
    radial-gradient(rgba(255,255,255,0.10) 1px, transparent 1.3px) 0 0 / 6px 6px,
    var(--jj-bar1);
  transition: filter 0.2s ease;
}
.jj-btn:hover { filter: brightness(1.25); }
.jj-btn:focus-visible { outline: 2px solid var(--jj-accent); outline-offset: 2px; }
.jj-btn--ghost { background: transparent; color: var(--jj-text); box-shadow: inset 0 0 0 1px #9a9a9a; }
.jj-btn--ghost:hover { filter: none; box-shadow: inset 0 0 0 1px var(--jj-text); }
.jj-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 0; }

/* 產品介紹：圖片與規格 */
.jj-prod-img, .jj-article-img { margin: 0 0 28px; background: #f1f1f1; }
.jj-prod-img img, .jj-article-img img { display: block; width: 100%; max-height: 420px; object-fit: contain; }
.jj-prod-noimg {
  display: flex; align-items: flex-end;
  aspect-ratio: 16 / 9; max-width: 100%; padding: 16px; box-sizing: border-box;
  background: linear-gradient(135deg, #8e8e8e, #3c3c3c); color: #fff; font-size: 14px;
}
.jj-specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 32px; }
.jj-spec summary {
  display: block; list-style: none; pointer-events: none;   /* 電腦版規格全部展開，不需點選 */
  margin: 0 0 8px; padding-left: 10px;
  border-left: 3px solid var(--jj-accent);
  font-size: 15px; font-weight: 700; color: var(--jj-text);
}
.jj-spec summary::-webkit-details-marker { display: none; }
.jj-spec dl { margin: 0; font-size: 13.5px; }
.jj-spec dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed #dcdcdc; }
.jj-spec dt { color: #666; }
.jj-spec dd { margin: 0; color: var(--jj-text); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jj-spec dl > div.is-feature dt { color: var(--jj-text); }
.jj-spec dl > div.is-feature dt::before { content: "✓"; color: var(--jj-accent); margin-right: 6px; }
.jj-spec-note { margin: 20px 0 0; font-size: 12.5px; color: #777; }

/* 最新消息：文章 */
.jj-article-video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: #111; margin-bottom: 24px; }
.jj-article-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.jj-article-body { font-size: 15px; line-height: 1.9; color: var(--jj-text); }
.jj-article-nav { display: flex; justify-content: space-between; gap: 16px; margin: 32px 0 0; padding-top: 16px; border-top: 1px solid var(--jj-rule); font-size: 13px; }
.jj-article-nav a { color: #444; text-decoration: none; }
.jj-article-nav a:hover { color: var(--jj-accent); }

/* 電子型錄、圖檔下載：檔案清單 */
.jj-files { list-style: none; margin: 0; padding: 0; }
.jj-files li { border-bottom: 1px solid var(--jj-rule); }
.jj-files a { display: flex; align-items: center; gap: 16px; padding: 18px 0; color: var(--jj-text); text-decoration: none; }
.jj-file-type {
  flex: none; display: grid; place-items: center; width: 46px; height: 56px;
  background: var(--jj-accent); color: #fff; font: 700 12px/1 var(--jj-font-foot); letter-spacing: 1px;
  clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%);
}
.jj-file-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; }
.jj-file-go { flex: none; font-size: 13px; color: #777; }
.jj-file-go::after { content: " ↓"; }
.jj-files a:hover .jj-file-name, .jj-files a:hover .jj-file-go { color: var(--jj-accent); }
.jj-files a:focus-visible { outline: 2px solid var(--jj-accent); outline-offset: 2px; }
.jj-files-empty { padding: 8px 0 20px; color: #666; font-size: 14px; line-height: 1.8; }
.jj-files-empty p { margin: 0; }
.jj-files-empty a { color: var(--jj-news-red); }

/* 灰底側欄的說明文字與聯絡資訊 */
.jj-note { display: flex; flex-direction: column; flex: 1; font-size: 14px; line-height: 1.8; color: #555; }
.jj-note > p:first-child { margin: 0 0 20px; }
.jj-info { margin: 0; font-size: 14px; }
.jj-info > div { display: flex; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--jj-rule); }
.jj-info dt { flex: none; width: 4.5em; color: #777; }
.jj-info dd { margin: 0; min-width: 0; color: var(--jj-text); overflow-wrap: anywhere; }
.jj-info a { color: var(--jj-text); text-decoration: none; border-bottom: 1px dotted #999; }
.jj-info a:hover { color: var(--jj-accent); border-color: var(--jj-accent); }
.jj-co { margin: 20px 0 6px; font-size: 16px; color: var(--jj-text); }

/* 聯絡我們：地圖與表單 */
.jj-map { aspect-ratio: 4 / 3; max-width: 100%; background: #d9d9d9; }
.jj-map iframe { display: block; width: 100%; height: 100%; border: 0; }
.jj-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.jj-form label span { display: block; margin-bottom: 4px; font-size: 13px; color: #666; }
.jj-form em { font-style: normal; color: var(--jj-accent); margin-left: 2px; }
.jj-form input { height: 38px; }
.jj-form input, .jj-form textarea {
  width: 100%; box-sizing: border-box;
  padding: 8px 2px; border: 0; border-bottom: 1px solid #bdbdbd; border-radius: 0;
  background: transparent; color: var(--jj-text); font: 16px/1.5 var(--jj-font);
}
.jj-form textarea { resize: vertical; border: 1px solid #bdbdbd; padding: 8px 10px; }
.jj-form input:focus, .jj-form textarea:focus { outline: none; border-color: var(--jj-accent); box-shadow: 0 1px 0 var(--jj-accent); }
.jj-form .is-invalid { border-color: var(--jj-accent); background: #fff4f4; }
.jj-form-full { grid-column: 1 / -1; }
.jj-form-msg { margin: 0; min-height: 1.4em; font-size: 13px; }
.jj-form-msg.is-error { color: var(--jj-accent); }
.jj-form-msg.is-ok { color: #2e7d32; }
.jj-form-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* 翻頁控制列只在手機翻書模式顯示 */
.jj-book-pager { display: none; }

/* ---------- 平板 ---------- */
@media (max-width: 1000px) {
  .jj-header { padding-left: max(40px, env(safe-area-inset-left, 0px)); }
  .jj-video { width: calc(100% - 2 * 40px); }
  .jj-thumbs, .jj-page--inner .jj-thumbs { padding-left: 40px; }
  .jj-panel, .jj-panel--wide { width: calc(100% - 2 * 40px); margin-top: 64px; }
  .jj-specs { grid-template-columns: 1fr; }
  .jj-social { position: static; transform: none; margin-left: 24px; }
  .jj-footer { flex-wrap: wrap; gap: 12px; }
}

/* ---------- 手機 ---------- */
@media (max-width: 640px) {
  .jj-header { height: 112px; padding-top: 18px; padding-left: max(16px, env(safe-area-inset-left, 0px)); }
  .jj-logo-text { font-size: 30px; }
  .jj-logo-en { font-size: 14px; padding-left: 34px; margin-top: 6px; }
  .jj-dot { top: 190px; left: 60%; }

  .jj-video { width: 100%; margin-top: 32px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2); }

  /* 手機：漢堡按鈕降到右下方、距底部約 10% */
  .jj-burger { width: 56px; height: 56px; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(10% + env(safe-area-inset-bottom, 0px)); }
  .jj-burger span { left: 17px; top: 27px; }
  .jj-nav { bottom: calc(10% + 56px + 16px + env(safe-area-inset-bottom, 0px)); }

  /* 長條保持由深到淺、長短交錯，寬度改成依螢幕比例 */
  .jj-nav li:nth-child(1) { --w: 78%; }
  .jj-nav li:nth-child(2) { --w: 90%; }
  .jj-nav li:nth-child(3) { --w: 70%; }
  .jj-nav li:nth-child(4) { --w: 84%; }
  .jj-nav li:nth-child(5) { --w: 70%; }
  .jj-nav a { height: 56px; padding-right: 24px; }
  .jj-nav a:hover, .jj-nav a:focus-visible { width: var(--w); }

  .jj-thumbs, .jj-page--inner .jj-thumbs { margin-top: 32px; padding-left: 0; justify-content: center; }

  /* 公司介紹頁：維持白、灰兩區的樣式；沒有 JavaScript 時改成上下排列 */
  .jj-panel { grid-template-columns: 1fr; width: calc(100% - 32px); margin-top: 24px; }
  /* 翻書模式：書頁縮小為 80%（寬度與高度），置中 */
  .jj-panel.is-book { width: calc((100% - 32px) * 0.8); }
  .jj-sheet { padding: 26px 20px 24px; }
  .jj-sheet--gray { box-shadow: inset 0 14px 18px -14px rgba(0, 0, 0, 0.28); }
  /* 手機版縮小間距，減少上下篇幅 */
  .jj-title { font-size: 22px; margin-bottom: 18px; padding-bottom: 12px; }
  .jj-about { font-size: 14px; letter-spacing: 1.2px; }
  .jj-about-sub { margin-top: 24px; margin-bottom: 12px; font-size: 14px; }
  .jj-about-list { gap: 10px; }
  .jj-news-list li { padding-block: 14px; }
  .jj-news-list li:first-child { padding-top: 0; }
  .jj-news-list a { gap: 14px; }
  .jj-news-img { width: 92px; height: 70px; }
  .jj-news-more { padding-top: 14px; }
  .jj-news-list + .jj-news-more { margin-top: 0; border-top: 0; }
  .jj-page--inner .jj-thumbs { margin-top: 20px; }

  /* 內頁元件：手機縮小間距 */
  .jj-panel--wide { grid-template-columns: 1fr; width: calc(100% - 32px); }
  .jj-prod-img, .jj-article-img { margin-bottom: 16px; }
  .jj-prod-img img, .jj-article-img img { max-height: 180px; }
  .jj-specs { gap: 14px; }
  /* 手機：規格分組可點選收合，標題右側顯示 ＋／－ */
  .jj-specs { gap: 0; }
  .jj-spec { border-bottom: 1px solid var(--jj-rule); }
  .jj-spec summary {
    pointer-events: auto; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    margin: 0; padding: 10px 2px 10px 10px; font-size: 14px;
  }
  .jj-spec summary::after { content: "＋"; color: #888; font-weight: 400; }
  .jj-spec[open] summary::after { content: "－"; }
  .jj-spec summary:focus-visible { outline: 2px solid var(--jj-accent); outline-offset: -2px; }
  .jj-spec dl { padding-bottom: 8px; }
  .jj-spec dl { font-size: 12.5px; }
  .jj-spec dl > div { padding: 4px 0; }
  .jj-actions { margin-top: 18px; }
  .jj-actions .jj-btn { flex: 1; padding: 0 12px; }
  .jj-files a { padding: 12px 0; gap: 12px; }
  .jj-file-type { width: 38px; height: 46px; }
  .jj-file-name { font-size: 14px; }
  .jj-note > p:first-child { margin-bottom: 12px; }
  .jj-info > div { padding: 6px 0; }
  .jj-map { aspect-ratio: 16 / 10; }
  .jj-co { margin-top: 12px; }
  .jj-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
  .jj-form input { padding: 5px 2px; }
  .jj-form textarea { min-height: 72px; }
  .jj-article-nav { margin-top: 18px; flex-direction: column; gap: 8px; }
  .jj-form input { height: 34px; }
  /* 按鈕靠左，避開右下方的懸浮選單按鈕 */
  .jj-form-actions { justify-content: flex-start; }

  /* ---------- 翻書模式（JavaScript 啟用後）：兩欄變兩頁，左右滑動翻頁 ---------- */
  .jj-panel.is-book {
    display: block;
    height: var(--book-h, auto);
    perspective: 1800px;
    box-shadow: none;
    touch-action: pan-y;          /* 上下仍可捲動頁面，左右交給翻頁 */
    user-select: none;
    -webkit-user-select: none;
  }
  .is-book > .jj-sheet {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--book-h, auto);
    box-sizing: border-box;
    transform-origin: left center;           /* 以左側為書背翻動 */
    transform: rotateY(var(--a, 0deg));
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: transform 0.75s cubic-bezier(.3,.75,.25,1);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
    will-change: transform;
  }
  /* 每頁固定滿版高度；萬一單一區塊比一頁還高，頁內可上下捲動 */
  .is-book > .jj-sheet { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
  /* 懸浮選單按鈕所在高度：右側留空，內容自動往左讓開（兩個浮動元素的組合） */
  .jj-gap-a { float: right; width: 0; height: var(--gap-top, 0px); }
  .jj-gap-b { float: right; clear: right; width: var(--gap-w, 0px); height: var(--gap-h, 0px); }
  /* 規格列、清單列遇到留空處會自動縮短寬度（外層不能是 grid／flex，否則整塊都會變窄） */
  .is-book .jj-specs { display: block; }
  .is-book .jj-spec dl > div, .is-book .jj-news-list li, .is-book .jj-files li, .is-book .jj-info > div { overflow: hidden; }
  /* 書頁內的地圖與聯絡資訊縮小一點，讓同一頁放得下 */
  .is-book .jj-map { aspect-ratio: 2 / 1; }
  .is-book .jj-info { font-size: 13px; }
  .is-book .jj-info > div { padding: 5px 0; gap: 10px; }
  .is-book .jj-info dt { width: 3.6em; }
  .is-book .jj-co { margin: 10px 0 4px; font-size: 15px; }
  /* 聯絡表單頁：內容較長，在書頁內上下捲動 */
  .is-book > .jj-sheet[data-scroll] { -webkit-overflow-scrolling: touch; }
  /* 分頁後的續頁標題 */
  .jj-title--cont { font-size: 16px; color: #9a9a9a; margin-bottom: 14px; padding-bottom: 8px; }
  /* 翻書模式下規格全部展開（改用分頁，不需收合） */
  .is-book .jj-spec summary { pointer-events: none; }
  .is-book .jj-spec summary::after { content: none; }
  .is-book .jj-spec:last-child { border-bottom: 0; }
  .is-book > .jj-sheet--gray { box-shadow: inset 12px 0 16px -12px rgba(0, 0, 0, 0.25), 0 10px 24px rgba(0, 0, 0, 0.16); }
  .is-book.is-dragging > .jj-sheet { transition: none; }
  /* 翻動時頁面上的光影：越接近垂直越暗 */
  .is-book > .jj-sheet::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.35) 100%);
    opacity: var(--shade, 0);
  }
  /* 書背：左側一道細陰影 */
  .is-book > .jj-sheet::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 10px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0,0,0,0.10), rgba(0,0,0,0));
  }

  /* 翻頁控制列：放在書頁底部（‹  ● ○  1 / 2  ›） */
  .is-book > .jj-sheet { padding-bottom: 64px; }
  .jj-book-pager {
    display: flex;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    z-index: 100;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0;
    font: 12px/1 var(--jj-font-foot);
    letter-spacing: 1px;
    color: #777;
    pointer-events: none;
  }
  .jj-book-pager > * { pointer-events: auto; }
  .jj-book-pager button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--jj-rule);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  .jj-book-pager button:disabled { opacity: 0.35; cursor: default; }
  .jj-book-pager button:focus-visible { outline: 2px solid var(--jj-accent); outline-offset: 2px; }
  .jj-book-dots { display: flex; gap: 8px; }
  .jj-book-dots span { width: 7px; height: 7px; border-radius: 50%; background: #c4c4c4; transition: background-color 0.3s; }
  .jj-book-dots span.is-on { background: var(--jj-accent); }
  .jj-book-label { min-width: 3.2em; text-align: center; }

  /* 頁尾常駐在畫面最底部 */
  .jj-page { box-sizing: border-box; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .jj-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    margin: 0;
    padding-top: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(244, 245, 247, 0.94);
    backdrop-filter: blur(4px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }
  .jj-copy { font-size: 11px; }
  .jj-social img, .jj-social-fallback { width: 24px; height: 24px; }
  .jj-social { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .jj-nav a, .jj-menu-open .jj-nav a { transition: none; }
  .jj-roll > span, .jj-thumbs a, .jj-social a,
  .jj-burger, .jj-burger span, .jj-burger span::before, .jj-burger span::after, .jj-backdrop { transition: none; }
  .is-book > .jj-sheet { transition: none; }
}
