/* =========================================================================
   Andrew Chang — personal site
   Minimalist plain-text academic style. System sans fonts, white background,
   classic underlined links. No JavaScript, no external dependencies.
   ========================================================================= */

:root {
  --bg:        #ffffff;
  --ink:       #1a1a1a;
  --muted:     #666666;
  --link:      #14509b;   /* classic academic blue */
  --link-hi:   #b03535;
  --rule:      #dddddd;
  --measure:   66rem;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", "SFMono-Regular", "Menlo", "Consolas",
               "DejaVu Sans Mono", "Courier New", monospace;
  font-size: 15.5px;
  line-height: 1.7;
}

.wrap {
  max-width: var(--measure);
  margin: 0;
  padding: 2.75rem 1.5rem 4rem;
}

/* ---------- Links -------------------------------------------------------- */
a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--link-hi); }

/* ---------- Masthead ----------------------------------------------------- */
.masthead {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.masthead .id { flex: 1 1 auto; }
.masthead h1 {
  margin: 0 0 0.2rem;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.15;
}
.masthead h1 .zh { font-weight: 500; margin-left: 0.4rem; }
.masthead .role { margin: 0; font-size: 1.02rem; }
.masthead .affil { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
.masthead .contact { margin: 0.6rem 0 0; font-size: 0.92rem; color: var(--muted); }
.masthead .contact a { color: var(--link); }
.masthead img {
  width: 128px;
  height: 128px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ---------- Bracketed anchor nav ---------------------------------------- */
.nav {
  margin: 1.4rem 0 2.4rem;
  font-size: 0.95rem;
  line-height: 2;
}
.nav a { text-decoration: none; white-space: nowrap; margin-right: 0.3rem; }
.nav a:hover { text-decoration: underline; }
.nav a::before { content: "["; color: var(--muted); }
.nav a::after  { content: "]"; color: var(--muted); }

/* ---------- Sections ----------------------------------------------------- */
section { margin: 0 0 2.4rem; }

h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.9rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}

p { margin: 0 0 0.85rem; }
section > p:last-child { margin-bottom: 0; }

ul { margin: 0 0 0.85rem; padding-left: 1.25rem; }
li { margin: 0.25rem 0; }

/* ---------- Experience / CV list ---------------------------------------- */
.cv { list-style: none; padding: 0; margin: 0; }
.cv li { display: flex; gap: 1rem; margin: 0.55rem 0; }
.cv .date {
  flex-shrink: 0;
  width: 6rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cv .sub { color: var(--muted); }

/* ---------- Publications ------------------------------------------------- */
.pub-group { margin: 1.1rem 0 1.4rem; }
.pub-group h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.7rem;
}
ol.pubs {
  margin: 0;
  padding-left: 1.9rem;
  font-size: 0.95rem;
}
ol.pubs li { margin: 0 0 0.7rem; line-height: 1.5; }
ol.pubs li::marker { color: var(--muted); }
.pub .title { font-weight: 600; }
.pub .venue { font-style: italic; }
.pub .me { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Blog / thoughts list ---------------------------------------- */
.postlist { list-style: none; padding: 0; margin: 0; }
.postlist li { display: flex; gap: 0.9rem; margin: 0.5rem 0; align-items: baseline; }
.postlist .date {
  flex-shrink: 0;
  width: 6.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

/* ---------- Blog post ---------------------------------------------------- */
.post-meta { color: var(--muted); font-size: 0.92rem; margin: 0 0 1.75rem; }
.post-body h2 { border: none; padding: 0; margin-top: 2rem; }
.post-body h3 { margin-top: 1.5rem; }
.post-body img { max-width: 100%; height: auto; }
.post-body pre {
  background: #f5f5f5;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  border-radius: 4px;
  font-size: 0.9rem;
}
.post-body code { font-size: 0.9em; }
.post-body blockquote {
  margin: 0 0 0.85rem;
  padding-left: 1rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
}
.backlink { display: inline-block; margin-bottom: 1.5rem; font-size: 0.92rem; }

/* ---------- Footer ------------------------------------------------------- */
footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem;
}
footer a { color: var(--link); }

/* ---------- Responsive --------------------------------------------------- */
@media (max-width: 34rem) {
  .wrap { padding: 2rem 1.15rem 3rem; }
  .masthead { flex-direction: column-reverse; align-items: flex-start; gap: 1rem; }
  .masthead img { width: 104px; height: 104px; }
  .cv li, .postlist li { flex-direction: column; gap: 0.1rem; }
  .cv .date, .postlist .date { width: auto; }
}
