/**
 * 信用卡跑馬燈專用樣式
 * 模組化設計，獨立於其他樣式
 */

/* ==================== 主容器 ==================== */

/* 信用卡跑馬燈 - 滿版設計 */
.special-offers .credit-card-marquee {
  width: 100vw;
  min-height: 540px; /* 增加高度以容納調整後的雙行跑馬燈 (250px * 2 + 40px 邊距) */
  overflow-x: hidden; /* 只隱藏橫向溢出，保留垂直空間 */
  overflow-y: visible; /* 允許直式卡片在垂直方向突破 */
  /* 使用負邊距讓跑馬燈突破父層限制，實現滿版效果 */
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  position: relative;
  background: transparent;
}

/* ==================== 軌道容器 ==================== */

.special-offers .marquee-row {
  display: flex;
  width: 100%;
  height: 180px; /* 桌面版：增加高度以容納完整的直式卡片 (210px + 16px padding + 24px 緩衝) */
  margin: 15px 0; /* 增加上下邊距，為hover放大提供更多空間 */
  overflow-x: hidden; /* 只隱藏橫向溢出，保持跑馬燈效果 */
  overflow-y: visible; /* 允許直式卡片在垂直方向突破軌道高度 */
}

/* 上方跑馬燈特殊樣式 */
.special-offers .marquee-row.marquee-upper {
  /* 上方軌道樣式，向左滑動 */
}

/* 下方跑馬燈特殊樣式 */
.special-offers .marquee-row.marquee-lower {
  /* 下方軌道樣式，向右滑動 */
}

.special-offers .marquee-track {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.special-offers .marquee-content {
  display: flex;
  align-items: center;
  gap: 20px;
  /* 60fps動畫硬體加速優化 - 符合CLAUDE.md技術要求 */
  will-change: transform;
  -webkit-transform: translateZ(0);
  -moz-transform: translateZ(0);
  -ms-transform: translateZ(0);
  -o-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  /* JavaScript requestAnimationFrame控制動畫 */
  animation: none; /* 確保沒有CSS動畫干擾 */
  /* 防止初始化時的閃動 */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 動畫準備就緒後的狀態 */
.special-offers .marquee-content.ready {
  opacity: 1;
  visibility: visible;
}

/* ==================== 動畫方向 ==================== */
/* JavaScript控制動畫方向，不需要CSS動畫類別 */

/* ==================== 互動效果 ==================== */
/* hover效果由JavaScript處理 */

.special-offers .card-link {
  display: block;
  transition: transform 0.3s ease;
  flex-shrink: 0; /* 防止卡片被壓縮 */
}

.special-offers .card-link:hover {
  transform: scale(1.1);
}

/* 直式卡片的容器調整 */
.special-offers .card-link:has(.card-image-marquee.portrait) {
  margin-left: -27.5px;
  margin-right: -27.5px;
  padding: 20px 0; /* 增加上下padding，為hover放大提供緩衝空間 */
}

/* ==================== 卡片樣式 ==================== */

/* 橫式卡片 (landscape) - 基礎樣式 */
.special-offers .card-image-marquee {
  object-fit: contain;
  background: transparent;
  padding: 0;
  box-shadow: none;
  display: block;
  transition: transform 0.3s ease;
  /* 橫式卡片尺寸 */
  width: 150px;
  height: 95px;
}



/* ==================== 動畫定義 ==================== */
/* 使用JavaScript requestAnimationFrame控制動畫，移除CSS keyframes */

/* ==================== 響應式設計 ==================== */

/* 平板版 (≤768px) */
@media (max-width: 768px) {
  /* 響應式跑馬燈 */
  .special-offers .marquee-row {
    height: 140px; /* 平板版：增加高度以容納完整的直式卡片 (120px * 1.4 + 16px padding + 20px 緩衝) */
    margin: 15px 0; /* 增加邊距為hover放大提供空間 */
  }
  
  /* 平板版橫式卡片 */
  .special-offers .card-image-marquee {
    width: 120px;
    height: 75px;
  }
  

  /* 平板版直式卡片容器調整 */
  .special-offers .card-link:has(.card-image-marquee.portrait) {
    margin-left: -22.5px;
    margin-right: -22.5px;
    padding: 15px 0; /* 增加上下padding，為hover放大提供緩衝空間 */
  }
  
  .special-offers .credit-card-marquee {
    
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    /* 確保外層容器也有足夠空間 */
  }
}



/* 手機版 (≤480px) */
@media (max-width: 480px) {
  /* 小螢幕跑馬燈 */
  .special-offers .marquee-row {
    height: 120px; /* 手機版：增加高度以容納完整的直式卡片 (100px * 1.4 + 16px padding + 16px 緩衝) */
    margin: 10px 0; /* 增加邊距為hover放大提供空間 */
  }
  
  /* 手機版橫式卡片 */
  .special-offers .card-image-marquee {
    width: 100px;
    height: 63px;
  }
  
  /* 手機版直式卡片容器調整 */
  .special-offers .card-link:has(.card-image-marquee.portrait) {
    margin-left: -18.5px;
    margin-right: -18.5px;
    padding: 12px 0; /* 增加上下padding，為hover放大提供緩衝空間 */
  }
  
  .special-offers .credit-card-marquee {
    
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    /* 確保外層容器也有足夠空間 */
  }
  
  .special-offers .marquee-content {
    gap: 15px;
  }
}

/* ==================== 載入狀態 ==================== */

/* 載入中的樣式 */
.special-offers .credit-card-marquee.loading {
  opacity: 0.7;
  min-height: 200px;
  position: relative;
}

.special-offers .credit-card-marquee.loading::after {
  content: '載入中...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #FFFFFF;
  font-size: 18px;
  font-weight: bold;
  z-index: 10;
}

/* 錯誤狀態的樣式 */
.special-offers .credit-card-marquee.error::after {
  content: '載入失敗，請重新整理頁面';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #FF6B6B;
  font-size: 16px;
  text-align: center;
}