/* ==========================================================================
   翔威工程顧問 — 網站樣式
   建立在 Bootstrap 5.3 之上，只覆寫需要的部分。
   深淺色主題走 Bootstrap 原生的 data-bs-theme，不必自己寫兩套顏色。
   ========================================================================== */

/* ------------------------------------------------------------- 品牌變數 */
:root {
  --hw-brand: #1d5f96;
  --hw-brand-600: #17527f;
  --hw-brand-700: #0f3d61;
  --hw-accent: #c9741f;

  --hw-ink: #131c26;
  --hw-surface: #ffffff;
  --hw-canvas: #f7f9fb;
  --hw-line: #e5eaef;

  --hw-shadow-sm: 0 1px 2px rgba(16, 26, 36, .05), 0 2px 6px rgba(16, 26, 36, .04);
  --hw-shadow: 0 2px 6px rgba(16, 26, 36, .06), 0 12px 28px -8px rgba(16, 26, 36, .12);
  --hw-shadow-lg: 0 4px 10px rgba(16, 26, 36, .07), 0 24px 48px -12px rgba(16, 26, 36, .2);

  --hw-r: 14px;
  --hw-r-sm: 10px;
  --hw-r-pill: 999px;

  --hw-ease: cubic-bezier(.22, .61, .36, 1);
  --hw-nav-h: 68px;

  /* 交給 Bootstrap 的覆寫 */
  --bs-primary: #1d5f96;
  --bs-primary-rgb: 29, 95, 150;
  --bs-body-font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.75;
  --bs-body-color: #131c26;
  --bs-body-bg: #f7f9fb;
  --bs-border-color: #e5eaef;
  --bs-border-radius: 14px;
  --bs-border-radius-sm: 10px;
  --bs-border-radius-lg: 18px;
  --bs-link-color: #1d5f96;
  --bs-link-hover-color: #0f3d61;
}

[data-bs-theme="dark"] {
  --hw-brand: #6aaadf;
  --hw-brand-600: #8cc0ea;
  --hw-brand-700: #a9d2f2;
  --hw-accent: #dfa055;

  --hw-ink: #e9eef4;
  --hw-surface: #16212c;
  --hw-canvas: #0e1720;
  --hw-line: #26333f;

  --hw-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --hw-shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 12px 28px -8px rgba(0, 0, 0, .5);
  --hw-shadow-lg: 0 4px 10px rgba(0, 0, 0, .4), 0 24px 48px -12px rgba(0, 0, 0, .6);

  --bs-primary: #6aaadf;
  --bs-primary-rgb: 106, 170, 223;
  --bs-body-color: #e9eef4;
  --bs-body-bg: #0e1720;
  --bs-border-color: #26333f;
  --bs-link-color: #6aaadf;
  --bs-link-hover-color: #a9d2f2;
  --bs-secondary-color: rgba(233, 238, 244, .65);
  --bs-tertiary-bg: #16212c;
}

/* ------------------------------------------------------------------ 基礎 */
html { scroll-behavior: smooth; }
body { background: var(--hw-canvas); -webkit-font-smoothing: antialiased; }

h1, h2, h3, h4, .display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3;
}
.lead { font-size: 1.075rem; line-height: 1.8; }

.text-muted-2 { color: var(--bs-secondary-color); }
.fw-medium { font-weight: 500; }

a { text-decoration: none; }
:focus-visible { outline: 2px solid var(--hw-brand); outline-offset: 3px; }

/* 章節間距 */
.section { padding: 5.5rem 0; }
.section-sm { padding: 3.5rem 0; }
@media (max-width: 767.98px) {
  .section { padding: 3.25rem 0; }
  .section-sm { padding: 2.25rem 0; }
}

.eyebrow {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--hw-accent);
  margin-bottom: .5rem;
}

/* ---------------------------------------------------------------- 導覽列 */
.hw-nav {
  background: color-mix(in srgb, var(--hw-surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--hw-line);
  min-height: var(--hw-nav-h);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .hw-nav { background: var(--hw-surface); }
}

.hw-logo { display: flex; align-items: center; gap: .7rem; }
.hw-logo-mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--hw-r-sm);
  background: linear-gradient(140deg, var(--hw-brand), var(--hw-brand-700));
  color: #fff; font-weight: 700; font-size: 1.05rem;
  box-shadow: var(--hw-shadow-sm);
}
[data-bs-theme="dark"] .hw-logo-mark {
  background: linear-gradient(140deg, #2b6d9f, #14425f);
}
.hw-logo-name {
  display: block; font-weight: 700; font-size: 1.08rem;
  letter-spacing: .04em; color: var(--bs-body-color); line-height: 1.2;
}
.hw-logo-sub {
  display: block; font-size: .62rem; letter-spacing: .16em;
  color: var(--bs-secondary-color);
}

.hw-nav .nav-link {
  font-size: .95rem; font-weight: 500;
  color: var(--bs-secondary-color);
  padding: .5rem .9rem; border-radius: var(--hw-r-sm);
  transition: color .18s var(--hw-ease), background-color .18s var(--hw-ease);
}
.hw-nav .nav-link:hover { color: var(--hw-brand); background: rgba(var(--bs-primary-rgb), .08); }
.hw-nav .nav-link.active { color: var(--hw-brand); font-weight: 700; }

.theme-toggle {
  width: 38px; height: 38px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--hw-line); border-radius: var(--hw-r-sm);
  background: transparent; color: var(--bs-secondary-color);
  transition: all .18s var(--hw-ease);
}
.theme-toggle:hover { color: var(--hw-brand); border-color: var(--hw-brand); }
.theme-toggle .icon-dark { display: none; }
[data-bs-theme="dark"] .theme-toggle .icon-dark { display: block; }
[data-bs-theme="dark"] .theme-toggle .icon-light { display: none; }

/* ------------------------------------------------------------------ Hero */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--hw-surface);
  border-bottom: 1px solid var(--hw-line);
}
.hero::before {
  content: "";
  position: absolute; inset: -30% -10% auto -10%; height: 150%;
  background:
    radial-gradient(42% 46% at 78% 18%, rgba(29, 95, 150, .16), transparent 68%),
    radial-gradient(38% 40% at 12% 78%, rgba(201, 116, 31, .1), transparent 70%),
    radial-gradient(50% 50% at 50% 0%, rgba(29, 95, 150, .07), transparent 72%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(var(--hw-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--hw-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 60% at 75% 25%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 75% 25%, #000 10%, transparent 72%);
}
.hero > .container { position: relative; z-index: 1; padding-top: 5.5rem; padding-bottom: 5.5rem; }
@media (max-width: 767.98px) {
  .hero > .container { padding-top: 3.25rem; padding-bottom: 3.25rem; }
}

.hero h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); letter-spacing: -.02em; }
.hero .lead { max-width: 34em; }

.pill-tag {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .3rem .85rem; border-radius: var(--hw-r-pill);
  border: 1px solid var(--hw-line); background: var(--hw-surface);
  font-size: .8rem; font-weight: 500; color: var(--bs-secondary-color);
  box-shadow: var(--hw-shadow-sm);
}
.pill-tag .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--hw-accent);
}

/* ------------------------------------------------------------------ 按鈕 */
.btn { border-radius: var(--hw-r-sm); font-weight: 600; padding: .6rem 1.35rem; }
.btn-lg { padding: .8rem 1.7rem; font-size: 1rem; }
.btn-primary {
  background: var(--hw-brand); border-color: var(--hw-brand);
  box-shadow: 0 1px 2px rgba(16, 26, 36, .1), 0 6px 16px -6px rgba(var(--bs-primary-rgb), .5);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--hw-brand-600); border-color: var(--hw-brand-600);
}
[data-bs-theme="dark"] .btn-primary { color: #0b141c; }
.btn-outline-secondary {
  border-color: var(--hw-line); color: var(--bs-body-color); background: var(--hw-surface);
}
.btn-outline-secondary:hover {
  border-color: var(--hw-brand); color: var(--hw-brand); background: var(--hw-surface);
}

/* ------------------------------------------------------------------ 卡片 */
.hw-card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--hw-surface);
  border: 1px solid var(--hw-line);
  border-radius: var(--hw-r);
  overflow: hidden;
  color: inherit;
  box-shadow: var(--hw-shadow-sm);
  transition: transform .25s var(--hw-ease), box-shadow .25s var(--hw-ease),
    border-color .25s var(--hw-ease);
}
.hw-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--hw-shadow-lg);
  border-color: color-mix(in srgb, var(--hw-brand) 35%, var(--hw-line));
  color: inherit;
}
.hw-card:hover .hw-card-title { color: var(--hw-brand); }

.hw-card-media {
  position: relative; aspect-ratio: 4 / 3;
  background: var(--hw-canvas); overflow: hidden;
}
.hw-card-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s var(--hw-ease);
}
.hw-card:hover .hw-card-media img { transform: scale(1.05); }
.hw-card-media img.is-default { object-fit: contain; padding: 12%; opacity: .6; }

.media-chip {
  position: absolute;
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .55rem;
  border-radius: var(--hw-r-pill);
  background: rgba(14, 23, 32, .72); color: #fff;
  font-size: .72rem; font-weight: 600;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.media-chip.top-start { top: .7rem; left: .7rem; }
.media-chip.bottom-end { bottom: .7rem; right: .7rem; }
.media-chip.is-live { background: rgba(201, 116, 31, .92); }

.hw-card-body { padding: 1.1rem 1.15rem 1.2rem; display: flex; flex-direction: column; flex: 1; }
.hw-card-title {
  font-size: 1.02rem; font-weight: 700; line-height: 1.5; margin: 0 0 .45rem;
  transition: color .18s var(--hw-ease);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hw-card-meta {
  font-size: .845rem; color: var(--bs-secondary-color);
  margin: 0 0 .75rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
}
.hw-card-meta .sep { opacity: .45; }
.hw-card-tags { margin-top: auto; display: flex; flex-wrap: wrap; gap: .35rem; }

.tag {
  padding: .18rem .55rem; border-radius: var(--hw-r-sm);
  background: rgba(var(--bs-primary-rgb), .1); color: var(--hw-brand-700);
  font-size: .78rem; font-weight: 500; white-space: nowrap;
}
[data-bs-theme="dark"] .tag { color: var(--hw-brand-600); }
.tag.tag-plain { background: var(--hw-canvas); color: var(--bs-secondary-color); }

/* --------------------------------------------------------------- 服務卡 */
.svc-card {
  height: 100%; padding: 1.6rem 1.5rem;
  background: var(--hw-surface); border: 1px solid var(--hw-line);
  border-radius: var(--hw-r);
  transition: transform .25s var(--hw-ease), box-shadow .25s var(--hw-ease),
    border-color .25s var(--hw-ease);
}
.svc-card:hover {
  transform: translateY(-3px); box-shadow: var(--hw-shadow);
  border-color: color-mix(in srgb, var(--hw-brand) 35%, var(--hw-line));
}
.svc-icon {
  width: 44px; height: 44px; margin-bottom: 1rem;
  display: grid; place-items: center; border-radius: var(--hw-r-sm);
  background: rgba(var(--bs-primary-rgb), .1); color: var(--hw-brand);
  font-weight: 700;
}

/* ------------------------------------------------------------- 篩選工具列 */
.toolbar {
  position: sticky; top: var(--hw-nav-h); z-index: 20;
  background: color-mix(in srgb, var(--hw-canvas) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--hw-line);
  padding: .85rem 0;
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .toolbar { background: var(--hw-canvas); }
}

.chip {
  padding: .4rem .95rem; border-radius: var(--hw-r-pill);
  border: 1px solid var(--hw-line); background: var(--hw-surface);
  color: var(--bs-secondary-color);
  font-size: .89rem; font-weight: 500; white-space: nowrap;
  transition: all .18s var(--hw-ease);
}
.chip:hover { border-color: var(--hw-brand); color: var(--hw-brand); }
.chip[aria-pressed="true"] {
  background: var(--hw-brand); border-color: var(--hw-brand); color: #fff;
}
[data-bs-theme="dark"] .chip[aria-pressed="true"] { color: #0b141c; }
.chip .n { opacity: .6; font-size: .8em; margin-left: .2rem; }

.chip-row { display: flex; gap: .45rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }

.search-box { position: relative; }
.search-box .form-control {
  padding-left: 2.4rem; border-radius: var(--hw-r-pill);
  background: var(--hw-surface); border-color: var(--hw-line);
  font-size: .92rem;
}
.search-box .form-control:focus {
  border-color: var(--hw-brand);
  box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .16);
}
.search-box .icon {
  position: absolute; left: .85rem; top: 50%; transform: translateY(-50%);
  color: var(--bs-secondary-color); pointer-events: none;
}
.search-box .clear {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--bs-secondary-color);
  padding: .25rem; line-height: 1; border-radius: 50%;
}
.search-box .clear:hover { color: var(--bs-body-color); }

.form-select-sm.hw-select {
  border-radius: var(--hw-r-pill); border-color: var(--hw-line);
  background-color: var(--hw-surface); font-size: .89rem;
  padding: .4rem 2rem .4rem .9rem; width: auto;
}

/* 年份群組標題 */
.year-head {
  display: flex; align-items: center; gap: 1rem;
  margin: 2.5rem 0 1.1rem;
}
.year-head:first-child { margin-top: 0; }
.year-head .y {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em;
  color: var(--bs-body-color);
}
.year-head .n { font-size: .85rem; color: var(--bs-secondary-color); }
.year-head .line { flex: 1; height: 1px; background: var(--hw-line); }

/* ------------------------------------------------------------- 專案詳細頁 */
.page-head {
  background: var(--hw-surface); border-bottom: 1px solid var(--hw-line);
  padding: 2.75rem 0 2.5rem;
}
.page-head h1 { font-size: clamp(1.6rem, 3.4vw, 2.5rem); }

.breadcrumb { --bs-breadcrumb-divider: "/"; font-size: .85rem; margin-bottom: .75rem; }
.breadcrumb a { color: var(--bs-secondary-color); }
.breadcrumb a:hover { color: var(--hw-brand); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--bs-secondary-color); opacity: .5; }

.gallery-main {
  position: relative; aspect-ratio: 16 / 10;
  background: var(--hw-surface); border: 1px solid var(--hw-line);
  border-radius: var(--hw-r); overflow: hidden;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-main img.is-default { object-fit: contain; padding: 7%; opacity: .55; }
.gallery-main.is-zoomable { cursor: zoom-in; }

.gnav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: #131c26;
  box-shadow: var(--hw-shadow); opacity: 0;
  transition: opacity .2s var(--hw-ease);
}
.gallery-main:hover .gnav, .gnav:focus-visible { opacity: 1; }
.gnav.prev { left: .75rem; }
.gnav.next { right: .75rem; }

.gthumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: .55rem; margin-top: .7rem;
}
.gthumbs button {
  aspect-ratio: 4 / 3; padding: 0; overflow: hidden; opacity: .62;
  border: 2px solid transparent; border-radius: var(--hw-r-sm);
  background: var(--hw-canvas);
  transition: opacity .18s var(--hw-ease), border-color .18s var(--hw-ease);
}
.gthumbs button:hover { opacity: 1; }
.gthumbs button[aria-current="true"] { opacity: 1; border-color: var(--hw-brand); }
.gthumbs img { width: 100%; height: 100%; object-fit: cover; }

.gdots { display: none; justify-content: center; gap: .4rem; margin-top: .75rem; }
.gdots button {
  width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%;
  background: var(--hw-line); transition: all .18s var(--hw-ease);
}
.gdots button[aria-current="true"] { background: var(--hw-brand); width: 22px; border-radius: 4px; }

.spec-card {
  position: sticky; top: calc(var(--hw-nav-h) + 1.25rem);
  background: var(--hw-surface); border: 1px solid var(--hw-line);
  border-radius: var(--hw-r); overflow: hidden; box-shadow: var(--hw-shadow-sm);
}
.spec-card .head {
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--hw-line);
  font-weight: 700; font-size: .95rem; background: var(--hw-canvas);
}
.spec-card dl { margin: 0; padding: .35rem 1.25rem 1.1rem; }
.spec-card dt {
  margin-top: .9rem; font-size: .76rem; font-weight: 600;
  letter-spacing: .07em; color: var(--bs-secondary-color);
}
.spec-card dd { margin: .15rem 0 0; font-size: .97rem; }
.spec-card dd .tag { margin: .2rem .2rem 0 0; display: inline-block; }

/* 燈箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 1080; display: none;
  background: rgba(8, 13, 18, .94);
  align-items: center; justify-content: center; padding: 2rem;
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--hw-r-sm); }
.lightbox .close-btn {
  position: absolute; top: 1rem; right: 1rem;
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center;
}
.lightbox .close-btn:hover { background: rgba(255, 255, 255, .26); }

/* ---------------------------------------------------------------- 數據列 */
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--hw-line);
  border: 1px solid var(--hw-line); border-radius: var(--hw-r); overflow: hidden;
}
.stat-strip .item { background: var(--hw-surface); padding: 1.5rem 1.1rem; text-align: center; }
.stat-strip .num {
  font-size: 2.1rem; font-weight: 700; line-height: 1.15;
  color: var(--hw-brand); letter-spacing: -.02em;
}
.stat-strip .lbl { font-size: .86rem; color: var(--bs-secondary-color); }

/* ------------------------------------------------------------------ CTA */
.cta-band {
  border-radius: var(--hw-r);
  background: linear-gradient(135deg, var(--hw-brand-700), var(--hw-brand) 55%, #2b7cb8);
  color: #fff; padding: 3rem 2rem; text-align: center;
  box-shadow: var(--hw-shadow);
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .8); max-width: 34em; margin-inline: auto; }
.cta-band .btn-light { color: var(--hw-brand-700); font-weight: 700; }

/* ----------------------------------------------------------------- 頁尾 */
.site-footer {
  background: #0f1922; color: rgba(255, 255, 255, .68);
  padding: 3.25rem 0 1.5rem; font-size: .93rem;
}
.site-footer h6 {
  color: #fff; font-size: .78rem; letter-spacing: .14em; margin-bottom: .85rem; font-weight: 700;
}
.site-footer a { color: rgba(255, 255, 255, .68); }
.site-footer a:hover { color: #fff; }
.site-footer .hw-logo-name { color: #fff; }
.site-footer .hw-logo-mark { background: rgba(255, 255, 255, .12); }
.site-footer hr { border-color: rgba(255, 255, 255, .12); opacity: 1; }

/* ----------------------------------------------------------- 骨架與狀態 */
.sk { border-radius: var(--hw-r); overflow: hidden; border: 1px solid var(--hw-line); background: var(--hw-surface); }
.sk-media { aspect-ratio: 4 / 3; }
.sk-line { height: 12px; margin: 0 1.15rem .6rem; border-radius: 4px; }
.sk-line:first-of-type { margin-top: 1.15rem; width: 76%; }
.sk-line:last-of-type { width: 45%; margin-bottom: 1.4rem; }
.sk-media, .sk-line {
  background: linear-gradient(90deg, var(--hw-canvas) 25%, var(--hw-line) 37%, var(--hw-canvas) 63%);
  background-size: 400% 100%;
  animation: hw-shimmer 1.4s ease-in-out infinite;
}
@keyframes hw-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

.state { padding: 4rem 1rem; text-align: center; color: var(--bs-secondary-color); }
.state h3 { color: var(--bs-body-color); font-size: 1.15rem; }

/* --------------------------------------------------------------- 轉檔工具 */
.dropzone {
  border: 2px dashed var(--hw-line); border-radius: var(--hw-r);
  background: var(--hw-surface); padding: 2.25rem 1.5rem; text-align: center;
  transition: all .2s var(--hw-ease); cursor: pointer;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--hw-brand); background: rgba(var(--bs-primary-rgb), .04);
}
.dropzone.is-done { border-style: solid; border-color: #2f9e63; }

.log { font-size: .88rem; max-height: 340px; overflow-y: auto; }
.log .row-item { padding: .45rem .7rem; border-radius: var(--hw-r-sm); margin-bottom: .3rem; }
.log .err { background: rgba(198, 40, 40, .1); color: #b3261e; }
.log .warn { background: rgba(201, 116, 31, .12); color: #8a5214; }
.log .ok { background: rgba(47, 158, 99, .1); color: #1e7a49; }
[data-bs-theme="dark"] .log .err { color: #ff9c92; }
[data-bs-theme="dark"] .log .warn { color: #e5b273; }
[data-bs-theme="dark"] .log .ok { color: #77d3a1; }

code, .font-mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .88em;
}

/* ---------------------------------------------------------------- 響應式 */
@media (max-width: 991.98px) {
  .spec-card { position: static; }
}
@media (max-width: 767.98px) {
  :root { --hw-nav-h: 60px; }
  .gthumbs { display: none; }
  .gdots { display: flex; }
  .gnav { opacity: 1; width: 34px; height: 34px; }
  .gallery-main { aspect-ratio: 4 / 3; }
  .toolbar { padding: .65rem 0; }
  .cta-band { padding: 2.25rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

@media print {
  .hw-nav, .site-footer, .toolbar, .cta-band, .gnav, .gthumbs, .pager { display: none !important; }
  body { background: #fff; }
}

/* 工具列的搜尋欄：手機獨占一整列，桌機縮到右側固定寬度 */
.toolbar .search-box { flex: 0 0 100%; }
@media (min-width: 992px) {
  .toolbar .search-box { flex: 0 1 230px; }
}

/* ==========================================================================
   技術顧問
   ========================================================================== */
.cons-card {
  height: 100%;
  padding: 1.5rem;
  background: var(--hw-surface);
  border: 1px solid var(--hw-line);
  border-radius: var(--hw-r);
  box-shadow: var(--hw-shadow-sm);
  transition: transform .25s var(--hw-ease), box-shadow .25s var(--hw-ease),
    border-color .25s var(--hw-ease);
}
.cons-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--hw-shadow);
  border-color: color-mix(in srgb, var(--hw-brand) 32%, var(--hw-line));
}

.cons-avatar {
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 18px;
  object-fit: cover;
  overflow: hidden;
}
.cons-avatar.is-text {
  background: linear-gradient(145deg, var(--a1), var(--a2));
  color: #fff;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: 0 2px 6px rgba(16, 26, 36, .18), inset 0 1px 0 rgba(255, 255, 255, .22);
}

.cons-name {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: .45rem;
  flex-wrap: wrap;
}
.cons-title {
  font-size: .84rem;
  font-weight: 500;
  color: var(--hw-brand);
  padding: .1rem .5rem;
  border-radius: var(--hw-r-pill);
  background: rgba(var(--bs-primary-rgb), .1);
}
.cons-affil {
  font-size: .9rem;
  color: var(--bs-secondary-color);
  line-height: 1.55;
}

.cons-creds { list-style: none; padding: 0; font-size: .92rem; color: var(--bs-secondary-color); }
.cons-creds li { position: relative; padding-left: 1rem; margin-bottom: .3rem; }
.cons-creds li::before {
  content: ""; position: absolute; left: 0; top: .68em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--hw-brand); opacity: .65;
}

/* 學歷／現職與經歷／著作。小標用細線分隔，不用粗標題，
   免得一張卡片上出現三、四個搶眼的標題把姓名壓下去。 */
.cons-sects { display: grid; gap: 1rem; }
.cons-sect { padding-top: .85rem; border-top: 1px solid var(--hw-line); }
.cons-sect:first-child { padding-top: 0; border-top: 0; }
.cons-sect-label {
  margin: 0 0 .45rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  /* 不要再疊 opacity。字只有 11–12px，淺色模式下降透明度會掉到 3.8:1，
     過不了 WCAG AA 的 4.5:1；要更淡就改 token，不要用 opacity。 */
  color: var(--bs-secondary-color);
}

/* YouTube 按鈕 */
.btn-yt {
  display: inline-flex; align-items: center; gap: .4rem;
  background: #ff0033; border-color: #ff0033; color: #fff; font-weight: 600;
}
.btn-yt:hover, .btn-yt:focus { background: #d90029; border-color: #d90029; color: #fff; }
.btn-yt svg { flex: none; }

.min-w-0 { min-width: 0; }

/* ==========================================================================
   動態效果的基礎樣式
   只有載入 motion.js 的頁面才會加上 .hw-motion，所以沒載入時完全不受影響。
   ========================================================================== */
.hw-motion [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s var(--hw-ease), transform .6s var(--hw-ease);
  will-change: opacity, transform;
}
.hw-motion [data-reveal].is-in { opacity: 1; transform: none; }

.hw-motion [data-tilt] {
  transform: perspective(900px) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg));
  transition: transform .4s var(--hw-ease), box-shadow .3s var(--hw-ease);
}
.hw-motion [data-tilt].is-tilting { transition: transform .08s linear, box-shadow .3s var(--hw-ease); }

@media (prefers-reduced-motion: reduce) {
  .hw-motion [data-reveal] { opacity: 1 !important; transform: none !important; }
  .hw-motion [data-tilt] { transform: none !important; }
}

/* 「2021–2025」這種長字串用原本的大字級會撐破格子，縮小並禁止斷行 */
.stat-strip .num.is-wide { font-size: 1.35rem; white-space: nowrap; letter-spacing: 0; }
@media (min-width: 992px) {
  .stat-strip .num.is-wide { font-size: 1.5rem; }
}

/* ==========================================================================
   清單檢視：把工程實績排成可快速掃描的索引
   案件多的時候比格狀檢視有效率，也是日系企業網站慣用的實績呈現方式。
   ========================================================================== */
.idx {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hw-line);
}
.idx-row { border-bottom: 1px solid var(--hw-line); }

.idx-row > a {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 9.5rem 5.5rem 6.5rem 1.5rem;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem .35rem;
  color: inherit;
  transition: background-color .25s var(--hw-ease), padding-left .25s var(--hw-ease);
}
.idx-row > a:hover {
  color: inherit;
  background: rgba(var(--bs-primary-rgb), .045);
  padding-left: .8rem;
}

.idx-no {
  font-variant-numeric: tabular-nums;
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--bs-secondary-color);
}
.idx-name {
  font-weight: 600;
  line-height: 1.6;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
}
.idx-live {
  font-style: normal;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .06em;
  padding: .1rem .45rem;
  border: 1px solid currentColor;
  color: var(--hw-accent);
  flex: none;
}
.idx-cat, .idx-loc, .idx-year {
  font-size: .84rem;
  color: var(--bs-secondary-color);
}
.idx-year { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.idx-go {
  font-size: .95rem;
  color: var(--bs-secondary-color);
  opacity: 0;
  transition: opacity .25s var(--hw-ease), transform .25s var(--hw-ease);
}
.idx-row > a:hover .idx-go { opacity: 1; transform: translateX(3px); }

/* 窄螢幕：改成「編號絕對定位 + 內容區塊流動」
   原本用 grid-row 讓類別／地點／年份分行，但它們都落在同一個
   grid-column，同列時會疊在一起，所以這裡改用單純的區塊排版 */
@media (max-width: 991.98px) {
  .idx-row > a {
    display: block;
    position: relative;
    padding: 1rem .25rem 1.05rem 2.7rem;
  }
  .idx-row > a:hover { padding-left: 2.7rem; }
  .idx-no { position: absolute; left: 0; top: 1.15rem; }
  .idx-name { display: block; margin-bottom: .2rem; }
  .idx-cat, .idx-loc, .idx-year { display: inline; font-size: .81rem; }
  .idx-loc::before, .idx-year::before {
    content: "／";
    opacity: .45;
    margin: 0 .1rem;
  }
  .idx-go { display: none; }
}

/* ==========================================================================
   公司 logo
   淺色模式用原始的銀灰漸層版，深色模式換成單色 knockout 版。
   深色底直接用原圖的話，黑色中文字會整片看不見。
   ========================================================================== */
.hw-logo-img {
  display: block;
  height: 46px;
  width: auto;
  max-width: 100%;
}
.hw-logo-img.is-footer { height: 42px; }

/* 兩張圖依主題二選一顯示 */
.hw-logo-ko { display: none; }
[data-bs-theme="dark"] .hw-logo-img:not(.hw-logo-ko) { display: none; }
[data-bs-theme="dark"] .hw-logo-ko { display: block; }

@media (max-width: 991.98px) {
  .hw-logo-img { height: 34px; }
  .hw-logo-img.is-footer { height: 36px; }
}
@media (max-width: 400px) {
  .hw-logo-img { height: 30px; }
}

/* 頭像：照片疊在文字頭像上面。照片載不到時 img 會被移除，露出底下的文字頭像 */
.cons-avatar-stack {
  position: relative;
  flex: none;
  display: block;
  overflow: hidden;
  border-radius: 18px;
}
.cons-avatar-stack .cons-avatar {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.cons-avatar-stack img.cons-avatar { object-fit: cover; z-index: 1; }

/* 縮圖退到預設圖時，比照主圖的處理：置中不裁切、降低不透明度 */
.gthumbs img.is-default { object-fit: contain; padding: 18%; opacity: .5; }
