:root {
  --bg: #070b14;
  --bg-elevated: #0c1120;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #edeff5;
  --text-muted: #97a0b5;
  --text-faint: #626b81;

  --primary: #38bdf8;
  --secondary: #8b5cf6;
  --accent: #22c55e;

  --font-display: "Space Grotesk", "Manrope", sans-serif;
  --font-body: "Manrope", sans-serif;

  --max-width: 1260px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

ul { list-style: none; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

::selection { background: rgba(56, 189, 248, 0.25); color: #fff; }

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

/* ---------- scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ---------- header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  padding: 18px 0;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), padding 0.35s var(--ease);
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  padding: 12px 0;
  background: rgba(7, 11, 20, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.logo span { color: var(--primary); }

.main-nav {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-size: 0.92rem;
  color: var(--text-muted);
  position: relative;
  padding: 4px 2px;
  transition: color 0.25s var(--ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s var(--ease);
}

.nav-link:hover,
.nav-link.is-active { color: var(--text); }

.nav-link:hover::after,
.nav-link.is-active::after { width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  padding-top: 90px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

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

.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  pointer-events: none;
}

.glow-a {
  width: 420px; height: 420px;
  background: var(--primary);
  top: -100px; right: 5%;
}

.glow-b {
  width: 380px; height: 380px;
  background: var(--secondary);
  bottom: -120px; left: 0%;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--primary);
  margin-bottom: 22px;
}

.hero-name {
  font-size: clamp(2.4rem, 5.2vw, 3.6rem);
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ffffff 40%, #c7d2fe 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-role {
  color: var(--text-muted);
  font-size: 1.02rem;
  margin-bottom: 22px;
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
  font-weight: 500;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.35;
}

.rotating-word {
  color: var(--primary);
  border-bottom: 2px solid rgba(56, 189, 248, 0.3);
}

.hero-tagline {
  color: var(--text-muted);
  max-width: 46ch;
  margin-bottom: 34px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 26px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #0ea5e9);
  color: #04121c;
  font-weight: 600;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -10px rgba(56, 189, 248, 0.55);
}

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.hero-visual { display: flex; justify-content: center; }

.orbit-card {
  position: relative;
  width: min(340px, 80vw);
  padding: 38px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  text-align: center;
}

.avatar-ring {
  position: relative;
  width: 140px; height: 140px;
  margin: 0 auto 26px;
  border-radius: 50%;
  padding: 4px;
  background: conic-gradient(from 180deg, var(--primary), var(--secondary), var(--accent), var(--primary));
}

.avatar-img,
.avatar-fallback {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated);
}

.avatar-img { position: relative; z-index: 1; }

.avatar-img:not([src]),
.avatar-img.is-broken { display: none; }

.avatar-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--text);
  background: radial-gradient(circle at 30% 20%, rgba(56,189,248,0.28), rgba(139,92,246,0.22) 60%, var(--bg-elevated));
}

.avatar-fallback.is-visible { display: flex; }

.orbit-tags {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.orbit-tags li {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 0.8rem;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.orbit-tags i { color: var(--primary); }

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-faint);
  font-size: 1.1rem;
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ---------- sections ---------- */
.section { padding: 100px 0; }
.section-alt { background: var(--bg-elevated); }

.section-head { max-width: 620px; margin-bottom: 48px; }

.section-head h2 {
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  margin-bottom: 12px;
}

.section-sub { color: var(--text-muted); font-size: 1.02rem; }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: start;
}

.about-copy p { color: var(--text-muted); margin-bottom: 18px; max-width: 62ch; }

.philosophy {
  border-left: 2px solid var(--secondary);
  padding-left: 18px;
  font-style: italic;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.02rem;
  margin-top: 24px;
}

.exploring-panel {
  padding: 28px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
}

.exploring-panel h3 {
  font-size: 1rem;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-weight: 500;
}

.explore-tags { display: flex; flex-wrap: wrap; gap: 10px; }

.explore-tags span {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
}

/* ---------- education timeline ---------- */
.timeline {
  position: relative;
  max-width: 720px;
  padding-left: 32px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  opacity: 0.4;
}

.timeline-item { position: relative; margin-bottom: 28px; }
.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -32px; top: 8px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

.timeline-card {
  padding: 22px 26px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.timeline-card:hover {
  border-color: var(--border-strong);
  transform: translateX(4px);
}

.timeline-year {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.timeline-card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.timeline-card p { color: var(--text-muted); font-size: 0.92rem; }

.timeline-tag {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

/* ---------- skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.skill-card {
  padding: 26px 22px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.skill-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.skill-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(56,189,248,0.18), rgba(139,92,246,0.18));
  color: var(--primary);
  margin-bottom: 16px;
  font-size: 1.05rem;
}

.skill-card h3 { font-size: 1.02rem; margin-bottom: 14px; }

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }

.tag-list span {
  font-size: 0.78rem;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.tag-list.small span { font-size: 0.72rem; padding: 5px 10px; }

/* ---------- projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 44px;
}

.project-card {
  padding: 28px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 18px 40px -22px rgba(56, 189, 248, 0.35);
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.project-top i { font-size: 1.3rem; color: var(--primary); }

.status {
  font-size: 0.72rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.status-live { background: rgba(34,197,94,0.14); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.status-progress { background: rgba(56,189,248,0.14); color: #7dd3fc; border: 1px solid rgba(56,189,248,0.3); }

.project-card h3 { font-size: 1.12rem; margin-bottom: 10px; }
.project-card p { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 18px; flex-grow: 1; }

.project-link {
  font-size: 0.85rem;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  width: fit-content;
}

.project-link i { font-size: 0.7rem; }

.upcoming {
  padding: 30px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-strong);
}

.upcoming h3 { font-size: 1rem; color: var(--text-muted); font-weight: 500; margin-bottom: 18px; }

.upcoming-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.upcoming-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.upcoming-item i { color: var(--secondary); }

/* ---------- research ---------- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.research-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--secondary);
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}

.research-card:hover {
  transform: translateY(-4px);
  background: var(--surface-hover);
}

.research-card i {
  font-size: 1.15rem;
  color: var(--secondary);
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.12);
}

.research-card span { font-size: 0.95rem; font-weight: 500; }

/* ---------- contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.contact-card {
  padding: 26px 20px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.contact-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
}

.contact-card i { font-size: 1.5rem; color: var(--primary); margin-bottom: 12px; }
.contact-card span { display: block; font-weight: 600; margin-bottom: 4px; }
.contact-card small { color: var(--text-muted); font-size: 0.8rem; word-break: break-word; }

/* ---------- footer ---------- */
.site-footer { padding: 40px 0; border-top: 1px solid var(--border); }

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-inner p { color: var(--text-muted); font-size: 0.85rem; }
.copyright { color: var(--text-faint); font-size: 0.8rem; }

/* ---------- back to top ---------- */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), border-color 0.3s var(--ease);
  z-index: 500;
}

.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-actions { justify-content: center; }
  .hero-tagline { margin-left: auto; margin-right: auto; }
  .about-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .research-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .upcoming-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .main-nav {
    position: fixed;
    top: 64px; left: 16px; right: 16px;
    flex-direction: column;
    gap: 4px;
    background: rgba(10, 14, 24, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    backdrop-filter: blur(16px);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
  }

  .main-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link { padding: 12px 10px; border-radius: 8px; }
  .nav-link:hover { background: var(--surface); }
  .nav-link::after { display: none; }

  .nav-toggle { display: flex; }

  .section { padding: 72px 0; }
}

@media (max-width: 620px) {
  .skills-grid,
  .projects-grid,
  .research-grid,
  .contact-grid,
  .upcoming-grid { grid-template-columns: 1fr; }

  .hero { min-height: auto; padding-bottom: 60px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
