/* ANT Lab global visual system */

:root {
  --primary: #1f4e79;
  --primary-strong: #173d61;
  --primary-soft: #eef4fb;
  --link: #2563eb;
  --text: #202936;
  --muted: #657184;
  --border: #e3e8ef;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --shadow: 0 10px 30px rgba(30, 58, 95, 0.08);
  --radius: 14px;
  --content-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0 0 64px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

/* ===== Global links ===== */
a,
a > tt {
  color: var(--link);
  text-decoration: none;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

a:hover {
  color: var(--primary-strong);
  text-decoration: none;
}

/* ===== Convert the old Jemdoc table shell into a modern page shell ===== */
table#tlayout,
table#tlayout > tbody,
table#tlayout > tbody > tr {
  display: block;
  width: 100%;
  border: 0;
  border-collapse: separate;
  background: transparent;
}

table#tlayout > tbody > tr > td {
  display: block;
  border: 0;
}

/* ===== Top navigation ===== */
#layout-menu {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  min-height: 76px;
  display: flex !important;
  align-items: center;
  gap: 4px;
  padding: 0 max(24px, calc((100vw - var(--content-width)) / 2));
  background: rgba(255, 255, 255, 0.95);
  border: 0 !important;
  border-bottom: 1px solid rgba(227, 232, 239, 0.96) !important;
  box-shadow: 0 2px 14px rgba(24, 45, 74, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  white-space: nowrap;
}

#layout-menu .menu-category:first-child {
  margin: 0 auto 0 0;
  padding: 0;
  border: 0;
  color: var(--primary-strong);
  font-size: 0;
  font-weight: 750;
  letter-spacing: -0.02em;
}

#layout-menu .menu-category:first-child::after {
  content: "Cai's Lab";
  font-size: 1.48rem;
}

/* Hide the legacy Links/Jemdoc block. */
#layout-menu .menu-category:not(:first-child),
#layout-menu .menu-category:not(:first-child) + .menu-item {
  display: none !important;
}

#layout-menu .menu-item {
  margin: 0;
  padding: 0;
  text-indent: 0;
}

#layout-menu .menu-item a,
#layout-menu .menu-item a:link,
#layout-menu .menu-item a:visited {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  margin: 0;
  padding: 0 17px;
  border: 0;
  border-radius: 9px;
  color: #475569;
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1;
}

#layout-menu .menu-item a:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

#layout-menu .menu-item a.current,
#layout-menu .menu-item a.current:link,
#layout-menu .menu-item a.current:visited {
  color: var(--primary-strong);
  background: #e8f0fa;
  border: 0;
}

/* ===== Main content ===== */
#layout-content {
  width: min(calc(100% - 48px), var(--content-width));
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px 0 80px;
  border: 0;
  background: transparent;
  text-align: left;
}

#toptitle {
  margin: 0 0 34px;
  padding: 0 0 20px;
  border: 0;
  border-bottom: 1px solid var(--border);
}

#toptitle h1,
#layout-content #toptitle h1 {
  margin: 0;
  padding: 0;
  border: 0;
  color: #182230;
  font-size: clamp(2.35rem, 4vw, 3.05rem);
  font-weight: 760;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

h1,
h2,
h3 {
  color: #1e293b;
  border: 0;
  line-height: 1.25;
}

h1 {
  font-size: 2.7rem;
}

h2 {
  margin: 46px 0 20px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
  font-size: 1.72rem;
  font-weight: 740;
  letter-spacing: -0.02em;
}

h3 {
  margin: 28px 0 12px;
  padding: 0;
  font-size: 1.28rem;
  font-weight: 720;
}

p {
  margin: 0 0 16px;
  padding: 0;
  line-height: 1.75;
}

strong,
b {
  font-weight: 700;
}

ul,
ol,
dl {
  margin-top: 8px;
  margin-bottom: 18px;
}

li {
  margin-bottom: 6px;
}

li p,
dd p {
  margin-bottom: 6px;
}

/* ===== Home page ===== */
.home-hero {
  position: relative;
  overflow: hidden;
  margin: 0 0 34px;
  padding: 50px 56px 48px;
  border: 1px solid #d7e2ee;
  border-radius: 20px;
  background:
    radial-gradient(circle at 88% 18%, rgba(64, 112, 188, 0.08) 0, rgba(64, 112, 188, 0.08) 106px, transparent 107px),
    linear-gradient(135deg, #f8fbff 0%, #edf4fb 58%, #f8fbfd 100%);
  box-shadow: 0 12px 34px rgba(30, 58, 95, 0.07);
}

.home-hero::before {
  content: "";
  position: absolute;
  right: 92px;
  bottom: -88px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(51, 93, 150, 0.10);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 940px;
}

/* 1. College: compact academic eyebrow */
.hero-college {
  display: block;
  margin: 8px 0 18px;
  color: #3f5f7f;
  font-size: clamp(1.28rem, 1.9vw, 1.55rem);
  font-weight: 680;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

/* 2. Lab name: dominant focal point */
.home-hero h1 {
  margin: 0 0 22px;
  color: #142235;
  font-size: clamp(3.2rem, 6vw, 5rem);
  font-weight: 820;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

/* 3. University: prominent affiliation, visually distinct from lab name */
.hero-university {
  display: inline-block;
  max-width: 920px;
  padding-bottom: 4px;
  color: #1f4f7b;
  font-size: clamp(1.62rem, 2.6vw, 2.16rem);
  font-weight: 760;
  line-height: 1.34;
  letter-spacing: -0.016em;
  border-bottom: 1px solid rgba(31, 79, 123, 0.26);
}

.hero-university:hover {
  color: #163f69;
  border-bottom-color: rgba(22, 63, 105, 0.55);
}

/* 4. Research areas: separate visual language from affiliation */
.hero-research {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-research-item {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 720;
  line-height: 1.2;
  letter-spacing: 0.005em;
}

/* restrained but clearly distinct colors */
.hero-research-network {
  color: #1e5d95;
  background: #e8f2fb;
  border: 1px solid #cfe1f3;
}

.hero-research-security {
  color: #0f6a5c;
  background: #e8f6f2;
  border: 1px solid #cae8df;
}

.hero-research-ai {
  color: #5b4a9a;
  background: #f0edfb;
  border: 1px solid #ddd6f5;
}

.home-profile {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 32px;
  align-items: stretch;
  margin: 32px 0 44px;
}

.home-profile-image {
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface);
}

.home-profile-image img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 285px;
  object-fit: cover;
}

.home-profile-info {
  padding: 4px 0 0;
  background: transparent;
}

.home-profile-info h2 {
  margin-top: 0;
}

.home-meta-line {
  margin-bottom: 8px;
  color: #536174;
}

.section-plain {
  margin: 0 0 36px;
  padding: 0;
  background: transparent;
}

.section-plain > :last-child {
  margin-bottom: 0;
}

.graduate-list {
  margin-top: 8px;
  padding-left: 23px;
}

.graduate-list li {
  margin-bottom: 9px;
  line-height: 1.65;
}

.join-us-block {
  max-width: 900px;
}

.research-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 20px 0 38px;
}

.research-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.research-card h3 {
  margin-top: 0;
  color: var(--primary-strong);
}

.research-card p {
  margin-bottom: 0;
  color: var(--muted);
}

/* ===== Homepage News ===== */
.news-list {
  margin: 16px 0 42px;
  border-top: 1px solid var(--border);
  background: transparent;
}

.news-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 18px 0 19px;
  border-bottom: 1px solid #e8edf3;
}

.news-date {
  padding-top: 2px;
  color: #768396;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.55;
}

.news-title-line {
  color: #1d2939;
  font-size: 1.12rem;
  font-weight: 690;
  line-height: 1.58;
}

.news-venue-prefix {
  margin-right: 8px;
  color: #2458c6;
  font-weight: 800;
  white-space: nowrap;
}

.news-title-line a {
  color: #1d2939;
  font-weight: 690;
}

.news-title-line a:hover {
  color: var(--primary);
}

/* ===== Research page ===== */
.research-page-intro {
  max-width: 820px;
  margin: -10px 0 28px;
  color: var(--muted);
  font-size: 1.14rem;
}

.research-topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.research-topic-card {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 7px 22px rgba(30, 58, 95, 0.045);
}

.research-topic-card h2 {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  color: var(--primary-strong);
  font-size: 1.36rem;
}

.research-topic-card ul {
  margin-bottom: 0;
  padding-left: 20px;
  color: #4b596b;
}

/* ===== Existing home Jemdoc image table fallback ===== */
table.imgtable {
  width: 100%;
  margin: 22px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(30, 58, 95, 0.04);
}

table.imgtable td {
  padding: 22px;
  border: 0;
  text-align: left;
  vertical-align: middle;
}

table.imgtable img {
  width: min(420px, 100%) !important;
  height: 230px !important;
  object-fit: cover;
  border-radius: 10px;
}

/* ===== Generic tables ===== */
table:not(#tlayout):not(.imgtable) {
  width: 100%;
  border: 1px solid var(--border);
  border-collapse: collapse;
  background: var(--surface);
}

table:not(#tlayout):not(.imgtable) td,
table:not(#tlayout):not(.imgtable) th {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

tr.heading {
  font-weight: 700;
  background: var(--surface-soft);
}

/* ===== Code / information blocks ===== */
tt {
  border-radius: 4px;
  background: #f2f4f7;
}

pre,
tt {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.codeblock,
.infoblock {
  margin: 20px 0;
}

.blockcontent {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

/* ===== Footer ===== */
#footer {
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: #94a3b8;
  font-size: 0.87rem;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  #layout-menu {
    padding-left: 18px;
    padding-right: 18px;
  }

  #layout-menu .menu-item a,
  #layout-menu .menu-item a:link,
  #layout-menu .menu-item a:visited {
    padding: 0 10px;
  }

  #layout-content {
    width: min(calc(100% - 34px), var(--content-width));
    padding-top: 34px;
  }

  .home-hero {
    padding: 42px 36px 38px;
  }

  .home-profile,
  .research-card-grid,
  .research-topic-grid {
    grid-template-columns: 1fr;
  }

  .news-item {
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 18px;
  }
}

@media (max-width: 680px) {
  #layout-menu {
    min-height: auto;
    flex-wrap: wrap;
    row-gap: 2px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #layout-menu .menu-category:first-child {
    flex-basis: 100%;
    margin-bottom: 4px;
  }

  #layout-menu .menu-item a,
  #layout-menu .menu-item a:link,
  #layout-menu .menu-item a:visited {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.98rem;
  }

  #layout-content {
    width: min(calc(100% - 28px), var(--content-width));
    padding-top: 28px;
  }

  .home-hero {
    padding: 34px 25px 32px;
    border-radius: 14px;
  }

  .home-hero::before {
    display: none;
  }

  .hero-college {
    margin: 7px 0 16px;
    font-size: 1.12rem;
    letter-spacing: 0;
  }

  .hero-university {
    font-size: 1.38rem;
  }

  .hero-research {
    gap: 8px;
    margin-top: 20px;
  }

  .hero-research-item {
    font-size: 0.93rem;
    min-height: 32px;
    padding: 5px 10px;
  }

  .news-item {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 15px 0 16px;
  }

  .news-date {
    font-size: 0.95rem;
  }

  .news-title-line {
    font-size: 1.04rem;
  }

  table.imgtable,
  table.imgtable > tbody,
  table.imgtable > tbody > tr,
  table.imgtable td {
    display: block;
    width: 100%;
  }

  table.imgtable td {
    padding: 16px;
  }

  table.imgtable img {
    width: 100% !important;
    height: 220px !important;
  }
}

@media print {
  #layout-menu {
    display: none !important;
  }

  #layout-content {
    width: 100%;
    max-width: none;
  }
}
