:root {
  --base-font-size: 16px;
  --siteBackgroundColor: #ffffff;
  --paragraphMediumColor: #222222;
  --heading-font-font-family: Georgia, serif;
  --body-font-font-family: "Helvetica Neue", sans-serif;
}

body {
  font-size: var(--base-font-size);
  font-family: var(--body-font-font-family);
  background-color: var(--siteBackgroundColor);
  color: var(--paragraphMediumColor);
  margin: 0;
  padding: 0; 
}

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



.hero {
  min-height: 100vh;
  background: linear-gradient(to bottom right, #fafafa, #eee);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
}

.hero-content h1 {
  font-size: 3.5rem;
  font-family: var(--heading-font-font-family);
  margin-bottom: 1rem;
}

.hero-content p {
  font-size: 1.5rem;
  margin-bottom: 2rem;
}

.hero-card-stage {
  width: min(1040px, calc(100vw - 7rem));
  min-height: 510px;
  perspective: 1400px;
  transition: transform 0.28s ease;
}

.hero-card-stage:hover {
  transform: translateY(-3px);
}

.academic-identity-card,
.hero-card-inner {
  width: 100%;
  min-height: inherit;
}

.academic-identity-card {
  position: relative;
}

.hero-card-inner {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.academic-identity-card.flipped .hero-card-inner {
  transform: rotateY(180deg);
}

.hero-card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(34, 34, 34, 0.1);
  border-radius: 20px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 22px 55px rgba(20, 29, 48, 0.14);
}

.hero-card-front {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 31%);
  align-items: stretch;
  gap: clamp(2rem, 4vw, 4rem);
  padding: clamp(2.4rem, 4vw, 3.75rem);
  background: rgba(255, 255, 255, 0.94);
  text-align: left;
  transform: rotateY(0deg);
}

.hero-card-stage:hover .hero-card-face {
  box-shadow: 0 27px 65px rgba(20, 29, 48, 0.17);
}

.identity-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.identity-copy p {
  margin: 0;
}

.identity-kicker {
  color: #b01825;
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.identity-copy h1 {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.28em;
  margin: 0.75rem 0 0.45rem;
  font-family: var(--heading-font-font-family);
  font-size: clamp(2.85rem, 4.4vw, 4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.identity-copy h1 .name-chinese {
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.identity-field {
  color: #1e3a8a;
  font-family: var(--heading-font-font-family);
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
}

.identity-position {
  width: 100%;
  max-width: 620px;
  margin-top: 0.9rem !important;
  color: #3d3d3d;
  font-size: 1.02rem;
  line-height: 1.5;
}

.identity-position a {
  color: #005f99;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.identity-research {
  max-width: 620px;
  margin-top: 1rem !important;
  color: #303030;
  font-family: var(--heading-font-font-family);
  font-size: 1.1rem;
  line-height: 1.55;
}

.identity-card-footer {
  display: flex;
  width: 100%;
  max-width: 620px;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(30, 58, 138, 0.18);
}

.identity-contact,
.identity-links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}

.identity-contact {
  gap: 0.45rem;
}

.identity-contact-label {
  color: #777;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.identity-links {
  justify-content: flex-end;
  gap: 0.65rem 1.45rem;
}

.identity-email {
  color: #252525;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.identity-links a {
  position: relative;
  color: #b01825;
  font-size: 0.95rem;
  font-weight: 750;
  text-decoration: none;
}

.identity-links a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}

.identity-links a:hover::after,
.identity-links a:focus-visible::after {
  transform: scaleX(1);
}

.hero-flip-control {
  margin-top: 1.5rem;
  padding: 0.72rem 1rem;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: #b01825;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.hero-flip-control:hover,
.hero-flip-control:focus-visible {
  background: #8f101c;
  transform: translateY(-2px);
}

.identity-portrait {
  position: relative;
  min-height: 360px;
  margin: 0;
  overflow: hidden;
  border-radius: 11px;
  background: linear-gradient(145deg, #7e111b, #b01825 48%, #1e3a8a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.portrait-placeholder,
.identity-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.portrait-placeholder {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.94);
  font-family: var(--heading-font-font-family);
  font-size: 6rem;
  letter-spacing: 0.04em;
}

.identity-portrait img {
  object-fit: cover;
  object-position: center;
}

.hero-card-back {
  display: flex;
  transform: rotateY(180deg);
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(2.75rem, 5vw, 4.75rem);
  color: #fff;
  background: linear-gradient(145deg, #191d29, #26365c);
  text-align: left;
}

.hero-card-back .identity-kicker {
  color: rgba(255, 255, 255, 0.65);
}

.hero-card-back h2 {
  max-width: 780px;
  margin: 0.75rem 0 1.45rem;
  font-family: var(--heading-font-font-family);
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1.08;
}

.hero-card-back > p {
  max-width: 820px;
  margin: 0 0 1rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: 1.04rem;
  line-height: 1.55;
}

.hero-research-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.hero-research-topics button {
  padding: 0.42rem 0.68rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hero-research-topics button:hover,
.hero-research-topics button:focus-visible {
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.hero-flip-control-back {
  margin-top: 1.8rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.08);
}

.hero-flip-control-back:hover,
.hero-flip-control-back:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

#intro {
  max-width: 750px;      
  margin: 0 auto;         /* 居中显示 */
  padding: 1rem 1.5rem;   /* 给左右一些缓冲 */
  text-align: justify;     
  
}

/* For links */
.hero-content a {
  position: relative;
  text-decoration: none;
  color: #005f99;
}
.hero-content a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0%;
  height: 2px;
  background-color: #005f99;
  transition: width 0.3s ease;
}
.hero-content a:hover::after {
  width: 100%;
}

.full-screen-section {
  height: 100vh;
  background-color: #f8f8f8;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  text-align: center;
}


.section-content {
  width: 100%;
}

section#research {
  background-color: #ffffff;
  padding: 2rem 1rem;
}

#research h2 {
  text-align: center;
  font-size: 3rem;       
  margin-bottom: 2rem;
  font-family: var(--heading-font-font-family);
}

#talks h2 {
  text-align: center;
  font-size: 3rem;       
  margin-bottom: 2rem;
  font-family: var(--heading-font-font-family);
}


.full-screen-section h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  font-family: var(--heading-font-font-family);
}



.paper-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 850px;
}

.paper-list li {
  margin-bottom: 2rem;
}

.paper-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap; /* 避免溢出时断行混乱 */
}


.collaborator {
  font-style: italic;
  color: #444;
  margin-left: 1rem;
  white-space: nowrap;
}

  .journal {
    font-style: italic;
    color: #666;
    font-size: 0.95rem;
    margin-top: 0.3rem;
  }

.paper-list {
  padding-left: 0;
  margin-left: 0;
  list-style: none;           /* optional: 去掉左侧圆点 */
}

.paper-list li {
  text-align: left;
  margin-bottom: 1.8rem;      /* 增加每条之间的垂直间距 */
  line-height: 1.5;
  max-width: 850px;           /* 防止行太长，便于阅读 */
}

.paper-list li:not(:last-child) {
  border-bottom: 1px dashed #ddd;   /* 可选：添加浅浅的分隔线 */
  padding-bottom: 1rem;
}

.paper-list a {
  position: relative;
  text-decoration: none;
  color: #b01825;
}
.paper-list a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0%;
  height: 2px;
  background-color: #700010;
  transition: width 0.3s ease;
}
.paper-list a:hover::after {
  width: 100%;
}


@keyframes draw-brush {
  to {
    stroke-dashoffset: 0;
  }
}


.fade-in-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  margin-bottom: 1.5rem;
}

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

.section-title {
  text-align: center;
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
  color: #111;
}

.center-underline {
  width: 800px;
  height: 3px;
  margin: 0 auto 3rem auto;
  position: relative;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.8s ease-out;
}

#hero_underline {
  background-color: #333;
}

#research_underline {
  background-color: #b01825;
}


.center-underline.visible {
  transform: scaleX(1);
}

/* Container for all cards */

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  column-gap: 16px;  /* 横向间距变小 */
  row-gap: 20px;     /* 保持垂直间距 */
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px;
  box-sizing: border-box;
}

.card-container {
  perspective: 1000px;
  position: relative;
  border-radius: 10px;
  box-sizing: border-box;
  overflow: visible; /* 确保阴影不被遮住 */
}

.card-inner{
  position: relative;
  width: 100%;
  height: 250px;
  text-align: center;
  transform-style: preserve-3d;
  cursor: pointer;
  transform: translateZ(0);
  border-radius: 10px;
  transition: transform 0.8s ease, box-shadow 0.4s ease;
}


.card-inner.flipped {
  transform: rotateY(180deg) scale(1.02);
}

.card-inner.flipped.highlighted {
  transform: rotateY(180deg) translateY(-8px) scale(1.02);
  transition: transform 0.8s ease;
}

.card-inner.highlighted {
  box-shadow:
    0 0 10px rgba(176, 24, 37, 0.3),
    0 0 20px rgba(176, 24, 37, 0.2),
    0 0 30px rgba(176, 24, 37, 0.15);
  border-radius: 10px;
  transform: translateY(-8px) scale(1.02);
  transition: transform 0.8s ease, box-shadow 0.4s ease;
}

@keyframes wiggle {
  0%   { transform: rotateY(0deg); }
  25%  { transform: rotateY(8deg); }
  50%  { transform: rotateY(-8deg); }
  75%  { transform: rotateY(5deg); }
  100% { transform: rotateY(0deg); }
}
.wiggle-on-hover:hover {
  perspective: 1000px;
}

.wiggle-on-hover:hover {
  animation: wiggle 0.6s ease-in-out;
}

.card-front, .card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 2px 4px 10px rgba(0,0,0,0.1);
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  transition:
    border 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease;
}




.card-back {
  transform: rotateY(180deg);
  font-size: 2rem;
  line-height: 1.6;
  text-align: left;
  padding: 20px;    
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
        
.abstract {
  font-size: 1.2rem;
  line-height: 1.4;
  color: #222;
}

.paper-meta {
  font-size: 1rem;
  color: #555;
}

.paper-journal {
  font-size: 1rem;
  font-weight: bold;
  margin-top: 4px;
  color: #333;
}
.paper-title-container {
  font-size: 1.3rem;
  line-height: 1.4;
  color: #b01825;
  margin-bottom: 8px;
  display: inline;  /* important */
  white-space: normal;
}



.link-btn {
  font-size: 1rem;
  color: #555;
  text-decoration: none;
  margin-top: 12px;
  cursor: pointer;
  transform: scale(1.3);
  display: inline-block;
}

.link-btn:hover {
  color: #b01825;
}

.paper-title {
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  font-weight: bold;
  font-size: 1.25rem;
  color: #b01825;
  text-decoration: none;
}

.paper-title:hover {
  text-decoration: underline;  /* show underline on hover */
}

.paper-meta {
  font-style: italic;
  margin-top: 0.3rem;
  font-size: 1.05rem;
  color: #555;
}

.paper-journal {
  font-weight: bold;
  margin-top: 0.5rem;
  color: #333;
  font-size: 1.05rem;  
}

.submitted {
  margin-top: 0.5rem;
  color: rgba(51, 51, 51, 0.8);
  font-size: 1.05rem;  
}



.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: #222;
  color: white;
  display: flex;
  padding: 12px 24px;
  font-family: sans-serif;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.nav-left .brand {
  font-weight: bold;
  font-size: 1.2rem;
  margin-right: 10px;
}

.nav-left a {
  color: white;
  text-decoration: none;
  font-size: 1rem;
}

.nav-left a:hover {
  text-decoration: underline;
}


.topic-buttons button {
  background: #eee;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.7rem;
  cursor: pointer;
}

.topic-buttons button:hover {
  background-color: #b01825;
  color: white;
}

.topic-buttons {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: 20px;
}

.topic-buttons.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.topic-buttons button.active {
  background-color: #b01825;
  color: white;
  box-shadow: 0 0 6px rgba(176, 24, 37, 0.4);
  transform: translateY(-1px);
}



.talks-section {
  background-color: #f5f7fc; /* 浅蓝灰背景 */
  padding: 60px 20px;
}


#talks_underline {
  background-color: #1e3a8a;
}

.talks-container {
  max-width: 1100px;  /* 可以调整为1000、960等 */
  margin: 0 auto;
  padding: 0 20px;   /* 防止在窄屏贴边 */
}

.talk-year {
  font-size: 1.6rem;
  font-weight: 600;
  color: #1e3a8a;
  margin-top: 20px;
  margin-bottom: 6px;
  border-left: 4px solid #1e3a8a;
  padding-left: 12px;
}
.talk-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 4px;
}

.talk-list li {
  font-family: "Segoe UI", Roboto, sans-serif;
  font-size: 1.3rem;
  padding: 1px 0;
  padding-left: 7rem;
  border-bottom: 1px dashed rgba(30, 58, 138, 0.2);
}

.talk-year + .talk-list::before {
  content: "";
  display: block;
  height: 1px;
  background: rgba(30, 58, 138, 0.1);
  margin: 10px 0;
}

/* Default: desktop version shows cards, hides plain text */
.desktop-only {
  display: block; /* Keep only one of these */
}

.mobile-only {
  display: none;
}

@media (min-width: 768px) and (max-width: 1050px) {
  .hero-card-stage {
    width: calc(100vw - 3.5rem);
  }

  .hero-card-front {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 31%);
    gap: 2.5rem;
    padding: 2.5rem;
  }

  .identity-copy h1 {
    font-size: clamp(2.7rem, 5vw, 3.2rem);
  }
}

/* Mobile specific styles */
@media (max-width: 767px) { 
  body {
    font-size: 14px; /* Slightly smaller base font size for phones */
  }

  .desktop-only {
    display: none !important; /* This will now only apply to actual mobile sizes */
  }

  .topic-buttons {
    display: none; /* Hide topic buttons on mobile, !important is removed for cleaner code */
    opacity: 0;
    pointer-events: none;
  }

  .mobile-only {
    display: block; /* Use block for list items to stack properly */
  }
  
    
/* Hero section adjustments for mobile */
  .hero {
    min-height: 100svh;
    height: auto;
    padding: 5rem 1rem 2.5rem;
  }

  .academic-identity-card {
    width: 100%;
    min-height: 0;
  }

  .hero-card-stage {
    width: 100%;
    min-height: 0;
    perspective: none;
  }

  .hero-card-stage:hover {
    transform: none;
  }

  .hero-card-inner {
    min-height: 0;
    transform: none !important;
  }

  .hero-card-front {
    position: relative;
    inset: auto;
    grid-template-columns: 1fr;
    gap: 1.6rem;
    padding: 1.35rem 1.25rem 1.75rem;
    border-radius: 16px;
    box-shadow: 0 15px 38px rgba(20, 29, 48, 0.13);
    text-align: center;
  }

  .hero-card-stage:hover .hero-card-face {
    box-shadow: 0 15px 38px rgba(20, 29, 48, 0.13);
  }

  .hero-card-back,
  .hero-flip-control {
    display: none;
  }

  .identity-portrait {
    order: -1;
    width: 145px;
    min-height: 0;
    aspect-ratio: 4 / 5;
    margin: 0 auto;
    border-radius: 12px;
  }

  .identity-copy {
    align-items: center;
  }

  .identity-kicker {
    font-size: 0.68rem;
    line-height: 1.4;
  }

  .identity-copy h1 {
    margin-top: 0.55rem;
    font-size: 2.15rem;
    line-height: 1.05;
    letter-spacing: -0.025em;
  }

  .identity-field {
    font-size: 1.25rem;
  }

  .identity-position {
    margin-top: 1.1rem !important;
    font-size: 0.95rem;
  }

  .identity-research {
    margin-top: 0.85rem !important;
    font-size: 1rem;
    line-height: 1.45;
  }

  .identity-links {
    justify-content: center;
  }

  .identity-card-footer {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 0.9rem;
  }

  .identity-contact {
    justify-content: center;
  }

  .hero-content h1 {
    font-size: 2rem; /* Further reduce font size for very small screens */
  }
  .hero-content p {
    font-size: 1rem; /* Adjust paragraph font size for readability on small screens */
  }
  #intro {
    padding: 0 0.5rem; /* Reduce padding to give more horizontal space to the text */
    text-align: left; /* Optional: left align intro text for better readability on mobile */
  }    
    

  /* Navbar adjustments for mobile */
  .navbar {
    display: none; 
    opacity: 0;
    pointer-events: none;
  }

  /* Research section adjustments for mobile papers */
  .M_paper-list {
    list-style: none;
    max-width: 100%; /* Ensure it takes full width */
    margin: 0; /* Center the list */
  }

  .M_paper-list li {
    margin-bottom: 1rem; /* Reduced margin */
    padding-bottom: 0.8rem;
    max-width: 100%;
  }

    .M_paper-title {
  font-weight: 600;
  color: #b01825;
  font-size: 1.1rem;
  text-align: left;
    }
    .M_paper-title a {
      color: #b01825;
    }

    .M_journal{
      margin-top: 0.3rem;
      font-size: 0.95rem;
      color: #333;
      font-weight: bold;
      font-style: italic;
      text-align: left;
    }
    .M_collaborator {
      font-style: italic;
      color: #444;
      text-align: left;
    }
  .M_submitted {
      margin-top: 0.3rem;
      font-size: 0.95rem;
      color: rgba(51, 51, 51, 0.8);
      text-align: left;
   }

    
  section {
    padding: 0rem; /* Adjust overall section padding for mobile, reducing side padding */
  }

  .section-content {
    padding: 0 0rem; /* Reduce padding inside section content for more space */
    width: 100%;
    max-width: 100%;
  }

  /* Talks section adjustments for mobile */
  .talks-container {
    padding: 0 0.5rem;
  }

  .talk-year {
    font-size: 1rem;
    padding-left: 8px; /* Slightly less padding */
  }

  .talk-list li {
    font-size: 0.8rem; /* Smaller font for talk details */
    padding-left: 0.5rem; /* Reduced padding */
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
