/* ============================================================
   I-Chung Lu — Academic Website
   手寫 CSS，無框架依賴。改樣式只需動這個檔案。
   ============================================================ */

:root {
  --ink:        #16202b;
  --ink-soft:   #4a5764;
  --ink-faint:  #7d8996;
  --line:       #e2e6ea;
  --line-soft:  #f0f2f4;
  --bg:         #ffffff;
  --bg-soft:    #f7f9fa;
  --accent:     #14607a;
  --accent-dim: #e6f0f3;
  --highlight:  #b8860b;
  --max:        920px;
  --radius:     6px;
  /* 標題用襯線。拉丁字母載入 Source Serif 4（檔案小），
     中日韓字元一律交給系統既有的宋體，不從網路下載 CJK 字型，
     否則光是一套中文襯線就要幾 MB。 */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
          "PingFang TC", "Microsoft JhengHei", Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia,
           "Songti TC", "Noto Serif CJK TC", "Noto Serif TC", "Source Han Serif TC",
           "PMingLiU", "MingLiU", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:        #e8edf1;
    --ink-soft:   #a9b4bf;
    --ink-faint:  #7d8996;
    --line:       #2a3540;
    --line-soft:  #202932;
    --bg:         #131a21;
    --bg-soft:    #182028;
    --accent:     #5fb3ce;
    --accent-dim: #1c2f38;
    --highlight:  #d9a441;
  }
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* 鍵盤使用者的跳過導覽連結：平常收在畫面外，聚焦時才出現 */
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--bg); color: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 9px 16px; font-size: 0.9rem; transition: top .15s ease;
}
.skip:focus { top: 12px; text-decoration: none; }

/* 回到頂端 */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; pointer-events: none;
  transform: translateY(8px); transition: opacity .22s ease, transform .22s ease;
  box-shadow: 0 2px 10px rgba(22, 32, 43, .07);
}
.to-top.on { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
.to-top svg { width: 19px; height: 19px; }

/* ---------- Header / nav ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 50;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: 62px; flex-wrap: wrap;
}
.brand { font-weight: 650; letter-spacing: -0.01em; color: var(--ink); font-size: 1.02rem; }
.brand span { color: var(--ink-faint); font-weight: 400; margin-left: 8px; font-size: 0.9rem; }
.brand:hover { text-decoration: none; }

nav.main a {
  color: var(--ink-soft);
  margin-left: 20px;
  font-size: 0.94rem;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
nav.main a:hover { color: var(--ink); text-decoration: none; }
nav.main a.active { color: var(--ink); border-bottom-color: var(--accent); }

/* 語言切換 */
nav.main a.lang {
  margin-left: 22px; padding: 3px 12px; border: 1px solid var(--line);
  border-radius: 100px; font-size: 0.82rem; font-weight: 600;
  color: var(--ink-soft); background: var(--bg-soft);
}
nav.main a.lang:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-dim); text-decoration: none;
}

/* ---------- Hero ---------- */
.hero { padding: 56px 0 40px; border-bottom: 1px solid var(--line); }
.hero-grid { display: grid; grid-template-columns: 168px 1fr; gap: 36px; align-items: start; }
.hero-photo {
  width: 168px; height: 168px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--line);
}
.hero h1 { margin: 0 0 6px; font-size: 2.1rem; letter-spacing: -0.02em; line-height: 1.15; }
.hero .zh-name { color: var(--ink-faint); font-weight: 400; font-size: 1.15rem; margin-left: 10px; }
.hero .role { color: var(--ink-soft); margin: 0 0 18px; font-size: 1.02rem; }
.hero .lede { font-size: 1.06rem; color: var(--ink); margin: 0 0 22px; }

/* ---------- 首頁主視覺 ----------
   左文右圖，底部一條淡質譜峰線。主持人介紹在團隊頁，不佔第一眼。 */
.home-hero { padding: 66px 0 54px; position: relative; overflow: hidden; }
.hero-spectrum {
  position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 132px;
  pointer-events: none; stroke: var(--accent); stroke-width: 1.4; opacity: .17;
}
.hero-spectrum .baseline { stroke-width: 1; }
.home-grid {
  display: grid; grid-template-columns: 1.12fr 1fr; gap: 46px;
  align-items: center; position: relative;
}
.home-hero .eyebrow {
  font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 16px; font-weight: 600;
}
.home-hero .claim {
  font-family: var(--serif);
  margin: 0 0 18px; font-size: 2.5rem; line-height: 1.28;
  letter-spacing: -0.012em; font-weight: 600;
}
.home-hero .claim-lede {
  font-size: 1.04rem; color: var(--ink-soft);
  margin: 0 0 26px; text-align: justify; text-justify: inter-ideograph;
}
.cta-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

/* 內頁沿用同一套主視覺語彙：標題 + 導言 + 底部峰線，但不放照片。
   position: relative 一定要有，否則絕對定位的峰線會跑去跟著整頁定位。 */
.page-hero { position: relative; overflow: hidden; padding: 44px 0 46px; }
.page-hero .claim { font-size: 2rem; margin-bottom: 14px; position: relative; }
.page-hero .claim-lede { margin-bottom: 0; max-width: 40em; position: relative; }
.page-hero .hero-spectrum { height: 84px; opacity: .13; }
/* 主視覺是實驗室的鉛筆手繪（已把紙張黃調校回近白）。邊緣用遮罩淡出成頁面底色，
   紙的白與頁面的白接在一起，不會像一張圖貼在版面上。 */
/* 圖檔本身已把四邊烘成純白羽化，所以這裡不再加遮罩，
   只留一層很淡的收邊，避免縮放時邊界重新浮現。 */
.hero-shot { margin: 0; }
.hero-shot img {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  -webkit-mask-image:
    radial-gradient(135% 135% at 50% 50%, #000 72%, transparent 100%);
  mask-image:
    radial-gradient(135% 135% at 50% 50%, #000 72%, transparent 100%);
}
@media (prefers-color-scheme: dark) {
  /* 手繪是白底，深色模式反相成白線黑底才不會變成一塊亮白 */
  .hero-shot img { filter: invert(1); opacity: .85; }
}

/* 首頁研究主題卡 */
.tcards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tcard {
  display: block; color: inherit; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px 18px;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.tcard:hover {
  text-decoration: none; border-color: var(--accent);
  background: var(--bg-soft); transform: translateY(-2px);
}
.tcard-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.ticon { width: 22px; height: 22px; color: var(--accent); flex: none; }
.tcard .tag { margin-bottom: 0; }
.tcard h3 { font-size: 1.04rem; margin: 0 0 8px; }
.tcard p {
  margin: 0; font-size: 0.93rem; color: var(--ink-soft); line-height: 1.6;
}

/* 首頁代表圖畫廊 */
.pcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pcard { display: block; color: inherit; }
.pcard:hover { text-decoration: none; }
.pcard-fig {
  display: block; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #fff; margin-bottom: 10px;
  transition: border-color .2s ease;
}
.pcard-fig img {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  object-fit: contain; padding: 8px; background: #fff;
}
.pcard:hover .pcard-fig { border-color: var(--accent); }
.pcard-title {
  display: block; font-size: 0.9rem; line-height: 1.5; color: var(--ink);
}
.pcard:hover .pcard-title { color: var(--accent); }
.pcard-meta {
  display: block; font-size: 0.82rem; color: var(--ink-faint); margin-top: 4px;
}

/* 兩端對齊：中文用 inter-ideograph，避免西文式的字距拉扯 */
.justify { text-align: justify; text-justify: inter-ideograph; }

.idlinks { display: flex; flex-wrap: wrap; gap: 10px; }
.idlinks a {
  font-size: 0.87rem; padding: 5px 13px; border: 1px solid var(--line);
  border-radius: 100px; color: var(--ink-soft); background: var(--bg-soft);
}
.idlinks a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- Sections ---------- */
section { padding: 44px 0; border-bottom: 1px solid var(--line-soft); }
section:last-of-type { border-bottom: none; }

h2 {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.11em;
  color: var(--ink-faint); font-weight: 650; margin: 0 0 22px;
}
h3 {
  font-family: var(--serif);
  font-size: 1.16rem; margin: 0 0 8px; font-weight: 600; letter-spacing: 0;
}
.lede { font-family: var(--serif); font-size: 1.08rem; }
p { margin: 0 0 14px; }
.zh { color: var(--ink-soft); font-size: 0.95rem; font-family: var(--sans); }

/* ---------- Research themes ---------- */
.themes { display: grid; gap: 26px; }
.theme {
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 20px;
}
.theme .tag, .tcard .tag {
  display: inline-block; font-size: 0.72rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-dim); padding: 2px 9px; border-radius: 3px;
  margin-bottom: 8px; font-weight: 600;
}
.theme p { margin-bottom: 8px; }

/* ---------- 研究頁：每條主軸展開成 問題 → 做法 → 成果 → 代表著作 ---------- */
.theme-long { padding: 34px 0; border-bottom: 1px solid var(--line); }
.theme-long:last-of-type { border-bottom: none; }
.theme-head { margin-bottom: 20px; }
.theme-head .tag { margin-bottom: 9px; }
.theme-head h3 { font-size: 1.34rem; margin: 0; }
.theme-head .zh { font-size: 0.95rem; }
.step { display: grid; grid-template-columns: 132px 1fr; gap: 22px; margin-bottom: 16px; }
.step-k {
  font-size: 0.74rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 650; padding-top: 4px;
}
.step p { margin: 0; text-align: justify; text-justify: inter-ideograph; }
.theme-refs {
  display: grid; grid-template-columns: 132px 1fr; gap: 22px; margin-top: 20px;
}
.theme-refs ul { list-style: none; margin: 0; padding: 0; }
.theme-refs li { margin-bottom: 9px; font-size: 0.93rem; line-height: 1.5; }
.theme-refs li:last-child { margin-bottom: 0; }
.r-meta { display: block; font-size: 0.83rem; color: var(--ink-faint); margin-top: 1px; }

/* ---------- Publications ---------- */
.legend {
  font-size: 0.87rem; color: var(--ink-soft); background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 26px;
}
.legend b { color: var(--ink); }

.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 26px; }
.filters button {
  font: inherit; font-size: 0.84rem; cursor: pointer;
  padding: 5px 13px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-soft);
}
.filters button:hover { border-color: var(--accent); color: var(--accent); }
.filters button[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

ol.pubs { list-style: none; margin: 0; padding: 0; counter-reset: pub; }
ol.pubs li {
  padding: 15px 0 15px 44px; border-bottom: 1px solid var(--line-soft);
  position: relative; counter-increment: pub;
}
ol.pubs li::before {
  content: counter(pub); position: absolute; left: 0; top: 17px;
  font-size: 0.8rem; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; width: 30px; text-align: right;
}
.pub-authors { font-size: 0.93rem; color: var(--ink-soft); }
.pub-authors strong { color: var(--ink); font-weight: 650; }
.pub-title { display: block; margin: 3px 0; }
.pub-meta { font-size: 0.9rem; color: var(--ink-soft); }
.pub-meta em { color: var(--ink); font-style: italic; }
.pub-badges { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge {
  font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 3px; font-weight: 600;
  border: 1px solid var(--line); color: var(--ink-faint);
}
.badge.corr { color: var(--highlight); border-color: var(--highlight); }
.badge.first { color: var(--accent); border-color: var(--accent); }
.badge.inv { color: var(--highlight); border-color: var(--highlight); }
.doi { font-size: 0.82rem; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 30px; }
.stat {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; background: var(--bg-soft);
}
.stat .n { font-size: 1.7rem; font-weight: 680; letter-spacing: -0.03em; line-height: 1.1; }
.stat .k { font-size: 0.78rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------- 消息時間軸：依年份分組，年份釘在左欄 ---------- */
.timeline { position: relative; }
.tl-group { display: grid; grid-template-columns: 62px 1fr; gap: 18px; }
.tl-year {
  font-family: var(--serif); font-size: 1.16rem; font-weight: 600;
  color: var(--ink); font-variant-numeric: tabular-nums;
  position: sticky; top: 8px; align-self: start; padding-top: 12px;
}
.tl-items {
  list-style: none; margin: 0; padding: 0 0 6px 20px;
  border-left: 1px solid var(--line);
}
.tl-items li {
  display: grid; grid-template-columns: 46px 1fr; gap: 14px;
  padding: 9px 0; font-size: 0.95rem; position: relative;
}
.tl-items li::before {
  content: ""; position: absolute; left: -25px; top: 17px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--line);
}
.tl-items li:first-child::before { border-color: var(--accent); background: var(--accent); }
.tl-items time {
  color: var(--ink-faint); font-size: 0.84rem; font-variant-numeric: tabular-nums;
}

/* ---------- Grants ---------- */
ul.grants { list-style: none; margin: 0; padding: 0; }
ul.grants li { padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
ul.grants .g-head { display: flex; flex-wrap: wrap; gap: 9px; align-items: baseline; }
ul.grants .g-id { font-size: 0.8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
ul.grants .g-title { font-size: 0.98rem; }
ul.grants .g-zh { font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- People ---------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px; }
.person { text-align: center; }
.person .ph {
  width: 96px; height: 96px; border-radius: 50%; margin: 0 auto 10px;
  background: var(--bg-soft); border: 1px solid var(--line);
  object-fit: cover; display: flex; align-items: center;
  justify-content: center; color: var(--ink-faint); font-size: 1.5rem;
}
.person .nm { font-size: 0.95rem; font-weight: 600; }
.person .nm-zh { font-size: 0.86rem; color: var(--ink-soft); }
.person .topic { font-size: 0.8rem; color: var(--ink-faint); margin-top: 4px; }

/* 歷屆成員：卡片略小，讓 27 位排起來仍然清爽 */
.alumni-preview { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.alumni-preview .ph { width: 76px; height: 76px; }
#alumni-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 26px 20px; }
#alumni-grid .ph { width: 84px; height: 84px; margin-bottom: 9px; }
#alumni-grid .nm { font-size: 0.9rem; }
#alumni-grid .nm-zh { font-size: 0.82rem; }

/* ---------- 相簿 ---------- */
/* ---------- 相簿封面牆 ----------
   一本相簿一張封面，點開才在燈箱裡逐張看。整頁只有 20 張封面，
   不必無止盡往下捲，初始載入量也從 5.8 MB 降到 1.4 MB。 */
.acards {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px 12px;
}
.acard {
  display: block; padding: 0; border: 0; background: none;
  text-align: left; cursor: pointer; color: inherit; font: inherit;
}
.acard-fig {
  display: block; position: relative; overflow: hidden;
  border-radius: 4px; border: 1px solid var(--line);
  aspect-ratio: 1 / 1; background: var(--bg-soft);
}
.acard-fig img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .4s ease;
}
.acard:hover .acard-fig img { transform: scale(1.045); }
.acard:hover .acard-fig { border-color: var(--accent); }
.acard:focus-visible .acard-fig { outline: 2px solid var(--accent); outline-offset: 2px; }
.acard-count {
  position: absolute; right: 5px; bottom: 5px;
  background: rgba(14, 22, 30, .6); color: #fff;
  font-size: 0.66rem; line-height: 1; padding: 3px 6px; border-radius: 100px;
  backdrop-filter: blur(2px);
}
.acard-cap {
  display: block; margin-top: 7px; font-size: 0.82rem; line-height: 1.4;
  color: var(--ink);
}
.acard:hover .acard-cap { color: var(--accent); }
.acard-year {
  display: block; font-size: 0.72rem; color: var(--ink-faint); margin-top: 1px;
}

/* 首頁那一排縮圖 */
.shots { display: grid; gap: 8px; }
.shots.strip { grid-template-columns: repeat(6, 1fr); margin-top: 16px; }
.shot {
  display: block; padding: 0; border: 0; background: var(--bg-soft);
  border-radius: 3px; overflow: hidden; cursor: pointer;
  aspect-ratio: 1 / 1; line-height: 0;
}
.shot img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease, opacity .25s ease;
}
.shot:hover img { transform: scale(1.04); opacity: .9; }
.shot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 燈箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex;
  align-items: center; justify-content: center;
  background: rgba(14, 17, 22, 0.94); padding: 40px;
}
.lightbox[hidden] { display: none; }
.lightbox figure {
  margin: 0; max-width: 100%; max-height: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.lightbox img {
  max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
}
.lightbox figcaption {
  color: rgba(255, 255, 255, .78); font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
.lightbox button {
  position: absolute; background: none; border: 0; color: rgba(255, 255, 255, .72);
  cursor: pointer; line-height: 1; padding: 12px; transition: color .2s;
}
.lightbox button:hover { color: #fff; }
.lb-close { top: 10px; right: 14px; font-size: 2rem; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lb-prev { left: 6px; }
.lb-next { right: 6px; }

/* ---------- YouTube 頻道 ---------- */
.yt { display: grid; grid-template-columns: 132px 1fr; gap: 26px; align-items: center; }
.yt-logo { display: block; line-height: 0; }
.yt-logo img {
  width: 132px; height: 132px; display: block;
  transition: transform .25s ease;
}
.yt-logo:hover img { transform: translateY(-2px) scale(1.02); }
.yt h3 { margin-bottom: 8px; }
.yt .yt-tag {
  font-family: var(--serif); font-size: 1.06rem; color: var(--ink-soft);
  margin-bottom: 14px;
}

/* ---------- 開課紀錄表 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.courses {
  width: 100%; border-collapse: collapse; font-size: 0.93rem;
}
table.courses th {
  text-align: left; font-size: 0.74rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 650;
  padding: 0 12px 9px 0; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.courses td {
  padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line-soft);
  vertical-align: baseline;
}
table.courses tr.newyear td { border-top: 1px solid var(--line); }
table.courses tr.newyear:first-child td { border-top: none; }
table.courses .yr {
  font-variant-numeric: tabular-nums; font-weight: 600; width: 3.6em;
}
table.courses .tm { color: var(--ink-soft); width: 3.2em; }
table.courses .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem; color: var(--ink-soft); width: 6em;
}
table.courses .dept { color: var(--ink-soft); white-space: nowrap; width: 7em; }
table.courses .cname { width: 100%; }
.ctype {
  display: inline-block; font-size: 0.75rem; padding: 1px 8px;
  border-radius: 3px; white-space: nowrap;
}
.ctype.req { color: var(--accent); background: var(--accent-dim); }
.ctype.ele { color: var(--ink-soft); background: var(--bg-soft); border: 1px solid var(--line); }

/* ---------- Misc ---------- */
.note {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; font-size: 0.93rem;
  color: var(--ink-soft);
}
.cta {
  display: inline-block; padding: 9px 20px; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-size: 0.94rem; font-weight: 500;
}
.cta:hover { text-decoration: none; opacity: 0.9; }

footer.site-footer {
  border-top: 1px solid var(--line); padding: 30px 0 44px;
  font-size: 0.88rem; color: var(--ink-faint); margin-top: 20px;
}
footer.site-footer a { color: var(--ink-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .hero-grid { grid-template-columns: 1fr; gap: 22px; }
  .hero-photo { width: 128px; height: 128px; }
  .hero h1 { font-size: 1.72rem; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .tl-group { grid-template-columns: 46px 1fr; gap: 12px; }
  .tl-year { font-size: 1.02rem; }
  .tl-items { padding-left: 15px; }
  .tl-items li { grid-template-columns: 1fr; gap: 2px; }
  .tl-items li::before { left: -19px; top: 15px; }
  .jump { top: 52px; }
  section[id] { scroll-margin-top: 104px; }
  .to-top { right: 14px; bottom: 14px; width: 38px; height: 38px; }
  .site-header .wrap { min-height: auto; padding-top: 12px; padding-bottom: 12px; }
  nav.main { width: 100%; display: flex; flex-wrap: wrap; gap: 0 4px; }
  nav.main a { margin-left: 0; margin-right: 16px; }
  ol.pubs li { padding-left: 34px; }
  ol.pubs li::before { width: 24px; }
}

@media print {
  .site-header, .filters, footer.site-footer { display: none; }
  body { font-size: 11pt; color: #000; }
  a { color: #000; }
}

/* ---------- Publications 分區 ---------- */
h2 .yrs {
  font-weight: 400; letter-spacing: 0.04em; color: var(--ink-faint);
  margin-left: 8px; text-transform: none;
}
.sec-note {
  font-size: 0.94rem; color: var(--ink-soft); max-width: 66ch;
  margin: -8px 0 22px;
}
/* 著作頁分區導覽：黏在頁首下方，捲動時標示目前所在分區 */
.jump {
  position: sticky; top: 62px; z-index: 40;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.jump .wrap {
  display: flex; gap: 26px; overflow-x: auto; scrollbar-width: none;
  padding-top: 11px; padding-bottom: 11px;
}
.jump .wrap::-webkit-scrollbar { display: none; }
.jump a {
  font-size: 0.88rem; color: var(--ink-faint); white-space: nowrap;
  padding-bottom: 3px; border-bottom: 2px solid transparent;
}
.jump a:hover { color: var(--ink); text-decoration: none; }
.jump a.on { color: var(--ink); border-bottom-color: var(--accent); }
section[id] { scroll-margin-top: 118px; }

/* ---------- Facility 合作案例 ---------- */
.case { border-left: 3px solid var(--highlight); padding: 2px 0 2px 20px; margin-bottom: 30px; }
.case-refs { margin-top: 12px; }
.case-refs .k {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint); font-weight: 650;
}
.case-refs ul.grants li { padding: 8px 0; }

/* ---------- 學經歷等清單：收緊行距 ---------- */
ul.grants li { padding: 8px 0; }
ul.grants .g-title { font-size: 0.97rem; line-height: 1.4; }
ul.grants .g-id { font-size: 0.83rem; line-height: 1.45; margin-top: 1px; }
ul.grants .g-zh { margin-top: 1px; line-height: 1.45; }
section { padding: 34px 0; }
h2 { margin-bottom: 16px; }

/* ---------- Logo ---------- */
.brand { display: flex; align-items: center; gap: 13px; }
.brand .logo { height: 32px; width: auto; display: block; flex: none; }
.brand-txt {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 650; letter-spacing: -0.01em; color: var(--ink); font-size: 1.02rem;
}
.brand-txt em {
  font-style: normal; color: var(--ink-faint); font-weight: 400; font-size: 0.9rem;
}
@media (max-width: 760px) {
  .brand .logo { height: 26px; }
  .brand-txt { font-size: 0.95rem; }
  .brand-txt em { display: none; }
}

/* logo 單獨作為品牌標誌（頁首不再有文字） */
.brand { gap: 0; }
.brand .logo { height: 36px; }
@media (max-width: 760px) { .brand .logo { height: 30px; } }

/* ---------- 首頁消息：可向下捲動看歷史 ---------- */
.news-scroll {
  max-height: 340px;
  overflow-y: auto;
  padding-right: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 16px;
  background: var(--bg-soft);
  /* 底部漸層提示：下面還有內容 */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent 100%);
          mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent 100%);
  overscroll-behavior: contain;
}
.news-scroll:hover { -webkit-mask-image: none; mask-image: none; }
.news-scroll .tl-group:last-child .tl-items { padding-bottom: 0; }
.news-scroll::-webkit-scrollbar { width: 8px; }
.news-scroll::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 4px;
}
.news-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
.news-scroll::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 760px) { .news-scroll { max-height: 300px; } }

/* ---------- 著作代表圖 ----------
   圖置於右側，文字左緣與其他條目完全對齊，
   49 筆的編號／作者／標題維持同一條垂直線。 */
ol.pubs li.has-fig {
  display: grid;
  grid-template-columns: 1fr 168px;
  gap: 26px;
  align-items: start;
}
.pub-fig {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 7px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.pub-fig img {
  display: block; width: 100%; height: auto; border-radius: 2px;
}
.pub-fig:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(0,0,0,.10);
  transform: translateY(-2px);
  text-decoration: none;
}
@media (prefers-color-scheme: dark) {
  .pub-fig:hover { box-shadow: 0 4px 16px rgba(0,0,0,.5); }
}
@media (max-width: 760px) {
  ol.pubs li.has-fig { grid-template-columns: 1fr; gap: 14px; }
  .pub-fig { max-width: 190px; }
}

/* ============================================================
   精緻化調整：縮小視覺重量，讓版面回到以文字為主
   ============================================================ */

/* logo：頁首標誌收小，維持識別但不搶戲 */
.brand .logo { height: 27px; }
@media (max-width: 760px) { .brand .logo { height: 23px; } }
.site-header .wrap { min-height: 56px; }

/* 著作代表圖：縮小、去掉外框與陰影，改以極細線分隔 */
ol.pubs li.has-fig { grid-template-columns: 1fr 128px; gap: 28px; }
.pub-fig {
  border: none; background: none; padding: 0;
  opacity: .92; transition: opacity .18s;
}
.pub-fig img {
  border-radius: 3px;
  border: 1px solid var(--line-soft);
}
.pub-fig:hover { opacity: 1; box-shadow: none; transform: none; }
.pub-fig:hover img { border-color: var(--line); }
@media (max-width: 760px) {
  ol.pubs li.has-fig { grid-template-columns: 1fr; gap: 12px; }
  .pub-fig { max-width: 150px; }
}

/* ---------- 代表圖：撐滿條目高度（上下分隔線之間）---------- */
ol.pubs li.has-fig {
  grid-template-columns: 1fr auto;
  align-items: stretch;
  min-height: 136px;
  gap: 30px;
}
.pub-fig {
  align-self: stretch;
  margin: -15px 0;                 /* 抵銷 li 的上下 padding，貼齊分隔線 */
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.pub-fig img {
  height: 100%;
  width: auto;
  max-width: 300px;
  object-fit: contain;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
}
@media (max-width: 760px) {
  ol.pubs li.has-fig { grid-template-columns: 1fr; gap: 12px; min-height: 0; }
  .pub-fig { margin: 0; justify-content: flex-start; }
  .pub-fig img { height: auto; width: 100%; max-width: 220px; }
}

/* ---------- 收緊區塊間距：學歷／經歷／獲獎等短清單 ---------- */
section { padding: 26px 0; }
h2 { margin-bottom: 13px; }
ul.grants li:last-child { border-bottom: none; }   /* 末筆不畫線，避免與區塊分隔線疊成雙線 */
ul.grants li { padding: 7px 0; }


/* ---------- 手機版整體調校 ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; line-height: 1.6; }
  .wrap { padding: 0 18px; }
  section { padding: 22px 0; }
  h2 { margin-bottom: 11px; font-size: 0.78rem; }

  .hero { padding: 30px 0 26px; }
  .home-hero { padding: 34px 0 30px; }
  .home-grid { grid-template-columns: 1fr; gap: 24px; }
  .hero-shot { order: -1; }
  .hero-spectrum { height: 90px; }
  .home-hero .claim { font-size: 1.72rem; line-height: 1.32; }
  .home-hero .claim br { display: none; }
  .home-hero .claim-lede { font-size: 0.99rem; }
  .tcards { grid-template-columns: 1fr; gap: 12px; }
  .tcard { padding: 16px 18px 14px; }
  .pcards { grid-template-columns: 1fr 1fr; gap: 14px; }
  .pcard-title { font-size: 0.85rem; }
  .hero-photo { width: 104px; height: 104px; }
  .hero h1 { font-size: 1.55rem; }
  .hero .zh-name { font-size: 1rem; margin-left: 8px; }
  .hero .lede { font-size: 1rem; }

  /* 導覽列：橫向捲動，不再折成兩三行擠壓版面 */
  .site-header .wrap { flex-wrap: nowrap; gap: 12px; min-height: 52px; }
  nav.main {
    display: flex; align-items: center; gap: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; margin-right: -18px; padding-right: 18px;
  }
  nav.main::-webkit-scrollbar { display: none; }
  nav.main a { margin: 0 14px 0 0; white-space: nowrap; font-size: 0.88rem; }
  nav.main a.lang { margin-left: 4px; }

  /* 著作條目 */
  ol.pubs li { padding: 12px 0 12px 30px; }
  ol.pubs li::before { width: 20px; top: 14px; font-size: 0.74rem; }
  .pub-title { font-size: 0.97rem; }
  .pub-authors, .pub-meta { font-size: 0.87rem; }

  /* 成員頭像 */
  .people { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px; }
  .person .ph { width: 76px; height: 76px; }
  .person .nm { font-size: 0.88rem; }
  .person .nm-zh { font-size: 0.8rem; }

  /* 研究頁：手機上標籤改成單欄疊在文字上方 */
  .step, .theme-refs { grid-template-columns: 1fr; gap: 6px; }
  .step-k { padding-top: 0; }
  .theme-head h3 { font-size: 1.16rem; }
  .theme-long { padding: 26px 0; }

  .filters button { font-size: 0.8rem; padding: 4px 11px; }
  .legend { font-size: 0.83rem; padding: 10px 13px; }

  /* 相簿 */
  .acards { grid-template-columns: repeat(3, 1fr); gap: 14px 8px; }
  .acard-cap { font-size: 0.76rem; margin-top: 6px; }
  .acard-year { font-size: 0.68rem; }
  .shots.strip { grid-template-columns: repeat(3, 1fr); }
    .lightbox { padding: 16px; }
  .lb-prev, .lb-next { font-size: 2.2rem; padding: 8px; }
  #alumni-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 18px 12px; }
  #alumni-grid .ph { width: 72px; height: 72px; }

  /* YouTube 區塊：手機上改成上下排 */
  .yt { grid-template-columns: 1fr; gap: 16px; justify-items: start; }
  .yt-logo img { width: 104px; height: 104px; }
  .yt .yt-tag { font-size: 1rem; }

  /* 開課表：手機上收窄欄位，必要時橫向捲動 */
  table.courses { font-size: 0.87rem; }
  table.courses th { font-size: 0.68rem; }
  table.courses td { padding: 8px 10px 8px 0; }
  table.courses .code { font-size: 0.8rem; width: 5.2em; }
  table.courses .dept { width: 5.4em; }
  table.courses .yr { width: 3.2em; }
  table.courses .tm { width: 2.6em; }
  .ctype { font-size: 0.7rem; padding: 1px 6px; }
}
