/* Yifan Shen — personal homepage styles */

:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --ink: #18202e;
  --ink-2: #3a4456;
  --muted: #6a7284;
  --line: #e5e2dc;
  --line-soft: #efede8;
  --accent: #e84a27;          /* Illini orange */
  --accent-ink: #c2391a;
  --accent-soft: #fdece6;
  --navy: #13294b;            /* Illini blue */
  --navy-soft: #e9eef7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .05);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, .05), 0 14px 32px rgba(16, 24, 40, .09);
  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1218;
    --surface: #161a22;
    --ink: #e9ebef;
    --ink-2: #c7ccd5;
    --muted: #949bab;
    --line: #272c37;
    --line-soft: #1e232c;
    --accent: #ff7b54;
    --accent-ink: #ff936f;
    --accent-soft: rgba(255, 123, 84, .13);
    --navy: #a9bde6;
    --navy-soft: rgba(169, 189, 230, .12);
    --shadow: none;
    --shadow-hover: 0 10px 30px rgba(0, 0, 0, .35);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

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

/* ---------- Top navigation ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1160px;
  height: 100%;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  font-weight: 750;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }

.nav-inner > nav { min-width: 0; }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--ink); background: var(--line-soft); text-decoration: none; }
.nav-links a.active { color: var(--accent-ink); background: var(--accent-soft); }

/* ---------- Page layout ---------- */

.layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 44px 28px 72px;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 60px;
  align-items: start;
}

/* ---------- Profile sidebar ---------- */

.profile {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
}

.avatar {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: var(--shadow);
  background: var(--line-soft);
}

.profile h1 {
  margin: 22px 0 4px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -.02em;
}

.profile .role {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}

.profile .affil {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.contact {
  list-style: none;
  margin: 20px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 2px;
}

.contact li { display: flex; }

.contact a, .contact .static {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 7px 10px;
  margin: 0 -10px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.contact a:hover { background: var(--surface); color: var(--accent-ink); text-decoration: none; box-shadow: var(--shadow); }
.contact i { width: 18px; text-align: center; font-size: 15px; color: var(--muted); }
.contact a:hover i { color: var(--accent); }

/* ---------- Sections ---------- */

.section {
  scroll-margin-top: calc(var(--nav-h) + 20px);
  margin-bottom: 60px;
}
.section:last-child { margin-bottom: 0; }

.section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  font-size: 23px;
  font-weight: 720;
  letter-spacing: -.015em;
}
.section h2::before {
  content: "";
  width: 5px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), #f59e0b);
}

.section h2 .note {
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.prose p { margin: 0 0 14px; color: var(--ink-2); font-size: 16.5px; }
.prose strong { color: var(--ink); font-weight: 650; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--navy-soft);
  color: var(--navy);
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- Timeline (experience / education) ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 26px;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 52px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--line);
}

.tl-logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--navy);
  font-size: 19px;
  font-weight: 750;
}
.tl-logo.apple { color: var(--ink); font-size: 22px; }
.tl-logo.alibaba { color: #ff6a00; }
.tl-logo.hik { color: #d7000f; font-size: 15px; }
.tl-logo.award { color: #d97706; font-size: 18px; }

.tl-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  flex-wrap: wrap;
}
.tl-title { margin: 0; font-size: 16.5px; font-weight: 680; line-height: 1.4; }
.tl-date {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tl-org { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; }
.tl-org .loc { color: var(--muted); }
.tl-org em { font-style: normal; color: var(--accent-ink); font-weight: 600; }

.tl-points {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 14.8px;
  line-height: 1.6;
}
.tl-points li { margin-bottom: 4px; }
.tl-points li::marker { color: var(--accent); }

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

.pub-list { display: grid; gap: 18px; }

.pub {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.pub:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.pub-thumb {
  position: relative;
  align-self: start;
  aspect-ratio: 16 / 10;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: zoom-in;
  display: grid;
  place-items: center;
}
.pub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .35s ease;
}
.pub:hover .pub-thumb img { transform: scale(1.035); }
.pub-thumb::after {
  content: "\f00e";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 12px;
  color: #fff;
  background: rgba(19, 41, 75, .78);
  opacity: 0;
  transition: opacity .2s;
}
.pub-thumb:hover::after { opacity: 1; }

.pub-body { min-width: 0; }

.venue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.venue.preprint { background: var(--navy-soft); color: var(--navy); }

.pub-title {
  margin: 9px 0 6px;
  font-size: 17.5px;
  line-height: 1.4;
  font-weight: 680;
  letter-spacing: -.005em;
}
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--accent-ink); text-decoration: none; }

.authors { margin: 0; color: var(--muted); font-size: 14.3px; line-height: 1.6; }
.me {
  color: var(--ink);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.pub-highlight {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-ink);
}

.pub-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s, color .15s, background .15s;
}
.btn i { font-size: 12px; }
.btn:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-soft);
  text-decoration: none;
}

/* ---------- Service ---------- */

.service { display: grid; gap: 18px; }
.service-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.service-row:last-child { border-bottom: none; padding-bottom: 0; }
.service-label { font-weight: 650; font-size: 15px; color: var(--ink); padding-top: 3px; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  padding: 3px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 550;
}

.ws-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ws-list li { display: flex; gap: 10px; font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.ws-list li i { color: var(--accent); margin-top: 5px; font-size: 12px; }
.ws-list a { color: var(--ink); font-weight: 550; }
.ws-list a:hover { color: var(--accent-ink); }

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

.footer {
  border-top: 1px solid var(--line);
  padding: 26px 28px 34px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- Lightbox ---------- */

.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(1240px, 94vw);
  max-height: 94vh;
  overflow: visible;
}
.lightbox::backdrop { background: rgba(10, 12, 18, .78); backdrop-filter: blur(3px); }
.lightbox img {
  max-width: 100%;
  max-height: 84vh;
  margin: 0 auto;
  border-radius: 12px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.lightbox p { margin: 14px 0 0; text-align: center; color: #e9ebef; font-size: 15px; font-weight: 550; }
.lightbox .close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #18202e;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 40px; padding-top: 28px; }

  .profile {
    position: static;
    display: grid;
    grid-template-columns: 124px minmax(0, 1fr);
    gap: 4px 22px;
    align-items: center;
  }
  .avatar { grid-row: span 3; border-radius: 16px; }
  .profile h1 { margin: 0; font-size: 26px; }
  .contact {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding-top: 16px;
  }
  .contact a, .contact .static {
    width: auto;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 14px;
  }
}

@media (max-width: 720px) {
  .pub { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 14px; }
  .pub-thumb { aspect-ratio: 16 / 9; }
  .service-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .section h2 .note { display: none; }
}

@media (max-width: 560px) {
  .nav-inner { padding: 0 16px; gap: 12px; }
  .brand { display: none; }
  .nav-inner > nav { width: 100%; }
  .nav-links { gap: 0; justify-content: space-between; }
  .nav-links a { padding: 7px 8px; font-size: 13.5px; }
  .layout { padding: 22px 16px 56px; }
  .profile { grid-template-columns: 96px minmax(0, 1fr); gap: 2px 16px; }
  .profile h1 { font-size: 23px; }
  .profile .role, .profile .affil { font-size: 14px; }
  .prose p { font-size: 16px; }
  .tl-item { grid-template-columns: 40px minmax(0, 1fr); gap: 14px; }
  .tl-logo { width: 40px; height: 40px; font-size: 17px; }
  .tl-item:not(:last-child)::before { left: 19px; top: 46px; }
  .lightbox .close { top: -44px; right: 0; }
}

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