/* ---------- Design tokens ---------- */
:root {
  --bg:        #0b1220;
  --bg-2:      #0e1729;
  --surface:   rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border:    rgba(255, 255, 255, 0.10);
  --text:      #e7ecf3;
  --muted:     #93a1b8;
  --accent:    #60a5fa;
  --accent-2:  #a78bfa;
  --radius:    16px;
  --maxw:      1080px;
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.15; margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ---------- Animated background ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
}
body::before {
  /* soft radial glow layered over the canvas */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 60rem at 15% 0%, rgba(96, 165, 250, 0.12), transparent 60%),
    radial-gradient(50rem 50rem at 100% 20%, rgba(167, 139, 250, 0.10), transparent 55%),
    linear-gradient(180deg, rgba(11, 18, 32, 0.2), rgba(11, 18, 32, 0.85));
}

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1.2rem, 4vw, 3rem);
  backdrop-filter: blur(10px);
  background: rgba(11, 18, 32, 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);
  background: rgba(11, 18, 32, 0.8);
}
.nav__brand {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}
.nav__brand-dot { color: var(--accent); }
.nav__links {
  display: flex;
  gap: clamp(1rem, 3vw, 2.2rem);
  font-size: 0.95rem;
  font-weight: 500;
}
.nav__links a {
  color: var(--muted);
  transition: color 0.2s var(--ease);
  position: relative;
}
.nav__links a:hover { color: var(--text); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -4px;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.25s var(--ease);
}
.nav__links a:hover::after { width: 100%; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}
.nav__toggle span {
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav.is-open .nav__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav.is-open .nav__toggle span:nth-child(2) { opacity: 0; }
.nav.is-open .nav__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Layout ---------- */
main { position: relative; z-index: 1; }
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) clamp(1.2rem, 4vw, 2rem);
}
.section__head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 2.2rem;
}
.section__index {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
}
.section__head h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem clamp(1.2rem, 4vw, 2rem) 4rem;
  position: relative;
}
.hero__inner { max-width: 760px; }
.hero__eyebrow {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-size: clamp(0.8rem, 2.4vw, 0.95rem);
  letter-spacing: 0.04em;
  margin: 0 0 1.2rem;
}
.hero__title {
  font-size: clamp(3rem, 12vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
}
.hero__title span {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lead {
  color: var(--muted);
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  margin: 1.4rem auto 2rem;
  max-width: 620px;
}
.hero__actions {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero__meta {
  display: flex;
  gap: clamp(1.2rem, 5vw, 3rem);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.hero__meta span {
  display: block;
  color: var(--text);
  font-weight: 700;
  font-size: 1.5rem;
  font-family: "JetBrains Mono", monospace;
}
.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 2px solid var(--border);
  border-radius: 14px;
}
.hero__scroll span {
  position: absolute;
  top: 8px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  background: var(--accent);
  border-radius: 2px;
  animation: scroll 1.8s var(--ease) infinite;
}
@keyframes scroll {
  0% { opacity: 0; transform: translateY(0); }
  40% { opacity: 1; }
  80%, 100% { opacity: 0; transform: translateY(14px); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
  border: 1px solid transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0b1220;
  box-shadow: 0 8px 30px rgba(96, 165, 250, 0.35);
}
.btn--ghost {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}
.btn--ghost:hover { background: var(--surface-2); }

/* ---------- About ---------- */
.about {
  max-width: 760px;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  color: var(--muted);
}
.about p + p { margin-top: 1.2rem; }
.about strong { color: var(--text); font-weight: 600; }
.about em { color: var(--accent); font-style: normal; }

/* ---------- Cards (portfolio) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
}
.card {
  display: flex;
  flex-direction: column;
  padding: 1.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(96,165,250,0.10), rgba(167,139,250,0.10));
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.card:hover {
  transform: translateY(-6px);
  border-color: rgba(96, 165, 250, 0.5);
}
.card:hover::before { opacity: 1; }
.card > * { position: relative; z-index: 1; }
.card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}
.card__tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--accent);
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.card__arrow {
  font-size: 1.3rem;
  color: var(--muted);
  transition: transform 0.3s var(--ease), color 0.3s var(--ease);
}
.card:hover .card__arrow { transform: translate(3px, -3px); color: var(--accent); }
.card__title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.card__desc { color: var(--muted); font-size: 0.98rem; flex-grow: 1; }
.card__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0;
}
.card__stack li {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.2rem 0.65rem;
  background: var(--surface-2);
  border-radius: 6px;
}
.card__link {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  color: var(--accent);
}

/* ---------- Timeline ---------- */
.timeline { position: relative; }
.timeline__item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding: 1.8rem 0;
  border-top: 1px solid var(--border);
}
.timeline__item:last-child { border-bottom: 1px solid var(--border); }
.timeline__date {
  display: block;
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-size: 0.9rem;
}
.timeline__place { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 0.3rem; }
.timeline__body h3 { font-size: 1.25rem; margin-bottom: 0.8rem; font-weight: 700; }
.timeline__body ul { display: flex; flex-direction: column; gap: 0.5rem; }
.timeline__body li {
  color: var(--muted);
  padding-left: 1.3rem;
  position: relative;
  font-size: 0.98rem;
}
.timeline__body li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.65em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Grid-2 (education / associations) ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2.5rem;
}
.plainlist { display: flex; flex-direction: column; gap: 1.3rem; }
.plainlist h3 { font-size: 1.1rem; font-weight: 600; }
.plainlist p { color: var(--muted); margin: 0.3rem 0 0; font-size: 0.95rem; }
.plainlist p span { color: var(--accent); }

/* ---------- Skills ---------- */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.4rem;
}
.skills__group {
  padding: 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.skills__group h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.skills__group ul { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skills__group li {
  font-size: 0.85rem;
  color: var(--text);
  padding: 0.35rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ---------- Contact ---------- */
.section--contact { text-align: center; }
.section--contact .section__head { justify-content: center; }
.contact p { color: var(--muted); font-size: 1.1rem; max-width: 540px; margin: 0 auto 2rem; }
.contact__links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.contact__links a {
  font-family: "JetBrains Mono", monospace;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), color 0.25s var(--ease);
  font-size: 0.92rem;
}
.contact__links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- Footer ---------- */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem clamp(1.2rem, 4vw, 2rem);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.88rem;
  position: relative;
  z-index: 1;
}
.footer__note { font-family: "JetBrains Mono", monospace; }

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

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav__links {
    position: fixed;
    inset: 0 0 auto 0;
    top: 100%;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
    padding: 2.5rem 1rem;
    background: rgba(11, 18, 32, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    transition: transform 0.35s var(--ease);
    font-size: 1.1rem;
  }
  .nav.is-open .nav__links { transform: translateY(0); }
  .nav__toggle { display: flex; }
  .timeline__item { grid-template-columns: 1fr; gap: 0.8rem; }
  .footer { flex-direction: column; text-align: center; align-items: center; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero__scroll span { animation: none; }
}
