
:root {
  --primary:    #0f2a4a; 
  --primary-lt: #1a3a5c; 
  --accent:     #c0392b; 
  --accent2:    #1a78c2; 
  --gold:       #d4a017; 
  --light-bg:   #f4f7fb;
  --border:     #dce3ed;
  --text:       #1e2636;
  --text-muted: #6c7a8d;
  --font-serif: 'Times New Roman', Times, serif;
  --font-sans:  'Segoe UI', Arial, sans-serif;
  --transition: 0.28s ease;
  --radius:     8px;
  --shadow-sm:  0 2px 10px rgba(15,42,74,0.10);
  --shadow-md:  0 6px 24px rgba(15,42,74,0.16);
  --shadow-lg:  0 12px 40px rgba(15,42,74,0.22);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-serif);
  color: var(--text);
  background: #fff;
  line-height: 1.7;
  overflow-x: hidden;
}

/* ====================================================
   TOP PROGRESS BAR
   ==================================================== */
#reading-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent), var(--gold));
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ====================================================
   PARTICLE CANVAS BACKGROUND
   ==================================================== */
#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
}

/* Ensure content is above canvas */
nav, .page-content, footer, main, .container {
  position: relative;
  z-index: 1;
}

/* ====================================================
   NAVIGATION BAR
   ==================================================== */
.site-navbar {
  background: rgba(15,42,74,0.92) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 2px solid rgba(192,57,43,0.6);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 3px 20px rgba(0,0,0,0.25);
  transition: background var(--transition);
}

.site-navbar .navbar-brand {
  color: #fff !important;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 14px 0;
  transition: color var(--transition), text-shadow var(--transition);
  text-shadow: 0 0 0 transparent;
}

.site-navbar .navbar-brand:hover {
  color: #c8deff !important;
  text-shadow: 0 0 16px rgba(100,180,255,0.5);
}

.site-navbar .nav-link {
  color: rgba(255,255,255,0.85) !important;
  font-size: 0.94rem;
  padding: 14px 15px !important;
  position: relative;
  transition: color var(--transition);
  letter-spacing: 0.02em;
}

/* Animated underline on nav links */
.site-navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 15px;
  right: 15px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  border-radius: 2px;
}

.site-navbar .nav-link:hover,
.site-navbar .nav-link.nav-active {
  color: #fff !important;
}

.site-navbar .nav-link:hover::after,
.site-navbar .nav-link.nav-active::after {
  transform: scaleX(1);
}

/* =====================================================
   PUBLICATION DROPDOWN — 完全自定义，不依赖 Bootstrap
   ===================================================== */

/* 父容器：桌面端绝对定位基准 */
.nav-hover-dropdown {
  position: relative;
}

/* 子菜单基础 */
.nav-dropdown-menu {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}

/* ── 桌面端（≥768px）：悬浮弹出，绝对定位 ── */
@media (min-width: 768px) {
  .nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 9999;
    min-width: 130px;
    /* 默认隐藏：用 opacity + transform 做动画 */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px) scaleY(0.92);
    transform-origin: top center;
    transition:
      opacity    0.2s ease,
      transform  0.2s ease,
      visibility 0s   linear 0.2s;
    /* 毛玻璃样式 */
    background: rgba(10, 28, 52, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,0.10);
    border-top: 2px solid var(--accent2);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
    overflow: hidden;
  }

  /* hover 或 JS 加 .pub-open 时展开 */
  .nav-hover-dropdown:hover  > .nav-dropdown-menu,
  .nav-hover-dropdown.pub-open > .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scaleY(1);
    transition:
      opacity   0.2s ease,
      transform 0.2s ease,
      visibility 0s linear 0s;
  }
}

/* ── 手机端（<768px）：内嵌展开，display 切换 ── */
@media (max-width: 767px) {
  .nav-dropdown-menu {
    display: none;
    position: static;
    background: rgba(8, 22, 42, 0.95);
    border-left: 3px solid var(--accent2);
    border-radius: 0;
    margin: 2px 0 6px 12px;
    padding: 4px 0;
  }

  .nav-dropdown-menu.pub-open {
    display: block;
  }

  /* Publication 按钮右侧箭头 */
  .pub-toggle::after {
    content: '▾';
    margin-left: 6px;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
    display: inline-block;
  }
  .nav-hover-dropdown.pub-open .pub-toggle::after {
    transform: rotate(180deg);
  }
}

/* 子菜单项 */
.nav-dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 20px;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(210, 230, 255, 0.85);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: color 0.15s ease, background 0.15s ease, padding-left 0.15s ease;
}

.nav-dropdown-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 2px;
  background: var(--accent2);
  border-radius: 2px;
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.nav-dropdown-item:hover,
.nav-dropdown-item:focus,
.nav-dropdown-item:active {
  color: #fff;
  background: rgba(26, 120, 194, 0.2);
  padding-left: 26px;
  text-decoration: none;
}

.nav-dropdown-item:hover::before,
.nav-dropdown-item:focus::before {
  opacity: 1;
  transform: scaleY(1);
}

.nav-dropdown-menu li + li {
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* 移动端汉堡 */
.site-navbar .navbar-toggler {
  border-color: rgba(255,255,255,0.4);
  padding: 6px 10px;
}
.site-navbar .navbar-toggler-icon { filter: invert(1); }

@media (max-width: 767px) {
  /* 移动端 Publication 行布局 */
  .nav-hover-dropdown > .pub-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

/* ====================================================
   BACK TO TOP BUTTON
   ==================================================== */
#back-to-top {
  position: fixed;
  bottom: 32px;
  right: 28px;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-lt), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(16px) scale(0.85);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 888;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#back-to-top:hover {
  box-shadow: 0 6px 24px rgba(26,120,194,0.4);
  transform: translateY(-3px) scale(1.05);
}

/* ====================================================
   PAGE CONTENT CONTAINER
   ==================================================== */
.page-content {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
  min-height: calc(100vh - 130px);
}

/* ====================================================
   SECTION TITLES
   ==================================================== */
.section-title {
  font-family: var(--font-serif);
  font-size: calc(1rem + 0.6vw);
  font-weight: 700;
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
  margin-bottom: 1.4rem;
  display: inline-block;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40%;
  height: 2px;
  background: var(--accent2);
  transition: width 0.4s ease;
}

.section-title:hover::after {
  width: 100%;
}

/* ====================================================
   MEMBER CARDS
   ==================================================== */
.member-card {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  padding: 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: box-shadow var(--transition), background var(--transition),
              border-color var(--transition), transform var(--transition);
  background: rgba(255,255,255,0.85);
}

.member-card:hover {
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, #fff 85%, #eef4ff);
  border-color: rgba(26,120,194,0.2);
  transform: translateX(4px);
}

.member-photo {
  width: 110px;
  min-width: 110px;
  border-radius: 6px;
  object-fit: cover;
  object-position: top;
  aspect-ratio: 4 / 5;
  border: 2px solid var(--border);
  transition: transform var(--transition), border-color var(--transition),
              box-shadow var(--transition);
  filter: grayscale(10%);
}

.member-card:hover .member-photo {
  transform: scale(1.04);
  border-color: var(--accent2);
  box-shadow: 0 4px 16px rgba(26,120,194,0.25);
  filter: grayscale(0%);
}

.member-name {
  font-size: calc(1rem + 0.4vw);
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text);
  transition: color var(--transition);
}

.member-card:hover .member-name {
  color: var(--accent2);
}

.member-info {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.2rem;
  line-height: 1.6;
}

/* Alumni */
.alumni-card {
  padding: 0.8rem 1rem;
  border-left: 3px solid var(--border);
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: border-color var(--transition), background var(--transition),
              transform var(--transition);
}

.alumni-card:hover {
  border-left-color: var(--accent2);
  background: linear-gradient(90deg, rgba(26,120,194,0.05), transparent);
  transform: translateX(6px);
}

.alumni-name {
  font-size: calc(0.95rem + 0.25vw);
  font-weight: 700;
  margin-bottom: 0.2rem;
  transition: color var(--transition);
}

.alumni-card:hover .alumni-name {
  color: var(--accent2);
}

.alumni-info {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

/* ====================================================
   HOME PAGE
   ==================================================== */
.home-hero {
  margin-bottom: 1.8rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  position: relative;
}

.home-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(15,42,74,0.08));
  pointer-events: none;
}

.home-hero img {
  width: 100%;
  display: block;
  transition: transform 0.6s ease;
}

.home-hero:hover img {
  transform: scale(1.015);
}

.home-intro-title {
  font-size: calc(1.3rem + 0.8vw);
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 1.2rem;
  position: relative;
  display: inline-block;
  width: 100%;
}

.home-intro-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  margin: 6px auto 0;
  border-radius: 2px;
}

.home-intro-text {
  font-size: calc(0.95rem + 0.3vw);
  text-align: justify;
  line-height: 1.85;
  color: var(--text);
  margin-bottom: 1rem;
}

.hiring-badge {
  display: inline-block;
  background: linear-gradient(90deg, var(--accent), #e74c3c);
  color: #fff;
  font-size: calc(0.9rem + 0.2vw);
  font-weight: 600;
  padding: 7px 22px;
  border-radius: 30px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(192,57,43,0.3);
  transition: transform var(--transition), box-shadow var(--transition);
}

.hiring-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(192,57,43,0.45);
}

/* ====================================================
   RESEARCH PAGE
   ==================================================== */
.research-intro {
  font-size: calc(0.95rem + 0.2vw);
  line-height: 1.8;
  color: var(--text);
}

.research-intro h2 {
  font-family: var(--font-serif);
  font-size: calc(1.1rem + 0.5vw);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.8rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
}

.research-intro ul { padding-left: 1.4rem; }
.research-intro li { margin-bottom: 0.4rem; }

.research-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  background: #fff;
}

.research-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
  border-color: rgba(26,120,194,0.3);
}

.research-card img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  background: var(--light-bg);
  padding: 10px;
  transition: transform 0.4s ease;
}

.research-card:hover img {
  transform: scale(1.03);
}

.research-card .caption {
  font-family: var(--font-serif);
  font-size: calc(0.88rem + 0.2vw);
  text-align: center;
  padding: 8px 10px 10px;
  color: var(--text);
  background: #fff;
  border-top: 1px solid var(--border);
}

/* ====================================================
   PAPER LIST — Enhanced
   ==================================================== */
.paper-stats {
  font-family: var(--font-serif);
  font-size: calc(1rem + 0.5vw);
  font-weight: 700;
  color: var(--accent);
  background: linear-gradient(135deg, #fff5f5, #fff8ee);
  border-left: 4px solid var(--accent);
  padding: 10px 22px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.6rem;
  display: inline-block;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.paper-stats::before {
  content: '◎';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  opacity: 0.12;
  color: var(--accent);
}

/* Year headings with crystal/atom decoration */
.year-heading {
  font-family: var(--font-serif);
  font-size: calc(1rem + 0.4vw);
  font-weight: 700;
  color: var(--primary-lt);
  padding: 6px 14px 6px 12px;
  margin: 1.8rem 0 0.6rem;
  border-left: 4px solid var(--accent2);
  background: linear-gradient(90deg, rgba(26,120,194,0.07), transparent 70%);
  border-radius: 0 6px 6px 0;
  position: relative;
  display: inline-block;
  width: auto;
  min-width: 80px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.year-heading::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--accent2), transparent);
}

/* Paper items */
.paper-item {
  font-family: var(--font-serif);
  font-size: 0.975rem;
  line-height: 1.6;
  padding: 9px 12px 9px 14px;
  border-bottom: 1px solid #eef1f5;
  border-left: 3px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition), box-shadow var(--transition);
  position: relative;
}

.paper-item:hover {
  background: linear-gradient(90deg, rgba(26,120,194,0.04), rgba(26,120,194,0.01));
  border-left-color: var(--accent2);
  transform: translateX(4px);
  box-shadow: -3px 0 0 var(--accent2), var(--shadow-sm);
}

/* Paper number badge */
.paper-item::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: 2px;
}

.paper-item:hover::before { opacity: 1; }

.paper-item a {
  color: var(--accent2);
  text-decoration: none;
  transition: color var(--transition);
}

.paper-item a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ====================================================
   WRITINGS / CODE PAGE
   ==================================================== */
.writings-title, .code-title {
  font-family: var(--font-serif);
  font-size: calc(1rem + 0.5vw);
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
  margin-bottom: 1.2rem;
}

.writings-list, .code-list {
  font-size: calc(0.95rem + 0.2vw);
  line-height: 1.85;
  color: var(--text);
}

.writings-item, .code-item {
  padding: 0.85rem 0.5rem;
  border-bottom: 1px solid #eef1f5;
  transition: background var(--transition), transform var(--transition);
  border-radius: 4px;
}

.writings-item:hover, .code-item:hover {
  background: var(--light-bg);
  transform: translateX(4px);
}

.writings-item:last-child, .code-item:last-child { border-bottom: none; }

/* ====================================================
   CONTACT PAGE
   ==================================================== */
.contact-label { font-weight: 700; }

.contact-info {
  font-size: calc(0.95rem + 0.25vw);
  line-height: 2.0;
  color: var(--text);
}

.contact-info a {
  color: var(--accent2);
  transition: color var(--transition);
}

.contact-info a:hover { color: var(--accent); }

/* ====================================================
   KALEIDOSCOPE — SCATTER DESK
   ==================================================== */

/* ── Body override for scatter page ── */
body.scatter-body {
  background: #f0ebe0;
  min-height: 100vh;
  overflow: hidden;   /* 禁止滚动 */
}

/* ── Page header ── */
.scatter-header {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: 6rem 1rem 1.2rem;
  pointer-events: none;
  user-select: none;
}

.scatter-title {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: calc(1.5rem + 1.2vw);
  font-weight: 700;
  color: #3a2a18;
  letter-spacing: 0.05em;
  margin: 0 0 0.3rem;
  text-shadow: 1px 2px 4px rgba(80,50,20,0.15);
}

.scatter-subtitle {
  font-family: 'Georgia', serif;
  font-size: 0.9rem;
  color: #8a7060;
  letter-spacing: 0.06em;
  font-style: italic;
  margin: 0 0 0.4rem;
}

.scatter-hint {
  font-size: 0.78rem;
  color: #b0957a;
  letter-spacing: 0.04em;
}

/* ── Desk ── */
.scatter-desk {
  position: fixed;          /* 固定在视口，完全不随页面滚动 */
  top: 56px;                /* 导航栏高度 */
  left: 0;
  width: 100%;
  height: calc(100vh - 56px);
  background:
    radial-gradient(ellipse at 30% 40%, rgba(212,160,23,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 75% 65%, rgba(26,120,194,0.05) 0%, transparent 55%),
    linear-gradient(160deg, #ede8de 0%, #e4ddd2 50%, #dad4c8 100%);
  overflow: hidden;
  cursor: default;
  z-index: 1;
}

/* ── Photo Card ── */
/* ── Loading placeholder (lattice spinner) ── */
.photo-loading {
  position: absolute;
  inset: 7px 7px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f8f5f0;
  border-radius: 1px;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.35s ease;
}

.lattice-spin {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: #a08060;
  stroke-width: 1.8;
  stroke-linecap: round;
  animation: latticeRotate 2.4s linear infinite;
  filter: drop-shadow(0 0 3px rgba(160,120,60,0.35));
}

.lattice-spin circle {
  fill: #c09a60;
  stroke: none;
  animation: latticePulse 1.2s ease-in-out infinite alternate;
}

.lattice-spin circle:nth-child(2) { animation-delay: 0.24s; }
.lattice-spin circle:nth-child(3) { animation-delay: 0.48s; }
.lattice-spin circle:nth-child(4) { animation-delay: 0.72s; }
.lattice-spin circle:nth-child(5) { animation-delay: 0.96s; fill: #1a78c2; }

.loading-text {
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  color: #a08060;
  letter-spacing: 0.04em;
  text-align: center;
  animation: loadingBlink 1.6s ease-in-out infinite;
}

@keyframes latticeRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes latticePulse {
  from { opacity: 0.4; r: 2.5; }
  to   { opacity: 1;   r: 3.5; }
}

@keyframes loadingBlink {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

.photo-card.photo-card-tall .photo-loading {
  inset: 5px 5px 38px;
}

/* ── Photo Card ── */
.photo-card {
  position: absolute;
  /* top / left set via inline style (% values) — no default 0,0 */
  width: clamp(150px, 18vw, 220px);
  background: #fff;
  padding: 7px 7px 34px;
  box-shadow:
    0 4px 16px rgba(60,40,15,0.22),
    0 1px 4px rgba(0,0,0,0.14);
  border-radius: 2px;
  cursor: grab;
  user-select: none;
  transition: box-shadow 0.2s ease;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

.photo-card.photo-card-tall {
  padding-bottom: 38px;
}

.photo-card:active {
  cursor: grabbing;
  box-shadow:
    0 10px 36px rgba(60,40,15,0.32),
    0 2px 8px rgba(0,0,0,0.2);
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 1px;
  filter: sepia(10%) saturate(92%) contrast(1.02) brightness(1.01);
  pointer-events: none !important;  /* 无论 opacity/transition 状态，始终不拦截事件 */
  -webkit-user-drag: none;
  transition: filter 0.35s ease;
}

.photo-card.photo-card-tall img {
  aspect-ratio: 3/4;
}

.photo-card:hover img,
.photo-card:focus img {
  filter: sepia(0%) saturate(108%) contrast(1.04) brightness(1.02);
}

/* Caption stripe */
.photo-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Georgia', 'Courier New', cursive, serif;
  font-size: 0.7rem;
  color: #7a6050;
  letter-spacing: 0.05em;
  font-style: italic;
  pointer-events: none;
}

/* ── Tape pieces ── */
.photo-tape {
  position: absolute;
  width: 44px;
  height: 16px;
  background: rgba(255,235,130,0.58);
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(140,100,20,0.22), inset 0 0 0 1px rgba(255,255,255,0.3);
  z-index: 2;
  pointer-events: none;
}

.photo-tape::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255,255,255,0.2) 0px, rgba(255,255,255,0.2) 2px,
    transparent 2px, transparent 6px
  );
  border-radius: 2px;
}

.tape-top-left  {
  top: -8px; left: 12px;
  transform: rotate(-8deg);
}

.tape-top-right {
  top: -8px; right: 12px;
  transform: rotate(7deg);
}

/* ── Push pin ── */
.photo-pin {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #f6d060, #c07020);
  box-shadow:
    0 2px 5px rgba(100,60,0,0.45),
    inset 0 1px 2px rgba(255,255,255,0.55);
  z-index: 3;
  pointer-events: none;
}

.photo-pin::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 8px;
  background: linear-gradient(180deg, #a06010, #7a4a08);
  border-radius: 0 0 2px 2px;
}

/* Focus ring for accessibility */
.photo-card:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 4px;
}

/* ── Shuffle button ── */
.scatter-reset {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 200;
  background: rgba(250,245,235,0.92);
  border: 1.5px solid rgba(180,140,80,0.45);
  color: #7a5a30;
  font-size: 0.8rem;
  font-family: 'Georgia', serif;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(120,80,30,0.18);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  backdrop-filter: blur(6px);
}

.scatter-reset:hover {
  background: #fff9ec;
  box-shadow: 0 5px 18px rgba(120,80,30,0.28);
  transform: scale(1.05) rotate(-4deg);
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8,5,2,0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox-img {
  max-width: min(90vw, 900px);
  max-height: 80vh;
  object-fit: contain;
  border-radius: 2px;
  box-shadow:
    0 0 0 5px rgba(255,255,255,0.07),
    0 30px 80px rgba(0,0,0,0.65);
  transform: scale(0.9) translateY(16px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: sepia(4%) saturate(110%);
}

.lightbox.active .lightbox-img {
  transform: scale(1) translateY(0);
}

.lightbox-caption {
  margin-top: 1rem;
  font-family: 'Georgia', serif;
  font-size: 0.88rem;
  color: rgba(220,190,130,0.75);
  letter-spacing: 0.05em;
  font-style: italic;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.8);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.22);
  transform: rotate(90deg) scale(1.1);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .photo-card {
    width: clamp(120px, 38vw, 170px);
    padding: 5px 5px 28px;
  }

  .photo-label {
    font-size: 0.63rem;
    height: 28px;
  }

  .scatter-hint { display: none; }
}

/* ══ 手机端：照片墙改为可滚动网格 ══════════════════════════════════ */
@media (max-width: 768px) {

  /* body 允许滚动 */
  body.scatter-body {
    overflow: auto !important;
  }

  /* desk 脱离 fixed，变为普通块级容器 */
  .scatter-desk {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding: 16px 12px 80px;   /* 底部给页脚留空间 */
    /* 保留背景 */
    background:
      radial-gradient(ellipse at 30% 40%, rgba(212,160,23,0.06) 0%, transparent 60%),
      radial-gradient(ellipse at 75% 65%, rgba(26,120,194,0.05) 0%, transparent 55%),
      linear-gradient(160deg, #ede8de 0%, #e4ddd2 50%, #dad4c8 100%);
    min-height: 100vh;
  }

  /* 所有卡片：脱离绝对定位，变为网格子项 */
  .scatter-desk .photo-card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    transform: none !important;   /* 去掉倾斜旋转 */
    margin: 0;
    cursor: pointer;
  }

  /* 用 CSS Grid 排成 2 列 */
  .scatter-desk {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }

  /* tall 卡片横跨 1 列，保持竖构图 */
  .scatter-desk .photo-card.photo-card-tall {
    grid-column: span 1;
  }

  /* 胶带和图钉在手机端隐藏（布局变了放不下） */
  .scatter-desk .photo-tape,
  .scatter-desk .photo-pin {
    display: none;
  }

  /* Shuffle 按钮位置调整 */
  .scatter-reset {
    bottom: 60px;
    right: 16px;
  }

  /* 大图弹窗：手机端优化 */
  .lightbox-img {
    max-width: 95vw;
    max-height: 75vh;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
  }

  .lightbox-caption {
    font-size: 0.8rem;
    padding: 0 16px;
    text-align: center;
  }
}

/* ====================================================
   FOOTER
   ==================================================== */
.site-footer {
  background: linear-gradient(135deg, rgba(15,42,74,0.88), rgba(10,30,54,0.88));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.72);
  text-align: center;
  padding: 8px 0;
  font-size: 0.82rem;
  border-top: 1px solid rgba(26,120,194,0.3);
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 200;           /* 高于 scatter-desk(z-index:1) */
  margin-top: 0;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent2), transparent);
}

.site-footer a {
  color: rgba(200,225,255,0.85);
  text-decoration: none;
  transition: color var(--transition);
}

.site-footer a:hover { color: #fff; text-decoration: underline; }

/* ====================================================
   FADE-IN ANIMATION
   ==================================================== */
.fade-in {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for lists */
.fade-in:nth-child(2) { transition-delay: 0.08s; }
.fade-in:nth-child(3) { transition-delay: 0.16s; }
.fade-in:nth-child(4) { transition-delay: 0.24s; }

/* ====================================================
   TOOLTIP-LIKE PAPER NUMBER HIGHLIGHT
   ==================================================== */
.paper-item > *:first-child {
  font-variant-numeric: tabular-nums;
}

/* ====================================================
   CUSTOM SCROLLBAR
   ==================================================== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f0f2f5; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent2), var(--primary-lt));
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ====================================================
   SELECTION COLOR
   ==================================================== */
::selection {
  background: rgba(26,120,194,0.22);
  color: var(--primary);
}

/* ====================================================
   RESPONSIVE
   ==================================================== */
@media (max-width: 768px) {
  .member-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .member-card:hover { transform: none; }

  .member-photo { width: 130px; }

  .alumni-card { border-left: none; border-top: 3px solid var(--border); border-radius: 4px 4px 0 0; }
  .alumni-card:hover { border-top-color: var(--accent2); transform: none; }

  .research-card img { height: 180px; }

  .home-intro-title { font-size: calc(1.1rem + 0.5vw); }

  .site-navbar .nav-link::after { display: none; }

  .paper-item:hover { transform: none; }

  #back-to-top { bottom: 20px; right: 16px; }
}

@media (max-width: 576px) {
  .member-photo { width: 110px; }
  .year-heading { font-size: calc(0.95rem + 0.3vw); }
}
