/* Shared styles for liuyu.polyu.online */

:root {
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #1f2733;
  --muted: #5a6472;
  --accent: #8f1f2f;
  --accent-soft: #f8eef0;
  --border: #e3e6eb;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --maxw: 920px;
  --gutter: 1.5rem;
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header / navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
}

.brand {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 0.15rem;
}

.site-nav a {
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -0.6rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

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

.section {
  padding: 2.25rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 60px;
}

h1,
h2,
h3 {
  line-height: 1.25;
  color: var(--text);
}

h2 {
  margin: 0 0 1.1rem;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
}

h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.page-head {
  padding: 2.75rem 0 2rem;
}

.page-head h1 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 2.1rem;
}

/* ---------- Hero (home) ---------- */

.hero {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  padding: 3rem 0 2rem;
  scroll-margin-top: 60px;
}

.hero-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center top;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06),
    0 8px 24px rgba(16, 24, 40, 0.1);
}

.name {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.role {
  margin: 0 0 1.1rem;
  color: var(--muted);
}

.role strong {
  display: block;
  color: var(--accent);
  font-weight: 600;
}

.contact {
  list-style: none;
  margin: 0 0 1.1rem;
  padding: 0;
  font-size: 0.97rem;
}

.contact li {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  align-items: baseline;
  padding: 0.12rem 0;
}

.contact i {
  color: var(--muted);
  font-size: 0.9em;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.profile-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.bio {
  padding-bottom: 2.25rem;
}

/* ---------- Tags ---------- */

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.1rem 0 0;
  padding: 0;
}

.tags li {
  padding: 0.22rem 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
}

.callout {
  margin-top: 1.1rem;
  padding: 1rem 1.15rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--accent-soft);
}

/* ---------- News ---------- */

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

.news li {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.55rem 0;
}

.news-date {
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1.9;
}

/* ---------- Teaching ---------- */

.entry + .entry {
  margin-top: 1.5rem;
}

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

.courses li {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.28rem 0;
}

.course-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 2;
}

.course-terms {
  color: var(--muted);
  font-size: 0.93rem;
  white-space: nowrap;
}

.course-terms::before {
  content: "· ";
}

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

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 2.5rem;
}

.plain-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.97rem;
}

.plain-list li {
  padding: 0.18rem 0;
}

.plain-list li::marker {
  color: #b9bfc8;
}

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

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

.pubs li {
  padding: 0.8rem 0;
}

.pubs li + li {
  border-top: 1px solid var(--border);
}

.pub-title {
  display: block;
  font-weight: 600;
  line-height: 1.45;
}

.pub-authors {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.pub-authors b {
  font-weight: 600;
  color: var(--text);
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin-top: 0.15rem;
  font-size: 0.95rem;
}

.pub-venue {
  font-style: italic;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--accent);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  font-weight: 500;
}

.year-group {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

.year-group h2 {
  margin: 0;
  padding-top: 0.75rem;
  font-size: 1.3rem;
  color: var(--accent);
}

/* ---------- Group members ---------- */

.members {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.member {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.member img {
  flex: 0 0 96px;
  width: 96px;
  height: 120px;
  object-fit: cover;
  object-position: center top;
  border-radius: 8px;
  background: var(--surface);
}

.member-body {
  min-width: 0;
  font-size: 0.93rem;
}

.member-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.member-role {
  margin: 0.1rem 0 0.5rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.member-body p {
  margin: 0 0 0.3rem;
  color: var(--muted);
}

.member-body .contact {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

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

.site-footer {
  margin-top: 1rem;
  padding: 1.75rem 0 2.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.87rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- Tablet and phone ---------- */

@media (max-width: 760px) {
  :root {
    --gutter: 1.15rem;
  }

  body {
    font-size: 1rem;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.4rem 0.6rem 0.7rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(16, 24, 40, 0.08);
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    padding: 0.7rem 0.6rem;
    font-size: 1rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 1.4rem;
    padding: 2rem 0 1.5rem;
  }

  .hero-photo {
    width: 150px;
  }

  .name {
    font-size: 2rem;
  }

  .section {
    padding: 1.75rem 0;
  }

  h2 {
    font-size: 1.35rem;
  }

  .page-head {
    padding: 2rem 0 1.5rem;
  }

  .page-head h1 {
    font-size: 1.8rem;
  }

  .news li {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0.6rem 0;
  }

  .two-col,
  .members {
    grid-template-columns: 1fr;
  }

  .courses li {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0.4rem 0;
  }

  .course-code {
    line-height: 1.5;
  }

  .course-terms {
    white-space: normal;
  }

  .year-group {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .year-group h2 {
    padding-top: 0.25rem;
  }

  .profile-links a,
  .chip {
    min-height: 36px;
  }

  .chip {
    padding: 0.2rem 0.7rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 400px) {
  .member {
    padding: 0.9rem;
    gap: 0.9rem;
  }

  .member img {
    flex-basis: 76px;
    width: 76px;
    height: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  .site-header {
    position: static;
  }

  .site-nav,
  .nav-toggle,
  .chip {
    display: none;
  }
}

/* ==========================================================
   Layout v2: profile sidebar, news timeline, venue badges
   ========================================================== */

body.home {
  --maxw: 1120px;
}

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 3.5rem;
  align-items: start;
  padding-top: 2.5rem;
}

.layout > main > .section:first-child {
  border-top: 0;
  padding-top: 0;
}

.profile {
  position: sticky;
  top: 84px;
}

.profile .hero-photo {
  margin-bottom: 1.25rem;
}

.profile .name {
  font-size: 1.85rem;
}

.profile .role {
  font-size: 0.95rem;
  line-height: 1.5;
}

.profile .contact {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

.profile .profile-links a {
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
}

.section {
  scroll-margin-top: 61px;
}

/* News timeline */

.news {
  margin-left: 0.35rem;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border);
}

.news li {
  position: relative;
  display: block;
  padding: 0 0 1.25rem;
}

.news li:last-child {
  padding-bottom: 0.1rem;
}

.news li::before {
  content: "";
  position: absolute;
  left: calc(-1.5rem - 6px);
  top: 0.5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--bg);
}

.news-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.1rem;
}

.news-tag,
.pub-badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.5;
  text-transform: uppercase;
}

/* Venue badges on publications */

.pubs li {
  display: grid;
  grid-template-columns: 6.25rem minmax(0, 1fr);
  column-gap: 1rem;
}

.pubs li > * {
  grid-column: 2;
}

.pubs li > .pub-badge {
  grid-column: 1;
  grid-row: 1 / span 3;
  align-self: start;
  justify-self: start;
  margin-top: 0.22rem;
  text-transform: none;
  letter-spacing: 0.03em;
}

.year-group {
  display: block;
  padding: 1.5rem 0 0.5rem;
}

.year-group h2 {
  padding-top: 0;
  margin-bottom: 0.25rem;
}

@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 2rem;
  }

  .profile {
    position: static;
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 2rem;
    align-items: center;
  }

  .profile .hero-photo {
    margin-bottom: 0;
  }

  .layout > main > .section:first-child {
    border-top: 1px solid var(--border);
    padding-top: 1.75rem;
  }
}

@media (max-width: 760px) {
  .pubs li {
    display: block;
  }

  .pubs li > .pub-badge {
    margin: 0 0 0.3rem;
  }
}

@media (max-width: 560px) {
  .profile {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .profile .hero-photo {
    width: 150px;
  }
}

/* Keep the sticky profile within short laptop screens */
@media (min-width: 941px) {
  .profile .hero-photo {
    width: 200px;
  }
}

@media (min-width: 941px) and (max-height: 760px) {
  .profile {
    position: static;
  }
}

/* ---------- Institution banner ---------- */

.banner {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.banner-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2.25rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.banner a {
  display: block;
  transition: opacity 0.15s;
}

.banner a:hover {
  opacity: 0.8;
}

.banner img {
  height: 46px;
  width: auto;
}

@media (max-width: 760px) {
  .banner-inner {
    gap: 0.6rem 1.25rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .banner img {
    height: 30px;
  }
}

@media print {
  .banner {
    border-bottom: 0;
  }
}

/* ---------- Profile links: one horizontal row ---------- */

.profile .profile-links {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 0.5rem;
}

.profile .profile-links a {
  flex-direction: column;
  gap: 0.35rem;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.profile .profile-links i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 1.05rem;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.profile .profile-links a:hover {
  background: none;
  color: var(--accent);
}

.profile .profile-links a:hover i {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 940px) {
  .profile .profile-links {
    justify-content: flex-start;
    gap: 1.5rem;
  }
}

/* ---------- Teaching by semester ---------- */

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

.terms li {
  display: grid;
  grid-template-columns: 3.5rem 4.25rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: baseline;
  padding: 0.3rem 0;
}

.terms li.year-start:not(:first-child) {
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.term-year {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.term-tag {
  justify-self: start;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.5;
  text-transform: uppercase;
}

.term-fall {
  background: var(--accent-soft);
  color: var(--accent);
}

.term-spring {
  background: var(--surface);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.terms .course-code {
  display: inline-block;
  min-width: 5.25rem;
  line-height: inherit;
}

@media (max-width: 760px) {
  .terms li {
    grid-template-columns: 3rem 4rem minmax(0, 1fr);
    column-gap: 0.6rem;
    padding: 0.4rem 0;
  }

  .terms .course-code {
    display: block;
  }
}

/* ---------- Profile links v3: icon and name side by side, all on one line ---------- */

.layout {
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 3rem;
}

.profile .profile-links {
  justify-content: flex-start;
  gap: 0.9rem;
}

.profile .profile-links a {
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.profile .profile-links i {
  display: inline;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  font-size: 0.95em;
  color: var(--accent);
  background: none;
}

.profile .profile-links a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.profile .profile-links a:hover i {
  background: none;
}

@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .profile .profile-links {
    gap: 1.1rem;
  }

  .profile .profile-links a {
    font-size: 0.88rem;
  }
}

/* ---------- Banner v2: logos span the full content width ---------- */

@media (min-width: 761px) {
  .banner-inner {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 2rem;
  }

  .banner a {
    min-width: 0;
  }

  .banner a:nth-child(1) { flex: 5.096 1 0; max-width: calc(56px * 5.096); }
  .banner a:nth-child(2) { flex: 4.313 1 0; max-width: calc(56px * 4.313); }
  .banner a:nth-child(3) { flex: 4.853 1 0; max-width: calc(56px * 4.853); }

  .banner img {
    width: 100%;
    height: auto;
  }
}

/* ---------- Profile links v4: three lines, matching the contact list ---------- */

.profile .profile-links {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.profile .profile-links a {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0;
  padding: 0.12rem 0;
  font-size: 0.92rem;
  font-weight: 400;
}

.profile .profile-links i {
  font-size: 0.9em;
}

@media (max-width: 940px) {
  .profile .profile-links {
    gap: 0;
  }

  .profile .profile-links a {
    font-size: 0.97rem;
    padding: 0.2rem 0;
  }
}

/* ---------- Teaching v2: each course starts with "Fall 2025" ---------- */

.terms li {
  grid-template-columns: 6.25rem minmax(0, 1fr);
  column-gap: 1rem;
}

.term-label {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .terms li {
    grid-template-columns: 5.75rem minmax(0, 1fr);
    column-gap: 0.75rem;
  }
}

/* ---------- Research interest capsules: highlighted ---------- */

.tags {
  gap: 0.6rem;
}

h2 + .tags {
  margin-top: 0;
}

.tags li {
  padding: 0.35rem 1rem;
  border-color: rgba(143, 31, 47, 0.28);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 600;
}

/* ---------- PDF / BibTeX buttons on their own line ---------- */

.pub-meta .pub-venue {
  flex: 0 0 100%;
}

.pub-meta .chip {
  margin-top: 0.15rem;
}

/* ---------- Paper title: same size as the author line ---------- */

.pub-title {
  font-size: 0.95rem;
}
