:root {
  --bg: #0b0c10;
  --bg-2: #12141a;
  --surface: rgba(0, 255, 255, 0.03);
  --surface-hover: rgba(0, 255, 255, 0.08);
  --border: rgba(0, 255, 255, 0.15);
  --border-hover: rgba(0, 255, 255, 0.5);
  --text: #c5c6c7;
  --text-heading: #ffffff;
  --muted: #66fcf1;
  --muted-dark: #45a29e;
  --accent: #00ffff;
  --accent-glow: rgba(0, 255, 255, 0.3);
  --accent-2: #39ff14;
  --accent-3: #ffbf00;
  --shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.9);
  --shadow-hover: 0 40px 80px -15px rgba(0, 0, 0, 1), 0 0 30px var(--accent-glow);
  --radius-lg: 4px;
  --radius-md: 2px;
  --radius-sm: 0px;
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --mono: 'Fira Code', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image: 
    linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  background-attachment: fixed;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a { color: inherit; transition: var(--transition); }
img { max-width: 100%; display: block; }

.site-shell {
  position: relative;
  width: min(1200px, calc(100vw - 3rem));
  margin: 0 auto;
  padding: 2rem 0 5rem;
}

.site-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(90deg, rgba(0,255,255,0.02) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0,255,255,0.02) 1px, transparent 1px);
  background-size: 120px 120px;
  opacity: 0.8;
  z-index: -1;
}

.topbar {
  position: sticky;
  top: 1.5rem;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  margin-bottom: 4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}

.brand {
  text-decoration: none;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 999px;
}
.nav a:hover { 
  background: var(--surface-hover); 
  color: var(--text); 
  box-shadow: inset 0 0 0 1px var(--border);
}

.hero, .panel, .page-hero, .footer {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.3), rgba(15, 23, 42, 0.2));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.03);
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 2.5rem;
  padding: clamp(2.5rem, 5vw, 4rem);
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: '';
  position: absolute;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}
.hero::before { top: -15rem; left: -10rem; background: var(--accent-2); }
.hero::after { bottom: -15rem; right: -10rem; background: var(--accent); }

.hero-copy, .profile-card, .skill-card, .timeline-card, .project-card, .publications-card, .single-page, .page-hero {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.85rem;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--accent-2);
  display: inline-block;
}

h1, h2, h3 {
  margin: 0;
  font-family: 'Fraunces', serif;
  color: var(--text-heading);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.hero h1 {
  font-size: clamp(3rem, 7vw, 5.5rem);
  max-width: 12ch;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
}

.lede {
  max-width: 55ch;
  color: var(--muted);
  font-size: 1.15rem;
  font-weight: 300;
  line-height: 1.7;
}

.chip-row, .tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip, .tag {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
}
.chip:hover, .tag:hover {
  background: var(--surface-hover);
  color: var(--bg);
  background-color: var(--accent);
  border-color: var(--accent);
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0.8rem 1.5rem;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: var(--transition);
  border: 1px solid transparent;
}
.button-primary { 
  background: var(--accent); 
  color: var(--bg); 
  box-shadow: 0 0 15px var(--accent-glow);
}
.button-primary:hover {
  background: var(--accent-2);
  color: var(--bg);
  box-shadow: 0 0 25px rgba(57, 255, 20, 0.4);
}
.button-secondary { 
  background: var(--surface); 
  border: 1px solid var(--border); 
  color: var(--text);
}
.button-secondary:hover { 
  background: var(--surface-hover); 
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.profile-card, .skill-card, .timeline-card, .project-card, .publications-card, .single-page, .page-hero {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.skill-card:hover, .project-card:hover, .timeline-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  background: var(--surface-hover);
  box-shadow: var(--shadow-hover), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
}

.avatar { 
  width: 100%; 
  aspect-ratio: 1 / 1; 
  border-radius: var(--radius-sm); 
  object-fit: cover; 
  border: 1px solid var(--border);
  filter: grayscale(15%) contrast(105%);
}
.profile-card:hover .avatar { filter: grayscale(0%) contrast(100%); }

.card-kicker, .date, .section-note, .meta-row span, .mini-grid span { 
  color: var(--muted); 
  margin: 0; 
  font-size: 0.85rem; 
  font-family: var(--mono); 
}
.profile-card h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin-top: 0.5rem; color: var(--accent); }

.mini-grid { display: grid; gap: 1.2rem; margin-top: auto; }
.mini-grid strong { display: block; margin-top: 0.3rem; font-weight: 500; color: var(--text); }

.panel { margin-top: 4rem; padding: clamp(2.5rem, 5vw, 4rem); }
.section-heading { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 3rem; }
.section-heading.split { flex-direction: row; justify-content: space-between; align-items: flex-end; gap: 2rem; }
.section-heading h2 { font-size: clamp(2.2rem, 5vw, 3.5rem); max-width: 18ch; }

.grid-3, .grid-2 { display: grid; gap: 1.5rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }

.skill-card, .timeline-card, .project-card, .publications-card {
  padding: 2rem;
  height: 100%;
}

.skill-card h3 { font-size: 1.4rem; margin-bottom: 1rem; }
.skill-card ul, .single-content ul { margin: 0; padding-left: 1.2rem; color: var(--muted); }
.skill-card li { margin-bottom: 0.5rem; }

.stack { display: grid; gap: 1.5rem; }
.timeline-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
  padding: 2.5rem;
  align-items: stretch;
}
.timeline-media {
  overflow: hidden;
  border-radius: var(--radius-sm);
  display: flex;
}
.timeline-media img, .project-image, .single-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s;
  background: var(--surface);
  background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 20px);
}
.timeline-card:hover .timeline-media img, .project-card:hover .project-image {
  transform: scale(1.03);
  border-color: var(--border-hover);
}
.timeline-copy h3 { font-size: 1.8rem; }
.timeline-copy p { color: var(--muted); font-size: 1.05rem; }
.meta-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: baseline; margin-bottom: 0.5rem;}
.bullet-list { color: var(--muted); margin-top: 1.5rem; }
.bullet-list ul { padding-left: 1.2rem; }
.bullet-list li { margin-bottom: 0.5rem; }

.project-card { display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem; overflow: hidden;}
.project-card .project-image { aspect-ratio: 16 / 10; width: 100%; }
.project-body { display: flex; flex-direction: column; flex: 1; }
.project-body h3 { font-size: 1.6rem; }
.project-body p { color: var(--muted); margin-top: 1rem; }
.project-body .tag-row { margin-top: auto; padding-top: 1.5rem; }

.publications-card { display: flex; flex-direction: column; gap: 1rem;}
.publications-card h3 { font-size: 1.6rem; }
.publications-card p { color: var(--muted); }

.page-hero { margin-bottom: 2rem; padding: 3rem; }
.page-hero h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
.page-intro { color: var(--muted); font-size: 1.2rem; }
.single-page { padding: 3rem; }
.single-image { aspect-ratio: 16 / 7; margin-bottom: 2rem; }
.single-content { color: var(--muted); font-size: 1.1rem; line-height: 1.8; }
.single-content h2 { color: var(--text); margin-top: 2.5rem; margin-bottom: 1rem;}

.footer {
  margin-top: 4rem;
  padding: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .profile-card { max-width: 500px; margin: 0 auto; }
  .timeline-card { grid-template-columns: 1fr; gap: 1.5rem; }
  .timeline-media { height: 260px; }
  .grid-2 { grid-template-columns: 1fr; }
  .section-heading.split { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

@media (max-width: 640px) {
  .site-shell { width: min(100vw - 1.5rem, 1200px); padding: 1rem 0 3rem; }
  .topbar { flex-direction: column; border-radius: var(--radius-md); gap: 1rem; }
  .nav { justify-content: center; }
  .hero, .panel, .page-hero, .single-page, .footer { padding: 1.5rem; border-radius: var(--radius-md); }
  .hero::before, .hero::after { display: none; }
}