/* Zhenmei Shi — personal site */
:root {
  --bg: #eef2f5;
  --bg-accent: #e3eaef;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #f7fafb;
  --ink: #182230;
  --ink-muted: #556172;
  --line: rgba(24, 34, 48, 0.10);
  --accent: #0d5c63;
  --accent-soft: #d5eaec;
  --accent-hover: #09464c;
  --shadow: 0 1px 2px rgba(24, 34, 48, 0.04), 0 12px 40px rgba(24, 34, 48, 0.07);
  --radius: 14px;
  --max: 920px;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

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

html {
  scroll-behavior: smooth;
  background:
    radial-gradient(1200px 600px at 8% -12%, #cfe0e6 0%, transparent 55%),
    radial-gradient(900px 520px at 100% 0%, #d5dde8 0%, transparent 48%),
    linear-gradient(180deg, var(--bg-accent), var(--bg) 42%, #e7ecef);
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

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

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus { left: 1rem; top: 1rem; z-index: 100; background: #fff; padding: 0.5rem 1rem; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  background: rgba(238, 242, 245, 0.84);
  border-bottom: 1px solid var(--line);
}

.nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.85rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.nav-brand:hover { color: var(--accent); }

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.92rem;
  font-weight: 550;
}
.nav-links a { color: var(--ink-muted); }
.nav-links a:hover { color: var(--ink); }

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

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 2.5rem;
  align-items: center;
  padding: 3.2rem 0 2.4rem;
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.hero-kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 550;
  font-size: clamp(2.6rem, 5vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 0.55rem;
}

.hero-role {
  font-size: 1.2rem;
  color: var(--ink-muted);
  margin: 0 0 1.35rem;
  font-weight: 500;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 1.2rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 550;
}
.chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.chip.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #f7fffe;
}
.chip.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.hero-contact {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
}

.hero-photo {
  justify-self: end;
  width: min(100%, 260px);
  position: relative;
}
.hero-photo::before {
  content: "";
  position: absolute;
  inset: 12% -8% -8% 12%;
  background: linear-gradient(145deg, var(--accent-soft), #d7e0ea);
  border-radius: 28px;
  z-index: 0;
  transform: rotate(3deg);
}
.hero-photo a {
  position: relative;
  z-index: 1;
  display: block;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.hero-photo img {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.hero-photo a:hover img { transform: scale(1.03); }

/* Sections */
section {
  padding: 2.1rem 0 0.4rem;
  animation: rise 0.7s ease both;
  animation-delay: 0.08s;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.55rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 550;
  letter-spacing: -0.02em;
  margin: 0;
}

.section-note {
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.about-card p { margin: 0 0 0.85rem; }
.about-card p:last-child { margin-bottom: 0; }

/* Publications (collapsed by default) */
.pub-collapse {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.pub-toggle {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.2rem;
  user-select: none;
}
.pub-toggle::-webkit-details-marker { display: none; }
.pub-toggle-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.pub-toggle-title {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 550;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.15;
}
.pub-toggle-hint {
  font-size: 0.88rem;
  font-weight: 550;
  color: var(--accent);
}
.hint-open { display: none; }
.pub-collapse[open] .hint-closed { display: none; }
.pub-collapse[open] .hint-open { display: inline; }
.pub-toggle-meta {
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin-left: auto;
}
.pub-toggle-chevron {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--ink-muted);
  border-bottom: 2px solid var(--ink-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.pub-collapse[open] .pub-toggle-chevron {
  transform: rotate(225deg);
  margin-top: 0.35rem;
}
.pub-collapse[open] .pub-toggle {
  border-bottom: 1px solid var(--line);
}
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem 1rem;
}

.pub {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.15rem;
  align-items: start;
  padding: 1rem 1.05rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.pub:hover {
  background: var(--surface);
  border-color: var(--line);
  transform: translateY(-1px);
}

.pub-thumb {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  aspect-ratio: 16/10;
}
.pub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pub-title {
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.35;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.pub-authors {
  margin: 0 0 0.3rem;
  color: var(--ink-muted);
  font-size: 0.92rem;
}
.pub-authors strong { color: var(--ink); font-weight: 700; }
.pub-venue {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}
.pub-links { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pub-link {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}
.pub-link:hover { background: var(--accent); color: #fff; }

/* Experience */
.exp-list { display: flex; flex-direction: column; gap: 0.75rem; }
.exp-list-more { margin-top: 0.75rem; }

.exp-more {
  margin-top: 0.85rem;
}
.exp-more-toggle {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  user-select: none;
}
.exp-more-toggle::-webkit-details-marker { display: none; }
.exp-more-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.exp-more .hint-open { display: none; }
.exp-more[open] .hint-closed { display: none; }
.exp-more[open] .hint-open { display: inline; }
.exp-more[open] .pub-toggle-chevron {
  transform: rotate(225deg);
  margin-top: 0.15rem;
}

.exp {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.exp-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
}
.exp-logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.exp h3 { margin: 0 0 0.15rem; font-size: 1.05rem; font-weight: 700; }
.exp-org { margin: 0 0 0.15rem; font-weight: 600; }
.exp-meta { margin: 0 0 0.35rem; color: var(--ink-muted); font-size: 0.9rem; }
.exp-detail { margin: 0; color: var(--ink-muted); font-size: 0.95rem; }

.services {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow);
}
.services p { margin: 0 0 0.6rem; color: var(--ink-muted); }
.services p:last-child { margin: 0; }
.services strong { color: var(--ink); }

.site-footer {
  max-width: var(--max);
  margin: 2rem auto 0;
  padding: 1.5rem 1.4rem 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.88rem;
  text-align: center;
}
.site-footer p { margin: 0 0 0.45rem; }
.site-footer p:last-child { margin-bottom: 0; }
.site-footer img {
  display: inline;
  vertical-align: middle;
  height: 1.1em;
}
.footer-credit {
  margin-top: 0.75rem !important;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  opacity: 0.85;
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 2rem;
    text-align: left;
  }
  .hero-photo {
    justify-self: start;
    order: -1;
    width: min(200px, 55%);
  }
  .pub { grid-template-columns: 96px 1fr; gap: 0.85rem; padding: 0.75rem 0; }
  .nav { padding-inline: 1rem; }
  main { padding-inline: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
