/* 定義並載入本地字體 */
@font-face {
  font-family: 'Noto Sans TC';
  src: url('/common/fonts/NotoSansTC-Thin.ttf') format('truetype');
  font-weight: 100;
  font-style: normal;
}

/* 載入 LINE Seed JP (Web Font WOFF2 版本, Thin 細體) */
@font-face {
  font-family: 'Rubik';
  src: url(/common/fonts/Rubik-VariableFont_wght.ttf) format('truetype');
  font-weight: 500; 
  font-style: normal;
}

/* 讓整個頁面的錨點跳轉變成平滑滾動 */
html {
  scroll-behavior: smooth;
}

/* 基礎背景與字體設定 */
body {
  background-color: #3B0F6B;
  font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
  background-image: url('/common/images/bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.mobile-social-links {
  display: none;
}

.main-container {
  width: 100%; /* 將原本的 max-width: 1200px 移除，改為 100% */
  margin: 0 auto;
  overflow-x: clip; /* 關鍵：保留這個設定，它能順便幫我們防止 100vw 產生的水平卷軸 */
  min-height: 100vh;
  position: relative;
}

.custom-header {
  max-width: 1200px; /* 新增這行 */
  margin: 0 auto;    /* 新增這行 */
  height: 100px;
  z-index: 100;
}

/* 建立一個專屬的滿版背景層 */
.custom-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(50% - 50vw);
  width: 100vw;
  height: 100%;
  z-index: -1;
  
  /* 關鍵 1：不要用切出來的 100px 圖片，直接用原本的 body 大背景圖 */
  background-image: url('/common/images/bg.png');
  
  /* 關鍵 2：屬性必須跟 body 的背景設定完全一模一樣 */
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.header-left .btn {
  margin: 23px 16px 23px 23px;
  width: 54px;
}

.header-left .btn > img {
  width: 100%;
  /* 建議加上一點轉場時間，讓切換更順暢 (非必填) */
  transition: all 0.2s ease-in-out; 
}

/* Logo 間距設定 */
.brand-logo {
  padding: 10px 0;
  height: auto;
}

/* 右側精確定位 */
.header-right {
  padding-top: 27px;
  padding-right: 20px;
}

/* 社群圖示間距 */
.fb-icon {
  margin-right: 14px;
  height: 35px;
  padding: 6px;
  border-radius: 6px;
  transition: background-color 0.2s ease-in-out;
  box-sizing: content-box; /* 新增這行：讓 padding 往外長，圖片維持 35px */
}

.ig-icon {
  margin-right: 24px;
  height: 35px;
  padding: 6px;
  border-radius: 6px;
  transition: background-color 0.2s ease-in-out;
  box-sizing: content-box; /* 新增這行：讓 padding 往外長，圖片維持 35px */
}

.fb-icon:hover,
.ig-icon:hover,
#menuToggleBtn:hover {
  background-color: rgba(255, 255, 255, 0.2); 
  cursor: pointer;
}

#menuToggleBtn:hover {
  border-radius: 50%;
}

/* =========================================
   下拉選單按鈕 (白底黑字 + 自訂倒三角)
   ========================================= */
.custom-lang-btn {
  width: 90px;
  height: 23px;
  background-color: #FFFFFF;
  border: 1px solid #FFFFFF;
  border-radius: 4px;
  color: #000000;
  
  /* 右側保留 20px 給箭頭，防止文字蓋到箭頭 */
  padding: 0 20px 0 5px !important; 
  
  font-family: "PingFang TC";
  font-weight: 400;
  font-size: 12px;
  line-height: 100%;
  letter-spacing: 0.21px;
  margin-top: 12px;
  
  display: flex;
  align-items: center;
  justify-content: flex-start;
  
  /* 自訂黑色倒三角形 SVG */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  background-size: 12px;
}

/* =========================================
   展開後的選單外框與選項 (白底黑字)
   ========================================= */
.custom-dropdown-menu {
  background-color: #FFFFFF;
  border-radius: 4px;
  min-width: 90px;
  padding: 0;
  margin-top: 5px !important; /* 往下推 5px 避免蓋到按鈕 */
  border: 1px solid #FFFFFF;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
}

.custom-dropdown-menu .dropdown-item {
  font-family: "PingFang TC";
  font-size: 12px;
  color: #000000;
  padding: 8px 10px; /* 這裡可以自由調整選項的留白 */
  transition: background 0.2s;
}

.custom-dropdown-menu .dropdown-item:hover,
.custom-dropdown-menu .dropdown-item:focus {
  background-color: rgba(0, 0, 0, 0.08); /* 微微透明的灰底 */
  color: #3B0F6B;
}

/* 強制讓「選單選項」在點擊瞬間 (:active) 也維持透明灰底 */
.custom-dropdown-menu .dropdown-item:active {
  background-color: rgba(0, 0, 0, 0.08) !important;
  color: #000000 !important;
}

/* =========================================
   覆蓋 Bootstrap 預設的點擊與聚焦變色
   ========================================= */

/* 覆蓋 Bootstrap 預設設定，改為「內部變色」與「內陰影」 */
.custom-lang-btn:hover,
.custom-lang-btn:focus,
.custom-lang-btn:active,
.show > .btn.custom-lang-btn {
  background-color: #FFDC00 !important;
  color: #000000 !important;
  border-color: #FFDC00 !important;
  box-shadow: none !important;
}

/* 隱藏 Bootstrap 預設的下拉箭頭 */
.custom-lang-btn::after {
  display: none;
}

/* 強制讓「選單選項」在點擊瞬間 (:active) 不會變成預設的藍底白字 */
.custom-dropdown-menu .dropdown-item:active {
  background-color: #F5F5F5 !important; /* 點擊時維持與 hover 一樣的淺灰底 (或你想全白可改為 #FFFFFF) */
  color: #000000 !important;            /* 點擊時維持黑字 */
}

/* 側邊浮動選單自訂樣式 */
.custom-side-menu {
  position: fixed; /* 從 absolute 改為 fixed，讓選單不會因為往下滑而跑到上面 */
  top: 100px; /* 避開 100px 高度的 Header，若您希望它貼齊螢幕最上方，可改為 0 */
  
  /* 動態計算：永遠貼齊置中 1200px 區塊的左側，當螢幕小於 1200px 時會維持在 0 */
  left: max(0px, calc(50% - 600px)); 
  
  width: 19%; 
  max-width: 228px; /* 限制最大寬度為 228px (1200 * 19%)，避免大螢幕時選單無限變寬 */
  height: 700px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: #0D0B1C;
  border-radius: 0 12px 12px 0;
  z-index: 90;
  box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.5);
  
  /* 💡 關鍵 1：封印滑動穿透！讓滑動事件絕對不會傳遞給後方的網頁 */
  overscroll-behavior: contain; 
    
  /* 💡 關鍵 2：讓 iOS (iPhone/iPad) 設備上的觸控滑動更平滑順暢 */
  -webkit-overflow-scrolling: touch;
  /* 向右裁切隱藏，保留負值是為了不切到陰影 */
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.4s ease-in-out;
}

.custom-side-menu::-webkit-scrollbar {
  width: 6px; /* 捲軸變細 */
}

.custom-side-menu::-webkit-scrollbar-track {
  background: transparent; /* 軌道背景透明 */
}

.custom-side-menu::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2); /* 捲軸本體使用半透明白 */
  border-radius: 10px; /* 加上圓角 */
}

.custom-side-menu::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.4); /* 游標滑過時稍微變亮 */
}
.custom-side-menu.show-menu {
  clip-path: inset(-30px -30px -30px -30px);
}

.custom-menu-list {
  padding-top: 30px;
  padding-bottom: 16px; 
}

.menu-item {
  font-family: "Noto Sans TC", sans-serif;
  font-weight: 100;
  font-size: 18px;
  line-height: 100%;
  letter-spacing: 0.3px;
  margin-bottom: 25px;
  padding: 0 18px 0 20px;
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.3s;
}

.menu-item:last-child {
  margin-bottom: 0;
}

.menu-item:hover,
.active-item {
  color: #FFDC00;
}

/* ===== 主內容外框 ===== */
.main-content-area {
  position: relative; 
  padding-top: 40px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ===== 單一功能區塊 ===== */
.feature-block {
  display: flex;
  align-items: flex-start; /* 關鍵：改為靠上對齊，讓文字和圖片能各自控制高度 */
  justify-content: space-between;
  margin-bottom: 120px;
}

/* ===== KaraDoReMi™ 專屬標題樣式 ===== */
.feature-block .text-box h1.brand-title,
.feature-block .text-box h2.brand-title {
  font-family: "Rubik";
  font-weight: 700;
  font-size: 45px;
  line-height: 72px;
  letter-spacing: 0px;
  color: #FFFFFF;
  margin-top: 0;
  margin-bottom: 0;
}

.feature-block .text-box .app-download-area {
  display: flex;
  align-items: center; /* 讓內部的 QR Code 與 iOS 圖片垂直置中對齊 */
  margin-top: 43px;    /* 距離上方的 <p> 43px */
}

.feature-block .text-box .app-download-area .qr-code {
  width: 115px;
  height: 115px;
  margin-right: 30px;  /* 距離右邊的 ios_app.png 30px */
}

.feature-block .text-box .app-download-area .ios-app-link {
  display: block; /* 讓 a 標籤變成區塊元素，避免產生多餘的下劃線或高度誤差 */
}

.feature-block .text-box .app-download-area .ios-app {
  width: 170.27px;
  height: 63px;
}

.feature-block .image-box img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

/* ===== 產品功能區塊 高度與間距設定 ===== */

/* 第 1, 2, 4, 5, 7 區塊 */
.feature-block.section-normal {
  height: auto;
  margin-bottom: 100px;
}

/* 第 8 區塊 (不要 margin-bottom) */
.feature-block.section-last {
  height: auto;
  margin-bottom: 0;
}

/* 修改原有的 .section-bg-1 與 .section-bg-2，移除裡面的背景設定 */
.feature-block.section-bg-1,
.feature-block.section-bg-2 {
  position: relative; /* 定位基準 */
  background-image: none !important; /* 移除原本掛在身上的圖片 */
}

/* 建立共用的滿版背景虛擬元素 */
.feature-block.section-bg-1::before,
.feature-block.section-bg-2::before {
  content: "";
  position: absolute;
  top: 0;
  /* 突破容器技巧：將背景起點往左推到螢幕邊緣，然後設定寬度為螢幕全寬 */
  left: calc(50% - 50vw);
  width: 100vw;
  height: 100%;
  z-index: -1; /* 確保背景圖墊在文字與主圖片的後方 */
  background-size: cover;
  background-position: center;
}

/* 重新個別指定要載入的背景圖片 */
.feature-block.section-bg-1::before {
  background-image: url('/common/images/product_bg-01.png');
}

.feature-block.section-bg-2::before {
  background-image: url('/common/images/product_bg-02.png');
}

.feature-block.section-bg-2 {
  height: 752px;
  margin-bottom: 54px;
}

/* 1. 取消固定高度，改為彈性高度與 Flex 對齊 */
.feature-block.section-bg-1 {
  height: auto !important;
  padding-top: 80px;  /* 上方保留呼吸空間 */
  padding-bottom: 0;  /* 底部空間歸零，交給圖片去撐開 */
  display: flex;
  align-items: center; 
  margin-bottom: 50px; /* 統一設定區塊與區塊之間的間距 */
}

/* 2. 背景圖對齊最下方，確保陰影永遠緊貼著螢幕最底部 */
.feature-block.section-bg-1::before{
  background-position: center bottom !important; 
}

/* 3. 讓圖片往下貼齊，並動態推開陰影的高度 */
.feature-block.section-bg-1 .image-box {
  align-self: flex-end !important; /* 強制圖片區塊貼齊底部 */
  
  /* 使用 vw 來對應滿版背景圖 (100vw) 的縮放比例！
     假設背景圖原寬 1200px，陰影 55px -> 55 / 1200 = 0.0458 (約 4.6vw)
     如果你的背景圖原寬是 1920px -> 55 / 1920 = 0.0286 (約 2.9vw)
     你可以稍微調整這個 vw 數值，直到圖片剛好完美踩在線上為止。
  */
  margin-bottom: 4.6vw !important; 
}

.feature-block.section-bg-1 .text-box {
  position: relative;
  top: -20px; /* 往上提 20px，可視需求自行微調數字 */
}

/* ===== 反轉區塊 (左圖片、右文字) ===== */
.feature-block.reverse {
  flex-direction: row-reverse;
}

.feature-block.reverse .text-box {
  margin-left: 0;
  margin-right: 6.25%;    /* 反轉後，文字變成離右邊 6.25% */
}

.feature-block.reverse .image-box {
  margin-right: 0;
  margin-left: 6.25%;     /* 反轉後，圖片變成離左邊 6.25% */
  text-align: left;
}

/* ===== 說明文字樣式 ===== */
.feature-block .text-box p {
  font-family: "Noto Sans TC";
  font-weight: 100;
  color: #FFFFFF;
  font-size: 22px;
  line-height: 32px;
  letter-spacing: 0.39px;
  margin-top: 20px;
}

/* ===== 覆蓋第二個區塊之後的文字樣式 ===== */
/* 標題 brand-title 樣式 */
.feature-block:not(:first-of-type) .text-box h2.brand-title {
  font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-weight: 500;
  font-size: 38px;
  line-height: 45px;
  letter-spacing: 0px;
}

.feature-block:not(:first-of-type) .text-box ul {
  margin-top: 20px;
}

.feature-block:not(:first-of-type) .text-box p,
.feature-block:not(:first-of-type) .text-box ul li {
  font-family: "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-weight: 300;
  font-size: 16px;
  line-height: 25px;
  letter-spacing: 0px;
  color: #FFFFFF;
}

/* 特別針對第一區塊設定寬度與左距 */
.feature-block:nth-of-type(1) .text-box {
  margin-left: 10%;
  width: 29.25%;          /* 以 1200px 計算的寬度比例 */
  margin-top: 200px;      /* 配合外層 40px，精準達成距離 header 240px 的需求 */
}

/* ===== 右側圖片區塊 ===== */
.feature-block:nth-of-type(1) .image-box {
  width: 40%;             /* 以 1200px 計算的寬度比例 */
  margin-right: 10%;    /* 扣除外層 3.75%，補足剩下的 6.25% */
  text-align: right;      /* 圖片靠右對齊 */
}

.feature-block:nth-of-type(2) .text-box,
.feature-block:nth-of-type(6) .text-box,
.feature-block:nth-of-type(8) .text-box {
  width: 41.5%;
  margin-left: 5.83%;
  margin-top: 100px;
}

.feature-block:nth-of-type(2) .image-box,
.feature-block:nth-of-type(6) .image-box,
.feature-block:nth-of-type(8) .image-box {
  width: 46%;
  margin-right: 3.75%;
  text-align: right;
}

.feature-block:nth-of-type(3) .text-box,
.feature-block:nth-of-type(5) .text-box,
.feature-block:nth-of-type(9) .text-box {
  width: 41.5%;
  margin-right: 5.83%;
  margin-top: 100px;
}

.feature-block:nth-of-type(3) .image-box,
.feature-block:nth-of-type(5) .image-box,
.feature-block:nth-of-type(9) .image-box {
  width: 46%;
  margin-left: 3.75%;
}

.feature-block:nth-of-type(4) .text-box {
  width: 41.5%;
  margin-left: 5.83%;
}

.feature-block:nth-of-type(4) .image-box {
  width: 46%;
  margin-left: 3.75%;
  text-align: right;
  margin-top: 24px;
}

/* ===== 第 7 區塊改為上下排列 ===== */
.feature-block:nth-of-type(7) {
  flex-direction: column;      /* 將主軸改為垂直，變成上下排列 */
  align-items: center;         /* 讓區塊內的元素水平置中 */
  justify-content: center;     /* 讓區塊內的元素垂直置中 */
}

.feature-block:nth-of-type(7) .text-box {
  width: 60%;                 /* 讓文字區塊寬度佔滿（或依需求改為 80% 等） */
  margin: 40px 0 0 0;          /* 清除左右 margin，並在下方加上 40px 間距與圖片隔開 */
  text-align: center;          /* 如果希望文字也置中，可保留此行；若要靠左請改為 left */
  top: 0;
  position: absolute;
}

.feature-block:nth-of-type(7) .text-box p {
  margin-bottom: 0px;
}

.feature-block:nth-of-type(7) .image-box {
  width: 72.16%;                 /* 讓圖片區塊寬度佔滿 */
  margin: 0 0;                   /* 清除可能繼承的 margin */
  text-align: center;          /* 確保圖片在區塊內置中 */
  position: absolute;
  bottom: 55px;
}

.custom-footer {
  background-color: #0E0532;
  width: 100%;
  /* 設定高度以便讓內容可以完美的垂直置中，可依實際視覺需求微調 */
  height: 80px; 
  display: flex;
  justify-content: center;
}

.custom-footer-content {
  width: 1200px;
  max-width: 100%;
  display: flex;
  align-items: center;
  /* 離 1200 的左邊 50px */
  padding-left: 50px; 
}

.footer-copyright-text {
  font-family: 'PingFang TC', sans-serif;
  font-weight: 400;
  font-size: 14px;
  leading-trim: none;
  line-height: 14px;
  letter-spacing: 0px;
  color: #FFFFFF;
  /* 離右邊「隱私權政策」的隱字 70px */
  margin-right: 70px; 
}

.footer-legal-link {
  font-family: 'PingFang TC', sans-serif;
  font-weight: 400;
  font-size: 14px;
  leading-trim: none;
  line-height: 14px;
  letter-spacing: 0px;
  color: #FFFFFF;
  text-decoration: none;
}

.footer-legal-link:hover {
  color: #CCCCCC;
  text-decoration: underline;
}

.footer-divider {
  font-size: 14px;
  color: #FFFFFF;
  /* 隱私權政策與使用條款中間的線，左右各有 20px 間距 */
  margin-left: 20px;
  margin-right: 20px;
}

/* Sidebar 選項的基本樣式與 active 樣式 */
.sidebar-link {
  display: block;
  padding: 10px;
  color: #333;
  text-decoration: none;
}

.sidebar-link.active-item {
  color: #fff;
  background-color: #FFDC00; /* 加上你想要的 active 顏色 */
  font-weight: bold;
}

/* =========================================
   英文版專屬樣式 (English Version Styles)
   ========================================= */

/* 解除第 3 區塊的固定高度，避免文字變窄折行時撞到下方區塊 */
.lang-en .feature-block:nth-of-type(3) {
  height: auto !important; /* 取消 497px 的限制，讓內容自動撐開高度 */
  margin-bottom: 100px;    /* 確保底部永遠與第 4 區塊維持 100px 的距離 */
}

/* 確保裡面的元素在高度變成 auto 後，依然能對齊上方 */
.lang-en .feature-block:nth-of-type(3) .text-box {
  margin-top: 30px;
}

.lang-en .feature-block:nth-of-type(3) .text-box,
.lang-en .feature-block:nth-of-type(3) .image-box {
  padding-bottom: 20px; /* 給底部留一點呼吸空間，可依視覺需求微調 */
}

/* =========================================
   針對英文版第 7 區塊的間距與排版調整
   ========================================= */
   
.lang-en .feature-block:nth-of-type(7) {
  height: auto !important; /* 釋放固定高度，讓內容自然撐開 */
  padding-top: 40px;       /* 補回原本 text-box 頂部的空間 */
  padding-bottom: 55px;    /* 補回原本 image-box 底部的空間 */
}

.lang-en .feature-block:nth-of-type(7) .text-box {
  position: relative;      /* 取消絕對定位，恢復自然文檔流 */
  top: auto;               /* 清除 top 設定 */
  margin: 0 0 15px 0;      /* 精準設定與下方 image-box 保持 15px 的距離 */
  width: 85%;
}

.lang-en .feature-block:nth-of-type(7) .image-box {
  position: relative;      /* 取消絕對定位 */
  bottom: auto;            /* 清除 bottom 設定 */
}

.feature-block:not(:first-of-type) {
  scroll-margin-top: 100px;
}