/* Jerry Zheng portfolio
   Dark, photo-forward "Gallery" look. Bumper red and blue mark the robots; yellow marks awards. */

:root {
  --bg: #121316;
  --panel: #1A1C20;
  --panel-2: #202328;
  --ink: #ECEDEF;
  --muted: #A0A4AC;
  --line: #2A2D33;
  --red: #E5484D;
  --blue: #6E8BFF;
  --yellow: #F0C419;
  --focus: #6E8BFF;

  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  --radius-sm: 10px;
  --header-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.15; text-wrap: balance; }
p { margin: 0 0 0.9rem; }
p:last-child { margin-bottom: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 0.5rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
@media (min-width: 768px) { .wrap { padding: 0 2rem; } }

/* Pills and links */
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1.1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
  touch-action: manipulation;
}
.pill:hover { border-color: var(--muted); background: var(--panel); }
.pill-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.pill-primary:hover { background: #fff; border-color: #fff; }

.links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: 0.92rem; font-weight: 500; }
.links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: text-decoration-color 160ms var(--ease);
}
.links a:hover { text-decoration-color: currentColor; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags li {
  padding: 0.1rem 0.65rem;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.meta { color: var(--muted); font-size: 0.9rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); }
.wordmark { font-weight: 700; font-size: 1.05rem; text-decoration: none; white-space: nowrap; }
.site-nav { margin-left: auto; }
.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current="true"] { color: var(--ink); background: var(--panel-2); }
.menu-btn {
  display: none;
  min-height: 40px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 0.92rem var(--font);
  cursor: pointer;
}

@media (max-width: 899px) {
  .menu-btn { display: inline-flex; align-items: center; }
  .nav-links {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: var(--header-h);
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 1.25rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .nav-links a { min-height: 48px; width: 100%; font-size: 1.05rem; border-radius: var(--radius-sm); }
}

/* Hero */
.hero { padding: 3rem 0; }
.hero-grid { display: grid; gap: 1.5rem; }
@media (min-width: 900px) {
  .hero { padding: 4rem 0; }
  .hero-grid { grid-template-columns: 1.3fr 1fr; align-items: center; gap: 3rem; }
}
.hero h1 { font-size: clamp(3.25rem, 10vw, 6rem); font-weight: 700; letter-spacing: -0.04em; line-height: 0.95; }
.hero-side p { color: var(--muted); font-size: 1.15rem; max-width: 40ch; margin-bottom: 1.25rem; }
@media (max-width: 480px) {
  .hero .pills { gap: 0.4rem; }
  .hero .pill { padding: 0 0.85rem; font-size: 0.9rem; }
}

/* Sections */
.section { padding: 2.25rem 0; border-top: 1px solid var(--line); }
@media (min-width: 900px) { .section { padding: 3rem 0; } }
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem 2rem;
  margin-bottom: 1.75rem;
}
.section-head h2, .about-copy h2, .contact h2 { font-size: clamp(2rem, 4vw, 2.5rem); font-weight: 700; letter-spacing: -0.02em; }
.section-head p { color: var(--muted); max-width: 58ch; margin: 0; }

/* Cards */
.card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-body { display: flex; flex-direction: column; gap: 0; flex: 1; padding: 1.4rem 1.4rem 1.5rem; }
.card-body > p { color: var(--muted); font-size: 0.97rem; }
.card-body > .links { margin-top: auto; padding-top: 1rem; }
.card-body > .tags { margin-top: 1rem; }

/* Robots (first group inside Projects) */
.subsection { margin-bottom: 3rem; scroll-margin-top: calc(var(--header-h) + 1rem); }
.sub-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem 2rem; margin-bottom: 1.25rem; }
.sub-head h3 { font-size: 1.35rem; font-weight: 600; }
.sub-head p { color: var(--muted); font-size: 0.95rem; max-width: 62ch; margin: 0; }
.robots { display: grid; gap: 1.25rem; }
@media (min-width: 720px) { .robots { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .robots { grid-template-columns: repeat(3, 1fr); } }
.robot img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.robot h4 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.robot .summary { color: var(--muted); font-size: 0.97rem; margin-bottom: 0.4rem; }
.more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  min-height: 36px;
  margin-bottom: 1rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  font: 600 0.9rem var(--font);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  transition: text-decoration-color 160ms var(--ease);
}
.more-btn::after { content: "\2197"; font-size: 0.85em; text-decoration: none; }
.more-btn:hover { text-decoration-color: currentColor; }

/* Robot details dialog */
.robot-dialog {
  width: min(640px, calc(100vw - 2rem));
  max-height: min(85dvh, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  overflow: auto;
  overscroll-behavior: contain;
}
.robot-dialog::backdrop { background: rgba(6, 7, 9, 0.72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.robot-dialog[open] { animation: dialog-in 220ms var(--ease); }
.robot-dialog[open]::backdrop { animation: backdrop-in 220ms var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
@keyframes backdrop-in { from { opacity: 0; } }

.dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.dialog-head img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); }
.dialog-head h4 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.dialog-head .meta { margin: 0.15rem 0 0; }
.dialog-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}
.dialog-close:hover { border-color: var(--muted); background: var(--panel-2); }
.dialog-close svg { width: 18px; height: 18px; }
.robot-dialog .specs { gap: 0.8rem; margin: 0; padding: 1.4rem 1.5rem 1.6rem; }
.robot-dialog .specs li { font-size: 0.98rem; line-height: 1.6; color: color-mix(in srgb, var(--ink) 82%, var(--panel)); }
html.dialog-open { overflow: hidden; }
.specs { display: grid; gap: 0.5rem; margin: 0.5rem 0 0; }
.specs li { position: relative; padding-left: 1rem; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.specs li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.robot .meta { margin: 0.25rem 0 0.9rem; }

.awards { display: grid; gap: 0.4rem; margin: 0.5rem 0 1rem; }
.awards li { display: flex; align-items: baseline; gap: 0.55rem; font-size: 0.92rem; font-weight: 600; }
.awards li::before { content: "★"; flex: none; color: var(--yellow); font-size: 0.8rem; }
.awards span { margin-left: auto; padding-left: 0.75rem; font-weight: 400; color: var(--muted); text-align: right; white-space: nowrap; }

.season { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.season summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  list-style: none;
}
.season summary::-webkit-details-marker { display: none; }
.season summary::after { content: "+"; color: var(--muted); font-size: 1.2rem; font-weight: 400; transition: transform 200ms var(--ease); }
.season[open] summary::after { transform: rotate(45deg); }
.season table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-bottom: 0.75rem; font-variant-numeric: tabular-nums; }
.season th, .season td { text-align: left; vertical-align: top; padding: 0.35rem 0.5rem 0.35rem 0; border-top: 1px solid var(--line); }
.season thead th { color: var(--muted); font-weight: 500; border-top: 0; }
.season tbody th { font-weight: 600; }
.season td { color: var(--muted); }
.season td:nth-child(2) { width: 3rem; }
.season a { text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }

/* Research */
.duo { display: grid; gap: 1.25rem; }
@media (min-width: 900px) { .duo { grid-template-columns: 1fr 1fr; } }

.poster { position: relative; display: block; background: #fff; border-bottom: 1px solid var(--line); }
.poster img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: opacity 200ms var(--ease); }
.poster-label {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.poster:hover img { opacity: 0.9; }
.poster:hover .poster-label { text-decoration: underline; text-underline-offset: 3px; }

.paper h3 { font-size: 1.3rem; font-weight: 600; margin: 0.35rem 0 0.6rem; }
.paper .authors { font-size: 0.88rem; margin-bottom: 1rem; }
.paper .authors strong { color: var(--ink); font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0.5rem 0 1rem; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats div { display: flex; flex-direction: column-reverse; gap: 0.2rem; }
.stats dd { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats dt { font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.fine { font-size: 0.82rem; color: var(--muted); }

/* Projects */
.feature { display: grid; margin-bottom: 1.25rem; background: linear-gradient(180deg, var(--panel), var(--bg)); }
@media (min-width: 900px) { .feature { grid-template-columns: 1fr 1fr; align-items: center; } }
.feature-copy { padding: 1.75rem; }
@media (min-width: 900px) { .feature-copy { padding: 2.5rem; } }
.badge { color: var(--yellow); font-size: 0.85rem; font-weight: 600; margin-bottom: 0.5rem; }
.feature h3 { font-size: clamp(2rem, 4vw, 2.4rem); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.5rem; }
.feature .lede { color: var(--ink); font-size: 1.15rem; font-weight: 500; }
.feature-copy > p:not(.badge):not(.lede) { color: var(--muted); }
.feature-copy .tags { margin: 1rem 0; }
.feature .shot { align-self: stretch; padding: 0 1.75rem 1.75rem; }
@media (min-width: 900px) { .feature .shot { padding: 2rem 2rem 2rem 0; display: flex; align-items: center; } }
.feature .shot img { border-radius: var(--radius-sm); border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); }

.project .shot { display: block; border-bottom: 1px solid var(--line); overflow: hidden; }
.project .shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; transition: transform 300ms var(--ease); }
.project .shot:hover img { transform: scale(1.02); }
.project h3 { font-size: 1.35rem; font-weight: 600; margin: 0.3rem 0 0.6rem; }

/* Experience */
.timeline li { display: grid; gap: 0.25rem 2rem; padding: 1.4rem 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 768px) { .timeline li { grid-template-columns: 10rem 1fr; } }
.when { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; padding-top: 0.15rem; margin: 0; }
.timeline h3 { font-size: 1.15rem; font-weight: 600; }
.timeline .org { color: var(--muted); font-size: 0.95rem; margin: 0.1rem 0 0.4rem; }
.timeline p:not(.when):not(.org) { color: var(--muted); max-width: 64ch; }

/* About */
.about { display: grid; gap: 2.5rem; }
@media (min-width: 900px) { .about { grid-template-columns: 1.2fr 1fr; gap: 4rem; } }
.about-copy h2 { margin-bottom: 1.25rem; }
.about-copy > p { color: var(--muted); font-size: 1.08rem; max-width: 60ch; }
.about h3 { font-size: 1rem; font-weight: 600; margin: 2rem 0 0.75rem; }
@media (min-width: 900px) { .about > div:last-child h3:first-child { margin-top: calc(clamp(2rem, 4vw, 2.5rem) * 1.15 + 1.25rem); } }
.rows li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; color: var(--muted); }
.rows b { color: var(--ink); font-weight: 600; }
.rows .yr { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Contact */
.contact { padding: 2.25rem 0 3rem; }
@media (min-width: 900px) { .contact { padding: 3rem 0 4rem; } }
.contact h2 { font-size: clamp(2.4rem, 7vw, 3.75rem); letter-spacing: -0.03em; margin-bottom: 1rem; }
.contact p { color: var(--muted); max-width: 52ch; margin-bottom: 1.5rem; }


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