/* Ziyu Shan — homepage styles.
   Palette + fonts follow the WAtcher project page (navy / steel blue / gray).
   To retheme, edit only the variables in :root (light) and the dark block below. */

:root {
  --bg: #edf1f5;
  --surface: #ffffff;
  --ink: #2C3E50;          /* navy: headings, titles */
  --text: #3b4754;         /* body text */
  --muted: #59616C;        /* authors, captions */
  --faint: #8a939e;
  --accent: #47607E;       /* steel blue: links, dates, badges */
  --accent-soft: #E6EDF6;
  --line: rgba(44, 62, 80, 0.12);
  --shadow: 0 6px 22px rgba(30, 44, 60, 0.06);
  --shadow-hover: 0 12px 30px rgba(30, 44, 60, 0.11);
  --oral: #A84F58;
  --page-width: 1140px;    /* overall page width — change this to widen/narrow */

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Helvetica Neue", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151c;
    --surface: #18212c;
    --ink: #E6EDF6;
    --text: #cdd6e0;
    --muted: #A9B6C5;
    --faint: #8494A6;
    --accent: #9CC3EA;
    --accent-soft: rgba(136, 192, 208, 0.14);
    --line: rgba(204, 219, 237, 0.12);
    --shadow: 0 6px 22px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.4);
    --oral: #e0959c;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  font: 500 16px/1.65 var(--sans);   /* 400 = thinner, 600 = bolder */
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; font-weight: 600; }
b, strong { font-weight: 700; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.3; }

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--page-width); margin: 0 auto; padding: 0.8rem 2rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.nav .brand { font-family: var(--serif); font-size: 1.15rem; color: var(--ink); margin-right: auto; }
.nav a { color: var(--muted); font-weight: 500; font-size: 0.92rem; }
.nav a:hover { color: var(--ink); text-decoration: none; }

/* ---------- layout ---------- */
.layout {
  max-width: var(--page-width); margin: 0 auto; padding: 2rem 2rem 3rem;
  display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 3rem;
  align-items: start;
}

/* ---------- sidebar ---------- */
.sidebar { position: sticky; top: 90px; text-align: left; }
.avatar {
  width: 170px; height: 170px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--surface); box-shadow: var(--shadow-hover);
}
.sidebar h1 { font-size: 1.35rem; margin: 1rem 0 0.2rem; }
.sidebar .role { color: var(--muted); font-size: 0.88rem; margin: 0 0 1rem; }
.links { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.links li { margin: 0.1rem 0; }
.links a, .links span {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.25rem 0.4rem; border-radius: 6px; color: var(--muted); font-weight: 500;
}
.links a:hover { background: var(--accent-soft); color: var(--ink); text-decoration: none; }
.links i { width: 1.2em; text-align: center; color: var(--accent); }

/* fun photo pile (sidebar bottom) */
.fun { position: relative; margin-top: 1.6rem; width: 240px; }
.fun-note {
  margin: 0; font-family: "Caveat", "Bradley Hand", cursive; font-weight: 600;
  font-size: 1.45rem; line-height: 1.05; color: var(--accent); transform: rotate(-4deg);
}
.fun-arrow {
  position: absolute; top: 0.4rem; left: 150px; width: 62px; height: 56px;
  fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.pile { position: relative; height: 250px; margin-top: 0.4rem; }
.pile img {
  position: absolute; width: 118px; height: 140px; object-fit: cover;
  padding: 6px 6px 22px; background: #fff; border-radius: 3px;
  box-shadow: 0 6px 16px rgba(30, 44, 60, 0.22);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.pile img:nth-child(1) { left: 0;    top: 18px;  transform: rotate(-9deg); }
.pile img:nth-child(2) { left: 92px; top: 0;     transform: rotate(7deg); }
.pile img:nth-child(3) { left: 18px; top: 102px; transform: rotate(5deg); }
.pile img:nth-child(4) { left: 104px; top: 96px; transform: rotate(-6deg); }
.pile img:hover {
  z-index: 5; transform: rotate(0deg) scale(1.45);
  box-shadow: 0 14px 34px rgba(30, 44, 60, 0.35);
}
/* keep the sidebar sticky only when the screen is tall enough to show the whole pile */
@media (max-height: 860px) and (min-width: 861px) { .sidebar { position: static; } }

/* ---------- sections ---------- */
main section { margin-bottom: 2.75rem; }
main h2 {
  display: flex; align-items: center; gap: 0.8rem;
  font-size: 1.45rem; margin: 0 0 1rem;
}
main h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
}

/* about */
.intro { padding: 1.5rem 1.6rem; }
.intro p { margin: 0 0 0.9rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.tags span {
  padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
}

/* news */
.news { list-style: none; margin: 0; padding: 0.4rem 1.4rem; }
.news li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 0.75rem; padding: 0.55rem 0; }
.news li + li { border-top: 1px solid var(--line); }
.news time { color: var(--accent); font-weight: 700; font-size: 0.85rem; padding-top: 0.12rem; }

/* publications */
.note { color: var(--faint); font-size: 0.85rem; margin: -0.4rem 0 1rem; }
.pub {
  display: grid; grid-template-columns: minmax(200px, 34%) minmax(0, 1fr); gap: 1.4rem;
  padding: 1.1rem; margin-bottom: 1rem; align-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pub:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.pub-img {
  position: relative; height: 200px; border-radius: 9px; overflow: hidden;
  background: #fff; border: 1px solid var(--line);
}
.pub-img img { width: 100%; height: 100%; object-fit: contain; padding: 0.35rem; }
.badge {
  position: absolute; top: 0.55rem; left: 0.55rem;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  background: #2C3E50; color: #fff; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.pub h3 { font-size: 1.05rem; margin: 0 0 0.4rem; }
.pub .authors { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.3rem; }
.pub .authors b { color: var(--ink); }
.pub .authors .mail, .note .mail { font-size: 1.35em; line-height: 0; vertical-align: -0.06em; }
.pub .venue { color: var(--accent); font-size: 0.85rem; font-weight: 700; margin: 0 0 0.7rem; }
.pub .oral { color: var(--oral); }
.btns { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.btns a {
  padding: 0.28rem 0.75rem; border-radius: 999px; font-size: 0.8rem;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--line);
}
.btns a:hover { background: var(--accent); color: var(--surface); text-decoration: none; }

/* experience */
.timeline { overflow: hidden; }
.timeline .item { display: grid; grid-template-columns: 150px 1fr; gap: 1rem; padding: 1rem 1.3rem; align-items: center; }
.timeline .item + .item { border-top: 1px solid var(--line); }
.timeline time { color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.timeline h3 { font-family: var(--sans); font-size: 1rem; margin: 0; }
.timeline p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* awards */
.awards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.award { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.75rem; padding: 0.85rem 1rem; align-items: center; }
.award time { color: var(--accent); font-weight: 700; font-size: 0.85rem; }
.award strong { color: var(--ink); font-size: 0.95rem; font-weight: 600; }

/* services */
.plain { padding: 1rem 1.4rem; }
.plain p { margin: 0.3rem 0; }

footer { text-align: center; color: var(--faint); font-size: 0.8rem; padding: 0 1rem 2rem; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; padding: 1.25rem 1rem 2.5rem; }
  .nav-inner { flex-wrap: nowrap; overflow-x: auto; gap: 1.1rem; padding: 0.7rem 1rem; }
  .nav .brand { display: none; }
  .nav a { white-space: nowrap; }
  .intro { padding: 1.2rem; }
  .news { padding: 0.4rem 1rem; }
  .news li { grid-template-columns: 1fr; gap: 0; }
  .sidebar { position: static; text-align: center; }
  .avatar { margin: 0 auto; width: 140px; height: 140px; }
  .fun { margin: 1.4rem auto 0; text-align: left; }
  .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 0.5rem; }
  .pub { grid-template-columns: 1fr; }
  .awards { grid-template-columns: 1fr; }
  .timeline .item { grid-template-columns: 1fr; gap: 0.2rem; }
}
