:root {
  --bg-top: #0b1220;
  --bg-mid: #111827;
  --bg-bot: #0f172a;
  --panel: rgba(255,255,255,.03);
  --text: #e8edf7;
  --muted: #a9b4c8;
  --accent: #5da0ff;
  --accent-2: #8ac5ff;
  --max: 1100px;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  position: relative;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 45%, var(--bg-bot) 100%);
}

/* Static base grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.18;
}

/* Bright grid layer revealed by moving light mask */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(138,197,255,0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138,197,255,0.28) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 1;

  -webkit-mask-image: linear-gradient(
    180deg,
    transparent 0%,
    transparent 34%,
    rgba(255,255,255,0.10) 42%,
    rgba(255,255,255,0.95) 50%,
    rgba(255,255,255,0.10) 58%,
    transparent 66%,
    transparent 100%
  );
  -webkit-mask-size: 100% 220%;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: 0 -140%;

  mask-image: linear-gradient(
    180deg,
    transparent 0%,
    transparent 34%,
    rgba(255,255,255,0.10) 42%,
    rgba(255,255,255,0.95) 50%,
    rgba(255,255,255,0.10) 58%,
    transparent 66%,
    transparent 100%
  );
  mask-size: 100% 220%;
  mask-repeat: no-repeat;
  mask-position: 0 -140%;

  animation: gridLightWave 22s ease-in-out infinite;
}

@keyframes gridLightWave {
  0% {
    -webkit-mask-position: 0 -140%;
    mask-position: 0 -140%;
  }
  100% {
    -webkit-mask-position: 0 180%;
    mask-position: 0 180%;
  }
}

/* Keep content above background effects */
header,
main,
footer,
.nav,
.hero,
.section,
.hero-card,
.card,
.project,
.contact-card {
  position: relative;
  z-index: 1;
}

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

img {
  max-width: 100%;
  display: block;
  border-radius: 14px;
}

.wrap {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(11, 18, 32, 0.72);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  gap: 16px;
}

.brand {
  font-weight: 700;
  letter-spacing: .04em;
}

.nav-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .95rem;
}

.nav-links a:hover,
.nav-links a:focus {
  color: var(--text);
}

.hero {
  padding: 88px 0 64px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 28px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  background: rgba(255,255,255,.03);
  color: var(--accent-2);
  font-size: .88rem;
  margin-bottom: 18px;
}

h1, h2, h3 {
  line-height: 1.08;
  margin: 0 0 14px;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  letter-spacing: -.04em;
}

h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: -.03em;
}

h3 {
  font-size: 1.15rem;
}

.lead {
  color: var(--muted);
  max-width: 62ch;
  font-size: 1.04rem;
  margin-bottom: 24px;
}

.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  transition: .18s ease;
}

.btn-primary {
  background: var(--accent);
  color: #08111f;
}

.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn-secondary {
  border-color: rgba(255,255,255,.12);
  color: var(--text);
  background: rgba(255,255,255,.02);
}

.btn-secondary:hover {
  background: rgba(255,255,255,.06);
}

.quick-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--muted);
  font-size: .95rem;
}

.hero-card,
.card,
.project,
.contact-card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border: 1px solid rgba(255,255,255,.07);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-card {
  padding: 22px;
}

.avatar {
  aspect-ratio: 1;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(93,160,255,.14), rgba(255,255,255,.03)),
    rgba(18, 26, 43, 0.8);
  border: 1px solid rgba(255,255,255,.08);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.section {
  padding: 22px 0 64px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 24px;
}

.section-copy {
  color: var(--muted);
  max-width: 60ch;
}

.about-grid,
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.card {
  padding: 22px;
}

.list {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.list li + li {
  margin-top: 8px;
}

.projects-grid {
  display: grid;
  gap: 20px;
}

.project {
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
}

.project-media {
  min-height: 260px;
  background: linear-gradient(135deg, #1b2740, #111827);
  border-right: 1px solid rgba(255,255,255,.07);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-body {
  padding: 24px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 16px;
}

.tag {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(93,160,255,.1);
  color: var(--accent-2);
  font-size: .82rem;
  border: 1px solid rgba(93,160,255,.18);
}

.resume-box {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.contact-card {
  padding: 22px;
}

.footer {
  padding: 30px 0 50px;
  color: var(--muted);
  font-size: .92rem;
}

@media (max-width: 900px) {
  .hero-grid,
  .about-grid,
  .contact-grid,
  .project {
    grid-template-columns: 1fr;
  }

  .project-media {
    min-height: 220px;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.07);
  }

  .section-head {
    align-items: start;
    flex-direction: column;
  }
}
