@import url("./iso-header.css");
@import url("./iso-footer.css");

/* v12：首頁 Menu Bar 與 ISO 定稿 Footer 的全站共用外觀。 */
.site-header .nav-shell.container {
  width: min(1180px, 100%);
  max-width: 1180px;
}

.site-header .brand img {
  width: 58px !important;
  height: 44px !important;
  max-height: 44px !important;
  object-fit: contain !important;
}

.site-header .brand span {
  font-size: 1rem;
  line-height: 1.2;
}

.original-footer-home {
  display: inline-flex !important;
  align-items: center;
  gap: 12px;
}

.original-footer-logo {
  display: block;
  width: 52px;
  height: 36px;
  object-fit: contain;
  flex: 0 0 auto;
}

@media (max-width: 960px) {
  .site-header .nav-links[data-open="true"],
  .site-header .nav-links.open {
    display: flex;
  }
}

@media (max-width: 560px) {
  .site-header .brand img {
    width: 50px !important;
    height: 38px !important;
    max-height: 38px !important;
  }

  .site-header .brand span {
    font-size: .92rem;
  }

  .original-footer-logo {
    width: 46px;
    height: 32px;
  }
}

/* v13：共用 Footer 色彩以 ISO 定稿深藍版為唯一標準。 */
body.home-v3 .original-site-footer {
  border-top: 1px solid rgba(255, 255, 255, .14) !important;
  background: #102a3d !important;
  color: #d7e4e8 !important;
}

body.home-v3 .original-site-footer .original-footer-home,
body.home-v3 .original-site-footer .original-footer-main b,
body.home-v3 .original-site-footer .original-footer-main a,
body.home-v3 .original-site-footer .original-footer-brand p,
body.home-v3 .original-site-footer .original-footer-brand small,
body.home-v3 .original-site-footer .original-footer-bottom,
body.home-v3 .original-site-footer .original-footer-bottom a {
  color: inherit !important;
}

body.home-v3 .original-site-footer .original-footer-home {
  color: #fff !important;
}

body.home-v3 .original-site-footer .original-footer-main b {
  color: #80cbc7 !important;
}

body.home-v3 .original-site-footer .original-footer-main a {
  color: #dce8eb !important;
}

body.home-v3 .original-site-footer .original-footer-brand p,
body.home-v3 .original-site-footer .original-footer-brand small,
body.home-v3 .original-site-footer .original-footer-bottom,
body.home-v3 .original-site-footer .original-footer-bottom a {
  color: #a9c0c8 !important;
}

body.home-v3 .original-site-footer .original-footer-bottom {
  border-color: rgba(255, 255, 255, .14) !important;
}

/* v14：首頁結尾行動區採品牌藍色，和深藍 Footer 清楚分層。 */
body.home-v3 .closing {
  border-top: 1px solid rgba(255, 255, 255, .2);
  background:
    radial-gradient(circle at 82% 18%, rgba(145, 190, 223, .24), transparent 30%),
    linear-gradient(118deg, #214978 0%, #3f5f99 58%, #606ba5 100%) !important;
}

body.home-v3 .closing .section-kicker {
  color: #b9eee5;
}

body.home-v3 .closing .button-primary {
  border-color: rgba(255, 255, 255, .35);
  background: #f8fbff;
  color: #183c68;
}

body.home-v3 .closing .button-primary:hover,
body.home-v3 .closing .button-primary:focus-visible {
  background: #dff3ee;
  color: #173c49;
}

/* v14：首頁中央使用使用者提供的灰字「達美智創」LOGO。 */
body.home-v3 .journey-visual::after {
  background-image:
    url("../assets/damei-logo-zh-gray.webp"),
    radial-gradient(
      ellipse at center,
      rgba(255, 255, 255, .78) 0%,
      rgba(255, 255, 255, .58) 43%,
      rgba(255, 255, 255, .18) 63%,
      rgba(255, 255, 255, 0) 78%
    );
  background-position: 50% 40%, center;
  background-size: 94% auto, 94% 90%;
  background-repeat: no-repeat;
}

/* 培訓首頁課程入口：完整卡片皆可由鍵盤清楚辨識。 */
.tr8-feature-main-link {
  color: inherit;
  text-decoration: none;
}

.tr8-feature-main-link .tr8-feature-copy > span:last-child {
  display: inline-flex;
  align-items: center;
  margin-top: 24px;
  color: #245f9d;
  font-weight: 800;
}

.tr8-feature-main-link:focus-visible,
.tr8-feature-card:focus-visible,
.tr8-feed-card:focus-visible,
.tr8-course-card:focus-visible {
  outline: 3px solid #69c9c6;
  outline-offset: 5px;
}

/* v15：首頁中央 LOGO 再上移並縮小，保留「達」字完整下方筆畫。 */
body.home-v3 .journey-visual::after {
  background-position: 50% 31%, center;
  background-size: 88% auto, 94% 90%;
}

/* v15：首頁結尾 CTA 加深，至少維持參考圖二的藍紫飽和度。 */
body.home-v3 .closing {
  background:
    radial-gradient(circle at 82% 18%, rgba(150, 174, 224, .2), transparent 32%),
    linear-gradient(112deg, #173861 0%, #31588f 52%, #675f91 100%) !important;
}

/* v15：關於我們最下方行動章節改為淡霧綠至淡灰紫。 */
body.page-e7 .chapter-7 {
  background:
    radial-gradient(circle at 86% 25%, rgba(183, 163, 202, .24), transparent 34%),
    linear-gradient(112deg, #dcecea 0%, #e7edf0 48%, #e9e1ee 100%) !important;
  color: #17384b !important;
}

body.page-e7 .chapter-7 .chapter-grid p,
body.page-e7 .chapter-7 .chapter-grid .emphasis,
body.page-e7 .chapter-7 .chapter-grid blockquote:not(.closing-principle) p {
  color: #294b59 !important;
}

body.page-e7 .chapter-7 .chapter-grid cite {
  color: #58717c !important;
}

body.page-e7 .chapter-7 .closing-principle {
  background: linear-gradient(110deg, #d0e2e3 0%, #ddd8e8 100%) !important;
}

body.page-e7 .chapter-7 .closing-principle p {
  color: #18384d !important;
}

/* v15：全站 Footer 統一為圖八版本。 */
.original-site-footer {
  background: #102a3d !important;
  color: #d7e4e8 !important;
}

.original-site-footer .original-footer-main {
  width: min(1180px, calc(100% - 48px)) !important;
  grid-template-columns: 1.7fr 1fr 1fr !important;
  gap: 48px !important;
  padding: 38px 0 34px !important;
}

body .original-site-footer .original-footer-main .original-footer-home,
body.home-v3 .original-site-footer .original-footer-main .original-footer-home {
  color: #fff !important;
}

.original-site-footer .original-footer-brand small {
  color: #8bb9c2 !important;
}

.original-site-footer .original-footer-brand p {
  color: #b9cdd4 !important;
}

.original-site-footer .original-footer-main b {
  color: #80cbc7 !important;
}

.original-site-footer .original-footer-main a {
  color: #dce8eb !important;
}

.original-site-footer .original-footer-line {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  width: max-content !important;
  min-height: 38px !important;
  margin-top: 4px !important;
  padding: 7px 13px !important;
  border: 1px solid rgba(128, 203, 199, .46) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, .035) !important;
  color: #e8f1f2 !important;
  font-weight: 700 !important;
  transition: border-color .2s ease, background .2s ease, color .2s ease !important;
}

.original-site-footer .original-footer-line svg {
  width: 18px !important;
  height: 18px !important;
  fill: currentColor !important;
  color: #c5dadd !important;
  transition: color .2s ease !important;
}

.original-site-footer .original-footer-line:hover,
.original-site-footer .original-footer-line:focus-visible {
  border-color: #80cbc7 !important;
  background: rgba(128, 203, 199, .12) !important;
  color: #fff !important;
}

.original-site-footer .original-footer-line:hover svg,
.original-site-footer .original-footer-line:focus-visible svg {
  color: #06c755 !important;
}

.original-site-footer .original-footer-bottom {
  width: min(1180px, calc(100% - 48px)) !important;
  border-color: rgba(255, 255, 255, .14) !important;
  color: #9fb7c0 !important;
}

.original-site-footer .original-footer-bottom a {
  color: #b9cdd4 !important;
}

@media (max-width: 900px) {
  /* V15《修改意見 2》：課程子選單展開後由整頁自然捲動，不在卡片內另做卷軸。 */
  .course-sidebar__list {
    max-height: none !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
  }

  .original-site-footer .original-footer-main {
    grid-template-columns: 1fr 1fr !important;
    gap: 32px !important;
  }

  .original-site-footer .original-footer-brand {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 560px) {
  .original-site-footer .original-footer-main {
    width: 100% !important;
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    padding: 32px 20px !important;
  }

  .original-site-footer .original-footer-brand {
    grid-column: auto !important;
  }

  .original-site-footer .original-footer-bottom {
    width: 100% !important;
    padding: 16px 20px !important;
  }
}

/* V15 綜合修正：長頁面單元首頁的回到頂端按鈕。 */
.back-to-top {
  position: fixed;
  z-index: 95;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  width: 58px;
  height: 58px;
  place-content: center;
  gap: 1px;
  padding: 0;
  border: 1px solid rgba(128, 203, 199, .55);
  border-radius: 50%;
  background: rgba(16, 42, 61, .93);
  box-shadow: 0 12px 30px rgba(10, 31, 46, .26);
  color: #fff;
  font: 800 10px/1.15 "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  letter-spacing: .08em;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .22s ease, transform .22s ease, background .22s ease;
}

.back-to-top span { font-size: 20px; line-height: 1; }
.back-to-top b { font: inherit; }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top:hover,
.back-to-top:focus-visible { background: #2f7878; }
.back-to-top:focus-visible { outline: 3px solid #9de4df; outline-offset: 3px; }

@media (max-width: 560px) {
  .back-to-top {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 50px;
    height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top { transition: none; }
}

/* V19：避免固定式手機導覽列遮住指定工具頁的 Banner 小標題。 */
@media (max-width: 760px) {
  body.privacy-page .hero-copy,
  body.sitemap-page .hero-copy,
  body.diagnostic-page .hero-copy,
  body.contact-page .hero-copy {
    padding-top: 100px !important;
  }
}
