:root {
  --ink: #23242a;
  --muted: #656873;
  --paper: #fafbf9;
  --panel: #ffffff;
  --soft: #f0f3f1;
  --line: #d9ded9;
  --purple: #6f4aa8;
  --purple-soft: #f2edf8;
  --blue: #3f70bd;
  --blue-soft: #edf3fb;
  --coral: #c9516c;
  --green: #3f806b;
  --max: 1060px;
  --sans: Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55; letter-spacing: 0; }
img { display: block; max-width: 100%; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { color: var(--purple); }
button { font: inherit; letter-spacing: 0; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 8px 14px; background: var(--ink); color: white; }
.skip-link:focus { top: 12px; }

.site-header { position: sticky; top: 0; z-index: 50; padding: 8px 0; background: rgba(250, 251, 249, .94); border-bottom: 1px solid transparent; backdrop-filter: blur(12px); }
.site-header.is-scrolled { border-color: var(--line); }
.nav-shell { width: min(calc(100% - 36px), var(--max)); min-height: 46px; margin: auto; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.78); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; text-decoration: none; }
.wordmark:hover { color: var(--ink); }
.wordmark-mark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 5px; background: var(--purple-soft); color: var(--purple); font-family: var(--mono); font-size: 11px; font-weight: 800; }
.site-nav { display: flex; align-items: center; gap: 6px; }
.site-nav a { padding: 6px 10px; border-radius: 4px; color: #4d5058; font-family: var(--mono); font-size: 12px; text-decoration: none; }
.site-nav a:hover, .site-nav a.is-current { background: var(--blue-soft); color: var(--blue); }
.nav-toggle { display: none; width: 42px; height: 42px; padding: 10px; border: 0; background: transparent; }
.nav-toggle span { display: block; height: 1px; margin: 5px 0; background: var(--ink); transition: transform 160ms ease, opacity 160ms ease; }

.intro { width: min(calc(100% - 36px), var(--max)); margin: 0 auto; padding: 30px 0 34px; display: grid; grid-template-columns: 180px minmax(0, 1fr); column-gap: 28px; row-gap: 18px; align-items: start; }
.intro-heading { grid-column: 2; grid-row: 1; align-self: end; }
.intro-copy { grid-column: 2; grid-row: 2; }
.portrait-wrap { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 78px; }
.portrait-wrap img { width: 100%; height: 240px; border: 1px solid #cfd6d0; border-radius: 8px; object-fit: cover; object-position: 50% 72%; filter: brightness(1.05) contrast(.98); box-shadow: 6px 6px 0 var(--purple-soft); }
.portrait-rule { position: absolute; top: -10px; left: 50%; width: 64px; height: 19px; z-index: 2; transform: translateX(-50%) rotate(-2deg); background: rgba(255, 232, 174, .82); }
.portrait-wrap p { margin: 13px 0 0; color: var(--muted); font-family: var(--mono); font-size: 10px; line-height: 1.5; }
.portrait-wrap strong { color: var(--ink); font-family: var(--sans); font-size: 13px; }
.eyebrow { margin: 0 0 10px; color: var(--purple); font-family: var(--mono); font-size: 12px; font-weight: 700; line-height: 1.4; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(46px, 5.5vw, 60px); font-weight: 800; line-height: 1; letter-spacing: 0; }
.intro-lede { margin: 12px 0 18px; color: var(--muted); font-family: var(--mono); font-size: 13px; }
.bio-copy { margin: 0; font-size: 15px; }
.bio-copy a { font-weight: 650; }
.intro-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 12px; border: 1px solid #cdd3ce; border-radius: 5px; background: white; color: var(--ink); font-family: var(--mono); font-size: 11px; font-weight: 700; text-decoration: none; }
.button:hover { border-color: #aeb7b0; color: var(--purple); transform: translateY(-1px); }
.button-primary { border-color: #d8d2e3; background: var(--purple-soft); color: var(--purple); }
.button-secondary { background: var(--blue-soft); color: var(--blue); }
.text-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 4px; border: 0; background: transparent; color: var(--blue); font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer; }
.research-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.research-tags li { padding: 4px 9px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.7); color: #565a61; font-family: var(--mono); font-size: 10px; }
.research-tags li::before { content: "#"; margin-right: 2px; color: var(--green); }
.section-cue { display: none; }

.section { width: min(calc(100% - 36px), var(--max)); margin: 0 auto; padding: 44px 0; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; }
.section-index { display: grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; margin: 0; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 17px; }
.section-heading .eyebrow { margin-bottom: 2px; }
.section-heading h2 { margin: 0; font-size: clamp(27px, 3vw, 32px); line-height: 1.1; }

.experience-entry { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 28px; align-items: center; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.experience-logo { display: grid; place-items: center; min-height: 110px; padding: 18px; border: 1px solid #d9d3e1; border-radius: 8px; background: white; }
.experience-logo img { width: 158px; height: auto; }
.experience-details { min-width: 0; }
.experience-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.experience-role { margin: 0 0 5px; color: var(--purple); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.experience-details h3 { max-width: 620px; margin: 0; font-size: 22px; line-height: 1.22; }
.experience-topline time { flex: 0 0 auto; padding-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 10px; white-space: nowrap; }
.experience-advisor { margin: 10px 0 4px; color: var(--ink) !important; }
.experience-details > p { max-width: 720px; margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.experience-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.experience-tags li { padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; background: white; color: #696d74; font-family: var(--mono); font-size: 9px; }

.news-section { display: block; }
.news-list { padding: 7px 16px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.78); }
.news-item { display: grid; grid-template-columns: 84px 1fr; gap: 14px; padding: 9px 0; border-bottom: 1px dashed #cfd5d0; }
.news-item:last-child { border-bottom: 0; }
.news-item time { align-self: start; padding: 3px 7px; border: 1px solid #d7dcd8; border-radius: 4px; background: var(--soft); color: var(--muted); font-family: var(--mono); font-size: 10px; text-align: center; }
.news-item p, .featured-news p { margin: 0; font-family: var(--sans); font-size: 13px; line-height: 1.45; }
.news-label { display: inline-block; margin: 0 0 3px; color: var(--coral); font-family: var(--mono); font-size: 10px; font-weight: 800; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px 48px; }
.filter-button { min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--muted); font-family: var(--mono); font-size: 10px; cursor: pointer; }
.filter-button span { margin-left: 3px; color: #92969c; }
.filter-button:hover, .filter-button.is-active { border-color: #cfc4df; background: var(--purple-soft); color: var(--purple); }
.publication-list { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.publication { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 14px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.publication.has-media { grid-template-columns: 42px 190px minmax(0,1fr); }
.publication[hidden] { display: none; }
.publication-year { padding-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.publication-media { align-self: start; height: 112px; padding: 7px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: white; }
.publication-media img { width: 100%; height: 100%; object-fit: contain; }
.publication-body { min-width: 0; }
.publication-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.status { font-family: var(--mono); font-size: 9px; font-weight: 800; }
.status { color: var(--coral); }
.status-accepted { color: var(--green); }
.status-patent { color: #9b7023; }
.publication h3 { margin: 0 0 5px; font-size: 17px; line-height: 1.3; }
.authors, .paper-note { margin: 0; color: var(--muted); font-size: 12px; }
.paper-note { margin-top: 5px; }
.paper-links { display: flex; gap: 7px; margin-top: 8px; }
.paper-links a { padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; background: white; font-family: var(--mono); font-size: 9px; font-weight: 800; text-decoration: none; text-transform: lowercase; }
.publication-toggle { display: flex; justify-content: center; padding-top: 14px; }
.show-more-button { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 7px 14px; border: 1px solid #cfc4df; border-radius: 5px; background: var(--purple-soft); color: var(--purple); font-family: var(--mono); font-size: 10px; font-weight: 700; cursor: pointer; }
.show-more-button:hover { border-color: var(--purple); background: white; }
.show-more-icon { font-size: 13px; transition: transform 160ms ease; }
.show-more-button[aria-expanded="true"] .show-more-icon { transform: rotate(180deg); }
.publication-note { margin: 15px 0 0 64px; color: #777b82; font-family: var(--mono); font-size: 9px; }

.open-source-section { width: 100%; max-width: none; padding-right: max(18px, calc((100% - var(--max)) / 2)); padding-left: max(18px, calc((100% - var(--max)) / 2)); background: #f4f1f8; border-top: 1px solid #ddd5e8; border-bottom: 1px solid #ddd5e8; }
.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.project { min-height: 240px; overflow: hidden; border: 1px solid #d9d3e1; border-radius: 8px; background: rgba(255,255,255,.8); }
.project-featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.2fr .8fr; min-height: 290px; }
.project-visual { min-height: 240px; background: white; border-right: 1px solid var(--line); }
.project-visual img { width: 100%; height: 100%; padding: 18px; object-fit: contain; }
.project-content { display: flex; flex-direction: column; padding: 20px; }
.project-number { color: var(--purple); font-family: var(--mono); font-size: 10px; }
.project h3 { margin: 14px 0 8px; font-size: 22px; line-height: 1.2; }
.project p { margin: 0; color: var(--muted); font-size: 13px; }
.tech-list, .project-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.tech-list li, .project-meta span { padding: 3px 7px; border: 1px solid var(--line); border-radius: 4px; color: #71747a; font-family: var(--mono); font-size: 9px; }
.project-link { align-self: flex-start; margin-top: auto; padding-top: 14px; color: var(--blue); font-family: var(--mono); font-size: 10px; font-weight: 700; }

.section-placeholder { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.gallery-collections { display: grid; gap: 28px; }
.gallery-group { min-width: 0; }
.gallery-group-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.gallery-group-heading .eyebrow { margin-bottom: 3px; }
.gallery-group-heading h3 { margin: 0; font-size: 22px; line-height: 1.2; }
.gallery-group-count { flex: 0 0 auto; margin: 0; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.album-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.album-card { min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); cursor: pointer; text-align: left; transition: border-color 160ms ease, transform 160ms ease; }
.album-card:hover { border-color: #b9c2bb; transform: translateY(-2px); }
.album-card:focus-visible, .album-dialog-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.album-cover { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--soft); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 220ms ease; }
.album-card:hover .album-cover img { transform: scale(1.025); }
.album-info { display: grid; min-height: 70px; padding: 11px 12px 12px; }
.album-info strong { align-self: start; font-size: 14px; line-height: 1.3; }
.album-info small { align-self: end; margin-top: 7px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
body.album-open { overflow: hidden; }
.album-dialog { width: min(1120px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); }
.album-dialog::backdrop { background: rgba(26, 28, 31, .72); backdrop-filter: blur(3px); }
.album-dialog-shell { max-height: calc(100vh - 30px); overflow-y: auto; }
.album-dialog-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 17px 18px 15px; border-bottom: 1px solid var(--line); background: rgba(250, 251, 249, .96); backdrop-filter: blur(10px); }
.album-dialog-header .eyebrow { margin-bottom: 3px; }
.album-dialog-header h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.album-dialog-meta { margin: 5px 0 0; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.album-dialog-close { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; }
.album-dialog-close:hover { border-color: #b9c2bb; color: var(--purple); }
.album-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 18px; }
.album-photo { min-width: 0; margin: 0; }
.album-photo img { width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); object-fit: contain; }
.album-photo figcaption { margin-top: 4px; color: var(--muted); font-family: var(--mono); font-size: 8px; text-align: right; }
.cv-section { padding-bottom: 60px; }
.cv-download { display: flex; align-items: center; }

.site-footer { display: grid; grid-template-columns: 1.5fr 1fr auto; gap: 30px; padding: 34px max(18px, calc((100% - var(--max)) / 2)); border-top: 1px solid var(--line); background: #f1f3f0; }
.footer-wordmark { margin-bottom: 12px; }
.site-footer p { max-width: 430px; margin: 0; color: var(--muted); font-family: var(--mono); font-size: 9px; }
.footer-links { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.footer-links a { font-family: var(--mono); font-size: 10px; }
.copyright { align-self: end; white-space: nowrap; }

@media (max-width: 850px) {
  .intro { grid-template-columns: 166px minmax(0,1fr); column-gap: 24px; }
  .publication.has-media { grid-template-columns: 40px 170px minmax(0,1fr); }
  .album-grid, .album-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  html { scroll-padding-top: 74px; }
  .site-header { padding: 8px 0; }
  .nav-shell { width: min(calc(100% - 24px), var(--max)); min-height: 50px; }
  .nav-toggle { display: block; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .site-nav { position: absolute; top: 67px; right: 12px; left: 12px; display: none; align-items: stretch; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: 0 12px 28px rgba(31,35,32,.1); }
  .site-nav.is-open { display: flex; flex-direction: column; gap: 2px; }
  .site-nav a { padding: 9px 11px; }
  .intro { width: min(calc(100% - 28px), var(--max)); padding: 30px 0 38px; grid-template-columns: 1fr; gap: 20px; }
  .intro-heading { grid-column: 1; grid-row: 1; }
  .portrait-wrap { grid-column: 1; grid-row: 2; position: relative; top: auto; width: min(100%, 340px); }
  .intro-copy { grid-column: 1; grid-row: 3; }
  .portrait-wrap img { height: 330px; }
  h1 { font-size: 48px; }
  .intro-lede { font-size: 12px; }
  .bio-copy { font-size: 15px; }
  .experience-entry { grid-template-columns: 1fr; gap: 17px; padding: 18px 0; }
  .experience-logo { width: min(100%, 210px); min-height: 100px; }
  .experience-topline { flex-direction: column; gap: 7px; }
  .experience-details h3 { font-size: 20px; }
  .section { width: min(calc(100% - 28px), var(--max)); padding: 36px 0; }
  .section-heading { margin-bottom: 17px; }
  .section-index { flex-basis: 34px; width: 34px; height: 34px; font-size: 16px; }
  .section-heading h2 { font-size: 28px; }
  .news-list { padding: 6px 12px; }
  .news-item { grid-template-columns: 72px 1fr; gap: 10px; }
  .filter-bar { margin-left: 0; }
  .publication, .publication.has-media { grid-template-columns: 36px minmax(0,1fr); gap: 9px; padding: 16px 0; }
  .publication.has-media .publication-media { grid-column: 2; height: 145px; }
  .publication.has-media .publication-body { grid-column: 2; }
  .publication-topline { align-items: flex-start; flex-direction: column; gap: 3px; }
  .publication h3 { font-size: 16px; }
  .publication-note { margin-left: 48px; }
  .open-source-section { width: 100%; padding-right: 14px; padding-left: 14px; }
  .project-grid { grid-template-columns: 1fr; }
  .project-featured { grid-column: auto; grid-template-columns: 1fr; }
  .project-visual { min-height: 190px; border-right: 0; border-bottom: 1px solid var(--line); }
  .project { min-height: 235px; }
  .gallery-group-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .album-dialog { width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .album-dialog-shell { max-height: calc(100vh - 18px); }
  .album-dialog-header { padding: 14px; }
  .album-dialog-header h2 { font-size: 20px; }
  .album-photo-grid { grid-template-columns: 1fr; padding: 12px; }
  .site-footer { grid-template-columns: 1fr; gap: 18px; padding: 30px 20px; }
  .copyright { align-self: auto; }
}

@media (max-width: 460px) {
  .album-grid { grid-template-columns: 1fr; }
}

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

@media print {
  .site-header, .intro-actions, .research-tags, .section-cue, #news, #publications, #opensource, #gallery, .site-footer { display: none !important; }
  .intro { grid-template-columns: 150px 1fr; padding: 25px 0; }
  .portrait-wrap { position: static; }
  .portrait-wrap img { height: 210px; box-shadow: none; }
  .section { padding: 30px 0; }
}
