/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --bg-deep: #05050a;
  --bg-base: #0a0a12;
  --bg-elevated: #0f172a;

  --surface: rgba(255, 255, 255, 0.05);
  --surface-hover: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text: #f5f5f7;
  --text-muted: #94a3b8;
  --text-faint: #5b6478;

  --violet: #7c3aed;
  --indigo: #6366f1;
  --cyan: #22d3ee;
  --violet-glow: rgba(124, 58, 237, 0.45);
  --cyan-glow: rgba(34, 211, 238, 0.35);

  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  color-scheme: dark;
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-base) 45%, var(--bg-elevated) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }

a {
  color: var(--cyan);
  text-decoration: none;
  transition: color 200ms var(--ease);
}
a:hover { color: #67e8f9; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ==========================================================================
   Ambient background — canvas particle network + drifting gradient blobs
   ========================================================================== */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: 0.55;
  pointer-events: none;
}

.ambient-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  filter: blur(90px);
}

.blob {
  position: absolute;
  border-radius: 50%;
  opacity: 0.32;
  will-change: transform;
  animation: drift 22s var(--ease) infinite alternate;
}

.blob-violet {
  width: 480px;
  height: 480px;
  top: -12%;
  left: -8%;
  background: var(--violet);
}

.blob-cyan {
  width: 420px;
  height: 420px;
  bottom: -14%;
  right: -8%;
  background: var(--cyan);
  animation-delay: -8s;
}

.blob-indigo {
  width: 360px;
  height: 360px;
  top: 35%;
  left: 55%;
  background: var(--indigo);
  animation-delay: -15s;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(50px, 70px) scale(1.18); }
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(5, 5, 10, 0.55);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1.05rem;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
  gap: clamp(0.5rem, 3vw, 1.75rem);
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 2px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 1px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transition: right 250ms var(--ease);
}

.nav-links a:hover {
  color: var(--text);
}
.nav-links a:hover::after { right: 0; }

/* ==========================================================================
   Layout shell
   ========================================================================== */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
  border-top: 1px solid var(--border);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.section.in-view {
  opacity: 1;
  transform: translateY(0);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 2rem;
}

.section-index {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cyan);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.section-intro {
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 65ch;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  min-height: 88vh;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(2rem, 6vw, 4.5rem);
  padding: 4rem 0 3rem;
  flex-wrap: wrap;
}

.hero-photo {
  flex: 0 0 auto;
  width: clamp(160px, 22vw, 240px);
  aspect-ratio: 1 / 1;
  position: relative;
}

.hero-photo::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  opacity: 0.6;
  filter: blur(18px);
  z-index: 0;
}

.hero-photo img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
}

.hero-text { flex: 1 1 420px; min-width: 0; max-width: 100%; }

.eyebrow {
  color: var(--cyan);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.hero-text h1 {
  font-size: clamp(2.4rem, 6vw, 3.75rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffffff 30%, var(--cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 500;
}

.bio {
  margin-top: 1.5rem;
  color: var(--text-muted);
  max-width: 62ch;
}

.bio a { color: var(--text); border-bottom: 1px solid var(--border-strong); }
.bio a:hover { color: var(--cyan); border-color: var(--cyan); }

.hero-links {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-links a,
.footer-links a {
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: transform 220ms var(--ease), border-color 220ms var(--ease), box-shadow 220ms var(--ease), background 220ms var(--ease);
}

.hero-links a:hover,
.footer-links a:hover {
  color: var(--text);
  transform: translateY(-2px);
  border-color: var(--cyan);
  background: var(--surface-hover);
  box-shadow: 0 8px 24px -8px var(--cyan-glow);
}

/* ==========================================================================
   News
   ========================================================================== */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.news-list li {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 220ms var(--ease), background 220ms var(--ease), transform 220ms var(--ease);
}

.news-list li:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateX(4px);
}

.news-date {
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bg-deep);
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.news-text { color: var(--text-muted); }
.news-text strong { color: var(--text); }

/* ==========================================================================
   Cards (publications & projects)
   ========================================================================== */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 280ms var(--ease), border-color 280ms var(--ease), box-shadow 280ms var(--ease), background 280ms var(--ease);
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--border-strong);
  background: var(--surface-hover);
  box-shadow: 0 20px 40px -20px var(--violet-glow);
}

.card-thumb {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.card-body {
  padding: 1.25rem 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.card-title:hover { color: var(--cyan); }

.card-authors {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-authors strong { color: var(--text); }

.card-venue {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--text-faint);
}

.card-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  font-weight: 600;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 4rem;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.credit {
  font-size: 0.82rem;
  color: var(--text-faint);
}

.credit a { color: var(--text-faint); border-bottom: 1px dotted var(--text-faint); }
.credit a:hover { color: var(--cyan); border-color: var(--cyan); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  .nav-links { gap: 0.85rem; }
  .hero { min-height: unset; padding-top: 3rem; flex-direction: column; text-align: center; }
  .hero-links { justify-content: center; }
  .bio { margin-left: auto; margin-right: auto; }
  .section { padding: 3.5rem 0; }
}

@media (max-width: 480px) {
  .nav-links { font-size: 0.8rem; gap: 0.6rem; }
  .brand { font-size: 0.95rem; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #bg-canvas { display: none; }
  .blob { animation: none; }
  .section {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
