/* Ink on paper by day and paper on night by dark, with colour only in flat planes: links and
   labels in cyan, and NVIDIA's green on the word itself. Writing is set in the sans; the page's
   own furniture (navigation, labels, dates, venues, numbers) is set in the system mono. */
:root {
  color-scheme: dark;
  --page: #0f1418;
  --band: #0a0e11;
  --sheet: #172026;
  --text-1: #e8f0f2;
  --text-2: #b3c3c8;
  --text-3: #82939a;
  --divider: rgb(232 240 242 / 14%);
  --link: #7fe4f1;
  --figure-paper: #172026;
  --nvidia-green: #76b900;
  --token-cache: rgb(79 216 234 / 30%);
  --token-prefill: #4fd8ea;
  --token-decoding: #e8f0f2;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f4f8f9;
  --band: #e8f0f2;
  --sheet: #fff;
  --text-1: #141a1f;
  --text-2: #435058;
  --text-3: #5d6a72;
  --divider: rgb(20 26 31 / 14%);
  --link: #0b7080;
  --figure-paper: #fff;
  --token-cache: rgb(31 179 199 / 30%);
  --token-prefill: #1fb3c7;
  --token-decoding: #141a1f;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--page); color: var(--text-1); font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--link) 30%, transparent); }
p { margin: 0 0 12px; }
h1, h2, h3, h4 { color: var(--text-1); }
.nvidia-word { color: var(--nvidia-green); }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 30; padding: 6px 10px; background: var(--page); }
.skip-link:focus { top: 10px; }
.kicker { margin: 0 0 6px; font: 700 12px/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--link); }

/* Navigation */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--page); border-bottom: 1px solid var(--divider); }
.header-inner { max-width: 1120px; margin: 0 auto; padding: 0 28px; height: 60px; display: flex; align-items: center; gap: 28px; }
.wordmark { font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--text-1); }
.wordmark:hover { text-decoration: none; }
.site-header nav { margin-left: auto; display: flex; gap: 24px; }
.site-header nav a, #theme-toggle { font: 14px var(--mono); color: var(--text-1); }
.site-header nav a:hover { color: var(--link); text-decoration: none; }
#theme-toggle { background: none; border: 1px solid var(--divider); border-radius: 2px; padding: 5px 10px; cursor: pointer; white-space: nowrap; }
#theme-toggle:hover { border-color: var(--link); color: var(--link); }

main { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
main > section { padding: 60px 0 4px; border-top: 1px solid var(--divider); }
main > section.intro { border-top: 0; }
main > section.news { padding: 22px 0; }

/* Introduction */
/* The name and the portrait share the top row at every width; roles, bio, and links follow. */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "head portrait" "body portrait"; grid-template-rows: auto 1fr; column-gap: 64px; align-items: start; padding-top: 64px; padding-bottom: 56px; }
.intro-head { grid-area: head; }
.intro-body { grid-area: body; }
h1 { margin: 6px 0 22px; font-size: 52px; line-height: 1.04; letter-spacing: -.035em; font-weight: 750; }
.roles { display: grid; gap: 4px; margin: 0 0 22px; }
.roles div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.roles dt { font: 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.roles dd { margin: 0; }
.intro-body > p:not(.links) { max-width: 680px; color: var(--text-2); }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin: 26px 0 0; font: 14px var(--mono); }
.button { padding: 9px 14px; border: 1px solid var(--text-1); border-radius: 2px; color: var(--text-1); }
.button:hover { border-color: var(--link); color: var(--link); text-decoration: none; }
.portrait { grid-area: portrait; margin: 0; }
.portrait-plate { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--sheet); border-radius: 2px; }
.portrait-plate img { position: absolute; left: -8%; bottom: 0; width: 125%; max-width: none; height: auto; }
/* The retouched light-shirt portrait on dark pages, the original navy one on light pages. */
:root[data-theme="light"] .dark-only, :root:not([data-theme="light"]) .light-only { display: none; }
.portrait figcaption { margin-top: 8px; font-size: 13px; color: var(--text-3); }

/* News */
.news { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; }
.news .kicker { margin: 0; line-height: 1.95; }
.news ul { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; color: var(--text-2); }
.news time { font: 13px/2 var(--mono); color: var(--text-3); }

/* Sections and research lines */
h2 { margin: 0 0 14px; font-size: 34px; line-height: 1.15; letter-spacing: -.028em; font-weight: 750; }
.lede { max-width: 760px; font-size: 18px; line-height: 1.65; color: var(--text-2); }
.thread { margin-top: 48px; }
.thread h3 { margin: 0 0 10px; font-size: 24px; line-height: 1.25; letter-spacing: -.02em; font-weight: 700; }
.thread-text { max-width: 820px; color: var(--text-2); }
.note { font-size: 14px; color: var(--text-3); }

/* Figures, shared by projects, publications, and the viewer */
.figure-filters { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
:root:not([data-theme="light"]) .figure-ink { filter: url(#dark-figure-ink); }
.work-figure { margin: 0; min-width: 0; }
.work-figure a { display: block; aspect-ratio: 1.6; padding: 8px; background: var(--figure-paper); border: 1px solid var(--divider); border-radius: 2px; }
.work-figure a:hover { border-color: var(--link); }
.work-figure svg { display: block; width: 100%; height: 100%; }

/* Projects */
.project h4 { margin: 0 0 8px; font-size: 19px; line-height: 1.3; letter-spacing: -.015em; font-weight: 700; }
.project h4 a { color: var(--text-1); }
.project h4 a:hover { color: var(--link); }
.project-text > p:not(.kicker, .usage-note) { font-size: 15px; color: var(--text-2); }
.project-list .project { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 36px; align-items: start; padding: 28px 0; border-top: 1px solid var(--divider); }
.project-list { margin-top: 26px; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 26px; }
.project-grid .project { padding-top: 20px; border-top: 1px solid var(--divider); }
.project-grid .work-figure { margin-bottom: 16px; }

/* Agent usage */
.usage-panel { margin: 18px 0 8px; }
.usage-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font: 12px var(--mono); color: var(--text-3); }
.usage-status { letter-spacing: .06em; text-transform: uppercase; }
.usage-controls { display: flex; gap: 6px; }
.usage-range { font: 12px var(--mono); padding: 3px 8px; border: 1px solid var(--divider); border-radius: 2px; background: none; color: var(--text-2); cursor: pointer; }
.usage-range[aria-pressed="true"] { border-color: var(--link); color: var(--link); }
.usage-total { margin: 10px 0 0; font-size: 34px; line-height: 1.1; letter-spacing: -.03em; font-weight: 700; color: var(--text-1); }
.usage-total-label { margin: 2px 0 0; font-size: 13px; color: var(--text-3); }
.usage-secondary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.usage-stat { padding: 10px 12px; background: var(--sheet); border: 1px solid var(--divider); border-radius: 2px; }
.usage-stat strong { display: block; font-size: 18px; letter-spacing: -.02em; font-weight: 700; color: var(--text-1); }
.usage-stat span { font: 11px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.usage-chart { height: 64px; display: flex; gap: 2px; align-items: end; margin-top: 16px; border-bottom: 1px solid var(--divider); }
.usage-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 1px; }
.usage-bar span { min-height: 0; }
.token-cache_hit { background: var(--token-cache); }
.token-prefill { background: var(--token-prefill); }
.token-decoding { background: var(--token-decoding); }
.usage-axis, .usage-legend { display: flex; gap: 16px; font: 11.5px var(--mono); color: var(--text-3); margin-top: 6px; }
.usage-axis { justify-content: space-between; }
.usage-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--token-cache); }
.usage-legend .legend-prefill::before { background: var(--token-prefill); }
.usage-legend .legend-decoding::before { background: var(--token-decoding); }
.usage-updated, .usage-note { margin: 8px 0 0; font-size: 13px; color: var(--text-3); }
.usage-empty { font-size: 14px; color: var(--text-3); }

/* Publications */
.kicker.group { margin: 40px 0 0; padding-bottom: 10px; border-bottom: 1px solid var(--divider); }
.paper { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 26px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--divider); }
#publications > .paper:last-child { border-bottom: 0; }
.paper h4 { margin: 0 0 4px; font-size: 16px; line-height: 1.45; letter-spacing: -.01em; font-weight: 650; }
.paper h4 a { color: var(--text-1); }
.paper h4 a:hover { color: var(--link); }
.paper-authors { margin: 0 0 6px; font-size: 14px; color: var(--text-2); }
.paper-authors strong { color: var(--text-1); font-weight: 650; }
.paper-meta { margin: 0; font: 12.5px var(--mono); color: var(--text-3); }
.paper-meta em { font-style: normal; color: var(--link); }

/* Background */
.background-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 64px; margin-top: 24px; }
.background-grid > div { margin-bottom: 28px; }
.background-grid .kicker { margin-bottom: 14px; }
.background-grid > div > p { font-size: 15px; color: var(--text-2); }
.entry { padding: 12px 0; border-top: 1px solid var(--divider); }
.entry p { margin: 0; font-size: 15px; color: var(--text-2); }
.entry h4 { margin: 2px 0 0; font-size: 16px; font-weight: 650; }
.entry h4 a { color: var(--text-1); }
.entry .entry-date { font: 12.5px var(--mono); color: var(--text-3); }
.entry-detail { font-size: 14px; color: var(--text-3); }
.background-grid > div > .entry-detail { padding-top: 10px; border-top: 1px solid var(--divider); }

/* Footer */
.site-footer { margin-top: 56px; border-top: 1px solid var(--divider); }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: 22px 28px 36px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font: 12.5px var(--mono); color: var(--text-3); }

/* Figure viewer */
.figure-viewer { width: min(1100px, 94vw); max-height: 92vh; padding: 16px; background: var(--figure-paper); color: var(--text-1); border: 1px solid var(--divider); border-radius: 2px; }
.figure-viewer::backdrop { background: rgb(0 0 0 / 70%); }
.figure-viewer-controls { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font: 13px var(--mono); }
.figure-close { font: inherit; color: var(--text-1); background: none; border: 1px solid var(--divider); border-radius: 2px; padding: 4px 12px; cursor: pointer; }
.figure-enlarged a { aspect-ratio: auto; padding: 0; border: 0; }
.figure-enlarged svg { height: auto; max-height: 76vh; }

@media (max-width: 960px) {
  .intro { grid-template-columns: minmax(0, 1fr) 240px; column-gap: 40px; }
  h1 { font-size: 44px; }
  .project-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .header-inner, main, .footer-inner { padding-left: 20px; padding-right: 20px; }
  .header-inner { gap: 16px; }
  .site-header nav { gap: 14px; }
  .site-header nav a[href="#background"] { display: none; }
  .intro { grid-template-columns: minmax(0, 1fr) 112px; grid-template-areas: "head portrait" "body body"; column-gap: 18px; align-items: center; padding-top: 32px; }
  .intro-head h1 { margin-bottom: 0; }
  .intro-body { margin-top: 24px; }
  .portrait figcaption { display: none; }
  .portrait-plate img { left: -49%; top: -14%; bottom: auto; width: 230%; }
  h1 { font-size: 38px; }
  .roles div, .news, .news li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .project-list .project, .project-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .paper { grid-template-columns: 110px minmax(0, 1fr); gap: 16px; align-items: start; }
  .background-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .wordmark { display: none; }
  .site-header nav { margin-left: 0; gap: 12px; }
  .site-header nav a, #theme-toggle { font-size: 13px; }
  #theme-toggle { margin-left: auto; padding: 4px 8px; }
}
@media (max-width: 420px) {
  .intro { grid-template-columns: minmax(0, 1fr) 96px; column-gap: 14px; }
  h1 { font-size: 34px; }
}
@media (max-width: 340px) {
  .site-header nav { gap: 9px; }
  .site-header nav a, #theme-toggle { font-size: 12px; }
  #theme-toggle { padding: 3px 6px; }
}
@media print {
  :root, :root[data-theme="light"] { --page: #fff; --sheet: #fff; --text-1: #000; --text-2: #222; --text-3: #444; --link: #000; --divider: #bbb; }
  .site-header, .usage-panel, .skip-link { display: none; }
  .project, .paper, .entry { break-inside: avoid; }
}
