/* ============================================================
   Personal academic homepage — serif, two-column (sticky
   sidebar + content), bilingual (EN / 中). Deep-green theme.
   Edit the variables below to retheme.
   ============================================================ */

:root {
  --ink:        #182431;   /* main text                    */
  --muted:      #65717d;   /* dates, captions              */
  --accent:     #1d6b68;   /* links, accents (LLM teal)    */
  --accent-dk:  #123f45;   /* darker teal                  */
  --rule:       #d6dee4;   /* hairlines                    */
  --bg:         #e8eef2;   /* research notebook canvas     */
  --card:       rgba(255, 255, 255, .92); /* translucent cards */
  --mist:       #526f9e;   /* transformer blue             */
  --sand:       #cf8061;   /* reward signal accent         */
  --sidebar-w:  280px;     /* sidebar width                */
  --maxw:       1120px;    /* whole layout width           */
}

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

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 4% 4%, rgba(82, 111, 158, .2), transparent 31rem),
    radial-gradient(ellipse at 97% 52%, rgba(29, 107, 104, .18), transparent 31rem),
    linear-gradient(125deg, rgba(255, 255, 255, .25), rgba(226, 235, 240, .5)),
    url("../assets/llm-research-bg.svg");
  background-position: left top, right center, center, center top;
  background-size: auto, auto, auto, 1600px 960px;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat-y;
  background-attachment: fixed;
  color: var(--ink);
  border-top: 4px solid var(--accent);
  border-image: linear-gradient(90deg, var(--accent), var(--mist), var(--sand)) 1;
  font-family: Aptos, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- bilingual visibility ---------- */
body.lang-en .zh { display: none !important; }
body.lang-zh .en { display: none !important; }
.zh { font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif; }

/* ---------- language toggle ---------- */
.langbar { position: fixed; top: 1rem; right: 1.25rem; z-index: 10; }
#lang-toggle {
  font: inherit; font-size: .85rem; cursor: pointer;
  background: rgba(248, 250, 248, .88); border: 1px solid var(--rule); border-radius: 999px;
  backdrop-filter: blur(8px);
  padding: .25rem .8rem; color: var(--muted); letter-spacing: .5px;
}
#lang-toggle:hover { border-color: var(--accent); color: var(--accent); }
#lang-toggle .sep { margin: 0 .35rem; opacity: .5; }
body.lang-en #lang-toggle .opt-en,
body.lang-zh #lang-toggle .opt-zh { color: var(--accent); font-weight: 600; }

/* ---------- links ---------- */
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; }
a:hover { border-bottom-color: var(--accent); }

/* ============================================================
   LAYOUT — sidebar + content
   ============================================================ */
.layout {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 5rem;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 3rem;
  align-items: start;
}

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky;
  top: 3.5rem;
  text-align: left;
  padding: 1.1rem;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0, rgba(82, 111, 158, .38), transparent 48%),
    linear-gradient(155deg, rgba(20, 42, 59, .98), rgba(19, 70, 68, .96));
  box-shadow: 0 22px 60px rgba(24, 47, 62, .2);
  backdrop-filter: blur(8px);
}
.sidebar::after {
  content: "PROMPT  →  JUDGE  →  SCORE";
  position: absolute; right: -4.8rem; bottom: 5.1rem;
  z-index: -1; transform: rotate(-90deg);
  color: rgba(255, 255, 255, .055);
  font: 700 .62rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 2px; white-space: nowrap;
}
.sidebar .avatar {
  width: 100%; max-width: 220px; aspect-ratio: 1/1;
  object-fit: cover; object-position: center 22%;  /* lift crop so the face sits centred */
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 9px; background: var(--rule);
  display: block; margin-bottom: 1.6rem;
  box-shadow: 10px 10px 0 rgba(85, 121, 138, .09), -4px -4px 0 rgba(185, 141, 89, .08);
}
.sidebar .name { margin: 0; font-size: 1.7rem; font-weight: 600; line-height: 1.15; }
.sidebar .name { color: #f4f8fa; }
.sidebar .name-cn { margin: .15rem 0 1rem; font-size: 1.1rem; color: #b8c8cf; }
.sidebar a { color: #d8ebe7; }
.sidebar a:hover { color: #fff; border-bottom-color: #fff; }

.role { margin-bottom: 1.3rem; }
.role-line { margin: .05rem 0; font-size: .95rem; line-height: 1.4; }
.role-line.strong { font-weight: 600; }
.role-line.muted { color: var(--muted); }
.role-line.italic { font-style: italic; color: var(--muted); font-size: .88rem; margin-top: .4rem; }
.sidebar .role-line { color: #eef5f7; }
.sidebar .role-line.muted,
.sidebar .role-line.italic { color: #b8c8cf; }

.sidebar .resume-btn {
  display: block; text-align: center; margin: 0 0 1.4rem;
  background: #d9efea; color: #123f45; border: 0;
  padding: .55rem 1rem; border-radius: 4px; font-size: .9rem; letter-spacing: .5px;
}
.sidebar .resume-btn:hover { background: #fff; color: #123f45; }

.sidebar-contact { margin: 0 0 1.2rem; border-top: 1px solid rgba(255, 255, 255, .16); padding-top: 1rem; }
.sidebar-contact dt { font-size: .68rem; letter-spacing: 1px; color: #8fd0c3; margin-top: .6rem; }
.sidebar-contact dd { margin: .1rem 0 0; font-size: .9rem; word-break: break-word; }
.sidebar-contact dd a { color: #eef5f7; }
.sidebar-contact dd a:hover { color: #fff; }

.social { display: flex; flex-wrap: wrap; gap: .8rem; margin: 0; font-size: .85rem; }
.social a { color: #b8c8cf; }
.social a:hover { color: #fff; }

/* ============================================================
   CONTENT
   ============================================================ */
.content {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 1.35rem 1.65rem 1.65rem;
  border: 1px solid rgba(82, 111, 158, .2);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .94), rgba(248, 251, 252, .84));
  box-shadow: 0 28px 80px rgba(24, 47, 62, .13);
  backdrop-filter: blur(9px);
}
.content::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--mist) 58%, var(--sand));
  opacity: .88;
}
section { margin: 0 0 2.8rem; }
section:first-child { margin-top: 0; }

section h2 {
  position: relative;
  font-size: 1.35rem; font-weight: 600; margin: 0 0 1.1rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--rule);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", serif;
}
section h2::after {  /* short accent underline like the reference */
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 56px; height: 2px; background: var(--accent);
}
.num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.25rem; margin-right: .6rem; padding: .05rem .35rem;
  border: 1px solid rgba(82, 111, 158, .16);
  border-radius: 999px; background: rgba(82, 111, 158, .08);
  color: var(--accent); font-size: .72rem; letter-spacing: 1px; vertical-align: 2px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.tag {
  float: right; font-size: .7rem; letter-spacing: 1.5px; color: var(--muted);
  text-transform: uppercase; font-weight: 400; margin-top: .35rem;
}
section h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
section p { margin: .6rem 0; }
.muted { color: var(--muted); font-size: .85rem; }

/* ---------- research cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--rule); border-top: 2px solid var(--accent);
        border-radius: 8px; padding: 1rem 1.1rem; box-shadow: 0 8px 22px rgba(24, 47, 62, .04); }
.card:nth-child(2) { border-top-color: var(--mist); }
.card:nth-child(3) { border-top-color: var(--sand); }
.card-no { font-size: .72rem; letter-spacing: 1px; color: var(--accent); }
.card h3 { margin: .2rem 0 .4rem; font-size: 1rem; }
.card p { font-size: .88rem; color: var(--muted); margin: 0; }

/* ---------- news ---------- */
.news { list-style: none; padding: 0; margin: 0; }
.news li { padding: .4rem 0; border-bottom: 1px dotted var(--rule); }
.news:not(.is-expanded) .news-extra { display: none; }
.news-toggle {
  margin-top: .75rem; padding: .32rem 0;
  border: 0; border-bottom: 1px solid transparent; background: transparent;
  color: var(--accent); cursor: pointer; font: inherit; font-size: .82rem;
}
.news-toggle:hover { border-bottom-color: var(--accent); }
.news-toggle .label-less { display: none; }
.news-toggle[aria-expanded="true"] .label-more { display: none !important; }
.news-toggle[aria-expanded="true"] .label-less { display: inline; }
.date { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; margin-right: .5rem; }

/* ---------- entries ---------- */
.entry { margin: 1.2rem 0; }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.entry-sub { color: var(--muted); font-size: .92rem; }
.entry ul { margin: .5rem 0 0; padding-left: 1.2rem; }
.entry ul li { margin: .25rem 0; }
.stack { font-size: .85rem; color: var(--muted); font-style: italic; }

/* ---------- education ---------- */
.edu-entry {
  display: grid; grid-template-columns: 62px 1fr; gap: 1rem; align-items: start;
  padding: .2rem 0 .7rem;
}
.edu-logo-frame {
  position: relative; width: 58px; height: 58px; overflow: hidden;
  border: 1px solid var(--rule); border-radius: 8px; background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.edu-logo { display: block; width: 52px; height: 52px; object-fit: contain; }
.edu-logo-gdufs {
  position: absolute; top: 0; left: 50%; width: 190px; max-width: none; height: auto;
  transform: translateX(-50%);
}
.edu-body { min-width: 0; }
.edu-meta { margin: .35rem 0 0; color: var(--muted); font-size: .86rem; }

/* ---------- publications ---------- */
.pubs { padding-left: 1.3rem; }
.pubs li { margin: 1.2rem 0; }
.pubs .venue-tag {
  display: inline-block; font-size: .68rem; letter-spacing: .5px; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 3px;
  padding: .05rem .4rem; margin-bottom: .35rem;
}
.pubs .title { display: block; font-weight: 600; }
.pubs .authors { display: block; font-size: .92rem; }
.pubs .venue { display: block; color: var(--muted); font-size: .88rem; font-style: italic; }
.pub-cards { list-style: none; padding: 0; }
.pubs .pub-card {
  display: grid; grid-template-columns: minmax(190px, 32%) 1fr;
  gap: 1.15rem; margin: 1.25rem 0; padding: .85rem;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--card);
}
.pub-figure {
  display: flex; min-height: 145px; overflow: hidden; align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: 4px; background: #f7f8f6;
}
.pub-figure:hover { border-color: var(--accent); }
.pub-figure img { display: block; width: 100%; height: 100%; max-height: 180px; object-fit: contain; }
.pub-figure-wide { background: #fff; }
.pub-body { min-width: 0; align-self: center; }
.pub-card-text .pub-body { grid-column: 1 / -1; }
.pub-meta { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.pub-year { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.pub-card .title { margin: .25rem 0 .35rem; line-height: 1.4; }
.pub-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.pub-action {
  display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .58rem;
  border: 1px solid var(--rule); border-radius: 4px; color: var(--ink);
  background: var(--bg); font-size: .78rem; font-weight: 600; text-decoration: none;
}
.pub-action:hover { color: var(--accent); border-color: var(--accent); }
.pub-action-disabled { color: var(--muted); cursor: not-allowed; opacity: .7; }
.pub-action-disabled:hover { color: var(--muted); border-color: var(--rule); }

/* ---------- skills ---------- */
.skills { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 0; }
.skills dt { font-weight: 600; }
.skills dd { margin: 0; color: var(--muted); }

/* ---------- footer ---------- */
.visitors {
  margin: 3.2rem 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
}
.visitors-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.visitors-label {
  margin: 0 0 .75rem;
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.visitors-kicker {
  color: var(--accent);
  font-size: .68rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.visitors-panel {
  padding: 1rem 1.1rem .8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background:
    radial-gradient(circle at 100% 0, rgba(31, 92, 58, .08), transparent 34%),
    var(--card);
}
.visitor-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: .8rem;
  align-items: stretch;
}
.visitor-map-card,
.visitor-ranking-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(85, 121, 138, .2);
  border-radius: 9px;
  background: rgba(255, 255, 255, .9);
}
.visitor-map-card { display: flex; flex-direction: column; color: var(--ink); border-bottom: 1px solid rgba(85, 121, 138, .2); }
.visitor-map-card:hover { border-color: rgba(31, 92, 58, .45); }
.visitor-map-card img { display: block; width: 100%; height: auto; }
.visitor-map-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: auto;
  padding: .48rem .7rem;
  border-top: 1px solid rgba(85, 121, 138, .14);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .45px;
  text-transform: uppercase;
}
.visitor-ranking-card { display: flex; flex-direction: column; padding: .72rem; }
.visitor-ranking-title {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .65rem;
  color: var(--ink);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #35a56f; box-shadow: 0 0 0 4px rgba(53, 165, 111, .12); }
.visitor-ranking-link { display: block; margin: auto; border: 0; }
.visitor-ranking-link:hover { border: 0; opacity: .88; }
.visitor-ranking-link img { display: block; max-width: 100%; width: auto; height: auto; margin: 0 auto; }
.visitor-ranking-card p { margin: .6rem 0 0; color: var(--muted); font-size: .66rem; line-height: 1.4; text-align: center; }
.visitors-note {
  margin: .7rem 0 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.45;
  text-align: center;
}

footer { margin-top: 3.5rem; padding-top: 1.2rem; border-top: 1px solid var(--rule);
         font-size: .82rem; color: var(--muted); }

/* ============================================================
   RESPONSIVE — stack to one column on narrow screens
   ============================================================ */
@media (max-width: 760px) {
  body {
    background-size: auto, auto, auto, 1000px 600px;
    background-attachment: scroll;
  }
  .layout { grid-template-columns: 1fr; gap: 2rem; padding: 4rem 1rem 4rem; }
  .sidebar { position: static; text-align: center; }
  .sidebar .avatar { margin-left: auto; margin-right: auto; }
  .sidebar-contact { text-align: left; max-width: 320px; margin-left: auto; margin-right: auto; }
  .social { justify-content: center; }
  body { font-size: 16px; }
  .entry-head { flex-direction: column; }
  .tag { display: none; }
  .edu-entry { grid-template-columns: 52px 1fr; gap: .75rem; }
  .edu-logo-frame { width: 50px; height: 50px; }
  .edu-logo { width: 45px; height: 45px; }
  .edu-logo-gdufs { width: 165px; height: auto; }
  .pubs .pub-card { grid-template-columns: 1fr; }
  .pub-figure { min-height: 0; aspect-ratio: 16 / 9; }
  .content { padding: 1rem; border-radius: 10px; }
  .content, .content section, .visitors { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .skills { grid-template-columns: 1fr; gap: .15rem; }
  .skills dd { margin-bottom: .45rem; overflow-wrap: anywhere; }
  .visitor-dashboard { grid-template-columns: 1fr; }
}
