/* =========================================
   共用元件：header / nav / dropdown / search / footer / sidebar / card / breadcrumb
   ========================================= */

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
  display: flex;
  align-items: center;
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.logo-link { display: flex; align-items: center; flex-shrink: 0; }
/* 英文/日文的 logo 是完整拼出公司全名，橫向比例比中文版寬很多；
   加寬度上限避免把導覽選單擠壞，超過上限時改成等比縮小高度（object-fit: contain 避免變形） */
.logo-img { height: 48px; width: auto; max-width: 215px; object-fit: contain; }

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 20px;
  background: none;
  border: none;
  padding: 0;
}
.menu-toggle span {
  display: block;
  height: 2.5px;
  width: 100%;
  background: var(--brand-navy);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav > ul { display: flex; align-items: center; gap: 4px; }
.main-nav > ul > li { position: relative; }
.main-nav > ul > li > a {
  display: block;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-color);
  border-radius: 6px;
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li.active > a {
  color: var(--brand-red);
}

.dropdown-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  min-width: 240px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  padding: 8px;
  z-index: 100;
}
.has-dropdown:hover .dropdown-panel,
.has-dropdown:focus-within .dropdown-panel {
  display: block;
  animation: fadeInDown 0.2s ease forwards;
}
.dropdown-panel a {
  display: block;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-color);
}
.dropdown-panel a:hover { background: var(--bg-light); color: var(--brand-red); }

@keyframes fadeInDown {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Search（放大鏡圖示，點擊展開搜尋框，跟語言切換同一套互動模式） ---------- */
.header-search { position: relative; }
.header-search-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border: none; background: transparent; color: var(--text-color);
  transition: color var(--transition);
}
.header-search-toggle:hover,
.header-search.open .header-search-toggle { color: var(--brand-red); }

.header-search-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  align-items: center;
  z-index: 100;
}
.header-search.open .header-search-panel { display: flex; animation: fadeInDownRight 0.2s ease forwards; }

.header-search-panel input[type="search"] {
  width: 260px;
  padding: 10px 42px 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 14px;
  background: var(--white);
  box-shadow: var(--shadow-md);
}
.header-search-panel input[type="search"]:focus {
  outline: none;
  border-color: var(--brand-red);
}
.header-search-panel button {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
}
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 340px;
  overflow-y: auto;
  z-index: 200;
}
.search-suggestions a {
  display: block;
  padding: 10px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
}
.search-suggestions a:last-child { border-bottom: none; }
.search-suggestions a:hover { background: var(--bg-light); color: var(--brand-red); }
.search-suggestions .suggestion-empty { padding: 14px; color: var(--text-muted); font-size: 14px; }

/* ---------- Language switch（地球圖示 + 下拉選單） ---------- */
.lang-switch { position: relative; }
.lang-switch-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 50px; height: 50px;
  border: none; background: transparent;
}
.lang-switch-icon { display: block; opacity: 0.85; transition: opacity var(--transition); }
.lang-switch-toggle:hover .lang-switch-icon,
.lang-switch.open .lang-switch-icon { opacity: 1; }

.lang-switch-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--white);
  min-width: 160px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  padding: 8px;
  z-index: 100;
}
.lang-switch.open .lang-switch-panel { display: block; animation: fadeInDownRight 0.2s ease forwards; }

@keyframes fadeInDownRight {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.lang-link {
  display: block;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 6px;
  color: var(--text-color);
}
.lang-link:hover { background: var(--bg-light); color: var(--brand-red); }
.lang-link.active { background: var(--brand-navy); color: #fff; }

/* ---------- Page banner (內頁標題帶) ---------- */
.page-banner {
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-light) 100%);
  color: #fff;
  padding: 56px 0 40px;
  text-align: center;
}
.page-banner h1 { color: #fff; margin-bottom: 10px; font-size: 34px; }
.page-banner p { color: rgba(255,255,255,0.8); max-width: 640px; margin: 0 auto; }

.breadcrumb {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 16px;
}
.breadcrumb a { color: rgba(255,255,255,0.85); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; opacity: 0.6; }

/* ---------- Sticky sidebar layout（服務子頁 / 最新消息 共用） ---------- */
.layout-with-sidebar {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  max-width: var(--container-width);
  margin: 48px auto 80px;
  padding: 0 20px;
}
.sidebar {
  width: 270px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px 20px;
  position: sticky;
  top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto;
}
.sidebar-title {
  font-size: 16px;
  color: var(--brand-navy);
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand-red);
  font-weight: 700;
}
.sidebar-menu li { border-bottom: 1px solid var(--border-color); }
.sidebar-menu li:last-child { border-bottom: none; }
.sidebar-menu a {
  display: block;
  padding: 12px 8px;
  font-size: 14px;
  color: var(--text-color);
  border-left: 3px solid transparent;
}
.sidebar-menu a:hover,
.sidebar-menu a.active {
  color: var(--brand-red);
  font-weight: 700;
  border-left-color: var(--brand-red);
  padding-left: 14px;
  background: var(--bg-light);
}
.main-content { flex-grow: 1; min-width: 0; }

@media (max-width: 900px) {
  .layout-with-sidebar { flex-direction: column; margin: 30px auto 50px; }
  .sidebar { width: 100%; position: static; max-height: none; }
}

/* ---------- Card grid（服務製程卡 / 新聞卡 共用） ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}
.info-card {
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.info-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.info-card .card-img-wrap { aspect-ratio: 4 / 3; overflow: hidden; background: var(--bg-light); }
.info-card .card-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.info-card:hover .card-img-wrap img { transform: scale(1.06); }
.info-card .card-body { padding: 22px; flex-grow: 1; display: flex; flex-direction: column; }
.info-card h3 { font-size: 18px; margin-bottom: 10px; }
.info-card p { font-size: 14px; color: var(--text-muted); flex-grow: 1; }
.info-card .card-link { margin-top: 14px; font-weight: 700; color: var(--brand-red); font-size: 14px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-navy); color: rgba(255,255,255,0.75); padding: 60px 0 0; margin-top: 60px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.footer-logo-img { height: 40px; margin-bottom: 14px; }
.footer-name { color: #fff; font-weight: 700; }
.footer-col h3 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.footer-col p, .footer-col a { color: rgba(255,255,255,0.7); font-size: 14px; }
.footer-nav a { display: block; margin-bottom: 8px; }
.footer-col a:hover { color: #fff; }
.footer-bottom { padding: 20px; text-align: center; font-size: 13px; color: rgba(255,255,255,0.5); }

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- Mobile nav ---------- */
@media (max-width: 900px) {
  .menu-toggle { display: flex; }
  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    gap: 20px;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform var(--transition);
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav > ul { flex-direction: column; align-items: stretch; gap: 0; }
  .main-nav > ul > li > a { padding: 14px 4px; border-bottom: 1px solid var(--border-color); }
  .dropdown-panel { position: static; transform: none; box-shadow: none; border: none; display: none; padding-left: 12px; }
  .has-dropdown:hover .dropdown-panel { display: none; }
  .has-dropdown.open .dropdown-panel { display: block; }
  .header-search { display: flex; justify-content: center; }
  .header-search-panel { position: static; width: 100%; margin-top: 10px; }
  .header-search-panel input[type="search"] { width: 100%; }
  .lang-switch { display: flex; justify-content: center; padding-top: 10px; }
}

.menu-toggle.open span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

/* ---------- CTA band（跨頁共用，故放在全站都會載入的 components.css）---------- */
.cta-band { background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-light) 100%); color: #fff; text-align: center; padding: 70px 20px; }
.cta-band h2 { color: #fff; font-size: 30px; margin-bottom: 24px; }
/* 淺色版（對調用色給「專業表面處理，從這裡開始」） */
.cta-band-light { background: var(--white); color: var(--text-color); }
.cta-band-light h2 { color: var(--brand-navy); }
