:root {
  --paper: #FBFCFD;
  --ink: #16202C;
  --muted: #5B6573;
  --rule: #DCE1E7;
  --accent: #1F4F8C;
  --accent-soft: #E8EEF6;
  --brand: #173A66;
  --card: #F3F6F8;
  --name-size: clamp(2.6rem, 5vw, 3.4rem);
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Public Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --measure: 62rem;
  --text: 46rem;
  color-scheme: light dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12171E; --ink: #E4E8ED; --muted: #9AA4B1; --rule: #2A323C;
    --accent: #8FB4E6; --accent-soft: #1B2633; --card: #1A212B; --brand: #B4CDEF;
  }
}
:root[data-theme="dark"] {
  --paper: #12171E; --ink: #E4E8ED; --muted: #9AA4B1; --rule: #2A323C;
  --accent: #8FB4E6; --accent-soft: #1B2633; --card: #1A212B; --brand: #B4CDEF;
}
*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.1875rem; line-height: 1.6;
  font-optical-sizing: auto;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 2rem; }
.hero-text { flex: 1; min-width: 0; max-width: var(--text); }
.abstract, .page-lede, .jmp { max-width: var(--text); }

/* header */
.site-header { border-bottom: 1px solid var(--rule); }
.header-inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 1.25rem; padding-bottom: 1.1rem; }
.site-name { font-family: var(--sans); font-weight: 600; font-size: 1rem; color: var(--brand); text-decoration: none; letter-spacing: 0.01em; }
nav { display: flex; gap: 1.6rem; font-family: var(--sans); font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; }
nav a { color: var(--brand); opacity: 0.78; text-decoration: none; padding-bottom: 0.2rem; border-bottom: 2px solid transparent; }
nav a:hover { opacity: 1; }
nav a[aria-current="page"] { opacity: 1; border-bottom-color: var(--brand); }

/* light/dark toggle */
nav { align-items: center; }
.theme-toggle { display: inline-grid; place-items: center; width: 2rem; height: 2rem; margin: -0.4rem -0.4rem -0.4rem 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.theme-toggle:hover { color: var(--ink); background: var(--accent-soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.icon-moon { fill: currentColor; }
.icon-sun { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-sun circle { fill: currentColor; stroke: none; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* home hero */
.hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 3rem; padding-top: 4.5rem; }
.person { color: var(--brand); font-size: var(--name-size); font-weight: 500; line-height: 1.05; letter-spacing: -0.015em; margin: 0 0 1rem; }
.name-zh { font-weight: 400; color: var(--muted); font-size: 0.55em; letter-spacing: 0.05em; }
.role { margin: 0; color: var(--muted); font-size: 1.0625rem; line-height: 1.45; }
.market { margin: 1.1rem 0 0; font-family: var(--sans); font-size: 0.9375rem; font-weight: 500; color: var(--accent); }
.headshot { align-self: flex-start; margin-top: calc(var(--name-size) * 1.05 + 1.3rem); width: 260px; height: 325px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.monogram { border-radius: 50%; width: 168px; height: 168px; }
.monogram { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 3.2rem; font-weight: 500; letter-spacing: 0.02em; }

/* JMP card */
.jmp-line { margin: 2.75rem 0 0; padding: 0.8rem 1.1rem; background: var(--card); border-radius: 6px; font-size: 1.125rem; line-height: 1.45; color: var(--muted); }
.jmp-line-title { font-style: italic; color: var(--ink); text-decoration-color: var(--rule); }
.jmp-line-title:hover { text-decoration-color: var(--accent); }
.jmp-line-link { font-family: var(--sans); font-size: 0.875rem; font-weight: 500; white-space: nowrap; }

/* event chart */
.tickfig { margin: 1.75rem 0 0.5rem; }
.tick-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem 1.4rem; margin-bottom: 1.6rem; border-bottom: 1px solid var(--rule); font-family: var(--sans); font-size: 0.8125rem; }
.tick-tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 0.35rem 0; font: inherit; color: var(--muted); cursor: pointer; }
.tick-tab:hover { color: var(--ink); }
.tick-tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tick-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tickframe { position: relative; padding-left: 4.4rem; padding-top: 1.6rem; }
.tickplot { position: relative; height: clamp(190px, 28vw, 300px); border-left: 1px solid var(--muted); border-bottom: 1px solid var(--muted); touch-action: pan-y; cursor: crosshair; }
.tickplot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tick-reveal { position: absolute; inset: 0; }
.tick-reveal.waiting { clip-path: inset(-8px 100% -8px 0); }
.tick-reveal.drawing { animation: reveal 3.2s linear both; }
@keyframes reveal { from { clip-path: inset(-8px 100% -8px 0); } to { clip-path: inset(-8px -8px -8px 0); } }
.tick-path { fill: none; stroke: var(--accent); stroke-width: 1.4; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.tick-pts i { position: absolute; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--accent); }
.tick-event { stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; opacity: 0.5; }
.tick-event.flash { animation: flash-line 1.6s ease-out; }
@keyframes flash-line { 0% { opacity: 0.5; } 15% { opacity: 1; stroke: var(--brand); stroke-width: 2; } 100% { opacity: 0.5; } }
.tick-cross { stroke: var(--rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tick-label { position: absolute; top: 0.4rem; margin-left: 0.4rem; font-family: var(--sans); font-size: 0.75rem; font-style: italic; color: var(--muted); white-space: nowrap; pointer-events: none; }
.tl-short { display: none; }
.tick-label.flash { animation: flash-label 1.6s ease-out; }
@keyframes flash-label { 0% { color: var(--muted); } 15% { color: var(--brand); font-weight: 600; } 100% { color: var(--muted); } }
.tick-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); pointer-events: none; }
.tick-tip { position: absolute; bottom: calc(100% + 0.2rem); transform: translateX(-50%); font-family: var(--sans); font-size: 0.75rem; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 0.15rem 0.45rem; white-space: pre; pointer-events: none; z-index: 2; }
.tick-tip.flip { transform: translateX(-100%); }
.tick-yaxis { position: absolute; left: 0; top: 1.6rem; width: 4.4rem; height: clamp(190px, 28vw, 300px); }
.tick-yaxis span { position: absolute; right: 0.45rem; transform: translateY(-50%); font-family: var(--sans); font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tick-ytitle { position: absolute; left: 0; top: calc(1.6rem + clamp(190px, 28vw, 300px) / 2); transform: translate(-50%, -50%) rotate(-90deg) translateY(0.6rem); font-family: var(--sans); font-size: 0.6875rem; color: var(--muted); white-space: nowrap; }
.tick-axis { position: relative; height: 1.2rem; margin-top: 0.35rem; font-family: var(--sans); font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tick-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tickfig figcaption { margin-top: 0.6rem; font-family: var(--sans); font-size: 0.8125rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tick-reveal { clip-path: none !important; animation: none !important; } .tick-event.flash, .tick-label.flash { animation: none; } }
@media (max-width: 600px) {
  .tickframe { padding-left: 2.6rem; }
  .tick-yaxis { width: 2.6rem; }
  .tick-ytitle { display: none; }
  .tick-tabs { gap: 0.25rem 1rem; font-size: 0.75rem; }
  .tl-full { display: none; }
  .tl-short { display: inline !important; }
  .tick-axis span { display: none; }
  .tick-axis span:nth-child(3n+1) { display: inline; }
}

.intro { margin-top: 2rem; }
.prose p { margin: 0 0 1.1rem; }
.contact-links { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; font-family: var(--sans); font-size: 0.9375rem; }

/* blocks */
.block { margin-top: 3.25rem; }
h2 { color: var(--brand); font-family: var(--sans); font-size: 1rem; font-weight: 600; letter-spacing: 0.01em; margin: 0 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule); }
.page { padding-top: 3.5rem; }
.page-title { color: var(--brand); font-size: clamp(2.2rem, 6vw, 2.9rem); font-weight: 500; letter-spacing: -0.01em; line-height: 1.1; margin: 0 0 0.75rem; }
.page-lede { color: var(--muted); margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; }
.muted { color: var(--muted); font-family: var(--sans); font-size: 0.875rem; }

/* job market paper */
.jmp { border-left: 3px solid var(--accent); padding: 0.25rem 0 0.25rem 1.4rem; }
.kicker { font-family: var(--sans); font-size: 0.875rem; font-weight: 500; color: var(--accent); margin: 0 0 0.35rem; }
.jmp-title { font-size: 1.6rem; font-weight: 500; line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.005em; }
.paper-meta { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); margin: 0; display: inline-flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; }
.paper-link { font-weight: 500; }
.abstract { font-size: 1.0625rem; line-height: 1.65; margin: 0.9rem 0 0; }
.abstract-toggle summary { cursor: pointer; font-family: var(--sans); font-size: 0.875rem; color: var(--accent); margin-top: 0.75rem; width: fit-content; }

/* lists */
.news, .papers, .talks, .rows, .plain { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; padding: 0.55rem 0; }
.news-date { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); padding-top: 0.2rem; font-variant-numeric: tabular-nums; }
.papers li { padding: 0.6rem 0; }
.paper-title { display: block; font-size: 1.1875rem; line-height: 1.4; }
.papers .paper-meta { display: block; margin-top: 0.15rem; }
.year-group { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.year { font-family: var(--sans); font-size: 0.9375rem; font-weight: 600; margin: 0.2rem 0 0; font-variant-numeric: tabular-nums; }
.talks li { padding: 0.15rem 0; }
.place { color: var(--muted); }
.tag { font-family: var(--sans); font-size: 0.75rem; color: var(--accent); background: var(--accent-soft); padding: 0.1rem 0.45rem; border-radius: 3px; white-space: nowrap; vertical-align: 0.1em; }
.rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 1.5rem; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.rows li:last-child { border-bottom: 0; }
.row-main { display: block; }
.row-sub { display: block; color: var(--muted); font-size: 1rem; }
.row-year { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.plain li { padding: 0.3rem 0; }
.refs { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem; }
.ref p { margin: 0; }
.ref a { font-family: var(--sans); font-size: 0.875rem; word-break: break-all; }
.button { font-family: var(--sans); font-size: 0.9375rem; font-weight: 500; background: var(--accent); color: var(--paper); text-decoration: none; padding: 0.55rem 1rem; border-radius: 4px; }
.button:hover { filter: brightness(1.1); }

/* footer */
.site-footer { margin-top: 5rem; border-top: 1px solid var(--rule); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 1.5rem; padding-bottom: 2rem; font-family: var(--sans); font-size: 0.875rem; color: var(--muted); }

@media (max-width: 860px) {
  .headshot { width: 220px; height: 275px; }
}
@media (max-width: 600px) {
  .wrap { padding-left: 1.5rem; padding-right: 1.5rem; }
  .page { padding-top: 2.25rem; }
  body { font-size: 1.0625rem; }
  .hero { flex-direction: column-reverse; align-items: flex-start; padding-top: 2.5rem; gap: 1.5rem; }
  .headshot { align-self: flex-start; margin-top: 0; width: 200px; height: 250px; }
  .monogram { width: 112px; height: 112px; }
  .monogram { font-size: 2.2rem; }
  .news li { grid-template-columns: 1fr; gap: 0; }
  .year-group { grid-template-columns: 1fr; gap: 0.25rem; }
  .rows li { flex-direction: column; gap: 0.15rem; }
  nav { gap: 0.5rem 0.7rem; letter-spacing: 0.04em; flex-wrap: wrap; }
}

@media (max-width: 400px) {
  nav { gap: 0.5rem 0.55rem; letter-spacing: 0.03em; }
}

/* CV page */
.cv-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.75rem 1.25rem; }
.button-lg { font-size: 1.0625rem; padding: 0.8rem 1.4rem; }
.cv-embed-wrap { max-width: var(--measure); margin: 2.5rem auto 0; padding: 0 2rem; }
.cv-pages { display: flex; flex-direction: column; gap: 1rem; max-width: 780px; margin: 0 auto; }
.cv-pages canvas { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 1px 3px rgba(20, 32, 48, 0.08); }
.cv-frame { display: block; width: 100%; height: 900px; border: none; border-radius: 4px; }
.cv-fallback { padding: 2rem 0; font-family: var(--sans); font-size: 0.9375rem; color: var(--muted); }
@media (max-width: 600px) { .cv-embed-wrap { padding: 0 0.75rem; margin-top: 1.75rem; } .cv-pages { gap: 0.6rem; } }

/* contact icons */
.icon-links { gap: 0.5rem 1.15rem; align-items: center; }
.icon-links a { display: inline-flex; align-items: center; color: var(--brand); opacity: 0.85; text-decoration: none; }
.icon-links a:hover { opacity: 1; color: var(--accent); }
.icon-links svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.icon-links .icon-ssrn svg { width: auto; height: 0.95rem; stroke: currentColor; stroke-width: 0.45; }
/* footer icons */
.site-footer .icon-links { margin: 0; gap: 0.5rem 1rem; }
.site-footer .icon-links a { opacity: 0.85; }
.site-footer .icon-links a:hover { opacity: 1; }
.site-footer .icon-links svg { width: 1.15rem; height: 1.15rem; }
.site-footer .icon-links .icon-ssrn svg { width: auto; height: 0.9rem; }

/* about page */
.about-kicker { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; font-weight: 600; }
.about-text { max-width: var(--text); margin-top: 1.25rem; }

/* photo gallery: justified rows, each photo keeps its aspect ratio (--r = w/h) */
.gallery { display: flex; flex-wrap: wrap; gap: 2rem 1.25rem; margin-top: 2.75rem; padding-top: 2.75rem; border-top: 1px solid var(--rule); }
.gallery figure { margin: 0; flex: calc(var(--r) * 100) 1 calc(var(--r) * 41%); }
.gallery figure.wide { flex-basis: 100%; }
.gallery a { display: block; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: var(--r); object-fit: cover; border-radius: 2px; background: var(--card); transition: opacity 0.15s; }
.gallery a:hover img { opacity: 0.88; }
.gallery figcaption { font-family: var(--serif); font-style: italic; font-size: 0.875rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.4; }
.lightbox { border: 0; padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; background: rgba(10, 14, 20, 0.94); color: #E4E8ED; }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(10, 14, 20, 0.94); }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; }
.lightbox img { max-width: 92vw; max-height: 84vh; width: auto; height: auto; border-radius: 2px; }
.lightbox figcaption { font-family: var(--serif); font-style: italic; font-size: 0.9375rem; margin-top: 0.75rem; opacity: 0.85; }
.lightbox button { position: absolute; background: none; border: 0; color: inherit; font-size: 2.6rem; line-height: 1; padding: 0.5rem 0.9rem; cursor: pointer; opacity: 0.75; }
.lightbox button:hover { opacity: 1; }
.lb-close { top: 0.5rem; right: 0.5rem; }
.lb-prev { left: 0.25rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 0.25rem; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  .gallery { gap: 1.75rem; margin-top: 1.75rem; padding-top: 1.75rem; }
  .gallery figure { flex-basis: 100%; }
  .gallery figcaption { font-size: 0.8125rem; }
  .lb-prev, .lb-next { display: none; }
}
