/* ==========================================================================
   Bowen Cui — Academic Site
   Ported 1:1 from the claude.ai/design project "英文学术网站雏形"
   (Bowen Cui - Academic Site.dc.html). Purple academic style, light default
   with a dark theme via html[data-theme="dark"].
   ========================================================================== */

:root {
  --bg: #fcfbf9;
  --surface: #ffffff;
  --sunken: #f4f4f6;
  --soft: #f6f1fa;
  --ink: #1a1a1f;
  --muted: #51515b;
  --subtle: #8d8d96;
  --border: #e6e6ea;
  --border-strong: #d2d2d7;
  --accent: #68448b;
  --accent-strong: #4f3573;
  --chip-bg: #ece3f3;
  --chip-ink: #3e2960;
  --primary: #68448b;
  --primary-hover: #4f3573;
  --on-primary: #ffffff;
  --shadow: 0 4px 12px rgba(42, 27, 58, 0.08), 0 1px 3px rgba(42, 27, 58, 0.05);
}
html[data-theme="dark"] {
  --bg: #17141d;
  --surface: #1f1b27;
  --sunken: #241f2e;
  --soft: #261f33;
  --ink: #ece9f2;
  --muted: #b3acc0;
  --subtle: #8b8496;
  --border: #322c3f;
  --border-strong: #443c54;
  --accent: #b59ec6;
  --accent-strong: #d6c6e2;
  --chip-bg: #332947;
  --chip-ink: #d6c6e2;
  --primary: #7d56a3;
  --primary-hover: #916ba4;
  --on-primary: #ffffff;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

html { scroll-behavior: auto; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Source Sans 3', system-ui, sans-serif;
  transition: background 200ms cubic-bezier(0.2, 0.6, 0.2, 1), color 200ms cubic-bezier(0.2, 0.6, 0.2, 1);
  -webkit-font-smoothing: antialiased;
}

/* ---- Side-gutter PTX rain canvases ---- */
.side-rain {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 0;
  pointer-events: none;
  z-index: 0;
}
.side-rain.left { left: 0; }
.side-rain.right { right: 0; }

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Header
   ========================================================================== */

.bc-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.hdr-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  cursor: pointer;
  padding: 14px 0;
}
.brand img { width: 26px; height: 26px; display: block; }
.brand-name {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-weight: 600;
  font-size: 19px;
  color: var(--ink);
  white-space: nowrap;
}
.brand-divider { width: 1px; height: 16px; background: var(--border-strong); }
.brand-role {
  font-family: 'Source Code Pro', monospace;
  font-size: 12.5px;
  color: var(--subtle);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hdr-right { display: flex; align-items: center; gap: 20px; }

.bc-nav { display: flex; align-items: center; gap: 24px; }
.bc-nav a {
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  padding: 20px 1px;
  color: var(--muted);
  box-shadow: inset 0 -2px 0 transparent;
  cursor: pointer;
  transition: color 120ms;
}
.bc-nav a:hover { color: var(--accent); }
.bc-nav a.active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.theme-btn {
  font-family: 'Source Code Pro', monospace;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 120ms;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

.menu-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 2px;
}
.menu-btn span {
  width: 22px;
  height: 2px;
  background: var(--ink);
  display: block;
  border-radius: 2px;
}

.mobile-nav {
  display: none;
  border-top: 1px solid var(--border);
  padding: 6px 20px 14px;
  flex-direction: column;
}
.mobile-nav a {
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  padding: 13px 4px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.mobile-nav a.active { color: var(--accent); }
.mobile-nav.open { display: flex; }

/* ==========================================================================
   Main / footer
   ========================================================================== */

.main-wrap {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 56px 40px 88px;
}

.bc-footer { border-top: 1px solid var(--border); }
.bc-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.bc-footer-copy { font-size: 13.5px; color: var(--subtle); }
.bc-footer-updated {
  font-family: 'Source Code Pro', monospace;
  font-size: 12px;
  color: var(--subtle);
}

/* ==========================================================================
   Shared primitives
   ========================================================================== */

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 18px;
}
.section-row .eyebrow { white-space: nowrap; }
.section-row .rule { flex: 1; height: 1px; background: var(--border); }
.section-row .section-note {
  font-family: 'Source Code Pro', monospace;
  font-size: 12.5px;
  color: var(--subtle);
  white-space: nowrap;
}

.page-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 26px;
  margin-bottom: 8px;
}
.page-head h1 {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-weight: 700;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 10px 0 0;
  color: var(--ink);
}
.page-head--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.ph-note {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-style: italic;
  font-size: 15px;
  color: var(--subtle);
  margin: 16px 0 0;
}

a.text-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a.text-link:hover { color: var(--accent-strong); }

.chip {
  font-family: 'Source Code Pro', monospace;
  font-size: 11.5px;
  background: var(--chip-bg);
  color: var(--chip-ink);
  padding: 2px 8px;
  border-radius: 3px;
  white-space: nowrap;
}

.btn-primary {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--on-primary);
  background: var(--primary);
  border: none;
  border-radius: 4px;
  padding: 10px 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms;
  text-decoration: none;
  display: inline-block;
}
.btn-primary:hover { background: var(--primary-hover); }

/* ==========================================================================
   Home
   ========================================================================== */

.home-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 64px;
  align-items: start;
}

.home-aside { display: flex; flex-direction: column; gap: 20px; }
.home-aside .portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: block;
}
.contact-label {
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 8px;
}
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.contact-list .plain { font-size: 14.5px; color: var(--muted); }
.contact-list a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  width: fit-content;
}
.contact-list a:hover { text-decoration: underline; color: var(--accent-strong); }

.home-main { min-width: 0; }
.home-main h1 {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-weight: 700;
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 12px 0 18px;
  color: var(--ink);
}
.home-lead {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-style: italic;
  font-size: 21px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 18px;
  max-width: 640px;
}
.home-bio {
  font-size: 16.5px;
  line-height: 1.6;
  margin: 0;
  max-width: 680px;
  color: var(--ink);
}

.home-section { margin-top: 52px; }
.section-row.tight { margin: 52px 0 18px; }

.interest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.interest-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 18px 20px;
  transition: border-color 120ms, box-shadow 120ms;
}
.interest-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.interest-card .t { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.interest-card .d { font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---- GitHub contribution graph ---- */
.gh-box {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px 20px;
}
.gh-scroll { overflow-x: auto; padding-bottom: 6px; }
.gh-inner { display: inline-flex; flex-direction: column; gap: 6px; }
.gh-months { display: flex; gap: 3px; height: 13px; }
.gh-month { width: 11px; position: relative; }
.gh-month span {
  position: absolute;
  left: 0;
  top: 0;
  font-family: 'Source Code Pro', monospace;
  font-size: 10px;
  color: var(--subtle);
  white-space: nowrap;
}
.gh-weeks { display: flex; gap: 3px; }
.gh-week { display: flex; flex-direction: column; gap: 3px; }
.gh-cell { width: 11px; height: 11px; border-radius: 2px; }
.gh-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.gh-foot .gh-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.gh-foot .gh-link:hover { text-decoration: underline; color: var(--accent-strong); }
.gh-legend { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.gh-legend .lbl { font-size: 11px; color: var(--subtle); }
.gh-note {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 18px 20px;
  max-width: 560px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
}
.gh-note strong { color: var(--ink); }
.gh-note a { color: var(--accent); }
.gh-loading {
  font-family: 'Source Code Pro', monospace;
  font-size: 13px;
  color: var(--subtle);
  padding: 8px 0;
}
.gh-error { font-size: 14px; color: var(--muted); padding: 8px 0; }
.gh-error a { color: var(--accent); }

/* ---- Home lower: news + selected publications ---- */
.home-lower {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 48px;
  margin-top: 52px;
  align-items: start;
}
.home-lower > div { min-width: 0; }

.news-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-left: 1px solid var(--border);
  padding-left: 20px;
}
.news-item { position: relative; }
.news-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.news-date {
  font-family: 'Source Code Pro', monospace;
  font-size: 12.5px;
  color: var(--subtle);
  margin-bottom: 2px;
}
.news-text { font-size: 14.5px; line-height: 1.5; color: var(--ink); }
.news-text a { color: var(--accent); }

.selpub-list { display: flex; flex-direction: column; gap: 20px; }
.selpub { display: flex; flex-direction: column; gap: 5px; }
.selpub .t {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
}
a.selpub-t:hover { color: var(--accent); }
.selpub .a { font-size: 13.5px; color: var(--muted); }
.selpub .m { display: flex; align-items: center; gap: 8px; }
.selpub .y {
  font-family: 'Source Code Pro', monospace;
  font-size: 11.5px;
  color: var(--subtle);
}
.view-all {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  width: fit-content;
}
.view-all:hover { text-decoration: underline; }

/* ==========================================================================
   Publications page
   ========================================================================== */

.pub-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.pub-filter {
  font-family: 'Source Code Pro', monospace;
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  transition: all 120ms;
}
.pub-filter.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-primary);
}

.pub-group { margin-top: 36px; }
.pub-year-label {
  font-family: 'Source Code Pro', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--subtle);
  margin-bottom: 20px;
}
.pub-items { display: flex; flex-direction: column; gap: 26px; }
.pub-entry { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.pub-entry .t {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-weight: 600;
  font-size: 19px;
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
}
a.pub-entry-t:hover { color: var(--accent); }
.pub-entry .a { font-size: 14.5px; color: var(--muted); }
.pub-entry .m { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pub-link {
  font-family: 'Source Code Pro', monospace;
  font-size: 11.5px;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: all 120ms;
  background: none;
  cursor: pointer;
}
.pub-link:hover { background: var(--soft); border-color: var(--border-strong); }
.bib-btn.copied { color: var(--accent-strong); border-color: var(--accent); }

/* ==========================================================================
   Talks / Teaching / Blog — date rows
   ========================================================================== */

.row-list { display: flex; flex-direction: column; margin-top: 28px; max-width: 820px; }
.date-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.date-row .d {
  font-family: 'Source Code Pro', monospace;
  font-size: 13px;
  color: var(--subtle);
  padding-top: 3px;
}
.date-row .t {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 4px;
}
a.date-row-t { text-decoration: none; font-size: 19px; }
a.date-row-t:hover { color: var(--accent); }
.date-row .v { font-size: 14.5px; color: var(--muted); }
.date-row .x { font-size: 14.5px; line-height: 1.5; color: var(--muted); margin-top: 5px; }

/* ==========================================================================
   Portfolio
   ========================================================================== */

.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 28px;
}
.proj-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 120ms, box-shadow 120ms;
}
.proj-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.proj-card .t { font-size: 17px; font-weight: 600; color: var(--ink); }
.proj-card .d { font-size: 14.5px; line-height: 1.5; color: var(--muted); flex: 1; }
.proj-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.proj-tag {
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 7px;
}

/* ==========================================================================
   CV
   ========================================================================== */

.cv-wrap { max-width: 820px; }
.cv-section-row { display: flex; align-items: baseline; gap: 14px; margin: 36px 0 6px; }
.cv-section-row.skills { margin: 42px 0 16px; }
.cv-section-row.later { margin: 42px 0 6px; }
.cv-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}
.cv-row .t {
  font-family: 'Source Serif Pro', Georgia, serif;
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 3px;
}
.cv-row .s { font-size: 14.5px; color: var(--muted); }
.cv-row .y {
  font-family: 'Source Code Pro', monospace;
  font-size: 13px;
  color: var(--subtle);
}
.skill-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.skill-chip {
  font-family: 'Source Code Pro', monospace;
  font-size: 12.5px;
  color: var(--chip-ink);
  background: var(--chip-bg);
  border-radius: 3px;
  padding: 3px 10px;
}

/* ==========================================================================
   Responsive & print — from the design
   ========================================================================== */

@media (max-width: 820px) {
  .hdr-inner { padding-left: 20px; padding-right: 20px; }
  .main-wrap { padding: 36px 20px 64px; }
  .home-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .home-aside { max-width: 340px; }
  .home-lower { grid-template-columns: 1fr !important; gap: 40px !important; }
  .bc-nav { display: none; }
  .menu-btn { display: flex; }
}

@media print {
  .side-rain, header, footer, .no-print { display: none !important; }
  .main-wrap { padding: 0 !important; max-width: 100% !important; }
  body { background: #ffffff !important; color: #111111 !important; }
  a { color: #111111 !important; }
  @page { margin: 1.6cm; }
}
