/* ... 保留原有的 root 和基礎樣式 ... */

/* Blog 區域樣式 */
.blog {
    padding: 100px 0;
}

.blog-wrapper {
    padding: 0 24px;
    max-width: 1175px;
    margin: 0 auto;
}

.blog-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: auto;
    gap: 25px 100px;
    align-items: start;
}

/* 目錄樣式 */
.table-of-contents {
    background: white;
    border-radius: 12px;
    padding: 21px 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.115);
    position: sticky;
    top: 150px;
    height: fit-content;
}

.table-of-contents ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.table-of-contents li {
    margin-bottom: 8px;
    padding-left: 8px;
}

.table-of-contents li:last-child {
    margin-bottom: 0;
}

.table-of-contents a {
    color: #666;
    text-decoration: none;
    font-size: 15px;
    line-height: 1.5;
    display: block;
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.table-of-contents a.active {
    background-color: #000000;
    color: #ffffff;
}

/* 其他項目的樣式 */
.table-of-contents li:not(:first-child) a {
    padding-left: 16px;
    border-radius: 4px;
}

/* 滑鼠懸停效果 */
.table-of-contents li:not(:first-child) a:hover {
    background-color: #000000;
    color: #ffffff;
}

/* 點擊後的狀態 */
.table-of-contents li:not(:first-child) a:active,
.table-of-contents li:not(:first-child) a.active {
    background-color: #000000;
    color: white;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .blog {
        padding: 50px 0;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .table-of-contents {
        position: relative;
        top: 0;
    }
}

/* 文章內容區域 */
.blog-post {
    padding: 2rem 0;
    max-width: 100%;
    margin: 0;
}

.post-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #333;
}

/* 文章內容區域樣式 */
.post-content {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    padding: 64px 56px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.115);
    gap: 40px;
}

.post-section {
    margin-bottom: 20px;
    scroll-margin-top: 150px;
}

.post-section:last-child {
    margin-bottom: 0;
}

.post-section h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #333;
}

.post-section p {
    font-size: 1.2rem;
    color: #666;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.post-section ul {
    font-size: 1.2rem;
    color: #666;
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 1.5rem;
}

.blog-post-image {
    width: 90%;
    height: 400px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 20px;
}

/* 最後一個段落移除底部間距 */
.post-section p:last-child {
    margin-bottom: 0;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .blog {
        padding: 60px 0;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .post-content {
        padding: 32px 24px;
    }

    .post-section h1 {
        font-size: 1.5rem;
    }

    .post-section p,
    .post-section ul {
        font-size: 1rem;
    }

    .hero-banner {
        padding: 200px 0 80px;
    }

    .hero-banner h1 {
        font-size: 2em;
    }

    .category-tag,
    .post-meta {
        font-size: 0.9em;
    }

    .blog-post-image {
        width: 100%;
        height: 250px;
    }

    .related-articles {
        margin: 40px auto;
    }

    .related-articles-header h2 {
        font-size: 24px;
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        padding: 0 20px;
    }

    .table-of-contents {
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
}

/* 頁面頂部橫幅圖片 */
.hero-banner {
    width: 100%;
    position: relative;
    overflow: hidden;
    padding-top: 430px;
    padding-bottom: 132px;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, 
        rgba(0,0,0,0.8) 0%,
        rgba(0,0,0,0.6) 40%,
        rgba(0,0,0,0.2) 70%,
        rgba(0,0,0,0) 100%
    );
    z-index: 1;
}

.hero-banner-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.inner-container {
    position: relative;
    z-index: 2;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

._740px {
    max-width: 740px;
    color: #fff;
}

.category-tag {
    display: inline-block;
    padding: 8px 16px;
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 4px;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.hero-banner h1 {
    font-size: 3em;
    color: #fff;
    margin-bottom: 20px;
    line-height: 1.3;
}

.post-meta {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .hero-banner {
        padding-top: 300px;
        padding-bottom: 80px;
    }

    .hero-banner h1 {
        font-size: 2em;
    }

    .category-tag {
        font-size: 1em;
    }
}

/* 內容區域平滑滾動 */
html {
    scroll-behavior: smooth;
}

/* 相关文章部分样式 */
.related-articles {
    max-width: 1175px;
    margin: 80px auto;
    padding: 0 24px;
}

.related-articles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.related-articles-header h2 {
    font-size: 32px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.browse-all {
    padding: 12px 24px;
    background-color: #000;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 16px;
    transition: background-color 0.3s ease;
}

.browse-all:hover {
    background-color: #333;
}

.related-articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.article-card {
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
    display: block;
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
}

.article-card:hover {
    transform: translateY(-5px);
}

.article-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-image img {
    transform: scale(1.05);
}

.article-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 32px;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        rgba(0, 0, 0, 0) 100%
    );
    color: white;
}

.article-category {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
    font-weight: 500;
}

.article-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin: 0;
    line-height: 1.4;
}

/* 响应式设计 - 相关文章 */
@media (max-width: 1024px) {
    .related-articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .related-articles {
        margin: 40px auto;
    }

    .related-articles-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .related-articles-grid {
        grid-template-columns: 1fr;
    }
}
