/* ============================================================
   youngmp.github.io — shared styles
   Minimal academic site. Serif body, sans labels, auto dark mode.
   ============================================================ */

:root {
  --bg: #ffffff;
  --ink: #1c1c1c;
  --muted: #6b6b66;
  --rule: #e4e2dc;
  --rule-soft: #efede8;
  --link: #35608f;
  --link-hover: #1e3f63;
  --chip-bg: #f4f2ec;
  --chip-ink: #55606b;

  --serif: Charter, "Bitstream Charter", Georgia, Cambria, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --ink: #d9d9d3;
    --muted: #8f8f88;
    --rule: #2c2f36;
    --rule-soft: #23262c;
    --link: #7fa8d4;
    --link-hover: #a9c6e6;
    --chip-bg: #23262c;
    --chip-ink: #a7b0ba;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}
.wrap.wide { max-width: 64rem; }

/* ---- Navigation ---- */
nav {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-bottom: 3rem;
}
nav a { color: var(--muted); text-decoration: none; }
nav a:hover, nav a:focus-visible { color: var(--link-hover); }
nav a[aria-current="page"] { color: var(--ink); }

/* ---- Links ---- */
a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover, a:focus-visible { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---- Headings ---- */
h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.25rem;
}
.role { margin: 0; color: var(--muted); }
.role a { color: inherit; }

h2 {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

p { margin: 0 0 1rem; }

/* ---- Page title block (interior pages) ---- */
.page-title {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 1.5rem;
}
.lede { color: var(--muted); margin-top: -0.5rem; }

/* ---- Section rules ---- */
section {
  border-top: 1px solid var(--rule);
  margin-top: 2.5rem;
  padding-top: 2rem;
}

/* ---- Home: intro grid ---- */
.intro {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 1.75rem;
  align-items: start;
  margin-top: 2rem;
}
figure { margin: 0; }
figure img { width: 100%; height: auto; border-radius: 3px; display: block; }
figcaption {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

ul { padding-left: 1.1rem; margin: 0.5rem 0 1.25rem; }
li { margin-bottom: 0.35rem; }

.bio img {
  float: left;
  width: min(38%, 220px);
  height: auto;
  border-radius: 3px;
  margin: 0.3rem 1.25rem 0.5rem 0;
}

/* ---- Interests: two-column definition cards (research) ---- */
.interests {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 0 0 1rem;
}
.interests .col-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
}
.interests ul { margin: 0; }

/* ---- Publications list ---- */
.pubs { list-style: none; padding: 0; margin: 0; counter-reset: pub; }
.pubs li {
  position: relative;
  padding-left: 2.25rem;
  margin-bottom: 1.1rem;
  line-height: 1.55;
}
.pubs li::before {
  counter-increment: pub;
  content: counter(pub);
  position: absolute;
  left: 0;
  top: 0.05em;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  width: 1.6rem;
  text-align: right;
}
.pubs .me { font-weight: 700; }
.pubs .venue { font-style: italic; }

/* Reference link chips: [ arXiv ] [ Code ] */
.refs { margin-left: 0.15rem; }
.refs a {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--chip-ink);
  background: var(--chip-bg);
  border-radius: 4px;
  padding: 0.08rem 0.4rem;
  margin: 0.15rem 0.25rem 0 0;
  white-space: nowrap;
}
.refs a:hover, .refs a:focus-visible {
  color: var(--bg);
  background: var(--link);
}

/* ---- Teaching table ---- */
.courses { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.courses th {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--rule);
}
.courses td {
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: baseline;
}
.courses tr.group td {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  padding-top: 1.4rem;
  border-bottom: 1px solid var(--rule);
}
.courses .kind { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.courses .evals a {
  font-family: var(--sans);
  font-size: 0.85rem;
  margin-right: 0.4rem;
  white-space: nowrap;
}
.courses .evals .lbl { color: var(--muted); }

/* ---- Gallery (art / students) ---- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 0 0 2rem;
}
.gallery a { display: block; line-height: 0; }
.gallery img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 3px;
  display: block;
  background: var(--rule-soft);
}
@media (prefers-reduced-motion: no-preference) {
  .gallery img { transition: opacity 150ms ease; }
  .gallery a:hover img { opacity: 0.85; }
}

/* ---- Masonry gallery (art) ---- */
/* Thumbnails are anchors so lightGallery can drive the zoom/lightbox. */
.masonry {
  column-width: 230px;
  column-gap: 0.85rem;
  margin: 0 0 1rem;
}
.masonry .tile {
  break-inside: avoid;
  display: block;
  margin: 0 0 0.85rem;
  line-height: 0;
  border-radius: 3px;
  overflow: hidden;
  cursor: zoom-in;
}
.masonry .tile img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--rule-soft);
}
@media (prefers-reduced-motion: no-preference) {
  .masonry .tile img { transition: opacity 150ms ease, transform 150ms ease; }
  .masonry .tile:hover img { opacity: 0.9; }
}
.masonry .tile:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

/* ---- Footer ---- */
footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1.5rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  a { transition: color 120ms ease, background-color 120ms ease; }
}

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .intro { grid-template-columns: 1fr; }
  .intro figure img { max-width: 220px; }
  .bio img { float: none; width: 100%; max-width: 220px; margin: 0 0 1rem; }
  .interests { grid-template-columns: 1fr; }
  .courses .kind { display: none; }
}
