/* style.css */
/* --- 基礎設定 & 全域變數 --- */
:root {
    --primary-blue: #1A2B4C;   /* 沉穩深藍 */
    --secondary-blue: #111D33; /* 暗藍（頁尾與部分背景） */
    --gold: #B8975E;           /* 高質感金 */
    --light-gold: #F4EFE6;     /* 淺金背景 */
    --text-dark: #333333;      /* 深灰內文 */
    --text-light: #FFFFFF;     /* 白色文字 */
    --bg-light: #F8F9FA;       /* 淺灰網頁背景 */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.7;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h2.section-title {
    text-align: center;
    font-size: 2rem;
    color: var(--primary-blue);
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 10px;
}

h2.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--gold);
}

section {
    padding: 80px 0;
}

/* --- 1. 導覽列 (Navbar) --- */
header {
    background-color: var(--text-light);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    color: var(--primary-blue);
    font-size: 1.3rem;
    height: 100%;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary-blue);
    color: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid var(--gold);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--gold);
}

.btn-consult {
    display: none;
    background-color: var(--gold);
    color: var(--text-light) !important;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s !important;
}

.btn-consult:hover {
    background-color: #A3824B;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle span {
    width: 100%;
    height: 3px;
    background-color: var(--primary-blue);
    transition: all 0.3s ease;
}

/* --- 2. 大型主視覺 (Hero Section) --- */
.hero {
    background: linear-gradient(rgba(26, 43, 76, 0.75), rgba(26, 43, 76, 0.75)), 
                url('https://images.unsplash.com/photo-1589829545856-d10d557cf95f?auto=format&fit=crop&w=1920&q=80') no-repeat center center/cover;
    height: 550px;
    display: flex;
    align-items: center;
    color: var(--text-light);
}

.hero-content {
    max-width: 600px;
}

.hero-content h1 {
    font-size: 2.8rem;
    margin-bottom: 20px;
    font-weight: 700;
    letter-spacing: 2px;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #E0E0E0;
}

/* --- 3. 事務所介紹 (About) --- */
.about {
    background-color: var(--text-light);
}

.about-wrapper {
    display: flex;
    gap: 50px;
    align-items: center;
}

.about-text {
    flex: 1;
}

.about-text h3 {
    color: var(--gold);
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.about-text h2 {
    color: var(--primary-blue);
    font-size: 2.2rem;
    margin-bottom: 20px;
}

.about-text p {
    margin-bottom: 20px;
    color: #555;
    text-align: justify;
}

.about-image {
    flex: 1;
    position: relative;
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.about-image::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid var(--gold);
    top: 20px;
    left: -20px;
    z-index: -1;
    border-radius: 4px;
}

/* --- 4. 律師團隊 & 法務介紹 (Team) --- */
.team {
    background-color: var(--bg-light);
}

.lawyer-card {
    background-color: var(--text-light);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    display: flex;
    overflow: hidden;
    margin-bottom: 50px;
    border-top: 5px solid var(--gold);
}

.lawyer-img {
    flex: 1;
    max-width: 350px;
    background: #e1e1e1;
}

.lawyer-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lawyer-info {
    flex: 2;
    padding: 40px;
}

.lawyer-info h3 {
    font-size: 1.8rem;
    color: var(--primary-blue);
    margin-bottom: 5px;
}

.lawyer-title {
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 25px;
}

.lawyer-details h4 {
    color: var(--primary-blue);
    margin: 15px 0 5px 0;
    font-size: 1.1rem;
}

.lawyer-details ul {
    list-style-position: inside;
    color: #555;
    margin-bottom: 15px;
}

/* 法務區塊（僅姓名與圖片） */
.paralegal-title {
    width: 25%;
    min-width: 180px;
    margin: 40px auto 25px;
    text-align: center;
    color: var(--primary-blue);
    font-size: 1.5rem;
}

.paralegal-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 25px;
}

.paralegal-card {
    flex: 0 0 calc((100% - 75px) / 4);
    max-width: calc((100% - 75px) / 4);
    background-color: var(--text-light);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    text-align: center;
    transition: transform 0.3s;
}

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

.paralegal-img {
    width: 100%;
    height: 260px;
    background-color: #e1e1e1;
}

.paralegal-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.paralegal-card h4 {
    padding: 15px 0;
    color: var(--primary-blue);
    font-size: 1.1rem;
}

/* --- 5. 服務項目 (Services) --- */
.services {
    background-color: var(--text-light);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 30px;
}

.service-card {
    background-color: var(--bg-light);
    padding: 40px 30px;
    border-radius: 6px;
    text-align: center;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.service-card:hover {
    border-bottom: 3px solid var(--gold);
    background-color: var(--light-gold);
    transform: translateY(-5px);
}

.service-icon {
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 20px;
}

.service-card h3 {
    color: var(--primary-blue);
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.service-card p {
    color: #666;
    font-size: 0.95rem;
    text-align: justify;
}

/* --- 6. 營業資訊與聯絡地圖 (Contact) --- */
.contact {
    background-color: var(--secondary-blue);
    color: var(--text-light);
}

.contact h2.section-title {
    color: var(--text-light);
}

/* 警示文字區塊設定 */
.notice-box {
    background-color: rgba(184, 151, 94, 0.15);
    border-left: 4px solid var(--gold);
    padding: 20px;
    margin-bottom: 40px;
    border-radius: 4px;
}

.notice-box p {
    color: #E0E0E0;
    font-size: 1rem;
    line-height: 1.6;
}

.contact-wrapper {
    display: flex;
    gap: 50px;
}

.contact-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-block {
    margin-bottom: 30px;
}

.info-block h3 {
    color: var(--gold);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.info-block p {
    color: #D1D5DB;
    font-size: 1.1rem;
}

.phone-link-footer {
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 700;
}

.contact-map {
    flex: 1;
    height: 350px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--gold);
}

.contact-map iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- Footer 頁尾 --- */
footer {
    background-color: #0B1322;
    color: #778293;
    text-align: center;
    padding: 20px 0;
    font-size: 0.9rem;
    border-top: 1px solid #1A2B4C;
}

/* --- 響應式 RWD 行動裝置調整 --- */
@media (max-width: 992px) {
    .about-wrapper, .contact-wrapper {
        flex-direction: column;
    }
    .lawyer-card {
        flex-direction: column;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        max-width: 680px;
    }
    .lawyer-img {
        max-width: 100%;
        height: 300px;
    }
    .paralegal-title {
        width: 220px;
        min-width: 220px;
        max-width: 90%;
        font-size: 1.3rem;
        margin: 32px auto 20px;
    }
    .paralegal-grid {
        justify-content: center;
    }
    .paralegal-card {
        flex: 0 0 min(280px, 100%);
        max-width: min(280px, 100%);
    }

    /* 手機版漢堡選單結構 */
    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 80px;
        right: 0;
        width: 260px;
        height: calc(100vh - 80px);
        background-color: var(--text-light);
        flex-direction: column;
        gap: 0;
        box-shadow: -5px 5px 10px rgba(0,0,0,0.05);
        padding: 20px 0;
        align-items: stretch;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 15px 30px;
        border-bottom: 1px solid #eee;
        color: var(--text-dark) !important;
    }

    .btn-consult {
        display: block;
        margin: 15px 30px;
        text-align: center;
        border-radius: 4px;
        color: var(--text-light) !important;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .menu-toggle.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    
    .phone-link-footer {
        color: var(--gold);
        text-decoration: underline;
    }
    /* 🚀 法律專欄 RWD 手機版自適應微調 */
    .articles-grid {
        grid-template-columns: 1fr; /* 在手機版強迫改成單欄，文章會乖乖上下堆疊 */
        gap: 20px;                  /* 縮小卡片之間的間距，符合手機閱讀 */
    }

    .article-card {
        max-width: 100%;            /* 防止卡片寬度超出手機螢幕 */
        margin: 0 auto;
    }

    .article-img {
        height: 180px;              /* 稍微縮高手機版的圖片高度，留更多空間給文字 */
    }

    .article-content {
        padding: 20px;              /* 稍微縮減內邊距，讓手機版畫面更緊湊精緻 */
    }

    .article-content h3 {
        font-size: 1.2rem;          /* 微調手機版標題大小，閱讀更流暢 */
        margin-bottom: 8px;
    }

    .article-content p {
        margin-bottom: 15px;
    }
    
    /* 🚀 分頁按鈕手機版微調：防止按鈕太多時在小螢幕塞不下 */
    .pagination-container {
        gap: 5px;
        margin-top: 35px;
        flex-wrap: wrap;            /* 萬一頁數太多，允許按鈕自動折行 */
    }
    
    .pagination-btn, .pagination-disabled {
        padding: 6px 12px;          /* 縮小按鈕尺寸，更適合手指點擊 */
        font-size: 0.9rem;
    }
}

/* 律師經歷與著作左右並排佈局 */
.lawyer-meta-grid {
    display: flex;
    gap: 40px;          /* 左右欄位的間距 */
    margin-top: 20px;
    align-items: flex-start; /* 確保標題「經歷」與「著作」齊頭平行 */
}
.lawyer-meta-grid .meta-col {
    flex: 1;            /* 左右兩欄等寬分配 */
    min-width: 0;       /* 防止長文字撐破版面 */
    word-break: break-all;       /* 遇到邊界強迫任意字元斷行 */
    overflow-wrap: break-word;   /* 針對超長網址或連續標點符號強制換行 */
    overflow: hidden;            /* 萬一有隱形元素超出，安全切平不外溢 */      
}
/* RDP 手機版自適應：當螢幕太小時，自動彈性切換回上下堆疊，維持手機閱讀體驗 */
@media (max-width: 768px) {
    .lawyer-meta-grid {
        flex-direction: column;
        gap: 20px;
    }
}

/* 專屬導覽列書法 LOGO 樣式控制 */
.navbar-logo {
    height: 60%;          /* 依父元素高度比例縮放 */
    width: auto;          /* 確保等比例縮放，毛筆字絕對不變形 */
    display: block;       /* 清除圖片預設的下方微小間距 */
    max-width: 100%;      /* 確保在極小螢幕的手機上也能自適應縮小 */
    filter: drop-shadow(0px 1px 2px rgba(0,0,0,0.1)); /* 幫招牌字加上一絲絲極輕微的立體陰影，質感更好 */
    align-self: center;   /* 垂直置中 */
}

/* RWD 手機版微調：如果手機畫面上導覽列空間不夠，可以稍微縮小圖片高度 */
@media (max-width: 576px) {
    .navbar-logo {
        height: 60%;      /* 手機版維持父元素 60% */
    }
}
/* --- 7. 法律專欄 (Articles) --- */
.articles {
    background-color: var(--bg-light); /* 使用淺灰背景，與服務項目的白色隔開 */
}

.articles-grid {
    display: grid;
    /* min(320px, 100%) 避免窄螢幕時欄寬撐破版面 */
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 30px;
    justify-content: center; /* 🚀 這行是讓所有卡片在父容器中水平置中的關鍵核心 */
}
.article-card {
    background-color: var(--text-light);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.article-img {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: #e1e1e1;
}

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

.article-card:hover .article-img img {
    transform: scale(1.05); /* 滑過時圖片微放大效果 */
}

.article-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-date {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 10px;
}

.article-content h3 {
    color: var(--primary-blue);
    font-size: 1.3rem;
    margin-bottom: 12px;
    line-height: 1.4;
    /* 限制標題最多兩行，超出顯示驚嘆號 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-content p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: justify;
    /* 限制摘要最多三行 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1; /* 確保按鈕被推到最底部對齊 */
}

.btn-readmore {
    color: var(--gold);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    align-self: flex-start;
    transition: color 0.3s;
}

.btn-readmore:hover {
    color: #A3824B;
}

.articles-more {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 10px;
}

.btn-articles-more {
    display: inline-block;
    background-color: var(--primary-blue);
    color: var(--text-light);
    padding: 12px 30px;
    text-decoration: none;
    font-weight: bold;
    border-radius: 4px;
    border: 1px solid var(--primary-blue);
    transition: all 0.3s;
}

.btn-articles-more:hover {
    background-color: transparent;
    color: var(--primary-blue);
}

/* --- 8. 法律專欄列表頁 (blog.php) --- */
.header-banner {
    background-color: var(--primary-blue);
    padding: 40px 20px;
    text-align: center;
    color: var(--text-light);
    position: static;
    box-shadow: none;
}

.header-banner h1 {
    margin: 0;
    font-size: 2rem;
    color: var(--gold);
}

.header-banner p {
    margin: 10px 0 0;
    opacity: 0.8;
}

.header-banner a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-block;
    margin-top: 15px;
}

.header-banner a:hover {
    color: var(--gold);
}

.blog-main.container {
    margin-top: 40px;
    margin-bottom: 40px;
}

.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 50px;
}

.pagination-btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: var(--text-light);
    color: var(--primary-blue);
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: all 0.3s;
}

.pagination-btn:hover {
    border-color: var(--primary-blue);
    background-color: var(--primary-blue);
    color: var(--text-light);
}

.pagination-btn.active {
    background-color: var(--gold);
    border-color: var(--gold);
    color: var(--text-light);
    pointer-events: none;
}

.pagination-disabled {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #eee;
    background-color: #f9f9f9;
    color: #ccc;
    border-radius: 4px;
    cursor: not-allowed;
}