/* =========================================================================
   Personal website — styles
   Theme: deep navy + indigo/cyan accents, with a light variant via [data-theme="light"]
   ========================================================================= */

:root {
  --bg:           #08091a;
  --bg-2:         #0e1024;
  --card:         #11142b;
  --card-2:       #161a36;
  --border:       #21264a;
  --border-2:     #2c3360;
  --text:         #e7e9f4;
  --text-mute:    #9aa0c0;
  --text-dim:     #6e739a;
  --accent:       #8b9bff;     /* indigo-blue */
  --accent-2:     #4ad6ff;     /* cyan */
  --accent-3:     #c98cff;     /* violet */
  --accent-strong:#6366f1;
  --good:         #22c989;
  --warn:         #ffb84d;

  --radius:   14px;
  --radius-s: 8px;
  --max:      1180px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,.25);
  --shadow-md: 0 8px 30px rgba(0,0,0,.35);
  --shadow-glow: 0 10px 40px -10px rgba(99,102,241,.45);

  --ease: cubic-bezier(.2,.7,.2,1);
}

[data-theme="light"] {
  --bg:        #f7f8fc;
  --bg-2:      #eef0fa;
  --card:      #ffffff;
  --card-2:    #f3f5fc;
  --border:    #e0e3f0;
  --border-2:  #c9cee0;
  --text:      #14172b;
  --text-mute: #555a78;
  --text-dim:  #8a8fae;
  --accent:        #4955d6;
  --accent-2:      #0ea5e9;
  --accent-3:      #9333ea;
  --accent-strong: #4f46e5;
  --shadow-md: 0 8px 30px rgba(20,30,80,.10);
  --shadow-glow: 0 10px 40px -10px rgba(79,70,229,.35);
}

/* ----- base ------------------------------------------------------------- */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; margin: 0; }

::selection { background: var(--accent-strong); color: #fff; }

code {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: .9em;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

.link {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent);
  transition: opacity .2s;
}
.link:hover { opacity: .8; }

/* ----- mesh background -------------------------------------------------- */

.bg-mesh {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}
.bg-blob {
  position: absolute;
  width: 520px; height: 520px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: .55;
  animation: drift 22s ease-in-out infinite;
}
.bg-blob-1 { top: -120px; left: -100px; background: radial-gradient(closest-side, var(--accent-strong), transparent); }
.bg-blob-2 { top: 20%;     right: -120px; background: radial-gradient(closest-side, var(--accent-2),    transparent); animation-delay: -7s; }
.bg-blob-3 { bottom: -160px; left: 30%;   background: radial-gradient(closest-side, var(--accent-3),    transparent); animation-delay: -14s; }

[data-theme="light"] .bg-blob { opacity: .25; }

@keyframes drift {
  0%, 100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(60px, -40px) scale(1.08); }
  66%      { transform: translate(-40px, 50px) scale(.95); }
}

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

.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: .2px;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px var(--accent);
}
.nav-links {
  display: flex; gap: 22px;
  font-size: 14px; color: var(--text-mute);
}
.nav-links a {
  position: relative;
  padding: 6px 0;
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1.5px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); }

.theme-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-mute);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .2s;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* ----- hero ------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
}
.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 80px 28px 80px;
  width: 100%;
  position: relative; z-index: 1;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 6px 12px; border-radius: 999px;
  margin-bottom: 28px;
}
.hero-title {
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin: 0 0 24px;
  max-width: 800px;
}
.grad {
  background: linear-gradient(120deg, var(--accent), var(--accent-2) 60%, var(--accent-3));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.underline-accent {
  position: relative; white-space: nowrap;
}
.underline-accent::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px;
  height: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: .35;
  border-radius: 2px;
  z-index: -1;
}
.hero-sub {
  font-size: 18px;
  color: var(--text-mute);
  max-width: 580px;
  margin: 0 0 36px;
}
.hero-actions {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-bottom: 56px;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s var(--ease);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-2));
  color: white;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn-ghost {
  background: transparent;
  border-color: var(--border-2);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.hero-stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 28px;
  padding: 22px 26px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 720px;
  backdrop-filter: blur(8px);
}
.stat-num {
  font-size: 22px; font-weight: 700;
  color: var(--text);
  display: inline-flex; align-items: baseline;
}
.stat-plus {
  font-size: 14px; color: var(--accent); margin-left: 2px;
}
.stat-label {
  font-size: 12.5px; color: var(--text-dim);
  letter-spacing: .3px;
}
.stat-sep {
  width: 1px; height: 32px; background: var(--border);
}

/* ----- ambient particle canvas (behind hero text) ----------------------- */

.hero-particles {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: .55;
  pointer-events: none;
}

/* ----- cursor-following spotlight in the hero --------------------------- */
/* JS sets --spot-x / --spot-y on the .hero element on mousemove. */
.hero-spotlight {
  position: absolute; inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle 360px at var(--spot-x, 50%) var(--spot-y, -100px),
                              color-mix(in srgb, var(--accent) 22%, transparent) 0%,
                              color-mix(in srgb, var(--accent) 8%, transparent) 35%,
                              transparent 70%);
  opacity: 0;
  transition: opacity .35s ease-out;
  mix-blend-mode: screen;
}
.hero:hover .hero-spotlight { opacity: 1; }

/* ----- hero face mesh art ---------------------------------------------- */

.hero-art {
  position: absolute; right: -60px; top: 50%;
  width: 560px; height: 560px;
  color: var(--accent);
  pointer-events: none;
  opacity: .42;
  z-index: 1;
  transform: translateY(-50%);
  perspective: 900px;     /* enables the rotateY oscillation below */
}
.face-mesh {
  width: 100%; height: 100%;
  transform-origin: 50% 50%;
  animation: face-yaw 11s ease-in-out infinite;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--accent) 50%, transparent));
}
@keyframes face-yaw {
  0%, 100% { transform: rotateY(-22deg) rotateX(2deg); }
  50%      { transform: rotateY( 22deg) rotateX(-2deg); }
}

/* The tracked landmark dots breathe at slightly offset cadences. */
.landmarks circle { animation: pulse 2.6s ease-in-out infinite; transform-origin: center; }
.landmarks circle:nth-child(1) { animation-delay: 0s; }
.landmarks circle:nth-child(2) { animation-delay: .25s; }
.landmarks circle:nth-child(3) { animation-delay: .55s; }
.landmarks circle:nth-child(4) { animation-delay: .85s; }
.landmarks circle:nth-child(5) { animation-delay: 1.10s; }
.landmarks circle:nth-child(6) { animation-delay: 1.35s; }
.landmarks circle:nth-child(7) { animation-delay: 1.60s; }
.landmarks circle:nth-child(8) { animation-delay: 1.85s; }
@keyframes pulse {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1;   }
}

@media (max-width: 980px) {
  .hero-art { display: none; }
  .hero-particles { opacity: .35; }
}

.scroll-cue {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 50%;
  animation: bob 2.2s ease-in-out infinite;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
}
@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 6px); }
}

/* ----- generic section -------------------------------------------------- */

.section { padding: 90px 0; position: relative; }
.section-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
}
.section-eyebrow {
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  font-weight: 600;
}
.section h2 {
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 800;
  letter-spacing: -.6px;
  margin: 0 0 16px;
}
.section-lead {
  font-size: 17px;
  color: var(--text-mute);
  max-width: 720px;
  margin-bottom: 40px;
}

/* ----- about: two-col --------------------------------------------------- */

.two-col {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 60px;
  align-items: start;
}
.col-text p { color: var(--text-mute); margin: 0 0 16px; }
.col-text b { color: var(--text); font-weight: 600; }

.chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 24px;
}
.chips li {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text-mute);
  transition: all .2s;
}
.chips li:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  position: sticky; top: 100px;
}
/* Profile portrait — container aspect matches the photo's natural aspect
   (480×701) exactly, so `object-fit: cover` produces zero cropping and the
   whole face including the jaw is visible.                                  */
.avatar {
  width: 240px;
  aspect-ratio: 480 / 701;
  border-radius: 18px;
  margin: 0 auto 20px;
  background: var(--card-2);
  display: grid; place-items: center;
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}
.avatar::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  pointer-events: none;
}
/* A second pseudo-element gives a subtle accent gradient halo. */
.avatar::before {
  content: ""; position: absolute; inset: -3px;
  z-index: -1;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-2) 50%, var(--accent-3));
  filter: blur(14px);
  opacity: .55;
}
.avatar-initials {
  font-weight: 800; font-size: 50px; color: white;
  letter-spacing: 1px;
}
.avatar-photo { background: var(--card-2); }
.avatar-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;  /* aspect matches exactly — no offset needed */
  display: block;
}
.profile-name { font-weight: 700; font-size: 18px; }
.profile-role { font-size: 13.5px; color: var(--text-mute); margin-top: 2px; }
.profile-links {
  display: flex; justify-content: center; gap: 8px;
  margin-top: 18px;
}
.profile-links a {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text-mute);
  transition: all .2s;
}
.profile-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

@media (max-width: 880px) {
  .two-col { grid-template-columns: 1fr; }
  .profile-card { position: static; max-width: 380px; }
}

/* ----- research cards --------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: all .25s var(--ease);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg,
              color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%);
  opacity: 0; transition: opacity .25s;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.card:hover::before { opacity: 1; }
.card-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  display: grid; place-items: center;
  margin-bottom: 18px;
}
.card-icon svg { width: 24px; height: 24px; }
.card h3 { font-size: 18px; margin: 0 0 8px; font-weight: 700; }
.card p  { color: var(--text-mute); margin: 0; font-size: 14.5px; }

/* ----- publications ----------------------------------------------------- */

.pubs {
  display: flex; flex-direction: column; gap: 26px;
}

/* Stacked layout: big media on top, body underneath. */
.pub {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.pub:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

/* Publication thumbnails accept <img> or <video> children. The container
   uses `aspect-ratio` (not a fixed height) so it grows with the card width,
   and both images and videos use `object-fit: contain` so nothing is cropped.
   The card-2 fill + faint dot-grid behind handles whatever empty space is
   left over after the media is sized to fit. Same setting works for
   square-ish media (the FaceAnything 1100×1100 video) and the very wide
   research figures (~3:1). */
.pub-thumb {
  border-radius: var(--radius-s);
  width: 100%;
  aspect-ratio: 16 / 10;     /* tuned compromise: fits 1:1 video well, gives wide figures plenty of room */
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  display: block;
  background:
    radial-gradient(120% 80% at 50% 0%,
                    color-mix(in srgb, var(--accent) 10%, transparent),
                    transparent 60%),
    var(--card-2);
}
.pub-thumb img,
.pub-thumb video {
  width: 100%; height: 100%;
  object-fit: contain;     /* same setting for both — nothing gets cropped */
  object-position: center;
  display: block;
  transition: transform .5s var(--ease);
}
.pub:hover .pub-thumb img,
.pub:hover .pub-thumb video {
  transform: scale(1.025);
}

/* Subtle dot-grid behind the media so the empty letterbox area has texture. */
.pub-thumb::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 50% 50%,
                    color-mix(in srgb, var(--accent) 14%, transparent) 1px,
                    transparent 1.5px);
  background-size: 22px 22px;
  opacity: .25;
  pointer-events: none;
  z-index: 0;
}
.pub-thumb img,
.pub-thumb video { position: relative; z-index: 1; }

/* Featured pub: square-ish aspect so the 1100×1100 FaceAnything teaser
   fills the frame as completely as possible. */
.pub-featured .pub-thumb {
  aspect-ratio: 4 / 3;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* "FEATURED" pill — used on the latest paper. */
.badge-featured {
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .5px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #ffd66b;
  background: linear-gradient(135deg,
              color-mix(in srgb, #ffd66b 18%, transparent),
              color-mix(in srgb, #ff8c5a 18%, transparent));
  border: 1px solid color-mix(in srgb, #ffd66b 40%, transparent);
}

/* ===== Featured pub card =================================================
   Uses a registered custom property to animate a conic-gradient angle, so
   the border appears to slowly rotate around the card. Two backgrounds
   are layered: the inner card color (padding-box) sits on top of a conic
   gradient (border-box), and only the 2px border strip shows through.
   Browsers without @property support fall back to a static gradient.
   ========================================================================= */
@property --gradient-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

.pub-featured {
  position: relative;
  isolation: isolate;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    conic-gradient(from var(--gradient-angle),
                   var(--accent),
                   var(--accent-2),
                   var(--accent-3),
                   var(--accent-2),
                   var(--accent)) border-box;
  animation: spin-grad 9s linear infinite;
}
@keyframes spin-grad {
  to { --gradient-angle: 360deg; }
}

/* Soft outer glow that pulses, layered behind the card. */
.pub-featured::after {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: calc(var(--radius) + 6px);
  background: conic-gradient(from var(--gradient-angle),
                             color-mix(in srgb, var(--accent)  55%, transparent),
                             color-mix(in srgb, var(--accent-2) 55%, transparent),
                             color-mix(in srgb, var(--accent-3) 55%, transparent),
                             color-mix(in srgb, var(--accent)  55%, transparent));
  filter: blur(22px);
  opacity: .4;
  animation: spin-grad 9s linear infinite;
}
.pub-featured:hover::after {
  opacity: .65;
  transition: opacity .4s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .pub-featured, .pub-featured::after { animation: none; }
}

.pub-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.venue {
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 3px 10px; border-radius: 999px;
}
.dot { color: var(--text-dim); }
.status {
  font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px;
}
.status-submission { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.status-accepted   { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }

.pub-title {
  font-size: 18px; font-weight: 700;
  margin: 4px 0 6px;
  line-height: 1.35;
}
.pub-authors {
  font-size: 14px; color: var(--text-mute); margin-bottom: 10px;
}
.pub-authors b { color: var(--text); font-weight: 600; }
.pub-abstract {
  font-size: 14.5px; color: var(--text-mute);
  margin: 0 0 14px;
}
.pub-links {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.pill {
  font-size: 12.5px; font-weight: 500;
  padding: 4px 12px; border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text-mute);
  transition: all .2s;
}
.pill:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

@media (max-width: 720px) {
  .pub { grid-template-columns: 1fr; }
  .pub-thumb { height: 100px; }
}

/* ----- contact ---------------------------------------------------------- */

.contact-inner {
  text-align: center;
  padding: 60px 28px;
  max-width: 700px;
}
.contact-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-top: 24px;
}

/* ----- footer ----------------------------------------------------------- */

.footer {
  padding: 38px 0 56px;
  border-top: 1px solid var(--border);
  margin-top: 60px;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-dim);
  text-align: center;
}

/* ----- scroll reveal ---------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.reveal.in-view {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
