/* =============================================================
 * Peizhong (Chill) Gao — personal site
 * One font. Monochrome gray palette. No accent colors.
 * ============================================================= */

:root {
  --bg:            #ffffff;
  --bg-soft:       #fafafa;
  --bg-mute:       #f1f1ee;
  --bg-deep:       #e7e6e0;
  --text:          #161616;
  --text-body:     #232323;
  --text-dim:      #555555;
  --text-faint:    #888888;
  --border:        #e2e2dd;
  --border-strong: #c3c2bb;

  --ff:    "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --page-max:   1200px;
  --sidebar-w:  280px;
  --header-h:   56px;
  --gap:        clamp(1.4rem, 2.5vw, 2.2rem);
  --px:         clamp(1rem, 2.2vw, 1.6rem);
  --radius:     4px;
}

html[data-theme="dark"] {
  --bg:            #0e0e0f;
  --bg-soft:       #151516;
  --bg-mute:       #1c1c1d;
  --bg-deep:       #222224;
  --text:          #ededec;
  --text-body:     #d6d6d4;
  --text-dim:      #a1a19d;
  --text-faint:    #70706d;
  --border:        #2a2a2c;
  --border-strong: #3c3c3f;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 10px); }
body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

body {
  margin: 0;
  font-family: var(--ff);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--text); color: var(--bg); }

b, strong { font-weight: 600; color: var(--text); }
em { font-style: normal; }     /* disable italics everywhere */

.skip-link {
  position: absolute; top: -40px; left: 12px; z-index: 100;
  background: var(--text); color: var(--bg); padding: 6px 10px;
  text-decoration: none; border-radius: 3px;
}
.skip-link:focus { top: 10px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--px);
  height: var(--header-h);
  display: flex; align-items: center; gap: 1.2rem;
}
.home-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  margin-right: auto;
  font-size: 0.96rem;
}
.nav-primary { display: flex; gap: 1.3rem; font-size: 0.92rem; }
.nav-primary a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1.5px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-primary a:hover,
.nav-primary a.is-active {
  color: var(--text);
  border-bottom-color: var(--text);
}
@media (max-width: 880px) { .nav-primary { gap: 0.9rem; font-size: 0.88rem; } }
@media (max-width: 720px) { .nav-primary { display: none; } }

.header-tools { display: flex; align-items: center; gap: 8px; }
.lang-toggle, .theme-toggle {
  width: auto; min-width: 36px; height: 32px;
  padding: 0 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.lang-toggle:hover, .theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-mute);
}
.theme-toggle { width: 32px; padding: 0; font-size: 0.95rem; }
.theme-toggle .tt-dark { display: none; }
html[data-theme="dark"] .theme-toggle .tt-light { display: none; }
html[data-theme="dark"] .theme-toggle .tt-dark  { display: inline; }

/* Page layout */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1.6rem var(--px) 3rem;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
@media (max-width: 960px) {
  .page { grid-template-columns: 1fr; }
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 0.8rem);
  align-self: start;
}
@media (max-width: 960px) {
  .sidebar { position: static; margin-bottom: 1rem; }
}

.avatar {
  width: 176px;
  height: 176px;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
  border: 1px solid var(--border);
}

.profile-name {
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.profile-affil {
  font-size: 0.87rem;
  color: var(--text-body);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 0.9rem;
}

/* Stats + Incoming — identical box style for visual consistency */
.profile-stats,
.profile-incoming {
  padding: 0.7rem 0.8rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.85rem;
}
.profile-stats { padding: 0.7rem 0.3rem 0.55rem; }
.ps-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  text-align: center;
}
.ps-list li {
  display: flex; flex-direction: column; gap: 1px;
  padding: 0 4px;
  position: relative;
}
.ps-list li + li::before {
  content: "";
  position: absolute; left: 0; top: 15%; bottom: 15%;
  width: 1px;
  background: var(--border-strong);
}
.ps-num {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ps-cap {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 3px;
  text-transform: lowercase;
}
.ps-src {
  font-size: 0.7rem;
  text-align: center;
  color: var(--text-faint);
  margin-top: 0.45rem;
  letter-spacing: 0.02em;
}

.profile-incoming {
  font-size: 0.83rem;
  text-align: center;
  line-height: 1.5;
  color: var(--text-body);
}

/* Contact grid: 3 × 2 stacked cards — icon on top, label below */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 0.6rem;
}
.contact-grid > li > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 14px 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  color: var(--text-body);
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg);
  min-height: 74px;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}
.contact-grid > li > a:hover {
  background: var(--bg-mute);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.contact-grid > li > a > svg {
  width: 22px; height: 22px;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: color 0.15s;
}
.contact-grid > li > a:hover > svg { color: var(--text); }

/* Location line — small, centered below the grid */
.sidebar-loc {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 0.9rem;
  margin-top: 0;
}
.sidebar-loc svg { color: var(--text-dim); }

.profile-interests {
  margin-top: 0.2rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}
.pi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.35rem;
  font-weight: 600;
}
.pi-body {
  font-size: 0.82rem;
  color: var(--text-body);
  line-height: 1.55;
}

/* Main content */
.content { min-width: 0; }

.section { margin-bottom: 2.4rem; }
.section h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.sec-sub {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-top: -0.4rem;
  margin-bottom: 1.1rem;
}
.sec-sub a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* About */
#about p { margin-bottom: 0.9rem; color: var(--text-body); }
#about p:last-child { margin-bottom: 0; }
#about a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  transition: text-decoration-color 0.2s;
}
#about a:hover { text-decoration-color: var(--text); }
.about-close {
  color: var(--text-dim);
  padding-left: 0.95rem;
  border-left: 2px solid var(--border-strong);
  margin-top: 1rem !important;
}

/* News */
.news {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.25rem 0.8rem 0.25rem 0.9rem;
  border-left: 1px solid var(--border);
  scrollbar-width: thin;
  display: flex; flex-direction: column; gap: 0.55rem;
}
.news::-webkit-scrollbar { width: 5px; }
.news::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
.news li {
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--text-body);
}
.ndate {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg-mute);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 3px;
  margin-right: 5px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.news li a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--border-strong);
}
.news li a:hover { text-decoration-color: var(--text); }

/* Impact widget */
.impact {
  margin-bottom: 1.4rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.impact-head-line {
  display: flex; justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.7rem;
}
.impact-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text);
  font-weight: 600;
}
.impact-status {
  font-size: 0.72rem;
  color: var(--text-faint);
}
.impact-status.is-live { color: var(--text); }
.impact-bars {
  display: flex; flex-direction: column; gap: 0.4rem;
}
.impact-bar-row {
  display: grid;
  grid-template-columns: 48px 1fr 54px;
  gap: 0.55rem;
  align-items: center;
  font-size: 0.82rem;
}
.impact-bar-year { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.impact-bar-row.is-current .impact-bar-year { color: var(--text); font-weight: 600; }
.impact-bar-track {
  height: 8px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.impact-bar-fill {
  display: block; height: 100%;
  background: var(--text-dim);
  width: 0;
  transition: width 0.9s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.impact-bar-row.is-current .impact-bar-fill { background: var(--text); }
.impact-bar-count {
  font-size: 0.82rem;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.impact-note {
  margin-top: 0.6rem;
  font-size: 0.73rem;
  color: var(--text-faint);
}

/* Publications — scrollable inner container, same style family as .news */
.pub-list {
  display: flex;
  flex-direction: column;
  max-height: 620px;
  overflow-y: auto;
  padding: 0.15rem 0.9rem 0.4rem 0.95rem;
  border-left: 1px solid var(--border);
  scrollbar-width: thin;
}
.pub-list::-webkit-scrollbar { width: 5px; }
.pub-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

.pub {
  display: grid;
  grid-template-columns: 115px 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}
.pub:first-child { border-top: 0; padding-top: 0.3rem; }

.pub-venue {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 4px 8px;
  background: var(--bg-mute);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  text-align: center;
  align-self: flex-start;
  white-space: nowrap;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.pub-body { min-width: 0; }
.pub-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.2rem;
}
.pub-title a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
  transition: border-color 0.2s;
}
.pub-title a:hover { border-bottom-color: var(--text); }
.pub-authors {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.55;
  margin-bottom: 0.25rem;
}
.pub-cite {
  color: var(--text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.pub-note {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.55;
  margin-top: 0.2rem;
}
.pub-links {
  font-size: 0.82rem;
  margin-top: 0.4rem;
}
.pub-links a {
  color: var(--text-dim);
  text-decoration: none;
  margin-right: 6px;
  transition: color 0.15s;
}
.pub-links a:hover { color: var(--text); }
@media (max-width: 620px) {
  .pub { grid-template-columns: 1fr; gap: 0.4rem; }
  .pub-venue { justify-self: start; }
}

/* Experience */
.exp { display: flex; flex-direction: column; gap: 0.8rem; }
.exp li {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-left: 2px solid var(--text-dim);
  background: var(--bg-soft);
  border-radius: var(--radius);
}
.exp-dates {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0.25rem;
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.exp-tag {
  display: inline-block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 1px 7px;
  background: var(--bg-mute);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-left: 4px;
  font-weight: 600;
}
.exp-role {
  font-size: 0.93rem;
  color: var(--text-body);
  line-height: 1.5;
}

/* Honors */
.honors {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding-left: 1rem;
}
.honors li {
  position: relative;
  font-size: 0.93rem;
  color: var(--text-body);
  line-height: 1.55;
}
.honors li::before {
  content: "·";
  position: absolute;
  left: -0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* Education */
.edu { display: flex; flex-direction: column; gap: 0.55rem; }
.edu li {
  font-size: 0.93rem;
  color: var(--text-body);
  line-height: 1.55;
}
.edu-date {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-right: 0.4rem;
  font-variant-numeric: tabular-nums;
}
.edu-sub {
  font-size: 0.85rem;
  color: var(--text-dim);
  padding-left: 0.9rem;
  border-left: 1px solid var(--border);
  margin-top: 0.25rem;
  margin-left: 0.3rem;
}

/* Skills */
.skills-line {
  font-size: 0.93rem;
  color: var(--text-body);
  margin-bottom: 0.5rem;
}
.skills-line:last-child { margin-bottom: 0; }

/* Contact */
#contact p { color: var(--text-body); margin-bottom: 0.5rem; }
#contact a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Footer */
.site-footer {
  margin-top: 2.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: 0.83rem;
  color: var(--text-faint);
}

/* Motion */
.reveal { opacity: 0; transform: translateY(8px); transition: opacity 0.45s, transform 0.45s; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; transition: none !important; }
}
