/* yiranpang.github.io
   Shares its type and colour with the project pages (GAdapHeadFRL): Newsreader
   for headings, Inter for text, ink on white with one blue accent. Each band
   carries its heading in a left rail and its content in one column beside it. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/newsreader-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400 600;
  font-display: swap;
  src: url("/assets/fonts/newsreader-italic-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --soft: #f4f6f9;
  --ink: #131b2a;
  --text: #283346;
  --muted: #5b6676;
  --line: #e1e5eb;
  --blue: #1f55b5;
  --blue-soft: #eaf0fb;
  --orange: #b4530a;
  --header-bg: rgba(255, 255, 255, 0.86);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  --mono: "SF Mono", Consolas, Menlo, monospace;
  --wrap: 1080px;
  --rail: 220px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141d;
  --soft: #171e2b;
  --ink: #f2f5fa;
  --text: #c9d1dd;
  --muted: #8e9aac;
  --line: #273041;
  --blue: #8fb5ff;
  --blue-soft: #1b2942;
  --orange: #f0a560;
  --header-bg: rgba(15, 20, 29, 0.86);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.62;
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

sub,
sup {
  line-height: 0;
}

strong,
b {
  color: var(--ink);
  font-weight: 600;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: min(100% - 48px, var(--wrap));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 20;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 8px 28px;
  min-height: 60px;
}

.brand {
  margin-right: auto;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 26px;
}

.site-nav a {
  padding: 6px 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.icon-sun,
[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

/* ---------- Shared pieces ---------- */

.badge {
  display: inline-block;
  padding: 3px 9px;
  background: var(--blue-soft);
  color: var(--blue);
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  line-height: 1.5;
  text-transform: uppercase;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.btn:hover {
  border-color: var(--muted);
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--text);
  border-color: var(--text);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.chip:hover {
  border-color: var(--muted);
  color: var(--ink);
}

.chip[aria-expanded="true"],
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.chip-quiet {
  border-color: transparent;
  color: var(--muted);
  padding-inline: 4px;
}

.chip-quiet:hover {
  border-color: transparent;
  text-decoration: underline;
}

/* ---------- Home hero ---------- */

.hero {
  padding: 76px 0 72px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 232px;
  align-items: start;
  gap: 64px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
}

.eyebrow a {
  color: inherit;
}

.hero h1 {
  margin-top: 14px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.8rem, 6vw, 4.1rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.04;
}

.lead {
  max-width: 44rem;
  margin-top: 26px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.1vw, 1.42rem);
  line-height: 1.5;
  text-wrap: pretty;
}

.lead em:first-of-type {
  color: var(--orange);
}

.lead em {
  color: var(--blue);
}

.hero-bio {
  max-width: 42rem;
  margin-top: 18px;
}

.hero-bio p + p {
  margin-top: 0.8em;
}

.hero .btn-row {
  margin-top: 30px;
}

.portrait {
  width: 100%;
  aspect-ratio: 5 / 7;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* ---------- Bands with a left rail ---------- */

.band {
  padding: 68px 0;
  border-top: 1px solid var(--line);
}

.rail-grid {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 20px 52px;
}

.rail h2 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-wrap: balance;
}

.rail-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* ---------- Inner page heading ---------- */

.page-head {
  padding: 64px 0 52px;
}

.page-head h1 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.page-lead {
  max-width: 44rem;
  margin-top: 14px;
  color: var(--muted);
}

/* ---------- Project cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 24px 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--muted);
  transform: translateY(-2px);
}

.card-name {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.card-name a {
  color: var(--ink);
  text-decoration: none;
}

/* The whole card is the link. */
.card-name a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
}

.card-title {
  margin-top: 6px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
  text-wrap: pretty;
}

.card-summary {
  margin-top: 12px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: auto;
  font-size: 0.92rem;
  font-weight: 600;
}

.card-go {
  color: var(--blue);
}

.card-link {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-weight: 500;
}

/* ---------- Publications ---------- */

.pubs > li + li {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.pub-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.pub-topic {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.pub-title {
  margin-top: 10px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.36rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.25;
  text-wrap: pretty;
}

.pub-title a {
  color: inherit;
  text-decoration: none;
}

.pub-title a:hover {
  color: var(--blue);
}

.pub-authors {
  margin-top: 8px;
  font-size: 0.96rem;
}

.pub-footnote {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.pub-venue {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.96rem;
}

.pub-venue-name {
  color: var(--text);
}

.pub-highlight {
  margin-left: 6px;
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pub-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.pub-panel {
  position: relative;
  margin-top: 14px;
  padding: 16px 18px;
  background: var(--soft);
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.pub-bibtex pre {
  margin: 0;
  padding-right: 64px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
}

.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.copy:hover {
  border-color: var(--muted);
}

.pub-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding-bottom: 36px;
}

.pub-filter[hidden] {
  display: none;
}

#pub-search {
  flex: 1 1 260px;
  max-width: 340px;
  padding: 9px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
}

#pub-search::placeholder {
  color: var(--muted);
}

.pub-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.year-group {
  padding: 48px 0;
}

.year-group .rail h2 {
  position: sticky;
  top: 84px;
  color: var(--muted);
}

.pub-empty {
  padding: 24px 0 72px;
  color: var(--muted);
}

/* ---------- Label + content rows (projects, teaching, services, awards) ---------- */

.entries > .entry {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 6px 28px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.entries > .entry:first-child {
  padding-top: 4px;
  border-top: 0;
}

.entries > .entry:last-child {
  padding-bottom: 0;
}

.entry-label {
  padding-top: 2px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.entry-title {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.4;
}

.entry-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.95rem;
}

.points {
  margin-top: 8px;
  padding-left: 1.1em;
  list-style: disc;
  font-size: 0.98rem;
}

.points li + li {
  margin-top: 4px;
}

.points li::marker {
  color: var(--muted);
}

.plain li + li {
  margin-top: 4px;
}

/* ---------- Project pages (content/pages/*.html) ---------- */

.project-hero {
  padding: 68px 0 64px;
}

.project-hero h1 {
  max-width: 22ch;
  margin-top: 18px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
}

.project-authors {
  margin-top: 28px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 500;
}

.project-affil {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.95rem;
}

.project-hero .lead {
  max-width: 50rem;
}

.project-hero .btn-row {
  margin-top: 30px;
}

.crumb {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.crumb a {
  color: inherit;
}

.rail-body > * + * {
  margin-top: 1.1em;
}

.rail-body > h3 {
  margin-top: 1.9em;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 600;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat {
  padding: 20px 22px;
  background: var(--soft);
  border-radius: 12px;
}

.stat b {
  display: block;
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.stat span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.step {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.step-kicker {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.step:first-child .step-kicker {
  color: var(--orange);
}

.step h3 {
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 500;
  line-height: 1.2;
}

.step p {
  margin-top: 10px;
  font-size: 0.98rem;
}

.fig {
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.fig img {
  margin-inline: auto;
}

.fig-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

figcaption,
.caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.fig figcaption {
  color: #5b6676; /* the figure panel stays white in both themes */
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 10px 16px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  background: var(--soft);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
}

tbody tr + tr td {
  border-top: 1px solid var(--line);
}

tr.ours td {
  background: var(--blue-soft);
  color: var(--ink);
  font-weight: 600;
}

.codeblock {
  position: relative;
  padding: 18px 20px;
  background: var(--soft);
  border-radius: 12px;
}

.codeblock pre {
  margin: 0;
  padding-right: 60px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
}

var {
  font-family: var(--serif);
  font-size: 1.08em;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 24px;
  padding-block: 28px;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  .rail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .year-group .rail h2 {
    position: static;
  }

  .band {
    padding: 52px 0;
  }

  .year-group {
    padding: 40px 0;
  }

  .stats,
  .steps,
  .fig-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .site-header-inner {
    flex-wrap: wrap;
    padding-top: 10px;
  }

  .site-nav {
    order: 3;
    width: 100%;
    gap: 22px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav a {
    padding: 8px 0 10px;
    white-space: nowrap;
  }

  .hero {
    padding: 44px 0 52px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .portrait {
    order: -1;
    width: 128px;
  }

  .cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .entries > .entry {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-head {
    padding: 44px 0 36px;
  }

  .project-hero {
    padding: 44px 0 48px;
  }
}

@media print {
  .site-header,
  .site-footer,
  .pub-filter,
  .pub-actions {
    display: none;
  }
}
