/* ==========================================================================
   Lan Wei — personal homepage
   Typography, colours and layout follow the AcadHomepage / Minimal Mistakes
   look: Trebuchet MS 15px, #494e52 text on white, #224b8d links,
   190px left sidebar, 21px section headings with a light rule.
   ========================================================================== */

:root {
  --text: #494e52;
  --muted: #7a8288;
  --link: #224b8d;
  --link-hover: #0e2a55;
  --rule: #f2f3f3;
  --box-rule: #efefef;
  --code-bg: #fafafa;
  --badge: #00369f;
  --award: #c0392b;
  --font: "Trebuchet MS", Helvetica, sans-serif;
  --mono: Monaco, Consolas, "Lucida Console", monospace;
  --masthead-h: 54px;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html {
  font-size: 15px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--masthead-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

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

a { color: var(--link); text-decoration: underline; }
a:hover { color: var(--link-hover); }

strong, b { font-weight: 700; }

code {
  padding: 1.5px 0;
  font-family: var(--mono);
  font-size: .9em;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
code::before,
code::after {
  content: "\00a0";
  letter-spacing: -.2em;
}

.icon {
  width: 1.28em;
  height: 1em;
  margin-right: 4px;
  vertical-align: -.125em;
  fill: currentColor;
  flex: none;
}

/* ---------- Masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--masthead-h);
  background: #fff;
  border-bottom: 1px solid var(--rule);
}

.masthead__inner {
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 7.5px 7.5px;
  display: flex;
  align-items: center;
}

.masthead a {
  position: relative;
  display: block;
  padding: 7.5px 0;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.masthead a::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 4px;
  background: var(--muted);
  transform: scaleX(0);
  transition: transform .2s ease-in-out;
}
.masthead a:hover::before,
.masthead a.is-active::before { transform: scaleX(1); }
.masthead a.is-active::before { background: #d7dadc; }
.masthead a:hover { color: var(--muted); }

.masthead__home {
  margin-right: 30px;
  font-weight: 700;
}

.masthead__menu {
  display: flex;
  gap: 30px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.masthead__menu::-webkit-scrollbar { display: none; }

/* ---------- Layout ---------- */

#main {
  max-width: 1280px;
  margin: 15px auto 0;
  padding: 0 15px 3em;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  column-gap: 73px;
  align-items: start;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 90px;
  padding-top: 6px;
}

.author__avatar {
  display: block;
  width: 175px;
  height: 175px;
  padding: 5px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  object-fit: cover;
}

.author__name {
  margin: 10px 0 0;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 700;
}

.author__bio {
  margin: 10px 0 20px;
}

.author__urls {
  list-style: none;
  margin: 0;
  padding: 0;
}
.author__urls li {
  margin-bottom: 7.5px;
  white-space: nowrap;
}
.author__urls a {
  color: inherit;
  text-decoration: none;
}
.author__urls a:hover { text-decoration: underline; }
.author__urls .icon { color: #000; }

/* ---------- Content ---------- */

.page__content { min-width: 0; }

.page__content h1 {
  margin: 21px 0 10.5px;
  padding-bottom: 10.5px;
  font-size: 21px;
  line-height: 1.2;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: calc(var(--masthead-h) + 12px);
}
.page__content h1:first-child { margin-top: 0; }

.page__content h2 {
  margin: 18px 0 9px;
  font-size: 18px;
  line-height: 1.2;
}

.page__content h3 {
  margin: 1em 0 .5em;
  font-size: 15px;
  line-height: 1.2;
}

.page__content p { margin: 0 0 7.5px; }

.page__content ul {
  margin: 7.5px 0 15px;
  padding-left: 30px;
}
.page__content li { margin-bottom: 7.5px; }
.page__content li ul { margin: 7.5px 0 0; }

.page__content h1 .emoji { margin-right: .3em; }

.cite-badge { text-decoration: none; }
.cite-badge img {
  display: inline-block;
  height: 20px;
  vertical-align: -5px;
}

.award { color: var(--award); font-weight: 700; }

.updated {
  margin-top: 3em !important;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Paper boxes (selected publications) ---------- */

.paper-box {
  display: flex;
  flex-flow: wrap;
  justify-content: left;
  align-items: center;
  padding: 2em 0;
  border-bottom: 1px solid var(--box-rule);
}

.paper-box .paper-box-image {
  display: flex;
  justify-content: center;
  width: 100%;
  order: 2;
}
.paper-box .paper-box-image > div { position: relative; }
.paper-box .paper-box-image img {
  display: block;
  max-width: 400px;
  width: 100%;
  box-shadow: 3px 3px 6px #888;
  object-fit: cover;
}

.paper-box .paper-box-text {
  max-width: 100%;
  order: 1;
}
.paper-box .paper-box-text ul { margin-bottom: 7.5px; }

.badge {
  position: absolute;
  z-index: 1;
  margin-top: .5em;
  margin-left: -.5em;
  padding: 0 1rem;
  color: #fff;
  background: var(--badge);
  font-size: .8em;
}

@media (min-width: 48em) {
  .paper-box .paper-box-image {
    justify-content: left;
    min-width: 200px;
    max-width: 40%;
    order: 1;
  }
  .paper-box .paper-box-text {
    justify-content: left;
    padding-left: 2em;
    max-width: 60%;
    order: 2;
  }
}

/* ---------- Full publication list ---------- */

.filters { margin-top: 4px !important; }
.filter {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.filter:hover { color: var(--link-hover); }
.filter[aria-pressed="true"] {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  cursor: default;
}
.filter .count { font-weight: 400; color: var(--muted); }
.filter .count::before { content: " ("; }
.filter .count::after { content: ")"; }

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

.pub { scroll-margin-top: calc(var(--masthead-h) + 16px); }
.pub:target {
  background: #fff8d6;
  outline: 4px solid #fff8d6;
}

.pubs-empty { color: var(--muted); }

/* ---------- Small screens ---------- */

@media (max-width: 1024px) {
  #main { grid-template-columns: 170px minmax(0, 1fr); column-gap: 40px; }
  .author__avatar { width: 160px; height: 160px; }
}

@media (max-width: 800px) {
  .masthead__inner { padding: 7.5px 15px; }
  .masthead__home { margin-right: 20px; }
  .masthead__menu { gap: 20px; }

  #main {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 15px;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 75px minmax(0, 1fr);
    column-gap: 15px;
    align-items: center;
    padding: 0 0 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--rule);
  }
  .author__avatar { width: 75px; height: 75px; padding: 3px; }
  .author__name { margin-top: 0; font-size: 18px; }
  .author__bio { margin: 4px 0 0; }
  .author__urls {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 18px;
    margin-top: 12px;
  }
  .author__urls li { margin: 0; }
}

@media print {
  .masthead, .filters { display: none; }
  #main { display: block; }
  .sidebar { position: static; }
}
