@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600&display=swap");
/* yiqingxu.org: one column, rows of figure + text, after Jon Barron's layout; the lighter
   spacing, font and pale bands after margaretroberts.net. Figures sit in square boxes.
   Colors: stone blue titles, lighter stone blue links, pale stone-blue bands. */
:root {
  --ink: #3d4950;
  --muted: #7a868c;
  --band: #eef5f8;
  --bar: #ffffff;
  --title: #0b4f6c;
  --link: #1685a9;
  --wash: #e4f1f7;
  --mat: #e5eef2;   /* the square behind each figure: a shade darker than the bands */
  --line: rgba(11, 79, 108, .10);
  --thumb: 240px;   /* one size at every width above phones (Yiqing, 10-31) */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0 auto;
  max-width: 1080px;
  padding: 0 20px 40px;
  background: #fff;
  color: var(--ink);
  font: 15px/1.7 "Open Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
main { display: block; }

/* the top bar stays on screen while scrolling; its white and its rule run the full window width */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--bar); box-shadow: 0 0 0 100vmax var(--bar); clip-path: inset(0 -100vmax); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; border-image: conic-gradient(var(--line) 0 0) fill 0 / / 0 100vmax; }  /* outset paints past the edges without widening the page */
.brand { color: var(--title); font-size: 19px; font-weight: 400; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { text-align: right; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nav a { color: var(--muted); margin: 0 0 0 22px; white-space: nowrap; display: inline-block; padding: 14px 0 12px; border-top: 2px solid transparent; }
.nav a.on { color: var(--link); border-top-color: var(--link); }
.nav a:hover { text-decoration: none; color: var(--title); }

.hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; align-items: center; margin: 0; padding: 48px 0; background: var(--band); box-shadow: 0 0 0 100vmax var(--band); clip-path: inset(0 -100vmax); }
.hero .intro { order: 2; font-size: 16px; }
.hero h1 { text-align: left; font-weight: 300; font-size: 38px; color: var(--title); margin: 0 0 14px; }
.hero h1 .zh { font-size: 22px; color: var(--muted); margin-left: 6px; }
.hero p { margin: 0 0 12px; }
.contact { color: var(--muted); font-size: 14px; }
/* English / 中文 switch for the intro only */
.langswitch { margin: 0 0 10px; display: flex; gap: 4px; }
.langswitch button { font: inherit; font-size: 12.5px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.langswitch button[aria-pressed="true"] { background: #fff; color: var(--title); border-color: rgba(11, 79, 108, .25); font-weight: 600; }
.intro-zh p { line-height: 1.85; }
/* both intros share one grid cell; the one not shown keeps its space, so the section height and the
   portrait's position stay the same when switching languages (Yiqing, 10-31) */
.intro-stack { display: grid; }
.intro-stack > div { grid-area: 1 / 1; }
.intro-stack > .off { visibility: hidden; }
.portrait { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; }

h1.pagehead { font-weight: 300; font-size: 34px; color: var(--title); margin: 32px 0 6px; }
h2 { font-weight: 300; font-size: 28px; color: var(--title); text-align: center; margin: 56px 0 6px; }
h2::after { content: ""; display: block; width: 36px; height: 2px; background: var(--link); margin: 10px auto 0; }
.lede { color: var(--muted); margin: 0 0 18px; text-align: center; }
.teach-intro { max-width: 640px; margin: 0 auto 8px; }
.teach-intro p { margin: 0; display: inline; }
.filters { margin: 8px 0 24px; color: var(--muted); }
.searchbar { display: flex; align-items: center; gap: 12px; max-width: 560px; margin: 0 auto 14px; }
.searchbar input { flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--ink); padding: 9px 14px; border: 1px solid #c9d6dc;
  border-radius: 20px; background: #fff; outline: none; }
.searchbar input:focus { border-color: var(--link); box-shadow: 0 0 0 3px rgba(22, 133, 169, .15); }
.search-count { color: var(--muted); font-size: 13px; white-space: nowrap; }
/* Open science: replication pages in two columns (one on phones) */
.replist { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 40px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.rephead { color: var(--title); font-size: 19px; margin: 0 0 6px; }
.replist .rephead { grid-column: 1 / -1; }
#open-science > .rephead { margin-top: 18px; }
.replist h3 { color: var(--title); font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.replist li { margin-bottom: 6px; }
.replist .venue { color: var(--muted); font-size: 13.5px; margin-left: 4px; }
@media (max-width: 640px) { .replist { grid-template-columns: 1fr; } }
h1.pagehead + .searchbar { margin-top: 4px; margin-bottom: 26px; }
.filters a.on { color: var(--title); font-weight: 600; }
.pinbar { position: fixed; left: 0; right: 0; top: var(--pin-top, 48px); z-index: 19; background: var(--bar); border-bottom: 1px solid var(--line); box-shadow: 0 2px 6px rgba(11, 79, 108, .06); }
.pin-inner { max-width: 1080px; margin: 0 auto; padding-block: 6px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; font-size: 13.5px; color: var(--muted); }
.pin-filters a.on { color: var(--title); font-weight: 600; }
.pin-jump { display: flex; gap: 14px; padding-left: 22px; border-left: 1px solid var(--line); }
.pin-jump a { color: var(--muted); }
.pin-jump a.on { color: var(--link); font-weight: 600; }
.pin-search { margin-left: auto; flex: 0 1 220px; min-width: 0; font: inherit; font-size: 13.5px; color: var(--ink); padding: 4px 12px; border: 1px solid #c9d6dc; border-radius: 999px; background: #fff; outline: none; }
.pin-search:focus { border-color: var(--link); box-shadow: 0 0 0 3px rgba(22, 133, 169, .15); }
.pin-more { display: none; font: inherit; font-size: 13px; padding: 3px 12px; border: 1px solid #c9d6dc; border-radius: 999px; background: transparent; color: var(--link); cursor: pointer; }
@media (max-width: 640px) {
  .pin-inner { gap: 6px 12px; }
  .pin-more { display: inline-block; }
  .pin-search { flex: 1 1 0; margin-left: 0; }
  .pin-filters, .pin-jump { display: none; width: 100%; }
  .pinbar.open .pin-filters { display: block; order: 3; }
  .pinbar.open .pin-jump { display: flex; order: 4; padding-left: 0; border-left: 0; }
}

/* sections alternate white and pale stone blue, full window width */
section.band { padding: 44px 0 36px; }
section.band:nth-of-type(even) { background: var(--band); box-shadow: 0 0 0 100vmax var(--band); clip-path: inset(0 -100vmax); }
section.band > h2:first-child { margin-top: 0; }
section.band[hidden] { display: none; }

.row { display: grid; grid-template-columns: var(--thumb) minmax(0, 1fr); gap: 32px; padding: 26px 0; align-items: center; border-top: 1px solid var(--line); }
.lede + .row, h2 + .row { border-top: 0; }
.row.small { --thumb: 180px; }
.row[hidden] { display: none; }
.thumb { width: var(--thumb); max-width: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: var(--mat); padding: 8px; overflow: hidden; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tile { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 10px; text-align: center; background: var(--wash); color: var(--title); font-size: 14px; }
.ptitle { color: var(--title); font-weight: 600; font-size: 16.5px; line-height: 1.45; }
.links { font-size: 13.5px; }
.venue { color: var(--muted); }
a.ptitle:hover { text-decoration: underline; }
.authors b { font-weight: 600; }
.summary { margin: 6px 0 0; }
.summary .abs-toggle { font-size: 13.5px; white-space: nowrap; margin-left: 2px; }  /* the abstract opens from the end of the short description */
.notes { margin: 4px 0 0; font-size: 14px; font-style: italic; color: var(--muted); }
.desc { margin: 2px 0 4px; }
.desc p { margin: 0 0 6px; }
.abstract { margin-top: 8px; padding-left: 12px; border-left: 3px solid var(--wash); color: #3b464d; font-size: 14px; }
.row > .abstract { grid-column: 1 / -1; margin-top: -12px; }  /* full width under the figure and text, so the figure never moves */
.abstract p { margin: 0 0 8px; }
.earlier { margin: 10px 0 8px; padding: 10px 14px; background: var(--band); border-radius: 6px; }
.earlier p { margin: 0; }

ul.plain { padding-left: 18px; margin: 6px 0; }
ul.plain li { margin: 4px 0; }
.honors { font-size: 14px; }
.prose p, .prose li { margin: 0 0 8px; }
.prose img { max-width: 100%; height: auto; }
.prose pre { position: relative; margin: 6px 0 8px; padding: 8px 44px 8px 12px; background: var(--mat); border-radius: 4px; overflow-x: auto; font-size: 13.5px; }
.prose li > p { margin: 0 0 6px; }
.copybtn { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: flex; padding: 5px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.copybtn:hover, .copybtn:focus-visible { color: var(--link); background: rgba(22, 133, 169, 0.1); }
.prose.narrow { max-width: 760px; margin: 0 auto; }
.prose h2 { font-size: 20px; }
.course h2 { font-size: 22px; }
.zhpage { font-size: 15.5px; }
.zhpage .lede { font-size: 16px; }

footer { margin-top: 0; padding: 20px 0; font-size: 12.5px; color: var(--muted); text-align: center; background: var(--band); box-shadow: 0 0 0 100vmax var(--band); clip-path: inset(0 -100vmax); }

.draftbar { background: #fff7e0; border: 1px solid #f0dca0; padding: 6px 10px; font-size: 13px; margin: 12px 0; }

/* floating menu button, bottom right: sections on this page, the pages, back to top */
.fab { position: fixed; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 30; }
.fab-btn { width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--title); box-shadow: 0 3px 10px rgba(0, 0, 0, .22); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; }
.fab-btn span { display: block; width: 18px; height: 2px; border-radius: 1px; background: #fff; transition: transform .2s, opacity .2s; }
.fab.open .fab-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.fab.open .fab-btn span:nth-child(2) { opacity: 0; }
.fab.open .fab-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.fab-panel { position: absolute; right: 0; bottom: 60px; width: 260px; max-height: 70vh; overflow-y: auto; padding: 8px 0; background: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); font-size: 14.5px; }
.fab-panel a { display: block; padding: 7px 18px; color: var(--ink); }
.fab-panel a:hover { background: var(--band); text-decoration: none; }
.fab-panel a.on { color: var(--link); font-weight: 600; }
.fab-head { padding: 8px 18px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fab-pages { display: grid; grid-template-columns: 1fr 1fr; }
.fab-pages a { padding: 6px 18px; }
.fab-sections:not(:empty) { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; }
.fab-panel a.fab-top { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; color: var(--link); }
.draft { font-size: 11px; color: #8a6d00; background: #fff7e0; border: 1px solid #f0dca0; border-radius: 4px; padding: 0 4px; font-style: normal; }

/* phones: figure and text stay side by side, the figure taking about 40% of the width */
@media (max-width: 640px) {
  body { padding: 0 16px 32px; font-size: 14px; }
  section.band { padding: 32px 0 24px; }
  h1.pagehead { font-size: 28px; margin-top: 24px; }
  .hero { grid-template-columns: 1fr; gap: 14px; padding: 28px 0; }
  .hero h1 { text-align: center; font-size: 30px; }
  .langswitch { justify-content: center; }
  .hero .intro { font-size: 15px; }
  .portrait { order: -1; justify-self: center; width: 140px; height: 140px; }
  h2 { font-size: 24px; margin-top: 32px; }
  .row { align-items: start; padding: 18px 0; }
  .thumb { padding: 3px; }
  .row, .row.small { grid-template-columns: 40% minmax(0, 1fr); gap: 12px; --thumb: 100%; padding: 14px 0; }
  .ptitle { font-size: 14.5px; }
  .notes, .abstract { font-size: 13px; }
  .row > .abstract { margin-top: 0; }
  /* name and the four tabs on one line */
  .topbar { gap: 10px; }
  .brand { display: none; }  /* Home is in the menu */
  .nav { flex: 1; min-width: 0; text-align: left; white-space: nowrap; font-size: 11px; letter-spacing: .02em; overflow-x: auto; scrollbar-width: none; }  /* scrolls only below ~340px */
  .nav::-webkit-scrollbar { display: none; }
  .nav a { margin: 0 14px 0 0; padding: 12px 0 10px; }
}

/* comparison tables in prose (e.g. Software's method guide): ruled, numbers and checks centered */
.prose table { border-collapse: collapse; width: 100%; margin: 18px 0; font-size: 14.5px; }
.prose th, .prose td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
.prose thead th { color: var(--title); font-weight: 600; border-bottom: 2px solid var(--title); white-space: nowrap; }
.prose tbody tr:last-child td { border-bottom: 2px solid var(--title); }
.prose td:not(:first-child) { color: var(--title); font-size: 15px; }
@media (max-width: 640px) { .prose table { font-size: 12.5px; } .prose th, .prose td { padding: 5px 4px; } }

/* click a figure to see it large (js/site.js) */
img.zoomable { cursor: zoom-in; }
.zoom { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: rgba(238, 245, 248, .96); cursor: zoom-out; }
.zoom img { display: block; max-width: 94vw; max-height: calc(100vh - 90px); object-fit: contain; background: #fff; border-radius: 6px; box-shadow: 0 6px 30px rgba(11, 79, 108, .18); }
.zoom-cap { max-width: min(94vw, 760px); text-align: center; color: var(--title); font-size: 14px; line-height: 1.5; }
.zoom-x { position: absolute; top: max(10px, env(safe-area-inset-top, 0px)); right: max(14px, env(safe-area-inset-right, 0px)); border: 0; background: none; color: var(--title); font-size: 34px; line-height: 1; cursor: pointer; padding: 4px 8px; }

/* logos sit small inside the box; figures fill it */
.thumb img[src*="logo"] { max-width: 50%; max-height: 50%; }

/* local editing (build.py --edit, serve.py): a pencil opens the source file in VS Code */
a.edit { font-size: 14px; font-weight: 400; color: var(--link); opacity: .7; margin-left: 4px; text-decoration: none; }
a.edit:hover { opacity: 1; color: var(--link); }
.editnote { font-size: 13px; color: var(--muted); }
.builderror { position: fixed; left: 0; right: 0; top: 0; z-index: 50; margin: 0; padding: 10px 16px; background: #fff0f0; color: #8a1c1c; border-bottom: 1px solid #e8b4b4; font-size: 13px; white-space: pre-wrap; }
