/* Research portfolio: academic content, stronger visual hierarchy. */
:root {
  --background: #ffffff;
  --surface: #f3f6fa;
  --ink: #142941;
  --muted: #526176;
  --accent: #225cad;
  --accent-surface: #eaf2fc;
  --line: #dce3ed;
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --max-width: 1080px;
  --gutter: clamp(22px, 4vw, 54px);
  --sidebar-width: 248px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 28px; scroll-behavior: smooth; }
body { margin: 0; padding-left: var(--sidebar-width); background: var(--background); color: var(--ink); font: 400 1rem/1.7 var(--sans); -webkit-font-smoothing: antialiased; }
main { min-height: calc(100svh - 70px); }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { display: block; max-width: 100%; }
::selection { color: var(--ink); background: #dce8ff; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 3px; }
[hidden] { display: none !important; }
.skip-link { position: absolute; top: -100px; left: 20px; z-index: 50; padding: 10px 20px; color: white; background: var(--ink); }
.skip-link:focus { position: fixed; top: 12px; }
.hero-inner, .hero-bottom, .section-inner, .footer-inner { width: min(var(--max-width), calc(100% - var(--gutter) * 2)); margin-inline: auto; }

/* Shared sidebar. Page links and their active state are generated statically. */
#navbar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); z-index: 20; background: #f7f9fc; border-right: 1px solid var(--line); overflow-y: auto; padding: 38px 22px; }
.nav-inner { display: block; margin-bottom: 32px; }
.nav-logo { display: inline-flex; align-items: baseline; gap: 2px; font: 600 1.25rem/1.5 var(--sans); letter-spacing: -.03em; }
.sidebar-bio { margin-top: 17px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.sidebar-role { font-size: .875rem; color: var(--muted); line-height: 1.65; }
.sidebar-role em { font-style: normal; }
.sidebar-education { font: 400 .75rem/1.8 var(--mono); color: var(--muted); margin-top: 8px; }
.logo-mark { color: var(--accent); font-size: 1.6rem; }
.nav-link { display: flex; align-items: center; min-height: 45px; padding: 10px 14px; margin-bottom: 6px; border-left: 3px solid transparent; border-radius: 4px; font-size: .9375rem; color: var(--muted); transition: color .2s, background-color .25s; }
.nav-link:hover { color: var(--accent); background: #eaf0f8; }
.nav-link.active { color: #204f8f; background: #e4edf9; border-left-color: var(--accent); font-weight: 500; }
.nav-link.active::after { content: '›'; margin-left: auto; padding-left: 12px; color: var(--accent); }
.nav-menu-btn { display: none; padding: 10px 0 10px 14px; background: none; border: 0; color: var(--ink); cursor: pointer; }
.nav-menu-btn span { display: inline-block; margin-left: 10px; font-size: 1.2rem; }
.nav-menu-btn[aria-expanded="true"] span { transform: rotate(45deg); }
.nav-drawer { position: relative; padding: 0; }
.nav-indicator { position: absolute; left: 0; top: 0; width: 3px; height: 45px; background: var(--accent); border-radius: 2px; opacity: 0; pointer-events: none; transition: transform .32s cubic-bezier(.22,1,.36,1), height .2s, opacity .2s; }
.scroll-ready .nav-indicator { opacity: 1; }
.scroll-ready .nav-link.active { border-left-color: transparent; }
.reading-progress { position: fixed; top: 0; left: var(--sidebar-width); right: 0; height: 3px; z-index: 25; pointer-events: none; }
.reading-progress > span { display: block; height: 100%; background: #73b8e7; transform: scaleX(0); transform-origin: left; }
.cover-scroll { display: flex; align-items: center; align-self: flex-start; gap: 18px; margin: 0 var(--gutter) 26px; color: #d6e7f4; font: 400 .8125rem/1.7 var(--mono); }
.cover-scroll:hover { color: white; }
.cover-scroll > span { display: inline-block; animation: scroll-cue 1.4s ease-in-out 2; }
@keyframes scroll-cue { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* A research-led introduction, portrait, and substantive areas of interest. */
#hero { min-height: calc(100svh - 70px); display: flex; flex-direction: column; justify-content: center; color: #f5f8fd; background: radial-gradient(ellipse at 95% 0%, #274d6b 0%, transparent 55%), #142941; border-bottom: 1px solid var(--line); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1fr) 240px; align-items: center; gap: 42px; padding-block: 64px 46px; }
.hero-content { min-width: 0; }
.hero-eyebrow { color: #b8cbdf; font: 400 .75rem/1.7 var(--mono); margin-bottom: 18px; letter-spacing: .02em; }
.hero-name { font-size: clamp(2.6rem, 5.1vw, 4.2rem); font-weight: 600; letter-spacing: -.055em; line-height: 1.12; overflow-wrap: anywhere; }
.hero-role { margin-top: 16px; color: #a5dce7; font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 500; line-height: 1.5; }
.hero-education { color: #c0cfe1; font-size: .875rem; margin-top: 5px; }
.hero-role em { font-style: normal; }
.hero-bio { color: #d3deeb; max-width: 38em; margin-top: 23px; line-height: 1.85; font-size: 1.0625rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 43px; padding: 9px 16px; border: 1px solid transparent; border-radius: 5px; font-size: .875rem; font-weight: 500; transition: background .15s, border-color .15s; }
.btn-primary { background: #e8f2ff; color: #183859; }
.btn-primary:hover { background: white; }
.btn-ghost { background: transparent; border-color: #70849a; color: #f2f6fc; }
.btn-ghost:hover { border-color: #c4e5f0; background: #294461; }
.btn-text { color: #cfdeef; }
.btn-text:hover { color: white; background: #294461; }
.hero-visual { width: 240px; padding: 12px; border: 1px solid #567188; border-radius: 10px; background: #ffffff08; }
.hero-photo-frame { aspect-ratio: 4 / 4.6; border: 1px solid #718399; border-radius: 5px; overflow: hidden; background: #e7ecf3; }
.hero-photo { width: 100%; height: 100%; object-fit: cover; object-position: 48% 45%; }
.hero-visual figcaption { color: #d0dbea; font: 400 .75rem/1.6 var(--sans); margin-top: 10px; text-align: center; }
.hero-visual figcaption > span:first-child { display: none; }
.hero-bottom { border-top: 1px solid #4b6279; padding-block: 24px 36px; }
.topics-label { color: #bccfe2; font: 400 .75rem/1.6 var(--mono); margin-bottom: 18px; }
.research-topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; counter-reset: area; }
.research-area { counter-increment: area; position: relative; padding: 0 22px 0 34px; border-right: 1px solid #4b6279; }
.research-area:last-child { border-right: 0; padding-right: 0; }
.research-area::before { content: counter(area, decimal-leading-zero); position: absolute; top: 2px; left: 0; font: 400 .75rem/1.7 var(--mono); color: #96c5d7; }
.research-topic { font-size: 1rem; line-height: 1.5; font-weight: 500; color: #f1f6fd; }
.research-area-description { font-size: .875rem; color: #becddd; margin-top: 8px; line-height: 1.7; }

/* Each section has a compact technical label and a readable content column. */
.section { padding-block: 58px; }
.section + .section { border-top: 1px solid var(--line); }
.section-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.section-label { color: var(--muted); font: 400 .8125rem/1.6 var(--mono); padding-top: 10px; }
.section-label::before { content: ''; display: block; width: 26px; height: 3px; background: var(--accent); margin-bottom: 14px; }
.section-body { min-width: 0; }
.section-heading { font-size: clamp(1.6rem, 2.8vw, 2.15rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.3; margin-bottom: 28px; }
.section-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 20px; margin-bottom: 24px; }
.section-header .section-heading { margin-bottom: 0; }
.publication-summary { color: var(--muted); font: 400 .75rem/1.7 var(--mono); }

/* Project entries: applications, implementation details, and tools. */
.projects-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.project-card { display: flex; flex-direction: column; min-width: 0; background: var(--background); border: 1px solid var(--line); border-radius: 7px; padding: 23px; }
.project-year { color: var(--muted); font: 400 .75rem/1.5 var(--mono); margin-bottom: 12px; }
.project-title { color: var(--ink); font-size: 1.125rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.4; margin-bottom: 10px; }
.project-desc { color: var(--muted); font-size: 1rem; line-height: 1.65; margin-bottom: 18px; }
.project-details { border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 23px; }
.project-detail + .project-detail { margin-top: 13px; }
.project-detail dt { color: var(--ink); font: 500 .75rem/1.7 var(--mono); margin-bottom: 4px; }
.project-detail dd { color: var(--muted); font-size: .875rem; line-height: 1.65; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.project-tag { color: #3f5470; background: var(--surface); padding: 3px 7px; border-radius: 3px; font: 400 .75rem/1.7 var(--mono); }
.resource-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 17px; }
.resource-link { display: inline-flex; align-items: center; min-height: 36px; color: var(--accent); font: 500 .8125rem/1.7 var(--mono); text-decoration: underline; text-underline-offset: 4px; }
.resource-link:hover { color: #163c86; }

/* Publications retain normal reading order and explicit statuses. */
.pub-list { border-top: 0; }
.pub-group + .pub-group { margin-top: 48px; }
.pub-group-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 20px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.pub-group-title { font-size: 1.2rem; font-weight: 600; letter-spacing: -.02em; }
.pub-group-count { color: var(--muted); font: 400 .75rem/1.7 var(--mono); }
.pub-author-position { margin-left: 12px; color: var(--muted); font-size: .8125rem; }
.paper-overview { margin-top: 12px; }
.paper-overview, .paper-step, .paper-result { min-width: 0; }
.paper-takeaway, .paper-step, .paper-result, .paper-context, .paper-note, .paper-figure figcaption { overflow-wrap: anywhere; }
.paper-takeaway { font-size: 1rem; line-height: 1.6; margin-top: 5px; max-width: 65ch; }
.paper-method { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; list-style: none; padding: 0; margin: 20px 0; }
.paper-step { position: relative; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: .8125rem; line-height: 1.5; }
.paper-step + .paper-step::before { content: '\2192'; position: absolute; top: 50%; left: -18px; transform: translateY(-50%); color: var(--muted); }
.paper-step-number { display: block; color: var(--accent); font: 500 .6875rem/1.7 var(--mono); margin-bottom: 5px; }
.paper-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; background: #eaf1f8; border-radius: 6px; padding: 16px 18px; }
.paper-result { display: flex; flex-direction: column; gap: 4px; }
.paper-result dt { color: var(--muted); font-size: .75rem; line-height: 1.5; }
.paper-result dd { color: #204f8f; font: 500 clamp(1.25rem, 2.5vw, 1.7rem)/1.3 var(--mono); letter-spacing: -.04em; }
.paper-context { margin-top: 10px; font-size: .75rem; color: var(--muted); line-height: 1.65; }
.paper-note { margin-top: 8px; font-size: .8125rem; line-height: 1.6; }
.paper-figure-details { margin-top: 16px; font-size: .8125rem; }
.paper-figure-details summary { cursor: pointer; color: var(--accent); width: fit-content; padding: 6px 0; }
.paper-figure-details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.paper-figure { margin-top: 12px; }
.paper-figure img { width: auto; max-width: 100%; height: auto; margin-inline: auto; background: white; border: 1px solid var(--line); border-radius: 4px; }
.paper-full-image { display: inline-block; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.paper-image-trigger { display: block; cursor: zoom-in; }
/* Center the complete Lightbox2 frame, including its caption, in the viewport. */
#lightbox { top: 50% !important; transform: translateY(-50%); max-height: calc(100dvh - 32px); overflow-y: auto; }
.paper-figure figcaption { font-size: .75rem; color: var(--muted); margin-top: 8px; line-height: 1.6; }
.pub-card { padding: 25px 0; border-bottom: 1px solid var(--line); }
.pub-card:last-child { border-bottom: 0; padding-bottom: 0; }
.pub-venue-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 8px; }
.pub-venue { color: var(--accent); font: 500 .8125rem/1.7 var(--mono); }
.pub-date { color: var(--muted); font: 400 .75rem/1.7 var(--mono); }
.pub-title { font-size: 1.0625rem; line-height: 1.55; font-weight: 600; }
.pub-author-self { font-weight: 600; color: var(--ink); }
.pub-authors { font-size: .875rem; color: var(--muted); margin-top: 7px; }
.pub-badge { display: inline-block; font-size: .875rem; line-height: 1.4; border-radius: 3px; padding: 3px 8px; margin-top: 10px; }
.pub-badge.published { color: #28533e; background: #edf5ef; }
.pub-badge.accepted { color: #285396; background: #edf3ff; }
.pub-badge.upcoming { color: #77551d; background: #fbf3e4; }
.pub-card-upcoming .pub-title { color: var(--muted); }

/* Employment and research history */
.timeline { border-top: 1px solid var(--line); }
.timeline-item { position: relative; padding: 23px 0 23px 22px; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline-marker { position: absolute; top: 33px; left: 0; width: 6px; height: 6px; border: 1px solid var(--accent); border-radius: 1px; background: var(--accent-surface); }
.timeline-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; }
.timeline-role { font-size: 1rem; font-weight: 600; }
.timeline-badge { color: var(--accent); font-size: .875rem; }
.timeline-org-row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 5px 18px; margin-block: 5px 10px; }
.timeline-org { color: var(--muted); font-size: .875rem; }
.timeline-period { color: var(--muted); font: 400 .75rem/1.7 var(--mono); }
.timeline-desc { color: var(--muted); }

/* Background and skills */
#about, #skills { background: var(--surface); }
.about-meta-item { background: white; padding: 23px; border: 1px solid var(--line); border-radius: 7px; }
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) 140px; gap: 36px; }
.about-bio { color: var(--muted); margin-bottom: 16px; }
.hero-stats { padding-left: 24px; border-left: 1px solid var(--line); }
.hero-stat { display: flex; flex-direction: column; gap: 3px; padding-block: 3px 16px; }
.hero-stat-num { font: 600 1.9rem/1.4 var(--sans); letter-spacing: -.04em; color: var(--accent); }
.hero-stat-label { color: var(--muted); font-size: .75rem; }
.hero-stat-divider { height: 1px; background: var(--line); margin-bottom: 15px; }
.about-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 24px; }
.about-meta-label, .skill-cat-label { font: 500 .8125rem/1.7 var(--mono); color: var(--ink); margin-bottom: 15px; }
.edu-item { display: flex; flex-direction: column; gap: 4px; margin-bottom: 17px; }
.edu-degree { font-size: 1rem; font-weight: 500; }
.edu-detail { color: var(--muted); font-size: .875rem; }
.about-langs { display: grid; gap: 8px; }
.lang-chip { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2px 14px; font-size: .875rem; }
.lang-chip em { font-size: .8125rem; font-style: normal; color: var(--muted); }
.lang-scores { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 20px; }
.lang-score-item { display: flex; align-items: baseline; gap: 9px; }
.lang-score-label, .lang-score-max { color: var(--muted); font-size: .75rem; }
.lang-score-value { font: 400 .875rem/1.7 var(--mono); }
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 25px; }
.skill-category { padding-top: 16px; border-top: 1px solid var(--line); }
.skill-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.skill-tag { font-size: .875rem; padding: 4px 9px; background: white; border: 1px solid var(--line); border-radius: 4px; }
.skill-tag-accent { color: #285396; background: var(--accent-surface); border-color: #ceddfa; }

/* Contact stays compact and practical. */
.contact-sub { color: var(--muted); max-width: 42em; margin-bottom: 24px; }
#contact .section-body { padding: 32px; border: 1px solid #cfdeee; border-radius: 9px; background: linear-gradient(120deg, #edf4fc, #ffffff); }
.contact-links { display: grid; gap: 10px; }
.contact-link { display: flex; align-items: center; gap: 15px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 5px; }
.contact-link:hover { border-color: var(--accent); background: var(--surface); }
.contact-link::after { content: '↗'; color: var(--accent); margin-left: auto; }
.contact-icon { width: 23px; flex-shrink: 0; text-align: center; color: var(--muted); font-size: 1rem; }
.contact-link-text { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 24px; min-width: 0; }
.contact-link-label { color: var(--muted); font: 400 .75rem/1.7 var(--mono); min-width: 70px; }
.contact-link-value { color: var(--accent); font-size: .875rem; overflow-wrap: anywhere; }
footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; color: var(--muted); font-size: .75rem; padding-block: 22px; }
.footer-credit { display: flex; flex-wrap: wrap; gap: 10px; }
.back-top { display: inline-flex; gap: 13px; }

@media (min-width: 801px) and (max-width: 1150px) {
  :root { --sidebar-width: 215px; }
  #navbar { padding: 30px 16px; }
  .hero-inner { grid-template-columns: minmax(0, 1fr) 170px; gap: 26px; }
  .hero-visual { width: 170px; }
  .hero-name { font-size: 2.8rem; }
  .research-topics { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .research-area { border-right: 0; padding-right: 0; }
  .about-meta { grid-template-columns: minmax(0, 1fr); }
  .section-label { padding-top: 0; }
}
@media (max-width: 800px) {
  html { scroll-padding-top: 96px; }
  body { padding-left: 0; }
  #navbar { position: sticky; inset: 0 auto auto; width: auto; overflow: visible; padding: 0 var(--gutter); border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 15px; padding-block: 10px; margin-bottom: 0; }
  .sidebar-bio { display: none; }
  .nav-drawer { padding-block: 8px 18px; max-height: min(65svh, calc(100svh - 160px)); overflow-y: auto; }
  .nav-ready .nav-menu-btn { display: inline-flex; align-items: center; }
  main, #hero { min-height: calc(100svh - 68px); }
  .reading-progress { left: 0; }
  .hero-inner { grid-template-columns: minmax(0, 1fr) 190px; gap: 30px; padding-top: 45px; }
  .hero-visual { width: 190px; align-self: center; }
  .hero-visual figcaption { font-size: .75rem; }
  .research-topics { gap: 15px; }
  .research-area { padding-left: 0; padding-right: 15px; }
  .research-area::before { position: static; display: block; margin-bottom: 8px; }
}
@media (max-width: 600px) {
  .paper-method { grid-template-columns: 1fr; gap: 16px; }
  .paper-step { display: flex; gap: 12px; align-items: baseline; }
  .paper-step-number { margin-bottom: 0; }
  .paper-step + .paper-step::before { content: '\2193'; left: 19px; top: -17px; transform: none; }
  .paper-results { padding: 14px; }
  .hero-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 26px; padding-block: 34px 28px; }
  .hero-visual { width: 170px; align-self: flex-start; transform: none; padding: 8px; }
  .hero-photo-frame { aspect-ratio: 1; }
  .hero-visual figcaption { display: none; }
  .hero-name { font-size: 2.7rem; }
  .hero-role { font-size: 1.25rem; }
  .hero-eyebrow { margin-bottom: 8px; }
  .hero-actions { margin-top: 20px; }
  .hero-bottom { padding-block: 22px 28px; }
  .topics-label { width: 100%; }
  .research-topics { grid-template-columns: minmax(0, 1fr); gap: 19px; }
  .research-area { border-right: 0; border-bottom: 1px solid #4b6279; padding: 0 0 18px 33px; }
  .research-area:last-child { border-bottom: 0; padding-bottom: 0; }
  .research-area::before { position: absolute; }
  .research-area-description { margin-top: 5px; }
  .section { padding-block: 38px; }
  .projects-grid, .skills-grid, .about-meta { grid-template-columns: minmax(0, 1fr); }
  .project-card { padding: 20px; }
  .about-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .hero-stats { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; padding-left: 0; border-left: 0; }
  .hero-stat-divider { display: none; }
  .about-meta { margin-top: 12px; gap: 20px; }
  .contact-link-text { flex-direction: column; gap: 2px; }
  #contact .section-body { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  body { font-size: 11pt; color: black; background: white; padding-left: 0; }
  main, .section, #hero { min-height: 0; }
  #navbar, .hero-actions, .skip-link, .back-top, .cover-scroll, .reading-progress { display: none; }
  #hero, #about, #skills { background: white; color: black; }
  #hero * { color: black !important; }
  .hero-visual { transform: none; }
  .section { padding-block: 22px; }
  .section-grid { display: block; }
  .section-label { margin-bottom: 10px; }
  .project-card, .pub-card, .timeline-item { break-inside: avoid; }
}
