:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #e9edeb;
  --ink: #0a0c0d;
  --ink-2: #202426;
  --muted: #626a6d;
  --soft: #5f686c;
  --line: #d3d9d6;
  --line-strong: #9ca6a2;
  --accent: #55e6c1;
  --accent-dark: #006b59;
  --blue: #21677a;
  --danger: #ff6b5d;
  --shadow: 0 24px 70px rgba(10, 12, 13, 0.1);
  --sans: "Avenir Next", Avenir, "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Noto Serif CJK SC", "Songti SC", serif;
  --mono: "SFMono-Regular", Menlo, "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --site-width: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg width='48' height='48' viewBox='0 0 48 48' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0H48M0 0V48' fill='none' stroke='%230a0c0d' stroke-opacity='.025'/%3E%3C/svg%3E");
  font-family: var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.lightbox-open {
  overflow: hidden;
}


a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 3px;
}

section,
#about {
  scroll-margin-top: var(--header-offset, 104px);
}

.sr-live,
.sr-only {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0.08;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23000' fill-opacity='.16'%3E%3Ccircle cx='8' cy='12' r='.6'/%3E%3Ccircle cx='31' cy='7' r='.45'/%3E%3Ccircle cx='49' cy='29' r='.55'/%3E%3Ccircle cx='19' cy='46' r='.45'/%3E%3C/g%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: 72px;
  overflow: hidden;
  border-bottom: 1px solid #25292b;
  background: #080a0b;
  color: #f5f7f6;
}

.topbar-inner {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 42px;
  width: min(var(--site-width), calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
}

.nav-links {
  grid-column: 2;
  display: flex;
  justify-content: center;
  justify-content: safe center;
  gap: 36px;
}

.nav-links a {
  position: relative;
  padding: 12px 0;
  color: #aeb5b6;
  font: 650 16px/1 var(--sans);
  letter-spacing: 0.025em;
  white-space: nowrap;
  transition: color 160ms ease;
}

.nav-links a:hover,
.nav-links a.is-current {
  color: #ffffff;
}

.language-switch {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: #b8c4c1;
  font: 650 13px/1.2 var(--sans);
  white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.lang-btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.lang-btn.is-active {
  background: #f0f8f4;
  color: #10221a;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.14);
}

.lang-label-compact {
  display: none;
}

/* Core layout */
.page-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  grid-template-areas: "sidebar content";
  column-gap: 64px;
  row-gap: 0;
  width: min(var(--site-width), calc(100% - 48px));
  margin: 54px auto 0;
}

.page-shell:focus {
  outline: none;
}

.profile-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: var(--profile-sticky-top, 116px);
  align-self: start;
  min-width: 0;
  /* Keep tall laptop profiles visible without turning off sticky positioning. */
  max-height: calc(100vh - var(--profile-sticky-top, 116px) - 16px);
  max-height: calc(100dvh - var(--profile-sticky-top, 116px) - 16px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #ccd5d0 transparent;
}
.profile-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  color: var(--muted);
  font: 650 12px/1.4 var(--sans);
  letter-spacing: 0.035em;
}

.profile-eyebrow > span:first-child {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(85, 230, 193, 0.15);
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 650;
  letter-spacing: -0.035em;
}

.profile-sidebar h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  font-size: 42px;
  line-height: 1.18;
}

.profile-sidebar h1 > span {
  white-space: nowrap;
}

/* Give the displayed name a restrained, handwritten character. */
html:lang(zh-CN) .profile-sidebar h1 > span {
  font-family: "Xingkai SC", "STXingkai", "HanziPen SC", "STKaiti", "Kaiti SC", "KaiTi", serif;
  font-weight: 500;
  letter-spacing: 0.035em;
}

html:lang(en) .profile-sidebar h1 > span {
  font-family: "Iowan Old Style", "Baskerville", Georgia, serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.profile-sidebar h1 small {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
  font: 500 15px/1.4 var(--sans);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.profile-sidebar h1 small::before {
  content: "/";
  color: var(--soft);
  font-weight: 400;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 22px 0 0;
}

.sidebar-actions a {
  display: grid;
  min-height: 46px;
  padding: 0 10px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  font: 650 14px/1.3 var(--sans);
  letter-spacing: 0.025em;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.sidebar-actions a + a {
  background: transparent;
  color: var(--ink);
}

.sidebar-actions a:hover {
  background: var(--accent);
  color: var(--ink);
  transform: translateY(-2px);
}

.education-block,
.profile-facts,
.profile-summary,
.profile-links {
  margin-top: 24px;
}

.education-block {
  padding: 16px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.education-block > strong {
  display: block;
  font-size: 16px;
  line-height: 1.45;
}

.education-track {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.education-track p {
  position: relative;
  display: grid;
  grid-template-columns: 94px 36px minmax(0, 1fr);
  align-items: baseline;
  gap: 7px;
  margin: 0;
  padding-left: 15px;
}

.education-track p::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-dark);
}

.education-track span,
.education-track b {
  font: 650 14px/1.5 var(--sans);
  white-space: nowrap;
}

.education-track span {
  color: var(--muted);
}

.education-track b {
  color: var(--accent-dark);
}

.education-track em {
  color: var(--ink-2);
  font-size: 14px;
  font-style: normal;
  font-weight: 550;
  line-height: 1.5;
}

.education-track .education-major {
  display: block;
  color: var(--ink-2);
  font: inherit;
  white-space: normal;
}

.education-track .education-detail {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font: 400 13px/1.55 var(--sans);
}

.profile-facts {
  border-top: 1px solid var(--line);
  margin-bottom: 0;
}

.profile-facts div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.profile-facts dt,
.profile-summary dt,
.profile-links > li > span {
  color: var(--muted);
  font: 650 13px/1.5 var(--sans);
  letter-spacing: 0.025em;
}

.profile-facts dd {
  margin: 0;
}

.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.keyword-list span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: 650 13px/1.3 var(--sans);
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
  margin-bottom: 0;
}

.profile-summary div {
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
}

.profile-summary dt {
  min-height: 18px;
}

.profile-summary dd {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 0;
  font: 700 26px/1.1 var(--mono);
}

.profile-summary dd small {
  color: var(--accent-dark);
  font: 650 12px/1.4 var(--sans);
  white-space: nowrap;
}

.profile-links {
  display: grid;
  gap: 0;
  margin-bottom: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
  list-style: none;
}

.profile-links li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.profile-links > li > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-top: 3px;
  color: var(--muted);
}

.profile-links > li > span::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-dark);
}

.profile-links a,
.profile-links em {
  color: var(--ink-2);
  font-size: 13px;
  font-style: normal;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.profile-links a {
  font-weight: 650;
}

.profile-links > li > a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  width: 100%;
}

.profile-links > li > a::after {
  content: "↗";
  color: var(--soft);
  font: 700 12px/1.4 var(--mono);
  transition: color 160ms ease, transform 160ms ease;
}

.profile-links a:hover {
  color: var(--accent-dark);
}

.profile-links > li > a:hover::after {
  color: var(--accent-dark);
  transform: translate(1px, -1px);
}

.profile-links em {
  color: var(--muted);
}

.profile-link-row {
  min-width: 0;
}

.profile-link-row a {
  min-width: 0;
}

.content-column {
  grid-area: content;
  min-width: 0;
}


/* Sections */
.content-section {
  padding: 72px 0 0;
}

#projects {
  padding-top: 0;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
}

.section-title > span {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.04em;
}

.section-title > small {
  color: var(--muted);
  font: 700 12px/1.3 var(--mono);
  letter-spacing: 0.11em;
}

/* Project cards */
.entry {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 20px;
  margin-top: 14px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.entry-year {
  padding-top: 2px;
  color: #798781;
  font: 500 28px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.075em;
}

.entry-main {
  min-width: 0;
}

.tag-row,
.entry-links,
.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}


.entry-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
}

.entry-main h3 {
  font-size: 30px;
  line-height: 1.15;
}

.project-wordmark-title {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 1.15em;
}

.project-wordmark {
  display: block;
  width: 6.4em;
  max-width: 100%;
  height: auto;
}

.entry-links {
  justify-content: flex-end;
}

.entry-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font: 650 13px/1.3 var(--sans);
  transition: background 160ms ease, color 160ms ease;
}

.entry-links a:hover {
  background: var(--accent);
  color: var(--ink);
}

.entry-meta {
  margin: 10px 0 0;
  color: var(--blue);
  font: 650 16px/1.55 var(--sans);
  letter-spacing: 0.002em;
}

.entry-main > p:not(.entry-meta),
.project-details > p,
.project-text-collapse > p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.78;
}

.entry-main strong,
.compact-list strong,
.honor-list strong {
  color: var(--ink);
  font-weight: 750;
}

/* Editorial achievement statistics: typographic hierarchy without inner cards. */
.metric-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  width: auto;
  margin-top: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.metric-row > span {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
}

.metric-row > span + span::before {
  content: "·";
  color: #a0aaa5;
  font: 500 16px/1 var(--sans);
  margin-right: 12px;
}

.metric-row strong,
.metric-row em {
  display: inline;
}

.entry-main .metric-row strong {
  color: var(--ink-2);
  font: 650 25px/1.25 var(--sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.028em;
}

.metric-row em {
  margin: 0;
  color: var(--muted);
  font: 500 13px/1.4 var(--sans);
  font-style: normal;
  letter-spacing: 0;
}

.publication-metrics { margin-top: 19px; }
.entry-main .publication-metrics strong { font-size: 23px; letter-spacing: -0.035em; }
.publication-metrics em { white-space: nowrap; }

.tag-row {
  margin: 11px 0 18px;
  gap: 7px;
}

.project-details {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.project-highlights {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 19px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.78;
  overflow-wrap: anywhere;
}

.project-highlights li::marker {
  color: var(--accent-dark);
}

.project-details > p + p,
.project-text-collapse > p + p {
  margin-top: 12px;
}

.project-details figure {
  margin: 16px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef1ef;
}

.project-details picture {
  display: block;
}

.project-details img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #ffffff;
  cursor: zoom-in;
  transition: filter 180ms ease;
}

.project-details img:hover {
  filter: brightness(0.96);
}

.project-video video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080a0b;
}

.project-details figcaption {
  margin: 10px 3px 1px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.project-details figcaption strong {
  font: 700 12px/1.3 var(--mono);
  letter-spacing: 0.08em;
}

.figure-stack {
  display: grid;
  gap: 14px;
}

/* Research timeline */
.compact-list {
  border-top: 1px solid var(--line);
}

.compact-list article {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-mark {
  display: grid;
  gap: 5px;
  padding-left: 13px;
  border-left: 2px solid var(--accent-dark);
}

.timeline-mark .timeline-year {
  color: var(--ink);
  font: 700 15px/1.3 var(--mono);
}

.timeline-mark span {
  color: var(--muted);
  font: 650 13px/1.4 var(--sans);
  letter-spacing: 0.015em;
}

.research-body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.research-body h3 {
  color: var(--ink);
  font: 700 18px/1.4 var(--sans);
  letter-spacing: 0.01em;
}

.compact-list p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.68;
}

/* CV-inspired technical skills: restrained typographic rows, not nested cards. */
.skills-list {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.skill-item {
  display: grid;
  grid-template-columns: 165px minmax(0, 1fr);
  column-gap: 28px;
  align-items: start;
  padding: 21px 4px 21px 2px;
  border-bottom: 1px solid var(--line);
}

.skill-item dt {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  color: var(--ink-2);
  font: 700 15px/1.6 var(--sans);
  letter-spacing: 0.005em;
}

.skill-item dt::before {
  content: "";
  flex: 0 0 5px;
  width: 5px;
  height: 5px;
  align-self: center;
  border-radius: 50%;
  background: var(--accent-dark);
}

.skill-item dd {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  color: var(--ink-2);
  font: 500 15px/1.65 var(--sans);
  overflow-wrap: anywhere;
}

.skill-item dd span + span { color: var(--muted); }

@media (max-width: 680px) {
  .skill-item {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    padding: 18px 2px;
  }

  .skill-item dt { font-size: 14px; }
  .skill-item dd { padding-left: 15px; font-size: 14px; line-height: 1.65; }
}

/* Honors */
.honor-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.honor-list li {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.honor-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font: 650 13px/1.4 var(--sans);
}

.honor-meta .honor-year {
  color: var(--blue);
  font: 700 14px/1.5 var(--mono);
}

.honor-text {
  min-width: 0;
}

/* Contact and footer */
.contact-card {
  position: relative;
  display: grid;
  gap: 10px;
  overflow: hidden;
  padding: 30px;
  border-radius: 18px;
  background: var(--ink);
  color: #ffffff;
}

.contact-card::after {
  content: "";
  position: absolute;
  right: -62px;
  top: -92px;
  width: 220px;
  height: 220px;
  border: 1px solid #343a3c;
  border-radius: 50%;
}

.contact-card > * {
  position: relative;
  z-index: 1;
}

.contact-card p {
  max-width: 650px;
  margin: 0 0 12px;
  color: #f3f6f5;
  font-size: 20px;
  line-height: 1.45;
}

.contact-card a,
.contact-address {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  width: fit-content;
  max-width: 100%;
  color: #cbd1d1;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.contact-card a span,
.contact-address > span:first-child {
  color: var(--accent);
  font: 700 12px/1.5 var(--mono);
  letter-spacing: 0.08em;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 72px;
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--soft);
  font: 650 12px/1.5 var(--mono);
  letter-spacing: 0.08em;
}

/* Lightbox */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 34px;
  background: rgba(5, 7, 8, 0.94);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.image-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.image-lightbox__frame {
  width: fit-content;
  max-width: calc(100vw - 68px);
  max-height: calc(100vh - 68px);
  margin: 0;
  padding: 12px;
  border: 1px solid #343b3d;
  border-radius: 16px;
  background: #111416;
  box-shadow: 0 36px 100px rgba(0, 0, 0, 0.5);
}

.image-lightbox__frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 140px);
  object-fit: contain;
  border-radius: 9px;
  background: #ffffff;
}

.image-lightbox__meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 10px;
  padding: 0 2px;
}

.image-lightbox__caption {
  color: #aeb5b6;
  font-size: 12px;
  line-height: 1.5;
}

.image-lightbox__download {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #3e4749;
  border-radius: 999px;
  color: var(--accent);
  font: 700 13px/1 var(--mono);
  letter-spacing: 0.025em;
  white-space: nowrap;
}

.image-lightbox__download:hover {
  border-color: var(--accent);
}

.image-lightbox__close {
  position: fixed;
  top: 20px;
  right: 22px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #475052;
  border-radius: 50%;
  background: #0d1011;
  color: #ffffff;
  cursor: pointer;
  font-size: 24px;
}

/* Utility controls */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 55;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #343a3c;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(10, 12, 13, 0.2);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.back-to-top span {
  font-size: 20px;
  line-height: 1;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent-dark);
}

body.bot-open .back-to-top {
  opacity: 0;
  pointer-events: none;
}

/* Portfolio bot */
.bot-backdrop {
  display: none;
}

.floating-sidebar {
  position: fixed;
  left: 24px;
  top: 33vh;
  bottom: auto;
  z-index: 90;
  --hat-scale: 1.6;
  --hat-x: -62%;
  --hat-y: -90%;
  --hat-rot: -10deg;
  --hat-width: 110%;
  --hat-height: 74%;
  width: 52px;
  height: 52px;
  display: block;
  animation: floaty-bob 6s ease-in-out infinite;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.25));
  transition: opacity 180ms ease, visibility 180ms ease;
}

.floating-sidebar.is-dragging {
  animation-play-state: paused;
  cursor: grabbing;
}

.floating-sidebar.open {
  animation-play-state: paused;
}

.floating-sidebar__bubble {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid #f5f7fb;
  border-radius: 999px;
  background: #0b0b0f;
  color: #0f172a;
  box-shadow:
    0 10px 18px rgba(15, 23, 42, 0.18),
    0 0 12px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  overflow: visible;
  touch-action: none;
  animation: bubble-pulse 2.8s ease-in-out infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-sidebar.is-dragging .floating-sidebar__bubble,
.floating-sidebar__header {
  cursor: grab;
}

.floating-sidebar.is-dragging .floating-sidebar__bubble,
.floating-sidebar.is-dragging .floating-sidebar__header {
  cursor: grabbing;
}

.floating-sidebar__bubble:hover {
  transform: translateY(-2px) scale(1.04);
}

.floating-sidebar__bubble::before,
.floating-sidebar__bubble::after {
  content: none !important;
  display: none !important;
  border: 0 !important;
  animation: none !important;
}

.floating-sidebar__bubble .floating-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.floating-sidebar__bubble .floating-face::before {
  content: "";
  /* The second eye is a shadow 14px to the right; center the pair, not the first eye. */
  --eye-pair-center-x: -7px;
  position: relative;
  display: block;
  width: 6px;
  height: 16px;
  border-radius: 999px;
  background: #f7f8fb;
  box-shadow: 14px 0 0 #f7f8fb;
  transform: translate(calc(var(--eye-x, 0px) + var(--eye-pair-center-x)), var(--eye-y, 0px));
  transition: transform 0.08s ease-out;
  animation: eye-blink 5s ease-in-out infinite;
}

.floating-sidebar__bubble .floating-face::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  box-shadow: none;
}

.floating-sidebar__hat {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-sidebar.hat-santa {
  --hat-image: url("./assets/hat-ref.svg");
}

.floating-sidebar.hat-santa .floating-sidebar__hat {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 3;
  display: block;
  width: var(--hat-width);
  height: var(--hat-height);
  overflow: visible;
  background: var(--hat-image) no-repeat 50% 0 / contain;
  pointer-events: none;
  transform: translate(calc(var(--hat-x) + 4.5px), calc(var(--hat-y) + 14.5px)) rotate(var(--hat-rot)) scale(var(--hat-scale));
  transform-origin: var(--hat-origin, 78% 90%);
}

.floating-sidebar__panel {
  position: absolute;
  left: calc(100% + 16px);
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(370px, calc(100vw - 96px));
  max-height: 78vh;
  overflow: hidden;
  border: 1px solid #c9d0cd;
  border-radius: 18px;
  background: #f8faf9;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(10, 12, 13, 0.26);
  transform-origin: left top;
  transition-property: opacity, transform;
  animation: panel-pop 190ms ease;
}

.floating-sidebar:not(.open) .floating-sidebar__panel {
  display: none;
}

.floating-sidebar__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  cursor: grab;
}

.floating-sidebar.is-dragging .floating-sidebar__header {
  cursor: grabbing;
}

.portfolio-bot__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-dark);
  font: 700 12px/1.2 var(--mono);
  letter-spacing: 0.025em;
}

.portfolio-bot__eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(85, 230, 193, 0.16);
}

.floating-sidebar__header h2 {
  margin-top: 7px;
  font-size: 19px;
}

.floating-sidebar__close {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
}

.floating-sidebar__close:hover {
  border-color: var(--ink);
}

.portfolio-bot__messages {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  max-height: 310px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 15px;
  background-color: #edf1ef;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0H24M0 0V24' fill='none' stroke='%230a0c0d' stroke-opacity='.035'/%3E%3C/svg%3E");
}

.portfolio-bot__message {
  min-width: 0;
  max-width: 92%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.portfolio-bot__message p {
  margin: 0;
}

.portfolio-bot__message p + p,
.portfolio-bot__message p + ul {
  margin-top: 8px;
}

.portfolio-bot__message--bot {
  justify-self: start;
  border-bottom-left-radius: 3px;
  background: #ffffff;
  color: #343a3c;
}

.portfolio-bot__message--user {
  justify-self: end;
  border-color: var(--ink);
  border-bottom-right-radius: 3px;
  background: var(--ink);
  color: #ffffff;
}

.portfolio-bot__message strong {
  color: inherit;
  font-weight: 750;
}

.portfolio-bot__message ul {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  padding-left: 16px;
}

.portfolio-bot__message li::marker {
  color: var(--accent-dark);
}

.portfolio-bot__message code {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #edf1ef;
  color: var(--ink);
  font-family: var(--mono);
  font-size: max(12px, 0.9em);
}

.portfolio-bot__link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.portfolio-bot__link-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font: 700 13px/1.3 var(--mono);
}

.portfolio-bot__link-button:hover {
  background: var(--accent-dark);
}

.portfolio-bot__starters {
  display: flex;
  flex-wrap: wrap;
  min-height: 0;
  max-height: 128px;
  overflow: auto;
  overscroll-behavior: contain;
  gap: 6px;
  padding: 12px 15px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.portfolio-bot__starters button {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f1f4f2;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.portfolio-bot__starters button:hover {
  border-color: var(--accent-dark);
  color: var(--accent-dark);
}

.portfolio-bot__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px 15px 15px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.portfolio-bot__input {
  min-width: 0;
  min-height: 40px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f4f6f5;
  color: var(--ink);
  font-size: 14px;
  outline: none;
}

.portfolio-bot__input:focus {
  border-color: var(--accent-dark);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(85, 230, 193, 0.15);
}

.portfolio-bot__form button {
  padding: 0 13px;
  border: 1px solid var(--ink);
  border-radius: 9px;
  background: var(--ink);
  color: #ffffff;
  cursor: pointer;
  font: 700 13px/1 var(--mono);
}

.portfolio-bot__form button:hover {
  background: var(--accent-dark);
}

.floating-sidebar__panel.is-compact .portfolio-bot__starters {
  display: none;
}

.floating-sidebar__panel.is-compact .floating-sidebar__header {
  align-items: center;
  padding: 10px 14px;
}

.floating-sidebar__panel.is-compact .portfolio-bot__eyebrow {
  display: none;
}

.floating-sidebar__panel.is-compact .floating-sidebar__header h2 {
  margin-top: 0;
}

.floating-sidebar__panel.is-tiny .floating-sidebar__header {
  padding: 4px 10px;
}

.floating-sidebar__panel.is-tiny .floating-sidebar__header h2 {
  font-size: 16px;
  line-height: 1.2;
}

.floating-sidebar__panel.is-tiny .portfolio-bot__messages {
  padding: 4px 10px;
}

.floating-sidebar__panel.is-tiny .portfolio-bot__form {
  padding: 6px 10px;
}

/* Motion */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal 620ms cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.content-section.reveal {
  animation-delay: 70ms;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floaty-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes bubble-pulse {
  0%,
  100% {
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2), 0 0 20px rgba(78, 168, 255, 0.35);
    transform: scale(1);
  }

  50% {
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.28), 0 0 26px rgba(78, 168, 255, 0.45);
    transform: scale(1.05);
  }
}

@keyframes eye-blink {
  0%,
  90%,
  100% {
    transform: translate(calc(var(--eye-x, 0px) + var(--eye-pair-center-x)), var(--eye-y, 0px)) scaleY(1);
  }

  94% {
    transform: translate(calc(var(--eye-x, 0px) + var(--eye-pair-center-x)), var(--eye-y, 0px)) scaleY(0.2);
  }

  96% {
    transform: translate(calc(var(--eye-x, 0px) + var(--eye-pair-center-x)), var(--eye-y, 0px)) scaleY(0.05);
  }
}

@keyframes panel-pop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Language typography */
html:lang(zh-CN) body {
  font-family: "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", var(--sans);
}

html:lang(zh-CN) .profile-sidebar h1,
html:lang(zh-CN) .section-title > span,
html:lang(zh-CN) .entry-main h3,
html:lang(zh-CN) .contact-card p {
  letter-spacing: -0.035em;
}

html:lang(en) .education-track p {
  grid-template-columns: 106px minmax(0, 1fr);
}

html:lang(en) .education-track em {
  grid-column: 2;
}

/* Responsive */
@media (max-width: 1080px) {
  .topbar-inner,
  .page-shell {
    width: min(100% - 36px, var(--site-width));
  }

  .topbar-inner {
    gap: 24px;
  }

  .nav-links {
    gap: 22px;
  }

  .page-shell {
    grid-template-columns: 270px minmax(0, 1fr);
    column-gap: 38px;
  }

  .profile-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .nav-links {
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

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

  .page-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "content";
    row-gap: 34px;
    margin-top: 34px;
  }

  .profile-sidebar {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.85fr);
    gap: 20px 30px;
    align-items: start;
  }

  .profile-eyebrow,
  .profile-sidebar h1,
  .sidebar-actions,
  .profile-summary,
  .profile-links {
    grid-column: 1 / -1;
  }

  .education-block,
  .profile-facts,
  .profile-summary,
  .profile-links {
    margin-top: 0;
  }

  .profile-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .education-block {
    border-bottom: 0;
  }

}

@media (max-width: 680px) {
  .topbar,
  .topbar-inner {
    min-height: 56px;
  }

  .topbar-inner,
  .page-shell {
    width: calc(100% - 32px);
  }

  .topbar-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: calc(100% - 24px);
    padding: 0;
  }

  .nav-links {
    grid-column: 1;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: clamp(4px, 1.2vw, 8px);
    overflow: visible;
  }

  .nav-links a {
    display: inline-flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 0;
    font-size: clamp(13px, 3.4vw, 15px);
    line-height: 1.3;
    letter-spacing: 0;
  }

  .language-switch {
    grid-column: 2;
    justify-self: end;
    gap: 1px;
    padding: 3px;
  }

  .lang-btn {
    min-height: 32px;
    padding: 0 8px;
    font-size: 12px;
  }

  .lang-label-full {
    display: none;
  }

  .lang-label-compact {
    display: inline;
  }

  .page-shell {
    row-gap: 32px;
    margin-top: 24px;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }

  .profile-sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .profile-eyebrow {
    order: 0;
    margin-bottom: 10px;
  }

  .profile-sidebar h1 {
    order: 1;
    gap: 8px 10px;
    font-size: 34px;
  }

  .profile-sidebar h1 small {
    gap: 8px;
  }

  .sidebar-actions {
    order: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 20px;
  }

  .sidebar-actions a {
    min-height: 44px;
    border-radius: 6px;
    font-size: 14px;
  }

  .profile-summary {
    order: 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 20px;
    margin-bottom: 0;
    border: 0;
    background: transparent;
  }

  .profile-summary div {
    min-height: 78px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
  }

  .profile-summary dd {
    margin-top: 7px;
  }

  .profile-summary dt {
    font-size: 13px;
    letter-spacing: 0;
  }

  .education-block {
    order: 4;
    margin-top: 20px;
    padding: 16px 0;
  }

  .education-block > strong {
    font-size: 16px;
  }

  .education-track {
    gap: 12px;
    margin-top: 12px;
  }

  .education-track p {
    grid-template-columns: 94px 36px minmax(0, 1fr);
    gap: 7px;
    padding-left: 12px;
  }

  .profile-facts {
    order: 5;
    margin-top: 14px;
    margin-bottom: 0;
    border-top: 0;
  }

  .profile-facts div {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0;
  }

  html:lang(en) .profile-facts div {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 10px;
  }

  .keyword-list {
    gap: 6px;
  }

  .keyword-list span {
    min-height: 30px;
    padding: 0 8px;
    border-radius: 4px;
  }

  .profile-links {
    order: 6;
    margin: 20px 0 0;
  }

  .profile-links li {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 44px;
    padding: 9px 0;
  }

  .profile-links > li > span {
    padding-top: 0;
  }

  .profile-links li:last-child {
    align-items: start;
    border-bottom: 0;
  }

  .profile-links a,
  .profile-links em {
    font-size: 13px;
    line-height: 1.6;
  }

  .content-section {
    padding-top: 44px;
  }

  .section-title {
    align-items: baseline;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 12px;
  }

  .section-title > span {
    font-size: 26px;
    line-height: 1.25;
  }

  .section-title > small {
    display: none;
  }

  .entry {
    position: relative;
    display: block;
    margin-top: 16px;
    padding: 20px 18px;
    border-radius: 16px;
  }

  .entry-year {
    position: static;
    display: flex;
    align-items: center;
    margin: 0 0 15px;
    padding: 0;
    font-size: 23px;
    line-height: 1;
  }


  .entry-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .entry-main h3 {
    font-size: clamp(22px, 6vw, 28px);
    line-height: 1.2;
  }

  .entry-links {
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
  }

  .entry-links a {
    min-height: 36px;
    padding: 0 9px;
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
    font-size: 13px;
  }

  .entry-meta {
    margin: 10px 0 0;
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: 0;
    text-transform: none;
  }

  .entry-main > p:not(.entry-meta),
  .project-details > p,
  .project-text-collapse > p {
    font-size: 15px;
    line-height: 1.8;
    overflow-wrap: break-word;
  }

  .metric-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    width: auto;
    max-width: none;
    margin-top: 17px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
  }

  .metric-row > span {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
  }

  .metric-row > span + span::before { margin-right: 8px; }

  .entry-main .metric-row strong {
    font-size: 23px;
    line-height: 1.3;
  }

  .metric-row em {
    font-size: 13px;
    line-height: 1.45;
    letter-spacing: 0;
    text-transform: none;
  }

  .publication-metrics { gap: 10px 22px; }
  .publication-metrics > span + span::before { display: none; }
  .entry-main .publication-metrics strong { font-size: 21px; }

  .tag-row {
    gap: 6px;
    margin: 10px 0 17px;
  }

  .project-details {
    margin-top: 18px;
    padding-top: 16px;
  }

  .project-details figure {
    margin-top: 16px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .project-details picture {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #ffffff;
  }

  .project-details img {
    border-radius: 0;
  }

  .project-details figcaption {
    margin: 10px 0 0;
    line-height: 1.6;
  }

  .figure-stack {
    gap: 6px;
  }

  .compact-list article {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    padding: 20px 0;
  }

  .timeline-mark {
    grid-column: 1;
    align-items: start;
    gap: 5px;
    padding-left: 9px;
  }

  .timeline-mark .timeline-year {
    font-size: 14px;
  }

  .timeline-mark span {
    font-family: var(--sans);
    letter-spacing: 0;
    text-transform: none;
  }

  .research-body h3 {
    font-size: 17px;
  }

  .compact-list p {
    font-size: 14px;
    line-height: 1.75;
    overflow-wrap: anywhere;
  }

  .honor-list {
    gap: 10px;
  }

  .honor-list li {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 16px;
    line-height: 1.7;
  }

  .honor-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 12px;
  }

  .honor-text {
    overflow-wrap: anywhere;
  }

  .contact-card {
    gap: 0;
    padding: 22px 18px;
    border-radius: 16px;
  }

  .contact-card p {
    margin-bottom: 16px;
    font-size: 17px;
    line-height: 1.6;
  }

  .contact-card a,
  .contact-address {
    grid-template-columns: 76px minmax(0, 1fr);
    align-items: baseline;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 0;
    border-top: 1px solid #303638;
    font-size: 13px;
    line-height: 1.6;
  }

  .contact-card a span,
  .contact-address > span:first-child {
    font-family: var(--sans);
    letter-spacing: 0;
    text-transform: none;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-top: 40px;
    padding: 20px 0 0;
    font-size: 12px;
  }

  .image-lightbox {
    padding: 16px;
  }

  .image-lightbox__frame {
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 52px);
    padding: 8px;
  }

  .image-lightbox__frame img {
    max-height: calc(100dvh - 140px);
  }

  .image-lightbox__meta {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .image-lightbox__download {
    justify-content: center;
    min-height: 44px;
    font-size: 13px;
  }

  .back-to-top {
    right: 16px;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .floating-sidebar {
    left: 16px;
    top: auto;
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    filter: drop-shadow(0 5px 10px rgba(15, 23, 42, 0.2));
  }

  body.bot-open {
    overflow: hidden;
  }

  .bot-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 85;
    display: block;
    padding: 0;
    border: 0;
    background: rgba(7, 10, 11, 0.35);
  }

  .floating-sidebar__panel {
    top: auto;
    bottom: calc(100% + 16px);
    width: calc(100vw - 32px);
    max-height: calc(100dvh - 184px);
    border-radius: 20px;
    transform-origin: center bottom;
  }

  .floating-sidebar__header {
    padding: 16px;
  }

  .floating-sidebar__close {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
  }

  .portfolio-bot__eyebrow {
    font-size: 12px;
    letter-spacing: 0.04em;
  }

  .portfolio-bot__messages {
    min-height: 0;
    max-height: none;
    padding: 14px;
    overscroll-behavior: contain;
  }

  .portfolio-bot__message {
    max-width: 96%;
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }

  .portfolio-bot__link-button {
    min-height: 40px;
    font-size: 12px;
  }

  .portfolio-bot__starters {
    min-width: 0;
    max-height: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 10px 14px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .portfolio-bot__starters button {
    flex: 0 0 auto;
    min-height: 40px;
    font-size: 13px;
    white-space: nowrap;
  }

  .portfolio-bot__form {
    padding: 12px 14px 14px;
  }

  .portfolio-bot__input {
    min-height: 44px;
    font-size: 16px;
  }

  .portfolio-bot__form button {
    min-height: 44px;
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .education-track p {
    grid-template-columns: 94px 36px minmax(0, 1fr);
  }

}

@media (max-width: 360px) {
  html:lang(en) .topbar-inner {
    width: calc(100% - 16px);
    column-gap: 4px;
  }

  html:lang(en) .nav-links {
    gap: 0;
  }

  html:lang(en) .nav-links a {
    font-size: 12px;
  }

  html:lang(en) .lang-btn {
    padding-inline: 4px;
  }
}


@media (hover: none) {
  .floating-sidebar__bubble,
  .floating-sidebar__close,
  .portfolio-bot__form button,
  .portfolio-bot__starters button {
    min-width: 44px;
    min-height: 44px;
  }
}

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

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


/* Retained refinement: name typography, profile spacing and lighter skill labels. */
.profile-eyebrow { margin-bottom: 18px; }
.profile-sidebar h1 {
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  font-size: 46px;
  line-height: 1.14;
}
.profile-sidebar h1 small {
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.025em;
}
.profile-sidebar h1 small::before { display: none; }
.sidebar-actions { margin-top: 26px; }
.profile-facts { border-top: 0; }
.profile-summary {
  gap: 8px;
  border: 0;
  background: transparent;
}
.profile-summary div {
  border: 1px solid #e0e5e2;
  border-radius: 9px;
}
.tag-row {
  gap: 7px;
  margin: 11px 0 18px;
}
.tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 10px;
  border: 1px solid #e3ebe6;
  border-radius: 999px;
  background: #f2f6f4;
  color: #3b6155;
  font: 600 12px/1.45 var(--sans);
  letter-spacing: 0.005em;
}
@media (max-width: 680px) {
  .profile-eyebrow { margin-bottom: 15px; }
  .profile-sidebar h1 {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    font-size: 38px;
    line-height: 1.14;
  }
  .profile-sidebar h1 small { font-size: 15px; }
  .tag-row { gap: 6px; margin: 10px 0 17px; }
  .tag-row span {
    min-height: 27px;
    padding: 4px 9px;
    font-size: 12px;
  }
}

/* Collapse technical copy only; keep every project figure and video visible. */
.project-text-collapse {
  margin: 0 0 4px;
}
.project-text-collapse > summary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  cursor: pointer;
  list-style: none;
  color: var(--accent-dark);
  font: 650 13px/1.4 var(--sans);
}
.project-text-collapse > summary::-webkit-details-marker { display: none; }
.project-text-collapse > summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}
.project-text-collapse[open] > summary::after {
  transform: rotate(225deg) translateY(-1px);
}
.project-text-label--open { display: none; }
.project-text-collapse[open] .project-text-label--open { display: inline; }
.project-text-collapse[open] .project-text-label--closed { display: none; }
.project-text-collapse[open] > summary { margin-bottom: 12px; }
@media (prefers-reduced-motion: reduce) {
  .project-text-collapse > summary::after { transition: none; }
}

