@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url('../fonts/dm-sans-var.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans';
  font-style: italic;
  font-weight: 100 1000;
  font-display: swap;
  src: url('../fonts/dm-sans-italic-var.woff2') format('woff2');
}

:root {
  --font-sans: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --bg: #F4F1EC;
  --bg-2: #ECE8E0;
  --surface: #FFFFFF;
  --surface-2: #F7F5F0;
  --text: #16141D;
  --text-2: #4C4957;
  --text-3: #817D8E;
  --line: rgba(22, 20, 29, 0.10);
  --line-2: rgba(22, 20, 29, 0.18);
  --accent: #5C47E0;
  --accent-2: #B54AE0;
  --accent-rgb: 92, 71, 224;
  --accent-soft: rgba(92, 71, 224, 0.09);
  --glow: rgba(92, 71, 224, 0.22);
  --on-accent: #FFFFFF;
  --particle: 92, 71, 224;
  --shadow: 0 24px 60px -24px rgba(22, 20, 29, 0.28);
  --shadow-sm: 0 10px 30px -14px rgba(22, 20, 29, 0.20);
  --radius: 22px;
  --radius-sm: 14px;
  --nav-h: 68px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --speed: 0.5s;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0B0A11;
  --bg-2: #12101B;
  --surface: #14121D;
  --surface-2: #1A1724;
  --text: #F1EFF7;
  --text-2: #B6B2C6;
  --text-3: #7C7892;
  --line: rgba(241, 239, 247, 0.09);
  --line-2: rgba(241, 239, 247, 0.18);
  --accent: #9D8CFF;
  --accent-2: #C47CFF;
  --accent-rgb: 157, 140, 255;
  --accent-soft: rgba(157, 140, 255, 0.13);
  --glow: rgba(128, 106, 255, 0.32);
  --on-accent: #191626;
  --particle: 157, 140, 255;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.65);
  --shadow-sm: 0 10px 30px -14px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 85% -5%, rgba(var(--accent-rgb), 0.10), transparent 60%),
    radial-gradient(700px 480px at -10% 40%, rgba(var(--accent-rgb), 0.07), transparent 60%);
  pointer-events: none;
}

::selection { background: var(--accent); color: var(--on-accent); }

a { color: inherit; }

button { font-family: inherit; }

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

.skip-link {
  position: fixed;
  top: -48px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: top 0.25s var(--ease);
}
.skip-link:focus { top: 12px; }

section[id] { scroll-margin-top: calc(var(--nav-h) + 14px); }

/* ---------- NAV ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 36px);
  transition: transform var(--speed) var(--ease), background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border-bottom-color: var(--line);
  box-shadow: 0 8px 30px -18px rgba(0, 0, 0, 0.25);
}
.nav.hidden { transform: translateY(-110%); }

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.nav-logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 6px 16px -8px var(--glow);
}
.accent-dot { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  transition: color 0.25s ease, background 0.25s ease;
}
.nav-links a:hover { color: var(--text); background: var(--accent-soft); }
.nav-links a.active { color: var(--accent); background: var(--accent-soft); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: 8px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: transform 0.3s var(--ease), color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.theme-toggle svg { display: none; }
html[data-theme="light"] .icon-moon { display: block; }
html[data-theme="dark"] .icon-sun { display: block; }
.theme-toggle:active svg { transform: rotate(40deg); transition: transform 0.3s ease; }

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 10px;
}
.nav-burger span {
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.35s var(--ease), opacity 0.25s ease;
}
.nav-burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.active span:nth-child(2) { opacity: 0; }
.nav-burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- HERO ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: calc(var(--nav-h) + 48px) 0 96px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translate(calc(var(--px, 0) * 18px), calc(var(--py, 0) * 18px));
  transition: transform 0.6s var(--ease);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
}
.orb-core {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.orb-a {
  width: 56vmin;
  height: 56vmin;
  left: -9%;
  top: 4%;
  opacity: 0.42;
  animation: drift-a 26s ease-in-out infinite alternate;
}
.orb-a .orb-core {
  background: radial-gradient(circle at 32% 30%, rgba(108, 84, 226, 0.85), rgba(180, 74, 224, 0.35) 48%, transparent 72%);
}
.orb-b {
  width: 44vmin;
  height: 44vmin;
  right: -7%;
  top: 26%;
  opacity: 0.36;
  animation: drift-b 32s ease-in-out infinite alternate;
}
.orb-b .orb-core {
  background: radial-gradient(circle at 60% 40%, rgba(236, 82, 158, 0.75), rgba(96, 165, 250, 0.30) 52%, transparent 74%);
}
.orb-c {
  width: 34vmin;
  height: 34vmin;
  left: 26%;
  bottom: -6%;
  opacity: 0.34;
  animation: drift-c 22s ease-in-out infinite alternate;
}
.orb-c .orb-core {
  background: radial-gradient(circle at 45% 55%, rgba(56, 189, 248, 0.70), rgba(124, 92, 255, 0.35) 55%, transparent 76%);
}
[data-theme="dark"] .orb-a { opacity: 0.5; }
[data-theme="dark"] .orb-b { opacity: 0.44; }
[data-theme="dark"] .orb-c { opacity: 0.42; }

.ring {
  position: absolute;
  border-radius: 50%;
}
.ring-a {
  width: 74vmin;
  height: 74vmin;
  left: -12%;
  bottom: -4%;
  border: 1px dashed var(--line-2);
  animation: spin 70s linear infinite;
}
.ring-b {
  width: 30vmin;
  height: 30vmin;
  right: 10%;
  top: 6%;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  animation: spin-rev 46s linear infinite;
}
.ring-b::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--glow);
}

#heroCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 44px);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero-eyebrow::before {
  content: '';
  width: 34px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.hero-name {
  margin: 20px 0 10px;
  font-size: clamp(3rem, 9vw, 5.6rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  color: var(--text);
}
.hero-name-accent {
  background: linear-gradient(100deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s ease-in-out infinite;
}

.hero-role {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-weight: 550;
  color: var(--text-2);
}
.hero-role::after {
  content: '';
  height: 1px;
  flex: 0 1 160px;
  background: linear-gradient(90deg, var(--line-2), transparent);
}

.hero-tagline {
  max-width: 580px;
  margin-top: 16px;
  font-size: clamp(1rem, 2.2vw, 1.14rem);
  line-height: 1.75;
  color: var(--text-3);
}
.hero-tagline strong { color: var(--text); font-weight: 650; }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 14px 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease, border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
}
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  box-shadow: 0 14px 30px -12px var(--glow);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px -14px var(--glow);
}
.btn-ghost {
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
}
.btn-ghost:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(22px, 4.5vw, 46px);
  margin-top: 34px;
  list-style: none;
}
.hero-stats li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-stats strong {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-stats span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease), color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.chip:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.chip-tip {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  padding: 5px 11px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s var(--ease);
}
.chip-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: var(--text);
}
.chip-copy.copied .chip-tip { opacity: 1; transform: translateX(-50%) translateY(0); }
.chip-copy.copied { color: var(--accent); border-color: var(--accent); }

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: 26px;
  height: 42px;
  transform: translateX(-50%);
  border: 2px solid var(--line-2);
  border-radius: 14px;
  transition: border-color 0.3s ease;
}
.hero-scroll::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 3px;
  height: 8px;
  margin-left: -1.5px;
  border-radius: 3px;
  background: var(--accent);
  animation: bob 1.8s ease-in-out infinite;
}
.hero-scroll:hover { border-color: var(--accent); }

.hero-inner > * {
  animation: rise 0.8s var(--ease) both;
}
.hero-inner > :nth-child(1) { animation-delay: 0.05s; }
.hero-inner > :nth-child(2) { animation-delay: 0.12s; }
.hero-inner > :nth-child(3) { animation-delay: 0.19s; }
.hero-inner > :nth-child(4) { animation-delay: 0.26s; }
.hero-inner > :nth-child(5) { animation-delay: 0.33s; }
.hero-inner > :nth-child(6) { animation-delay: 0.40s; }
.hero-inner > :nth-child(7) { animation-delay: 0.47s; }

/* ---------- MAIN ---------- */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 36px) 70px;
  display: grid;
  gap: clamp(18px, 3vw, 26px);
}

.panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4.5vw, 44px);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}
.panel:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: clamp(24px, 4.5vw, 44px);
  right: clamp(24px, 4.5vw, 44px);
  height: 3px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), transparent);
  opacity: 0.85;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.panel-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
}
.panel-label::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px var(--glow);
}
.panel-index {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.panel-sub {
  margin: -10px 0 18px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.lead {
  max-width: 720px;
  font-size: 16.5px;
  line-height: 1.8;
  color: var(--text-2);
}
.lead::first-letter {
  font-weight: 800;
  font-size: 1.5em;
  color: var(--accent);
  padding-right: 2px;
}

/* ---------- ENTRIES ---------- */

.entry {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 24px;
}
.entry-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 3px;
}
.entry-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.entry-range::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--glow);
}
.entry-extra {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.entry-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 5px;
}
.entry-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 10px;
}
.entry-text {
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-2);
}

/* ---------- PUBLICATIONS ---------- */

.pub-list { display: grid; gap: 14px; }

.pub {
  position: relative;
  display: grid;
  grid-template-areas:
    'num title'
    'num authors'
    'num journal'
    'num note';
  grid-template-columns: auto 1fr;
  column-gap: 20px;
  row-gap: 5px;
  padding: 20px 22px 20px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: transform 0.4s var(--ease), border-color 0.35s ease, box-shadow 0.4s ease;
}
.pub::before {
  content: '';
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.pub:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: var(--shadow-sm);
}
.pub-num {
  grid-area: num;
  align-self: start;
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.pub-title {
  grid-area: title;
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -0.008em;
  line-height: 1.45;
  color: var(--text);
}
.pub-authors {
  grid-area: authors;
  font-size: 13.5px;
  color: var(--text-3);
}
.pub-authors .me { color: var(--accent); font-weight: 700; }
.pub-journal {
  grid-area: journal;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-style: italic;
  color: var(--text-2);
}
.pub-dot { color: var(--text-3); }
.pub-journal a {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  position: relative;
}
.pub-journal a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 1.5px;
  background: var(--accent);
  transition: right 0.3s var(--ease);
}
.pub-journal a:hover::after { right: 0; }
.pub-note {
  grid-area: note;
  justify-self: start;
  margin-top: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- PROJECTS ---------- */

.proj-list { list-style: none; }

.proj-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 18px;
  align-items: baseline;
  padding: 18px 10px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: background 0.35s ease, transform 0.35s var(--ease), padding 0.35s var(--ease);
}
.proj-item:last-child { border-bottom: none; }
.proj-item:hover {
  background: var(--accent-soft);
  transform: translateX(5px);
  padding-left: 18px;
}
.proj-num {
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}
.proj-title {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.008em;
  color: var(--text);
  margin-bottom: 3px;
}
.proj-desc {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-3);
}
.proj-tags {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.proj-type {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-soft);
}
.proj-loc {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-3);
}

/* ---------- SKILLS ---------- */

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
}
.skill-group-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 16px;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  list-style: none;
}
.tag {
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-2);
  background: var(--surface);
  cursor: default;
  transition: transform 0.3s var(--ease), color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.tag:hover {
  transform: translateY(-2px);
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.tag.primary {
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  box-shadow: 0 8px 18px -10px var(--glow);
}
.tag.primary:hover { color: var(--on-accent); }

/* ---------- FOOTER ---------- */

.site-footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 52px clamp(16px, 4vw, 36px) 60px;
  border-top: 1px solid var(--line);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 30px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.footer-links a {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.25s ease, background 0.25s ease;
}
.footer-links a:hover { color: var(--accent); background: var(--accent-soft); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--text-3);
}

/* ---------- BACK TO TOP ---------- */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.4s var(--ease), visibility 0.4s, color 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover {
  color: var(--on-accent);
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

/* ---------- REVEAL ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- ANIMATIONS ---------- */

@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(9vmin, 6vmin) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-7vmin, 9vmin) scale(0.92); }
}
@keyframes drift-c {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(6vmin, -7vmin) scale(1.15); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-rev { to { transform: rotate(-360deg); } }
@keyframes shimmer {
  0% { background-position: 0% center; }
  50% { background-position: 100% center; }
  100% { background-position: 0% center; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(9px); opacity: 1; }
}

/* ---------- RESPONSIVE ---------- */

@media (max-width: 820px) {
  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    z-index: 99;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 14px 16px 20px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    backdrop-filter: blur(18px) saturate(150%);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s;
  }
  .nav-links a {
    padding: 12px 16px;
    font-size: 15.5px;
  }
  .nav-links .theme-toggle {
    align-self: flex-start;
    margin: 8px 0 0 16px;
  }
  .nav.open .nav-links { opacity: 1; visibility: visible; transform: none; }
  .nav-burger { display: flex; }

  .hero { padding-top: calc(var(--nav-h) + 40px); }
  .hero-role::after { flex-basis: 70px; }

  .entry { grid-template-columns: 1fr; gap: 12px; }
  .entry-meta { flex-direction: row; align-items: center; gap: 14px; }

  .proj-item { grid-template-columns: 32px 1fr; }
  .proj-tags {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }

  .skills-grid { grid-template-columns: 1fr; gap: 28px; }

  .ring-b, .hero-scroll { display: none; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  main { padding-bottom: 48px; }

  .hero { padding-bottom: 64px; }
  .hero-cta .btn { flex: 1 1 100%; justify-content: center; }
  .hero-stats { gap: 22px; }
  .hero-name { font-size: clamp(2.5rem, 13vw, 3.4rem); }

  .panel { padding: 24px 20px; }
  .panel-head { margin-bottom: 16px; }
  .panel-label { letter-spacing: 0.14em; font-size: 12px; }
  .lead { font-size: 15.5px; }

  .pub {
    grid-template-columns: 1fr;
    grid-template-areas:
      'num'
      'title'
      'authors'
      'journal'
      'note';
    gap: 4px;
    padding: 18px;
  }
  .pub-note { margin-top: 7px; }

  .proj-item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px 4px;
  }
  .proj-tags { grid-column: auto; }

  .footer-top { flex-direction: column; align-items: flex-start; }
  .footer-bottom { flex-direction: column; gap: 6px; }
}

/* ---------- REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .hero-bg { display: none; }
}

/* ---------- PRINT ---------- */

@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --text: #111111;
    --text-2: #333333;
    --text-3: #555555;
    --line: #dddddd;
    --line-2: #bbbbbb;
    --accent: #4a33c8;
    --accent-soft: #efebff;
    --shadow: none;
    --shadow-sm: none;
  }
  body::before,
  .nav,
  .hero-bg,
  .hero-cta,
  .hero-chips,
  .hero-stats,
  .hero-scroll,
  .ring,
  #heroCanvas,
  .to-top,
  .theme-toggle,
  .nav-burger,
  .skip-link { display: none !important; }

  .hero {
    min-height: auto;
    padding: 8px 0 20px;
  }
  .hero-inner { padding: 0; }
  .hero-name { font-size: 30pt; margin: 12px 0 4px; }
  .hero-tagline { margin-top: 8px; }

  main {
    padding: 0;
    gap: 0;
  }
  .panel {
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    margin-bottom: 22px;
    break-inside: avoid;
  }
  .panel::before { display: none; }
  .panel-head { margin-bottom: 12px; }
  .panel-index, .panel-sub { display: none; }

  .pub {
    background: var(--surface);
    border: 1px solid var(--line);
    break-inside: avoid;
  }
  .proj-item { break-inside: avoid; }

  .site-footer {
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
  }
  .footer-bottom { justify-content: space-between; }
}
