/* ===== Safe Area 基礎（iOS 瀏海） ===== */
:root {
  /* iOS 11 早期用 constant()，新版本用 env()；兩者都寫保險 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-top-legacy: constant(safe-area-inset-top, 0px);
  /* header 高度（Mobile First） */
  --header-h: 56px;
}

.safe-area-top {
  padding-top: calc(0.5rem + var(--safe-top)); /* 新版 */
  padding-top: calc(0.5rem + var(--safe-top-legacy)); /* 兼容舊版 */
}

/* 如果 header 要固定在頂部，讓 body 下移避免被蓋住 */
.fixed-top ~ main,
.fixed-top ~ section,
.fixed-top ~ div:is(#app, .page-wrap) {
  /* header 本身高度 + 安全區 */
  margin-top: calc(var(--header-h) + var(--safe-top));
  margin-top: calc(var(--header-h) + var(--safe-top-legacy));
}

/* ========== Header / Navbar（Mobile First） ========== */
.site-header {
  background: #fff;
  position: relative;
  z-index: 3000; /* 比 hero 大即可 */
}

.brand-logo {
  display: block;
  max-height: 44px;
  width: auto;
}

.bi-search,
.bi-share,
.bi-bag,
.bi-list {
  color: #000;
  line-height: 1;
}

/* Header Logo：手機維持 44px，高於 992px 放大 */
@media (min-width: 992px) {
  .brand-logo {
    max-height: 64px; /* 建議 56~72px 之間微調 */
  }
}

@media (min-width: 1400px) {
  .brand-logo {
    max-height: 88px;
  } /* 72 → 88px */
  .navbar .container {
    align-items: center;
  } /* 確保置中 */
}

/* 超大螢幕再放一點（可選） */
@media (min-width: 1920px) {
  .brand-logo {
    max-height: 96px;
  }
}

/* ========== Footer Base  ========== */

.footer {
  background: #fff;
  color: #2c2c2c;
  padding: clamp(28px, 5vw, 56px) 0 0;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}
/* Bootstrap container 在 footer 內不要被寫死寬 */
.footer .container {
  width: 100%;
  max-width: 1320px; /* 你站內桌機常用容器寬，視需要改 1200/1280/1400 */
  margin: 0 auto;
  padding-left: clamp(16px, 3vw, 40px);
  padding-right: clamp(16px, 3vw, 40px);
  box-sizing: border-box;
}
/* Logo */
.footer__brand img {
  width: clamp(150px, 32vw, 180px);
  height: auto;
  display: block;
}

/* 資訊區：行動 1 欄 → XL 起 4 欄 */
.footer__info {
  display: grid;
  grid-template-columns: 1fr; /* mobile 預設 1 欄 */
  gap: 24px;
  width: 100%;
  max-width: 100%;
}

/* >=992px (lg)：兩欄開始排 */
@media (min-width: 992px) {
  .footer__info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 32px;
  }
}

/* >=1200px (xl)：四欄，但用 minmax(0,1fr) 讓它會縮 */
@media (min-width: 1200px) {
  .footer__info {
    grid-template-columns: repeat(3, 1fr) auto;
    gap: 24px 24px;
  }
}

/* 每一欄內容允許換行，不會撐爆 */
.footer__block,
.footer__list,
.footer__text {
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 區塊標題與文字 */
.footer__heading {
  margin: 0 0 0.35rem;
  font-weight: 500;
  font-size: clamp(16px, 2.6vw, 18px);
  color: var(--text-secondary, #555);
  letter-spacing: 0.2px;
}
.footer__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer__list li {
  margin: 0.2rem 0;
  font-size: clamp(13px, 2.4vw, 14px);
  line-height: 1.8;
  color: var(--text-secondary, #555);
  letter-spacing: 0.2px;
}
.footer__text {
  margin: 0;
}
.footer__text a,
.footer__list a {
  font-size: clamp(13px, 2.3vw, 13.5px);
  color: var(--text-secondary, #555);
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) {
  .footer__text a:hover,
  .footer__list a:hover {
    text-decoration: underline;
  }
}

/* E-mail + 社群容器（小裝置置中、桌機左對齊） */
.footer__contact {
  margin-bottom: clamp(12px, 2vw, 24px); /* 手機約 12px，桌機約 20–24px */
}

.footer__contactwrap {
  text-align: center;
  min-width: 240px;
}

@media (min-width: 992px) {
  .footer__contactwrap {
    text-align: left;
  }
}

/* === 社群 icon 區塊：橫向排列 === */
.footer__socialblock {
  margin-top: clamp(12px, 2.5vw, 20px);
  margin-bottom: clamp(16px, 3vw, 28px);
  text-align: center;
}

.footer__social {
  display: flex;
  flex-wrap: wrap; /* 若空間不夠可自動換行 */
  flex-direction: row; /* 明確指定橫向排列 */
  justify-content: center; /* 手機與平板置中 */
  align-items: center;
  gap: clamp(8px, 1.4vw, 14px);
  padding: 0;
  margin: 0;
}

.footer__social li {
  display: inline-block;
}
@media (min-width: 992px) {
  .footer__social {
    justify-content: flex-start; /* 桌機靠左對齊（與 Email 對齊） */
    flex-wrap: nowrap; /* 桌機不換行，保持一列橫排 */
  }
}

/* 單一社群按鈕 */
.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f0f0f0;
  color: var(--text-secondary); /* 圖標顏色（Bootstrap Icons 走 color） */
  font-size: 1.25rem; /* <i class="bi ..."> 大小 */
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease,
    color 0.2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .social:hover {
    background: #2c295a;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  }
}

/* 版權列（滿版灰底） */
.footer__bottom {
  width: 100%;
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding: 12px 10px;
  margin-top: clamp(24px, 5vw, 48px);
}
.footer__copy {
  margin: 0;
  font-size: clamp(12px, 2.8vw, 13px);
  letter-spacing: 0.2px;
}

/* ===== 平板直式：置中左側整包資訊（但文字仍左對齊） ===== */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* Logo 置中 */
  .footer__brand {
    display: flex;
    justify-content: center;
  }

  /* 紅框那整包（logo + 三個公司資訊）給一個最大寬度並置中 */
  .footer__info {
    max-width: 620px; /* 你可微調 560~680 看視覺 */
    margin: 0 auto;
  }

  /* 每個 block 的文字維持左對齊 */
  .footer__block {
    text-align: center;
  }
}

@media (min-width: 992px) {
  .footer__top {
    display: grid;
    grid-template-columns: clamp(180px, 18vw, 240px) 1fr;
    column-gap: clamp(16px, 3vw, 32px);
    align-items: start;
  }

  /* 讓原本的 col 不再用 bootstrap 寬度 */
  .footer__top > [class*="col-"] {
    width: auto;
    max-width: none;
    flex: none;
  }
}

@media (min-width: 992px) {
  .footer__brand {
    display: flex;
    align-items: center; /* 垂直置中整體比例更好 */
    height: 100%;
  }
}

@media (min-width: 1200px) {
  .footer__info {
    column-gap: 32px;
  }
}
