/* ===========================================================================
   Yang Ni — personal academic site
   Dark theme inspired by Sarah Jeffreson's homepage.
   Edit colors below in :root to retune the palette site-wide.
   =========================================================================== */

:root {
  /* === Active palette (light academic) ===
     Swap with one of the presets below and save — every page rethemes. */
  --bg:            #ffffff;         /* main background */
  --bg-sidebar:    #ffffff;         /* sidebar bg */
  --bg-card:       #ffffff;         /* publication / news card bg */
  --bg-card-hov:   #f4f4f0;         /* card hover */
  --bg-code:       #eef0ec;         /* inline code & pre blocks */
  --bg-thumb:      #f4f4f0;         /* publication thumbnail placeholder */
  --border:        #e2e2db;         /* subtle borders */
  --text:          #1a1a1c;         /* primary text */
  --text-dim:      #555a62;         /* secondary text */
  --text-faint:    #8a8f97;         /* tertiary / metadata */
  --accent:        #1f5fa5;         /* link / highlight (academic blue) */
  --accent-hov:    #2c79c8;
  --accent-warm:   #a96b1d;         /* second accent (rust, used sparingly) */
  --rule:          #e2e2db;
  --tint-accent:   rgba(31, 95, 165, 0.08);   /* faint accent wash for active states */
  --tint-warm:     rgba(169, 107, 29, 0.12);  /* faint warm wash for badges */
  --shadow-soft:   0 4px 16px rgba(0,0,0,0.06);

  /* === Dark theme preset (uncomment to switch) ===
  --bg:           #0e0f12;
  --bg-sidebar:   #15171b;
  --bg-card:      #1a1c20;
  --bg-card-hov:  #20232a;
  --bg-code:      #1c1f24;
  --bg-thumb:     #0a0b0d;
  --border:       #2a2d34;
  --text:         #d8dade;
  --text-dim:     #9ea4ad;
  --text-faint:   #6c727b;
  --accent:       #8ab4ff;
  --accent-hov:   #b0c9ff;
  --accent-warm:  #e2b873;
  --rule:         #2a2d34;
  --tint-accent:  rgba(138, 180, 255, 0.10);
  --tint-warm:    rgba(226, 184, 115, 0.12);
  --shadow-soft:  0 6px 22px rgba(0,0,0,0.35);
  */

  --sidebar-w:    220px;
  --content-pad:  60px;             /* horizontal padding inside main content */
  --content-max:  1000px;           /* max width of reading column */

  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display-italic: 'Newsreader', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hov); text-decoration: underline; }

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

hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.25; color: var(--text); }
h1 { font-size: 2.0rem; margin: 0 0 .4em; letter-spacing: -0.01em; }
h2 { font-size: 1.4rem; margin: 1.6em 0 .5em; letter-spacing: -0.005em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 .4em; }

p { margin: 0 0 1em; }

code, pre {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  background: var(--bg-code);
  border-radius: 4px;
  font-size: 0.92em;
}
code { padding: 1px 5px; }
pre  { padding: .9em 1em; overflow-x: auto; }

::selection { background: var(--tint-accent); }

/* =========================================================================
   Sidebar
   ========================================================================= */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 28px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 50;
  overflow-y: auto;
}

.sidebar__avatar-link { display: block; }
.sidebar__avatar {
  width: 130px; height: 130px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.sidebar__name {
  margin-top: 18px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
}
.sidebar__name a { color: var(--text); }
.sidebar__name a:hover { color: var(--accent-hov); text-decoration: none; }

.sidebar__role {
  font-size: 0.78rem;
  color: var(--text-faint);
  text-align: center;
  margin-top: 4px;
  line-height: 1.35;
}

.sidebar__nav {
  margin-top: 22px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.sidebar__navlink {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text-dim);
  font-size: 0.83rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 9px 12px;
  border-radius: 6px;
  margin: 1px 0;
}
.sidebar__navlink i { width: 16px; text-align: center; font-size: 0.95rem; }
.sidebar__navlink:hover {
  color: var(--text);
  background: var(--bg-card-hov);
  text-decoration: none;
}
.sidebar__navlink.is-active {
  color: var(--accent);
  background: var(--tint-accent);
}

.sidebar__socials {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.sidebar__socials a {
  color: var(--text-dim);
  font-size: 1.1rem;
}
.sidebar__socials a:hover { color: var(--accent); text-decoration: none; }

/* =========================================================================
   Main content
   ========================================================================= */
.content {
  margin-left: var(--sidebar-w);
  padding: 24px var(--content-pad) 80px;
  max-width: calc(var(--content-max) + 2 * var(--content-pad));
  min-height: 100vh;
}

.page-header { margin-bottom: 28px; }
.page-header__title {
  font-size: 2.1rem;
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}
.page-header__subtitle {
  color: var(--text-dim);
  margin: 0;
  font-size: 1.02rem;
}
.page-header__rule {
  width: 60px;
  margin: 18px 0 0;
  border-top: 2px solid var(--accent);
  opacity: 0.7;
}

.site-footer {
  margin-top: 80px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* =========================================================================
   Inline accents
   ========================================================================= */
.accent-italic {
  font-family: var(--font-display-italic);
  font-style: italic;
  color: var(--accent-warm);
}

.btn-row {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin: 16px 0 8px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 6px;
  transition: all .15s;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.btn--primary {
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================================================================
   Research highlights — large figures + abstract per featured paper
   ========================================================================= */
.highlight {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--rule);
}
.highlight:last-child { border-bottom: none; padding-bottom: 0; }

.highlight__figure {
  width: 100%;                  /* full column width, flush with the page (no frame) */
  height: auto;                 /* natural aspect ratio — no height cap */
}
.highlight__title {
  font-size: 1.45rem;
  margin: 26px 0 6px;
  letter-spacing: -0.01em;
}
.highlight__title a { color: var(--text); }
.highlight__title a:hover { color: var(--accent); text-decoration: none; }

.highlight__authors {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin: 0 0 4px;
}
.highlight__authors strong { color: var(--accent-warm); font-weight: 600; }

.highlight__venue {
  font-size: 0.88rem;
  color: var(--text-faint);
  margin: 0 0 16px;
}
.highlight__venue em { font-style: italic; }

.highlight__abstract {
  font-size: 1.0rem;
  color: var(--text);
  line-height: 1.7;
}
.highlight__abstract p:first-child { margin-top: 0; }
.highlight__abstract p:last-child { margin-bottom: 0; }

.highlight__links {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 16px;
  font-size: 0.88rem;
}
.highlight__links a {
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 5px;
  color: var(--text-dim);
}
.highlight__links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* =========================================================================
   Year groupings (Talks, News)
   ========================================================================= */
.year-group { margin-bottom: 36px; }
.year-group__heading {
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 14px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item__date {
  color: var(--text-faint);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.timeline-item__title {
  margin: 0 0 4px;
  font-size: 1.0rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}
.timeline-item__meta {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.timeline-item__type {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  background: var(--tint-accent);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-right: 8px;
  vertical-align: middle;
}

/* News-card variant for the home page snippet */
.news-mini {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 0; border-bottom: 1px solid var(--rule);
}
.news-mini:last-child { border-bottom: none; }
.news-mini__date {
  color: var(--text-faint); font-size: 0.78rem;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.news-mini__body { color: var(--text); font-size: 0.95rem; }
.news-mini__body p { margin: 0; }

/* =========================================================================
   Contact page
   ========================================================================= */
.contact-list {
  list-style: none; padding: 0; margin: 0;
}
.contact-list li {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.0rem;
}
.contact-list li:last-child { border-bottom: none; }
.contact-list i {
  width: 22px; text-align: center; color: var(--accent);
  font-size: 1.1rem;
}

/* =========================================================================
   Research interests — simple bulleted list (no boxes)
   ========================================================================= */
.interests-list {
  margin: 10px 0 0;
  padding-left: 1.4em;
}
.interests-list li {
  margin-bottom: 9px;
  line-height: 1.6;
  color: var(--text);
}
.interests-list li::marker { color: var(--text-faint); }

/* =========================================================================
   Responsive: collapse sidebar to top bar on narrow screens
   ========================================================================= */
@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 16px;
    gap: 12px;
    overflow-y: visible;
  }
  .sidebar__avatar { width: 56px; height: 56px; }
  .sidebar__name { margin-top: 0; font-size: 1.0rem; }
  .sidebar__role { display: none; }
  .sidebar__nav {
    margin-top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    flex: 1;
  }
  .sidebar__navlink {
    padding: 6px 10px;
    font-size: 0.74rem;
  }
  .sidebar__navlink span { display: none; }   /* show icons only */
  .sidebar__navlink i { font-size: 1.05rem; }
  .sidebar__socials {
    margin-top: 0; padding-top: 0;
    width: 100%; justify-content: flex-start;
  }

  .content {
    margin-left: 0;
    padding: 36px 24px 60px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* =========================================================================
   Single-page sections + scroll behaviour
   ========================================================================= */
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 24px; }

.page-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.section-title {
  font-size: 1.9rem;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
.section-title::after {
  content: "";
  display: block;
  width: 60px;
  margin-top: 12px;
  border-top: 2px solid var(--accent);
  opacity: 0.7;
}
.section-lede {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin: 8px 0 14px;
}
.interests-lead { margin: 1.1em 0 4px; }

/* Landing (About) name heading */
.page-name { font-size: 2.4rem; letter-spacing: -0.02em; margin: 0 0 14px; }

/* Clean publications list (Minghao-Guo style) */
.pub-group-title {
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 30px 0 10px;
}
.pub-clean { margin: 0 0 8px; padding-left: 1.5em; }
.pub-clean li { margin-bottom: 15px; padding-left: 4px; }
.pub-clean li::marker { color: var(--text-faint); font-size: 0.9rem; }
.pub-line { line-height: 1.6; font-size: 0.95rem; }
.pub-line__authors { color: var(--text); }
.pub-line__authors strong { color: var(--accent-warm); font-weight: 600; }
.pub-line__title { color: var(--text); font-weight: 600; }
.pub-line__title:hover { color: var(--accent); text-decoration: none; }
.pub-line__venue { color: var(--text-dim); }
.pub-line__venue em { font-style: italic; }
.pub-line__links { font-size: 0.85rem; white-space: nowrap; }
.pub-line__links a {
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  margin-left: 2px;
}
.pub-line__links a:hover { border-color: var(--accent); text-decoration: none; }
