/* Ying Liu — site styles
   One stylesheet for every page. Colors are defined once as tokens below. */

:root {
  --ink: #1f1d24;
  --muted: #625e6b;
  --paper: #ffffff;
  --wash: #f5f4f8;
  --rule: #dedbe5;
  --violet: #5e449c;      /* the name + links; deepened from the original #674ea7 for contrast */
  --violet-soft: #ece7f6;
  --forest: #2b4a1c;      /* carried over from the Google Sites theme */

  --serif: "EB Garamond", Garamond, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --measure: 100%;  /* text fills the page width (64rem max) */
  --page: 64rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ecebef;
    --muted: #a9a5b2;
    --paper: #17161b;
    --wash: #201f26;
    --rule: #34323c;
    --violet: #b9a6ec;
    --violet-soft: #2b2540;
    --forest: #9cc486;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 118.75%; /* 19px — Garamond sets small, so the base runs larger */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.6;
  font-feature-settings: "kern", "liga", "onum";
}

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

a {
  color: var(--violet);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--violet); color: var(--paper); padding: .5rem 1rem; z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Header ---------- */

.site-header {
  border-top: 5px solid var(--forest);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
}
.wordmark {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--violet);
  text-decoration: none;
  letter-spacing: .005em;
  white-space: nowrap;
}
.wordmark span { color: var(--muted); font-weight: 400; font-size: .8em; margin-left: .3em; }

.site-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .25rem 1.4rem;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  padding: .15rem 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { color: var(--forest); border-bottom-color: var(--forest); font-weight: 600; }

/* ---------- Page body ---------- */

main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.page-title {
  font-size: 2.6rem;
  font-weight: 500;
  line-height: 1.1;
  margin: 0 0 2.25rem;
  letter-spacing: -.01em;
}

h2 {
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
  margin: 3.25rem 0 1rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--rule);
  max-width: var(--measure);
}
h2:first-of-type { margin-top: 0; }

h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--forest);
  margin: 2rem 0 .6rem;
}

p, .prose { max-width: var(--measure); }

/* Body text size on every page (20% larger than the base) */
main p, .pubs li, .course dl, .roles li, .journals li { font-size: 1.2rem; }
main p.note, main p.where { font-size: 1rem; }
.note { color: var(--muted); font-size: .92rem; margin: -.2rem 0 1rem; }

/* ---------- Home ---------- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
  gap: 2.75rem;
  align-items: stretch;   /* photo column grows to the height of the text */
}
.portrait {
  margin: 0;
  position: relative;
  min-height: 18rem;
  background: var(--violet-soft);
  border-radius: 3px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 70% 30%; }
.portrait .monogram { font-size: 4rem; color: var(--violet); opacity: .55; }

.name {
  font-size: clamp(2.1rem, 4vw, 2.7rem);
  font-weight: 500;
  line-height: 1.1;
  color: var(--violet);
  margin: 0 0 1.6rem;   /* one blank line before the text */
  letter-spacing: -.015em;
}
.role { margin: 0 0 1.75rem; color: var(--muted); font-size: 1.05rem; line-height: 1.45; }
.intro p { margin: 0 0 1rem; hyphens: auto; }
.intro p:last-child { margin-bottom: 0; }


/* ---------- Publications ---------- */

.pubs {
  max-width: var(--measure);
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: none;
}
.pubs li {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0 .5rem;
  margin: 0 0 1.15rem;
}
.pubs li::before {
  content: attr(data-n) ".";
  color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
  text-align: right;
}
.pubs .me { font-weight: 600; }
.pubs .meta { display: block; color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.status {
  display: inline-block;
  font-size: .85rem;
  color: var(--forest);
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 0 .4rem;
  line-height: 1.5;
  margin-top: .2rem;
}

/* ---------- Teaching ---------- */

.course {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: .25rem 1.5rem;
  margin: 0 0 2rem;
}
.course .term { color: var(--muted); font-variant-numeric: lining-nums; padding-top: .15rem; font-size: 1.2rem; }
.course h4 { margin: 0; font-size: 1.3rem; font-weight: 600; }
.course .where { margin: .1rem 0 .6rem; color: var(--muted); font-size: .95rem; }
.course dl {
  margin: 0;
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: .3rem 1rem;
  font-size: .97rem;
}
.course dt { color: var(--muted); }
.course dd { margin: 0; }
.course dd ul { margin: 0; padding-left: 1.1rem; }
.course dd li { margin-bottom: .2rem; }
.score { font-variant-numeric: lining-nums tabular-nums; }
.nw { white-space: nowrap; }
.perm { display: block; color: var(--muted); font-size: .88rem; margin-top: .2rem; }

.roles { list-style: none; padding: 0; margin: 0; max-width: var(--measure); }
.roles li { margin-bottom: .7rem; padding-left: 1rem; text-indent: -1rem; }
.roles .yrs { color: var(--muted); white-space: nowrap; }

.journals {
  list-style: none; padding: 0; margin: 0;
  columns: 2 18rem; column-gap: 2rem;
  max-width: var(--measure);
}
.journals li { break-inside: avoid; margin-bottom: .35rem; }
.journals .ab { color: var(--muted); font-size: .9rem; }
.journals abbr { text-decoration: none; }

/* ---------- CV ---------- */

.cv-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0 0 1.75rem; }
.button {
  display: inline-block;
  padding: .45rem 1.1rem;
  border: 1px solid var(--violet);
  border-radius: 3px;
  text-decoration: none;
  font-size: 1rem;
}
.button.primary { background: var(--violet); color: var(--paper); }
.button:hover { text-decoration: none; filter: brightness(1.08); }
.cv-frame {
  width: 100%;
  height: 80vh;
  min-height: 32rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--wash);
}

/* ---------- Life ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 2rem 1.5rem;
  margin-top: 3rem;
}
.gallery figure { margin: 0; }
.gallery .frame {
  aspect-ratio: 4 / 3;
  background: var(--wash);
  border-radius: 3px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery .missing-note { color: var(--muted); font-size: .85rem; padding: 1rem; text-align: center; }
.gallery figcaption { margin-top: .5rem; font-size: 1rem; }
.gallery figcaption .yr { color: var(--muted); font-variant-numeric: lining-nums; }

/* ---------- Footer ---------- */

.site-footer { background: var(--wash); border-top: 1px solid var(--rule); }
.site-footer .wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2rem 1.5rem 2.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  font-size: .95rem;
}
.site-footer address { font-style: normal; line-height: 1.5; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; }

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

@media (max-width: 44rem) {
  html { font-size: 112.5%; }
  main { padding-top: 2rem; }
  .page-title { font-size: 2.1rem; }
  .intro { grid-template-columns: 1fr; gap: 1.75rem; }
  .portrait { max-width: 9rem; min-height: 0; aspect-ratio: 4 / 5; }
  .course dl { grid-template-columns: 1fr; gap: 0; }
  .course dd { margin-bottom: .55rem; }
  .course { grid-template-columns: 1fr; }
  .course .term { font-weight: 600; color: var(--forest); }
}

@media print {
  .site-header, .site-footer, .skip { display: none; }
  a { color: inherit; }
}
