/* Design system for yimingli.site. Layouts live in _layouts/yl-*.liquid. No text on the site is set below 16px. */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-latin-opsz-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f8f6f1;
  --paper-2: #efece4;
  --ink: #17191d;
  --ink-2: #44484f;
  --rule: #dcd7cc;
  --accent: #8c2f1e;
  --frame: #ffffff;

  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --text: 1.125rem;
  --meta: 1rem;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1120px;
  --measure: 68ch;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #121417;
  --paper-2: #1b1e22;
  --ink: #ebe8e1;
  --ink-2: #b9bbc0;
  --rule: #2c3036;
  --accent: #e39a83;
  --frame: #f4f2ed;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}
::selection {
  background: var(--accent);
  color: #fff;
}
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.18em;
  transition:
    color 0.15s ease,
    text-decoration-color 0.15s ease;
}
a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
h1,
h2,
h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-wrap: balance;
}
p {
  margin: 0 0 1em;
  text-wrap: pretty;
}
ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
code {
  font-size: 0.92em;
}
.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--paper);
  color: var(--ink);
}
.skip:focus {
  left: 8px;
}
.meta {
  font-size: var(--meta);
  color: var(--ink-2);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
}
.site-header-in {
  display: flex;
  align-items: center;
  gap: 32px;
  min-height: 68px;
}
.brand {
  margin-right: auto;
  font-family: var(--serif);
  font-size: 1.4rem;
  text-decoration: none;
}
.site-nav {
  display: flex;
  gap: clamp(18px, 2.4vw, 32px);
}
.site-nav a {
  position: relative;
  font-size: 1.0625rem;
  text-decoration: none;
  padding-block: 4px;
}
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: var(--accent);
}
.theme-toggle {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  margin-right: -8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  border-radius: 50%;
}
.theme-toggle:hover {
  color: var(--accent);
}
.theme-toggle svg {
  transition: transform 0.35s ease;
}
[data-theme="dark"] .theme-toggle svg {
  transform: rotate(180deg);
}
@media (max-width: 640px) {
  .site-header-in {
    flex-wrap: wrap;
    gap: 0 16px;
    padding-block: 10px 8px;
  }
  .site-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: space-between;
  }
}

/* Introduction */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(200px, 24vw, 280px);
  gap: clamp(32px, 6vw, 80px);
  align-items: start;
  padding-block: clamp(48px, 7vw, 88px) clamp(40px, 5vw, 64px);
}
.intro h1 {
  font-size: clamp(2.6rem, 5.4vw, 3.6rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}
.intro-role {
  margin: 12px 0 28px;
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.intro-bio {
  max-width: var(--measure);
}
.intro-bio p {
  margin-bottom: 0.9em;
}
.intro-interests {
  margin: 4px 0 0;
  color: var(--ink-2);
}
.intro-interests strong {
  color: var(--ink);
  font-weight: 500;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-top: 26px;
  font-size: 1.0625rem;
}
.portrait {
  margin: 8px 0 0;
}
.portrait img {
  width: 100%;
  border-radius: 6px;
}
@media (max-width: 720px) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  .portrait {
    order: -1;
    max-width: 180px;
    margin: 0;
  }
}

/* Sections */
.section {
  padding-block: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--rule);
}
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 28px;
}
.section-head h2 {
  font-size: clamp(1.75rem, 3vw, 2.1rem);
}
.section-head a {
  font-size: 1.0625rem;
}

/* News */
.news > li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 4px 24px;
  padding-block: 12px;
  border-top: 1px solid var(--rule);
}
.news > li:first-child {
  border-top: 0;
  padding-top: 0;
}
.news time {
  padding-top: 0.08em;
  font-size: var(--meta);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.news p {
  margin: 0;
  max-width: var(--measure);
}
@media (max-width: 520px) {
  .news > li {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Publications */
.publications h2.bibliography {
  margin: 0 0 4px;
  padding-top: 28px;
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--ink);
}
.publications h2.bibliography:first-child {
  padding-top: 0;
}
.publications ol.bibliography,
.pub-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.pub {
  display: grid;
  grid-template-columns: clamp(140px, 22vw, 220px) minmax(0, 1fr);
  gap: clamp(18px, 3vw, 36px);
  padding-block: 24px;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 88px;
}
li:first-child > .pub {
  border-top: 0;
}
.pub-figure {
  margin: 0;
  align-self: start;
  padding: 6px;
  background: var(--frame);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.pub-figure img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}
.pub-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 450;
  line-height: 1.25;
}
.pub-authors {
  margin: 0 0 4px;
  color: var(--ink-2);
}
.pub-authors strong {
  font-weight: 600;
  color: var(--ink);
}
.pub-venue {
  margin: 0 0 10px;
  font-style: italic;
  color: var(--ink-2);
}
.pub-venue b {
  margin-left: 6px;
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
}
.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  font-size: var(--meta);
}
.pub-links summary {
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.18em;
}
.pub-links summary::-webkit-details-marker {
  display: none;
}
.pub-links summary:hover {
  color: var(--accent);
}
.pub-detail[open] {
  flex-basis: 100%;
}
.pub-detail > div {
  margin-top: 10px;
  padding: 14px 16px;
  background: var(--paper-2);
  border-radius: 4px;
  overflow-x: auto;
}
.pub-detail .pub-abstract {
  font-size: var(--meta);
  line-height: 1.6;
}
.pub-detail pre {
  margin: 0;
  font-size: var(--meta);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .pub {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .pub-figure {
    max-width: 320px;
  }
}

/* Collaboration */
.collab {
  max-width: var(--measure);
  margin-top: 32px;
  padding: 18px 22px;
  border-left: 3px solid var(--accent);
  background: var(--paper-2);
  border-radius: 0 6px 6px 0;
}
.collab h2 {
  margin-bottom: 6px;
  font-size: 1.4rem;
}
.collab p {
  margin: 0 0 6px;
  color: var(--ink-2);
}
.collab a {
  font-weight: 500;
}

.section-intro {
  max-width: 46rem;
  margin-bottom: 32px;
}
.section-intro h2 {
  font-size: clamp(1.75rem, 3vw, 2.1rem);
}
.section-intro p {
  margin: 10px 0 0;
  color: var(--ink-2);
}

/* Videos */
.videos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 44px) clamp(20px, 3vw, 36px);
}
.videos.is-single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 860px;
}
.video {
  margin: 0;
}
.video video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0d0e10;
  border-radius: 4px;
}
.video figcaption {
  margin-top: 14px;
}
.video-tag {
  margin: 0 0 4px;
  font-size: var(--meta);
  color: var(--accent);
}
.video h3 {
  font-size: 1.4rem;
  font-weight: 450;
}
.video-caption {
  margin: 8px 0 0;
  color: var(--ink-2);
}
.video-link {
  display: inline-block;
  margin-top: 8px;
}
.video.is-feature {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
  margin-bottom: clamp(32px, 4vw, 48px);
}
.video.is-feature figcaption {
  margin-top: 0;
}
.video.is-feature h3 {
  font-size: clamp(1.6rem, 2.6vw, 2rem);
}
@media (max-width: 860px) {
  .video.is-feature {
    grid-template-columns: minmax(0, 1fr);
  }
  .video.is-feature figcaption {
    margin-top: 4px;
  }
}
@media (max-width: 720px) {
  .videos {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Definition grids: expertise, facts */
.defs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px clamp(24px, 4vw, 56px);
  margin: 0;
}
.defs > div {
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.defs dt {
  margin-bottom: 4px;
  font-family: var(--serif);
  font-size: 1.3rem;
}
.defs dd {
  margin: 0;
  color: var(--ink-2);
}
.facts {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px clamp(20px, 3vw, 40px);
  margin-bottom: clamp(36px, 5vw, 56px);
}
.facts dt {
  font-family: var(--sans);
  font-size: var(--meta);
  color: var(--ink-2);
}
.facts dd {
  color: var(--ink);
}
@media (max-width: 720px) {
  .defs {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Plain lists */
.plain > li {
  position: relative;
  padding-left: 1.1em;
  margin-bottom: 0.5em;
}
.plain > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 0.45em;
  height: 1px;
  background: var(--ink-2);
}
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px clamp(24px, 4vw, 56px);
}
.two-col h3 {
  margin-bottom: 12px;
  font-size: 1.3rem;
}
@media (max-width: 720px) {
  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Inner pages */
.page-head {
  padding-block: clamp(48px, 7vw, 88px) clamp(24px, 3vw, 40px);
}
.page-head h1 {
  font-size: clamp(2.5rem, 5vw, 3.4rem);
  letter-spacing: -0.02em;
}
.page-lede {
  max-width: 46rem;
  margin: 16px 0 0;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ink-2);
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 22px;
  font-size: 1.0625rem;
}
.page-body {
  padding-bottom: clamp(56px, 8vw, 104px);
}
.button {
  display: inline-block;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  text-decoration: none;
}
.button:hover {
  background: var(--accent);
  color: #fff;
}
.prose {
  max-width: var(--measure);
}
.prose h2 {
  margin: 1.8em 0 0.5em;
  font-size: clamp(1.6rem, 2.6vw, 1.9rem);
}
.prose h3 {
  margin: 1.5em 0 0.4em;
  font-size: 1.35rem;
}
.prose > :first-child {
  margin-top: 0;
}
.prose ul {
  margin: 0 0 1em;
}
.prose ul > li {
  position: relative;
  padding-left: 1.1em;
  margin-bottom: 0.45em;
}
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 0.45em;
  height: 1px;
  background: var(--ink-2);
}
.prose strong {
  font-weight: 600;
}
.prose code {
  padding: 0.1em 0.35em;
  background: var(--paper-2);
  border-radius: 3px;
}
.figure {
  margin: 28px 0;
}
.figure .frame {
  padding: 10px;
  background: var(--frame);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.figure img {
  width: 100%;
}
.figure figcaption,
.caption {
  margin-top: 10px;
  font-size: var(--meta);
  color: var(--ink-2);
}
.refs {
  font-size: var(--meta);
  color: var(--ink-2);
}

/* Research chapters */
.chapter {
  padding-block: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--rule);
}
.chapter h2 {
  max-width: 30ch;
  margin-bottom: 14px;
  font-size: clamp(1.7rem, 3vw, 2.1rem);
}
.chapter .prose {
  margin-bottom: 26px;
}

/* Tables */
.table {
  width: 100%;
  max-width: 720px;
  margin: 18px 0 8px;
  border-collapse: collapse;
  font-size: var(--meta);
  font-variant-numeric: tabular-nums;
}
.table th,
.table td {
  padding: 9px 0 9px 14px;
  border-top: 1px solid var(--rule);
  text-align: right;
  font-weight: 400;
}
.table th:first-child,
.table td:first-child {
  padding-left: 0;
  text-align: left;
}
.table thead th {
  border-top: 0;
  color: var(--ink-2);
}
.table .is-mine td {
  font-weight: 600;
}
.table.is-left td,
.table.is-left th {
  text-align: left;
}

/* Projects */
.project-row {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(20px, 4vw, 48px);
  padding-block: clamp(28px, 4vw, 44px);
  border-top: 1px solid var(--rule);
}
.project-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.project-row h2 {
  margin-bottom: 6px;
  font-size: clamp(1.7rem, 3vw, 2.1rem);
}
.project-row h2 a {
  text-decoration: none;
}
.project-row .frame {
  display: block;
  padding: 10px;
  background: var(--frame);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.project-row .frame img {
  width: 100%;
  height: clamp(180px, 20vw, 240px);
  object-fit: contain;
}
@media (max-width: 760px) {
  .project-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* CV */
.cv-section {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 0 clamp(24px, 4vw, 56px);
  padding-block: 28px;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 80px;
}
.cv-section > h2 {
  margin: 0 0 14px;
  font-size: 1.45rem;
}
.cv-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 20px;
  margin-bottom: 20px;
}
.cv-entry:last-child {
  margin-bottom: 0;
}
.cv-entry h3 {
  font-size: 1.25rem;
  font-weight: 450;
  line-height: 1.3;
}
.cv-entry .cv-date {
  padding-top: 0.2em;
  font-size: var(--meta);
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cv-entry p,
.cv-entry ul {
  grid-column: 1 / -1;
  margin: 3px 0 0;
  color: var(--ink-2);
}
.cv-entry ul > li,
.cv-bullets > li {
  position: relative;
  padding-left: 1.1em;
  margin-top: 3px;
}
.cv-entry ul > li::before,
.cv-bullets > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.8em;
  width: 0.45em;
  height: 1px;
  background: var(--ink-2);
}
.cv-entry strong {
  font-weight: 600;
  color: var(--ink);
}
.cv-text {
  margin: 0;
  max-width: 44rem;
}
.cv-bullets {
  margin-bottom: 6px;
}
.cv-bullets:last-child {
  margin-bottom: 0;
}
.cv-pair {
  display: grid;
  grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
  gap: 2px 20px;
  margin: 0 0 10px;
}
.cv-pair:last-child {
  margin-bottom: 0;
}
.cv-pair dt {
  font-weight: 500;
}
.cv-pair dd {
  margin: 0;
  color: var(--ink-2);
}
@media (max-width: 760px) {
  .cv-section,
  .cv-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Footer */
.site-footer {
  padding-block: 40px 48px;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
}
.footer-in {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 40px;
}
.footer-in p {
  margin: 0;
}
.footer-in .meta {
  margin-top: 6px;
}

@media print {
  .site-header,
  .site-footer,
  .page-actions {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition: none !important;
  }
}
