/**
 * 熱門遊戲分類版塊樣式 - 優化版
 * 黑金風格卡片設計 - 響應式布局 - SEO友好
 */

/* 版塊容器 */
.games-section {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #000 100%);
    padding: 80px 0;
    position: relative;
    overflow: hidden;
}

.games-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(255, 215, 0, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

/* 版塊標題 */
.content-header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

.section-title {
    font-size: 3rem;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
}

.section-subtitle {
    font-size: 1.2rem;
    color: #ccc;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 300;
}

/* 遊戲網格 - 使用 CSS Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    padding: 0 20px;
}

/* 遊戲卡片 - 使用 Flexbox 確保高度一致 */
.game-card {
    background: linear-gradient(145deg, #1a1a1a 0%, #2a2a2a 100%);
    border: 2px solid #333;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transition: left 0.6s ease;
    z-index: 1;
}

.game-card:hover {
    transform: translateY(-8px);
    border-color: #ffd700;
    box-shadow: 0 20px 40px rgba(255, 215, 0, 0.2);
}

.game-card:hover::before {
    left: 100%;
}

/* 卡片圖片區域 - 固定高度和比例 */
.game-image {
    position: relative;
    height: 200px; /* 固定高度 */
    overflow: hidden;
    border-radius: 13px 13px 0 0;
}

.game-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 自動裁切保持比例 */
    transition: transform 0.4s ease;
    display: block;
}

.game-card:hover .game-image img {
    transform: scale(1.05);
}

/* 圖片覆蓋層 */
.game-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 20px 15px 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.game-card:hover .game-overlay {
    opacity: 1;
    transform: translateY(0);
}

.game-category {
    color: #ffd700;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    display: block;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* 卡片內容區域 - 使用 Flexbox 確保底部對齊 */
.game-content {
    padding: 25px;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* 讓內容區域填滿剩餘空間 */
    justify-content: space-between; /* 確保按鈕在底部 */
}

.game-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 15px;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1.3;
}

.game-description {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 300;
    flex-grow: 1; /* 讓描述文字填滿可用空間 */
    display: flex;
    align-items: center; /* 垂直居中 */
}

/* 馬上玩按鈕 */
.game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #000;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    margin-top: auto; /* 確保按鈕在底部 */
}

.game-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.game-btn:hover {
    background: linear-gradient(45deg, #ffed4e, #ffd700);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
    color: #000;
    text-decoration: none;
}

.game-btn:hover::before {
    left: 100%;
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 25px;
    }
}

@media (max-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .game-image {
        height: 180px;
    }
}

@media (max-width: 768px) {
    .games-section {
        padding: 60px 0;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 400px;
        padding: 0 15px;
    }
    
    .section-title {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .section-subtitle {
        font-size: 1rem;
        padding: 0 20px;
    }
    
    .game-image {
        height: 200px;
    }
    
    .game-content {
        padding: 20px;
    }
    
    .game-title {
        font-size: 1.2rem;
    }
    
    .game-description {
        font-size: 0.9rem;
    }
    
    .game-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .games-section {
        padding: 40px 0;
    }
    
    .games-grid {
        padding: 0 10px;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
    }
    
    .game-image {
        height: 180px;
    }
    
    .game-content {
        padding: 15px;
    }
    
    .game-title {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .game-description {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }
    
    .game-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* 無障礙訪問優化 */
@media (prefers-reduced-motion: reduce) {
    .game-card,
    .game-image img,
    .game-btn,
    .game-overlay {
        transition: none;
    }
    
    .game-card:hover {
        transform: none;
    }
}

/* 高對比度模式 */
@media (prefers-contrast: high) {
    .game-card {
        border-color: #fff;
    }
    
    .game-title {
        color: #fff;
    }
    
    .game-description {
        color: #fff;
    }
}

/* 打印樣式 */
@media print {
    .games-section {
        background: #fff;
        color: #000;
    }
    
    .game-card {
        background: #fff;
        border: 1px solid #000;
        box-shadow: none;
        break-inside: avoid;
    }
    
    .game-title {
        color: #000;
    }
    
    .game-description {
        color: #000;
    }
    
    .game-btn {
        background: #000;
        color: #fff;
    }
}

/* 確保圖片不會被文字覆蓋 */
.game-image {
    position: relative;
    z-index: 1;
}

.game-content {
    position: relative;
    z-index: 2;
}

/* 文字溢出處理 */
.game-title {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.game-description {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* 確保卡片高度一致 */
.games-grid {
    align-items: stretch;
}

.game-card {
    min-height: 400px; /* 最小高度確保一致性 */
}

/* 圖片載入優化 */
.game-image img {
    background-color: #333;
    background-image: linear-gradient(45deg, #333 25%, transparent 25%), 
                      linear-gradient(-45deg, #333 25%, transparent 25%), 
                      linear-gradient(45deg, transparent 75%, #333 75%), 
                      linear-gradient(-45deg, transparent 75%, #333 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* 焦點狀態優化 */
.game-btn:focus {
    outline: 2px solid #ffd700;
    outline-offset: 2px;
}

.game-card:focus-within {
    border-color: #ffd700;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.3);
}

/* 🚫 強制移除遊戲卡片偽元素圖示 - 確保在所有樣式載入後生效 */
.game-image::before,
.game-image:before,
article.game-card .game-image::before,
article.game-card .game-image:before {
  content: none !important;
  display: none !important;
  visibility: hidden !important;
  background: none !important;
  width: 0 !important;
  height: 0 !important;
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: -1 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  transform: none !important;
  transition: none !important;
}