/* =========================================================
   首頁（新版）樣式 home.css
   - 只供中文首頁 index.html 使用，class 皆以 hm- 開頭，
     不影響其他頁面與英文版（英文版仍使用 index.css / index.js）
   ========================================================= */
.hm {
  --hm-primary: #1d5fd1;
  --hm-primary-dark: #0b3f8f;
  --hm-text: #1f2329;
  --hm-muted: #5b6470;
  --hm-line: #e3e8ef;
  --hm-radius: 10px;
  --hm-gutter: 24px;
  color: var(--hm-text);
}
.hm *, .hm *::before, .hm *::after { box-sizing: border-box; }
.hm a { text-decoration: none; color: inherit; }
.hm p { margin: 0; }
.hm button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

.hm-container {
  width: 100%;
  max-width: calc(1200px + var(--hm-gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--hm-gutter);
}
.hm-title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  text-align: center;
  letter-spacing: .04em;
  margin: 0 0 clamp(24px, 3vw, 40px);
}

/* ---------- 共用：進度條 + 左右箭頭 ---------- */
.hm-controls { display: flex; align-items: center; gap: 24px; }
.hm-progress { flex: 1; height: 3px; background: var(--hm-line); border-radius: 3px; position: relative; overflow: hidden; }
.hm-progress__bar { position: absolute; left: 0; top: 0; height: 100%; min-width: 24px; background: #9aa3ad; border-radius: 3px; transition: left .4s, width .4s; }
/* 可點選切換的進度條（橫幅、雲端服務與解決方案），上下各擴大 10px 點擊範圍 */
.hm-progress--seek { overflow: visible; }
.hm-progress--seek::after { content: ""; position: absolute; left: 0; right: 0; top: -10px; bottom: -10px; }
.hm-progress--seek:hover .hm-progress__bar { background: #6f7883; }
.hm-arrows { display: flex; flex-shrink: 0; border: 1px solid var(--hm-line); border-radius: 20px; overflow: hidden; background: #fff; }
.hm-arrows button { width: 42px; height: 34px; display: grid; place-items: center; transition: background .2s, opacity .2s; }
.hm-arrows button:hover { background: #f2f5f9; }
.hm-arrows button:disabled { opacity: .35; cursor: default; background: none; }
.hm-arrows svg { width: 16px; height: 16px; }

.hm-more { display: flex; justify-content: flex-end; margin-top: 20px; }
.hm-more a { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--hm-primary); }
.hm-more a::before {
  content: ""; width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  background: var(--hm-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M6 3l5 5-5 5'/%3E%3C/svg%3E") center/14px no-repeat;
  transition: background-color .2s;
}
.hm-more a:hover { color: var(--hm-primary-dark); }
.hm-more a:hover::before { background-color: var(--hm-primary-dark); }

/* ---------- 首頁橫幅（排序沿用 data/index.json 的 banner 陣列） ---------- */
.hm-hero .carousel-item img { width: 100%; aspect-ratio: 1920 / 430; object-fit: cover; }
.hm-hero__controls { margin-top: 20px; }

/* ---------- 熱門資訊 / 服務公告 ---------- */
.hm-news { padding: clamp(36px, 5vw, 64px) 0 clamp(48px, 6vw, 80px); }
.hm-tabs { display: flex; justify-content: center; gap: clamp(16px, 3vw, 32px); margin-bottom: 28px; }
.hm-tabs button { font-size: clamp(16px, 1.6vw, 18px); font-weight: 700; padding: 8px 10px 12px; color: #333; border-bottom: 4px solid transparent; transition: border-color .2s, color .2s; }
.hm-tabs button:hover { color: var(--hm-primary); }
.hm-tabs button[aria-selected="true"] { border-color: var(--hm-primary); color: var(--hm-text); }
.hm-panel[hidden] { display: none; }
.hm-news__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(12px, 1.6vw, 20px); }
.hm-news-card { display: block; background: linear-gradient(180deg, #F9F9F9 0%, #EAEAEA 100%); border-radius: var(--hm-radius); padding: 18px 18px 24px; box-shadow: 0 4px 14px rgba(20, 40, 80, .12); min-height: 170px; transition: transform .2s, box-shadow .2s; }
.hm-news-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(20, 40, 80, .16); }
.hm-news-card p { font-size: 15px; line-height: 1.75; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hm-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 12px; border-radius: 12px; margin-bottom: 12px; background: #eceff3; color: #444; }
.hm-tag--news   { background: #e2edfb; color: #1f3d7a; }
.hm-tag--case   { background: #fdf3c8; color: #6b5200; }
.hm-tag--hot    { background: #ece4fb; color: #4a2f8a; }
.hm-tag--promo  { background: #fde3ef; color: #8a1f52; }
.hm-tag--feature { background: #DCFFF2; color: #000000; }
.hm-tag--notice { background: #e1f4ea; color: #1b6b43; }

/* ---------- 成功案例 ---------- */
.hm-cases {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(48px, 6vw, 96px) 0;
  background: #ECF7FA;
}
/* 左下、右上的藍色光暈（左下略小） */
.hm-cases::before,
.hm-cases::after {
  content: "";
  position: absolute;
  z-index: -1;
  aspect-ratio: 1;
  background: url("../images/index/cases_glow.png") center / contain no-repeat;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.hm-cases::after { left: 92%; top: 32%; width: clamp(280px, 38vw, 680px); }
.hm-cases::before { left: 6%; top: 75%; width: clamp(230px, 31vw, 560px); }
.hm-cases__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2vw, 24px); }
.hm-case-card { display: flex; flex-direction: column; background: #fff; border-radius: var(--hm-radius); overflow: hidden; box-shadow: 0 4px 14px rgba(20, 40, 80, .08); transition: transform .2s, box-shadow .2s; }
.hm-case-card:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(20, 40, 80, .14); }
.hm-case-card__img { aspect-ratio: 3 / 2; background: #dfe7f1; overflow: hidden; }
.hm-case-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.hm-case-card:hover .hm-case-card__img img { transform: scale(1.04); }
.hm-case-card__body { padding: 20px 22px 28px; }
.hm-case-card h3 { font-size: 17px; font-weight: 700; line-height: 1.55; margin: 0 0 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hm-case-card__body p { font-size: 14px; line-height: 1.7; color: var(--hm-muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 雲端服務與解決方案 ---------- */
.hm-services { position: relative; padding: clamp(48px, 6vw, 72px) 0 clamp(40px, 5vw, 64px); }
/* 背景線條：1440 寬時 1:1 顯示，置中靠上；線條會延伸到下方「雲端 × AI」區塊兩側 */
.hm-services::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: max(56.95vw, 512px);
  background: url("../images/index/services_lines.png") center top / max(100%, 900px) auto no-repeat;
  pointer-events: none;
}
.hm-services .hm-container { position: relative; }
.hm-sol-track { --gap: clamp(16px, 2.6vw, 32px); display: flex; gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  /* 留出 hover 陰影的空間（overflow-x:auto 會連帶裁切上下），再以負邊距抵銷，卡片位置不變 */
  padding: 12px var(--hm-gutter) 32px; margin: -12px calc(var(--hm-gutter) * -1) 0; scroll-padding-inline: var(--hm-gutter); }
.hm-sol-track::-webkit-scrollbar { display: none; }
.hm-sol-card { flex: 0 0 calc((100% - 3 * var(--gap)) / 4); scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; background: #fff; border: 1px solid #B5E3FF; border-radius: var(--hm-radius); padding: 28px 16px 24px; transition: box-shadow .2s, border-color .2s; }
.hm-sol-card:hover { box-shadow: 0 8px 20px rgba(20, 40, 80, .1); border-color: #8DD3FF; }
.hm-sol-card img { width: 110px; height: 110px; object-fit: contain; }
.hm-sol-card strong { font-size: 18px; line-height: 1.45; font-weight: 700; }
.hm-services .hm-controls { margin-top: 0; }

/* ---------- 雲端 × AI 一站式整合 ---------- */
.hm-why { position: relative; z-index: 1; padding-bottom: 28px; }
.hm-why__panel { background: linear-gradient(180deg, #1361b3 0%, #0a3f86 100%); border-radius: 14px; color: #fff; padding: clamp(32px, 4vw, 52px) clamp(20px, 4.5vw, 56px) clamp(36px, 5vw, 72px); }
.hm-why__title { text-align: center; font-size: clamp(22px, 3vw, 38px); font-weight: 500; line-height: 1.5; letter-spacing: .03em; margin: 0 0 clamp(24px, 3vw, 32px); }
.hm-why__title span { display: block; font-size: inherit; }
.hm-why__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.hm-why-item { background: rgba(255, 255, 255, .06); border-radius: 12px; padding: clamp(22px, 2.6vw, 32px) clamp(20px, 3vw, 36px); }
.hm-why-item h3 { display: flex; align-items: center; gap: 12px; font-size: clamp(18px, 1.8vw, 21px); font-weight: 700; margin: 0 0 14px; }
.hm-why-item h3 svg,
.hm-why-item h3 img { width: 40px; height: 40px; flex-shrink: 0; object-fit: contain; }
.hm-why-item p, .hm-why-item li { font-size: 15px; line-height: 1.85; color: rgba(255, 255, 255, .9); }
.hm-why-item ul { list-style: none; margin: 8px 0 0; padding: 0; }
.hm-why-item li { position: relative; padding-left: 30px; }
.hm-why-item li::before { content: ""; position: absolute; left: 0; top: 7px; width: 20px; height: 14px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M1 8l5 5L17 2M9 12l1 1L21 2'/%3E%3C/svg%3E") no-repeat; }

/* ---------- CTA ---------- */
.hm-cta { padding-bottom: 48px; }
.hm-cta__panel { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; background: linear-gradient(90deg, #0f56ad, #0a3f86); border-radius: 14px; color: #fff; padding: 28px clamp(20px, 4.5vw, 56px); }
.hm-cta h2 { font-size: clamp(24px, 2.6vw, 34px); font-weight: 700; line-height: 1.4; margin: 0 0 16px; }
.hm-cta__text p { font-size: clamp(16px, 1.7vw, 20px); font-weight: 700; line-height: 1.7; margin-bottom: 28px; }
.hm-cta .hm-btn { display: inline-flex; align-items: center; gap: 8px; background: #fff; color: var(--hm-primary); font-size: 20px; font-weight: 700; padding: 14px 56px; border-radius: 4px; transition: transform .2s, box-shadow .2s; }
.hm-cta .hm-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, .2); color: var(--hm-primary); }
.hm-btn svg { width: 26px; height: 26px; color: #f3c22c; }
.hm-cta__img { border-radius: 6px; overflow: hidden; aspect-ratio: 16 / 9; }
.hm-cta__img img { width: 100%; height: 100%; object-fit: cover; }

/* =========================================================
   RWD
   ========================================================= */
/* 平板 */
@media (max-width: 991.98px) {
  .hm-news__grid { grid-template-columns: repeat(2, 1fr); }
  .hm-cases__grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 calc(var(--hm-gutter) * -1); padding: 4px var(--hm-gutter) 12px; scroll-padding: 0 var(--hm-gutter); }
  .hm-cases__grid::-webkit-scrollbar { display: none; }
  .hm-case-card { flex: 0 0 calc((100% - 20px) / 2); scroll-snap-align: start; }
  .hm-sol-card { flex-basis: calc((100% - 2 * var(--gap)) / 3); }
}

/* 手機 */
@media (max-width: 767.98px) {
  /* 手機：背景只露出右上青色線（另一張裁切圖） */
  .hm-services::before { left: auto; width: 180px; height: 481px; background: url("../images/index/services_lines_m.png") right top / 100% auto no-repeat; }
  .hm { --hm-gutter: 16px; }
  .hm-controls { gap: 12px; }
  .hm-news__grid { grid-template-columns: 1fr; gap: 12px; }
  .hm-news-card { min-height: 0; padding: 16px 16px 18px; }
  .hm-news-card p { -webkit-line-clamp: 2; }
  .hm-case-card { flex-basis: 93%; }
  .hm-sol-card { flex-basis: calc((100% - var(--gap)) / 2); padding: 20px 10px 18px; gap: 12px; }
  .hm-sol-card img { width: 80px; height: 80px; }
  .hm-sol-card strong { font-size: 15px; }
  .hm-why__grid { grid-template-columns: 1fr; gap: 14px; }
  .hm-why-item p, .hm-why-item li { font-size: 14px; }
  .hm-cta__panel { grid-template-columns: 1fr; gap: 20px; padding: 24px 20px 28px; text-align: center; }
  .hm-cta__img { order: -1; }
  .hm-cta .hm-btn { width: 100%; justify-content: center; font-size: 18px; padding: 12px 24px; }
}

/* 小手機：橫幅沿用原站做法，固定高度並以 cover 填滿 */
@media (max-width: 575.98px) {
  .hm-hero .carousel-item img { aspect-ratio: auto; height: 120px; }
  .hm-hero__controls { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .hm *, .hm *::before, .hm *::after { transition: none !important; }
}
