/* =========================================================
   Lingguo (Lin) Xu — Academic Website
   ========================================================= */

:root {
  --dark:    #0f1b2d;
  --dark2:   #1a2e4a;
  --accent:  #c4993a;
  --blue:    #2d6cbe;
  --bg:      #f8f7f3;
  --bg2:     #eeecea;
  --text:    #1a1a24;
  --muted:   #64748b;
  --border:  #ddd9d2;
  --card:    #ffffff;
  --font-serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --font-sans:  'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono:  'IBM Plex Mono', 'Courier New', monospace;
  --sidebar: 20vw;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-serif); line-height: 1.2; }
h1 { font-size: 3rem; font-weight: 700; }
h2 { font-size: 1.9rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1.05rem; font-weight: 600; }

/* ── Layout ─────────────────────────────────────────────── */
.site-wrap { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar);
  background: var(--dark);
  color: #fff;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 2.75rem 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* ── Construction banner ───────────────────────────────── */
.construction-banner {
  background: #fff8e6;
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  color: var(--text);
  font-size: .85rem;
  padding: .7rem 1.1rem;
  margin: 1.5rem 1.75rem 0;
  font-family: var(--font-sans);
  line-height: 1.5;
}
.construction-banner strong {
  color: #8a6722;
  font-weight: 600;
}

.profile-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dark2) 0%, var(--accent) 100%);
  border: 2px solid rgba(196,153,58,.5);
  margin: 0 auto 1.4rem;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 2.2rem; font-weight: 700;
  color: #fff; letter-spacing: -.02em;
  object-fit: cover;
  display: block;
}

.sb-name {
  font-family: var(--font-serif);
  font-size: 1.35rem; font-weight: 700;
  text-align: center; color: #fff;
  margin-bottom: .25rem;
}
.sb-role {
  font-size: .78rem; color: rgba(255,255,255,.55);
  text-align: center; line-height: 1.4; margin-bottom: .15rem;
}
.sb-inst {
  font-size: .75rem; color: var(--accent);
  text-align: center; margin-bottom: 1.6rem;
}

.sb-divider {
  border: none; border-top: 1px solid rgba(255,255,255,.1);
  margin: 0 0 1.4rem;
}

.sb-contact { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1.6rem; }
.sb-contact a {
  color: rgba(255,255,255,.6); font-size: .78rem;
  display: flex; align-items: center; gap: .55rem;
  transition: color .2s;
}
.sb-contact a:hover { color: var(--accent); text-decoration: none; }
.sb-contact .ic {
  width: 16px; text-align: center;
  opacity: .7; font-size: .8rem;
}

.sb-nav-label {
  font-size: .65rem; text-transform: uppercase;
  letter-spacing: .14em; color: rgba(255,255,255,.3);
  font-family: var(--font-mono);
  margin-bottom: .65rem;
}

.sb-nav { list-style: none; }
.sb-nav li a {
  display: block;
  padding: .4rem 0 .4rem .85rem;
  color: rgba(255,255,255,.55);
  font-size: .82rem;
  border-left: 2px solid transparent;
  transition: color .18s, border-color .18s;
}
.sb-nav li a:hover,
.sb-nav li a.active {
  color: #fff;
  border-left-color: var(--accent);
  text-decoration: none;
}

.sb-spacer { flex: 1; }

.sb-pages {
  list-style: none;
  border-top: 1px solid rgba(255,255,255,.1);
  padding-top: 1.2rem;
  margin-top: 1rem;
}
.sb-pages li a {
  display: block;
  padding: .5rem .85rem;
  color: rgba(255,255,255,.65);
  font-size: .82rem;
  border-radius: 4px;
  transition: background .18s, color .18s;
}
.sb-pages li a:hover,
.sb-pages li a.active {
  background: rgba(196,153,58,.15);
  color: var(--accent);
  text-decoration: none;
}

/* ── Main content ────────────────────────────────────────── */
.main { margin-left: var(--sidebar); flex: 1; }

/* ── Section base ────────────────────────────────────────── */
.sec {
  padding: 5rem 8% 4rem;
  max-width: 880px;
}

.sec.alt-bg {
  background: var(--bg2);
  max-width: none;
  padding-right: 0;
}
.sec.alt-bg .sec-inner { max-width: 880px; padding-right: 8%; }

.sec-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: .4rem;
}

.sec-heading {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--dark);
  margin-bottom: 2rem;
}
.sec-heading::after {
  content: '';
  display: block;
  width: 36px; height: 3px;
  background: var(--accent);
  margin-top: .5rem;
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  background: var(--dark);
  padding: 5.5rem 8% 5rem;
  max-width: none;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--accent);
  letter-spacing: .08em;
  margin-bottom: 1rem;
}

.hero h1 { color: #fff; font-size: 3.4rem; margin-bottom: .4rem; }
.hero-sub { color: rgba(255,255,255,.65); font-size: 1.1rem; margin-bottom: .25rem; }
.hero-inst {
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--accent);
  margin-bottom: 2.2rem;
}

.tag-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  display: inline-block;
  border: 1px solid rgba(196,153,58,.5);
  background: rgba(196,153,58,.08);
  color: rgba(196,153,58,.9);
  padding: .28rem .85rem;
  border-radius: 2rem;
  font-size: .8rem;
}

/* ── News ────────────────────────────────────────────────── */
.news-list { list-style: none; }
.news-item {
  display: flex; gap: 1.5rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.news-date {
  flex-shrink: 0; width: 76px;
  font-family: var(--font-mono); font-size: .72rem;
  color: var(--muted); padding-top: .15rem;
}
.news-body { font-size: .92rem; line-height: 1.55; }

.badge {
  display: inline-block;
  padding: .12rem .55rem;
  border-radius: 2rem;
  font-size: .67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  vertical-align: middle;
  margin-right: .3rem;
}
.badge-green  { background: rgba(34,197,94,.1); color: #15803d; border: 1px solid #15803d; }
.badge-amber  { background: rgba(196,153,58,.1); color: var(--accent); border: 1px solid var(--accent); }
.badge-blue   { background: rgba(45,108,190,.1); color: var(--blue); border: 1px solid var(--blue); }

/* ── Timeline ────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: ''; position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.tl-item { position: relative; margin-bottom: 2rem; }
.tl-item::before {
  content: ''; position: absolute;
  left: -1.78rem; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}
.tl-year {
  font-family: var(--font-mono); font-size: .73rem;
  color: var(--muted); margin-bottom: .2rem;
}
.tl-title {
  font-family: var(--font-serif); font-size: 1.1rem;
  font-weight: 600; color: var(--dark);
}
.tl-org { font-size: .88rem; color: var(--blue); }
.tl-detail { font-size: .83rem; color: var(--muted); margin-top: .2rem; line-height: 1.5; }

/* ── Research tags ───────────────────────────────────────── */
.rtags { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: 1.75rem; }
.rtag {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .35rem .85rem;
  border-radius: 2rem;
  font-size: .83rem;
  cursor: default;
  transition: border-color .2s, color .2s;
}
.rtag:hover { border-color: var(--accent); color: var(--accent); }

/* ── Paper cards ─────────────────────────────────────────── */
.paper-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.15rem;
  transition: box-shadow .22s, transform .22s;
}
.paper-card:hover {
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
  transform: translateY(-1px);
}
.paper-meta {
  font-family: var(--font-mono); font-size: .69rem;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin-bottom: .5rem;
}
.paper-title {
  font-family: var(--font-serif); font-size: 1.1rem;
  font-weight: 600; color: var(--dark);
  line-height: 1.3; margin-bottom: .4rem;
}
.paper-authors { font-size: .83rem; color: var(--muted); margin-bottom: .9rem; }

.paper-abstract {
  display: none;
  font-size: .875rem; color: var(--muted);
  line-height: 1.65; margin-top: .9rem;
  padding-top: .9rem;
  border-top: 1px solid var(--border);
}
.paper-abstract.open { display: block; }

.link-row { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }
.lnk {
  font-size: .78rem; font-weight: 500;
  padding: .25rem .8rem;
  border-radius: 2rem;
  transition: all .2s;
  cursor: pointer;
  display: inline-block;
}
.lnk-pdf {
  background: var(--dark); color: #fff;
}
.lnk-pdf:hover { background: var(--blue); text-decoration: none; color: #fff; }
.lnk-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.lnk-ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ── Teaching table ──────────────────────────────────────── */
.t-table { width: 100%; border-collapse: collapse; }
.t-table th {
  text-align: left; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-family: var(--font-mono);
  border-bottom: 2px solid var(--border);
  padding: .5rem .75rem; font-weight: 500;
}
.t-table td {
  padding: .7rem .75rem;
  border-bottom: 1px solid var(--border);
  font-size: .88rem; vertical-align: top;
}
.t-table tr:last-child td { border-bottom: none; }
.t-sub-head {
  font-family: var(--font-mono); font-size: .75rem;
  color: var(--muted); margin: 2rem 0 1rem;
}

/* ── Skills ──────────────────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 1.15rem;
}
.skill-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 1.2rem;
}
.skill-box-label {
  font-size: .7rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--accent);
  font-weight: 600; margin-bottom: .7rem;
  font-family: var(--font-mono);
}
.skill-list {
  list-style: none; font-size: .86rem;
  color: var(--text); line-height: 1.85;
}
.skill-list li::before {
  content: '›'; margin-right: .4rem; color: var(--accent);
}

/* ── Stat grid ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem; margin-bottom: 2.25rem;
}
.stat-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.35rem;
  text-align: center;
}
.stat-num {
  font-family: var(--font-serif); font-size: 2.4rem;
  font-weight: 700; color: var(--dark); line-height: 1;
  margin-bottom: .3rem;
}
.stat-label {
  font-size: .72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .7rem 1.85rem;
  border-radius: 4px; font-size: .9rem;
  font-weight: 600; font-family: var(--font-sans);
  transition: all .2s; cursor: pointer;
}
.btn-dark  { background: var(--dark); color: #fff; }
.btn-dark:hover { background: var(--blue); text-decoration: none; color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--dark); color: var(--dark);
}
.btn-outline:hover { background: var(--dark); color: #fff; text-decoration: none; }

.btn-row { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Experiment card ─────────────────────────────────────── */
.exp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 1.6rem;
  margin-bottom: 1.25rem;
}
.exp-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .4rem; }
.exp-meta { font-family: var(--font-mono); font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.exp-title { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 600; color: var(--dark); margin-bottom: .9rem; }
.exp-desc { font-size: .9rem; color: var(--muted); line-height: 1.65; margin-bottom: 1rem; }
.exp-tech {
  font-family: var(--font-mono); font-size: .76rem;
  color: var(--muted); background: var(--bg2);
  padding: .65rem 1rem; border-radius: 4px;
  margin-bottom: 1rem; line-height: 1.8;
}

/* ── CV page ─────────────────────────────────────────────── */
.cv-doc {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3.5rem 4rem;
  max-width: 780px;
  box-shadow: 0 2px 20px rgba(0,0,0,.06);
}
.cv-name {
  font-family: var(--font-serif);
  font-size: 2.5rem; font-weight: 700;
  color: var(--dark); margin-bottom: .2rem;
}
.cv-subtitle { font-size: .95rem; color: var(--muted); margin-bottom: .5rem; }
.cv-contact-row {
  display: flex; flex-wrap: wrap; gap: 1.2rem;
  font-size: .83rem; color: var(--muted);
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--dark);
  font-family: var(--font-mono);
}
.cv-contact-row a { color: var(--blue); }
.cv-sec { margin-bottom: 2.25rem; }
.cv-sec-title {
  font-family: var(--font-serif); font-size: 1.15rem;
  font-weight: 700; color: var(--dark);
  border-bottom: 1px solid var(--border);
  padding-bottom: .35rem; margin-bottom: 1rem;
  text-transform: uppercase; letter-spacing: .04em;
  font-size: 1rem;
}
.cv-entry { margin-bottom: 1.1rem; }
.cv-entry-header { display: flex; justify-content: space-between; align-items: flex-start; }
.cv-entry-title { font-weight: 600; font-size: .93rem; }
.cv-entry-year { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); flex-shrink: 0; margin-left: 1rem; }
.cv-entry-org { color: var(--blue); font-size: .88rem; }
.cv-entry-detail { font-size: .83rem; color: var(--muted); margin-top: .15rem; line-height: 1.5; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  margin-left: var(--sidebar);
  background: var(--dark);
  color: rgba(255,255,255,.4);
  text-align: center;
  padding: 2.2rem 2rem;
  font-size: .78rem;
}
.site-footer a { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar: 0px; }

  .sidebar {
    width: 100%; height: auto;
    position: static;
    padding: 2rem 1.5rem 1.5rem;
  }
  .site-wrap { flex-direction: column; }
  .main { margin-left: 0; }
  .site-footer { margin-left: 0; }

  .hero h1 { font-size: 2.2rem; }
  .sec { padding: 3rem 6% 2.5rem; }
  .cv-doc { padding: 2rem 1.5rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Utilities ───────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.mt1 { margin-top: 1rem; }
.mt2 { margin-top: 2rem; }
.mb1 { margin-bottom: 1rem; }
.mb2 { margin-bottom: 2rem; }
.lead { font-size: 1.05rem; color: var(--muted); line-height: 1.7; }
.wip-section { font-family: var(--font-serif); font-size: 1.05rem; color: var(--muted); margin: 2rem 0 1rem; font-style: italic; }
