/* ---------- Design tokens ---------- */
:root {
  --bg: #08080d;
  --bg-alt: #0f0f18;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef0f5;
  --text-dim: #9aa0b4;
  --text-dimmer: #676d84;

  --teal: #2dd4bf;
  --teal-bright: #5eead4;
  --purple: #a855f7;
  --purple-bright: #c084fc;

  --gradient: linear-gradient(135deg, var(--teal) 0%, var(--purple) 100%);
  --gradient-soft: linear-gradient(135deg, rgba(45, 212, 191, 0.15), rgba(168, 85, 247, 0.15));

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --nav-h: 76px;
  --radius: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

/* ---------- Reset ---------- */
* , *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@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;
    scroll-behavior: auto !important;
  }
}

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

h1, h2, h3 { font-family: var(--font-display); margin: 0; line-height: 1.1; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
svg { width: 1em; height: 1em; display: block; }

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--purple);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 0;
  z-index: 999;
}
.skip-link:focus { left: 0; }

/* ---------- Background canvas + grain ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background: var(--bg);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 5vw, 4rem);
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(8, 8, 13, 0.55);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav__logo-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  background-image: var(--gradient-soft);
}

.nav__links {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}
.nav__links a {
  position: relative;
  font-size: 0.95rem;
  color: var(--text-dim);
  transition: color 0.2s var(--ease);
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a:hover::after { transform: scaleX(1); }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}
.nav__toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  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); }

@media (max-width: 780px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(10, 10, 16, 0.97);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease);
  }
  .nav__links.is-open { max-height: 320px; }
  .nav__links a {
    padding: 1.1rem clamp(1.25rem, 5vw, 4rem);
    border-top: 1px solid var(--border);
  }
}

/* ---------- Layout helpers ---------- */
.section {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 7rem) clamp(1.25rem, 5vw, 2rem);
}

.section__head { margin-bottom: clamp(2rem, 5vw, 3rem); }
.section__kicker {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal-bright);
  margin-bottom: 0.75rem;
}
.section__head h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 600;
}
.section__sub {
  margin-top: 0.75rem;
  color: var(--text-dim);
  max-width: 46ch;
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 2rem) 1.5rem 4rem;
  overflow: hidden;
}

.hero__blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  max-width: 620px;
  max-height: 620px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: -1;
  animation: drift 16s ease-in-out infinite alternate;
}
.hero__blob--teal { background: var(--teal); top: -10%; left: -8%; }
.hero__blob--purple { background: var(--purple); bottom: -14%; right: -8%; animation-delay: -8s; }

@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(6%, 8%) scale(1.12); }
}

.hero__eyebrow {
  font-family: var(--font-display);
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.hero__name {
  font-size: clamp(2.75rem, 9vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background-size: 200% 200%;
  animation: gradient-pan 8s ease infinite;
}
@keyframes gradient-pan {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero__role {
  margin-top: 1rem;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.6vw, 1.5rem);
  color: var(--teal-bright);
  min-height: 1.6em;
}
.cursor-blink { animation: blink 1s step-start infinite; color: var(--purple-bright); }
@keyframes blink { 50% { opacity: 0; } }

.hero__tagline {
  margin-top: 1.25rem;
  max-width: 42ch;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.hero__cta {
  margin-top: 2.25rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); }

.btn--primary {
  background: var(--gradient);
  color: #050508;
  box-shadow: 0 8px 30px -8px rgba(168, 85, 247, 0.55);
}
.btn--primary:hover { box-shadow: 0 12px 34px -6px rgba(45, 212, 191, 0.5); }

.btn--ghost {
  border: 1px solid var(--border);
  background: var(--surface);
}
.btn--ghost:hover { background: var(--surface-hover); border-color: rgba(255,255,255,0.18); }

.hero__socials {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.15rem;
  color: var(--text-dim);
  transition: transform 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.icon-btn:hover {
  color: var(--teal-bright);
  border-color: var(--teal);
  background: rgba(45, 212, 191, 0.08);
  transform: translateY(-3px) scale(1.05);
}

.scroll-cue {
  position: absolute;
  bottom: clamp(1.25rem, 4vh, 2.5rem);
  width: 26px;
  height: 42px;
  border: 2px solid var(--border);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}
.scroll-cue span {
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--gradient);
  animation: scroll-cue 1.8s ease infinite;
}
@keyframes scroll-cue {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(12px); opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 5vw, 3rem);
  align-items: start;
}
@media (max-width: 720px) {
  .about__grid { grid-template-columns: 1fr; }
}
.about__bio { color: var(--text-dim); font-size: 1.05rem; }
.about__chips {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.about__chips li {
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  padding-left: 2rem;
}
.about__chips li::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gradient);
}

/* ---------- Timeline ---------- */
.timeline {
  --progress: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-left: clamp(1.5rem, 4vw, 2.5rem);
}
.timeline::before,
.timeline::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  border-radius: 2px;
}
.timeline::before {
  bottom: 0;
  background: var(--border);
}
.timeline::after {
  height: 100%;
  background: linear-gradient(180deg, var(--teal) 0%, var(--purple) 100%);
  transform: scaleY(var(--progress));
  transform-origin: top;
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.35);
}

.timeline__item {
  position: relative;
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.timeline__item.is-visible { opacity: 1; transform: translateY(0) scale(1); }

.timeline__item::before {
  content: "";
  position: absolute;
  left: calc(clamp(1.5rem, 4vw, 2.5rem) * -1 - 6px);
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.timeline__item.is-visible::before {
  animation: dot-pop 0.6s var(--ease) both;
}
.timeline__item:first-of-type::before {
  animation: dot-pop 0.6s var(--ease) both, dot-glow 2.4s ease-in-out 0.6s infinite;
}
.timeline__item:hover::before {
  transform: scale(1.25);
  box-shadow: 0 0 0 8px rgba(168, 85, 247, 0.18);
}

@keyframes dot-pop {
  0% { transform: scale(0.2); }
  60% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
@keyframes dot-glow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12); }
  50% { box-shadow: 0 0 0 10px rgba(45, 212, 191, 0.22); }
}

.timeline__period {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--purple-bright);
  font-weight: 600;
}
.timeline__role {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}
.timeline__org {
  color: var(--teal-bright);
  font-weight: 500;
  transition: color 0.25s var(--ease);
}
.timeline__item:hover .timeline__org { color: var(--purple-bright); }
.timeline__desc {
  margin-top: 0.6rem;
  color: var(--text-dim);
  max-width: 62ch;
}
.timeline__tags {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.timeline__tags span {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--surface);
}

.timeline__cta {
  margin-top: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--gradient-soft);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: var(--teal-bright);
  transition: transform 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.timeline__cta svg { width: 0.85em; height: 0.85em; }
.timeline__cta:hover {
  transform: translateY(-2px);
  border-color: var(--teal);
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.22), rgba(168, 85, 247, 0.22));
}

/* ---------- Projects ---------- */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1.75rem;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
  will-change: transform;
}
.card.is-visible { opacity: 1; transform: translateY(0); }
.card:hover {
  border-color: rgba(255,255,255,0.16);
  background: var(--surface-hover);
}

.card__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
}
.card__desc {
  margin-top: 0.6rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.card__tags {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.card__tags span {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--gradient-soft);
  color: var(--teal-bright);
}
.card__link {
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--teal-bright);
}
.card__link svg { width: 0.9em; height: 0.9em; }

/* ---------- Links / Contact ---------- */
.links__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.link-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple);
  background: rgba(168, 85, 247, 0.08);
}
.link-card__icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--gradient-soft);
  color: var(--teal-bright);
  font-size: 1.1rem;
}
.link-card__label { font-weight: 600; }
.link-card__url {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  color: var(--text-dimmer);
  word-break: break-all;
}

/* ---------- Footer ---------- */
.footer {
  padding: 2.5rem 1.5rem 3rem;
  text-align: center;
  color: var(--text-dimmer);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
