/* 專任教師頁（2026-10 改版）：三段卡片（照片｜職稱姓名聯絡｜研究領域學歷）、依職稱分組、搜尋、右側教師書籤 */

.fac-page,
.fac-bookmark,
.tag-dlg {
  --fac-accent: #832e33;
  --fac-accent-dark: #5a1419;
  --fac-ink: #2b2523;
  --fac-muted: #6b605c;
  --fac-line: #e5dfda;
}

.fac-page {
  padding: 22px 0 56px;
  color: var(--fac-ink);
}

/* 頁首英文副標；全站 h1 靠右，有英文時改靠左 */
#top-pic h1 {
  text-align: left;
}

#top-pic .top-pic-en {
  display: block;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.22em;
  color: #f5e4e5;
}

/* 系網全站 CSS 會給 li 加圓點 */
.fac-page li,
.fac-bookmark li {
  list-style: none;
}

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

.fac-card[hidden],
.fac-group[hidden],
.fac-empty[hidden],
[data-search][hidden],
[data-group][hidden] {
  display: none !important;
}

/* ---- 工具列：人數＋分組捷徑＋搜尋 ---- */

.fac-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  margin: 0 4px 6px;
}

.fac-summary {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  font-size: 15px;
  color: #5f5450;
}

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

.fac-summary-sep {
  color: #cbbdb7;
}

.fac-summary a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--fac-accent);
}

.fac-search {
  position: relative;
  width: 300px;
  max-width: 100%;
  color: #8a7d78;
}

.fac-search svg {
  position: absolute;
  left: 14px;
  top: 13px;
}

.fac-search input {
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  padding: 0 14px 0 42px;
  border: 1px solid #ddd3ce;
  border-radius: 999px;
  background: #ffffff;
  font: inherit;
  font-size: 15px;
  color: var(--fac-ink);
}

.fac-search input:focus {
  outline: 2px solid rgba(131, 46, 51, 0.35);
  outline-offset: 1px;
  border-color: var(--fac-accent);
}

.fac-empty {
  margin: 14px 0;
  padding: 40px 24px;
  border: 1px dashed #ddd3ce;
  border-radius: 14px;
  background: #ffffff;
  text-align: center;
  font-size: 16px;
  color: var(--fac-muted);
}

/* ---- 分組標題 ---- */

.fac-group {
  padding-top: 18px;
}

.fac-group-title {
  margin: 0 0 18px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-family: 'Noto Serif TC', 'Noto Serif CJK TC', serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fac-ink);
  scroll-margin-top: 64px;
}

.fac-group-title::after {
  content: "";
  flex: 1;
  height: 1px;
  align-self: center;
  background: #e2d8d3;
}

.fac-group-count {
  font-family: inherit;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--fac-muted);
}

/* ---- 卡片：三段，欄與欄之間用漸層過渡 ---- */

.fac-card {
  display: grid;
  grid-template-columns: 168px 300px minmax(0, 1fr);
  margin-bottom: 20px;
  border: 1px solid var(--fac-line);
  border-radius: 14px;
  overflow: hidden;
  /* 照片欄 0–168px、職稱姓名欄 168–468px，之後是研究領域 */
  background: linear-gradient(90deg,
    #efe1de 0px, #efe1de 120px,
    #f8f1ef 215px, #f8f1ef 410px,
    #ffffff 520px);
  box-shadow: 0 1px 2px rgba(60, 20, 22, 0.05), 0 6px 18px rgba(60, 20, 22, 0.05);
  scroll-margin-top: 64px;
}

/* 照片維持原比例整張顯示，不裁切 */
.fac-photo {
  padding: 26px 18px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.fac-photo img {
  display: block;
  width: 132px;
  height: auto;
  border-radius: 8px;
  background: #e7dfda;
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 5px #ead9da;
}

.fac-info {
  min-width: 0;
  padding: 28px 22px 22px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.fac-title {
  padding: 1px 8px;
  border: 1px solid #ead9da;
  border-radius: 4px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: #7a2a30;
}

.fac-name {
  margin: 0;
  font-family: 'Noto Serif TC', 'Noto Serif CJK TC', serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.06em;
  color: var(--fac-ink);
}

.fac-contact {
  align-self: stretch;
  margin: 4px 0 0;
  padding: 0;
  font-size: 14.5px;
}

.fac-contact li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
}

.fac-contact svg {
  flex-shrink: 0;
  color: var(--fac-accent);
}

.fac-contact strong {
  font-weight: 700;
  color: var(--fac-accent);
}

.fac-contact a {
  min-width: 0;
  color: var(--fac-accent);
  overflow-wrap: anywhere;
}

.fac-contact a:hover {
  color: var(--fac-accent-dark);
}

.fac-contact a.fac-web {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

/* ---- 研究領域、學歷 ---- */

.fac-detail {
  min-width: 0;
  padding: 28px 30px 14px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fac-label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--fac-accent);
}

.fac-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #eee3e0;
}

.fac-tags + .fac-label {
  margin-top: 8px;
}

.fac-tags {
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fac-tags li {
  padding: 4px 11px;
  border: 1px solid #eedcdd;
  border-radius: 6px;
  background: #f6eded;
  font-size: 14.5px;
  line-height: 1.45;
  color: #6a2328;
}

/* 兼任教師的授課科目：白底，跟研究領域區分 */
.fac-tags.is-subject li {
  border-color: #e2d6d1;
  background: #ffffff;
  color: #5f5450;
}

.fac-edu {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.6;
}

.fac-more {
  align-self: flex-end;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--fac-accent);
}

.fac-more:hover {
  color: var(--fac-accent-dark);
}

/* ---- 右側教師書籤（覆蓋 member.css 的 #right-nav 樣式）---- */

#right-nav .fac-bookmark {
  position: -webkit-sticky;
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#right-nav .fac-bookmark-title {
  margin: 0;
  padding-left: 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--fac-accent);
}

#right-nav .fac-bm-label {
  display: block;
  padding-left: 14px;
  margin-bottom: 4px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fac-muted);
}

#right-nav .fac-bookmark ul {
  position: static;
  max-height: none;
  margin: 0;
  padding: 0;
  border-left: 0;
  box-shadow: inset 1px 0 0 #e0d8d2;
  overflow: visible;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}

#right-nav .fac-bookmark ul.is-single {
  grid-template-columns: 1fr;
}

#right-nav .fac-bookmark ul li {
  margin: 0;
  padding: 0;
}

#right-nav .fac-bookmark ul li a {
  display: flex;
  align-items: center;
  max-width: none;
  min-height: 34px;
  box-sizing: border-box;
  margin: 0;
  padding: 4px 8px 4px 12px;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  white-space: normal;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
  font-size: 14px;
  font-weight: 500;
  color: var(--fac-ink);
}

#right-nav .fac-bookmark ul li a:hover {
  background: rgba(131, 46, 51, 0.04);
  color: var(--fac-accent);
  text-decoration: none;
}

#right-nav .fac-bookmark ul li a.is-current {
  border-left-color: var(--fac-accent);
  color: var(--fac-accent);
  font-weight: 700;
}

#right-nav .fac-bookmark-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding-left: 14px;
  font-size: 13px;
  color: var(--fac-muted);
}

#right-nav .fac-bookmark-top:hover {
  color: var(--fac-accent);
  text-decoration: none;
}

/* ---- 窄螢幕：上排「照片｜職稱姓名」，研究領域移到下方 ---- */

@media (max-width: 991.98px) {
  .fac-card {
    grid-template-columns: 150px minmax(0, 1fr);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0) 0px, rgba(255, 255, 255, 0) 190px, #ffffff 290px),
      linear-gradient(90deg, #efe1de 0px, #efe1de 100px, #f8f1ef 185px);
  }

  .fac-photo {
    padding: 22px 0 14px 22px;
    justify-content: flex-start;
  }

  .fac-photo img {
    width: 110px;
  }

  .fac-info {
    padding: 22px 20px 12px 14px;
  }

  .fac-detail {
    grid-column: 1 / -1;
    padding: 6px 24px 12px;
  }
}

@media (max-width: 767.98px) {
  .fac-page {
    padding-top: 16px;
  }

  .fac-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .fac-summary {
    font-size: 14px;
  }

  .fac-search {
    width: 100%;
  }

  .fac-group-title {
    font-size: 21px;
  }

  .fac-card {
    grid-template-columns: 112px minmax(0, 1fr);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0) 0px, rgba(255, 255, 255, 0) 170px, #ffffff 260px),
      linear-gradient(90deg, #efe1de 0px, #efe1de 76px, #f8f1ef 144px);
  }

  .fac-photo {
    padding: 20px 0 12px 16px;
  }

  .fac-photo img {
    width: 84px;
    border-radius: 6px;
    box-shadow: 0 0 0 3px #ffffff, 0 0 0 4px #ead9da;
  }

  .fac-info {
    padding: 20px 12px 8px 12px;
    gap: 6px;
  }

  .fac-name {
    font-size: 22px;
  }

  .fac-contact {
    margin-top: 2px;
    font-size: 13.5px;
  }

  .fac-contact li {
    gap: 8px;
    min-height: 30px;
  }

  .fac-contact a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .fac-detail {
    padding: 6px 18px 8px;
    gap: 8px;
  }

  .fac-label {
    font-size: 13px;
  }

  .fac-tags {
    gap: 6px;
  }

  .fac-tags li {
    padding: 3px 10px;
    font-size: 13.5px;
  }

  .fac-edu {
    font-size: 15px;
  }

  .fac-more {
    min-height: 44px;
  }
}

/* ---- 老師個人頁（2026-10，取代舊的 Vue 個人頁）：上方卡片同列表，下面經歷、榮譽、著作 ---- */

.tch-page .tch-card {
  margin-top: 6px;
}

.tch-section {
  padding-top: 26px;
  scroll-margin-top: 64px;
}

.tch-page .tch-box.ntc-body.news-card {
  padding: 24px 30px;
  border: 1px solid var(--fac-line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(60, 20, 22, 0.05), 0 6px 18px rgba(60, 20, 22, 0.05);
}

.tch-page .tch-box .content {
  overflow-wrap: anywhere;
}

/* 舊資料常把著作貼成表格，窄螢幕可左右捲 */
.tch-page .tch-box .content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 767.98px) {
  .tch-page .tch-box.ntc-body.news-card {
    padding: 18px 16px;
  }
}

/* ---- 研究領域標籤（2026-10）：連了標籤的研究領域是按鈕，點開彈出視窗（App\Support\ResearchTags） ---- */
.fac-tags li.has-tag {
  padding: 0;
  border: 0;
  background: none;
}

.fac-tag-btn {
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 11px;
  border: 1px solid #d8b6b8;
  border-radius: 6px;
  background: #f6eded;
  color: #6a2328;
  font-size: 14.5px;
  line-height: 1.45;
  cursor: pointer;
}

.fac-tag-btn:hover {
  background: #eedcdc;
  border-color: var(--fac-accent);
  color: var(--fac-accent-dark);
}

.fac-tag-btn:focus-visible {
  outline: 3px solid var(--fac-accent);
  outline-offset: 2px;
}

.fac-tag-btn svg {
  flex: none;
}

.fac-tag-hint {
  margin: -2px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--fac-muted);
}

.fac-tag-hint svg {
  flex: none;
  color: var(--fac-accent);
}

.tag-dlg {
  width: min(660px, calc(100vw - 32px));
  max-height: min(88vh, 920px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: var(--fac-ink);
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(40, 10, 12, 0.38);
  overflow: auto;
}

.tag-dlg::backdrop {
  background: rgba(32, 14, 16, 0.55);
}

.tdl-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 22px 64px 14px 28px;
  border-bottom: 1px solid #efe6e3;
  background: #ffffff;
}

.tdl-kicker {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--fac-accent);
}

.tdl-head h2 {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--fac-ink);
}

.tdl-head h2 small {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fac-muted);
}

.tdl-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--fac-line);
  border-radius: 50%;
  background: #ffffff;
  color: var(--fac-accent-dark);
  cursor: pointer;
}

.tdl-close:hover {
  background: #f6eded;
}

.tdl-close:focus-visible,
.tdl-p a:focus-visible {
  outline: 3px solid var(--fac-accent);
  outline-offset: 2px;
}

.tdl-body {
  padding: 18px 28px 24px;
}

.tdl-fig {
  margin: 0 0 16px;
}

/* 直式圖片不要撐高視窗：最高 340px，完整顯示不裁切 */
.tdl-fig img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  border-radius: 12px;
  background: #f7f3f2;
}

.tdl-fig figcaption {
  margin-top: 6px;
  font-size: 13px;
  color: var(--fac-muted);
}

.tdl-desc {
  font-size: 15.5px;
  line-height: 1.85;
}

.tdl-desc p,
.tdl-desc ul,
.tdl-desc ol {
  margin: 0 0 10px;
}

.tdl-desc a {
  color: var(--fac-accent);
  text-decoration: underline;
}

/* 老師個人頁點開時：本人在這個領域的研究重點 */
.tdl-self {
  margin: 4px 0 0;
  padding: 12px 16px;
  border-left: 4px solid var(--fac-accent);
  border-radius: 0 10px 10px 0;
  background: #faf3f3;
}

.tdl-self p {
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
}

.tdl-self .tdl-self-k {
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--fac-accent);
}

.tdl-sub {
  margin: 18px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--fac-ink);
}

.tdl-sub span {
  font-size: 13px;
  font-weight: 500;
  color: var(--fac-muted);
}

.tdl-people {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tdl-p a,
.tdl-p.is-self {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid #efe6e3;
  border-radius: 10px;
  color: var(--fac-ink);
  text-decoration: none;
}

.tdl-p.is-self {
  background: #faf6f5;
}

.tdl-p a:hover {
  border-color: var(--fac-accent);
  background: #fbf5f5;
}

.tdl-p img {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  background: #eeeeee;
}

.tdl-p b {
  display: block;
  font-size: 15px;
}

.tdl-p small {
  display: block;
  font-size: 12.5px;
  color: var(--fac-muted);
}

/* 名單裡有人寫研究重點時改成一欄，研究重點接在職稱下面 */
.tdl-people.has-notes {
  grid-template-columns: 1fr;
}

.tdl-p .tdl-note {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fac-ink);
}

.tdl-people.has-notes .tdl-p a,
.tdl-people.has-notes .tdl-p.is-self {
  align-items: flex-start;
}

@media (max-width: 575.98px) {
  .tdl-people {
    grid-template-columns: 1fr;
  }

  .tdl-head {
    padding: 18px 60px 12px 18px;
  }

  .tdl-head h2 {
    font-size: 22px;
  }

  .tdl-body {
    padding: 14px 18px 20px;
  }
}

/* ---- 老師頁自訂板塊（2026-10-29）：圖片集、連結清單、影片（App\Support\TeacherBlocks） ---- */
.blk-gallery {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.blk-gallery figure {
  margin: 0;
}

.blk-gallery a {
  display: block;
  border-radius: 10px;
}

.blk-gallery a:focus-visible {
  outline: 3px solid var(--fac-accent);
  outline-offset: 3px;
}

.blk-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 10px;
  background: #f4efed;
}

.blk-gallery figcaption {
  margin-top: 8px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--fac-muted);
}

.blk-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.blk-links li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

/* 項目符號放在清單項目上，不放進連結文字（讀屏軟體才不會念出來） */
.blk-links li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fac-accent);
  transform: translateY(-2px);
}

.blk-links a {
  color: var(--fac-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.blk-video {
  margin: 0;
}

.blk-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #1f1d1c;
}

.blk-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.blk-video figcaption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--fac-muted);
}

@media (max-width: 767.98px) {
  .blk-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
