/* Zhanpei Fang — site styles. Colors and fonts are set once here. */

/* Fonts by Wei Huang: Pantasia (headings) and Work Sans (everything else, SIL Open Font License). */
@font-face {
  font-family: "Pantasia";
  src: url("../fonts/Pantasia-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("../fonts/WorkSans-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("../fonts/WorkSans-Italic-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --text: #111;
  --muted: rgba(0, 0, 0, .55);
  --rule: rgba(0, 0, 0, .15);
  --link: #db230d;
  --link-hover: #e9af5d;
  --bg: #fff;
  /* To change the size of all body text, edit "15px" in body below. */
  --sans: "Work Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Pantasia", "Work Sans", "Helvetica Neue", Arial, sans-serif;
  --nav-width: 220px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--sans);
}

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

/* ---------- menu (filled in by js/nav.js) ---------- */
#site-nav {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--nav-width);
  padding: 20px 16px 20px 20px;
  overflow-y: auto;
  font: 15px/1.5 var(--sans);
}
#site-nav .name { display: block; font: 400 24px/1.1 var(--display); color: var(--text); margin-bottom: 18px; }
#site-nav .group { margin-top: 14px; }
#site-nav .label { display: block; color: var(--muted); font-size: 13px; }
#site-nav a.item { display: block; color: var(--text); }
#site-nav a.item:hover { color: var(--link-hover); }
#site-nav a.item.current { color: var(--link); }
#site-nav .links { margin-top: 22px; font-size: 13px; }
#site-nav .links a { color: var(--muted); }
#site-nav .links a:hover { color: var(--link-hover); }

main {
  margin-left: var(--nav-width);
  padding: 20px 32px 80px 24px;
  max-width: calc(var(--nav-width) + 1100px);
}

/* ---------- text ---------- */
h1 { font: 400 32px/1.15 var(--display); margin: 0 0 24px; }
h2 { font: 400 22px/1.25 var(--display); margin: 0 0 12px; }
h3 { font: 400 18px/1.3 var(--display); margin: 24px 0 6px; }
h2 .year, h3 .year { font: 400 14px var(--sans); color: var(--muted); margin-left: 4px; }
.text, .prose { max-width: 680px; }
p { margin: 0 0 .8em; }
blockquote { margin: 0 0 1em 1.5em; font-style: italic; }
.credit, .meta { color: var(--muted); font-size: 14px; }
ul.plain { list-style: none; padding: 0; margin: 0 0 1em; }
ul.plain li { margin-bottom: .55em; }
.date { font: 13px/1.5 var(--sans); color: var(--muted); display: inline-block; min-width: 5.5em; }

section.project {
  border-top: 1px solid var(--rule);
  padding-top: 18px;
  margin-top: 40px;
}
h1 + section.project, h1 + .todo + section.project { margin-top: 0; }

/* ---------- images ---------- */
figure { margin: 0 0 48px; }
figure img {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
}
/* Small works (around 5 × 7 in): <figure class="small"> shows them at a more modest size. */
figure.small img { max-width: min(100%, 640px); max-height: 50vh; }
figcaption { margin-top: 8px; font: 15px/1.35 var(--sans); }
figcaption .medium { color: var(--muted); font-size: 13px; }

.video .embed { position: relative; width: 100%; max-width: 900px; aspect-ratio: 16 / 9; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- home page ---------- */
.home { display: grid; grid-template-columns: 7fr 5fr; gap: 40px; align-items: start; }
.home aside { position: sticky; top: 20px; }
.home .feed figure { margin-bottom: 40px; }
.news li { border-top: 1px solid var(--rule); padding: 6px 0; margin: 0; }
.news .date { display: block; }

/* ---------- research page ---------- */
.research section { border-top: 1px solid var(--rule); padding-top: 18px; margin-top: 40px; }
.research h1 + section { border-top: 0; padding-top: 0; margin-top: 0; }
.research figure img { max-height: 75vh; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Review notes: visible only until you delete them. deploy.sh refuses to publish while any remain. */
.todo {
  background: #fff6c2;
  border-left: 4px solid #e0b400;
  padding: 6px 10px;
  font: 14px/1.4 var(--sans);
  color: #333;
  max-width: 680px;
}
.todo::before { content: "TO REVIEW: "; font-weight: 700; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  #site-nav { position: static; width: auto; padding: 16px 16px 4px; }
  #site-nav .group { display: inline; margin: 0; }
  #site-nav .label { display: inline; margin: 0 6px 0 0; }
  #site-nav a.item { display: inline; margin-right: 10px; }
  #site-nav .links { margin-top: 10px; }
  main { margin-left: 0; padding: 16px 16px 60px; }
  .home, .pair { grid-template-columns: 1fr; }
  .home aside { position: static; order: -1; }
}
