/* ============================================================
   師資陣容 — 搜尋、篩選、靜態網格
   頁首、搜尋列、膠囊、結果數、空狀態一律沿用 main.css 既有元件
   （.page-header / .search-bar / .search-input / .search-btn /
    .case-module-tabs / .case-module-tab / .result-count / .empty-state）。
   這裡只放本頁版面與卡片；顏色與圓角全接 :root 變數。
   ============================================================ */

/* .case-module-tab 與 .th-faculty-card 自帶 display，會蓋掉 hidden 屬性 */
.th-page [hidden] {
    display: none !important;
}

/* ── 頁首：左文右數字 ─────────────────────────────────────── */
.th-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem 3rem;
    align-items: end;
    margin-bottom: 1.75rem;
}

.th-hero .page-header {
    margin-bottom: 0.6rem;
}

/* .page-header p 已全站隱藏，說明文字另放一個元素；值同 .page-header p */
.th-hero-lead {
    max-width: 600px;
    margin: 0;
    color: var(--color-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

.th-hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    padding-bottom: 0.4rem;
}

.th-stat {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.th-stat-num {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--color-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.th-stat-num span {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--color-accent);
    margin-left: 0.1em;
}

.th-stat-label {
    font-size: 0.78rem;
    color: var(--color-muted);
    letter-spacing: 0.1em;
}

/* ── 搜尋與篩選 ───────────────────────────────────────────── */
.th-filter {
    margin-bottom: 1.25rem;
}

.th-filter .case-module-tabs {
    margin-bottom: 1rem;
}

/* 新增：可切換的系所膠囊。外觀完全沿用 .case-module-tab，
   只補 <button> 沒有的手型游標與行高 */
button.case-module-tab {
    cursor: pointer;
    line-height: inherit; /* <a> 版繼承 body 1.6，button 預設 normal */
}

.th-search-bar {
    gap: 0.75rem;
}

.th-search-bar .search-input {
    flex: 1 1 auto;
    min-width: 0;
}

/* 有選專長時的高亮，值同 team_home.css .team-filter-select.active */
.th-search-bar .filter-select.active {
    border-color: var(--color-primary);
    background-color: #f4f8ff;
    color: var(--color-primary);
    font-weight: 600;
}

/* 最右邊的多選面板靠右對齊，面板比按鈕寬時不會超出內容欄 */
.th-search-bar .filter-multi:last-child .filter-multi-panel {
    left: auto;
    right: 0;
}

/* 兩個多選下拉的包裹層：桌機不佔版面，手機時變成一列兩格 */
.th-filter-selects {
    display: contents;
}

/* ── 網格 ─────────────────────────────────────────────────── */
.th-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
}

.th-more {
    margin-top: 1.5rem;
    text-align: center;
}

/* ── 教師卡 ───────────────────────────────────────────────── */
.th-faculty-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.22s, transform 0.22s;
}

/* 底部深藍細線，hover 時從左滑出 */
.th-faculty-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.22s ease;
}

.th-faculty-card:hover {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
    transform: translateY(-4px);
    color: inherit;
    text-decoration: none;
}

.th-faculty-card:hover::after {
    transform: scaleX(1);
}

/* 鍵盤焦點框：同 .team-card--clickable:focus-visible */
.th-faculty-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* 照片統一 4:5，cover 裁切 */
.th-faculty-photo {
    flex-shrink: 0;
    width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #eaf4fd;
}

.th-faculty-avatar {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.35s ease;
}

.th-faculty-card:hover .th-faculty-avatar {
    transform: scale(1.04);
}

/* 無照片：淺藍底（同 detail.css 專長標籤底色）置中放大姓氏，標題襯線字 */
.th-faculty-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-primary);
    font-family: var(--font-serif);
    font-size: clamp(2.6rem, 2rem + 2vw, 4rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.th-faculty-info {
    padding: 0.75rem 0.7rem 0.9rem;
    text-align: center;
}

.th-faculty-name {
    margin-bottom: 0.2rem;
    color: var(--color-primary);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.02em;
}

.th-faculty-position,
.th-faculty-dept {
    color: var(--color-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

/* 專長標籤：值同 detail.css .teacher-expertise-list span；
   全站專長標籤統一後改接共用 class 即可 */
/* ── 斷點：沿用 main.css 的 992 / 640 與團隊頁的 700 ────────── */
@media (max-width: 992px) {
    .th-hero {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .th-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .th-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }
}

/* 手機：四格數據改 2x2，避免 3+1 換行落單 */
@media (max-width: 640px) {
    /* 手機：英雄區收緊、統計數字排成一列細帶，讓第一排老師進第一屏 */
    .th-hero {
        gap: 1rem;
        margin-bottom: 1.25rem;
    }

    .th-hero-lead {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    .th-hero-stats {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.5rem;
        padding: 0.9rem 0 0;
        border-top: 1px solid var(--color-border);
    }

    .th-stat-num {
        font-size: 1.35rem;
    }

    .th-stat-num span {
        font-size: 0.8rem;
    }

    .th-stat-label {
        font-size: 0.7rem;
        letter-spacing: 0.02em;
    }

    /* 研究領域、專長兩個下拉並排一列 */
    .th-filter-selects {
        display: flex;
        gap: 0.75rem;
        width: 100%;
    }

    .th-filter-selects .filter-multi {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
    }

    .th-filter-selects .filter-multi > summary {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
