/* ============================================================
   Sheng-Wei Chan — Academic Homepage
   Palette: paper white / ink black / single cobalt accent
   Type:    Source Serif 4 + Noto Serif TC (display)
            Inter + Noto Sans TC (body)
            IBM Plex Mono (metadata)
   Latin and CJK are matched per family, so each script keeps
   its own proportions instead of falling back to system defaults.
   ============================================================ */

:root {
  --paper: #fbfbfa;
  --surface: #ffffff;
  --ink: #191b1f;
  --text: #363b43;
  --muted: #6b7280;
  --line: #e4e5e3;
  --line-soft: #efefed;
  --accent: #1f47c5;
  --accent-soft: #f3f5fd;

  --serif: "Source Serif 4", "Noto Serif TC", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

/* ------------------------------------------------------------
   Language switching
   One of the two language layers is hidden at all times.
   With JavaScript off, data-lang stays "en" from the markup,
   so the page still reads correctly.
   ------------------------------------------------------------ */
html[data-lang="en"] [lang="zh-Hant"] {
  display: none;
}

html[data-lang="zh"] [lang="en"] {
  display: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  background: var(--paper);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

section[id],
div[id] {
  scroll-margin-top: 84px;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: #c8cbd0;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

a:focus-visible,
.btn:focus-visible,
.hero-btn:focus-visible,
.lang-toggle button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------------------------------------------------------------
   Navigation
   ------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  flex-shrink: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.topbar nav {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 24px;
  align-items: baseline;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar nav::-webkit-scrollbar {
  display: none;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

.topbar nav a:hover {
  color: var(--accent);
}

/* Language toggle — a two-state control, never scrolls away */
.lang-toggle {
  flex-shrink: 0;
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface);
}

.lang-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 5px 11px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.6;
  transition: 0.15s ease;
}

.lang-toggle button + button {
  border-left: 1px solid var(--line);
}

.lang-toggle button:hover {
  color: var(--ink);
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: #ffffff;
}

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px 24px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 56px;
}

.content {
  min-width: 0;
}

/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------ */
.profile-card {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px;
}

.profile-img {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  display: block;
  margin: 0 auto 20px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.profile-card h1 {
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: -0.2px;
  color: var(--ink);
}

.name-roman {
  margin: 3px 0 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.subtitle {
  margin: 10px 0 4px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.affiliation {
  margin: 4px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.identity-box {
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafaf8;
}

.identity-box dt {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.identity-box dd {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
}

.identity-box dd + dt {
  margin-top: 12px;
}

.social-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.social-list li {
  margin: 11px 0;
  color: var(--text);
  font-size: 14.5px;
}

.social-list i {
  width: 24px;
  color: var(--muted);
  text-align: center;
  margin-right: 2px;
}

/* ------------------------------------------------------------
   Sections
   Signature: hairline top rule with a short accent segment
   ------------------------------------------------------------ */
.section {
  position: relative;
  padding: 40px 0 28px;
  border-top: 1px solid var(--line);
}

.section::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 56px;
  height: 3px;
  background: var(--accent);
}

.section h2 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.section p {
  color: var(--text);
}

.section-note {
  margin: 20px 0 0;
  font-size: 14px;
  color: var(--muted);
}

/* ------------------------------------------------------------
   Hero
   ------------------------------------------------------------ */
.hero {
  padding: 10px 0 46px;
}

.hero-label {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1.65;
}

.hero h1 {
  margin: 0 0 18px;
  max-width: 810px;
  font-family: var(--serif);
  font-size: clamp(31px, 4.1vw, 43px);
  line-height: 1.16;
  letter-spacing: -0.5px;
  font-weight: 700;
  color: var(--ink);
}

.hero p {
  margin: 0;
  max-width: 690px;
  font-size: 17px;
  color: #464c55;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: 0.15s ease;
}

.hero-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
  text-decoration: none;
}

.hero-btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.hero-btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* ------------------------------------------------------------
   Research areas — card grid, one tile per area
   ------------------------------------------------------------ */
.area-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.area-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 24px 26px 22px;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

/* Accent bar that sweeps in along the top edge on hover */
.area-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.area-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 16px 32px -20px rgba(31, 71, 197, 0.4);
}

.area-card:hover::before {
  transform: scaleX(1);
}

.area-card .area-name {
  margin-bottom: 8px;
}

.area-card .area-works {
  margin-top: auto;
  padding-top: 4px;
}

.area-name {
  font-family: var(--serif);
  font-size: 17.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.area-desc {
  margin: 0 0 8px;
  font-size: 14.5px;
  color: var(--muted);
}

.area-data {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.area-data::before {
  content: "Benchmarks — ";
}

html[data-lang="zh"] .area-data::before {
  content: "資料集 — ";
  font-family: var(--sans);
}

.area-works {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.area-works > a,
.area-works > span {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.area-works > a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.area-works > span {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  background: #fafaf8;
  border-style: dashed;
}

/* ------------------------------------------------------------
   Tags / skills
   ------------------------------------------------------------ */
.tag-group,
.skill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.tag-group > span,
.skill-grid > span {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: #4a505a;
  font-size: 13px;
  font-weight: 500;
}

/* ------------------------------------------------------------
   News
   ------------------------------------------------------------ */
.news-box {
  max-height: 290px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 6px 22px;
}

.news-box ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-box li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}

.news-box li:last-child {
  border-bottom: none;
}

.news-box strong {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  padding-top: 2px;
}

/* ------------------------------------------------------------
   Publications
   ------------------------------------------------------------ */
.pub-group-title {
  margin: 36px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}

.pub-group-title.first {
  margin-top: 0;
}

html[data-lang="zh"] .pub-group-title {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.publication-card {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 30px;
  align-items: start;
  padding: 28px 0;
  border-bottom: 1px solid var(--line-soft);
}

.paper-visual {
  height: 148px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}

.paper-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.paper-visual.placeholder {
  background: #f7f7f5;
  border-style: dashed;
}

.paper-visual.placeholder span {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
}

.paper-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
}

.badge.accepted {
  color: var(--accent);
  border-color: #c9d4f2;
  background: var(--accent-soft);
}

.area-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

html[data-lang="zh"] .badge,
html[data-lang="zh"] .area-label {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.paper-info p {
  margin: 0;
  font-size: 15px;
}

.paper-info h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.paper-info .authors {
  font-size: 14.5px;
  color: var(--muted);
}

.paper-info .authors strong {
  color: var(--ink);
  font-weight: 600;
}

.paper-info .venue {
  margin: 4px 0 10px;
  font-size: 14.5px;
  color: var(--muted);
}

.paper-info .result {
  margin: 12px 0 0;
  padding-left: 13px;
  border-left: 2px solid var(--accent);
  font-size: 14.5px;
  color: var(--text);
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: 0.15s ease;
}

.btn i {
  color: var(--muted);
  font-size: 13px;
  transition: 0.15s ease;
}

.btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.btn:hover i {
  color: var(--accent);
}

.btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ------------------------------------------------------------
   Projects
   ------------------------------------------------------------ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.project-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  background: var(--surface);
}

.project-card h3 {
  margin: 0 0 10px;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.project-card p {
  margin: 0 0 6px;
  font-size: 14.5px;
  color: var(--text);
}

.project-tag {
  display: inline-block;
  margin: 8px 6px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #fafaf8;
}

html[data-lang="zh"] .project-tag {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.03em;
}

/* ------------------------------------------------------------
   Timeline
   ------------------------------------------------------------ */
.timeline {
  border-left: 2px solid var(--line);
  padding-left: 24px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -29px;
  top: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.time {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  padding-top: 2px;
}

.timeline h3 {
  margin: 0 0 2px;
  font-size: 17px;
  color: var(--ink);
}

.timeline p {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

/* ------------------------------------------------------------
   Awards
   ------------------------------------------------------------ */
.award-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.award-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.award-list li:first-child {
  padding-top: 0;
}

.award-list li:last-child {
  border-bottom: none;
}

.award-name {
  font-size: 15.5px;
  color: var(--ink);
}

.award-detail {
  display: block;
  font-size: 14px;
  color: var(--muted);
}

.award-count {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

@media screen and (max-width: 600px) {
  .award-list li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ------------------------------------------------------------
   Coursework
   ------------------------------------------------------------ */
.coursework-box h3 {
  margin: 20px 0 6px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}

.coursework-box > div:first-child h3 {
  margin-top: 0;
}

.coursework-box p {
  margin: 0 0 8px;
  font-size: 15px;
}

html[data-lang="zh"] .coursework-box h3 {
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */
footer {
  text-align: center;
  color: var(--muted);
  padding: 34px 0 8px;
  font-size: 13.5px;
}

footer p {
  margin: 4px 0;
}

/* ------------------------------------------------------------
   Chinese typography
   CJK needs more leading and no negative tracking; Latin display
   sizes run too large once set in Chinese.
   ------------------------------------------------------------ */
html[data-lang="zh"] body {
  line-height: 1.85;
}

html[data-lang="zh"] .hero h1 {
  font-size: clamp(27px, 3.5vw, 37px);
  line-height: 1.4;
  letter-spacing: 0;
}

html[data-lang="zh"] .hero-label {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.04em;
}

html[data-lang="zh"] .section h2 {
  line-height: 1.45;
  letter-spacing: 0;
}

html[data-lang="zh"] .profile-card h1 {
  letter-spacing: 0;
}

html[data-lang="zh"] .subtitle {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.08em;
}

html[data-lang="zh"] .area-name,
html[data-lang="zh"] .project-card h3 {
  line-height: 1.55;
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media screen and (max-width: 980px) {
  .page {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 36px 22px;
  }

  .profile-card {
    position: static;
    max-width: 460px;
    margin: 0 auto;
  }

  .publication-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .paper-visual {
    height: 170px;
    max-width: 340px;
  }

  .area-grid {
    grid-template-columns: 1fr;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}

@media screen and (max-width: 600px) {
  .topbar-inner {
    padding: 10px 18px;
    gap: 14px;
  }

  .topbar nav {
    gap: 18px;
  }

  .hero h1 {
    font-size: 29px;
  }

  .hero p {
    font-size: 16px;
  }

  .section h2 {
    font-size: 23px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .news-box li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .marquee-track {
    animation: none !important;
  }

}

/* ============================================================
   Individual paper pages
   ============================================================ */
.paper-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 32px 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 28px;
}

.back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

html[data-lang="zh"] .back-link {
  font-family: var(--sans);
  font-size: 13px;
}

.paper-header {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.paper-header h1 {
  margin: 12px 0 16px;
  font-family: var(--serif);
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.25;
  letter-spacing: -0.4px;
  font-weight: 700;
  color: var(--ink);
}

.paper-header .authors {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--muted);
}

.paper-header .authors strong {
  color: var(--ink);
  font-weight: 600;
}

.paper-header .venue {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.equal-note {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}

.paper-figure {
  margin: 32px 0 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.paper-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.paper-figure figcaption {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

.tldr {
  margin: 32px 0 0;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 4px 12px 12px 4px;
  background: var(--accent-soft);
}

.tldr h2 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

html[data-lang="zh"] .tldr h2 {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0.08em;
}

.tldr p {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}

.paper-section {
  padding: 36px 0 0;
}

.paper-section h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.3;
  letter-spacing: -0.2px;
  color: var(--ink);
}

html[data-lang="zh"] .paper-section h2 {
  line-height: 1.45;
  letter-spacing: 0;
}

.paper-section h3 {
  margin: 26px 0 8px;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--ink);
}

.paper-section p {
  margin: 0 0 14px;
  font-size: 16px;
}

.paper-section p:last-child {
  margin-bottom: 0;
}

.paper-section ul {
  margin: 0 0 14px;
  padding-left: 20px;
}

.paper-section li {
  margin-bottom: 8px;
  font-size: 15.5px;
}

/* Result tables */
.table-wrap {
  margin: 18px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

table.data caption {
  padding: 14px 18px 0;
  font-size: 13.5px;
  color: var(--muted);
  text-align: left;
}

table.data th,
table.data td {
  padding: 10px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}

table.data th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

html[data-lang="zh"] table.data th {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}

table.data td:not(:first-child) {
  font-family: var(--mono);
  font-size: 13.5px;
}

table.data tbody tr:last-child td {
  border-bottom: none;
}

table.data tr.ours td {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}

table.data tr.ours td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

.table-note {
  margin: -4px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}

/* BibTeX */
.bibtex {
  margin: 14px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafaf8;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre;
}

.paper-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

@media screen and (max-width: 600px) {
  .paper-page {
    padding: 28px 18px 20px;
  }

  .paper-figure {
    padding: 14px;
  }

  table.data th,
  table.data td {
    padding: 9px 12px;
  }
}

/* ------------------------------------------------------------
   Publication cards that link through to a detail page
   ------------------------------------------------------------ */
a.paper-visual {
  text-decoration: none;
  transition: border-color 0.15s ease;
}

a.paper-visual:hover {
  border-color: var(--accent);
}

.paper-info h3 a {
  color: var(--ink);
  text-decoration: none;
}

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

.coursework-box .section-note {
  margin-top: 16px;
  font-size: 13px;
}

/* ------------------------------------------------------------
   Collaborators
   ------------------------------------------------------------ */
.collab-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

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

.collab-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.collab-role {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

html[data-lang="zh"] .collab-role {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.collab-card > p {
  margin: 12px 0 0;
  font-size: 14.5px;
  color: var(--text);
}

.collab-card details {
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.collab-card summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent);
}

.collab-card summary::-webkit-details-marker {
  display: none;
}

.collab-card summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s ease;
}

.collab-card details[open] summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.collab-card summary:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.joint-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.joint-list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14.5px;
  line-height: 1.6;
}

.joint-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.joint-list .joint-role {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

html[data-lang="zh"] .joint-list .joint-role {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.03em;
}

@media screen and (max-width: 980px) {
  .collab-grid {
    grid-template-columns: 1fr;
  }
}

.methods-strip {
  margin: -6px 0 22px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafaf8;
  font-size: 14px;
  color: var(--text);
}

.methods-strip .methods-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 10px;
}

html[data-lang="zh"] .methods-strip .methods-label {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* Full-width project row */
.project-grid.wide {
  grid-template-columns: 1fr;
}

/* ------------------------------------------------------------
   Figure lightbox — architecture diagrams are unreadable small
   ------------------------------------------------------------ */
.paper-figure img {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(25, 27, 31, 0.88);
  cursor: zoom-out;
}

.lightbox[open],
.lightbox.is-open {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #ffffff;
  border-radius: 8px;
  padding: 16px;
}

.lightbox-hint {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.6);
}

html[data-lang="zh"] .lightbox-hint {
  font-family: var(--sans);
  font-size: 12.5px;
}

/* ------------------------------------------------------------
   Copy button (BibTeX)
   ------------------------------------------------------------ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
}

.copy-btn {
  flex-shrink: 0;
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  transition: 0.15s ease;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ------------------------------------------------------------
   Marquee — keyword ticker under the top bar
   Two identical segments scroll by -50% for a seamless loop.
   ------------------------------------------------------------ */
.marquee {
  overflow: hidden;
  background: var(--ink);
  user-select: none;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 34s linear infinite;
}

/* Without JS there is only one segment, so keep the strip static */
html:not(.js) .marquee-track {
  animation: none;
}

.marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-seg {
  display: flex;
  align-items: center;
  gap: 26px;
  /* Half the token gap on each side, so the seam between segments matches */
  padding: 10px 13px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #f2f2ef;
}

.mq-dot {
  font-size: 9px;
  color: #7d95ea;
}

html[data-lang="zh"] .marquee-seg {
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.1em;
}

@keyframes marquee-scroll {
  to {
    transform: translateX(-50%);
  }
}

/* ------------------------------------------------------------
   Print
   ------------------------------------------------------------ */
@media print {
  .topbar,
  .lang-toggle,
  .hero-buttons,
  .button-group,
  .back-link,
  .copy-btn,
  .lightbox,
  .marquee,
  .paper-footer {
    display: none !important;
  }

  body {
    background: #ffffff;
    font-size: 11pt;
  }


  .page {
    display: block;
    padding: 0;
    max-width: none;
  }

  .profile-card {
    position: static;
    border: none;
    padding: 0 0 18px;
  }

  .section,
  .paper-section,
  .publication-card,
  .project-card,
  .collab-card,
  .area-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .news-box {
    max-height: none;
    overflow: visible;
  }

  .collab-card details > *:not(summary) {
    display: block !important;
  }

  a {
    text-decoration: none;
    color: var(--ink);
  }
}
