/* Monochrome research portfolio. All essential content works without JavaScript. */
@layer reset, base, layout, components, accessibility;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, h4, p, figure { margin: 0; }
  img { display: block; max-width: 100%; height: auto; }
}
@layer base {
  :root {
    color-scheme: light dark;
    --bg: #fff; --ink: #191a1e; --muted: #626671; --accent: #2854df;
    --line: #e4e6ec; --soft: #f6f7fa; --blue-soft: #f0f4ff; --header: rgba(255,255,255,.97);
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    --home-scroll-offset: 6rem;
    font: 16px/1.7 var(--sans); color: var(--ink); background: var(--bg);
    scroll-padding-top: var(--home-scroll-offset);
  }
  @media (prefers-color-scheme: dark) {
    :root { --bg: #111216; --ink: #f3f3f6; --muted: #a9acb8; --accent: #9bb5ff; --line: #30323b; --soft: #1b1d24; --blue-soft: #1e2947; --header: rgba(17,18,22,.97); }
  }
  body { background: var(--bg); -webkit-font-smoothing: antialiased; }
  ::selection { background: var(--blue-soft); color: var(--accent); }
  a { color: inherit; text-underline-offset: .25em; }
  a:hover { color: var(--accent); }
  p, li { color: var(--muted); }
  h1, h2, h3, h4 { text-wrap: balance; }
  h2 { font-size: clamp(1.6rem, 2.5vw, 2rem); font-weight: 600; letter-spacing: -.04em; line-height: 1.3; }
  h3 { font-size: 1.05rem; line-height: 1.5; font-weight: 600; }
  main { outline: none; }
}
@layer layout {
  .header-inner, main, .site-footer { width: min(1180px, calc(100% - 100px)); margin-inline: auto; }
  .site-header { position: sticky; top: 0; z-index: 20; background: var(--header); border-bottom: 1px solid var(--line); }
  .header-inner { display: flex; align-items: center; gap: 32px; min-height: 76px; }
  .section-nav { display: flex; align-items: center; gap: 28px; margin-left: auto; }
  .site-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 90px; align-items: start; padding-top: 64px; }
  .profile-rail { position: sticky; top: 100px; padding-bottom: 32px; }
  .content-column { min-width: 0; }
  .intro-section { padding-bottom: 46px; }
  .content-section { border-top: 1px solid var(--line); padding-block: 52px 64px; }
  .section-heading { display: grid; gap: 12px; margin-bottom: 28px; }
  .section-heading > p:last-child:not(.eyebrow) { max-width: 66ch; font-size: .9rem; }
  .project-list { display: grid; gap: 24px; }
  .site-footer { display: flex; gap: 20px; justify-content: space-between; border-top: 1px solid var(--line); padding-block: 26px 36px; font-size: .75rem; }
}
@layer components {
  .site-brand { display: flex; gap: 12px; align-items: center; text-decoration: none; font-size: .85rem; font-weight: 600; white-space: nowrap; }
  .brand-mark { display: grid; place-items: center; width: 28px; height: 28px; background: var(--ink); color: var(--bg); font: 600 .65rem var(--mono); letter-spacing: -.04em; }
  .brand-chinese { margin-left: 7px; font-size: .75rem; font-weight: 400; color: var(--muted); }
  .section-nav a, .language-link { display: inline-flex; align-items: center; min-height: 44px; font-size: .8rem; text-decoration: none; white-space: nowrap; }
  .section-nav a { position: relative; color: var(--muted); }
  .section-nav a[aria-current], .section-nav a:hover { color: var(--ink); }
  .section-nav a[aria-current]::after { content: ''; position: absolute; inset: auto 0 2px; height: 2px; background: var(--accent); }
  .language-link { gap: 5px; font-family: var(--mono); }
  .profile-photo { width: 144px; height: auto; aspect-ratio: 295 / 413; object-fit: contain; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
  .profile-name { margin-top: 25px; }
  .profile-name h1 { font-size: 2rem; font-weight: 650; line-height: 1.3; letter-spacing: -.04em; }
  .homepage--zh .profile-name h1 { letter-spacing: .03em; }
  .other-name { margin-top: 3px; font-size: .9rem; }
  .profile-info { margin-top: 22px; font-size: .78rem; line-height: 1.9; }
  .profile-info p:first-child { color: var(--ink); font-weight: 500; }
  .profile-links { display: grid; margin-top: 20px; }
  .profile-links a { display: flex; justify-content: space-between; align-items: center; min-height: 38px; max-width: 170px; font-size: .81rem; text-decoration: none; }
  .profile-links span { color: var(--muted); }
  .availability { margin-top: 26px; display: flex; gap: 8px; align-items: baseline; max-width: 190px; font-size: .74rem; line-height: 1.7; }
  .availability > span { flex: 0 0 5px; width: 5px; height: 5px; background: var(--accent); border-radius: 50%; }
  .eyebrow { font: 500 .68rem/1.7 var(--mono); color: var(--muted); letter-spacing: .065em; text-transform: uppercase; }
  .intro-title { display: grid; margin-top: 24px; font-size: clamp(2.7rem, 4.4vw, 4rem); line-height: 1.08; letter-spacing: -.06em; font-weight: 600; }
  .intro-title span:last-child { color: var(--accent); }
  .homepage--zh .intro-title { font-size: clamp(2.6rem, 4.6vw, 4rem); line-height: 1.3; letter-spacing: -.035em; }
  .intro-text { margin-top: 26px; max-width: 66ch; font-size: .95rem; line-height: 1.85; }

  .text-link { display: inline-flex; gap: 10px; align-items: center; min-height: 44px; color: var(--accent); font-size: .8rem; font-weight: 500; text-decoration: none; }
  .text-link:hover { text-decoration: underline; }
  .intro-link { margin-top: 24px; }
  .research-list { display: grid; gap: 24px; container-type: inline-size; }
  .research-card { padding: 26px; border: 1px solid var(--line); border-radius: 6px; }
  .research-status { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; margin-bottom: 15px; }
  .status-label { font: 500 .7rem/1.6 var(--mono); color: var(--accent); }
  .status-detail { font-size: .73rem; color: var(--muted); }
  .research-card h3 { font-size: 1.16rem; font-weight: 600; line-height: 1.5; letter-spacing: -.02em; max-width: 58ch; }
  .research-card > p { margin-top: 13px; font-size: .88rem; line-height: 1.8; }
  .research-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; align-items: center; margin-top: 13px; }
  .research-bottom > span { color: var(--muted); font-size: .7rem; }
  .project-card { padding-top: 24px; border-top: 1px solid var(--line); }
  .project-recognition { margin-block: 7px 12px; font-size: .75rem; color: var(--accent); }
  .project-card h3 { margin: 0; font-size: .98rem; }
  .project-card > p:last-child { font-size: .84rem; line-height: 1.85; }
  .contact-section { padding: 38px 0 64px; border-top: 2px solid var(--ink); }
  .contact-section h2 { margin-top: 20px; max-width: 22ch; font-size: clamp(1.8rem, 3vw, 2.5rem); }
  .contact-section > p:not(.eyebrow) { margin-top: 18px; max-width: 62ch; font-size: .9rem; }
  .contact-email { display: inline-flex; gap: 16px; align-items: center; margin-top: 26px; min-height: 44px; font-size: clamp(.8rem, 2vw, 1.1rem); color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
  .contact-email:hover { text-decoration: underline; }
  .site-footer a { color: var(--muted); }
  @container (max-width: 500px) { .research-bottom { align-items: start; flex-direction: column; } }
  @media (max-width: 1100px) {
    .header-inner, main, .site-footer { width: calc(100% - 64px); }
    .site-shell { grid-template-columns: 190px minmax(0, 1fr); gap: 50px; }
    .section-nav { gap: 20px; }
    .brand-chinese { display: none; }
    .project-list { gap: 24px; }
  }
  @media (max-width: 850px) {
    .header-inner { gap: 18px; }
    .site-shell { grid-template-columns: 155px minmax(0, 1fr); gap: 30px; padding-top: 40px; }
    .profile-photo { width: 120px; }
    .profile-name h1 { font-size: 1.65rem; }
    .section-nav { gap: 15px; }
    .site-brand > span:last-child { display: none; }
    .intro-title { font-size: clamp(2.3rem, 5vw, 3rem); }
    .homepage--zh .intro-title { font-size: clamp(2.1rem, 4.9vw, 2.9rem); }

    .intro-section { padding-bottom: 40px; }

  }
  @media (min-width: 641px) and (max-height: 850px) {
    .profile-rail { position: static; }
  }
  @media (max-width: 640px) {
    .header-inner, main, .site-footer { width: calc(100% - 40px); }
    .header-inner { gap: 15px; min-height: 64px; }
    .section-nav { gap: 14px; margin-left: 0; flex: 1; justify-content: space-between; }
    .section-nav a { font-size: .7rem; }
    .language-link { margin-left: auto; font-size: .73rem; }
    .site-shell { display: block; padding-top: 28px; }
    .profile-rail { position: static; display: grid; grid-template-columns: 1fr 88px; gap: 7px 20px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
    .profile-identity { display: contents; }
    .profile-photo { width: 88px; grid-column: 2; grid-row: 1 / span 2; }
    .profile-name { grid-column: 1; grid-row: 1; margin: 0; }
    .profile-name h1 { font-size: 1.8rem; }
    .other-name { font-size: .8rem; }
    .profile-info { margin: 0; grid-column: 1; grid-row: 2; font-size: .7rem; }
    .profile-info p:last-child { display: none; }
    .profile-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 21px; margin-top: 9px; }
    .profile-links a { gap: 12px; min-height: 44px; font-size: .75rem; }
    .availability { grid-column: 1 / -1; max-width: none; margin: 1px 0 0; font-size: .7rem; }
    .intro-section { padding-top: 36px; }
    .intro-title { font-size: clamp(2.25rem, 8.7vw, 3.3rem); line-height: 1.12; margin-top: 20px; }
    .homepage--zh .intro-title { font-size: clamp(1.95rem, 8.5vw, 3.2rem); line-height: 1.35; }
    .intro-text { font-size: .87rem; margin-top: 20px; }

    .content-section { padding-block: 38px 44px; }
    .section-heading { gap: 10px; }
    .eyebrow { font-size: .62rem; letter-spacing: .025em; }
    .research-card h3 { font-size: 1.05rem; }
    .research-card > p { font-size: .84rem; }
    .contact-section { padding-block: 32px 44px; }
    .contact-email { gap: 8px; }
    .site-footer { flex-wrap: wrap; gap: 9px 18px; font-size: .65rem; }
  }
}
@layer accessibility {
  :focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; border-radius: 2px; }
  .skip-link { position: fixed; z-index: 30; top: 10px; left: 20px; padding: 12px 20px; background: var(--ink); color: var(--bg); transform: translateY(-180%); }
  .skip-link:focus { transform: translateY(0); }
  @media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
    @view-transition { navigation: auto; }
    ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  }
  @media (forced-colors: active) { .status-label { color: LinkText; } .profile-photo { border-color: CanvasText; } }
  @media print {
    :root { color-scheme: light; --bg: #fff; --ink: #111; --muted: #444; --accent: #2044ad; --soft: #f5f5f5; --line: #ccc; }
    .site-header, .skip-link, .site-footer a, .intro-link { display: none; }
    main, .site-footer { width: 100%; }
    .site-shell { grid-template-columns: 150px minmax(0,1fr); gap: 30px; padding-top: 0; }
    .profile-rail { position: static; }
    .profile-photo { width: 100px; }
    .content-section { padding-block: 24px; }
    .research-card, .project-card, .education-record, .honor-list li { break-inside: avoid; }
    .intro-title, .homepage--zh .intro-title { font-size: 2rem; }
  }
}
@layer components {
  .paper-title-link { text-decoration: none; }
  .paper-title-link:hover { text-decoration: underline; }
  .paper-figure { margin: 22px 0 8px; }
  .paper-image-link { display: block; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
  .paper-image-link:hover { border-color: var(--accent); }
  .paper-image-link img { width: 100%; height: auto; }
  .paper-figure figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 15px; margin-top: 8px; font-size: .7rem; color: var(--muted); }
  .paper-figure figcaption a { display: inline-flex; align-items: center; min-height: 32px; }
  .paper-links { display: flex; flex-wrap: wrap; gap: 8px; }
  .paper-links a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 3px; min-height: 40px; font-size: .75rem; text-decoration: none; }
  .paper-links a:first-child { color: var(--accent); }
  .paper-links a:hover { border-color: var(--accent); color: var(--accent); }
  @media (max-width: 640px) {
    .paper-image-link { padding: 8px; }
    .paper-links { gap: 6px; }
    .paper-links a { padding: 6px 10px; }
  }
  @media print { .profile-rail { position: static; } }
}

@layer components {
  .education-list { display: grid; gap: 25px; }
  .record-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; }
  .record-heading h3 { font-size: 1rem; }
  .record-period { font: .75rem/1.7 var(--mono); white-space: nowrap; }
  .record-program { margin-top: 7px; font-size: .88rem; color: var(--ink); }
  .education-record ul { margin: 12px 0 0; padding-left: 18px; font-size: .85rem; }
  .education-record li + li { margin-top: 7px; }
  .education-record--degree .record-heading h3 { font-size: 1.3rem; font-weight: 650; }
  .education-record--course { border-left: 2px solid var(--line); padding-left: 18px; }
  .education-label { margin-bottom: 7px; font-size: .72rem; color: var(--muted); }
  .education-record--course .record-heading { display: block; }
  .education-record--course .record-heading h3 { font-size: .9rem; font-weight: 500; }
  .education-record--course .record-period { margin-top: 4px; }
  .education-record--course .record-program { font-size: .83rem; }
  .education-record--course ul { margin-top: 9px; font-size: .82rem; }
  .honors-groups { display: grid; gap: 32px; }
  .honors-group > h3 { padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: .95rem; }
  .honor-list { list-style: none; margin: 0; padding: 0; }
  .honor-list li { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding-block: 15px; border-bottom: 1px solid var(--line); font-size: .85rem; }
  .honor-year { font: .75rem/1.9 var(--mono); }
  .honor-name { color: var(--ink); }
  .honor-list p { margin-top: 3px; font-size: .78rem; }
  @media (max-width: 850px) { .research-card { padding: 20px; } }
  @media (max-width: 640px) {
    .header-inner { flex-wrap: wrap; gap: 0; padding-top: 7px; }
    .site-brand > span:last-child { display: inline; }
    .site-brand { min-height: 36px; }
    .language-link { min-height: 36px; }
    .section-nav { order: 3; flex: 0 0 100%; width: 100%; justify-content: space-between; gap: 6px; }
    .section-nav a { min-height: 40px; font-size: .7rem; }
    .intro-section { padding-bottom: 36px; }
    .record-heading { display: grid; gap: 5px; }
    .honor-list li { grid-template-columns: 75px 1fr; gap: 12px; }
    .honor-list li { font-size: .82rem; }
  }
}
