:root {
  /* UW–Madison Badger Red + light theme */
  --bg: #f7f7f9;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f2f2f5;
  --uw-red: #c5050c;          /* Badger Red (Cardinal) */ 
  --uw-red-soft: rgba(197, 5, 12, 0.08);
  --accent: #c5050c;
  --accent-soft: rgba(197, 5, 12, 0.08);
  --text-main: #1f2430;
  --text-muted: #6b7280;
  --border-subtle: rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 12px 32px rgba(15, 23, 42, 0.12);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-pill: 999px;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--text-main);
  background-color: var(--bg);
  line-height: 1.6;
}

/* Layout helpers */
.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header / Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo a {
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--uw-red);
  text-decoration: none;
}

.main-nav a {
  margin-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  position: relative;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--uw-red);
  transition: width 0.2s ease-out;
}

.main-nav a:hover {
  color: var(--text-main);
}

.main-nav a:hover::after {
  width: 100%;
}

/* Hero */
.hero {
  padding: 4.5rem 0 3rem;
  background:
    radial-gradient(circle at top left, rgba(197, 5, 12, 0.12) 0, transparent 55%),
    linear-gradient(to bottom, #ffffff, #f7f7f9);
}

.hero-grid {
  display: grid;
  grid-template-columns: 3fr 2.5fr;
  gap: 2rem;
  align-items: stretch;
}

.hero-text h1 {
  font-size: clamp(2.2rem, 3vw, 2.8rem);
  margin: 0.25rem 0 0.75rem;
}

.hero-subtitle {
  color: var(--text-muted);
  max-width: 38rem;
  margin-bottom: 0.75rem;
}

.hero-meta {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--uw-red);
  font-weight: 600;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease-out, transform 0.1s ease-out, box-shadow 0.15s ease-out, border-color 0.15s ease-out;
}

.btn.primary {
  background: var(--uw-red);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(197, 5, 12, 0.28);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(197, 5, 12, 0.40);
}

.btn.secondary {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn.secondary:hover {
  background: #f3f4f6;
}

.hero-links {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-icons {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  align-items: center;
}

.hero-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.hero-icon svg {
  flex-shrink: 0;
}

.hero-icon:hover {
  color: var(--uw-red);
  border-color: rgba(197, 5, 12, 0.5);
  background: rgba(197, 5, 12, 0.06);
}

.hero-links a {
  color: inherit;
  text-decoration: none;
}

.hero-links a:hover {
  color: var(--uw-red);
}

/* Hero side card */
.hero-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.hero-card h2 {
  font-size: 1.1rem;
  margin: 0 0 1rem;
}

.hero-card ul {
  padding-left: 1.15rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-main);
}

/* Sections */
.section {
  padding: 3.5rem 0;
}

.section-alt {
  background-color: var(--bg-alt);
}

.section-header {
  max-width: 640px;
  margin: 0 auto 2rem;
  text-align: center;
}

.section-header h2 {
  margin-bottom: 0.35rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.4rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.3rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.10);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
}

.card p {
  margin: 0.15rem 0;
  font-size: 0.9rem;
}

.card-tags {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--uw-red);
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.metric {
  text-align: center;
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.2rem 0.7rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.metric-number {
  display: block;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--uw-red);
}

.metric-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Publications */
.pub-list {
  display: grid;
  gap: 1rem;
}

.pub-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem 1rem;
  border: 1px solid var(--border-subtle);
}

.pub-citation {
  margin: 0;
  font-size: 0.9rem;
}

.pub-note {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Timeline */
.timeline {
  display: grid;
  gap: 1.4rem;
  border-left: 2px solid rgba(197, 5, 12, 0.25);
  padding-left: 1.2rem;
}

.timeline-item {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 1rem 1rem;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.45rem;
  top: 1.1rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--uw-red);
}

.timeline-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0.6rem 0;
  font-style: italic;
}

.timeline-org {
  margin: 0.1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-item ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

/* Two-column layout */
.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.two-column h3 {
  margin-top: 0;
}

.two-column ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

/* Awards */
.awards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.award-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.9rem;
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
}

.award-item h3 {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  color: var(--uw-red);
}

/* CV section */
.cv-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.4rem;
}

/* Contact */
.contact-box {
  max-width: 460px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.2rem;
  border: 1px solid var(--border-subtle);
  text-align: left;
  font-size: 0.95rem;
}

.contact-box a {
  color: var(--uw-red);
  text-decoration: none;
}

.contact-box a:hover {
  text-decoration: underline;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  background-color: #ffffff;
  padding: 1.5rem 0 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-container {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: center;
}

.site-footer a {
  color: var(--uw-red);
  text-decoration: none;
}

/* Responsive tweaks for tablet and mobile */

/* 平板（含大螢幕手機橫放） */
@media (max-width: 900px) {
  .hero {
    padding-top: 3.75rem;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .hero-card {
    order: -1;              /* 卡片上移到人物介紹前面 */
  }

  .card-grid {
    grid-template-columns: 1fr;   /* 研究卡片一欄顯示 */
  }

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

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

  .two-column {
    grid-template-columns: 1fr;
  }
}

/* 手機（iPhone 等） */
@media (max-width: 640px) {
  /* 導航列強制實心背景，滑動不透明 */
  .site-header,
  .nav-container {
    background: rgba(247, 247, 249, 0.98) !important;  /* 實心白底 */
    backdrop-filter: none !important;                 /* 移除模糊 */
    -webkit-backdrop-filter: none !important;         /* iPhone Safari */
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);  /* 底線分隔 */
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);    /* 輕微陰影 */
  }

  .main-nav {
    background: transparent !important;               /* 導航內不重複背景 */
  }

  .main-nav a {
    background: transparent !important;               /* 連結不透明 */
    color: var(--text-dark) !important;               /* 深色文字 */
  }

  /* 確保導航文字清晰 */
  .site-header * {
    color: #1f2937 !important;
    text-shadow: none !important;
  }
  .timeline-meta {
      font-size: 0.85rem;
  }
  
  .container {
    padding: 0 1.1rem;
  }

  .nav-container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem 0.7rem;
    padding: 0.4rem 0.75rem;
  }

  .main-nav a {
    margin-left: 0.65rem;
    font-size: 0.78rem;
  }

  .hero {
    padding: 2.5rem 0 2rem !important;
  }

  .hero-icons {
    justify-content: flex-start;
    row-gap: 0.3rem;
  }

  .hero-icon {
    font-size: 0.8rem;
  }

  .hero-text h1 {
    font-size: 1.9rem;
  }

  .hero-subtitle {
    font-size: 0.96rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
  }

  .metric {
    padding: 0.9rem 0.5rem;
  }

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

  .hero-card,
  .card,
  .timeline-item,
  .contact-box {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  }

  /* 縮小整體 section padding */
  .section {
    padding: 2.25rem 0 !important;
  }

  .section-header {
    margin-bottom: 1.4rem;
  }

  .section-header h2 {
    font-size: 1.45rem;
  }

  .card-grid,
  .metrics-grid,
  .awards-grid {
    gap: 0.9rem;
  }

  .card,
  .timeline-item {
    padding: 1.1rem 1rem;
  }

  /* Publications 完整修復 */
  .pub-list {
    padding: 0;
  }

  .pub-item {
    padding: 0.9rem 0.8rem !important;
    margin-bottom: 0.8rem;
    word-wrap: break-word;
    overflow: hidden;
  }

  .pub-main {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 0.3rem;
  }

  .pub-meta {
    font-size: 0.78rem;
    color: #666;
    margin-bottom: 0.4rem;
  }

  .pub-meta span {
    display: inline-block;
    margin-right: 0.6rem;
    padding: 0.1rem 0.3rem;
    background: #f3f4f6;
    border-radius: 3px;
  }

  .pub-note {
    font-size: 0.82rem;
    margin: 0.4rem 0 0.5rem 0;
  }

  .pub-link {
    margin-top: 0;
    text-align: center;
  }

  .pub-link a,
  .pub-citation a {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(197, 5, 12, 0.08);
    color: #c5050c !important;
    border: 1px solid rgba(197, 5, 12, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none !important;
    word-break: break-all !important;
    max-width: 100%;
  }

  /* 舊版 citation 相容（若還在使用） */
  .pub-citation {
    font-size: 0.8rem !important;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  /* 手機版導航列：滑動時實心背景，不透明 */
  .site
}
