/* ==========================================================================
   Bowen Feng — personal site
   Layout and look adapted from Jon Barron's academic homepage template
   (https://github.com/jonbarron/jonbarron_website), rewritten without tables.
   One stylesheet for every page. No framework, no build step.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --heading: #000000;
  --text-muted: #666666;
  --border: #e3e3e3;
  --link: #1772d0;
  --link-hover: #f09228;
  --highlight: #f1f6fd;
  --tag-bg: #eaf2fb;
  --tag-text: #1d5fa3;
  --thumb-bg: #f2f2f2;
  --font: "Lato", Verdana, Helvetica, sans-serif;
  --maxw: 800px;
  color-scheme: light;
}

/* Dark mode: same structure, every colour via the variables above. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141619;
    --text: #dcdfe3;
    --heading: #f3f4f6;
    --text-muted: #9aa1aa;
    --border: #2d3138;
    --link: #5aa9f0;
    --link-hover: #f5a54a;
    --highlight: #16212e;
    --tag-bg: #1d2a38;
    --tag-text: #8cc2f5;
    --thumb-bg: #1f2227;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

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

a { color: var(--link); text-decoration: none; }
a:hover, a:focus { color: var(--link-hover); }
a:focus-visible { outline: 2px solid var(--link-hover); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 { font-weight: 400; line-height: 1.3; color: var(--heading); }
h3 { font-size: 18px; margin: 1.6rem 0 0.5rem; }
h4 { font-size: 15px; margin: 1.2rem 0 0.4rem; font-weight: 700; }
p { margin: 0 0 1em; }
ul { padding-left: 1.3em; margin: 0 0 1em; }
li { margin: 0.15em 0; }
strong { font-weight: 700; }
sup { line-height: 0; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--bg); padding: 0.4em 0.8em; z-index: 10; }
.skip-link:focus { left: 1em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- small top nav (secondary pages) ---------- */
.site-nav { padding: 20px 0 0; font-size: 14px; }
.site-nav .container { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; }
.site-nav .brand { font-size: 16px; color: var(--heading); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.site-nav li { margin: 0; }
.site-nav li + li::before { content: "/"; color: var(--text-muted); margin: 0 0.5em; }
.site-nav a[aria-current="page"] { color: var(--heading); }

/* ---------- intro: name / bio / links | photo ---------- */
.intro {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 40px;
  align-items: center;
  padding: 40px 0 8px;
}
.name { text-align: center; font-size: 32px; font-weight: 400; margin: 0 0 18px; letter-spacing: 0.2px; }
.intro-text p { margin-bottom: 0.85em; }
.intro-photo img {
  width: 200px; height: auto; border-radius: 8px;
  box-shadow: 0 0 0 1px var(--border);
}

/* " / "-separated inline link lists */
.slash-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; row-gap: 4px; }
.slash-list li { margin: 0; display: inline-flex; align-items: center; }
.slash-list li + li::before { content: "/"; color: var(--text-muted); margin: 0 0.55em; }
.slash-list a { display: inline-flex; align-items: center; gap: 5px; }
.slash-list svg { width: 14px; height: 14px; fill: currentColor; flex: none; }

/* ---------- headed sections ---------- */
.section-title { font-size: 22px; margin: 40px 0 12px; }.lead { margin: 0; }

.news { list-style: none; padding: 0; margin: 0; }
.news li { display: grid; grid-template-columns: 72px 1fr; gap: 12px; margin: 4px 0; }
.news .date { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- publication / project rows ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: center;
  margin: 0 -12px;
  padding: 16px 12px;
  border-radius: 8px;
}
.row.featured { background: var(--highlight); }
.row.featured + .row.featured { margin-top: 10px; }

/* fixed thumbnail box; still image on top, hover video underneath */
.thumb {
  position: relative;
  width: 200px;
  aspect-ratio: 10 / 7;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--thumb-bg);
}
.thumb img, .thumb video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
/* Wide teasers (e.g. EpicWM) show the whole frame, letterboxed on the teaser's own background. */
.thumb.contain { background: #e6e6e3; }
.thumb.contain img, .thumb.contain video { object-fit: contain; }
.thumb img { z-index: 1; transition: opacity 0.2s ease; }
.thumb.playing img { opacity: 0; }

.papertitle { font-weight: 700; font-size: 16px; line-height: 1.35; }
.row-body > * { display: block; }
.row-body .authors { margin-top: 4px; }
.venue { margin-top: 2px; }
.venue em { font-style: italic; }
.tag {
  display: inline-block;
  font-size: 12px; font-weight: 700; font-style: normal;
  line-height: 1.6;
  padding: 0 7px; margin-right: 6px;
  border-radius: 999px;
  background: var(--tag-bg); color: var(--tag-text);
  vertical-align: 1px;
}
.links { margin-top: 3px; }
.links a + a::before, .links a + details::before, .links details + a::before { content: "\00a0/\00a0"; color: var(--text-muted); }
.row-body p { margin: 8px 0 0; }
.note { font-size: 13px; color: var(--text-muted); }
.section-sub { margin: -6px 0 14px; }

/* optional bibtex disclosure (no JS) */
.links details { display: inline; }
.links summary { display: inline; cursor: pointer; color: var(--link); list-style: none; }
.links summary::-webkit-details-marker { display: none; }
.links summary:hover { color: var(--link-hover); }
.links details[open] pre { display: block; }
.bibtex {
  font-size: 12px; line-height: 1.45;
  background: var(--thumb-bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; margin: 8px 0 0;
  overflow-x: auto; white-space: pre;
}

.more { margin: 12px 0 0; }

/* ---------- project detail pages ---------- */
.article-wrap { max-width: 760px; margin: 0 auto; }
.back-link { display: inline-block; margin: 28px 0 4px; font-size: 14px; }
.page-header h1 { font-size: 28px; margin: 8px 0 8px; }
.meta { color: var(--text-muted); margin: 0 0 6px; }
.meta strong { color: var(--heading); }
.btns { margin: 0 0 8px; display: flex; flex-wrap: wrap; }
.btns a + a::before { content: "\00a0/\00a0"; color: var(--text-muted); }
article h2 { font-size: 22px; margin: 40px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

figure { margin: 24px 0; text-align: center; }
figure img, figure video { margin: 0 auto; border-radius: 4px; background: #fff; }
figcaption { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.fig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: start; margin: 16px 0; }
.fig-grid figure { margin: 0; }
.embed { position: relative; width: 100%; max-width: 640px; margin: 0 auto; aspect-ratio: 4 / 3; background: #000; border-radius: 4px; overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- footer ---------- */
.site-footer { padding: 40px 0 32px; }
.site-footer p { text-align: right; font-size: 13px; color: var(--text-muted); margin: 2px 0; }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .intro { grid-template-columns: 1fr; gap: 16px; padding-top: 28px; }
  .intro-photo { order: -1; justify-self: center; }
  .intro-photo img { width: 170px; }
  .row { grid-template-columns: 1fr; gap: 12px; margin: 0 -8px; padding: 14px 8px; }
  .thumb { width: 100%; aspect-ratio: 16 / 9; }
  .page-header h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .thumb img { transition: none; }
}
