/* Mutian Shen — personal site.
   One column, one typeface, one accent (cyan), light only. Colors are the tokens below. */

@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbfcfc;
  --text: #14181a;
  --muted: #5b656a;
  --line: rgba(20, 24, 26, 0.11);
  --tile: #f0f4f5;
  --accent: #0a7b99; /* link text */
  --cyan: #0891b2; /* marks and large type */
  --sel: #c8edf4;
  --max: 840px;
  --pad: clamp(20px, 6vw, 48px);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--sel);
}

h1,
h2,
h3,
p,
ul,
ol,
figure {
  margin: 0;
  padding: 0;
}
ul,
ol {
  list-style: none;
}
img,
video,
svg {
  display: block;
  max-width: 100%;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}
a:hover {
  text-decoration-line: underline;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  width: min(100% - 2 * var(--pad), var(--max));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
}
.skip:focus {
  top: 12px;
}

.arrow {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-left: 0.3em;
}
.arrow.down {
  transform: rotate(135deg);
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
}
.bar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.brand:hover {
  text-decoration: none;
}
.nav {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 0.875rem;
}
.nav a {
  color: var(--muted);
  transition: color 0.15s ease;
}
.nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* ---------- hero ---------- */

.hero {
  padding-top: clamp(36px, 6vw, 64px);
}
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--muted);
}
.status::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
}
.hero h1 {
  margin-top: 18px;
  font-size: clamp(1.9rem, 5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.16;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  color: var(--cyan);
}
.hero .about {
  margin-top: clamp(22px, 3.4vw, 30px);
}
.links {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 0.9375rem;
}

/* ---------- introduction: three paragraphs, portrait at the right ---------- */

.about {
  display: flex;
  align-items: flex-start;
  gap: clamp(24px, 4.5vw, 44px);
}
.about .prose {
  flex: 1 1 0;
  min-width: 0;
}
.portrait {
  flex: none;
  margin-top: 5px;
  width: clamp(168px, 27vw, 240px);
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 5px;
  background: var(--tile);
  box-shadow: 0 0 0 1px var(--line);
}

/* ---------- sections ---------- */

.section {
  position: relative;
  margin-top: clamp(44px, 7vw, 60px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.section::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  width: 24px;
  height: 2px;
  background: var(--cyan);
}
.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.4;
}
.note {
  font-size: 0.8125rem;
  color: var(--muted);
}

.prose {
  display: grid;
  gap: 0.9em;
  max-width: 41rem;
}
.prose p {
  text-wrap: pretty;
}
.nb {
  white-space: nowrap;
}

/* ---------- news ---------- */

.news {
  display: grid;
  gap: 9px;
  font-size: 0.9375rem;
}
.news li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 16px;
}
.news time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- research ---------- */

.papers {
  display: grid;
  gap: 30px;
  padding-top: 4px;
}
.papers:empty {
  display: none;
}
.paper {
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

.media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 5px;
  background: var(--tile);
}
.media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
  pointer-events: none;
}
a.media {
  cursor: zoom-in;
}
.media img,
.media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
a.media:hover img,
a.media:hover video {
  transform: scale(1.03);
}
.media.fit img {
  object-fit: contain;
  background: #fff;
}
.media.left img {
  object-position: left center;
}
.media.empty {
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: var(--muted);
}
.paper h3 {
  margin-top: -2px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.008em;
  text-wrap: balance;
}
.paper h3 a {
  color: inherit;
  transition: color 0.15s ease;
}
.paper h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}
.authors {
  margin-top: 5px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
}
.authors .me {
  color: var(--text);
  font-weight: 500;
}
.desc {
  margin-top: 8px;
  font-size: 0.9rem;
  line-height: 1.62;
  text-wrap: pretty;
}
.meta {
  margin-top: 8px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--muted);
}
.meta a {
  white-space: nowrap;
}
.sep {
  margin: 0 0.55em;
  opacity: 0.55;
}

/* ---------- experience, education ---------- */

.items {
  display: grid;
  gap: 22px;
}
.items.tight {
  gap: 15px;
}
.item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
}
.item h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.008em;
}
.when {
  flex: none;
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sub {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
}
.item .desc {
  margin-top: 6px;
  max-width: 41rem;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: clamp(52px, 8vw, 72px);
  padding: 22px 0 44px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.site-footer ul {
  display: flex;
  gap: 22px;
}

/* ---------- lightbox ---------- */

.lightbox {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}
.lightbox::backdrop {
  background: rgba(251, 252, 252, 0.97);
}
.lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.lb-bar {
  display: flex;
  justify-content: flex-end;
  padding: 12px clamp(14px, 3vw, 24px) 0;
}
.lb-close {
  padding: 8px 4px;
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.15s ease;
}
.lb-close:hover {
  color: var(--text);
}
.lb-stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 8px clamp(14px, 4vw, 48px);
}
.lb-stage img,
.lb-stage video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 24px 60px -36px rgba(20, 24, 26, 0.35);
}
.lb-stage video {
  width: min(100%, 1120px);
  background: #000;
}
.lb-cap {
  min-height: 3em;
  padding: 12px clamp(14px, 4vw, 48px) 20px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .nav a {
    display: none;
  }
  .about {
    flex-direction: column-reverse;
    gap: 18px;
  }
  .portrait {
    width: 200px;
  }
  .papers {
    gap: 34px;
  }
  .paper {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .paper .media.empty {
    display: none;
  }
  .paper h3 {
    margin-top: 0;
  }
  .item-top {
    flex-direction: column;
    gap: 0;
  }
  .news {
    gap: 14px;
  }
  .news li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .media img,
  .media video {
    transition: none;
  }
  a.media:hover img,
  a.media:hover video {
    transform: none;
  }
}

@media print {
  .site-header,
  .lightbox {
    display: none !important;
  }
}
