:root {
  --bg: #070b14;
  --surface: #101826;
  --surface-2: #141f31;
  --text: #e8eefb;
  --muted: #a9b4c8;
  --accent: #57b8ff;
  --accent-2: #66f3d0;
  --border: #243147;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 92px;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 20% 10%, #112039, var(--bg) 35%), var(--bg);
  min-height: 100vh;
  line-height: 1.6;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(var(--scroll-progress, 0));
  transform-origin: left;
  z-index: 140;
  pointer-events: none;
  box-shadow: 0 0 14px rgba(87, 184, 255, 0.45);
}

.background-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(to right, rgba(87, 184, 255, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(87, 184, 255, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 35%, black 30%, transparent 85%);
  pointer-events: none;
  z-index: -2;
  animation: grid-pan 20s linear infinite;
}

.background-grid::before,
.background-grid::after {
  content: "";
  position: absolute;
  inset: -12%;
  pointer-events: none;
}

.background-grid::before {
  background:
    radial-gradient(circle at 18% 24%, rgba(87, 184, 255, 0.2), transparent 26%),
    radial-gradient(circle at 78% 72%, rgba(102, 243, 208, 0.18), transparent 30%),
    radial-gradient(circle at 58% 18%, rgba(87, 184, 255, 0.12), transparent 22%);
  filter: blur(8px);
  animation: ai-orbits 12s ease-in-out infinite alternate;
  transform: translate3d(0, var(--scroll-shift-sm, 0px), 0);
  will-change: transform;
}

.background-grid::after {
  background:
    linear-gradient(115deg, transparent 0%, rgba(87, 184, 255, 0.16) 46%, transparent 52%),
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 24px,
      rgba(102, 243, 208, 0.06) 25px,
      transparent 26px
    );
  mix-blend-mode: screen;
  animation: data-scan 9s linear infinite;
  transform: translate3d(0, var(--scroll-shift-md, 0px), 0);
  will-change: transform;
}

@keyframes grid-pan {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 42px 42px, -42px 42px;
  }
}

@keyframes ai-orbits {
  0% {
    transform: translate3d(-1.8%, -1%, 0) scale(1);
    opacity: 0.55;
  }
  50% {
    transform: translate3d(1.4%, 1.8%, 0) scale(1.03);
    opacity: 0.72;
  }
  100% {
    transform: translate3d(2.6%, -1.5%, 0) scale(1.01);
    opacity: 0.6;
  }
}

@keyframes data-scan {
  0% {
    transform: translate3d(-18%, -5%, 0);
    opacity: 0.38;
  }
  50% {
    transform: translate3d(7%, 2%, 0);
    opacity: 0.52;
  }
  100% {
    transform: translate3d(18%, 5%, 0);
    opacity: 0.38;
  }
}

.site-header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(7, 11, 20, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  z-index: 100;
  transition: transform 260ms ease, background-color 260ms ease, border-color 260ms ease,
    box-shadow 260ms ease;
}

.site-header.header-scrolled {
  background: rgba(7, 11, 20, 0.9);
  border-bottom-color: rgba(87, 184, 255, 0.16);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.site-header.header-hidden {
  transform: translateY(-104%);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.site-nav {
  display: flex;
  gap: 1rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  position: relative;
  transition: color 220ms ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}

.site-nav a:hover {
  color: var(--accent-2);
}

.site-nav a:hover::after,
.site-nav a.active::after {
  transform: scaleX(1);
}

.site-nav a.active {
  color: var(--text);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  border-radius: 8px;
  width: 2.4rem;
  height: 2.4rem;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
}

.section {
  margin-top: 2rem;
}

.section,
.card,
.hero-profile {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 560ms ease, transform 560ms ease;
}

.section.in-view,
.card.in-view,
.hero-profile.in-view {
  opacity: 1;
  transform: translateY(0);
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 2rem;
  align-items: center;
  min-height: calc(100vh - 120px);
}

.hero-content,
.hero-profile {
  will-change: transform;
}

.tag {
  color: var(--accent-2);
  margin-bottom: 0.2rem;
  letter-spacing: 0.8px;
  font-size: 0.85rem;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.15;
  margin-bottom: 0.8rem;
}

h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  margin-bottom: 0.8rem;
}

.subtitle {
  color: var(--muted);
  max-width: 60ch;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  padding: 0.65rem 1rem;
  margin-right: 0.6rem;
  margin-top: 0.8rem;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #041222;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.hero-profile {
  position: relative;
  border-radius: 18px;
  padding: 0.7rem;
  background: linear-gradient(145deg, rgba(87, 184, 255, 0.32), rgba(102, 243, 208, 0.16));
  max-width: 360px;
  justify-self: center;
}

.hero-profile img {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 14px;
  background: #0f1726;
}

.profile-glow {
  position: absolute;
  inset: -1px;
  border-radius: 20px;
  box-shadow: 0 0 45px rgba(87, 184, 255, 0.24);
  pointer-events: none;
}

.panel,
.card {
  background: linear-gradient(180deg, rgba(16, 24, 38, 0.9), rgba(12, 19, 31, 0.85));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}

.timeline,
.project-grid,
.cert-list {
  display: grid;
  gap: 1rem;
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.card-header span,
.stack {
  color: var(--accent);
  font-size: 0.88rem;
}

ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
}

.contact-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact-icon {
  width: 2.8rem;
  height: 2.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--accent-2);
  background: rgba(16, 24, 38, 0.65);
  text-decoration: none;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease,
    color 200ms ease;
}

.contact-icon svg {
  width: 1.18rem;
  height: 1.18rem;
  fill: currentColor;
}

.contact-icon:hover {
  color: var(--text);
  border-color: rgba(102, 243, 208, 0.55);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(87, 184, 255, 0.2);
}

.site-footer {
  text-align: center;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1rem;
}

@media (max-width: 800px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    margin-top: 1rem;
  }

  .hero-profile {
    max-width: 290px;
    order: -1;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .site-nav {
    position: absolute;
    right: 1rem;
    top: 64px;
    display: none;
    flex-direction: column;
    background: rgba(16, 24, 38, 0.95);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  }

  .site-nav.open {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .background-grid {
    animation-duration: 40s;
  }

  .background-grid::before,
  .background-grid::after {
    animation-duration: 24s;
  }

  .site-header,
  .site-nav a,
  .site-nav a::after,
  .section,
  .card,
  .hero-profile {
    transition: none;
  }

  .scroll-progress {
    transition: none;
  }

  .section,
  .card,
  .hero-profile {
    opacity: 1;
    transform: none;
  }
}
