/* =========================================================
   蔡秀吉 — 學術與專案首頁
   Modern static site, light/dark mode, mobile-first
   ========================================================= */

:root {
  /* Light theme tokens */
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-sunken: #f4f4f5;
  --fg: #18181b;
  --fg-muted: #52525b;
  --fg-subtle: #71717a;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --accent: #0284c7;       /* sky-600 */
  --accent-hover: #0369a1; /* sky-700 */
  --accent-bg: #e0f2fe;    /* sky-100 */
  --warm: #ea580c;         /* orange-600, theatrical accent */
  --med: #be123c;          /* rose-700, medical */
  --net: #4f46e5;          /* indigo-600, networking */
  --ai: #0891b2;           /* cyan-600 */
  --code-bg: #f4f4f5;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-md: 0 4px 16px -2px rgb(0 0 0 / 0.06), 0 2px 4px -1px rgb(0 0 0 / 0.04);
  --shadow-lg: 0 12px 32px -8px rgb(0 0 0 / 0.10), 0 4px 8px -2px rgb(0 0 0 / 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --font-zh: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-en: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --max-width: 1100px;
  --space-section: clamp(2.5rem, 5vh, 4rem);
}

[data-theme="dark"] {
  --bg: #09090b;
  --bg-elevated: #18181b;
  --bg-sunken: #0c0c0e;
  --fg: #fafafa;
  --fg-muted: #a1a1aa;
  --fg-subtle: #7a7a83;  /* was #71717a (4.12:1 on dark bg — below AA); #7a7a83 = 4.68:1 */
  --border: #27272a;
  --border-strong: #3f3f46;
  --accent: #38bdf8;       /* sky-400 */
  --accent-hover: #7dd3fc; /* sky-300 */
  --accent-bg: #082f49;    /* sky-950 */
  --warm: #fb923c;
  --med: #fb7185;
  --net: #818cf8;
  --ai: #22d3ee;
  --code-bg: #27272a;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 16px -2px rgb(0 0 0 / 0.4), 0 2px 4px -1px rgb(0 0 0 / 0.2);
  --shadow-lg: 0 12px 32px -8px rgb(0 0 0 / 0.5), 0 4px 8px -2px rgb(0 0 0 / 0.3);
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  font-family: var(--font-zh), var(--font-en);
  font-size: 16px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Latin runs use Inter naturally; mixed text falls back to Noto */
.en, .hero-name .en, .brand-text, .kicker, .eyebrow, .btn, .tag,
.contact-label, .contact-value, .award-badge, .year {
  font-family: var(--font-en), var(--font-zh);
}

/* Headings */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.5rem, 7vw, 5rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.5rem); letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }

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

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

/* Skip link */
.skip {
  position: absolute; top: -40px; left: 16px;
  background: var(--accent); color: #fff;
  padding: 8px 16px; border-radius: var(--radius-sm);
  z-index: 100;
}
.skip:focus { top: 16px; }

/* ========================================================= */
/* View Transitions API — smooth cross-page navigation        */
/* ========================================================= */
@view-transition { navigation: auto; }
::view-transition-old(root) {
  animation: fade-out 180ms ease-out forwards;
}
::view-transition-new(root) {
  animation: fade-in 220ms ease-out 40ms backwards;
}
@keyframes fade-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes fade-in  { from { opacity: 0; transform: translateY(8px); } }

/* Shared elements morph instead of fade */
.topbar { view-transition-name: topbar; }
.site-footer { view-transition-name: footer; }

/* ========================================================= */
/* Topbar                                                     */
/* ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}
.topbar.scrolled {
  border-bottom-color: var(--border);
}
.topbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px clamp(1rem, 4vw, 2rem);
  display: flex; align-items: center; gap: 16px;
}

/* Cleaner typographic brand (no chunky logo box) */
.brand {
  display: flex; flex-direction: column;
  text-decoration: none;
  color: var(--fg);
  line-height: 1.15;
  padding: 4px 0;
  transition: color var(--transition);
}
.brand:hover { color: var(--accent); text-decoration: none; }
.brand-name {
  font-family: var(--font-zh);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-sub {
  font-family: var(--font-en);
  font-size: 10.5px;
  color: var(--fg-subtle);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.brand:hover .brand-sub { color: var(--accent); }

.topnav {
  flex: 1;
  display: flex; gap: clamp(4px, 1vw, 14px); justify-content: center;
  flex-wrap: wrap;
}
.topnav a {
  color: var(--fg-muted);
  font-size: 13.5px; font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  position: relative;
  transition: color var(--transition);
  text-decoration: none;
}
.topnav a:hover {
  color: var(--fg);
}
/* Active page indicator (added via JS) */
.topnav a.active {
  color: var(--accent);
}
.topnav a.active::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.theme-toggle {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 9px; cursor: pointer;
  color: var(--fg-muted);
  transition: all var(--transition);
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="light"] .theme-toggle .i-moon { display: none; }
[data-theme="dark"]  .theme-toggle .i-sun  { display: none; }

@media (max-width: 720px) {
  .topnav { display: none; }
}

/* ========================================================= */
/* Hero */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 6rem) clamp(1rem, 4vw, 2rem) clamp(4rem, 10vh, 7rem);
  min-height: 70vh;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: center;
}
.eyebrow {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin: 0 0 1rem;
  font-weight: 500;
}
.hero-name {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 1.5rem;
}
.hero-name .zh {
  font-family: var(--font-zh);
  font-weight: 900;
  color: var(--fg); /* fallback if gradient/color-mix not supported */
  background: linear-gradient(135deg, var(--fg) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-name .en {
  font-weight: 600;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  color: var(--fg-muted);
  letter-spacing: -0.01em;
}
.hero-tagline {
  font-size: clamp(1.125rem, 2vw, 1.4rem);
  color: var(--fg);
  font-style: italic;
  font-weight: 500;
  margin: 1rem 0 1.5rem;
  line-height: 1.5;
}
.hero-summary {
  color: var(--fg-muted);
  max-width: 56ch;
  font-size: 1.05rem;
  margin-bottom: 2rem;
}
.hero-summary strong { color: var(--fg); font-weight: 600; }

.hero-cta {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--fg);
  font-size: 14px; font-weight: 500;
  transition: all var(--transition);
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-primary {
  background: var(--fg); color: var(--bg);
  border-color: var(--fg);
}
.btn-primary:hover {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

.hero-avatar {
  position: relative;
  width: clamp(140px, 22vw, 220px);
  aspect-ratio: 1;
}
.hero-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative; z-index: 2;
  border: 3px solid var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}
.avatar-glow {
  position: absolute; inset: -20%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 25%, transparent), transparent 70%);
  filter: blur(40px);
  z-index: 1;
  animation: glow 8s ease-in-out infinite alternate;
}
@keyframes glow {
  from { opacity: 0.4; transform: scale(0.95); }
  to   { opacity: 0.7; transform: scale(1.05); }
}

.scroll-hint {
  position: absolute; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: var(--fg-subtle); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.15em;
  text-decoration: none;
  animation: bob 2.5s ease-in-out infinite;
}
.scroll-hint svg { width: 16px; height: 16px; }
.scroll-hint:hover { color: var(--accent); text-decoration: none; }
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 5px); }
}

@media (max-width: 720px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-avatar { order: -1; margin: 0 auto 1rem; }
  .scroll-hint { display: none; }
}

/* ========================================================= */
/* Sections */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-section) clamp(1rem, 4vw, 2rem);
  scroll-margin-top: 80px;
}
.section-head {
  margin-bottom: 2.5rem;
  max-width: 700px;
}
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 0.75rem;
  text-transform: uppercase;
}
.section-sub {
  color: var(--fg-muted);
  font-size: 1.05rem;
  margin-top: 0.75rem;
}
.lead {
  font-size: 1.2rem;
  line-height: 1.65;
  color: var(--fg);
  font-weight: 500;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: clamp(2rem, 4vw, 3rem);
  align-items: start;
}
.about-text p { color: var(--fg-muted); }
.about-text .lead { color: var(--fg); margin-bottom: 1rem; }
.about-now {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.about-now h3 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.about-now ul {
  list-style: none; padding: 0; margin: 0 0 1rem;
}
.about-now li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 6px 0;
  font-size: 0.95rem;
  color: var(--fg);
}
.dot {
  width: 6px; height: 6px; margin-top: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.2); }
}
.about-now .muted { font-size: 0.85rem; margin-top: 0.5rem; }
.muted { color: var(--fg-subtle); }
@media (max-width: 720px) { .about-grid { grid-template-columns: 1fr; } }

/* Tag / year pills — .tag-net/med/ai also color the experience timeline dots */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-sunken);
  color: var(--fg-muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tag-net { background: color-mix(in srgb, var(--net) 12%, transparent); color: var(--net); }
.tag-med { background: color-mix(in srgb, var(--med) 12%, transparent); color: var(--med); }
.tag-ai  { background: color-mix(in srgb, var(--ai) 14%, transparent);  color: var(--ai); }
.year { color: var(--fg-subtle); font-family: var(--font-mono); font-size: 11px; }

/* Writing (blog) */
.blog-list {
  list-style: none; padding: 0; margin: 0 0 1.5rem;
  display: flex; flex-direction: column; gap: 4px;
}
.blog-list li {
  display: grid; grid-template-columns: 1fr auto; gap: 1rem;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  transition: padding var(--transition);
}
.blog-list li:hover { padding-left: 8px; }
.blog-list li a {
  font-weight: 500;
  color: var(--fg);
  font-size: 1.05rem;
}
.blog-list li a:hover { color: var(--accent); }
.blog-list li time {
  color: var(--fg-subtle);
  font-size: 13px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.blog-loading { color: var(--fg-subtle); }
.more-link {
  display: inline-block;
  font-weight: 500;
  margin-top: 1rem;
}

/* Link list (medical, teaching) */
.link-list {
  list-style: none; padding: 0; margin: 0;
}
.link-list li {
  display: flex; flex-wrap: wrap; gap: 1rem;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
  justify-content: space-between;
}
.link-list li a {
  font-weight: 500;
  color: var(--fg);
}
.link-list li strong a { font-weight: 700; }
.link-list li a:hover { color: var(--accent); }
.link-list li span { color: var(--fg-subtle); font-size: 0.9rem; }

/* Community */
.community-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.community-grid h3 { color: var(--fg); margin-bottom: 0.75rem; }
.community-grid p { color: var(--fg-muted); font-size: 0.95rem; }
.award {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: color-mix(in srgb, var(--warm) 12%, transparent);
  border-left: 3px solid var(--warm);
  border-radius: 0 8px 8px 0;
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 500;
}
.award-badge {
  background: var(--warm); color: #fff;
  padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
}
@media (max-width: 720px) { .community-grid { grid-template-columns: 1fr; } }

/* Contact */
.section-contact {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  max-width: none;
  margin-top: var(--space-section);
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
}
.section-contact > * {
  max-width: var(--max-width);
  margin-left: auto; margin-right: auto;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1rem;
}
.contact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all var(--transition);
  display: flex; flex-direction: column; gap: 6px;
}
.contact-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}
.contact-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-subtle);
  font-weight: 600;
}
.contact-value {
  font-size: 0.95rem;
  color: var(--fg);
  font-weight: 500;
  word-break: break-all;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 3rem clamp(1rem, 4vw, 2rem) 4rem;
  color: var(--fg-subtle);
  font-size: 0.875rem;
}
.verse {
  font-family: var(--font-zh);
  font-style: italic;
  font-size: 1rem;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}
.verse small { display: block; font-size: 0.75rem; margin-top: 4px; color: var(--fg-subtle); }
.footer-meta { margin: 0.5rem 0; }
.visitor-badge img { display: inline-block; vertical-align: middle; }

/* Reveal animation */
[data-reveal] {
  opacity: 0; transform: translateY(20px);
  transition: opacity 600ms ease-out, transform 600ms ease-out;
}
[data-reveal].in-view {
  opacity: 1; transform: translateY(0);
}

/* Selection */
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--fg); }

/* ========================================================= */
/* Sidebar (Education / Skills / Honors)                      */
/* ========================================================= */
.sidebar {
  display: flex; flex-direction: column; gap: 1rem;
}
.sidebar-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}
.sidebar-block h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}

/* Education list */
.edu-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 0.875rem;
}
.edu-list li {
  display: flex; flex-direction: column; gap: 2px;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--border);
}
.edu-list li:last-child { border-bottom: none; padding-bottom: 0; }
.edu-school { font-weight: 600; font-size: 0.92rem; color: var(--fg); line-height: 1.35; }
.edu-major { font-size: 0.82rem; color: var(--fg-muted); }
.edu-year { font-family: var(--font-mono); font-size: 0.72rem; color: var(--fg-subtle); letter-spacing: 0.04em; }

/* Honor list */
.honor-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 0.75rem;
}
.honor-list li {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 0.85rem;
}
.honor-list li strong { color: var(--fg); font-weight: 600; }
.honor-list li span { font-size: 0.72rem; color: var(--fg-subtle); font-family: var(--font-mono); }

/* Skills */
.skill-cluster { display: flex; flex-direction: column; gap: 0.875rem; }
.skill-group { display: flex; flex-direction: column; gap: 4px; }
.skill-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-subtle); font-weight: 700;
}
.skill-chips {
  font-size: 0.88rem; color: var(--fg);
  line-height: 1.5;
}

/* ========================================================= */
/* CNCF PR list                                               */
/* ========================================================= */
.pr-list {
  list-style: none; padding: 0; margin: 0 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.pr {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
  transition: transform var(--transition), border-color var(--transition);
}
.pr:hover {
  border-left-color: var(--accent-hover);
  transform: translateX(3px);
}
.pr-head {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.pr-repo {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--fg);
  text-decoration: none;
}
.pr-repo:hover { color: var(--accent); text-decoration: underline; }
.pr-org {
  display: inline-block;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  border-radius: 4px;
  text-transform: uppercase;
}
.pr-desc {
  color: var(--fg-muted);
  font-size: 0.92rem;
  margin: 0;
  line-height: 1.6;
}
.pr-desc code {
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--fg);
}
.pr-desc strong { color: var(--fg); font-weight: 600; }
.pr-stats {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 500;
}

/* ========================================================= */
/* Timeline (Experience)                                      */
/* ========================================================= */
.timeline {
  list-style: none; padding: 0; margin: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 12px; bottom: 12px;
  width: 1px;
  background: var(--border);
}
.tl-item {
  position: relative;
  padding-left: 32px;
  padding-bottom: 2rem;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute;
  left: 0; top: 10px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--border);
}
.tl-dot.tag-net { background: var(--net); }
.tl-dot.tag-med { background: var(--med); }
.tl-dot.tag-ai  { background: var(--ai); }
.tl-dot.tag-edu { background: var(--warm); }
.tl-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  margin-bottom: 0.5rem;
}
.tl-head h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.tl-org { font-size: 0.9rem; color: var(--fg-muted); }
.tl-when {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--fg-subtle);
  margin-left: auto;
  letter-spacing: 0.04em;
}
.tl-bullets {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.tl-bullets li {
  font-size: 0.92rem;
  color: var(--fg-muted);
  position: relative;
  padding-left: 18px;
  line-height: 1.6;
}
.tl-bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}
.tl-bullets li strong { color: var(--fg); font-weight: 600; }
.tl-bullets li a { font-weight: 500; }

/* Education tag color (warm) */
.tag-edu {
  background: color-mix(in srgb, var(--warm) 14%, transparent);
  color: var(--warm);
}

/* Contact location footer */
.contact-location {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* Sidebar layout on mobile: stack below text */
@media (max-width: 720px) {
  .timeline::before { left: 5px; }
  .tl-dot { left: -2px; width: 13px; height: 13px; }
  .tl-when { margin-left: 0; width: 100%; }
  .pr-head { gap: 8px; }
}

/* ========================================================= */
/* Homepage nav cards (big interactive grid)                  */
/* ========================================================= */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.nav-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 1.5rem 1.5rem 1.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--fg);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}
.nav-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, color-mix(in srgb, var(--accent) 8%, transparent) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.nav-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.nav-card:hover::before { opacity: 1; }
.nav-card-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--fg-subtle);
  margin-bottom: 0.5rem;
}
.nav-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
  display: flex; align-items: center; gap: 8px;
}
.nav-card-title .arrow {
  font-size: 1.05rem;
  color: var(--fg-subtle);
  transition: transform var(--transition), color var(--transition);
}
.nav-card:hover .nav-card-title .arrow {
  color: var(--accent);
  transform: translate(3px, -3px);
}
.nav-card-desc {
  color: var(--fg-muted);
  font-size: 0.93rem;
  line-height: 1.6;
  margin: 0;
}
.nav-card-meta {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.78rem;
  color: var(--fg-subtle);
  font-family: var(--font-mono);
}

/* Special: external links visually marked */
.nav-card.external .nav-card-title .arrow::before { content: "↗"; }
.nav-card:not(.external) .nav-card-title .arrow::before { content: "→"; }

/* ========================================================= */
/* Page-specific layout: subpages have less top padding       */
/* ========================================================= */
.page-hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(2.5rem, 5vh, 4rem) clamp(1rem, 4vw, 2rem) clamp(1rem, 2vh, 2rem);
}
.page-hero .eyebrow { margin-bottom: 0.5rem; }
.page-hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.page-hero .page-sub {
  color: var(--fg-muted);
  font-size: 1.1rem;
  max-width: 60ch;
}
.page-hero + .section { padding-top: 1rem; }

/* Long-form article column (e.g. /PE/ medical notes) */
.prose { max-width: 72ch; }
.prose > section + section { margin-top: 2.75rem; }

/* ========================================================= */
/* Foundations section (Open Source page)                     */
/* ========================================================= */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 1rem;
  margin-bottom: 0;
}
.stat-card {
  display: flex; flex-direction: column;
  padding: 1.25rem 1.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.stat-num {
  font-family: var(--font-en);
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  margin-top: 0.5rem;
  letter-spacing: -0.01em;
}
.stat-sub {
  font-size: 0.75rem;
  color: var(--fg-subtle);
  margin-top: 0.25rem;
}
/* Stat card as a link (homepage "at a glance") */
a.stat-card {
  color: inherit;
  text-decoration: none;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
a.stat-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
a.stat-card:hover .stat-label { color: var(--accent); }

.foundation-section {
  padding-top: clamp(2rem, 4vh, 3rem);
  padding-bottom: clamp(2rem, 4vh, 3rem);
}
.foundation-header {
  display: flex; align-items: flex-start; gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.foundation-tag {
  flex-shrink: 0;
  display: inline-block;
  padding: 5px 11px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  margin-top: 6px;
}
.cncf-tag { background: #326CE5; color: #ffffff; }
.lfn-tag  { background: #003366; color: #ffffff; }
.aswf-tag { background: #DC2626; color: #ffffff; }
.pytorch-tag { background: #ee4c2c; color: #ffffff; }
.docker-tag { background: #1d63ed; color: #ffffff; }
.lfdirect-tag { background: #6f42c1; color: #ffffff; }
.lfai-tag { background: #0f766e; color: #ffffff; }
.huggingface-tag { background: #FFD21E; color: #111827; }
.foundation-sub { font-size: 0.7em; font-weight: 400; opacity: 0.7; margin-left: 0.4em; }
.foundation-meta { flex: 1; min-width: 0; }
.foundation-meta h2 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.4rem, 2.5vw, 1.85rem);
}
.foundation-stats {
  font-size: 1rem;
  color: var(--fg);
  margin-bottom: 0.4rem;
}
.foundation-stats strong { color: var(--accent); font-weight: 700; }
.foundation-desc {
  font-size: 0.92rem;
  margin: 0;
}

.pr-stats-inline {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-subtle);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.stat-merged { color: #16a34a; font-weight: 600; }
.stat-open   { color: var(--accent); font-weight: 500; }
.stat-closed { color: var(--fg-subtle); }
[data-theme="dark"] .stat-merged { color: #4ade80; }

@media (max-width: 600px) {
  .foundation-header { flex-direction: column; gap: 0.75rem; }
  .pr-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  /* tighten inter-section spacing on phones (the @media-print rule below never fired on screens) */
  .section { padding-top: 2rem; padding-bottom: 2rem; }
}

/* ========================================================= */
/* Capability cards (Open Source page hero feature)           */
/* ========================================================= */
.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 1.25rem;
}
.cap-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem 1.4rem;
  display: flex; flex-direction: column;
  gap: 0.85rem;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.cap-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.cap-head {
  display: flex; flex-direction: column; gap: 4px;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.cap-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--fg);
}
.cap-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-subtle);
  letter-spacing: 0.02em;
}
.cap-count strong { color: var(--accent); font-weight: 700; }
.cap-desc {
  color: var(--fg-muted);
  font-size: 0.94rem;
  line-height: 1.65;
  margin: 0;
  flex: 1;
}
.cap-desc strong { color: var(--fg); font-weight: 600; }
.cap-evidence {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: auto;
}
.cap-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: all var(--transition);
}
.cap-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.cap-chip.strong {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-elevated));
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
  font-weight: 600;
}
.cap-chip em {
  font-style: normal;
  font-weight: 700;
  color: var(--accent);
  margin-left: 2px;
}

/* ========================================================= */
/* Stack block (Languages / Frameworks / Domains / Tools)     */
/* ========================================================= */
.stack-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
}
.stack-row {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px dashed var(--border);
}
.stack-row:last-child { border-bottom: none; padding-bottom: 0; }
.stack-row:first-child { padding-top: 0; }
.stack-label {
  width: 100px;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.stack-chips {
  flex: 1;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.stack-chip {
  padding: 4px 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.83rem;
  color: var(--fg);
  white-space: nowrap;
}
.stack-chip em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg-subtle);
  margin-left: 6px;
  font-weight: 500;
}
.stack-chip.primary {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--fg);
  font-weight: 600;
}
.stack-chip.primary em { color: var(--accent); font-weight: 700; }

@media (max-width: 600px) {
  .stack-row { flex-direction: column; gap: 0.5rem; }
  .stack-label { width: auto; }
}

/* ========================================================= */
/* Merge list (Recent merged PRs timeline)                    */
/* ========================================================= */
.merge-list {
  list-style: none; padding: 0; margin: 0;
  counter-reset: merge;
}
.merge-list li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1.25rem;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.merge-list li:last-child { border-bottom: none; }
.merge-list li:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.merge-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg-subtle);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.merge-content {
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.merge-pr {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: -0.005em;
}
.merge-pr:hover { text-decoration: underline; }
.merge-title {
  color: var(--fg);
  font-size: 0.92rem;
  line-height: 1.45;
}

@media (max-width: 600px) {
  .merge-list li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Collapsible merge-list (CSS-only, no JS) ----------------- */
/* checkbox visually hidden but keyboard-focusable + in a11y tree */
.merge-toggle-cb {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.merge-collapse {
  position: relative;
  max-height: 760px;
  overflow: hidden;
  transition: max-height 0.45s ease;
}
/* fade cue at the bottom while collapsed */
.merge-collapse::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 110px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  transition: opacity 0.3s ease;
}
/* expanded cap must exceed the full list height (~114px/item on narrow mobile); bump if the list outgrows it */
.merge-toggle-cb:checked ~ .merge-collapse { max-height: 12000px; }
.merge-toggle-cb:checked ~ .merge-collapse::after { opacity: 0; }
/* toggle button (a <label>; text driven by data-total + checked state) */
.merge-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-family: var(--font-en);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--bg-elevated);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--transition), background var(--transition);
}
.merge-toggle:hover { border-color: var(--accent); background: var(--accent-bg); }
.merge-toggle::after { content: "顯示全部 " attr(data-total) " 筆  ▾"; }
.merge-toggle-cb:checked ~ .merge-toggle::after { content: "收合  ▴"; }
.merge-toggle-cb:focus-visible ~ .merge-toggle {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .merge-collapse { transition: none; }
}

/* Other foundation tag color */
.other-tag { background: #6b7280; color: #ffffff; }
[data-theme="dark"] .other-tag { background: #9ca3af; color: #111827; }

/* ========================================================= */
/* Repo list (Foundation reference compact view)              */
/* ========================================================= */
.foundation-section + .foundation-section { margin-top: 2rem; }
.foundation-section .foundation-header h3 {
  font-size: 1.2rem; font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}
.repo-list {
  list-style: none; padding: 0; margin: 0;
}
.repo-list li {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 1rem; padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.repo-list li:last-child { border-bottom: none; }
.repo-list li a {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--fg);
  text-decoration: none;
}
.repo-list li a:hover { color: var(--accent); text-decoration: underline; }
.repo-stat {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--fg-subtle);
  white-space: normal;
  min-width: 0;
}

/* ========================================================= */
/* Ultrathink 2026: Progressive Disclosure + Category Chips   */
/* ========================================================= */

/* <details> as collapsible year section */
details.year-fold {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0 0;
  margin: 0;
}
details.year-fold > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--fg-muted);
  transition: color var(--transition);
}
details.year-fold > summary::-webkit-details-marker { display: none; }
details.year-fold > summary::before {
  content: '＋';
  display: inline-block;
  font-size: 1rem;
  color: var(--fg-subtle);
  width: 1.25em;
  transition: transform var(--transition), color var(--transition);
}
details.year-fold[open] > summary::before {
  content: '－';
  color: var(--accent);
}
details.year-fold > summary:hover { color: var(--fg); }
details.year-fold > summary:hover::before { color: var(--accent); }
details.year-fold > summary .yr-count {
  font-size: 0.85rem;
  color: var(--fg-subtle);
  font-weight: 400;
  font-family: var(--font-mono);
}
details.year-fold[open] > summary {
  color: var(--fg);
  border-bottom: 1px solid var(--border);
}
details.year-fold .link-list { margin-top: 0.5rem; }

/* Inline category chip — at-a-glance scanning */
.cat-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 0.5rem;
  vertical-align: 0.1em;
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  background: var(--bg-sunken);
  white-space: nowrap;
}
.cat-chip.cat-award { color: #c2410c; border-color: color-mix(in srgb, var(--warm) 40%, var(--border)); background: color-mix(in srgb, var(--warm) 8%, transparent); }
.cat-chip.cat-talk  { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cat-chip.cat-comp  { color: var(--net); border-color: color-mix(in srgb, var(--net) 40%, var(--border)); background: color-mix(in srgb, var(--net) 8%, transparent); }
.cat-chip.cat-prog  { color: var(--ai); border-color: color-mix(in srgb, var(--ai) 40%, var(--border)); background: color-mix(in srgb, var(--ai) 8%, transparent); }
.cat-chip.cat-media { color: var(--med); border-color: color-mix(in srgb, var(--med) 40%, var(--border)); background: color-mix(in srgb, var(--med) 8%, transparent); }
.cat-chip.cat-pub   { color: var(--accent-hover); border-color: color-mix(in srgb, var(--accent-hover) 40%, var(--border)); background: color-mix(in srgb, var(--accent-hover) 8%, transparent); }
.cat-chip.cat-svc   { color: var(--fg-muted); border-color: var(--border-strong); }
/* cat-award glyph: light-mode --warm (#ea580c) on the pale chip is only 3.4:1; the line above
   uses a darker orange for AA text contrast. Dark mode keeps the bright --warm (#fb923c = 8.8:1). */
[data-theme="dark"] .cat-chip.cat-award { color: var(--warm); }

/* Honors year-timeline rows lead with a category chip, so the <li> has 3 children
   (chip + title + meta). Lay them out as a media object: the chip sits in a fixed left
   "category rail", and the title + meta stack in a shared content column so the meta reads
   as a description directly under its title (tight proximity, scannable). This grid is
   identical at every width — the content column just narrows — so no mobile rule is needed. */
.link-list li:has(.cat-chip) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.7rem;
  row-gap: 0.2rem;
  align-items: baseline;
}
.link-list li:has(.cat-chip) > .cat-chip { grid-column: 1; grid-row: 1; }
.link-list li:has(.cat-chip) > strong,
.link-list li:has(.cat-chip) > span:not(.cat-chip) { grid-column: 2; min-width: 0; }

/* Generic <details> for "show more" patterns */
details.more-fold {
  margin-top: 1rem;
}
details.more-fold > summary {
  cursor: pointer;
  list-style: none;
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
details.more-fold > summary::-webkit-details-marker { display: none; }
details.more-fold > summary::after {
  content: ' ▾';
  color: var(--fg-subtle);
}
details.more-fold[open] > summary::after { content: ' ▴'; }
details.more-fold > summary:hover {
  color: var(--fg);
  border-color: var(--accent);
}
details.more-fold[open] > summary {
  color: var(--accent-hover);  /* var(--accent) was 3.9:1 in light; --accent-hover = 5.7:1 */
  border-color: var(--accent);
  margin-bottom: 1rem;
}

/* Unified Experience timeline: inline year marker */
.tl-year-mark {
  position: relative;
  list-style: none;
  padding: 2rem 0 0.5rem 0;
  margin-left: -2rem;
  font-family: var(--font-en);
  font-weight: 800;
  font-size: 2rem;
  color: var(--fg);
  letter-spacing: -0.02em;
  border: none;
  background: none;
}
.tl-year-mark::before {
  content: '';
  display: block;
  width: 2rem;
  height: 1px;
  background: var(--border-strong);
  margin-bottom: 0.5rem;
}
.timeline > .tl-year-mark + .tl-item { padding-top: 0.25rem; }
.timeline > li:first-child.tl-year-mark { padding-top: 0; }

/* Tighter spacing for link-list inside year sections */
.year-fold .link-list li {
  padding: 10px 0;
  font-size: 0.95rem;
}

/* ========================================================= */
/* Print friendly                                             */
/* ========================================================= */
@media print {
  .topbar, .scroll-hint, .theme-toggle, .visitor-badge, .avatar-glow { display: none !important; }
  body { background: white; color: black; }
  a { color: black; text-decoration: underline; }
  .section { padding: 1.5rem 0; }
  .pr, .sidebar-block { box-shadow: none; border-color: #ccc; }
  .timeline::before { background: #ccc; }
  details.year-fold, details.more-fold { display: block; }
  details.year-fold > summary, details.more-fold > summary { list-style: none; }
  details.year-fold[open] > summary::before, details.more-fold > summary::after { content: ''; }
  details:not([open]) > *:not(summary) { display: revert !important; }
}

/* ========================================================= */
/* Publications page                                          */
/* ========================================================= */
.pub-head-links {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 1.25rem;
}
.pub-year {
  font-family: var(--font-en);
  font-weight: 800;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--fg);
  letter-spacing: -0.02em;
  margin: 2.5rem 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 0.75rem;
}
.pub-year:first-of-type { margin-top: 0; }
.pub-year-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--fg-subtle);
}
.pub-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 1.1rem;
}
.pub {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.3rem 1.5rem;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.pub:hover {
  transform: translateX(3px);
  border-left-color: var(--accent-hover);
  box-shadow: var(--shadow-md);
}
.pub-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px;
  margin-bottom: 0.75rem;
}
.pub-meta .cat-chip { margin-right: 0; }
.pub-date {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
}
.pub-title {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin: 0 0 0.4rem;
}
.pub-title a { color: var(--fg); }
.pub-title a:hover { color: var(--accent); }
.pub-authors {
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin: 0 0 0.4rem;
  line-height: 1.6;
}
.pub-authors strong { color: var(--fg); font-weight: 700; }
.pub-venue {
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  line-height: 1.5;
  margin: 0 0 0.65rem;
  word-break: break-word;
}
.pub-desc {
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.65;
  margin: 0 0 0.85rem;
}
.pub-links {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.pub-links a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}
.pub-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
@media (max-width: 600px) {
  .pub-meta .pub-date { margin-left: 0; width: 100%; }
}
