/* 
<!-- =============================
  style.css (cleaned)
============================= --> */
:root {
  --cw-text: #212529;
  --cw-text-muted: #6c757d;
  --cw-accent: #0d6efd; /* Bootstrap primary */
  --cw-border: #dee2e6;
  --cw-card: #ffffff;
  --section-rule: #000;
}

html[data-bs-theme='dark'] {
  --cw-text: #e9ecef;
  --cw-text-muted: #adb5bd;
  --cw-accent: #6ea8fe;
  --cw-border: #495057;
  --cw-card: #1c1f23;
  --section-rule: #fff;
}

/* Global */
body { font-family: 'Roboto', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Liberation Sans', sans-serif; }

h1 { font-weight: 700; font-size: 2.25rem; }

.section-title {
  /* font-weight: 700;
  display: inline-block;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--cw-accent); */
  display: block;                 /* 覆蓋原本的 inline-block */
  padding-bottom: .35rem;         /* 與底線拉開一點距離 */
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--section-rule);  /* 黑/白切換 */
}

p { color: var(--cw-text); }
.small, .text-muted { color: var(--cw-text-muted) !important; }

.section-gap { margin-top: 2rem; margin-bottom: 2rem; }

/* Navbar & social */
.navbar .icon-link { font-size: 1.1rem; color: var(--cw-text-muted); transition: color .2s ease; }
.navbar .icon-link:hover { color: var(--cw-accent); }

/* Profile */
/* .profile-photo { width: 220px; max-width: 100%; border-radius: 12px; border: 3px solid var(--cw-border); } */
/* Profile — 自動縮放 + 滑過微放大 */
.profile-wrap{
  /* 這三個值決定照片區塊尺寸上下限與對應視窗寬度的縮放 */
  --profile-min: 160px;
  --profile-vw:  26vw;
  --profile-max: 200px;

  display: inline-block;                 /* 讓整塊可點擊、可置中 */
  inline-size: clamp(var(--profile-min), var(--profile-vw), var(--profile-max));
  aspect-ratio: 1;                       /* 維持方形；若你想保留原比例，移除這行與 object-fit: cover */
  border: 3px solid var(--cw-border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--cw-card);
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
}

/* HERO figure：讓圖片寬度隨視窗平滑縮放，控制上下限 */
.hero-figure{
  /* 想更大/更小，改這三個值即可 */
  --hero-img-min: 180px;   /* 最小尺寸 */
  --hero-img-vw:  26vw;    /* 視窗相對尺寸（平滑過渡的關鍵） */
  --hero-img-max: 350px;   /* 最大尺寸 */

  inline-size: clamp(var(--hero-img-min), var(--hero-img-vw), var(--hero-img-max));
  margin-inline: auto;     /* < lg 置中 */
}


/* 覆蓋原本 .profile-photo 的固定寬度，改為吃容器寬 */
.hero-figure .profile-photo{
  inline-size: 100%;
  block-size: auto;
  display: block;
  border-radius: 12px;
  border: 3px solid var(--cw-border);
}

/* ≥ lg 左對齊（圖片欄位本身已 text-lg-start，此處確保容器不再置中） */
@media (min-width: 992px){
  .hero-figure{ margin-inline: 0; }
}


.profile-photo{
  inline-size: 100%;
  block-size: 100%;
  border-radius: 12px; border: 3px solid var(--cw-border);
  object-fit: cover;                     /* 充滿方形容器，視需要可改成 contain */
  display: block;
  transition: transform .35s ease;
}

@media (hover:hover) and (pointer:fine){
  .profile-wrap:hover .profile-photo{
    transform: scale(1.06);              /* 滑過微放大 */
  }
}

/* 小螢幕可再微調尺寸上下限（可選） */
@media (max-width: 576px){
  .profile-wrap{
    --profile-min: 140px;
    --profile-vw:  40vw;
    --profile-max: 220px;
  }
}

/* 尊重降低動態偏好（可選） */
@media (prefers-reduced-motion: reduce){
  .profile-photo{ transition: none; }
}






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

/* Lists & blocks */
.indented-list { padding-left: 1.25rem; margin-bottom: 0; }
.indented-list li { margin-bottom: .35rem; }

.award-list { list-style: none; padding: 0; margin: 0; }
.award-list li { margin-bottom: 1.25rem; }
.award-list .description { display: block; margin-top: .35rem; color: var(--cw-text-muted); }

/* Typography helpers */
.text-justify { text-align: justify; line-height: 1.8; }

/* Education logos */
#Education .logo-container{
  width:  min(20vw, 150px);   /* 視窗變大時最多 44px；變小時跟著縮 */
  height: min(20vw, 150px);
  display: grid;
  place-items: center;
}
#Education .logo-container img{
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#Education .logo-container img.img-fluid{
  max-width: 200%;
  max-height: 200%;
  height: auto;
  object-fit: contain;
}

/* Publication item */
.publication-item img { border: 1px solid var(--cw-border); background: var(--cw-card); }

/* Research Experience — Timeline Cards */
.exp-timeline{
  --dot: 12px;
  --line: 2px;
  position: relative;
}

.exp-item{
  position: relative;
  padding-left: 1.5rem;           /* 給時間軸留空間 */
  margin-bottom: 1.5rem;
}

/* 直向時間軸 + 節點 */
.exp-item::before{
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 0.35rem;
  bottom: -0.35rem;
  width: var(--line);
  background: linear-gradient(180deg, var(--cw-accent), transparent 80%);
}
.exp-item::after{
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--cw-card);
  border: 2px solid var(--cw-accent);
}

/* 卡片外觀 */
.exp-card{
  background: var(--cw-card);
  border: 1px solid var(--cw-border);
  border-radius: 12px;
  padding: 1rem 1rem 0.75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.04);
}

.exp-title{ font-weight: 600; margin: 0 0 .25rem; }
.exp-meta{ color: var(--cw-text-muted); font-size: .925rem; margin-bottom: .5rem; }
.exp-list{ margin: 0; padding-left: 1.25rem; }
.exp-list li{ margin-bottom: .35rem; }

/* 卡片間距（保留你原本的 section-gap 節奏） */
#research-experience .exp-item + .exp-item{ margin-top: 1rem; }

/* Mobile typography fix */
@media (max-width: 768px){
  /* 取消左右對齊，避免「空白河流」；加上自動斷字 */
  .text-justify{
    text-align: start !important;  /* ← 重點，加 !important 保證覆蓋 */
    text-justify: auto;
    hyphens: auto;
    word-break: normal;
    overflow-wrap: anywhere;
    line-height: 1.65;            /* 比桌機 1.8 稍微緊一點 */
  }
  /* 英文副標與段落間距略縮，視覺更緊實 */
  #about .header-subtitle{ margin-bottom: .5rem !important; }
  .section-gap{ margin-top: 1.25rem; margin-bottom: 1.25rem; }
}

/* 小加分：新瀏覽器自動優化換行 */
@supports (text-wrap: balance){ h1, h2, h3{ text-wrap: balance; } }
@supports (text-wrap: pretty){  .text-justify{ text-wrap: pretty; } }


/* Footer */
footer { color: var(--cw-text-muted); }
