/* SIMHEX 全站頁首：高度統一
   頁首本體已抽成共用元件 SiteHeader.dc.html，高度由元件自己控制。
   這裡只留一道保險：白色橫條的最小高度，避免個別頁面把它壓扁。
   改 --simhex-header-h 即全站生效。 */
:root { --simhex-header-h: 70px; }

/* 頁首載入前的占位：直接畫成頁首的樣子（白底、logo、公司名），不再出現灰條 */
.sc-placeholder[title="SiteHeader"] {
  background: #ffffff !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: 0 1px 0 rgba(16,24,40,0.07);
  height: var(--simhex-header-h) !important;
  display: flex;
  align-items: center;
  padding: 0 clamp(16px, 4.5vw, 72px);
  box-sizing: border-box;
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'PingFang TC', sans-serif;
}
.sc-placeholder[title="SiteHeader"]::before {
  content: '' !important;
  position: static !important;
  inset: auto !important;
  flex: none;
  width: 38px;
  height: 38px;
  background: url("simhex-mark-blue-v2.avif") center / contain no-repeat !important;
  animation: none !important;
  margin-right: 13px;
}
.sc-placeholder[title="SiteHeader"]::after {
  content: '星恆科技有限公司';
  display: block;
  padding-left: 14px;
  border-left: 1px solid rgba(0,86,179,0.32);
  line-height: 27px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #0056b3;
  white-space: nowrap;
}
.sc-placeholder[title="SiteHeader"] .sc-placeholder-error { display: none; }
.sc-placeholder[title="NavSparkles"] { display: none !important; }

@media (min-width: 861px) {
  div:has(> nav[aria-label="主選單"]) {
    min-height: var(--simhex-header-h);
    box-sizing: border-box;
    align-items: center;
  }
}


/* 內嵌頁首需要的動畫（原本在 SiteHeader 元件內） */
@property --shineAngle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes shineSpin { to { --shineAngle: 360deg; } }
@keyframes shimmerSpin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes sparkle { 0% { opacity: 0; transform: scale(0) rotate(75deg); } 50% { opacity: 1; transform: scale(1) rotate(120deg); } 100% { opacity: 0; transform: scale(0) rotate(150deg); } }
nav[aria-label="主選單"] { scrollbar-width: none; -ms-overflow-style: none; }
nav[aria-label="主選單"]::-webkit-scrollbar { display: none; width: 0; height: 0; }


/* 全站中文斷行規則（2026-09-15）：新頁面／新文章自動生效，不必逐頁手改。
   標題與短句用 balance（兩行長度盡量接近，不會只剩兩三個字）；
   卡片內文用 pretty（避免末行孤字），並禁止標點落在行首／行尾。 */
h1, h2, h3, h4,
[data-ts="card-title"], [data-ts="card-tagline"] {
  text-wrap: balance;
  line-break: strict;
}
p, li, [data-ts="card-body"] {
  text-wrap: pretty;
  line-break: strict;
  overflow-wrap: break-word;
}

/* 全站禁止橫向滑動（2026-09-15）：手機上任何元素溢出（負 margin、nowrap 標題、圖表溢出）
   都不再讓整頁能往右拖出一片空白。用 clip 而非 hidden — 不會破壞 position: sticky 頁首。 */
html, body {
  max-width: 100%;
  overflow-x: clip;
}
@supports not (overflow: clip) {
  html, body { overflow-x: hidden; }
}


/* 效能：頁首 CTA 的旋轉光暈與選單外框光邊原本 infinite 永久重繪 —
   使用者整段停留都在耗 GPU／電力。捲出視窗時由 nav-enhance.js 加上
   html[data-hdr-offscreen]，animation 一律暫停；捲回來自動繼續。
   prefers-reduced-motion 的使用者直接完全停用。 */
html[data-hdr-offscreen] [style*="shimmerSpin"],
html[data-hdr-offscreen] [style*="shineSpin"] {
  animation-play-state: paused !important;
}
@media (prefers-reduced-motion: reduce) {
  [style*="shimmerSpin"], [style*="shineSpin"] { animation: none !important; }
}
