* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  color-scheme: dark;
  --ink: #f2f2ed;
  --muted: #a3a39d;
  --faint: #6d6d68;
  --rule: #272724;
  --rule-strong: #3a3a36;
  --paper: #080808;
  --accent: #f2f2ed;
  --link: #d0d0ca;
  --link-rule: #555550;
  --reading-measure: 37rem;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 14% -10%, rgba(255, 255, 255, 0.045), transparent 30rem),
    var(--paper);
}

body {
  max-width: 980px;
  margin: 0 auto;
  padding: 56px 40px 96px;
  color: var(--ink);
  background: transparent;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-strong);
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

a:hover,
a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 16px;
  z-index: 10;
  padding: 6px 9px;
  color: var(--paper);
  background: var(--accent);
  border: 0;
  font-size: 0.78rem;
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

.page {
  --sidebar-width: 190px;
  --layout-gap: 56px;
  max-width: calc(var(--sidebar-width) + var(--layout-gap) + var(--reading-measure));
  margin-inline: auto;
  position: relative;
  padding-top: 22px;
}

main { min-width: 0; padding-top: 40px; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 0 var(--layout-gap);
  align-items: start;
}

.identity {
  position: sticky;
  top: 40px;
  margin-top: 40px;
  padding: 0 24px 8px 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.identity-line,
.profile-link,
.profile-section p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.7;
}

.identity-line a,
.profile-link a { color: var(--ink); }

.contact-email { margin-top: 10px; }
.contact-orcid { margin-top: 15px; }

.profile-meta { margin-top: 24px; }
.profile-meta .contact-orcid { margin-top: 0; }

.orcid-link,
.profile-link a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.orcid-mark,
.github-mark,
.quantconnect-mark {
  display: block;
  flex: 0 0 auto;
}

.profile-link { margin-top: 2px; }
.profile-link-secondary { margin-top: 2px; }

.quantconnect-mark {
  width: 13px;
  height: 13px;
  object-fit: contain;
}

.profile-section { margin-top: 26px; }

.profile-section h2 {
  margin-bottom: 4px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
}

.bio {
  max-width: var(--reading-measure);
  margin-bottom: 40px;
  color: #d1d1cb;
  font-size: 0.92rem;
  line-height: 1.76;
}

.papers {
  max-width: var(--reading-measure);
  margin-bottom: 36px;
}

.writing {
  max-width: var(--reading-measure);
  margin-bottom: 34px;
}

.projects {
  max-width: var(--reading-measure);
  margin-bottom: 34px;
}

.feed-heading {
  margin-bottom: 8px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1.5;
  text-transform: uppercase;
}

.paper {
  width: 100%;
  margin: 0;
  padding: 14px 0;
  font-size: 0.86rem;
}

.paper h2 {
  max-width: 100%;
  font-family: inherit;
  font-size: inherit;
  font-style: normal;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.project h2 {
  font-family: inherit;
  font-style: normal;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.paper h2 em { font-style: inherit; }
.paper-sub { color: var(--muted); font-style: normal; }

.paper-doi {
  margin-top: 1px;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.67rem;
}

.paper-doi a { color: var(--link); border-bottom-color: var(--link-rule); }

.paper-desc {
  margin-top: 3px;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.58;
}

/* Inline MathML in abstracts: inherit surrounding type instead of browser defaults. */
math {
  font-size: 1em;
  line-height: inherit;
  color: inherit;
}

math mfrac { font-size: 0.92em; }
.math-term { white-space: nowrap; }

.last-updated {
  max-width: var(--reading-measure);
  margin-top: 14px;
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.67rem;
}

.paper-page .back-link {
  margin-bottom: 24px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
}

.paper-page .back-link a { color: var(--muted); }

.paper-page .page-title {
  margin-bottom: 6px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1.1rem;
  font-style: normal;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.45;
}

.project-page .project-list {
  margin-top: 7px;
  padding-left: 1.1em;
}

.project-page .project-list li + li { margin-top: 3px; }
.project-page .project-list li::marker { color: var(--faint); }

.project-page .benchmark-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
  table-layout: fixed;
}

.project-page .benchmark-table th,
.project-page .benchmark-table td {
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.project-page .benchmark-table th {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 500;
}

.paper-page .document .page-subtitle {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.paper-page .document {
  max-width: 610px;
  color: #c8c8c2;
}

.paper-page .document section + section { margin-top: 28px; }

.paper-page .paper-figure {
  margin: 24px 0 0;
}

.paper-page .figure-image-link {
  display: block;
  border-bottom: 0;
}

.paper-page .paper-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.paper-page .paper-figure figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
}

.paper-page .document h3 {
  margin-bottom: 8px;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
}

.paper-page .document p,
.paper-page .document li {
  font-size: 0.82rem;
  line-height: 1.78;
}

.paper-page .document p + p { margin-top: 10px; }

.paper-page .paper-byline {
  margin-top: 15px;
  color: var(--muted);
  font-size: 0.76rem;
}

.paper-page .document .page-meta {
  margin-top: 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.paper-page .document section:first-of-type {
  margin-top: 28px;
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
  margin: 12px 0 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.65;
}

.resource-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--link);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-decoration-color: var(--link-rule);
  text-underline-offset: 0.3em;
}

.resource-links a:hover,
.resource-links a:focus-visible {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

.paper-doi a:hover,
.paper-doi a:focus-visible,
.paper-page .back-link a:hover,
.paper-page .back-link a:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.paper-page .citation-block {
  overflow: visible;
  margin: 8px 0 0;
  padding: 0;
  color: #c8c8c2;
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 0.82rem;
  font-style: italic;
  line-height: 1.78;
  white-space: normal;
}

.paper-page .citation-block code {
  font-family: inherit;
  font-style: inherit;
}

/* Reference list: hanging indent, muted, links kept quiet. */
.reference-list {
  margin-top: 4px;
}

.reference-item {
  padding-left: 1.6em;
  text-indent: -1.6em;
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.reference-item:first-child { margin-top: 0; }

.reference-number {
  color: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.reference-item a {
  color: var(--faint);
}

.reference-item a:hover,
.reference-item a:focus-visible { color: var(--accent); }

/* In-text citation markers: superscript, quiet until hovered. */
.cite {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.7em;
  font-style: normal;
  line-height: 0;
  white-space: nowrap;
}

.cite a {
  color: var(--faint);
  text-decoration: none;
}

.cite a:hover,
.cite a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

/* Brief highlight when a citation jumps to its entry. */
.reference-item:target {
  color: var(--ink);
}

.reference-item:target .reference-number { color: var(--accent); }

@media (max-width: 620px) {
  body { margin: 0 auto; padding: 24px 18px 56px; }

  .page { padding-top: 20px; }

  .layout { display: block; }

  main { padding-top: 0; }

  .identity {
    position: static;
    margin: 24px 0 28px;
    padding: 0 0 20px;
  }

  .identity-header {
    display: block;
  }

  .identity-info {
    margin-left: 0;
    line-height: 1.5;
  }

  .profile-meta {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(0, 1fr);
    gap: 3px 24px;
    margin-top: 20px;
  }

  .profile-link {
    grid-column: 1;
    grid-row: 2;
    margin-top: 0;
  }

  .profile-link-secondary {
    grid-row: 3;
    margin-top: 0;
  }

  .profile-links {
    grid-column: 1;
    grid-row: 1;
  }

  .profile-links .contact-orcid { margin-top: 0; }
  .profile-meta .profile-link a,
  .profile-meta .orcid-link { white-space: nowrap; }

  .profile-section {
    grid-column: 2;
    grid-row: 1 / span 3;
    margin-top: 0;
  }

  h1 { font-size: 0.95rem; }
  .identity-line,
  .profile-link,
  .profile-section p { font-size: 0.78rem; }
  .contact-email { margin-top: 4px; }
  .contact-orcid { margin-top: 8px; }
  .profile-section h2 { margin-bottom: 3px; }
  .bio { margin-bottom: 28px; font-size: 0.85rem; }
  .paper { margin: 0; padding: 12px 0; font-size: 0.82rem; }
  .paper-desc { font-size: 0.76rem; }

  .paper-page .back-link { margin-bottom: 20px; }
  .paper-page .page-title { font-size: 0.94rem; }
  .paper-page .document .page-subtitle { font-size: 0.8rem; }
  .paper-page .paper-byline { font-size: 0.76rem; }
  .resource-links { font-size: 0.76rem; gap: 4px 18px; }
  .resource-links a { min-height: 44px; }

  .project-page .benchmark-table {
    font-size: 0.66rem;
    line-height: 1.45;
  }

  .project-page .benchmark-table th,
  .project-page .benchmark-table td { padding: 7px 6px 7px 0; }
}

@media (prefers-reduced-motion: reduce) {
  a { transition: none; }
}

/* Typesetting only: preserve the shared page grid, font sizes and headings. */
.writing-page .document > header { margin-bottom: 20px; }
.writing-page .equation { margin: 22px 0; padding: 6px 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.writing-page .equation math { width: max-content; min-width: 100%; margin: 0; padding: 2px; font-size: 1rem; }
.equation:focus-visible { outline: 1px solid var(--muted); outline-offset: 4px; }
.writing-page .reference-list { padding-left: 1.5em; }
.writing-page .reference-item { padding-left: 0.3em; text-indent: 0; }
.writing-page .reference-item a, .writing-page .cite a { color: var(--muted); }
.writing-page .reference-back { margin-left: 0.3em; border: 0; }
.writing-page :is(h3, .reference-item) { scroll-margin-top: 28px; }
.paper-page .document math[display="inline"] { white-space: nowrap; }
