/* 配色方案 */
:root {
  --bg-primary: #EEF2F5;
  /* 最淺藍灰 */
  --bg-secondary: #B3C4DE;
  /* 次要背景 */
  --bg-tertiary: #94A2BF;
  /* 第三背景 */
  --bg-accent: #6680B3;
  /* 强調色 */
  --bg-dark: #354b77;
  /* 深色背景 - 改為較淺的藍色，更能襯托LOGO */
  --text-dark: #1E2337;
  --text-light: #ffffff;
  --header-height: 120px;
  /* Header 高度變數，會由 JS 動態更新 */
}

/* 頁面內容區 - 留出 Header 空間 */
.page-content {
  padding-top: var(--header-height);
}

/* 全局样式 */
html {
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-primary);
  font-family: 'Arial Unicode MS', 'Microsoft JhengHei', sans-serif;
  margin: 0;
  padding: 0;
  padding-top: var(--header-height);
  /* 預設留出 header 空間 */
  animation: fadeInPage 0.6s ease-out forwards;
  overflow-x: hidden;
  max-width: 100vw;
}

/* 直书样式（辦公大樓） */
.writing-vertical {
  writing-mode: vertical-rl;
}

/* Hero 區域 - 增加高度以便之後放影片 */
.hero-section {
  min-height: 100vh;
  margin-top: calc(-1 * var(--header-height));
  /* 抵消 body padding-top，讓 hero 從頂部開始 */
  padding-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .hero-section {
    min-height: 100vh;
  }
}

/* 场景卡片基础样式 */
.scene-card {
  position: relative;
  /* 為了讓文字絕對定位 */
  display: block;
  /* 讓 a 標籤表現像 div */
  overflow: hidden;
  /* 隱藏超出邊界的內容 */
  border-radius: 0.75rem;
  /* 圓角 */
  box-shadow: 0 4px 10px rgba(30, 35, 55, 0.08);

  /* 初始狀態：透明且稍微向下偏移 */
  opacity: 0;
  transform: translateY(20px);
  /* 動畫效果：針對透明度、位置和陰影設定過渡動畫 */
  transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow 0.3s ease;
}

.scene-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.scene-card img {
  width: 100%;
  height: auto;
  display: block;
}

.scene-card:hover {
  cursor: pointer;
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(30, 35, 55, 0.15);
}

/* Header 样式 - 固定在頂部 */
header {
  background-color: rgba(58, 74, 107, 0.8);
  /* 預設較淺的半透明效果 */
  backdrop-filter: blur(8px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}

/* Header 滾動後的更透明效果 */
header.scrolled {
  background-color: rgba(58, 74, 107, 0.2);
  /* 滾動後更透明 */
  backdrop-filter: blur(12px);
}

/* 桌面下拉項目 */
.dropdown-item {
  display: block;
  padding: 12px 16px;
}

.dropdown-item:hover {
  background: #f3f4f6;
}

/* Tailwind: bg-gray-100 */
/* 可點選的 TopNav active 狀態用到 .is-active（JS 會加） */
.nav-link.is-active {
  border-bottom-color: #ffffff;
  color: #ffffff;
}

/* 手機版側邊欄選單 */
.mobile-nav {
  position: fixed;
  top: 0;
  left: -100%;
  width: 280px;
  height: 100vh;
  background-color: #D1DBE8;
  z-index: 2000;
  transition: left 0.3s ease;
  overflow-y: auto;
}

.mobile-nav.active {
  left: 0;
}

.mobile-nav-content {
  padding: 20px;
  position: relative;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 0;
  color: #1E2337;
  font-size: 18px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}

.mobile-nav-item:hover {
  color: #6680B3;
}

/* 手機版側邊欄遮罩 */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1500;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-nav-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* 下拉選單樣式 */
.dropdown {
  z-index: 100;
  border-radius: 0;
  /* 移除圓角 */
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

/* 確保下拉選單從父容器底部開始，以利用 padding 創造的空間 */
.dropdown-container>.dropdown {
  top: 100%;
}

.dropdown:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  display: block;
  padding: 10px 16px;
  /* 縮小一點 */
  color: #1E2337;
  text-decoration: none;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 14px;
  /* 縮小字體 */
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background-color: var(--bg-secondary);
  color: #1E2337;
}

/* 導航連結樣式 */
.nav-link {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-size: inherit;
  position: relative;
}

/* 當下拉選單展開時，在選項下方顯示線條 - 從左至右動畫 */
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 100%;
  height: 2px;
  background-color: white;
  transition: right 0.3s ease;
}

.nav-link.active::after {
  right: 0;
}

/* 當下拉選單展開時，在選項下方顯示線條 */
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: white;
}

/* 聯絡我們下拉選單特殊樣式 */
#contact-menu {
  width: 200px;
  padding: 16px;
  background-color: white;
}

#contact-menu .contact-info {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#contact-menu .contact-info:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

#contact-menu .contact-label {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 4px;
}

#contact-menu .contact-value {
  font-size: 14px;
  color: #1E2337;
  font-weight: 500;
}

#contact-menu .qrcode {
  width: 100%;
  height: auto;
  margin-top: 8px;
}

/* 手機版子選單 */
.mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background-color: rgba(255, 255, 255, 0.1);
  margin-top: 8px;
  border-radius: 8px;
}

.mobile-submenu.active {
  max-height: 500px;
}

.mobile-submenu-item {
  display: block;
  padding: 10px 16px;
  color: #1E2337;
  text-decoration: none;
  font-size: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mobile-submenu-item:last-child {
  border-bottom: none;
}

.mobile-submenu-item:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Footer 样式 */
footer {
  background-color: #1E2337;
}

/* 社群浮动按钮 */
.social-float {
  background-color: white;
  box-shadow: 0 4px 12px rgba(30, 35, 55, 0.2);
  transition: transform 0.3s ease;
}

.social-float:hover {
  transform: scale(1.25);
}

/* 呼吸燈動畫 */
@keyframes scale-pulse {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 10px 20px -5px rgba(53, 75, 119, 0.5);
  }

  50% {
    transform: scale(1.1);
    box-shadow: 0 15px 25px -5px rgba(53, 75, 119, 0.6);
  }
}

.animate-scale-pulse {
  animation: scale-pulse 2s infinite ease-in-out;
}

.animate-scale-pulse:hover {
  animation: none;
  transform: scale(1.15);
  box-shadow: 0 15px 30px -5px rgba(53, 75, 119, 0.7);
}

/* 認證區塊 */
.cert-card {
  border: 1px solid rgba(148, 162, 191, 0.3);
}

/* 認證標章動畫效果 */
.cert-badge {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.4s ease, transform 0.3s ease;

}

.cert-badge.visible {
  opacity: 1;
  transform: translateX(0);
}

.cert-badge:hover {
  transform: translateY(-4px) scale(1.05);
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.15));
}

/* 錯開動畫時間 */
.cert-badge:nth-child(1) {
  transition-delay: 0.1s;
}

.cert-badge:nth-child(2) {
  transition-delay: 0.3s;
}




@keyframes lineShine {
  0% {
    left: -30%;
    opacity: 0;
  }

  5% {
    opacity: 0.5;
  }

  15% {
    opacity: 1;
  }

  85% {
    opacity: 1;
  }

  95% {
    opacity: 0.5;
  }

  100% {
    left: 100%;
    opacity: 0;
  }
}

/* Hero */
.hero-overlay {
  background: linear-gradient(to bottom, rgba(30, 35, 55, 0.6), rgba(30, 35, 55, 0.4));
}

/* Hero 標題動畫 */
.hero-title {
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.3s forwards;
}

.hero-description {
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.6s forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 頁面載入時的淡入動畫 */
@keyframes fadeInPage {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* 第二層選單 (子選單) 樣式 */
.submenu-container:hover>.submenu {
  display: block;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* 確保子選單在第一層選單旁邊，而不是下方 */
.submenu {
  top: -1px;
  /* 向上移動1px，使其與父項目頂部對齊 */
  left: calc(100% - 4px);
  /* 向左移動一點，確保滑鼠不會掉出選單區域 */
}

/* 圖片展示區 (Masonry Layout) */
.masonry-grid {
  column-count: 1;
  /* 手機上預設 1 欄 */
  column-gap: 1rem;
  /* 欄位間距 (16px) */
}

/* 在平板尺寸以上改為 2 欄 */
@media (min-width: 768px) {
  .masonry-grid {
    column-count: 2;
  }
}

.masonry-grid .grid-item {
  margin-bottom: 1rem;
  /* 圖片垂直間距 */
  display: inline-block;
  /* 確保元素是塊級元素，但能隨欄位流動 */
  width: 100%;
  break-inside: avoid;
  /* 防止圖片被切斷在兩欄之間 */
}

.masonry-grid .grid-item img {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  /* 圓角 (12px) */
  box-shadow: 0 4px 10px rgba(30, 35, 55, 0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.masonry-grid .grid-item img:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(30, 35, 55, 0.15);
}

/*首頁區塊動畫*/
/*第一區*/
/* 初始狀態：透明 + 位移 */
.fade-slide-left,
.fade-slide-right {
  opacity: 0;
  transition: all 0.9s ease;
}

.fade-slide-left {
  transform: translateX(-50px);
}

.fade-slide-right {
  transform: translateX(50px);
}

/* 觸發後加上 active */
.fade-slide-left.active,
.fade-slide-right.active {
  opacity: 1;
  transform: translateX(0);
}

/*第二區*/
/* 初始狀態：透明 + 下方位移 */
.fade-up {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1);
}

/* 啟動動畫（滑入畫面後） */
.fade-up.active {
  opacity: 1;
  transform: translateY(0);
}

/*第三區*/
/* 初始狀態：透明＋左右位移 */
.fade-left,
.fade-right {
  opacity: 0;
  transition: all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1);
}

.fade-left {
  transform: translateX(-60px);
}

.fade-right {
  transform: translateX(60px);
}

/* 啟動動畫 */
.fade-left.active,
.fade-right.active {
  opacity: 1;
  transform: translateX(0);
}

/*第四區*/
/* 淡入前狀態 */
.fade-down,
.fade-up {
  opacity: 0;
  transition: all 0.9s cubic-bezier(0.17, 0.55, 0.55, 1);
}

.fade-down {
  transform: translateY(-60px);
}

.fade-up {
  transform: translateY(60px);
}

/* 進入畫面後 */
.fade-down.active,
.fade-up.active {
  opacity: 1;
  transform: translateY(0);
}