/* ==========================================================================
   Single-page homepage.
   Layout and structure adapted from Ruihong Shen's homepage
   (https://github.com/ruihong04/ruihong04.github.io), recoloured to this
   site's solid blue accent and without the particle hero.
   ========================================================================== */

:root {
  color-scheme: light;
  --nav-offset-top: 14px;
  --nav-height: 62px;
  --anchor-gap: 20px;
  --anchor-offset: calc(var(--nav-offset-top) + var(--nav-height) + var(--anchor-gap));
  --max-width: 1180px;

  --text: #1f2937;
  --text-soft: #273445;
  --body-copy: #374151;
  --secondary-copy: #4b5563;
  --muted: #6b7280;
  --accent: #2259bc;
  --accent-bright: #1a44a2;
  --accent-1-rgb: 34, 89, 188;
  --accent-2-rgb: 34, 89, 188; /* read by geo-network.js */
  --accent-soft: rgba(34, 89, 188, 0.1);
  --border: rgba(34, 89, 188, 0.2);
  --shadow: rgba(30, 41, 59, 0.1);
  --selection-bg: rgba(34, 89, 188, 0.18);

  --page-bg: #f6f8fb;
  --page-backdrop-bg:
    radial-gradient(circle at 82% 12%, rgba(34, 89, 188, 0.1), transparent 32%),
    radial-gradient(circle at 14% 22%, rgba(34, 89, 188, 0.1), transparent 30%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f8 50%, #f7f9fc 100%);
  --page-backdrop-after-bg:
    radial-gradient(circle at 70% 24%, rgba(34, 89, 188, 0.1), transparent 18%),
    radial-gradient(circle at 24% 66%, rgba(34, 89, 188, 0.08), transparent 24%),
    radial-gradient(circle at 88% 82%, rgba(34, 89, 188, 0.07), transparent 20%);
  --noise-opacity: 0.12;
  --noise-dot-primary: rgba(31, 41, 55, 0.1);
  --noise-dot-accent: rgba(34, 89, 188, 0.12);
  --noise-blend: multiply;

  --nav-bg: rgba(255, 255, 255, 0.86);
  --nav-blur: 12px;
  --nav-shadow: 0 14px 34px rgba(30, 41, 59, 0.1);
  --nav-hover-bg: rgba(34, 89, 188, 0.1);
  --control-bg: rgba(255, 255, 255, 0.9);
  --control-hover-bg: rgba(34, 89, 188, 0.12);

  --content-bg: linear-gradient(180deg, rgba(251, 252, 254, 0.9) 0%, rgba(243, 246, 250, 0.9) 100%);
  --content-inset: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  --panel-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(251, 252, 255, 0.97) 100%);
  --panel-sheen:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 24%),
    radial-gradient(circle at top right, rgba(34, 89, 188, 0.06), transparent 28%);
  --card-border: rgba(34, 89, 188, 0.16);
  --card-bg: rgba(255, 255, 255, 0.84);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, 0.66);
  --timeline-soft: rgba(34, 89, 188, 0.18);

  --paper-card-bg: rgba(255, 255, 255, 0.9);
  --paper-card-border: rgba(30, 41, 59, 0.12);
  --paper-card-shadow: 0 14px 32px rgba(30, 41, 59, 0.08);
  --paper-highlight-border: rgba(var(--accent-1-rgb), 0.38);
  --paper-highlight-shadow: 0 18px 40px rgba(30, 41, 59, 0.12);
  --paper-abstract-border: rgba(30, 41, 59, 0.12);
  --paper-media-shadow: 0 10px 24px rgba(30, 41, 59, 0.12);
  --media-border: rgba(30, 41, 59, 0.12);
  --media-bg: #ffffff;
  --link-separator: rgba(31, 41, 55, 0.24);
  --title-hover: #1a44a2;
  --code-bg: rgba(34, 89, 188, 0.06);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --text: #e8edf5;
  --text-soft: #dde4ee;
  --body-copy: #b3bdcc;
  --secondary-copy: #c4ccd8;
  --muted: #8d98a8;
  --accent: #6ea2e5;
  --accent-bright: #9ec3f2;
  --accent-1-rgb: 110, 162, 229;
  --accent-2-rgb: 110, 162, 229;
  --accent-soft: rgba(110, 162, 229, 0.12);
  --border: rgba(110, 162, 229, 0.18);
  --shadow: rgba(0, 0, 0, 0.34);
  --selection-bg: rgba(110, 162, 229, 0.26);

  --page-bg: #0c1017;
  --page-backdrop-bg:
    radial-gradient(circle at 82% 14%, rgba(110, 162, 229, 0.12), transparent 30%),
    radial-gradient(circle at 18% 24%, rgba(110, 162, 229, 0.08), transparent 26%),
    linear-gradient(180deg, #0b0f15 0%, #11161e 30%, #131922 100%);
  --page-backdrop-after-bg:
    radial-gradient(circle at 66% 20%, rgba(110, 162, 229, 0.14), transparent 16%),
    radial-gradient(circle at 30% 70%, rgba(110, 162, 229, 0.1), transparent 24%),
    radial-gradient(circle at 86% 84%, rgba(110, 162, 229, 0.06), transparent 18%);
  --noise-opacity: 0.08;
  --noise-dot-primary: rgba(255, 255, 255, 0.32);
  --noise-dot-accent: rgba(110, 162, 229, 0.18);
  --noise-blend: soft-light;

  --nav-bg: rgba(18, 23, 31, 0.7);
  --nav-blur: 16px;
  --nav-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
  --nav-hover-bg: rgba(255, 255, 255, 0.06);
  --control-bg: rgba(255, 255, 255, 0.04);
  --control-hover-bg: rgba(255, 255, 255, 0.09);

  --content-bg: linear-gradient(180deg, rgba(19, 24, 32, 0.9) 0%, rgba(17, 22, 30, 0.9) 100%);
  --content-inset: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --panel-bg: linear-gradient(180deg, rgba(27, 33, 43, 0.9) 0%, rgba(22, 28, 37, 0.92) 100%);
  --panel-sheen:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 28%),
    radial-gradient(circle at top right, rgba(110, 162, 229, 0.1), transparent 28%);
  --card-border: rgba(255, 255, 255, 0.07);
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-inset: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  --timeline-soft: rgba(110, 162, 229, 0.16);

  --paper-card-bg: rgba(255, 255, 255, 0.04);
  --paper-card-border: rgba(255, 255, 255, 0.1);
  --paper-card-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
  --paper-highlight-shadow: 0 24px 54px rgba(0, 0, 0, 0.28);
  --paper-abstract-border: rgba(255, 255, 255, 0.09);
  --paper-media-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  --media-border: rgba(255, 255, 255, 0.08);
  --media-bg: rgba(255, 255, 255, 0.92);
  --link-separator: rgba(255, 255, 255, 0.22);
  --title-hover: #ffffff;
  --code-bg: rgba(255, 255, 255, 0.04);
}

* {
  box-sizing: border-box;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--page-bg);
  overflow-x: hidden;
  position: relative;
  transition: background-color 220ms ease, color 220ms ease;
}

::selection {
  background: var(--selection-bg);
  color: var(--text);
}

img,
canvas {
  display: block;
}

button {
  font: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 180ms ease, opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
}

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

strong {
  font-weight: 700;
}

/* --- Backdrop ------------------------------------------------------------ */

.page-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--page-backdrop-bg);
}

.page-backdrop::after {
  content: "";
  position: absolute;
  inset: -6vh -4vw -10vh -4vw;
  background: var(--page-backdrop-after-bg);
  filter: blur(14px);
  opacity: 0.85;
}

.page-noise {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: var(--noise-opacity);
  background-image:
    radial-gradient(circle at 1px 1px, var(--noise-dot-primary) 0.7px, transparent 0.75px),
    radial-gradient(circle at 2px 2px, var(--noise-dot-accent) 0.7px, transparent 0.75px);
  background-size: 22px 22px, 31px 31px;
  mix-blend-mode: var(--noise-blend);
}

#geo-network {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.fireworks-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 18;
  pointer-events: none;
}

/* --- Floating nav -------------------------------------------------------- */

.site-nav {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), var(--max-width));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(var(--nav-blur));
  -webkit-backdrop-filter: blur(var(--nav-blur));
  border-radius: 999px;
  box-shadow: var(--nav-shadow);
  z-index: 20;
  color: var(--text);
  transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.site-nav a {
  color: inherit;
}

.brand {
  grid-column: 1;
  justify-self: start;
  margin-left: calc(4px + 1ch);
  font-family: "Dancing Script", "Brush Script MT", cursive;
  font-size: clamp(1.32rem, 1.9vw, 1.6rem);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: var(--accent) !important;
}

.nav-links {
  grid-column: 2;
  display: flex;
  gap: 4px;
  justify-self: center;
  justify-content: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.nav-links a {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--secondary-copy);
  font-size: 0.97rem;
  transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.nav-links a:hover {
  background: var(--nav-hover-bg);
  color: var(--text);
  transform: translateY(-1px);
}

.nav-links a.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--control-bg);
  color: var(--text);
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.theme-toggle:hover {
  background: var(--control-hover-bg);
  color: var(--accent);
  transform: translateY(-1px) rotate(-12deg);
}

.theme-toggle svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.theme-icon {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun,
:root:not([data-theme="dark"]) .theme-icon-moon {
  display: block;
}

/* --- Content shell & panels ---------------------------------------------- */

.content-shell {
  position: relative;
  z-index: 4;
  width: min(calc(100% - 24px), var(--max-width));
  margin: calc(var(--nav-offset-top) + var(--nav-height) + 22px) auto 0;
  padding: 22px;
  border-radius: 18px;
  background: var(--content-bg);
  box-shadow: var(--content-inset);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 22px 54px var(--shadow);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--panel-sheen);
}

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

.section {
  padding: 30px;
  scroll-margin-top: var(--anchor-offset);
}

.section + .section {
  margin-top: 18px;
}

.section-head {
  margin-bottom: 22px;
}

.section-kicker {
  display: inline-block;
  margin: 0;
  font-size: clamp(1.4rem, 1.9vw, 1.95rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.005em;
  color: var(--accent);
}

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

/* --- Intro --------------------------------------------------------------- */

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 40px;
  align-items: center;
}

.profile-copy {
  min-width: 0;
}

.profile-heading {
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-name {
  margin: 0;
  font-size: clamp(1.45rem, 2.1vw, 1.8rem);
  line-height: 1.25;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.005em;
}

.profile-name .name-sep {
  margin: 0 0.3em;
  color: var(--accent);
  font-weight: 400;
}

.profile-meta {
  margin: 4px 0 0;
  font-size: 0.93rem;
  line-height: 1.45;
  color: var(--secondary-copy);
}

.profile-copy > p {
  margin: 0;
  color: var(--body-copy);
  font-size: 1.02rem;
  text-align: justify;
  text-indent: 1.8em;
  line-height: 1.82;
}

.profile-copy > p + p {
  margin-top: 14px;
}

.profile-copy a,
.news-item a,
.service-card a,
.experience-card a,
.site-footer a {
  color: var(--accent);
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: color 180ms ease, background-size 240ms ease;
}

.profile-copy a:hover,
.news-item a:hover,
.service-card a:hover,
.experience-card a:hover,
.site-footer a:hover {
  color: var(--accent-bright);
  background-size: 100% 1px;
}

.interest-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.interest-tags li {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--secondary-copy);
  font-size: 0.88rem;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 22px auto 0;
}

.profile-copy > .profile-links {
  margin: 22px auto 0;
  text-indent: 0;
  text-align: center;
}

.profile-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--control-bg);
  background-image: none;
}

.profile-links a:hover {
  color: var(--accent);
  border-color: rgba(var(--accent-1-rgb), 0.45);
  background: var(--control-hover-bg);
  transform: translateY(-1px);
}

.profile-side {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 260px;
  gap: 14px;
}

.portrait-frame {
  position: relative;
  width: 100%;
  padding: 3px;
  border-radius: 15px;
  background: var(--accent);
  box-shadow: 0 18px 40px rgba(var(--accent-1-rgb), 0.18);
}

.profile-portrait {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 12px;
}

.portrait-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
  text-align: center;
  line-height: 1.5;
}

/* --- Timelines (news, education, awards) --------------------------------- */

.news-list,
.experience-list,
.award-list,
.paper-list,
.service-list {
  display: grid;
  gap: 14px;
}

.news-list,
.experience-list,
.award-list {
  --timeline-axis-x: 8px;
  --timeline-line-width: 2px;
  --timeline-dot-size: 7px;
  --timeline-item-indent: 30px;
  --timeline-fade-length: 12px;
  --timeline-fade-soft-stop: 4px;
  position: relative;
  padding-block: var(--timeline-fade-length);
  gap: 10px;
}

.news-list::before,
.experience-list::before,
.award-list::before {
  content: "";
  position: absolute;
  left: calc(var(--timeline-axis-x) - (var(--timeline-line-width) / 2));
  top: 0;
  bottom: 0;
  width: var(--timeline-line-width);
  background: linear-gradient(
    180deg,
    transparent 0,
    var(--timeline-soft) var(--timeline-fade-soft-stop),
    var(--accent) var(--timeline-fade-length),
    var(--accent) calc(100% - var(--timeline-fade-length)),
    var(--timeline-soft) calc(100% - var(--timeline-fade-soft-stop)),
    transparent 100%
  );
}

.experience-list {
  gap: 22px;
}

.news-item,
.experience-card,
.award-row {
  position: relative;
  padding: 0 0 0 var(--timeline-item-indent);
}

.news-item::after,
.experience-card::after,
.award-row::after {
  content: "";
  position: absolute;
  left: var(--timeline-axis-x);
  top: 50%;
  width: var(--timeline-dot-size);
  height: var(--timeline-dot-size);
  border-radius: 50%;
  background: var(--page-bg);
  box-shadow: 0 0 0 2px var(--accent);
  transform: translate(-50%, -50%);
  z-index: 1;
}

.news-item p {
  margin: 0;
  font-size: 0.99rem;
  color: var(--text-soft);
  line-height: 1.55;
}

.news-date {
  margin-right: 0.3em;
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.experience-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.experience-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  width: 76px;
  height: 76px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.15;
}

.experience-logo:has(img) {
  padding: 10px;
  background: #ffffff;
}

.experience-logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Logos whose artwork already has generous margins. */
.experience-logo.logo-fill {
  padding: 3px;
}

/* SII artwork sits small and slightly high inside a mostly blank canvas. */
.logo-sii img {
  transform: scale(1.75) translateY(6%);
}

.experience-title {
  margin: 0 0 4px;
  font-size: 1.08rem;
  line-height: 1.45;
}

.experience-title a {
  color: var(--text);
}

.experience-title a:hover {
  color: var(--title-hover);
}

.experience-meta {
  margin: 0 0 4px;
  font-size: 0.92rem;
  color: var(--accent);
  font-weight: 600;
}

.experience-copy {
  margin: 0;
  color: var(--body-copy);
  font-size: 0.96rem;
  line-height: 1.65;
}

.experience-copy + .experience-copy {
  margin-top: 2px;
}

.award-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  column-gap: 6px;
  align-items: start;
}

.award-year {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 0.98rem;
  line-height: 1.55;
}

.award-row p {
  margin: 0;
  color: var(--body-copy);
  font-size: 0.99rem;
  line-height: 1.55;
}

.award-row strong {
  color: var(--text-soft);
}

/* --- Publications --------------------------------------------------------- */

.paper-list {
  gap: 18px;
}

.paper-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 20px;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--paper-card-border);
  background: var(--paper-card-bg);
  box-shadow: var(--paper-card-shadow), var(--card-inset);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.paper-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--accent-1-rgb), 0.4);
}

.paper-card-highlight {
  border-color: var(--paper-highlight-border);
  box-shadow: var(--paper-highlight-shadow), var(--card-inset);
}

.paper-card-highlight::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: var(--accent);
}

.paper-media {
  position: relative;
  width: 100%;
}

.paper-media img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--media-border);
  background: var(--media-bg);
  box-shadow: var(--paper-media-shadow);
}

.paper-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.paper-body {
  min-width: 0;
}

.paper-title {
  margin: 0 0 8px;
  font-size: 1.14rem;
  line-height: 1.45;
}

.paper-title a,
.paper-title span {
  color: var(--text);
}

.paper-title a:hover {
  color: var(--title-hover);
}

.paper-authors,
.paper-links,
.paper-venue {
  margin: 0;
  color: var(--body-copy);
  font-size: 0.95rem;
  line-height: 1.7;
}

.paper-authors strong {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-1-rgb), 0.6);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}

.paper-links span {
  color: var(--link-separator);
}

.paper-links button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
}

.paper-links a:hover,
.paper-links button:hover {
  color: var(--accent-bright);
}

.paper-venue {
  margin-top: 4px;
  color: var(--secondary-copy);
}

.paper-abstract {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--paper-abstract-border);
}

.paper-abstract-copy {
  margin: 0;
  color: var(--body-copy);
  font-size: 0.92rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

.js .paper-abstract:not(.is-expanded) .paper-abstract-copy {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.abstract-toggle {
  margin-top: 4px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.abstract-toggle:hover {
  color: var(--accent-bright);
}

.paper-bibtex {
  position: relative;
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--code-bg);
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-x: auto;
}

.paper-bibtex[hidden] {
  display: none;
}

.bibtex-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--control-bg);
  color: var(--accent);
  font-size: 0.76rem;
  cursor: pointer;
}

/* --- Skills / service ------------------------------------------------------ */

.service-card {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.service-role {
  font-weight: 700;
  color: var(--text-soft);
  line-height: 1.7;
}

.service-details {
  margin: 0;
  color: var(--body-copy);
  font-size: 0.98rem;
  line-height: 1.7;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip-list li {
  padding: 3px 12px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--secondary-copy);
  font-size: 0.92rem;
}

/* --- Footer ---------------------------------------------------------------- */

.site-footer {
  position: relative;
  z-index: 4;
  width: min(calc(100% - 24px), var(--max-width));
  margin: 22px auto 44px;
  padding: 0 8px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.7;
}

/* --- Reveal on scroll ------------------------------------------------------ */

.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 620ms ease, transform 620ms ease;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive ------------------------------------------------------------ */

@media (max-width: 980px) {
  .profile-grid,
  .paper-card {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    gap: 26px;
  }

  .profile-side {
    order: -1;
    justify-self: center;
    max-width: 220px;
  }

  .paper-media {
    max-width: 520px;
  }
}

@media (max-width: 820px) {
  :root {
    --nav-offset-top: 10px;
    --nav-height: 92px;
  }

  .site-nav {
    top: 10px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    padding: 10px;
    gap: 6px 0;
    border-radius: 22px;
  }

  .brand {
    margin-left: 0;
    justify-self: center;
  }

  .nav-links {
    grid-column: 1;
    width: max-content;
    max-width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

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

  .theme-toggle {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 34px;
    height: 34px;
  }

  .theme-toggle svg {
    width: 17px;
    height: 17px;
  }

  .content-shell {
    width: calc(100% - 16px);
    padding: 12px;
    border-radius: 14px;
  }

  .section {
    padding: 22px 18px;
  }

  .experience-card,
  .service-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .experience-logo {
    width: 60px;
    height: 60px;
    font-size: 0.8rem;
  }
}

@media (max-width: 560px) {
  .profile-copy > p {
    font-size: 0.97rem;
    text-align: left;
  }

  .nav-links a {
    padding: 7px 10px;
    font-size: 0.9rem;
  }

  .award-row {
    grid-template-columns: 1fr;
  }
}

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

  .js .reveal,
  .paper-card,
  .nav-links a,
  .theme-toggle {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
