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

body {
  font-family: "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
  position: relative;
}

/* 金門風格背景 - 使用漸層與圖片疊加 */
.background-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: linear-gradient(135deg,
    rgba(139, 90, 43, 0.85) 0%,      /* 古厝紅磚色 */
    rgba(218, 165, 32, 0.75) 30%,    /* 高粱金黃色 */
    rgba(70, 130, 180, 0.7) 60%,     /* 海岸藍色 */
    rgba(34, 139, 34, 0.8) 100%      /* 田野綠色 */
  ),
  url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800"><defs><linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%23d4a574;stop-opacity:0.3" /><stop offset="50%" style="stop-color:%23f4e4bc;stop-opacity:0.2" /><stop offset="100%" style="stop-color:%2387ceeb;stop-opacity:0.3" /></linearGradient></defs><rect width="1200" height="800" fill="url(%23grad)"/><path d="M0,400 Q300,200 600,400 T1200,400" stroke="%23ffffff" stroke-width="2" fill="none" opacity="0.1"/><path d="M0,500 Q300,300 600,500 T1200,500" stroke="%23ffffff" stroke-width="2" fill="none" opacity="0.1"/></svg>') center/cover;
  background-attachment: fixed;
  animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* 可選：如果用戶有金門背景圖，可以取消註解並替換路徑 */
/*
.background-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/kinmen-background.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  z-index: -1;
}
*/

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

.header {
  text-align: center;
  margin-bottom: 60px;
  color: #fff;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.header h1 {
  font-size: 3.5em;
  margin-bottom: 20px;
  font-weight: bold;
  letter-spacing: 0.1em;
}

.header p {
  font-size: 1.3em;
  opacity: 0.95;
}

.seo-nav {
  width: 100%;
  max-width: 980px;
  margin: 0 auto 40px;
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.seo-nav h2 {
  color: #8B5A3C;
  font-size: 1.2em;
  margin-bottom: 10px;
}

.seo-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.seo-nav a {
  color: #2f3f9f;
  text-decoration: underline;
  font-weight: 600;
}

.seo-nav a:hover {
  text-decoration: none;
}

/* 分類區塊 */
.category-section {
  width: 100%;
  max-width: 1200px;
  margin-bottom: 50px;
}

.category-title {
  text-align: center;
  color: #fff;
  font-size: 2.2em;
  margin-bottom: 30px;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
  font-weight: bold;
  position: relative;
  padding-bottom: 15px;
}

.category-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
}

.sites-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  width: 100%;
  justify-content: center;
  align-items: stretch;
}

/* 單個項目時居中 */
.sites-grid:has(.site-card:only-child),
.sites-grid.single-item {
  justify-content: center;
}

.sites-grid:has(.site-card:only-child) .site-card,
.sites-grid.single-item .site-card {
  max-width: 400px;
  width: 100%;
}

/* 兩個項目時居中 */
.sites-grid:has(.site-card:nth-child(2):last-child) .site-card,
.sites-grid.two-items .site-card {
  max-width: 380px;
  flex: 0 1 calc(50% - 15px);
}

/* 三個項目時居中 */
.sites-grid:has(.site-card:nth-child(3):last-child) .site-card,
.sites-grid.three-items .site-card {
  max-width: 320px;
  flex: 0 1 calc(33.333% - 20px);
}

/* 四個或更多項目時 */
.sites-grid .site-card {
  max-width: 300px;
  flex: 0 1 calc(25% - 23px);
  min-width: 280px;
}

.site-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
}

.site-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  background: rgba(255, 255, 255, 1);
}

.site-card h2 {
  font-size: 1.8em;
  margin-bottom: 15px;
  color: #8B5A3C;
  font-weight: bold;
}

.site-card .subtitle {
  font-size: 1.1em;
  color: #666;
  margin-bottom: 20px;
  font-weight: 500;
}

.site-card .description {
  font-size: 0.95em;
  color: #555;
  line-height: 1.6;
  flex-grow: 1;
  margin-bottom: 20px;
}

.site-card .link-btn {
  display: inline-block;
  padding: 12px 30px;
  background: linear-gradient(135deg, #8B5A3C, #D4A574);
  color: white;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
  margin-top: auto;
}

.site-card:hover .link-btn {
  background: linear-gradient(135deg, #A0694F, #E4B894);
  transform: scale(1.05);
}

.icon {
  font-size: 3em;
  margin-bottom: 15px;
  display: block;
}

/* 響應式設計 */
@media (max-width: 1024px) {
  .sites-grid .site-card {
    flex: 0 1 calc(33.333% - 20px);
    max-width: 320px;
  }

  .sites-grid:has(.site-card:nth-child(3):last-child) .site-card {
    flex: 0 1 calc(33.333% - 20px);
  }
}

@media (max-width: 768px) {
  .header h1 {
    font-size: 2.5em;
  }

  .header p {
    font-size: 1.1em;
  }

  .category-title {
    font-size: 1.8em;
    margin-bottom: 25px;
  }

  .category-section {
    margin-bottom: 40px;
  }

  .seo-nav {
    margin-bottom: 30px;
    padding: 16px;
  }

  .sites-grid {
    flex-direction: column;
    align-items: center;
  }

  .sites-grid .site-card {
    flex: 0 1 100% !important;
    max-width: 100% !important;
    min-width: auto !important;
    width: 100%;
    gap: 20px;
  }

  .site-card {
    min-height: 280px;
    padding: 25px;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 2em;
  }

  .container {
    padding: 20px 15px;
  }
}

/* 裝飾性元素 */
.decorative-elements {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.decorative-elements::before,
.decorative-elements::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  opacity: 0.1;
}

.decorative-elements::before {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255,255,255,0.3), transparent);
  top: -150px;
  right: -150px;
  animation: float 15s ease-in-out infinite;
}

.decorative-elements::after {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.2), transparent);
  bottom: -100px;
  left: -100px;
  animation: float 20s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  50% {
    transform: translate(30px, 30px) rotate(180deg);
  }
}