* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background-color: #ffffff;
  overflow-x: hidden;
}

/* 主要 Hero 區塊容器 */
.hero-section {
  position: relative;
  width: 100%;

  background-image: url("../images/purple-wave-top-right-bg.png");
  background-repeat: no-repeat;

  /* 初始位置：頂部往上拉 -15px（預留往下移動的安全緩衝區），靠右對齊 */
  background-position: right -15px;
  background-size: 70% auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 50px;

  /* 套用右上波浪呼吸動畫 */
  animation: purpleWaveBreath 4s ease-in-out infinite alternate;
  will-change: background-position;
}

/* -----------------------------------
   超大螢幕 (2000px 以上) 樣式微調
----------------------------------- */
@media (min-width: 2000px) {
  .hero-section {
    background-size: 55% auto;
  }
}

/* -----------------------------------
   右上紫色波浪呼吸動畫
----------------------------------- */
@keyframes purpleWaveBreath {
  0% {
    /* 最高點：距離頂部 -15px */
    background-position: right -15px;
  }
  100% {
    /* 最低點：往下移動 15px 到達 right 0px（正好貼齊頂部，絕不露出白邊） */
    background-position: right 0px;
  }
}

/* 頂端導覽列 */
.navbar {
  width: 100%;
  max-width: 1200px;
  padding: 20px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.navbar .logo img {
  height: 60px;
  width: auto;
  display: block;
}

.navbar .share-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.navbar .share-btn:hover {
  opacity: 0.7;
}

.navbar .share-btn svg {
  width: 35px;
  height: 35px;
  stroke: #fff;
}

/* 主要 Banner 區塊*/
.banner-container {
  width: 100%;
  max-width: 1200px;
  padding: 20px 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5;
}

.banner-container img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  animation: heroFadeInUp 1s ease-out forwards;
  /* 效能最佳化，避免首屏動畫卡頓 */
  will-change: transform, opacity;
}

@keyframes heroFadeInUp {
  0% {
    opacity: 0;
    transform: translateY(-35px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 響應式調整 */
@media (max-width: 768px) {
  .navbar {
    padding: 15px 20px;
  }

  .navbar .logo img {
    height: 40px;
  }

  .banner-container {
    padding: 10px;
  }
  .hero-section {
    margin-bottom: 30px;
  }
}

/* YouTube 影片區塊容器 */
.video-section {
  position: relative;
  width: 100%;
  padding: 60px 20px 80px;
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.video-section .container {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  z-index: 2;
  text-align: center;
}

/* 標題區域 */
.section-header {
  margin-bottom: 30px;
}

.section-header .main-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #222222;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.section-header .sub-title {
  font-size: 1.25rem;
  color: #444444;
  letter-spacing: 0.5px;
  font-weight: 400;
}

/* 響應式 16:9 影片外框 */
.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 比例 */
  height: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* RWD 行動裝置微調 */
@media (max-width: 768px) {
  .video-section {
    padding: 40px 16px 60px;
  }

  .section-header .main-title {
    font-size: 1.58rem;
    line-height: 1.4;
  }

  .section-header .sub-title {
    font-size: 1.1rem;
    line-height: 1.5;
  }
}

/* 技能課程連結區塊容器 */
.skill-links-section {
  width: 100%;
  padding: 0px 20px 40px 20px;
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  overflow: hidden; /* 防止滑入前的水平偏移超出畫面產生橫向滾動條 */
}

.skill-links-section .container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

/* Flexbox 並列網格 */
.skill-links-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px; /* 兩按鈕間距 */
  width: 100%;
}

/* -----------------------------------
   連結項：初始隱藏與進場動畫設定
----------------------------------- */
.skill-link-item {
  display: block;
  flex: 1;
  max-width: 420px; /* 限制單個按鈕的最大寬度 */

  /* 初始狀態：全透明 */
  opacity: 0;

  /* 動畫過渡時間 */
  transition:
    transform 1s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 1s ease;
  will-change: transform, opacity;
}

/* 左側圖片：初始往左偏移 -60px */
.skill-link-item:first-child {
  transform: translateX(-60px);
}

.skill-link-item:first-child img {
  width: 80%; /* 將左側圖片獨立縮小至 88% (可依實際視覺效果微調如 85% ~ 90%) */
}

/* 右側圖片：初始往右偏移 60px */
.skill-link-item:last-child {
  transform: translateX(60px);
}

/* -----------------------------------
   進入視窗時 (.in-view) 歸位與淡入
----------------------------------- */
.skill-links-section.in-view .skill-link-item {
  opacity: 1;
  transform: translateX(0);
}

/* -----------------------------------
   圖片與 Hover 動畫 (完整保留原效果)
----------------------------------- */
.skill-link-item img {
  width: 95%;
  height: auto;
  display: block;
  object-fit: contain;
  margin: 0 auto;
  /* Hover 過渡設定 */
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

/* 滑鼠懸停微幅放大上浮 */
.skill-link-item:hover img {
  transform: translateY(-5px) scale(1.02);
  opacity: 0.95;
}

/* RWD 響應式：手機版維持並列或依據螢幕適當縮放 */
@media (max-width: 768px) {
  .skill-links-section {
    padding: 0px 5px 20px 5px;
  }

  .skill-links-grid {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  /* 2. 限制手機版卡片最大寬度，避免圖片太大 */
  .skill-link-item {
    width: 100%;
    max-width: 280px; /* 可依視覺調整，如 260px ~ 300px */
  }
  .skill-link-item:first-child img {
    width: 90%;
  }
}

/* ========================================== */

/* 區塊容器 */
.category-carousel-section {
  width: 100%;
  padding: 60px 20px;
  display: flex;
  justify-content: center;
}

.category-carousel-section .container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

/* -----------------------------------
   桌機版 Grid 定位：3 - 2 - 2 - 3 排列
----------------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas:
    "catering online  senior"
    "art      title   music"
    "teacher  title   license"
    "fortune  fashion language";
  gap: 16px;
  align-items: center;
}

/* 指定各元件對應的區域 */
#card-catering {
  grid-area: catering;
}
#card-online {
  grid-area: online;
}
#card-senior {
  grid-area: senior;
}
#card-art {
  grid-area: art;
}
#card-music {
  grid-area: music;
}
#card-teacher {
  grid-area: teacher;
}
#card-license {
  grid-area: license;
}
#card-fortune {
  grid-area: fortune;
}
#card-fashion {
  grid-area: fashion;
}
#card-language {
  grid-area: language;
}

.desktop-center-title {
  grid-area: title;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  opacity: 0;
  transform: scale(0.8);
}

/* -----------------------------------
   桌機與手機版中央標題：初始與彈出進場設定
----------------------------------- */
.desktop-center-title,
.mobile-title {
  opacity: 0;
  transform: scale(0.5);
  transition:
    transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.8s ease-out;
  will-change: transform, opacity;
}

/* 標題自己拿到 .in-view 時觸發 */
.desktop-center-title.in-view,
.mobile-title.in-view {
  opacity: 1;
  transform: scale(1);
}

/* 進入視窗時 (.in-view) 觸發彈出動畫 */
.category-carousel-section.in-view .desktop-center-title,
.category-carousel-section.in-view .mobile-title,
.skill-links-section.in-view .desktop-center-title,
.skill-links-section.in-view .mobile-title {
  opacity: 1;
  transform: scale(1);
}

.mobile-title img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* 預設隱藏手機版標題 */
.mobile-title {
  display: none;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 30px;
  text-align: center;
}

.desktop-center-title img {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
}

/* 小方塊卡片樣式 */
a.category-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: #ffffff;
  border-radius: 55px;
  padding: 16px 12px;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 250px;
  cursor: pointer;
  transition:
    background-color 0.4s ease,
    transform 0.3s ease,
    box-shadow 0.3s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* Hover 互動效果 */
a.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

/* 圖示雙圖切換機制 */
.icon-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 8px;
}

.icon-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.4s ease;
}

.icon-wrapper .icon-black {
  opacity: 1;
}
.icon-wrapper .icon-white {
  opacity: 0;
}

.card-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ff00ff;
  margin: 0;
  transition: color 0.4s ease;
}

/* 亮燈選中狀態 (.active) */
.category-card.active {
  background-color: #ff00ff;
}

.category-card.active .card-title {
  color: #ffffff;
}

.category-card.active .icon-wrapper .icon-black {
  opacity: 0;
}
.category-card.active .icon-wrapper .icon-white {
  opacity: 1;
}

/* -----------------------------------
   RWD 手機版 (<= 768px)：改為 2 欄並列
----------------------------------- */

@media (max-width: 768px) {
  .mobile-title {
    display: block;
  }

  .mobile-title img {
    width: 65%;
    margin: 0 auto;
  }

  .desktop-center-title {
    display: none;
  }

  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-areas: none; /* 重置網格區域，恢復標準流式排列 */
    gap: 16px;
  }

  /* 取消 grid-area 屬性影響 */
  .category-card {
    grid-area: auto !important;
    border-radius: 20px;
    padding: 12px 8px;
    /* 手機版同樣保持正方形 */
    aspect-ratio: 1 / 1;
  }

  .icon-wrapper {
    width: 100px;
    height: 100px;
    margin-bottom: 6px;
  }

  .card-title {
    font-size: 1.25rem;
  }
}

/* =========================================== */
/* 區塊背景與基本佈局 */
.info-social-section {
  width: 100%;
  padding: 50px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.info-social-section .container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

/* -----------------------------------
   2. 區塊進場動畫（例如左側滑入）
----------------------------------- */
.info-social-section .info-left {
  opacity: 0;
  transform: translateX(-60px);
  transition:
    transform 0.8s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.8s ease;
  will-change: transform, opacity;
}

/* 區塊拿到 .in-view 時觸發內部的圖文滑入 */
.info-social-section.in-view .info-left {
  opacity: 1;
  transform: translateX(0);
}

/* 左欄：容器樣式 */
.info-left {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  /* 初始狀態：全透明 + 往左偏移 60px */
  opacity: 0;
  transform: translateX(-60px);

  /* 動態過渡時間 */
  transition:
    transform 1s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 1s ease;
  will-change: transform, opacity;
}

/* -----------------------------------
   進入視窗時 (.in-view) 歸位與淡入
----------------------------------- */
.info-social-section.in-view .info-left {
  opacity: 1;
  transform: translateX(0);
}

/* 左欄：圖片連結與 Hover 效果 */
.info-left .feature-link {
  display: inline-block;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.info-left .feature-img {
  display: block;
  max-width: 95%;
  height: auto;
  object-fit: contain;
  transition:
    transform 0.4s ease,
    filter 0.4s ease;
}

/* Hover 懸浮效果：圖片微微放大 */
.info-left .feature-link:hover {
  transform: translateY(-4px);
}

.info-left .feature-link:hover .feature-img {
  transform: scale(1.03); /* 圖片微幅放大 */
  filter: brightness(1.05); /* 微微提亮 */
}

/* 右欄：內容佈局 */
.info-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
}

/* 右欄第一排：文字樣式 */
.info-text {
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.7;
  letter-spacing: 0.5px;
}

.info-text p {
  margin: 0 0 8px 0;
}

.info-text p:last-child {
  margin-bottom: 0;
}

/* 右欄第二排：社群 Icon 列表 */
.social-icons {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease;
}

.social-link img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.social-link:hover {
  transform: translateY(-4px);
  opacity: 0.85;
}

/* -----------------------------------
   RWD 手機版調整 (<= 768px)
----------------------------------- */
@media (max-width: 768px) {
  .info-social-section {
    padding: 40px 20px;
  }

  .info-social-section .container {
    flex-direction: column; /* 手機版轉為單欄垂直排列 */
    gap: 30px;
    text-align: center;
  }

  .info-right {
    align-items: center;
    gap: 24px;
  }

  .info-text {
    font-size: 0.95rem;
  }

  .social-icons {
    justify-content: center;
    gap: 12px;
  }

  .social-link {
    width: 48px;
    height: 48px;
  }
}

/* -----------------------------------
   外層跨區塊背景容器
----------------------------------- */
.main-content-wrapper {
  width: 100%;
  position: relative;

  /* 多重背景：1. 黃色波浪圖 (在上層), 2. 漸層圖 (在下層) */
  background-image:
    url("../images/bg-yellow-wave.png"), url("../images/bg-gradient.png");

  /* 預設對齊位置：將黃色波浪初始點往下移至 30px */
  background-position:
    center 80px,
    /* 圖一 (黃色波浪) 初始距離頂部 */ center bottom; /* 圖二 (漸層) 對齊底部 */

  background-repeat: no-repeat, no-repeat;

  /* 尺寸設定 */
  background-size:
    100% 75%,
    100% 70%;

  /* 套用垂直呼吸波動動畫 */
  animation: verticalWave 3s ease-in-out infinite alternate;
  will-change: background-position;
}

/* -----------------------------------
   關鍵影格定義：在安全性下限內浮動
----------------------------------- */
@keyframes verticalWave {
  0% {
    background-position:
      center 50px,
      /* 最低點：距離頂部 30px */ center bottom; /* 漸層：固定不動 */
  }
  100% {
    background-position:
      center 20px,
      /* 最高點：距離頂部 10px (依然在容器範圍內，不裁切) */ center bottom; /* 漸層：固定不動 */
  }
}

/* -----------------------------------
   子區塊背景透明化 (關鍵)
   確保內部子區塊不會有自己的背景色擋住外層背景
----------------------------------- */
.video-section,
.skill-links-section,
.category-carousel-section,
.info-social-section {
  background-color: transparent !important;
}

/* -----------------------------------
   RWD 手機版調整 (<= 768px)
----------------------------------- */
@media (max-width: 768px) {
  .main-content-wrapper {
    /* 手機版直向變長時，可適度調整漸層涵蓋的比例 */
    background-size:
      100% auto,
      100% 100%;
    animation-name: verticalWaveMobile;
  }
}

/* -----------------------------------
   手機版專屬關鍵影格：加大上下移動範圍 (位移 50px)
----------------------------------- */
@keyframes verticalWaveMobile {
  0% {
    background-position:
      center 80px,
      center bottom; /* 漸層：固定不動 */
  }
  100% {
    background-position:
      center 10px,
      /* 最高點：回到 10px (依然不超出頂部邊界) */ center bottom; /* 漸層：固定不動 */
  }
}

/* =========================================
footer
========================================= */
footer {
  background-color: #fff;
  color: #000;
  font-size: 14px;
  text-align: center;
  padding: 15px;
}
