/* ============================================================
   Bhaskar Ganesh Devalla — Academic Portfolio
   "Scholar" theme: warm paper, deep teal, editorial serif.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg:           #f7f6f2;
  --surface:      #ffffff;
  --surface-2:    #f1efe9;
  --ink:          #12161b;
  --ink-2:        #363c45;
  --muted:        #636a74;
  --faint:        #979da6;
  --line:         #e3e0d8;
  --line-soft:    #ece9e3;

  --accent:       #0f5e6b;   /* deep teal — primary */
  --accent-hover: #0a4953;
  --accent-ink:   #ffffff;   /* text on accent */
  --accent-soft:  #e3eff0;
  --accent-line:  #b3d3d7;

  --warm:         #b4541c;   /* terracotta — highlights */
  --warm-soft:    #fbefe6;
  --warm-line:    #eecaae;

  --banner: linear-gradient(135deg, #0f5e6b 0%, #124a64 55%, #1a3a5c 100%);
  --glow:   rgba(15, 94, 107, 0.09);

  --header-bg:  rgba(247, 246, 242, 0.82);
  --shadow-sm:  0 1px 2px rgba(18, 22, 27, 0.05);
  --shadow:     0 1px 2px rgba(18, 22, 27, 0.04), 0 12px 32px -16px rgba(18, 22, 27, 0.18);
  --shadow-lg:  0 2px 6px rgba(18, 22, 27, 0.05), 0 28px 56px -24px rgba(18, 22, 27, 0.28);

  --serif: 'Newsreader', 'Noto Serif SC', Georgia, 'Times New Roman', serif;
  --sans:  'Geist', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  --mono:  'Geist Mono', 'JetBrains Mono', ui-monospace, Consolas, 'Noto Sans SC', monospace;

  --width: 1200px;
  --header-h: 64px;
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg:           #0c0f13;
  --surface:      #13181e;
  --surface-2:    #1a2027;
  --ink:          #eef1f4;
  --ink-2:        #c2c8cf;
  --muted:        #8d95a0;
  --faint:        #626a74;
  --line:         #252c35;
  --line-soft:    #1d232b;

  --accent:       #5ec2cf;
  --accent-hover: #8ad6df;
  --accent-ink:   #06222a;
  --accent-soft:  #10282e;
  --accent-line:  #1f4b53;

  --warm:         #f0a36b;
  --warm-soft:    #2a1c12;
  --warm-line:    #573821;

  --banner: linear-gradient(135deg, #0e4750 0%, #11384f 55%, #152c47 100%);
  --glow:   rgba(94, 194, 207, 0.07);

  --header-bg:  rgba(12, 15, 19, 0.8);
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:     0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg:  0 2px 6px rgba(0, 0, 0, 0.3), 0 28px 56px -24px rgba(0, 0, 0, 0.7);

  color-scheme: dark;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .3s var(--ease), color .3s var(--ease);
  overflow-x: hidden;
}

/* soft ambient glow behind the top of the page */
body::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 720px;
  background:
    radial-gradient(900px 420px at 12% -8%, var(--glow), transparent 70%),
    radial-gradient(700px 380px at 92% 0%, var(--glow), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
a { color: var(--accent); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--accent-hover); }
button { font: inherit; }

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 1em; height: 1em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

.container { width: 100%; max-width: var(--width); margin: 0 auto; padding: 0 2rem; }

.skip-link {
  position: absolute; left: 1rem; top: -60px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: .55rem 1rem; border-radius: 8px; font-weight: 600; font-size: .9rem;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 1rem; color: var(--accent-ink); }

/* ---------- Bilingual switching ---------- */
html[data-lang="en"] .lang-zh { display: none !important; }
html[data-lang="zh"] .lang-en { display: none !important; }
html[data-lang="zh"] body { font-family: 'Noto Sans SC', var(--sans); }
html[data-lang="zh"] .intro-title,
html[data-lang="zh"] .section-title,
html[data-lang="zh"] .profile-name,
html[data-lang="zh"] .brand-name,
html[data-lang="zh"] .interest-title,
html[data-lang="zh"] .pub-title,
html[data-lang="zh"] .xp-role,
html[data-lang="zh"] .edu-degree,
html[data-lang="zh"] .service-role,
html[data-lang="zh"] .cta-title,
html[data-lang="zh"] .footer-name { font-family: 'Noto Serif SC', var(--serif); letter-spacing: 0; }
html[data-lang="zh"] .intro-title { font-weight: 600; line-height: 1.25; font-size: clamp(1.9rem, 3.9vw, 3rem); max-width: none; }
html[data-lang="zh"] .intro-title em { font-style: normal; }
.profile-name-alt { font-family: 'Noto Serif SC', var(--serif); }

/* ============================================================
   PROGRESS + HEADER
   ============================================================ */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 70;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}

.site-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--header-h);
  background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background-color .3s var(--ease);
}
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 24px -18px rgba(0, 0, 0, .35); }

.nav-inner {
  max-width: var(--width); height: 100%;
  margin: 0 auto; padding: 0 2rem;
  display: flex; align-items: center; gap: 1.25rem;
}

.brand { display: flex; align-items: center; gap: .7rem; margin-right: auto; color: var(--ink); min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--banner);
  color: #fff;
  font-family: var(--serif); font-weight: 600; font-size: 1rem; letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.06rem; letter-spacing: -.005em; white-space: nowrap; }
.brand-sub { font-family: var(--mono); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; margin-top: .15rem; }

.nav-links { display: flex; align-items: center; gap: .1rem; }
.nav-link {
  position: relative; display: block;
  padding: .42rem .68rem; border-radius: 8px;
  font-size: .86rem; font-weight: 500; color: var(--muted);
  white-space: nowrap;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.nav-link:hover { color: var(--ink); background: var(--surface-2); }
.nav-link.active { color: var(--accent); }
.nav-link.active::after {
  content: ''; position: absolute; left: .68rem; right: .68rem; bottom: .12rem;
  height: 2px; border-radius: 2px; background: var(--accent);
}

.nav-actions { display: flex; align-items: center; gap: .45rem; flex: none; }

.lang-toggle {
  display: inline-flex; align-items: center; gap: .1rem;
  padding: .2rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  cursor: pointer;
  transition: border-color .15s var(--ease);
}
.lang-toggle:hover { border-color: var(--accent-line); }
.lang-opt {
  font-family: var(--mono); font-size: .68rem; font-weight: 600; letter-spacing: .04em;
  padding: .3rem .56rem; border-radius: 999px; color: var(--muted);
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.lang-opt.active { background: var(--accent); color: var(--accent-ink); }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); cursor: pointer;
  transition: border-color .15s var(--ease), color .15s var(--ease), transform .2s var(--ease);
}
.icon-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.icon-btn .icon { width: 18px; height: 18px; }
.theme-toggle:active { transform: rotate(-20deg) scale(.94); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle { display: none; flex-direction: column; gap: 4px; border-radius: 10px; }
.nav-toggle span { display: block; width: 16px; height: 1.8px; background: var(--ink); border-radius: 1px; transition: transform .25s var(--ease), opacity .2s var(--ease); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.8px) rotate(-45deg); }

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 4.5rem;
  align-items: start;
  padding-top: 2.75rem;
  padding-bottom: 3rem;
}

/* ============================================================
   PROFILE CARD
   ============================================================ */
.profile-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 1.3rem 1.2rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.profile-banner {
  position: absolute; inset: 0 0 auto 0; height: 78px;
  background-image:
    radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1.3px),
    var(--banner);
  background-size: 13px 13px, auto;
}
.profile-banner::after {
  content: ''; position: absolute; right: -40px; top: -60px;
  width: 180px; height: 180px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 0 0 26px rgba(255, 255, 255, .04), 0 0 0 52px rgba(255, 255, 255, .03);
}
.profile-photo {
  position: relative; z-index: 1;
  width: 108px; height: 108px;
  margin-top: 22px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  border: 4px solid var(--surface);
  box-shadow: var(--shadow);
}
/* fill the circle; 20% keeps the top of the hair in frame on this 3:4 portrait */
.profile-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }

.profile-id { margin-top: .8rem; }
.profile-name {
  font-family: var(--serif);
  font-size: 1.45rem; font-weight: 600;
  line-height: 1.15; letter-spacing: -.015em;
  color: var(--ink);
}
.profile-name-alt { font-size: .95rem; color: var(--muted); margin-top: .15rem; letter-spacing: .06em; }
html[data-lang="zh"] .profile-name-alt { font-family: var(--serif); letter-spacing: 0; }
.profile-role { margin-top: .65rem; font-size: .93rem; font-weight: 600; color: var(--ink); }
.profile-affil { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; font-size: .88rem; line-height: 1.5; margin-top: .2rem; }
.profile-affil a { color: var(--ink-2); border-bottom: 1px solid var(--line); transition: color .15s var(--ease), border-color .15s var(--ease); }
.profile-affil a:hover { color: var(--accent); border-color: var(--accent-line); }
.profile-affil .sep { display: none; }

.profile-links {
  display: grid; gap: .15rem;
  margin: .9rem 0 0; padding: .65rem 0 0;
  border-top: 1px solid var(--line-soft);
}
.pl {
  display: flex; align-items: center; gap: .7rem;
  padding: .24rem .5rem; margin: 0 -.5rem;
  border-radius: 8px;
  font-size: .87rem; color: var(--ink-2);
  overflow-wrap: anywhere;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.pl .icon { width: 16px; height: 16px; color: var(--muted); transition: color .15s var(--ease); }
a.pl:hover { background: var(--surface-2); color: var(--accent); }
a.pl:hover .icon { color: var(--accent); }

.profile-social { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .65rem; }
.social {
  width: 40px; height: 40px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s var(--ease), background-color .15s var(--ease), transform .2s var(--ease);
}
.social .icon { width: 18px; height: 18px; color: var(--ink-2); transition: color .15s var(--ease); }
.social:hover { transform: translateY(-1px); }
.social:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.social:hover .icon { color: var(--accent); }

.profile-interests { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line-soft); }
.mini-label {
  font-family: var(--mono); font-size: .66rem; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--faint);
  margin-bottom: .6rem;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag-cloud li {
  font-size: .74rem; font-weight: 500; line-height: 1.3;
  padding: .28rem .6rem; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .72rem 1.2rem; border-radius: 10px;
  font-size: .9rem; font-weight: 600; line-height: 1;
  white-space: nowrap; border: 1px solid transparent; cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn .icon { width: 16px; height: 16px; stroke-width: 2; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-block { width: 100%; margin-top: 1rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -8px var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); box-shadow: 0 10px 22px -10px var(--accent); }
.btn-light { background: #fff; color: #0f4953; }
.btn-light:hover { background: #eef7f8; color: #0a3a42; }
.btn-outline-light { background: rgba(255, 255, 255, .06); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .6); }

.btn-chip {
  display: inline-flex; align-items: center; gap: .42rem;
  padding: .42rem .78rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .8rem; font-weight: 600; color: var(--ink-2); line-height: 1;
  transition: border-color .15s var(--ease), color .15s var(--ease), background-color .15s var(--ease);
}
.btn-chip .icon { width: 14px; height: 14px; }
.btn-chip:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { margin-bottom: 5rem; }
.section:last-child { margin-bottom: 1rem; }

.section-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.75rem; }
.section-head::after { content: ''; flex: 1; height: 1px; background: var(--line); margin-left: .35rem; }
.section-num {
  font-family: var(--mono); font-size: .74rem; font-weight: 500;
  color: var(--accent);
  padding: .2rem .5rem; border-radius: 6px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  line-height: 1.2;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(1.65rem, 2.6vw, 2.1rem);
  font-weight: 500; letter-spacing: -.02em; line-height: 1.1;
  color: var(--ink);
}
.section-lead { font-size: 1.04rem; line-height: 1.75; max-width: 68ch; margin-bottom: 1.6rem; }
.section-lead strong { color: var(--ink); font-weight: 600; }

/* ---------- Intro / About ---------- */
.intro { padding-top: .5rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .38rem .85rem .38rem .7rem; border-radius: 999px;
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line);
}
html[data-lang="zh"] .eyebrow { letter-spacing: .04em; }
.eyebrow-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-line); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.intro-title {
  font-family: var(--serif);
  font-size: clamp(2.35rem, 4.8vw, 3.65rem);
  font-weight: 450; line-height: 1.04; letter-spacing: -.03em;
  color: var(--ink);
  margin: 1.3rem 0 1.5rem;
  max-width: 17ch;
  text-wrap: balance;
}
.intro-title em { font-style: italic; color: var(--accent); font-weight: 450; }

.prose { font-size: 1.07rem; line-height: 1.82; max-width: 66ch; color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a, .news-text a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color .15s var(--ease), text-decoration-color .15s var(--ease);
}
.prose a:hover, .news-text a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.announce {
  display: inline-flex; align-items: center; gap: .75rem;
  margin-top: 1.9rem;
  padding: .42rem .95rem .42rem .42rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: .9rem; color: var(--ink-2);
  max-width: 100%;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.announce:hover { color: var(--ink); border-color: var(--warm-line); box-shadow: var(--shadow); transform: translateY(-1px); }
.announce-tag {
  flex: none;
  font-family: var(--mono); font-size: .66rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: .28rem .6rem; border-radius: 999px;
  background: var(--warm); color: #fff;
}
[data-theme="dark"] .announce-tag { color: #1c1007; }
.announce-text strong { color: var(--ink); font-weight: 600; }
.announce .icon { width: 16px; height: 16px; color: var(--warm); transition: transform .2s var(--ease); }
.announce:hover .icon { transform: translateX(3px); }

/* ---------- Research interests ---------- */
.interests { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.interest {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem 1.45rem;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.interest::before {
  content: ''; position: absolute; left: 1.3rem; right: 1.3rem; top: -1px; height: 2px;
  background: var(--accent); border-radius: 0 0 2px 2px;
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .35s var(--ease);
}
.interest:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow); }
.interest:hover::before { transform: scaleX(1); }
.interest-num { position: absolute; top: 1.25rem; right: 1.3rem; font-family: var(--mono); font-size: .7rem; color: var(--faint); }
.interest-icon {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  margin-bottom: 1.05rem;
}
.interest-icon .icon { width: 21px; height: 21px; }
.interest-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; line-height: 1.25; color: var(--ink); margin-bottom: .55rem; letter-spacing: -.01em; }
.interest-body { font-size: .92rem; line-height: 1.65; }

/* ---------- News timeline ---------- */
.news { position: relative; }
.news::before {
  content: ''; position: absolute; top: .6rem; bottom: .6rem;
  left: calc(104px + 1.1rem); width: 1px; background: var(--line);
}
.news-item {
  position: relative;
  display: grid; grid-template-columns: 104px minmax(0, 1fr); column-gap: 2.3rem;
  padding: .7rem 0;
}
.news-item::before {
  content: ''; position: absolute;
  left: calc(104px + 1.1rem - 4.5px); top: 1.25rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--faint);
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.news-item:hover::before { border-color: var(--accent); }
.news-item.is-latest::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.news-date {
  font-family: var(--mono); font-size: .78rem; font-weight: 500;
  color: var(--muted); text-align: right; padding-top: .2rem;
  white-space: nowrap;
}
.news-item.is-latest .news-date { color: var(--accent); }
.news-text { font-size: .97rem; line-height: 1.7; }
.news-text em { color: var(--ink); }
.pill-new {
  display: inline-block; vertical-align: 2px; margin-left: .3rem;
  font-family: var(--mono); font-size: .62rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: .12rem .45rem; border-radius: 999px;
  color: var(--warm); background: var(--warm-soft); border: 1px solid var(--warm-line);
}

/* ---------- Publications ---------- */
.pub-group {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin-bottom: .9rem;
}
.pub-group::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--warm); transform: rotate(45deg); }
.pub-list { display: grid; gap: 1rem; }
.pub-card {
  display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 1.6rem;
  padding: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.pub-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
/* the figure panel stretches to the full height of the text column, so no
   empty space is left under it; the diagram is centred inside the panel */
.pub-figure {
  position: relative; display: block; align-self: stretch;
  min-height: 170px;
  border-radius: 10px; overflow: hidden;
  background: #fff; border: 1px solid var(--line);
}
.pub-figure img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain; padding: 8px;
  transition: transform .6s var(--ease);
}
.pub-figure:hover img { transform: scale(1.05); }
.pub-figure-hint {
  position: absolute; right: 8px; bottom: 8px;
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--mono); font-size: .66rem; font-weight: 500;
  padding: .28rem .5rem; border-radius: 6px;
  background: rgba(18, 22, 27, .82); color: #fff;
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.pub-figure:hover .pub-figure-hint, .pub-figure:focus-visible .pub-figure-hint { opacity: 1; transform: none; }
.pub-body { min-width: 0; display: flex; flex-direction: column; padding: .2rem .3rem .2rem 0; }
.pub-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.badge {
  display: inline-block;
  font-family: var(--mono); font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  padding: .26rem .58rem; border-radius: 6px; border: 1px solid;
  white-space: nowrap; line-height: 1.3;
}
.badge-venue { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.badge-rank  { color: var(--warm); background: var(--warm-soft); border-color: var(--warm-line); }
.pub-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; margin-bottom: .55rem; }
.pub-title a { color: var(--ink); }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: .9rem; line-height: 1.6; color: var(--muted); margin-bottom: 1rem; }
.author-self {
  color: var(--ink); font-weight: 600;
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.pub-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: auto; }

/* ---------- Experience timeline ---------- */
.xp-item {
  position: relative;
  display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 1.3rem;
  padding-bottom: 2.25rem;
}
.xp-item:last-child { padding-bottom: 0; }
.xp-item:not(:last-child)::before {
  content: ''; position: absolute; left: 26.5px; top: 62px; bottom: 8px;
  width: 1px; background: linear-gradient(var(--line), var(--line) 70%, transparent);
}
.xp-logo {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 14px; padding: 6px;
  background: #fff; border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.xp-logo img { width: 100%; height: 100%; object-fit: contain; }
.xp-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.xp-role { font-family: var(--serif); font-size: 1.24rem; font-weight: 600; line-height: 1.3; color: var(--ink); letter-spacing: -.01em; }
.date-pill {
  display: inline-block;
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  padding: .24rem .65rem; border-radius: 999px;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
  white-space: nowrap; line-height: 1.4;
}
.xp-org { margin-top: .15rem; font-size: .95rem; font-weight: 500; }
.xp-org a { color: var(--accent); }
.xp-org a:hover { color: var(--accent-hover); }
.xp-meta { font-size: .85rem; color: var(--muted); }
.xp-points { display: grid; gap: .5rem; margin-top: .85rem; }
.xp-points li { position: relative; padding-left: 1.3rem; font-size: .95rem; line-height: 1.65; }
.xp-points li::before {
  content: ''; position: absolute; left: 1px; top: .62em;
  width: 6px; height: 6px; border-radius: 1.5px;
  background: var(--accent); opacity: .6; transform: rotate(45deg);
}
.xp-points strong { color: var(--ink); font-weight: 600; }

.course-tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
.tag {
  display: inline-block;
  font-family: var(--mono); font-size: .73rem; font-weight: 500;
  padding: .32rem .7rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2);
  transition: border-color .15s var(--ease), color .15s var(--ease), background-color .15s var(--ease);
}
.tag:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }

/* ---------- Education ---------- */
.edu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.edu-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.2rem;
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.edu-card:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow); }
.edu-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.edu-logo {
  height: 50px; width: 50px; object-fit: contain;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px;
}
.edu-logo-wide { width: auto; max-width: 156px; padding: 5px 8px; }
.edu-degree { font-family: var(--serif); font-size: 1.16rem; font-weight: 600; line-height: 1.3; color: var(--ink); letter-spacing: -.01em; }
.edu-school { margin-top: .35rem; font-size: .92rem; font-weight: 500; color: var(--accent); line-height: 1.45; }
.edu-loc { font-size: .85rem; color: var(--muted); }
.edu-extra {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .6rem;
  margin-top: auto; padding-top: .9rem;
  font-size: .88rem; color: var(--ink-2);
}
.edu-extra::before { content: ''; flex-basis: 100%; height: 1px; margin-top: .9rem; margin-bottom: .45rem; border-top: 1px dashed var(--line); }
.edu-extra .k { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.edu-extra a { color: var(--ink); font-weight: 500; }
.edu-extra a:hover { color: var(--accent); }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.skill-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.25rem;
}
.skill-wide { grid-column: 1 / -1; }
.skill-k {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin-bottom: .8rem;
}
html[data-lang="zh"] .skill-k { font-family: 'Noto Sans SC', var(--sans); font-size: .82rem; letter-spacing: .04em; }
.skill-k::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li {
  font-size: .83rem; line-height: 1.35;
  padding: .3rem .66rem; border-radius: 7px;
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line-soft);
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.chips li:hover { border-color: var(--accent-line); color: var(--ink); }
.chips-lang small {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--faint); margin-left: .3rem;
}

/* ---------- Service ---------- */
.service-card {
  display: flex; gap: 1.1rem; align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
}
.service-card .interest-icon { margin-bottom: 0; }
.service-body { flex: 1; min-width: 0; }
.service-role { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.service-venue { margin-top: .3rem; font-size: .93rem; color: var(--ink); }
.service-text { font-size: .9rem; color: var(--muted); margin-top: .15rem; }

/* ---------- Contact CTA ---------- */
.cta {
  position: relative; overflow: hidden;
  padding: 2.6rem 2.5rem;
  border-radius: 22px;
  background-image:
    radial-gradient(rgba(255, 255, 255, .12) 1px, transparent 1.3px),
    var(--banner);
  background-size: 14px 14px, auto;
  color: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow-lg);
}
.cta::after {
  content: ''; position: absolute; right: -90px; bottom: -120px;
  width: 320px; height: 320px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, .035), 0 0 0 80px rgba(255, 255, 255, .025);
  pointer-events: none;
}
.cta-kicker {
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .65);
}
.cta-title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  font-weight: 450; letter-spacing: -.025em; line-height: 1.1;
  color: #fff; margin: .5rem 0 .8rem;
}
.cta-text { max-width: 54ch; font-size: 1.02rem; line-height: 1.7; }
.cta-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer { border-top: 1px solid var(--line); background: var(--surface-2); margin-top: 2rem; }
.footer-inner { padding-top: 2.4rem; padding-bottom: 2rem; }
.footer-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2rem; }
.footer-identity { display: flex; align-items: center; gap: .8rem; }
.footer-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--ink); line-height: 1.2; }
.footer-tag { font-size: .84rem; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.4rem; font-size: .88rem; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--accent); }
.visitors { text-align: center; }
.visitors .mini-label { margin-bottom: .45rem; }
.visitors img { display: inline-block; height: auto; max-width: 100%; border-radius: 6px; background: #fff; }
[data-theme="dark"] .visitors img { filter: invert(1) hue-rotate(180deg); opacity: .9; }
.footer-note {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem;
  margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--muted);
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 55;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s, color .15s var(--ease), border-color .15s var(--ease);
}
.to-top .icon { width: 18px; height: 18px; }
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent-line); }

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .eyebrow-dot { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* sticky sidebar: the whole card (photo included) stays pinned below the header.
   On shorter screens the interest tags are dropped so the card still fits; on
   very short screens the card scrolls internally rather than sliding under the header */
@media (min-width: 1025px) {
  .profile { position: sticky; top: calc(var(--header-h) + 1.25rem); }
  .profile-card {
    max-height: calc(100vh - var(--header-h) - 2.5rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
  }
}
@media (min-width: 1025px) and (max-height: 740px) {
  .profile-interests { display: none; }
}

@media (max-width: 1180px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    max-height: 0; overflow: hidden;
    transition: max-height .35s var(--ease);
  }
  .nav.open { max-height: 80vh; overflow-y: auto; }
  .nav-links {
    flex-direction: column; align-items: stretch; gap: 0;
    max-width: var(--width); margin: 0 auto; padding: .5rem 2rem 1rem;
  }
  .nav-link { padding: .8rem .25rem; border-radius: 0; border-bottom: 1px solid var(--line-soft); font-size: .98rem; }
  .nav-links li:last-child .nav-link { border-bottom: none; }
  .nav-link:hover { background: transparent; }
  .nav-link.active::after { display: none; }
}

@media (max-width: 1100px) {
  .layout { gap: 3rem; grid-template-columns: 272px minmax(0, 1fr); }
  .interests { grid-template-columns: 1fr; }
  .interest { display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; }
  .interest-icon { grid-row: span 2; margin-bottom: 0; }
  .interest-title { margin-top: .1rem; }
}

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; gap: 2.5rem; padding-top: 1.75rem; }

  .profile-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 1.4rem;
    padding: 0 1.5rem 1.5rem;
  }
  .profile-banner { height: 76px; }
  .profile-photo { grid-row: span 2; width: 112px; height: 112px; margin-top: 26px; }
  .profile-id { margin-top: 88px; }
  .profile-links, .profile-social, .profile-interests, .btn-block { grid-column: 1 / -1; }
  .profile-links { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); column-gap: 1rem; }
  .btn-block { width: auto; justify-self: start; }

  .interests { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .interest { display: block; }
  .interest-icon { margin-bottom: 1.05rem; }
}

@media (max-width: 860px) {
  .interests { grid-template-columns: 1fr; }
  .interest { display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; }
  .interest-icon { grid-row: span 2; margin-bottom: 0; }
  .footer-top { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 1.4rem; }
  .footer-identity { flex-direction: column; }
}

@media (max-width: 720px) {
  .brand-sub { display: none; }
  .pub-card { grid-template-columns: 1fr; gap: 1.1rem; }
  .pub-figure { aspect-ratio: 5 / 3; min-height: 0; }
  .edu-grid, .skills-grid { grid-template-columns: 1fr; }
  .news::before { display: none; }
  .news-item { grid-template-columns: 1fr; row-gap: .15rem; padding: .85rem 0 .85rem 1.4rem; border-bottom: 1px solid var(--line-soft); }
  .news-item:last-child { border-bottom: none; }
  .news-item::before { left: 0; top: 1.2rem; width: 9px; height: 9px; }
  .news-date { text-align: left; padding-top: 0; }
  .section { margin-bottom: 4rem; }
  .cta { padding: 2rem 1.5rem; }
}

@media (max-width: 560px) {
  .container, .nav-inner { padding: 0 1rem; }
  .nav-links { padding: .25rem 1rem .75rem; }
  .brand-name { font-size: .98rem; }

  .profile-card { grid-template-columns: 1fr; padding: 0 1.15rem 1.25rem; }
  .profile-photo { grid-row: auto; width: 104px; height: 104px; margin-top: 30px; }
  .profile-id { margin-top: .9rem; }
  .profile-links { grid-template-columns: 1fr; }
  .btn-block { width: 100%; }

  .interest { display: block; padding: 1.2rem 1.1rem; }
  .interest-icon { margin-bottom: .9rem; }
  .intro-title { font-size: 2.15rem; }
  .prose { font-size: 1.02rem; }
  .announce { border-radius: 14px; align-items: flex-start; padding: .55rem .8rem .55rem .55rem; }
  .announce .icon { display: none; }

  .xp-item { grid-template-columns: 1fr; gap: .9rem; }
  .xp-item:not(:last-child)::before { display: none; }
  .xp-logo { width: 46px; height: 46px; border-radius: 12px; }
  .service-card { flex-direction: column; padding: 1.2rem; }
  .cta-actions .btn { flex: 1 1 100%; }
  .to-top { right: 1rem; bottom: 1rem; }
}

@media (max-width: 400px) {
  .brand-text { display: none; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .site-header, .progress, .to-top, .skip-link, .cta-actions, .btn-block, .visitors, .footer-links, .pub-figure-hint { display: none !important; }
  body { background: #fff; color: #000; font-size: 11.5px; }
  body::before { display: none; }
  .layout { display: block; padding: 0; }
  .profile-card { box-shadow: none; border: none; display: grid; grid-template-columns: 110px 1fr; gap: 1rem; padding: 0; }
  .profile-banner { display: none; }
  .profile-photo { margin: 0; box-shadow: none; }
  .profile-id { margin: 0; }
  .profile-links, .profile-interests { grid-column: 1 / -1; }
  .section { margin: 1.5rem 0; page-break-inside: avoid; }
  .js .reveal { opacity: 1; transform: none; }
  .cta { background: none; color: #000; box-shadow: none; padding: 0; }
  .cta-title { color: #000; }
  a { color: #000; }
}
