:root {
  /* 海洋度假配色 */
  --ocean-dark: #006994;
  --ocean-light: #48CAE4;
  --sand: #FFFDF7;
  --coral: #FF8FAB;
  --sun: #FFD166;
  --text-main: #2B2D42;
  --text-gray: #6D6E7C;
  --white: #ffffff;
  
  /* 陰影與圓角 */
  --shadow-card: 0 10px 30px rgba(0, 105, 148, 0.1);
  --shadow-hover: 0 20px 40px rgba(0, 105, 148, 0.2);
  --radius-card: 24px;
  --radius-btn: 50px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Noto Sans TC', sans-serif;
  background-color: var(--sand);
  color: var(--text-main);
  overflow-x: hidden;
}

/* === 導覽列 (保留功能但優化外觀) === */
.main-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 15px 20px;
  transition: all 0.3s ease;
  background: transparent; /* 初始透明 */
}

/* ⬇️ 修改這裡：滾動後變為海洋深藍色，讓白色 Logo 浮現 */
.main-navbar.scrolled {
  background: rgba(0, 105, 148, 0.95); /* 改用 Ocean Dark 色碼 */
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 10px 20px;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo { height: 40px; }

.nav-right a {
  text-decoration: none;
  color: var(--white); /* 預設白色字 */
  font-weight: 600;
  margin-left: 20px;
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  transition: all 0.3s;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-right a:hover {
  background: rgba(255,255,255,0.2);
}

/* ⬇️ 修改這裡：滾動後文字保持白色 (因為背景變深藍了) */
.main-navbar.scrolled .nav-right a {
  color: var(--white); /* 保持白色 */
  text-shadow: none;
}

/* 滾動後的滑鼠懸停效果 */
.main-navbar.scrolled .nav-right a:hover {
  background: var(--ocean-light); /* 淺藍色背景 */
  color: var(--white);
}

/* === Hero Header (海洋大圖區) === */
.island-hero {
  position: relative;
  height: 70vh; /* 佔據 70% 螢幕高度 */
  min-height: 500px;
  /* 背景圖建議換成一張明亮的小琉球風景 */
  background: linear-gradient(180deg, rgba(0,105,148,0.3), rgba(0,105,148,0.1)), url('DSC_2287.webp') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-top: 60px;
}

.hero-content {
  z-index: 2;
  padding: 20px;
  animation: floatUp 1s ease-out;
}

.tagline {
  display: inline-block;
  background: var(--sun);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  letter-spacing: 1px;
  box-shadow: 0 4px 10px rgba(255, 209, 102, 0.4);
}

.island-hero h1 {
  font-size: 3.5rem;
  color: var(--white);
  margin: 10px 0;
  text-shadow: 0 4px 12px rgba(0,0,0,0.2);
  letter-spacing: 2px;
}

.island-hero p {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.95);
  margin-bottom: 30px;
  font-weight: 500;
}

/* === 波浪動畫 (SVG) === */
.ocean-waves {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
}
.waves {
  width: 100%;
  height: 100px;
}
.parallax > use {
  animation: move-forever 25s cubic-bezier(.55,.5,.45,.5) infinite;
}
.parallax > use:nth-child(1) { animation-delay: -2s; animation-duration: 7s; }
.parallax > use:nth-child(2) { animation-delay: -3s; animation-duration: 10s; }
.parallax > use:nth-child(3) { animation-delay: -4s; animation-duration: 13s; }
.parallax > use:nth-child(4) { animation-delay: -5s; animation-duration: 20s; }

@keyframes move-forever {
  0% { transform: translate3d(-90px,0,0); }
  100% { transform: translate3d(85px,0,0); }
}

/* === 篩選按鈕 === */
.filter-container {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-btn {
  background: rgba(255,255,255,0.9);
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  color: var(--ocean-dark);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.filter-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.filter-btn.active {
  background: var(--ocean-light);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(72, 202, 228, 0.4);
}

/* === 主要內容區 === */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* === 景點卡片 Grid === */
.attractions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 40px;
  margin-top: 20px;
}

/* === 旅遊卡片設計 === */
.attraction-card {
  background: var(--white);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all 0.4s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0,0,0,0.02);
  /* 動畫設定 */
  animation: cardEntrance 0.8s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.attraction-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
}

.card-image-box {
  position: relative;
  height: 240px;
  overflow: hidden;
}

.card-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.attraction-card:hover .card-image-box img {
  transform: scale(1.1);
}

/* 標籤貼紙化 */
.badge {
  position: absolute;
  top: 16px;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  backdrop-filter: blur(4px);
  z-index: 2;
}

.badge-price {
  right: 16px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ocean-dark);
}
.badge-price.paid { color: #E63946; }
.badge-price.free { color: #2A9D8F; }

.badge-secret {
  left: 16px;
  background: linear-gradient(135deg, var(--sun), #FFA500);
  color: var(--text-main);
}

.card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* === 核心優化：標題與圖片來源並列容器 === */
.card-title-container {
  display: flex; /* 啟用 Flexbox 佈局 */
  align-items: baseline; /* 讓文字的基線對齊 (讓標題和來源底部對齊) */
  gap: 10px; /* 名稱和來源間的間隔 */
  margin-bottom: 12px; /* 與下方描述保持間隔 */
}

.card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ocean-dark);
  margin: 0; /* 清除 H3 預設 margin */
  flex-grow: 1; /* 讓標題佔據大部分空間 */
  min-width: 0; /* 避免標題過長時擠壓右側元素 */
}

/* === 核心優化：圖片來源樣式 === */
.image-source, .image-source-link { /* 讓 a 標籤也套用基本樣式 */
  /* 移除預設的 p 標籤樣式，現在它是 span/a */
  margin: 0; 
  padding: 0;

  /* 文字樣式優化 */
  font-size: 0.8rem; /* 字體縮小 */
  font-weight: 500; 
  color: var(--text-gray); 
  opacity: 0.8; 
  white-space: nowrap; /* 不換行，避免名稱太長時變形 */
  overflow: hidden;
  text-overflow: ellipsis; 
  text-decoration: none; /* 移除連結下底線 */
  transition: color 0.2s; /* 讓 hover 效果更平滑 */
}

/* 新增連結專屬的 hover 效果 */
.image-source-link:hover {
  color: var(--coral); /* 懸停時使用珊瑚紅 */
  opacity: 1; /* 提高透明度 */
  text-decoration: underline; /* 加上下底線提示可點擊 */
}


.card-desc {
  color: var(--text-gray);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
  flex-grow: 1;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-gray);
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.info-row svg { width: 18px; height: 18px; color: var(--ocean-light); }

.card-footer {
  margin-top: 20px;
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
}

/* 按鈕樣式 */
.btn-map {
  width: 100%;
  background: var(--ocean-light);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-map:hover {
  background: var(--ocean-dark);
}

/* === 參訪人數 === */
.visitor-section {
  text-align: center;
  margin-top: 60px;
}
#visitor-count {
  display: inline-block;
  padding: 10px 24px;
  background: var(--white);
  color: var(--text-gray);
  border-radius: 50px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border: 1px solid #eee;
}

/* === 動畫 === */
@keyframes floatUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.92); 
    filter: blur(5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.no-result-message {
  animation: cardEntrance 0.6s ease-out;
}

/* === 懸浮地圖按鈕 (FAB) === */
#fab-map-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: var(--ocean-dark);
  color: white;
  border: none;
  padding: 15px 25px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0, 105, 148, 0.4);
  cursor: pointer;
  z-index: 999; 
  transition: transform 0.3s, background 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

#fab-map-btn:hover {
  transform: scale(1.05);
  background: var(--ocean-light);
}

/* === 地圖彈出視窗 (Modal) - 含精美動畫 === */
.map-modal {
  display: none; 
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0); 
  z-index: 2000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(0px); 
  transition: background 0.4s ease, backdrop-filter 0.4s ease; 
}

.map-modal.show {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
}

.map-content {
  background: white;
  width: 90%;
  max-width: 1000px;
  height: 80vh;
  border-radius: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
              transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-modal.show .map-content {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.map-content h3 {
  padding: 15px 20px;
  margin: 0;
  background: var(--sand, #FFFDF7);
  color: var(--ocean-dark, #006994);
  border-bottom: 1px solid #eee;
}

#map-container {
  flex: 1;
  width: 100%;
  background: #eef;
}

.close-map-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 30px;
  color: #6D6E7C;
  cursor: pointer;
  z-index: 1001;
  transition: color 0.2s;
}
.close-map-btn:hover { color: #E63946; }

/* RWD 手機版優化 */
@media (max-width: 768px) {
  .island-hero {
    height: 60vh;       
    min-height: 350px;  
    padding-top: 70px;  
  }

  .tagline {
    font-size: 12px;
    padding: 4px 10px;
    margin-bottom: 8px;
  }

  .island-hero h1 {
    font-size: 2rem; 
    margin: 5px 0 10px; 
    line-height: 1.3;
  }

  .island-hero p {
    font-size: 0.95rem; 
    margin-bottom: 20px;
    padding: 0 15px;    
    opacity: 0.9;
  }

  .filter-container {
    gap: 8px; 
  }

  .filter-btn {
    padding: 8px 16px; 
    font-size: 13px;   
    flex: 1 1 auto;    
    min-width: 80px;   
    display: flex;     
    justify-content: center;
  }

  .nav-right a {
    font-size: 14px;
    margin-left: 5px;
    padding: 6px 10px;
  }
  .logo {
    height: 32px; 
  }
  
  .main-content {
    padding: 20px 15px 60px; 
  }
  
  .attractions-grid {
    grid-template-columns: 1fr; 
    gap: 25px;
  }

  /* RWD 調整：手機版讓圖片來源可以自動換行，或將對齊改為左側 */
  .card-title-container {
      flex-direction: column; /* 垂直堆疊，避免標題和來源擠在一起 */
      align-items: flex-start; /* 靠左對齊 */
      gap: 0;
  }

  .image-source {
      font-size: 0.75rem; /* 在手機上更小一點 */
      margin-top: 4px; /* 與標題拉開一點距離 */
      white-space: normal; /* 允許換行 */
      text-align: left;
  }
}


/* 按鈕樣式 */
.card-footer {
  margin-top: 20px;
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
  /* ✨ 新增：讓按鈕並排且平均分佈 ✨ */
  display: flex; 
  gap: 12px; /* 按鈕間隔 */
}

.btn-map {
  flex: 1; /* 讓兩個按鈕平均佔據空間 */
  min-width: 0; /* 修正 flex 佈局下 min-width 預設值造成的擠壓 */

  background: var(--ocean-light);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none; /* 確保 a 標籤沒有底線 */
  font-size: 15px; /* 統一字體大小 */
}

.btn-map:hover {
  background: var(--ocean-dark);
}

/* ✨ 新增：星空資訊按鈕專屬樣式 ✨ */
.btn-star {
    background: var(--text-gray); /* 改用灰色系，區別導航 */
}

.btn-star:hover {
    background: var(--text-main); /* 滑鼠懸停時變深 */
}

