/* ============================================================
   Lijing Wang — shared stylesheet
   Edit design tokens in :root to change the look site-wide.
   ============================================================ */

:root {
  --bg:        #faf7ee;
  --bg-soft:   #f3eee0;
  --ink:       #1b1b1f;
  --ink-soft:  #4a4a52;
  --muted:     #7a7468;
  --rule:      #e3dcc9;
  --rule-strong: #c9c1ad;
  --accent:    #1f3a5f;
  --accent-hover: #b8553a;
  --highlight: #fff4cc;
  --card-bg:   #f4eed8;
  --card-bg-2: rgba(244, 238, 216, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", -apple-system, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image: radial-gradient(rgba(180,160,110,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .18s ease, border-color .18s ease;
}
a:hover { color: var(--accent-hover); border-bottom-color: var(--accent-hover); }

/* ====== Layout ====== */
.page {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 72px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 56px 48px 96px;
}

/* ====== Sidebar ====== */
aside.sidebar { position: sticky; top: 56px; align-self: start; }

.avatar {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f3a5f 0%, #2c4f7c 60%, #b8553a 140%);
  color: #faf7ee;
  display: flex; align-items: center; justify-content: center;
  font-family: "Fraunces", serif;
  font-size: 58px;
  font-weight: 500;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 12px 32px -16px rgba(31, 58, 95, 0.4);
}
.avatar-img {
  width: 140px; height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 24px;
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 12px 32px -16px rgba(31, 58, 95, 0.4);
}

.name {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "SOFT" 50;
  font-weight: 500;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 10px;
}

.title-block { font-size: 14px; line-height: 1.55; color: var(--ink-soft); margin-bottom: 24px; }
.title-block .role { color: var(--ink); font-weight: 500; }
.title-block .dept,
.title-block .inst { display: block; }

.contact {
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  list-style: none;
  margin-bottom: 28px;
}
.contact li { padding: 4px 0; display: flex; align-items: center; gap: 8px; }
.contact li::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--rule-strong); flex-shrink: 0;
}
.contact a { font-family: inherit; }

nav.primary { border-top: 1px solid var(--rule); padding-top: 20px; }
nav.primary ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
nav.primary a {
  display: block; padding: 7px 0; font-size: 14px;
  color: var(--ink-soft); border-bottom: none;
  position: relative;
  transition: color .18s ease, padding .18s ease;
}
nav.primary a::before {
  content: "→";
  position: absolute; left: -18px;
  opacity: 0; transform: translateX(-6px);
  transition: opacity .18s ease, transform .18s ease;
  color: var(--accent-hover);
}
nav.primary a:hover { color: var(--accent); padding-left: 4px; }
nav.primary a:hover::before { opacity: 1; transform: translateX(0); }
nav.primary a.active { color: var(--ink); font-weight: 500; }
nav.primary a.active::before { opacity: 1; transform: translateX(0); content: "•"; left: -14px; }

.copyright {
  margin-top: 32px; padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 11.5px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ====== Main content ====== */
main { min-width: 0; }
section { margin-bottom: 64px; scroll-margin-top: 56px; }
section:last-child { margin-bottom: 0; }

h2.section-title {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 96, "SOFT" 50;
  font-weight: 500; font-size: 28px;
  letter-spacing: -0.02em; color: var(--ink);
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
h2.section-title::after {
  content: ""; position: absolute;
  bottom: -1px; left: 0;
  width: 48px; height: 2px;
  background: var(--accent);
}

h3.subsection {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 48, "SOFT" 30;
  font-weight: 500; font-size: 20px;
  letter-spacing: -0.015em; color: var(--ink);
  margin: 36px 0 14px;
}

h3.subsection:first-child { margin-top: 0; }

.lede {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 36, "SOFT" 30;
  font-weight: 400; font-size: 19px;
  line-height: 1.55; color: var(--ink);
  letter-spacing: -0.005em;
}

p { margin-bottom: 14px; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--ink-soft); }

/* ====== Callout ====== */
.callout {
  background: var(--card-bg);
  border-left: 3px solid var(--accent-hover);
  padding: 20px 24px;
  border-radius: 0 6px 6px 0;
  margin-top: 28px;
  position: relative;
}
.callout .pill {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-hover);
  font-weight: 500;
  margin-bottom: 6px;
}
.callout strong { color: var(--ink); font-weight: 600; }

/* ====== Cards (events, projects) ====== */
.events { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.events li {
  background: var(--card-bg-2);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 16px 20px;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.events li:hover {
  border-color: var(--accent);
  background: var(--card-bg);
  transform: translateX(2px);
}

/* ====== News timeline ====== */
.news { list-style: none; }
.news > li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--rule);
  align-items: baseline;
}
.news > li:last-child { border-bottom: none; }
.news .date {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  padding-top: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.news .content { font-size: 15.5px; line-height: 1.55; color: var(--ink-soft); }
.news .content strong, .news .content em { color: var(--ink); font-style: normal; font-weight: 500; }

.tag {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px; font-weight: 500;
  color: var(--accent);
  background: rgba(31, 58, 95, 0.07);
  padding: 1px 8px;
  border-radius: 3px;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  vertical-align: 1px;
}
.tag.paper { color: #6b3a1f; background: rgba(184, 85, 58, 0.1); }
.tag.talk  { color: #4a5d2a; background: rgba(110, 130, 60, 0.12); }
.tag.grant { color: #6b4a1a; background: rgba(180, 140, 50, 0.14); }
.tag.award { color: #6b1a4a; background: rgba(180, 50, 130, 0.10); }

/* Year divider */
.year-divider {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 14px;
  padding: 28px 0 10px;
  margin-top: 8px;
}
.year-divider:first-child { padding-top: 0; margin-top: 0; }
.year-divider .year {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 72, "SOFT" 40;
  font-weight: 500; font-size: 22px;
  color: var(--ink); letter-spacing: -0.01em;
}
.year-divider .line { flex: 1; height: 1px; background: var(--rule); }

/* ====== Research interests grid ====== */
.interest-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 8px;
}
.interest-grid h4 {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.interest-grid ul { list-style: none; }
.interest-grid li {
  padding: 5px 0;
  color: var(--ink-soft);
  font-size: 15px;
  border-bottom: 1px dotted var(--rule);
}
.interest-grid li:last-child { border-bottom: none; }

/* ====== Grants list ====== */
.grants { list-style: none; }
.grants > li {
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 24px;
  align-items: start;
}
.grants > li:last-child { border-bottom: none; }
.grants .title {
  font-weight: 500; color: var(--ink); font-size: 15.5px;
  line-height: 1.45;
}
.grants .meta {
  font-size: 13.5px; color: var(--ink-soft);
  margin-top: 4px;
}
.grants .amount {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px; color: var(--accent);
  white-space: nowrap;
  background: rgba(31, 58, 95, 0.06);
  padding: 4px 10px;
  border-radius: 4px;
  align-self: center;
}

/* ====== Project cards ====== */
.project {
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: start;
}
.project:last-child { border-bottom: none; }
.project img {
  width: 100%; height: 130px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--card-bg-2);
}
.project h3 {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 36, "SOFT" 20;
  font-size: 20px; font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 6px;
}
.project .keywords {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  color: var(--accent-hover);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.project .description {
  color: var(--ink-soft);
  font-size: 15px;
  margin-bottom: 12px;
}
.project .related {
  list-style: none;
  border-left: 2px solid var(--rule);
  padding-left: 14px;
  font-size: 14px;
}
.project .related li { padding: 4px 0; color: var(--ink-soft); line-height: 1.5; }
.project .related strong { color: var(--ink); }

/* ====== Publication list ====== */
.pubs { list-style: none; }
.pubs > li {
  padding: 16px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}
.pubs > li:last-child { border-bottom: none; }
.pubs .authors { color: var(--ink-soft); }
.pubs .authors strong { color: var(--ink); font-weight: 600; }
.pubs .pub-title {
  display: block;
  color: var(--ink);
  font-weight: 500;
  margin: 3px 0;
  font-size: 15.5px;
}
.pubs .venue { font-style: italic; color: var(--muted); font-size: 13.5px; }
.pubs .pub-links {
  display: inline-flex; gap: 6px; flex-wrap: wrap;
  margin-left: 6px;
  vertical-align: 2px;
}
.pubs .pub-links a {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 7px;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  color: var(--ink-soft);
}
.pubs .pub-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(31, 58, 95, 0.05);
}
.pubs .badge {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 4px;
  vertical-align: 1px;
}
.badge.best { color: #6b1a4a; background: rgba(180, 50, 130, 0.10); }
.badge.oral { color: #4a5d2a; background: rgba(110, 130, 60, 0.12); }
.badge.toappear { color: var(--accent-hover); background: rgba(184, 85, 58, 0.1); }

/* ====== Teaching timeline ====== */
.semester-group { margin-bottom: 28px; }
.semester-group .year-label {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 72, "SOFT" 40;
  font-size: 28px; font-weight: 500;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: -0.015em;
}
.semester-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.course-card {
  background: var(--card-bg-2);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 16px 18px;
  transition: all .18s ease;
}
.course-card:hover {
  border-color: var(--accent);
  background: var(--card-bg);
  transform: translateY(-2px);
}
.course-card .term {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-hover);
  font-weight: 500;
  margin-bottom: 6px;
}
.course-card .code {
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 2px;
}
.course-card .name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  font-family: "DM Sans", sans-serif;
  line-height: 1.35;
}

/* ====== Openings page specials ====== */
.req-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}
.req-card {
  background: var(--card-bg-2);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 24px 26px;
}
.req-card h3 {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 36, "SOFT" 30;
  font-size: 19px; font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.req-card .subtitle {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-hover);
  margin-bottom: 14px;
}
.req-list { list-style: none; }
.req-list li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.5;
  position: relative;
  padding-left: 18px;
}
.req-list li::before {
  content: "·";
  position: absolute; left: 4px; top: 6px;
  color: var(--accent-hover);
  font-weight: bold;
  font-size: 16px;
}
.req-list li .plus {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--accent);
  background: rgba(31, 58, 95, 0.07);
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topic-list { list-style: none; margin: 16px 0; }
.topic-list li {
  padding: 10px 16px;
  margin-bottom: 8px;
  background: var(--card-bg-2);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  color: var(--ink-soft);
  font-size: 15px;
  transition: all .18s ease;
}
.topic-list li:hover {
  border-left-color: var(--accent-hover);
  background: var(--card-bg);
}

.steps { list-style: none; counter-reset: step; margin-top: 16px; }
.steps > li {
  position: relative;
  padding: 12px 0 12px 44px;
  border-bottom: 1px dashed var(--rule);
  color: var(--ink-soft);
  font-size: 14.5px;
  counter-increment: step;
}
.steps > li:last-child { border-bottom: none; }
.steps > li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute; left: 0; top: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: var(--accent);
  background: rgba(31, 58, 95, 0.07);
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.steps > li strong { color: var(--ink); font-weight: 500; }
.steps > li ul {
  list-style: none;
  margin-top: 8px;
  padding-left: 0;
}
.steps > li ul li {
  padding: 3px 0 3px 14px;
  position: relative;
  font-size: 13.5px;
}
.steps > li ul li::before {
  content: "›";
  position: absolute; left: 0;
  color: var(--accent-hover);
}

/* ====== Footer ====== */
footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px;
  font-family: "JetBrains Mono", monospace;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
footer a { color: var(--muted); font-family: inherit; }

/* ====== Mobile ====== */
@media (max-width: 860px) {
  .page {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 32px 24px 64px;
  }
  aside.sidebar {
    position: static;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px 24px;
    align-items: start;
  }
  .avatar, .avatar-img { width: 96px; height: 96px; margin-bottom: 0; font-size: 40px; }
  .name { font-size: 28px; }
  .title-block, .contact { grid-column: 1 / -1; margin-bottom: 16px; }
  nav.primary { grid-column: 1 / -1; }
  nav.primary ul { flex-direction: row; flex-wrap: wrap; gap: 6px 18px; }
  nav.primary a { padding: 4px 0; }
  nav.primary a:hover { padding-left: 0; }
  nav.primary a::before, nav.primary a.active::before { display: none; }
  .copyright { display: none; }
  .news > li { grid-template-columns: 1fr; gap: 4px; }
  .news .date { padding-top: 0; }
  h2.section-title { font-size: 24px; }
  .lede { font-size: 17px; }
  .interest-grid { grid-template-columns: 1fr; gap: 16px; }
  .project { grid-template-columns: 1fr; gap: 12px; }
  .project img { height: 180px; }
  .grants > li { grid-template-columns: 1fr; }
  .grants .amount { justify-self: start; }
  .req-grid { grid-template-columns: 1fr; }
  .semester-grid { grid-template-columns: 1fr; }
}