/* 國立中央大學哲學研究所 - 新版官網前端原型 */

/* ============================================== */
/* Design Tokens                                  */
/* ============================================== */

:root {
    --brand: #7a1515;
    --brand-strong: #5c0f0f;
    --brand-soft: #f6ebeb;
    --gold: #b08d57;
    /* 金色當文字用的版本。原本的 #b08d57 在白底只有 3.09:1，未達 WCAG AA 的 4.5:1。
       色相飽和度不變、只降明度到剛好達標（白底 4.77:1、米底 4.53:1）。
       框線與背景仍用 --gold，那些不受文字對比規範。 */
    --gold-text: #8b6e42;
    /* 深金。兩種用途都靠它：
       ① 金字放在 --gold-soft 的金底上（--gold-text 在那個底只剩 4.17:1，未達 AA；
          這個值是 5.04:1）
       ② 當實心膠囊的背景配白字（5.77:1） */
    --gold-deep: #7d6139;
    --gold-soft: #f5efe5;
    --gold-bright: #e5c896;

    --ink: #201c18;
    --ink-2: #57504a;
    /* 原為 #8a827a，白底 3.78:1 未達 AA。降到剛好過 4.5:1（白底 4.74、米底 4.50） */
    --ink-3: #79726b;
    --paper: #faf9f6;
    --surface: #ffffff;
    --line: #e7e3dc;
    /* 表格的列框線傳達資料結構，適用 WCAG 1.4.11 非文字對比（3:1）。
       原本的 --line 只有 1.28:1。純裝飾的分隔線仍用 --line——那類 WCAG 明文豁免。 */
    --line-strong: #9f8f72;
    --dark: #1d1916;

    --font-serif: 'Noto Serif TC', 'Songti TC', serif;
    --font-sans: 'Noto Sans TC', 'PingFang TC', sans-serif;
    --font-latin: 'Outfit', sans-serif;

    /* sticky 頁首實測 123px。錨點跳轉與 sticky 元件都要避開它，
       這個數字散在多處各自估的話一定會飄（踩過：估 96 與 100，兩個都太小）。 */
    --header-clear: 130px;

    --container: 1200px;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 3px rgba(32, 28, 24, 0.06);
    --shadow-md: 0 10px 30px rgba(32, 28, 24, 0.1);
    --shadow-lg: 0 24px 60px rgba(32, 28, 24, 0.18);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================== */
/* Base                                           */
/* ============================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.75;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

body.is-locked {
    overflow: hidden;
}

/* hidden 屬性必須贏過任何 display 設定 */
[hidden] {
    display: none !important;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--brand);
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

ul,
ol {
    list-style: none;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
    border-radius: 2px;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(20px, 4vw, 32px);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 300;
    background: var(--ink);
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    transform: translateY(-200%);
    transition: transform 0.2s var(--ease);
}

.skip-link:focus {
    transform: translateY(0);
}

/* ============================================== */
/* 按鈕                                           */
/* ============================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 26px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background 0.25s var(--ease), color 0.25s var(--ease),
        border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    background: var(--brand-strong);
}

.btn-light {
    background: #fff;
    color: var(--ink);
}

.btn-light:hover {
    background: var(--gold-soft);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-outline {
    border-color: var(--line);
    color: var(--brand);
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.btn-sm {
    padding: 8px 20px;
    font-size: 13.5px;
}

/* ============================================== */
/* 頁首                                           */
/* ============================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.topbar {
    background: var(--brand-strong);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 36px;
}

.topbar a {
    color: inherit;
    transition: color 0.2s var(--ease);
}

.topbar a:hover {
    color: #fff;
}

.topbar-univ-en {
    font-family: var(--font-latin);
    font-weight: 300;
    letter-spacing: 0.06em;
    opacity: 0.75;
    margin-left: 6px;
}

.topbar-links {
    display: flex;
    gap: 20px;
}

.navbar-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 86px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: block;
    flex-shrink: 0;
    object-fit: contain;
    /* 所徽中心為透明、「哲」字為白色：墊墨色圓底才能在白色頁首上顯示 */
    background: var(--dark);
    border-radius: 50%;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.brand-name {
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.04em;
}

.brand-sub {
    font-family: var(--font-latin);
    font-size: 10.5px;
    font-weight: 400;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ---- 主導覽與下拉選單 ---- */

.primary-nav > ul {
    display: flex;
    align-items: center;
    gap: clamp(0px, 0.6vw, 8px);
}

.primary-nav a,
.nav-group-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    font-size: 15.5px;
    /* a 繼承 body 1.75、button 用 UA 預設，需統一否則同列高度不齊 */
    line-height: 1.4;
    font-weight: 500;
    color: var(--ink-2);
    background: none;
    border: none;
    border-radius: 8px;
    transition: color 0.2s var(--ease), background 0.2s var(--ease);
    white-space: nowrap;
}

.primary-nav a:hover,
.nav-group-btn:hover {
    color: var(--brand);
    background: var(--brand-soft);
}

.primary-nav a.is-active,
.nav-group-btn.is-active {
    color: var(--brand);
    font-weight: 700;
}

.nav-group-btn svg {
    width: 13px;
    height: 13px;
    transition: transform 0.25s var(--ease);
}

.nav-group {
    position: relative;
}

.nav-group.is-open .nav-group-btn svg {
    transform: rotate(180deg);
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 10px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
    z-index: 60;
}

.nav-group.is-open .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown ul {
    display: flex;
    flex-direction: column;
}

.nav-dropdown a {
    display: block;
    padding: 9px 14px;
    font-size: 14.5px;
    border-radius: 8px;
    white-space: nowrap;
}

/* 修業課程 mega 選單 */
.nav-mega {
    display: flex;
    gap: 8px;
    padding: 18px;
    min-width: 640px;
}

.mega-col {
    min-width: 150px;
    padding: 0 10px;
}

.mega-col + .mega-col {
    border-left: 1px solid var(--line);
}

.mega-col-title {
    margin-bottom: 6px;
    padding: 0 14px;
}

.mega-col-title a {
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    padding: 0;
}

.mega-col-title a:hover {
    color: var(--brand);
    background: none;
}

.mega-col ul a {
    padding: 6px 14px;
    font-size: 13.5px;
    color: var(--ink-2);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 14px;
    color: var(--ink-2);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.search-trigger svg {
    width: 15px;
    height: 15px;
}

.search-trigger:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.menu-trigger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.menu-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 18px;
}

.menu-icon span {
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
}

/* ============================================== */
/* 首頁焦點輪播                                    */
/* ============================================== */

.hero {
    position: relative;
    height: clamp(480px, 66vh, 640px);
    background: var(--dark);
    overflow: hidden;
}

.hero-slides,
.hero-slide {
    position: absolute;
    inset: 0;
}

/* visibility 讓非作用中的頁真正退出鍵盤焦點順序與輔助科技，
   只用 opacity 的話裡面的連結仍可被 Tab 到（焦點會消失在看不見的地方） */
.hero-slide {
    opacity: 0;
    visibility: hidden;
    transition: opacity 1s var(--ease), visibility 1s var(--ease);
    pointer-events: none;
}

.hero-slide.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
}

.hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/*
 * 「完整顯示」的橫幅（海報、榜單、團照——圖本身就是內容，裁掉就看不懂）。
 * hero-img-contain 讓整張圖完整呈現不裁切；
 * hero-img-backdrop 是同一張圖的模糊放大版，鋪在底下填滿兩側，
 * 避免出現生硬的空白色塊。scale 是為了讓模糊的邊緣溢出容器外、不露出毛邊。
 */
.hero-img-contain {
    object-fit: contain;
}

.hero-img-backdrop {
    filter: blur(28px) brightness(0.75);
    transform: scale(1.15);
}

.hero-scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(18, 12, 10, 0.86) 0%, rgba(18, 12, 10, 0.35) 55%, rgba(18, 12, 10, 0.2) 100%),
        linear-gradient(100deg, rgba(66, 12, 12, 0.45) 0%, transparent 60%);
}

.hero-content {
    position: absolute;
    inset-inline: 0;
    left: 50%;
    transform: translateX(-50%);
    bottom: clamp(56px, 10vh, 96px);
    color: #fff;
    max-width: var(--container);
}

.hero-slide.is-active .hero-content > * {
    animation: hero-rise 0.8s var(--ease) both;
}

.hero-slide.is-active .hero-content > *:nth-child(2) { animation-delay: 0.08s; }
.hero-slide.is-active .hero-content > *:nth-child(3) { animation-delay: 0.16s; }
.hero-slide.is-active .hero-content > *:nth-child(4) { animation-delay: 0.24s; }

@keyframes hero-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.28em;
    color: var(--gold-bright);
    margin-bottom: 18px;
}

.hero-kicker::before {
    content: '';
    width: 36px;
    height: 1px;
    background: var(--gold-bright);
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(30px, 5vw, 52px);
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
    max-width: 22ch;
    text-wrap: balance;
}

.hero-title-dot {
    color: var(--gold-bright);
}

.hero-desc {
    font-size: clamp(14.5px, 1.4vw, 16.5px);
    font-weight: 300;
    color: rgba(255, 255, 255, 0.88);
    max-width: 560px;
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(20, 14, 12, 0.35);
    color: #fff;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s var(--ease), background 0.3s var(--ease);
}

.hero-arrow svg {
    width: 20px;
    height: 20px;
}

.hero:hover .hero-arrow,
.hero-arrow:focus-visible {
    opacity: 1;
}

@media (hover: none) {
    .hero-arrow {
        opacity: 1;
    }
}

.hero-arrow:hover {
    background: var(--brand);
    border-color: var(--brand);
}

.hero-arrow-prev { left: clamp(12px, 2.5vw, 28px); }
.hero-arrow-next { right: clamp(12px, 2.5vw, 28px); }

.hero-dots-wrap {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 24px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: flex-start;
}

/* 自動輪播需提供暫停手段：滑鼠移入／聚焦會暫停，但觸控使用者沒有這兩者 */
.hero-pause {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.hero-pause:hover,
.hero-pause:focus-visible {
    background: rgba(0, 0, 0, 0.55);
    border-color: #fff;
}

.hero-pause svg {
    width: 13px;
    height: 13px;
}

.hero-pause .hero-pause-icon-play,
.hero-pause.is-paused .hero-pause-icon-pause {
    display: none;
}

.hero-pause.is-paused .hero-pause-icon-play {
    display: block;
}

.hero-dots {
    display: flex;
    gap: 8px;
}

.hero-dot {
    width: 22px;
    height: 4px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    padding: 0;
    transition: background 0.3s var(--ease), width 0.3s var(--ease);
}

.hero-dot:hover {
    background: rgba(255, 255, 255, 0.7);
}

.hero-dot.is-active {
    width: 40px;
    background: var(--gold-bright);
}

/* ============================================== */
/* 內頁 Hero 與麵包屑                              */
/* ============================================== */

.page-hero {
    position: relative;
    padding: clamp(56px, 8vw, 96px) 0;
    background: var(--dark);
    color: #fff;
    overflow: hidden;
}

.page-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.page-hero-scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, rgba(24, 14, 12, 0.92) 20%, rgba(74, 16, 16, 0.72) 100%);
}

.page-hero-content {
    position: relative;
    max-width: 760px;
}

.page-hero-title {
    font-family: var(--font-serif);
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 900;
    letter-spacing: 0.06em;
    line-height: 1.3;
    margin-bottom: 12px;
    text-wrap: balance;
}

.page-hero-desc {
    font-size: 15.5px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    max-width: 620px;

    /*
     * 中文詞不要被拆到兩行（「攜手推廣哲／學普及」）。
     *
     * `keep-all` 讓連續的漢字視為一個不可斷的整體，斷行只發生在標點處——
     * 實測所友會那句會改成斷在「…職涯成就，」，完全不拆詞。
     * `text-wrap: balance` 解決不了：它只是把兩行長度拉平，實測仍會拆掉「聯絡網」。
     *
     * ⚠️ **`overflow-wrap: break-word` 不能拿掉**：單用 keep-all 的話，
     * 沒有標點的長句會整串撐出容器。實測最長的一段是 23 字 ≈ 356px，
     * 而手機的容器只有約 344px。這一行是「真的塞不下才拆」的退路。
     */
    word-break: keep-all;
    overflow-wrap: break-word;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 14px;
}

.breadcrumb a {
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.2s var(--ease);
}

.breadcrumb a:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.breadcrumb [aria-current] {
    color: var(--gold-bright);
}

.page-hero .hero-kicker {
    margin-bottom: 12px;
}

/* ---- 頁內分頁導覽（課程子頁） ---- */

.subnav-wrap {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}

.subnav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.subnav a {
    flex-shrink: 0;
    padding: 14px 18px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-2);
    border-bottom: 2px solid transparent;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.subnav a:hover {
    color: var(--brand);
}

.subnav a[aria-current] {
    color: var(--brand);
    font-weight: 700;
    border-bottom-color: var(--brand);
}

/* ============================================== */
/* 區塊與標題                                      */
/* ============================================== */

.section {
    padding: clamp(48px, 7vw, 88px) 0;
}

.section-alt {
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(40px, 5vw, 72px);
    align-items: start;
}

/* 右欄放直式海報卡片時：欄寬固定為卡片寬度，左欄吃掉剩餘空間，
   避免卡片右側出現空白、左右重量失衡 */
.split-poster {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: stretch;
}

/* 讓最新消息欄底部（分頁器）對齊右側「官方社群與影音」底部 */
.split-poster .split-main {
    display: flex;
    flex-direction: column;
}

.split-poster .split-main .site-pager {
    margin-top: auto;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 28px;
}

.section-head-gap {
    margin-top: 44px;
}

.section-kicker {
    font-family: var(--font-latin);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--gold-text);
    margin-bottom: 6px;
}

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(21px, 2.4vw, 26px);
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.4;
}

.section-more {
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    padding-bottom: 4px;
    transition: color 0.2s var(--ease);
}

.section-more:hover {
    color: var(--brand-strong);
}

[data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

[data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================== */
/* 內文排版（移植舊站內容用）                       */
/* ============================================== */

.prose {
    max-width: 820px;
    font-size: 15.5px;
    color: var(--ink-2);
}

.prose-wide {
    max-width: none;
}

.prose h2 {
    font-family: var(--font-serif);
    font-size: 23px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.04em;
    margin: 44px 0 16px;
    padding-left: 14px;
    border-left: 4px solid var(--brand);
    line-height: 1.4;
}

.prose h2:first-child {
    margin-top: 0;
}

.prose h3 {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    margin: 32px 0 12px;
}

.prose p {
    margin-bottom: 14px;
}

.prose ul,
.prose ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.prose ul {
    list-style: disc;
}

.prose ol {
    list-style: decimal;
}

.prose li {
    margin-bottom: 6px;
}

.prose li::marker {
    color: var(--brand);
}

.prose strong {
    color: var(--ink);
}

.prose .note {
    background: var(--gold-soft);
    border: 1px solid #e8dcc3;
    border-radius: var(--radius);
    padding: 16px 20px;
    font-size: 14px;
    margin: 20px 0;
}

.prose .lang-en {
    color: var(--ink-3);
    font-size: 14px;
}

/* 表格 */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    min-width: 560px;
}

.table-wrap th {
    background: var(--brand);
    color: #fff;
    font-weight: 500;
    text-align: left;
    padding: 12px 16px;
    white-space: nowrap;
}

.table-wrap td {
    padding: 11px 16px;
    border-top: 1px solid var(--line-strong);
    vertical-align: top;
    color: var(--ink-2);
}

.table-wrap tbody tr:nth-child(even) {
    background: var(--paper);
}

.table-wrap caption {
    caption-side: top;
    text-align: left;
    font-weight: 700;
    color: var(--ink);
    padding: 14px 16px 10px;
}

/* 下載連結列 */
.file-list {
    display: flex;
    flex-direction: column;
    margin: 20px 0;
}

.file-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 6px;
    border-bottom: 1px solid var(--line);
    font-size: 14.5px;
    color: var(--ink-2);
    transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.file-list a:first-child {
    border-top: 1px solid var(--line);
}

.file-list a::before {
    content: '↗'; /* 預設改用無彩色外部連結箭頭，以融入網頁品牌色 */
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 700;
}

/* 如果是 PDF / Word / Excel / ZIP 等檔案下載，自動切換為下載圖示 */
.file-list a[href$=".pdf"]::before,
.file-list a[href$=".docx"]::before,
.file-list a[href$=".doc"]::before,
.file-list a[href$=".xlsx"]::before,
.file-list a[href$=".xls"]::before,
.file-list a[href$=".zip"]::before,
.file-list a[href$=".rar"]::before,
.file-list a[href*="/file/"]::before,
.file-list a[href*="/docs/"]::before,
.file-list a[href*="pdc.adm.ncu.edu.tw/s/"]::before,
.file-list a[href*="pdc.adm.ncu.edu.tw/Form/"]::before {
    content: '↓';
}

.link-list a::before {
    content: '↗';
}

.file-list a:hover {
    color: var(--brand);
    background: var(--surface);
}

/* ============================================== */
/* 首頁元件                                        */
/* ============================================== */

.news-list {
    display: flex;
    flex-direction: column;
}

.news-item {
    display: flex;
    gap: 22px;
    padding: 24px 12px;
    border-bottom: 1px solid var(--line);
    border-radius: var(--radius);
    transition: background 0.25s var(--ease);
}

.news-item:first-child {
    border-top: 1px solid var(--line);
}

.news-item:hover {
    background: var(--surface);
}

.news-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    min-width: 56px;
    padding-top: 2px;
}

.news-date-day {
    font-family: var(--font-latin);
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
    color: var(--brand);
}

.news-date-month {
    font-size: 12px;
    color: var(--ink-3);
}

.news-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.news-tags {
    display: flex;
    gap: 8px;
}

.tag {
    font-size: 11.5px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 999px;
}

.tag-recruit { background: #eaf2fb; color: #2264ad; }
.tag-academic { background: #f3edfa; color: #7b3fb5; }
.tag-admin { background: #e9f5ee; color: #22794a; }
.tag-pinned { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.tag-alumni { background: var(--gold-soft); color: var(--gold-deep); }

/* 最新消息分類篩選列 */
.news-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.news-filter a {
    font-size: 13px;
    color: var(--ink-2);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 14px;
    text-decoration: none;
    transition: all 0.15s var(--ease);
}

.news-filter a:hover {
    background: var(--brand-soft);
    border-color: var(--brand);
    color: var(--brand);
}

.news-filter a.is-selected {
    background: var(--brand);
    color: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 4px 10px rgba(139, 0, 0, 0.25);
}

.news-headline {
    font-family: var(--font-serif);
    font-size: 17.5px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--ink);
}

.news-headline a {
    color: var(--ink);
    transition: color 0.2s var(--ease);
}

.news-headline a:hover {
    color: var(--brand);
}

/* 整塊 news-item 可點（外層為 <a>）：外觀不變，hover 時標題變色 */
a.news-item {
    color: inherit;
    text-decoration: none;
}

.news-item:hover .news-headline {
    color: var(--brand);
    transition: color 0.2s var(--ease);
}

/* 分頁器（頁碼＋省略號） */
.site-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 28px;
}

.pager-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-family: var(--font-latin);
    font-size: 14px;
    color: var(--ink-2);
    background: var(--surface);
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}

.pager-item:hover {
    border-color: var(--gold-text);
    color: var(--ink);
}

.pager-item.is-current {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 600;
}

.pager-item.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

.pager-gap {
    padding: 0 2px;
    color: var(--ink-3);
}

.news-excerpt {
    font-size: 14px;
    color: var(--ink-2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 快捷卡片 */
.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.card-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.card-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.quick-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color 0.25s var(--ease), transform 0.25s var(--ease),
        box-shadow 0.25s var(--ease);
}

.quick-card:hover {
    border-color: var(--brand);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.quick-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
}

.quick-icon svg {
    width: 22px;
    height: 22px;
}

.quick-card h3 {
    font-family: var(--font-serif);
    font-size: 16.5px;
    font-weight: 700;
    color: var(--ink);
}

.quick-card p {
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-2);
}

/* 最新活動卡片 */
/* 直式：預告用的多是 A4 海報，比例對齊可避免裁切。
   限寬避免右欄過重，與左側消息列表取得平衡 */
.activity-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    aspect-ratio: 1 / 1.414;
    max-width: 320px;
    background: var(--dark);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.activity-card:hover,
.activity-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* hover 時海報放大，外框尺寸與位置不動（靠 overflow: hidden 裁切） */
.activity-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease);
}

.activity-card:hover .activity-photo,
.activity-card:focus-visible .activity-photo {
    transform: scale(1.07);
}

/* 遮罩：平常只有底部漸層托住日期＋標題，hover 才加深並浮出說明 */
.activity-veil {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 6px;
    padding: 18px;
    color: #fff;
    background: linear-gradient(
        to top,
        rgba(29, 25, 22, 0.94) 0%,
        rgba(29, 25, 22, 0.8) 13%,
        rgba(29, 25, 22, 0.12) 32%,
        rgba(29, 25, 22, 0) 46%
    );
    transition: background 0.3s var(--ease);
}

.activity-card:hover .activity-veil,
.activity-card:focus-visible .activity-veil {
    background: linear-gradient(
        to top,
        rgba(29, 25, 22, 0.96) 0%,
        rgba(29, 25, 22, 0.92) 38%,
        rgba(29, 25, 22, 0.62) 52%,
        rgba(29, 25, 22, 0.12) 70%,
        rgba(29, 25, 22, 0) 82%
    );
}

.activity-date {
    font-family: var(--font-latin);
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--gold-bright);
}

.activity-title {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
    color: #fff;
}

/* 摘要與行動提示：預設收合，hover／鍵盤聚焦才展開。
   觸控裝置看不到說明無妨——海報本身已載明資訊，點進去即可 */
.activity-reveal {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.35s var(--ease), opacity 0.3s var(--ease);
}

.activity-card:hover .activity-reveal,
.activity-card:focus-visible .activity-reveal {
    grid-template-rows: 1fr;
    opacity: 1;
}

.activity-reveal > div {
    overflow: hidden;
    min-height: 0;
}

.activity-desc {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.86);
}

.activity-cta {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-bright);
}

/* 面板 */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: clamp(24px, 3vw, 36px);
}

.panel + .panel,
.news-list + .panel {
    margin-top: 28px;
}

.panel .section-head {
    margin-bottom: 20px;
}

.panel-note {
    background: var(--gold-soft);
    border-color: #e8dcc3;
}

.panel-note-title {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 10px;
}

.panel-note p {
    font-size: 14px;
    color: var(--ink-2);
}

/* ============================================== */
/* 師資卡片                                        */
/* ============================================== */

.teacher-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.teacher-card {
    display: flex;
    gap: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.teacher-card:hover {
    border-color: var(--gold-text);
    box-shadow: var(--shadow-md);
}

.teacher-card[data-href] {
    cursor: pointer;
}

.teacher-card[data-href]:hover {
    transform: translateY(-2px);
}

.teacher-photo {
    width: 104px;
    height: 128px;
    flex-shrink: 0;
    border-radius: var(--radius);
    object-fit: cover;
    object-position: top;
    background: var(--paper);
}

.teacher-info {
    min-width: 0;
}

.teacher-name {
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 700;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.teacher-title {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--gold-text);
}

.teacher-degree {
    font-size: 13.5px;
    color: var(--ink-3);
    margin: 4px 0 8px;
}

.teacher-field {
    font-size: 14px;
    color: var(--ink-2);
    margin-bottom: 8px;
}

.teacher-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 13px;
}

/* 電子郵件獨立一列，個人介紹／個人網站排在第二列。
   用 margin-right:100% 撐開右側強制換行，連結本身仍只有文字寬度（點擊範圍不外溢） */
.teacher-links a[href^="mailto:"] {
    margin-right: 100%;
    white-space: nowrap;
}

.teacher-links a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.teacher-group-title {
    font-family: var(--font-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--ink);
    margin: 44px 0 18px;
    padding-left: 14px;
    border-left: 4px solid var(--gold);
}

.teacher-group-title:first-child {
    margin-top: 0;
}

/* ============================================== */
/* 師資個人頁（單頁＋分頁籤）                          */
/* ============================================== */

.profile-layout {
    max-width: 940px;
}

/* 基本資料卡（常駐於分頁籤上方） */
.profile-header {
    padding-bottom: 32px;
    border-bottom: 1px solid var(--line);
}

/* 上方：照片 ＋ 姓名／英文名／職稱 左右並排、垂直置中 */
.profile-id {
    display: flex;
    align-items: center;
    gap: clamp(18px, 3vw, 30px);
}

.profile-photo {
    width: 132px;
    height: 168px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.profile-name {
    font-family: var(--font-serif);
    font-size: clamp(23px, 3vw, 30px);
    font-weight: 700;
    color: var(--ink);
}

.profile-name-en {
    display: block;
    margin-top: 3px;
    font-family: var(--font-latin);
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-3);
}

.profile-rank {
    margin-top: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--brand);
}

/* 下方：研究專長與聯絡資訊，全寬 */
.profile-detail {
    margin-top: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 14px;
    color: var(--ink-2);
}

.profile-field {
    line-height: 1.7;
}

.profile-field span,
.profile-contact span {
    display: inline-block;
    min-width: 68px;
    margin-right: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-3);
}

.profile-contact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* 分頁籤 */
.profile-tabs {
    margin-top: 28px;
}

.tablist {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 2px solid var(--line);
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    color: var(--ink-3);
    cursor: pointer;
    position: relative;
    top: 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.tab:hover {
    color: var(--ink);
}

.tab.is-active {
    color: var(--brand);
    font-weight: 700;
    border-bottom-color: var(--brand);
}

.tab:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px 4px 0 0;
}

.tabpanel {
    padding-top: 24px;
    animation: profile-fade 0.3s var(--ease);
}

.tabpanel[hidden] {
    display: none;
}

@keyframes profile-fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.profile-subhead {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin: 26px 0 12px;
    padding-left: 12px;
    border-left: 3px solid var(--gold);
}

.profile-subhead:first-child {
    margin-top: 0;
}

.profile-table {
    font-size: 14px;
}

.pub-single {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-2);
}

.pub-list,
.project-list {
    margin: 0;
    padding-left: 1.4em;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pub-list li,
.project-list li {
    font-size: 14px;
    line-height: 1.75;
    color: var(--ink-2);
}

.project-list {
    list-style: none;
    padding-left: 0;
    gap: 14px;
}

.project-name {
    font-weight: 600;
    color: var(--ink);
}

.project-meta {
    margin-top: 3px;
    font-family: var(--font-latin);
    font-size: 13px;
    color: var(--ink-3);
}

@media (max-width: 640px) {
    /* 手機：照片＋姓名職稱維持左右（.profile-id 本就是 flex），照片縮小 */
    .profile-header {
        padding-bottom: 24px;
    }

    .profile-photo {
        width: 96px;
        height: 122px;
    }

    .profile-name {
        font-size: 21px;
    }

    /* 下方聯絡/專長標籤改為上方獨立一行，避免窄欄擠壓 */
    .profile-field span,
    .profile-contact span {
        display: block;
        min-width: 0;
        margin-bottom: 1px;
    }

    .profile-contact a {
        word-break: break-all;
    }

    /* 分頁籤在窄螢幕可橫向捲動，不擠壓換行 */
    .tablist {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        white-space: nowrap;
    }
}

/* ============================================== */
/* 課程地圖（流程式呈現）                           */
/* ============================================== */

.flow-stage-title {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 18px;
}

.flow-stage-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

.flow-stage-title .flow-num {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-family: var(--font-latin);
    font-size: 16px;
    font-weight: 600;
}

.flow-arrow {
    text-align: center;
    color: var(--gold-text);
    font-size: 22px;
    margin: 14px 0 22px;
}

.course-groups {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}

.course-groups-1 {
    grid-template-columns: minmax(0, 1fr);
}

.course-groups-2 {
    grid-template-columns: 1fr 1fr;
}

.course-group-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 20px;
}

.course-group-card.is-primary {
    border-top-color: var(--brand);
}

.course-group-card h3 {
    font-family: var(--font-serif);
    font-size: 16.5px;
    font-weight: 700;
    margin-bottom: 12px;
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/*
 * 膠囊是**純標示、不可互動**。
 *
 * 原本點一下會 toggle 顏色，但那個狀態沒有任何用途（原型時期留下的），
 * 而且只有滑鼠點得到、鍵盤完全操作不了——等於用 cursor: pointer 和
 * hover 變色承諾了一個不存在的功能。已移除，連帶拿掉 main.js 的監聽。
 */
.pill-list li {
    font-size: 13px;
    color: var(--ink-2);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 12px;
    user-select: none;
}

/*
 * 三大方向做成**實心**、基礎課程維持外框。
 *
 * 一開始兩者都是外框、只換底色，但 --gold-soft 與 --paper 的差距只有 1.09:1，
 * 幾乎是同一個顏色——遮住小標就分不出來，等於沒解決「更好分這兩類」。
 * 實心之後兩者底色差 5.48:1。
 *
 * 實心也順便表達了層級：三大方向是分類，基礎課程是分類底下的課。
 *
 * ⚠️ 顏色仍然只是輔助，分類真正靠的是 .pill-group-title 那個小標——
 * 只靠顏色的話色盲使用者與黑白列印都分不出來（WCAG 1.4.1）。
 */
.pill-list.is-track li {
    background: var(--gold-deep);
    border-color: var(--gold-deep);
    color: var(--surface);
    font-weight: 500;
}

.pill-group + .pill-group {
    margin-top: 18px;
}

.pill-group-title {
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--ink-3);
    margin: 0 0 8px;
}

/* 卡片元件置於 .prose 內文時，隔絕內文的清單符號與標題間距 */
.prose .pill-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.prose .pill-list li {
    margin: 0;
}

.prose .course-group-card h3 {
    margin: 0 0 12px;
}

@media (max-width: 1080px) {
    .course-groups {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .course-groups,
    .course-groups-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ============================================== */
/* 學術活動：年份時間軸＋類型篩選                    */
/* ============================================== */

.tl-filters {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 8px;
}

.tl-filter {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink-2);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    transition: color 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.tl-filter:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.tl-filter.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 700;
}

.tl-count {
    font-size: 13px;
    color: var(--ink-3);
    margin-left: 4px;
}

.tl-decade-title {
    font-family: var(--font-latin);
    font-size: 30px;
    font-weight: 600;
    color: var(--brand);
    letter-spacing: 0.02em;
    margin: 44px 0 6px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--brand);
}

.tl-decade:first-of-type .tl-decade-title {
    margin-top: 24px;
}

.tl-year {
    font-family: var(--font-latin);
    font-size: 17px;
    font-weight: 600;
    color: var(--gold-text);
    margin: 24px 0 4px;
}

.tl-list {
    border-left: 2px solid var(--line);
    margin-left: 7px;
    padding-left: 22px;
}

.tl-item {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 18px;
    padding: 13px 0;
    border-bottom: 1px dashed var(--line);
}

.tl-item:last-child {
    border-bottom: none;
}

.tl-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 22px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    border: 2px solid var(--paper);
}

.tl-main {
    flex: 1;
    min-width: 0;
}

.tl-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.tl-cat {
    font-size: 11.5px;
    color: var(--ink-3);
}

.tl-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.6;
}

.tl-detail {
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.7;
    margin-top: 3px;
}

.tl-date {
    flex-shrink: 0;
    font-family: var(--font-latin);
    font-size: 13px;
    color: var(--ink-3);
    max-width: 220px;
    text-align: right;
}

@media (max-width: 640px) {
    .tl-item {
        flex-direction: column;
        gap: 2px;
    }

    .tl-date {
        text-align: left;
        max-width: none;
    }
}

/* ============================================== */
/* 手風琴（學術活動等長清單）                       */
/* ============================================== */

.acc-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.acc {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.25s var(--ease);
}

.acc[open] {
    border-color: var(--gold-text);
}

.acc summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 20px;
    font-size: 15.5px;
    font-weight: 500;
    color: var(--ink);
    cursor: pointer;
    list-style: none;
    transition: background 0.2s var(--ease);
}

.acc summary::-webkit-details-marker {
    display: none;
}

.acc summary:hover {
    background: var(--paper);
}

.acc summary::after {
    content: '＋';
    color: var(--ink-3);
    font-weight: 400;
    margin-left: auto;
}

.acc[open] summary::after {
    content: '－';
}

.acc-count {
    font-family: var(--font-latin);
    font-size: 12px;
    font-weight: 500;
    color: var(--gold-deep);
    background: var(--gold-soft);
    border-radius: 999px;
    padding: 1px 10px;
    margin-left: 4px;
}

.event-list {
    border-top: 1px solid var(--line);
    padding: 8px 20px 14px;
}

.event-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 14.5px;
}

.event-list li:last-child {
    border-bottom: none;
}

.event-main {
    flex: 1;
    min-width: 0;
}

.event-name {
    color: var(--ink-2);
}

/* 活動的詳細說明（場次、地點、講者等長內容）置於標題下方 */
.event-detail {
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.7;
    margin-top: 4px;
}

.event-date {
    flex-shrink: 0;
    font-family: var(--font-latin);
    font-size: 12.5px;
    color: var(--ink-3);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .event-list li {
        flex-direction: column;
        gap: 2px;
    }
}

/* ============================================== */
/* 相簿與照片                                      */
/* ============================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.gallery-item-wide {
    grid-column: span 2;
    aspect-ratio: 21 / 9;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s var(--ease);
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item figcaption {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 20px 14px 10px;
    font-size: 12.5px;
    color: #fff;
    background: linear-gradient(to top, rgba(18, 12, 10, 0.85), transparent);
}

.back-link {
    margin-top: 36px;
}

/* 長頁面：內文＋右側跳轉目錄（章程、簡介、表單下載等） */
.toc-layout,
.charter-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: clamp(32px, 4vw, 56px);
    align-items: start;
}

.charter-toc {
    position: sticky;
    top: var(--header-clear);
}

.toc-panel {
    padding: 22px 24px;
}

.toc-panel .section-kicker {
    margin-bottom: 10px;
}

.toc-panel ul {
    display: flex;
    flex-direction: column;
}

.toc-panel a {
    display: block;
    padding: 8px 10px;
    font-size: 14px;
    color: var(--ink-2);
    border-left: 2px solid var(--line);
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.toc-panel a:hover {
    color: var(--brand);
    border-left-color: var(--brand);
    background: var(--brand-soft);
}

/*
 * 錨點跳轉時避開 sticky 頁首。
 *
 * ⚠️ **不要只寫 `main h2[id]`。** 目錄連結指向的不一定是標題本身——
 * 空間介紹的 id 掛在 `<article class="space-row">` 上（整列是圖文並排，
 * 標題只是其中一格），只寫 h2 的話那一頁的目錄跳過去會被頁首蓋住，
 * 而且只有那一頁會這樣，很難聯想到是這條規則漏了。
 * 新增帶 id 的錨點區塊時記得回來加。
 */
main h2[id],
main .space-row[id] {
    scroll-margin-top: var(--header-clear);
}

@media (max-width: 1080px) {
    .toc-layout,
    .charter-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    /* 手機版目錄改置於內文上方 */
    .charter-toc {
        position: static;
        order: -1;
    }
}

/* 聯絡資訊清單 */
.contact-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    font-size: 14.5px;
    color: var(--ink-2);
}

.contact-list strong {
    display: block;
    font-size: 12.5px;
    color: var(--gold-text);
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}

/* 統計列（所友會等） */
.stats-row {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

.stats-row .stat {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    padding: 4px clamp(24px, 4vw, 48px);
}

.stats-row .stat + .stat {
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.stats-row dd {
    font-family: var(--font-latin);
    font-size: clamp(28px, 3.5vw, 38px);
    font-weight: 600;
    line-height: 1.1;
    color: #fff;
}

.stats-row dd span {
    color: var(--gold-bright);
}

.stats-row dt {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 6px;
}

/* 步驟清單 */
.steps-list {
    counter-reset: step;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.steps-list li {
    counter-increment: step;
    position: relative;
    padding-left: 48px;
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 2px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-family: var(--font-latin);
    font-size: 15px;
    font-weight: 600;
}

.steps-list h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}

.steps-list p {
    font-size: 13.5px;
    color: var(--ink-2);
}

/* ============================================== */
/* 頁尾                                            */
/* ============================================== */

.site-footer {
    background: var(--dark);
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
    margin-top: 40px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 0.8fr;
    gap: clamp(32px, 5vw, 64px);
    padding-block: clamp(48px, 6vw, 72px) 40px;
}

.footer-name {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.06em;
}

.footer-name-en {
    font-family: var(--font-latin);
    font-size: 12.5px;
    font-weight: 300;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 8px;
    line-height: 1.6;
}

.site-footer h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold-bright);
    letter-spacing: 0.12em;
    margin-bottom: 16px;
}

.site-footer li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.site-footer a {
    color: rgba(255, 255, 255, 0.72);
    transition: color 0.2s var(--ease);
}

.site-footer a:hover {
    color: #fff;
}

.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-block: 20px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.45);
}

/* 政策連結：用細分隔線取代直立線符號，讀屏軟體不會唸出多餘的「|」 */
.footer-policy {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
}

.footer-policy a {
    position: relative;
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-policy a + a::before {
    content: "";
    position: absolute;
    inset-block: 2px;
    left: -9px;
    width: 1px;
    background: rgba(255, 255, 255, 0.22);
}

.footer-policy a:hover,
.footer-policy a:focus-visible {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* 建議瀏覽器與版權：兩行右對齊，與左側政策連結分立 */
.footer-legal {
    text-align: right;
    line-height: 1.9;
}

.footer-legal p {
    margin: 0;
}

@media (max-width: 900px) {
    .footer-bottom {
        justify-content: flex-start;
    }

    .footer-legal {
        text-align: left;
    }
}

@media (max-width: 640px) {
    /* 右下角有「目錄」與「回到頂端」兩顆浮動鈕，footer 底部要讓開 */
    .footer-bottom {
        padding-bottom: 96px;
    }
}

/* ============================================== */
/* 搜尋視窗                                        */
/* ============================================== */

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(16px, 10vh, 96px) 20px 20px;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 18, 15, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.25s var(--ease);
}

.search-modal.is-open .search-modal-backdrop {
    opacity: 1;
}

.search-modal-panel {
    position: relative;
    width: 100%;
    max-width: 680px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.search-modal.is-open .search-modal-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.search-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 28px;
    border-bottom: 1px solid var(--line);
}

.search-modal-head h2 {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 700;
}

.search-modal-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink-2);
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.search-modal-close:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

.search-modal-close svg {
    width: 18px;
    height: 18px;
}

.search-modal-body {
    padding: 24px 28px 28px;
    overflow-y: auto;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border: 2px solid var(--line);
    border-radius: 999px;
    transition: border-color 0.2s var(--ease);
}

.search-field:focus-within {
    border-color: var(--brand);
}

.search-field svg {
    width: 18px;
    height: 18px;
    color: var(--ink-3);
    flex-shrink: 0;
}

.search-field input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 15.5px;
    padding: 13px 0;
    color: var(--ink);
}

.search-results {
    margin-top: 20px;
}

.search-placeholder {
    padding: 36px 20px;
    text-align: center;
    font-size: 14px;
    color: var(--ink-3);
    background: var(--paper);
    border-radius: var(--radius);
}

.search-count {
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: 4px;
}

.search-result {
    padding: 16px 4px;
    border-bottom: 1px solid var(--line);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result-cat {
    font-size: 12px;
    font-weight: 500;
    color: var(--gold-text);
}

.search-result h3 {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 700;
    margin: 4px 0;
}

.search-result h3 a {
    color: var(--ink);
}

.search-result h3 a:hover {
    color: var(--brand);
}

/*
 * 只給彈窗的摘要用。**要排除 .search-result-cat**——
 * `.search-result > p` 的特異度（0,1,1）贏過 `.search-result-cat`（0,1,0），
 * 不排除的話分類標籤宣告的 12px 永遠套不上，會被這裡的 13.5px 蓋掉。
 */
.search-result > p:not(.search-result-cat) {
    font-size: 13.5px;
    color: var(--ink-2);
}

/*
 * 搜尋結果頁（`/search`）的標題與摘要。
 *
 * 彈窗用 `<h3>`、結果頁用 `<h2 class="search-result-title">`，兩者結構不同。
 * 少了這兩條規則時，結果頁的標題會落回瀏覽器預設的 h2——**黑體 24px**，
 * 跟全站標題一律用明體的慣例不符，字級也過大。
 *
 * 對齊的對象是消息列表（`.news-headline` 17.5px／`.news-excerpt` 14px），
 * 那才是同性質的整頁清單；彈窗是壓縮版，字級刻意小一點。
 */
.search-result-title {
    font-family: var(--font-serif);
    font-size: 17.5px;
    font-weight: 700;
    line-height: 1.5;
    margin: 4px 0;
    color: var(--ink);
}

.search-result-title a {
    color: var(--ink);
    transition: color 0.2s var(--ease);
}

.search-result-title a:hover {
    color: var(--brand);
}

.search-result-excerpt {
    font-size: 14px;
    line-height: 1.7;
    color: var(--ink-2);
}

.search-result mark {
    background: #f8e9c8;
    color: #7a5a1e;
    border-radius: 3px;
    padding: 0 2px;
}

/* ============================================== */
/* 行動版導覽抽屜                                   */
/* ============================================== */

.drawer {
    position: fixed;
    inset: 0;
    z-index: 400;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 18, 15, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s var(--ease);
}

.drawer.is-open .drawer-backdrop {
    opacity: 1;
}

.drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(340px, 88vw);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    padding: 20px 24px 28px;
    transform: translateX(100%);
    transition: transform 0.3s var(--ease);
    overflow-y: auto;
}

.drawer.is-open .drawer-panel {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
}

.drawer-title {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: var(--ink-3);
}

.drawer-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink-2);
}

.drawer-close svg {
    width: 18px;
    height: 18px;
}

.drawer-link,
.drawer-group summary {
    display: block;
    padding: 13px 8px;
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    list-style: none;
    transition: color 0.2s var(--ease);
}

.drawer-group summary::-webkit-details-marker {
    display: none;
}

.drawer-group summary::after {
    content: '＋';
    float: right;
    color: var(--ink-3);
    font-weight: 400;
}

.drawer-group[open] summary::after {
    content: '－';
}

.drawer-link:hover,
.drawer-group summary:hover {
    color: var(--brand);
}

.drawer-group > ul {
    padding: 6px 0 10px;
    border-bottom: 1px solid var(--line);
}

.drawer-group > ul a {
    display: block;
    padding: 8px 8px 8px 22px;
    font-size: 14.5px;
    color: var(--ink-2);
}

.drawer-group > ul a:hover {
    color: var(--brand);
}

.drawer-subgroup > p {
    padding: 8px 8px 2px 22px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold-text);
}

.drawer-subgroup a {
    padding-left: 34px !important;
}

.drawer-search {
    margin-top: 24px;
}

/* ============================================== */
/* RWD                                             */
/* ============================================== */

@media (max-width: 1080px) {
    .primary-nav {
        display: none;
    }

    .menu-trigger {
        display: flex;
    }

    .split,
    .split-poster {
        grid-template-columns: minmax(0, 1fr);
    }

    .card-grid-3,
    .card-grid-4 {
        grid-template-columns: 1fr 1fr;
    }

    .teacher-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .album-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .topbar-univ-en {
        display: none;
    }

    .topbar-links {
        display: none;
    }

    .brand {
        min-width: 0;
        max-width: calc(100% - 54px);
        flex-shrink: 1;
    }

    .brand-text {
        min-width: 0;
    }

    .nav-actions {
        position: absolute;
        top: 50%;
        right: 20px;
        transform: translateY(-50%);
        flex-shrink: 0;
    }

    .search-trigger {
        display: none;
    }

    .brand-name {
        display: block;
        font-size: 17px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        overflow-wrap: break-word;
    }

    .brand-sub {
        display: none;
    }

    .hero {
        height: clamp(440px, 78vh, 560px);
    }

    .hero-content {
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        padding-inline: 20px;
    }

    /*
     * 手機版 .hero-content 是滿寬的，而 .hero-arrow 是 top:50% 絕對定位，
     * 兩者必然重疊——箭頭會壓在標題上（桌機因為要滑過才顯示所以看不出來）。
     * 手機改用底部圓點切換橫幅，圓點本身可點，導航不受影響。
     */
    .hero-arrow {
        display: none;
    }

    .hero-kicker {
        letter-spacing: 0.18em;
    }

    .hero-title,
    .hero-desc,
    .page-hero-title,
    .page-hero-desc {
        width: 100%;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-all;
    }

    .section-head {
        align-items: flex-start;
    }

    .section-more,
    .news-headline,
    .news-excerpt {
        overflow-wrap: anywhere;
        word-break: break-all;
    }

    .hero-actions .btn {
        padding: 11px 20px;
        font-size: 14px;
    }

    .news-item {
        gap: 14px;
        padding: 20px 4px;
    }

    .quick-grid,
    .card-grid-3,
    .card-grid-4,
    .album-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    /* 單欄時限寬會與其他區塊右緣參差，改為滿寬 */
    .activity-card {
        max-width: none;
    }

    .teacher-card {
        flex-direction: row-reverse;
        padding: 18px;
        gap: 14px;
    }

    .teacher-photo {
        width: 84px;
        height: 104px;
    }

    .stats-row .stat {
        padding-inline: 16px;
    }

    .footer-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }
}

/* ============================================== */
/* 減少動態偏好：停用非必要動效                      */
/* ============================================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-reveal] {
        opacity: 1;
        transform: none;
    }
}

/* 回到頂部按鈕 */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--surface);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: grid;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
    z-index: 99;
}

.back-to-top svg {
    width: 20px;
    height: 20px;
}

.back-to-top:hover {
    background: var(--gold);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}


/* ---------- 手機版章節目錄：浮動按鈕 + 彈出選單（桌機維持側邊欄） ---------- */
.toc-fab { display: none; }
.toc-sheet { display: none; }

@media (max-width: 1080px) {
    /* 手機改用浮動按鈕，隱藏內嵌目錄 */
    .toc-layout .charter-toc,
    .charter-layout .charter-toc { display: none; }

    .toc-fab {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        position: fixed;
        /* 與「回到頂端」同在右側直向堆疊：目錄在上、回到頂端在下（bottom 30px、高 44px）。
           30 + 44 + 12 = 86，留一個按鈕的間距。 */
        right: 30px;
        bottom: 86px;
        z-index: 60;
        padding: 12px 18px;
        border-radius: 999px;
        border: none;
        background: var(--brand);
        color: #fff;
        font-size: 14px;
        font-weight: 600;
        box-shadow: var(--shadow-md);
        cursor: pointer;
    }
    .toc-fab svg { width: 18px; height: 18px; }

    .toc-sheet.is-open { display: block; }
    .toc-sheet-backdrop {
        position: fixed; inset: 0; z-index: 110;
        background: rgba(0, 0, 0, 0.4);
    }
    .toc-sheet-panel {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 111;
        max-height: 72vh; overflow-y: auto;
        background: var(--surface);
        border-radius: 16px 16px 0 0;
        padding: 4px 8px 16px;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
    }
    .toc-sheet-head {
        display: flex; align-items: center; justify-content: space-between;
        padding: 14px 14px 8px;
        font-family: var(--font-serif); font-weight: 700; font-size: 16px;
    }
    .toc-sheet-close {
        border: none; background: none; cursor: pointer;
        font-size: 20px; line-height: 1; color: var(--ink-2); padding: 4px 8px;
    }
    .toc-sheet-body ul { display: flex; flex-direction: column; }
    .toc-sheet-body a {
        display: block; padding: 12px 14px; font-size: 15px;
        color: var(--ink); border-left: 2px solid var(--line);
    }
    .toc-sheet-body a:active { background: var(--brand-soft); border-left-color: var(--brand); }
}

/* 念臺書苑「活動集錦」底下的系列標題。
   原本是 h4 + 行內樣式，但上一層是 h2，跳級會讓螢幕閱讀器的大綱斷掉，改為 h3。 */
.niantai-series-title {
    margin-top: 0;
    color: var(--gold-text);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 6px;
    font-weight: 600;
    text-align: center;
}

/* ---------- 研究領域地圖 ---------- */

/* 與下方師資卡片隔開；狀態文字與「顯示全部」按鈕都在這一區的最底下 */
.research-filters {
    margin-bottom: 28px;
}

.research-group {
    margin-bottom: 22px;
}

.research-group-title {
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-3);
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.research-status {
    font-size: 14px;
    color: var(--ink-2);
    margin: 18px 0 0;
}

.research-reset {
    margin-top: 12px;
}

.research-areas {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 10px;
}

/* 標籤本身可點，等同上方的篩選鈕 */
.tag-area {
    cursor: pointer;
    background: var(--paper-2, #f2efe9);
    color: var(--ink-2);
    border: 1px solid var(--line);
}

.tag-area:hover {
    border-color: var(--gold-text);
    color: var(--gold-text);
}

.research-empty,
.research-note {
    font-size: 14px;
    color: var(--ink-3);
    margin-top: 24px;
}

.research-note {
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

/* 與目前選取沒有交集的領域：點不下去，但仍看得到（讓人知道還有這個領域存在） */
.tl-filter.is-unavailable {
    opacity: 0.38;
    cursor: not-allowed;
}

.tl-filter.is-unavailable:hover {
    border-color: var(--line);
    color: var(--ink-2);
}

.tag-area.is-picked {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

/* 搜尋彈窗的類別篩選 */
.search-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.search-filters .tl-filter {
    padding: 6px 14px;
    font-size: 13.5px;
    cursor: pointer;
}

/* ── 活動行事曆（/events）──────────────────────────────
   月曆格子 ＋ 該月活動清單。月份由網址參數決定，這裡只負責外觀。 */

/*
 * 桌機左右分欄、手機上下堆疊。
 *
 * 月曆刻意固定在窄欄：拉滿 860px 的話格子會變成 118×52 的扁長方塊，
 * 數字浮在大片空白裡像試算表。窄欄讓格子接近正方形，才讀得出是行事曆。
 */
.events-layout {
    max-width: 1060px;
    display: grid;
    grid-template-columns: 344px 1fr;
    gap: 48px;
    align-items: start;
}

/* 清單比月曆長很多，捲動時月曆跟著黏住才不會捲到一半失去月份脈絡 */
.events-layout > .cal {
    position: sticky;
    top: var(--header-clear);
}

.events-list {
    min-width: 0;
}

.cal {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px 16px 12px;
}

.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.cal-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0;
}

.cal-title-year {
    font-family: var(--font-latin);
    font-size: 15px;
    letter-spacing: 0.08em;
    color: var(--ink-3);
}

.cal-title-month {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
}

/* 翻月的箭頭。到頭時保留位置但變灰——直接抽掉的話標題會左右跳動 */
.cal-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    color: var(--ink-2);
    transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.cal-nav svg {
    width: 18px;
    height: 18px;
}

.cal-nav:hover {
    background: var(--gold-soft);
    border-color: var(--gold);
    color: var(--brand);
}

.cal-nav.is-off {
    color: var(--line);
    border-color: var(--line);
}

.cal-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 8px;
}

.cal-grid th {
    padding: 10px 0;
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink-3);
}

/* 星期標題用 abbr 帶完整讀音給螢幕閱讀器，但不要瀏覽器預設的虛線底線 */
.cal-grid th abbr {
    text-decoration: none;
    border: 0;
}

.cal-day {
    height: 44px;
    text-align: center;
    vertical-align: middle;
    padding: 0;
}

.cal-day-num {
    font-family: var(--font-latin);
    font-size: 14.5px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
}

.cal-day.is-outside {
    /* 上下月的空格。不留白是因為格線對齊比「畫滿」重要 */
    background: transparent;
}

/* 今天：只描一圈，不填色——填色會跟「有活動」的格子搶注意力 */
.cal-day.is-today .cal-day-num {
    color: var(--brand);
    font-weight: 700;
}

.cal-day.is-today {
    box-shadow: inset 0 0 0 1px var(--gold);
    border-radius: 10px;
}

/* 每一格（不論有沒有活動）都用這個盒子，置中方式才一致 */
.cal-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    border-radius: 10px;
}

.cal-day.has-events .cal-cell {
    background: var(--gold-soft);
    transition: background-color 0.2s var(--ease);
}

.cal-day.has-events .cal-day-num {
    color: var(--brand);
    font-weight: 700;
}

/* 絕對定位：放在文件流裡的話會把日期數字往上頂，
   同一列有活動與沒活動的數字就對不到同一條基線。 */
.cal-dots {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
}

.cal-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold-text);
}

.cal-day.has-events .cal-cell:hover {
    background: var(--brand-soft);
}

.cal-day.has-events .cal-cell:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* 已結束的活動：淡化但仍可點。整格拿掉會讓人以為那天沒事發生過 */
.cal-day.is-past .cal-cell {
    background: var(--paper);
}

.cal-day.is-past .cal-day-num {
    color: var(--ink-3);
    font-weight: 500;
}

.cal-day.is-past .cal-dot {
    background: var(--ink-3);
}

.events-list-title {
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 4px;
}

.events-list-title + .news-list {
    margin-bottom: 32px;
}

.events-empty {
    font-size: 14px;
    color: var(--ink-3);
    padding: 8px 0 24px;
}

/* 清單裡已結束的那幾筆，與月曆的淡化互相呼應 */
.news-item.is-past .news-date,
.news-item.is-past .news-headline {
    color: var(--ink-3);
}

.tag-done {
    background: #efece7;
    color: var(--ink-2);
}

/* 從月曆點日期跳下來時，錨點不要被固定頁首蓋住 */
.news-item[id] {
    scroll-margin-top: var(--header-clear);
}

@media (max-width: 960px) {
    .events-layout {
        grid-template-columns: 1fr;
        max-width: 560px;
        gap: 32px;
    }

    /* 堆疊之後黏住只會擋住清單 */
    .events-layout > .cal {
        position: static;
    }
}

@media (max-width: 640px) {
    .cal {
        padding: 16px 10px 8px;
    }

    /* 48 − 上下各 1px 內距 ≈ 46px 的可點高度，達到觸控目標的建議值 */
    .cal-day {
        height: 48px;
    }

    .cal-title-month {
        font-size: 21px;
    }
}


/* ── 空間介紹（/about/space）────────────────────────────
   一列一個空間，圖文左右並排、逐列對調。 */

.space-row {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 32px;
    align-items: center;
    padding: 40px 0;
    border-bottom: 1px solid var(--line);
}

.space-row:first-child {
    padding-top: 0;
}

/* 逐列對調，避免三列長得一模一樣。用 direction 而非改 order，
   讓鍵盤與讀屏的順序維持「圖→文」不受影響。 */
.space-row:nth-child(even) {
    direction: rtl;
}

.space-row:nth-child(even) > * {
    direction: ltr;
}

.space-media img,
.space-media-empty {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    object-fit: cover;
}

/* 照片輪播。**橫捲是 CSS scroll-snap 做的，不是 JS**——關掉 JS 一樣能用手指滑、
   用觸控板橫捲，箭頭與圓點只是加上去的快捷鍵，所以預設藏起來，
   由 main.js 掛上 .is-enhanced 之後才顯示。 */
.space-carousel {
    position: relative;
}

.space-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    border-radius: var(--radius);
    scrollbar-width: none;   /* 有圓點與箭頭了，捲軸只是雜訊 */
}

.space-track::-webkit-scrollbar {
    display: none;
}

/* 圓角交給外層的 .space-track，每張自己不要再圓——捲到一半時
   會看到相鄰兩張各自的圓角在中間對切，像破圖 */
.space-track img {
    scroll-snap-align: center;
    border-radius: 0;
}

/* 左右箭頭與圓點：沒有 JS 就沒有作用，所以沒有 .is-enhanced 時不要顯示 */
.space-nav,
.space-dots,
.space-count {
    display: none;
}

.space-carousel.is-enhanced .space-nav,
.space-carousel.is-enhanced .space-count {
    display: flex;
}

.space-carousel.is-enhanced .space-dots {
    display: flex;
}

.space-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .88);
    color: var(--ink);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
    cursor: pointer;
    transition: background .2s ease;
}

.space-nav:hover {
    background: #fff;
}

/* 到頭到尾的箭頭會被 JS 停用。淡掉但不隱藏——整顆消失會讓版面跳動，
   也讓人以為輪播壞了 */
.space-nav:disabled {
    opacity: .35;
    cursor: default;
}

.space-nav svg {
    width: 18px;
    height: 18px;
}

.space-nav-prev { left: 10px; }
.space-nav-next { right: 10px; }

/* 「2 / 3」。用 role="status" 讓讀屏軟體也知道換到第幾張了。
   ⚠️ **靠左下，不要靠右下**：手機上右下角有浮動的「目錄」與「回到頂端」兩顆鈕，
   它們是 fixed 的，捲到某些位置就會正好蓋住張數。 */
.space-count {
    position: absolute;
    left: 10px;
    bottom: 10px;
    margin: 0;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 12px;
    letter-spacing: .04em;
}

.space-dots {
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.space-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--line-strong);
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.space-dot.is-active {
    background: var(--gold-text);
    transform: scale(1.35);
}

/* 還沒有照片時的佔位。撐住比例，整列才不會塌成一條 */
.space-media-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--gold-soft);
    border: 1px dashed var(--gold);
    color: var(--gold-deep);
    font-size: 13.5px;
}

.space-media-empty svg {
    width: 32px;
    height: 32px;
}

.space-name {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 10px;
}

.space-loc {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--gold-text);
}

.space-intro {
    font-size: 15px;
    line-height: 1.85;
    color: var(--ink-2);
    margin: 0;
}

@media (max-width: 720px) {
    .space-row,
    .space-row:nth-child(even) {
        grid-template-columns: 1fr;
        gap: 20px;
        direction: ltr;
    }

    .space-name {
        font-size: 21px;
    }
}

/* ── 公告內文裡的表格 ────────────────────────────────
   舊站公告的表格帶著寫死的寬度（實測 840px、690px），而 .prose 原本沒有任何
   table 規則，手機上會把整頁撐寬。

   ⚠️ **只能用 CSS 解**：這些表格存在資料庫裡、由 TinyMCE 產生，
   不可能要求所辦手動加捲動容器，也不該在渲染時改寫內文。

   display:block ＋ overflow-x:auto 讓表格自己成為捲動容器；
   內部的列與格仍照表格演算法排版，所以資料不會擠成一團。 */

/*
 * ⚠️ **每一條都要帶 `:not(.table-wrap table)`。**
 *
 * 這一組規則的對象是**資料庫裡、由 TinyMCE 產生的公告內文表格**，
 * 不是我們自己在樣板裡排版的 `.table-wrap`（深紅表頭＋白字＋斑馬列的元件）。
 * 少了這個排除，兩者會撞在一起，而且是**看不出是衝突**的撞法：
 *
 *   `.prose table th`（0,1,2）贏過 `.table-wrap th`（0,1,1）→ 只搶走背景，
 *   深紅底變成近白的 --gold-soft；但文字色 `#fff` 仍來自 `.table-wrap th`，
 *   於是變成**白字白底、對比 1.07:1**，表頭整排消失。
 *
 * 踩過：2026-09-11 加這組規則時沒排除，12 個頁面的表頭同時看不見，
 * 而畫面上只是「標題不見了」，完全不像 CSS 疊加問題。
 * 順帶也讓 `.table-wrap` 裡的表格多長出一層捲動容器（容器裡又一個捲動容器）。
 */
.prose table:not(.table-wrap table) {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border-collapse: collapse;
    font-size: 14.5px;
}

/*
 * 欄數多的表格改成「可橫向捲動」，而不是硬擠進視埠。
 *
 * ⚠️ **min-width 要下在 tbody，不能下在 table 上。**
 * table 本身是捲動容器（display:block ＋ overflow-x:auto ＋ max-width:100%），
 * 而 CSS 的 min-width **優先於 max-width**——直接給 table 設 min-width:560px 的話，
 * 容器自己就變成 560px 撐寬整個頁面，比擠還糟（踩過）。
 * 下在 tbody 才是「內容比容器寬」，捲軸才會真的出現。
 *
 * 用 `:has()` 只對 5 欄以上的表格設限：2–3 欄本來就塞得下，
 * 一律給 min-width 反而逼出不必要的橫向捲動。
 * 不支援 `:has()` 的瀏覽器會忽略這條，退回「擠但不破版」，不會壞掉。
 */
.prose table:not(.table-wrap table):has(td:nth-child(5)) > tbody,
.prose table:not(.table-wrap table):has(th:nth-child(5)) > tbody {
    display: table;
    min-width: 560px;
}

.prose table:not(.table-wrap table) th,
.prose table:not(.table-wrap table) td {
    border: 1px solid var(--line-strong);
    padding: 8px 12px;
    vertical-align: top;
}

.prose table:not(.table-wrap table) th {
    background: var(--gold-soft);
    font-weight: 500;
    text-align: left;
}

/* 舊公告的 <td> 常帶寫死的 width，手機上會逼出過寬的欄。
   不直接覆蓋成 auto——那會讓刻意設定的欄寬比例失效——只擋住極端值。 */
@media (max-width: 640px) {
    .prose table:not(.table-wrap table) td[width],
    .prose table:not(.table-wrap table) td[style*="width"] {
        max-width: 60vw;
    }
}

/* ── 公告內文的長網址 ────────────────────────────────
   所辦常直接把網址貼成連結文字。網址沒有空白，瀏覽器找不到斷行點，
   在手機上會整條衝出視埠、把頁面撐寬。實測顯示中的公告有 73 處這樣的連結，
   最長 67 字元——這不是單一公告的問題，是通則。

   `anywhere` 而非 `break-word`：後者在某些排版情境下不影響最小內容寬度，
   長網址仍可能撐開容器。 */

.prose a {
    overflow-wrap: anywhere;
}

/* 內文其餘文字只在真的會溢出時才斷，避免中英夾雜處出現不必要的斷行 */
.prose {
    overflow-wrap: break-word;
}

/* ── 區段索引頁的子連結（/course）──────────────────
   沿用 .course-group-card 的外框，但卡片標題在索引頁是 h2 而非 h3
   （h1 之下就是它，用 h3 會跳級，AccessibilityTest 會擋）。 */

.course-group-card h2 {
    font-family: var(--font-serif);
    font-size: 17.5px;
    font-weight: 700;
    margin: 0 0 12px;
}

.course-group-card h2 a {
    color: var(--ink);
    transition: color 0.2s var(--ease);
}

.course-group-card h2 a:hover {
    color: var(--brand);
}

/* 站內連結，刻意不用 .link-list——那個會自動加上代表外部連結的 ↗ */
.section-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.section-links a {
    display: block;
    padding: 7px 0;
    font-size: 14.5px;
    color: var(--ink-2);
    border-bottom: 1px solid var(--line);
    transition: color 0.2s var(--ease), padding-left 0.2s var(--ease);
}

.section-links li:last-child a {
    border-bottom: 0;
}

.section-links a:hover {
    color: var(--brand);
    padding-left: 4px;
}

/* 手機加大可點範圍：桌機 40px 夠用，但觸控建議 44px 以上，
   也與站上 .file-list 的 46px 一致 */
@media (max-width: 640px) {
    .section-links a {
        padding: 10px 0;
    }
}
