:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #f0f1ed;
  --text: #17201c;
  --secondary: #59635e;
  --muted: #626b67;
  --border: #d8dcd7;
  --accent: #17624a;
  --accent-soft: #e1ece7;
  --header: rgb(247 247 244 / 92%);
  --shell: 800px;
}

html.dark {
  color-scheme: dark;
  --bg: #121714;
  --surface: #19201c;
  --text: #edf0ed;
  --secondary: #aab3ae;
  --muted: #808b85;
  --border: #303934;
  --accent: #8fc8ad;
  --accent-soft: #20372d;
  --header: rgb(18 23 20 / 92%);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body { display: flex; min-height: 100vh; flex-direction: column; margin: 0; overflow-x: hidden; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
main { flex: 1; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 3px solid #c8e66a; outline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
.shell { width: min(calc(100% - 2.5rem), var(--shell)); margin-inline: auto; }

.skip-link { position: fixed; z-index: 100; top: 0.75rem; left: 0.75rem; padding: 0.55rem 0.9rem; border-radius: 6px; background: var(--text); color: var(--bg); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.site-header { position: sticky; z-index: 20; top: 0; border-bottom: 1px solid transparent; background: var(--header); backdrop-filter: blur(12px); }
.site-header.is-scrolled { border-color: var(--border); }
.header-inner { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 1.75rem; min-height: 62px; }
.wordmark { display: inline-flex; align-items: center; justify-self: start; }
.wordmark img { width: 30px; height: 30px; }
.primary-nav { display: flex; gap: 1.6rem; color: var(--secondary); font-size: 0.78rem; font-weight: 650; }
.primary-nav a:hover, .primary-nav a[aria-current="page"], .social-links a:hover, .text-link:hover, .site-footer a:hover { color: var(--accent); }
.theme-toggle { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.theme-icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.theme-icon-sun, .dark .theme-icon-moon { display: none; }
.dark .theme-icon-sun { display: block; }

.hero { padding: clamp(3.5rem, 6vw, 4.75rem) 0; border-bottom: 1px solid var(--border); }
.hero-grid { display: grid; grid-template-columns: 160px minmax(0, 600px); align-items: center; justify-content: space-between; gap: 2.5rem; }
.hero-copy { min-width: 0; }
.eyebrow { margin: 0 0 0.7rem; color: var(--accent); font-size: 0.67rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.hero h1, .page-hero h1 { max-width: 680px; margin: 0; overflow-wrap: break-word; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.25rem, 4vw, 3.1rem); font-weight: 400; letter-spacing: -0.04em; line-height: 1.08; }
.name-chinese { color: var(--secondary); font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif; font-size: 0.58em; font-weight: 500; letter-spacing: 0; white-space: nowrap; }
.hero-intro, .page-intro { max-width: 610px; margin: 1rem 0 0; color: var(--secondary); font-size: 0.98rem; }
.portrait { width: 160px; height: 160px; aspect-ratio: 1; border: 1px solid var(--border); border-radius: 50%; object-fit: cover; object-position: 50% 18%; }
.hero-copy { grid-column: 2; grid-row: 1; }
.portrait { grid-column: 1; grid-row: 1; }
.social-links { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 1.25rem; color: var(--secondary); font-size: 0.74rem; font-weight: 650; }

.section { padding: clamp(2.75rem, 5vw, 3.75rem) 0; border-bottom: 1px solid var(--border); }
.section-muted { background: var(--surface); }
.section-grid { display: block; }
.section h2, .contact h2 { margin: 0; font-size: 1rem; font-weight: 750; letter-spacing: -0.015em; }
.section-grid > h2 { margin-bottom: 1.25rem; }
.section-label { display: flex; max-width: 100%; align-items: baseline; justify-content: space-between; margin-bottom: 1.25rem; }
.section-label .text-link { display: inline-block; color: var(--accent); font-size: 0.72rem; font-weight: 700; }
.prose { max-width: 100%; }
.prose p { margin: 0 0 1rem; color: var(--secondary); }
.prose .lead { color: var(--text); font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.25rem, 2.2vw, 1.55rem); line-height: 1.42; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.tag-list li { padding: 0.35rem 0.65rem; border: 1px solid var(--border); border-radius: 999px; color: var(--secondary); font-size: 0.7rem; font-weight: 650; }

.tools-content { max-width: 100%; }
.section-note { max-width: 680px; margin: 0 0 1.25rem; color: var(--secondary); font-size: 0.86rem; }
.tool-groups { display: grid; max-width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.tool-group { min-width: 0; padding: 1.15rem 1.25rem 1.15rem 0; border-bottom: 1px solid var(--border); }
.tool-group:nth-child(even) { padding-right: 0; padding-left: 1.25rem; border-left: 1px solid var(--border); }
.tool-group h3 { margin: 0 0 0.7rem; font-size: 0.78rem; }
.tool-group ul { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.tool-group li { padding: 0.3rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; color: var(--secondary); font-size: 0.67rem; font-weight: 650; }

.timeline { max-width: 100%; border-top: 1px solid var(--border); }
.timeline-entry { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 1.75rem; padding: 1.3rem 0; border-bottom: 1px solid var(--border); }
.timeline-meta { display: flex; align-items: flex-start; flex-direction: column; gap: 0.45rem; padding-top: 0.1rem; color: var(--muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.timeline-meta span { padding: 0.15rem 0.45rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.56rem; }
.timeline-content h3, .education-list h3 { margin: 0; font-size: 0.98rem; }
.role { margin: 0.05rem 0 0.55rem; color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.timeline-content > p:not(.role), .timeline-content li, .education-list article > p:not(.role) { color: var(--secondary); font-size: 0.84rem; }
.timeline-content > p:last-child { margin-bottom: 0; }
.timeline-content ul { margin: 0.65rem 0 0; padding-left: 1.1rem; }
.timeline-content li + li { margin-top: 0.35rem; }
.timeline-content a { text-decoration: underline; text-underline-offset: 3px; }

.project-list { max-width: 100%; border-top: 1px solid var(--border); }
.project-row { display: grid; grid-template-columns: 145px minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 1.1rem 0; border-bottom: 1px solid var(--border); transition: color 150ms ease; }
.project-row > span:first-child { color: var(--muted); font-size: 0.68rem; }
.project-row strong { font-size: 0.9rem; }
.project-row > span:last-child { color: var(--muted); }
.project-row:hover { color: var(--accent); }

.education-list { max-width: 100%; border-top: 1px solid var(--border); }
.education-list article { padding: 1.3rem 0; border-bottom: 1px solid var(--border); }
.education-list time { display: block; margin-bottom: 0.45rem; color: var(--muted); font-size: 0.66rem; font-weight: 700; }
.education-list article > p:not(.role) { margin-bottom: 0; }

.contact { padding: 2.5rem 0; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text); }
.contact-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.contact h2 { font-size: 1.35rem; }
.contact p { margin: 0.35rem 0 0; color: var(--secondary); font-size: 0.84rem; }
.button { display: inline-flex; flex: 0 0 auto; min-height: 42px; align-items: center; padding: 0.55rem 1rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.75rem; font-weight: 750; }
.button:hover { border-color: var(--accent); color: var(--accent); }

.site-footer { padding: 1.5rem 0; color: var(--muted); font-size: 0.7rem; }
.footer-inner, .site-footer nav { display: flex; align-items: center; justify-content: space-between; gap: 1.4rem; }
.footer-inner p { margin: 0; }

.page-hero { padding: clamp(2.75rem, 5vw, 4rem) 0; border-bottom: 1px solid var(--border); }
.page-hero .eyebrow { margin-bottom: 0.8rem; }
.page-hero h1 { font-size: clamp(2.25rem, 4vw, 3rem); }
.page-section { padding: clamp(2rem, 4vw, 3rem) 0; }
.showcase { max-width: 850px; border-top: 1px solid var(--border); }
.showcase-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 2.5rem; padding: 2rem 0; border-bottom: 1px solid var(--border); scroll-margin-top: 5rem; }
.showcase-meta { color: var(--muted); font-size: 0.7rem; }
.showcase-meta strong { display: block; margin-bottom: 0.35rem; color: var(--accent); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; }
.showcase-content h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 400; letter-spacing: -0.03em; }
.showcase-content p { max-width: 660px; color: var(--secondary); font-size: 0.9rem; }
.showcase-content a { color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.empty-state { max-width: 660px; padding: 1.75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.empty-state h2 { margin: 0 0 0.7rem; font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 400; }
.empty-state p { margin: 0; color: var(--secondary); }
.topic-list { display: flex; flex-wrap: wrap; gap: 0.45rem 0.9rem; margin: 1.4rem 0 0; padding: 0; list-style: none; }
.topic-list li { color: var(--muted); font-size: 0.72rem; }

@media (max-width: 720px) {
  .shell { width: min(calc(100% - 2rem), var(--shell)); }
  .header-inner { grid-template-columns: auto 1fr auto; gap: 0.85rem; }
  .primary-nav { justify-self: end; gap: 1rem; }
  .hero { padding: 2.75rem 0; }
  .hero-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .portrait { grid-column: 1; grid-row: 1; }
  .hero-copy { grid-column: 1; grid-row: 2; }
  .hero h1 { font-size: clamp(1.95rem, 8.3vw, 2.15rem); }
  .portrait { width: 120px; height: 120px; }
  .section { padding: 2.5rem 0; }
  .showcase-item { grid-template-columns: 1fr; gap: 0.9rem; padding: 1.6rem 0; }
  .timeline-entry { grid-template-columns: 1fr; gap: 0.55rem; }
  .timeline-meta { flex-direction: row; align-items: center; }
  .tool-groups { grid-template-columns: 1fr; }
  .tool-group { padding: 1rem 0; }
  .tool-group:nth-child(even) { padding: 1rem 0; border-left: 0; }
  .project-row { grid-template-columns: 1fr auto; }
  .project-row > span:first-child { grid-column: 1 / -1; }
  .contact-inner { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 430px) {
  .primary-nav { gap: 0.8rem; }
  .theme-toggle { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
