:root {
  --bg-black: #000000;
  --card-black: #0a0a0a;
  --neon-blue: #0077ff;
  --neon-blue-glow: #00d2ff;
  --blue-gradient: linear-gradient(135deg, #0077ff 0%, #00d2ff 100%);
  --text-gray: #a0a0a0;
  --border-soft: rgba(255, 255, 255, 0.12);
  --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

@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 {
  background-color: var(--bg-black);
  color: #ffffff;
  overflow-x: hidden;
}

/* Locks page scroll while the lightbox is open */
body.lightbox-open {
  overflow: hidden;
}

.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(0, 119, 255, 0.15) 1.5px, transparent 1.5px),
    linear-gradient(90deg, rgba(0, 119, 255, 0.15) 1.5px, transparent 1.5px);
  background-size: 40px 40px;
  z-index: -2;
  animation: pulseGrid 8s ease-in-out infinite;
}

@keyframes pulseGrid {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.bg-vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, transparent 30%, black 90%);
  pointer-events: none;
  z-index: -1;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--blue-gradient);
  box-shadow: 0 0 10px var(--neon-blue-glow);
  z-index: 1100;
  transition: width 0.1s linear;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 8%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(0, 119, 255, 0.2);
  transition: var(--transition);
}

.logo {
  font-family: 'Montserrat', sans-serif;
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 3px;
  color: var(--neon-blue-glow);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
}

.nav-links a {
  position: relative;
  color: var(--text-gray);
  margin-left: 2rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  transition: var(--transition);
  padding-bottom: 4px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0%;
  height: 1px;
  background: var(--neon-blue-glow);
  transition: width 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--neon-blue-glow);
  text-shadow: 0 0 10px var(--neon-blue);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 1001;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--neon-blue-glow);
  transition: var(--transition);
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 5%;
  position: relative;
}

.hero-img {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 2px solid var(--neon-blue);
  padding: 6px;
  box-shadow: 0 0 50px rgba(0, 119, 255, 0.4);
  margin-bottom: 2.5rem;
  background: var(--card-black);
  animation: floatY 6s ease-in-out infinite, heroPop 0.9s cubic-bezier(0.165, 0.84, 0.44, 1) both;
  cursor: zoom-in;
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes heroPop {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.hero-img-wrap {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #050505, #0d1b2a);
}

.hero-img img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.hero h1 {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(2rem, 7vw, 4rem);
  font-weight: 900;
  background: var(--blue-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
  animation: heroRise 0.8s 0.15s cubic-bezier(0.165, 0.84, 0.44, 1) both;
}

.hero p {
  color: var(--text-gray);
  font-size: 1rem;
  letter-spacing: 6px;
  text-transform: uppercase;
  font-weight: 300;
  margin-top: 0.75rem;
  animation: heroRise 0.8s 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) both;
}

@keyframes heroRise {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

.scroll-cue {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 36px;
  border: 1.5px solid rgba(0, 210, 255, 0.5);
  border-radius: 20px;
}

.scroll-cue::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 8px;
  background: var(--neon-blue-glow);
  border-radius: 2px;
  transform: translateX(-50%);
  animation: scrollDot 1.8s ease-in-out infinite;
}

@keyframes scrollDot {
  0% { opacity: 1; top: 6px; }
  70% { opacity: 0; top: 18px; }
  100% { opacity: 0; top: 6px; }
}

section {
  max-width: 1100px;
  margin: auto;
  padding: 80px 20px;
}

h2 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.8rem;
  margin-bottom: 3rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 15px;
  letter-spacing: 2px;
}

h2::before {
  content: "";
  width: 45px;
  height: 3px;
  background: var(--neon-blue);
  flex-shrink: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 2.5rem;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.6),
    inset 0 0 20px rgba(255, 255, 255, 0.05);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 119, 255, 0.5);
  box-shadow: 0 20px 60px rgba(0, 119, 255, 0.25);
}

.card h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--neon-blue-glow);
}

.card p {
  color: var(--text-gray);
  font-size: 0.95rem;
  line-height: 1.8;
}

.project-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: rgba(0, 210, 255, 0.5);
  margin-bottom: 0.5rem;
}

.proj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 1.2rem;
}

.proj-tag {
  font-size: 0.65rem;
  padding: 4px 10px;
  background: rgba(0, 119, 255, 0.08);
  border: 1px solid rgba(0, 119, 255, 0.35);
  border-radius: 4px;
  color: #aaa;
  letter-spacing: 0.5px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1.5rem;
}

.tag {
  font-size: 0.7rem;
  padding: 5px 14px;
  background: rgba(0, 119, 255, 0.08);
  border: 1px solid rgba(0, 119, 255, 0.4);
  border-radius: 4px;
  color: #fff;
  letter-spacing: 1px;
  transition: var(--transition);
}

.tag:hover {
  background: rgba(0, 119, 255, 0.25);
  border-color: var(--neon-blue-glow);
}

.contact-center {
  text-align: center;
  padding: 4rem 0;
}

.contact-row { margin-bottom: 3rem; }

.contact-label {
  color: var(--neon-blue-glow);
  font-size: 0.75rem;
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: block;
}

.contact-value {
  font-size: 1rem;
  font-weight: 300;
  color: #fff;
  letter-spacing: 1px;
}

.contact-value a {
  position: relative;
  transition: var(--transition);
}

.contact-value a:hover,
.contact-value a:focus-visible {
  color: var(--neon-blue-glow) !important;
  text-shadow: 0 0 12px rgba(0, 210, 255, 0.6);
}

.photo-gallery {
  padding: 60px 20px;
  text-align: center;
  max-width: 1100px;
  margin: auto;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px;
  margin-top: 30px;
}

.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: linear-gradient(100deg, #0a0a0a 20%, #101a24 40%, #0a0a0a 60%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite linear;
  border: 1px solid var(--border-soft);
  transition: var(--transition);
}

.gallery-item:hover {
  border-color: rgba(0, 119, 255, 0.5);
  box-shadow: 0 12px 40px rgba(0, 119, 255, 0.2);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.gallery-item.loaded {
  animation: none;
  background: none;
}

.gallery-item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 14px 16px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 10%, rgba(0,0,0,0.4) 70%, transparent 100%);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-gray);
  text-align: left;
  transform: translateY(6px);
  opacity: 0.92;
  z-index: 2;
  pointer-events: none;
}

.gallery-item figcaption strong {
  display: block;
  color: var(--neon-blue-glow);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 1px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

/* Visible failure state instead of an infinite spinning shimmer */
.gallery-item.load-error {
  animation: none;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-item.load-error::before {
  content: "Image unavailable";
  color: #555;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid var(--neon-blue);
  color: var(--neon-blue-glow);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: var(--transition);
  z-index: 900;
  backdrop-filter: blur(6px);
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--neon-blue);
  color: #000;
  box-shadow: 0 0 20px var(--neon-blue);
}

.back-to-top:active {
  transform: scale(0.92);
}

:focus-visible {
  outline: 2px solid var(--neon-blue-glow);
  outline-offset: 3px;
}

footer {
  padding: 5rem;
  text-align: center;
  color: #333;
  font-size: 0.75rem;
  letter-spacing: 4px;
}

/* =========================================================
   IMAGE FRAMES — accept any aspect ratio without cropping
   awkwardly or stretching. A blurred cover copy fills the
   frame edge-to-edge; the real image sits on top scaled with
   object-fit:contain so portrait, landscape, and 1:1 photos
   all read as intentional, letterboxed thumbnails.
   ========================================================= */
.img-frame {
  position: relative;
  aspect-ratio: 4 / 3;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: zoom-in;
  isolation: isolate;
  transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1),
              border-color 0.4s ease,
              box-shadow 0.4s ease;
}

.img-frame:hover {
  transform: translateY(-2px) scale(1.015);
  border-color: rgba(0, 210, 255, 0.6);
  box-shadow: 0 6px 20px rgba(0, 119, 255, 0.25);
}

.img-frame-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(20px) brightness(0.55) saturate(1.15);
  transform: scale(1.2);
  z-index: 0;
}

.img-frame-fg {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* =========================================================
   REFINED PROJECT IMAGES & ACTION BUTTONS
   ========================================================= */

.project-images {
  display: flex;
  gap: 12px;
  margin: 1.3rem 0;
}

/* Project Action Links / Buttons */
.project-links {
  display: flex;
  gap: 10px;
  margin-top: 1.3rem;
  flex-wrap: wrap;
}

.proj-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-decoration: none;
  text-transform: uppercase;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.proj-link:active {
  transform: scale(0.96);
}

/* GitHub Link Styling */
.proj-link.github {
  background: rgba(255, 255, 255, 0.05);
  color: #e6edf3;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.proj-link.github:hover,
.proj-link.github:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--neon-blue-glow);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
  transform: translateY(-2px);
}

/* Play Store Link Styling */
.proj-link.playstore {
  background: rgba(0, 210, 255, 0.08);
  color: var(--neon-blue-glow);
  border: 1px solid rgba(0, 210, 255, 0.35);
}

.proj-link.playstore:hover,
.proj-link.playstore:focus-visible {
  background: var(--neon-blue);
  color: #000000;
  font-weight: 700;
  border-color: var(--neon-blue-glow);
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.5);
  transform: translateY(-2px);
}

/* SVG Icon alignment inside buttons */
.proj-link svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

/* =========================================================
   CERTIFICATES SECTION
   ========================================================= */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.cert-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 2.2rem 2rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  transition: var(--transition);
}

.cert-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 119, 255, 0.5);
  box-shadow: 0 20px 60px rgba(0, 119, 255, 0.25);
}

.cert-thumb {
  aspect-ratio: 4 / 3;
  width: 100%;
  margin-bottom: 1.4rem;
}

.cert-card h3 {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.7rem;
}

.cert-card p {
  color: var(--text-gray);
  font-size: 0.88rem;
  line-height: 1.7;
  margin-bottom: 1.6rem;
}

.cert-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid rgba(0, 210, 255, 0.35);
  color: var(--neon-blue-glow);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}

.cert-link svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s ease;
}

.cert-link:hover,
.cert-link:focus-visible {
  background: var(--neon-blue);
  color: #000;
  border-color: var(--neon-blue-glow);
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.5);
}

.cert-link:hover svg {
  transform: translateX(3px);
}

.cert-link:active {
  transform: scale(0.96);
}

/* =========================================================
   LIGHTBOX — full-screen image preview
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding: 5vh 5vw;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.165, 0.84, 0.44, 1),
              opacity 0.35s ease;
}

.lightbox.active .lightbox-img {
  transform: scale(1);
  opacity: 1;
}

.lightbox-close {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 2001;
}

.lightbox-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: var(--neon-blue);
  border-color: var(--neon-blue-glow);
  box-shadow: 0 0 20px rgba(0, 210, 255, 0.5);
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(72vw, 280px);
    background: rgba(0, 0, 0, 0.97);
    border-left: 1px solid rgba(0, 119, 255, 0.25);
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0 2.5rem;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  }

  .nav-links.open { transform: translateX(0); }

  .nav-links a {
    margin: 1rem 0;
    font-size: 0.95rem;
  }

  .hero h1 { font-size: 2.8rem; }

  .contact-value {
    font-size: 0.9rem;
    word-break: break-all;
    display: block;
    padding: 0 10px;
  }

  .project-images {
    flex-direction: column;
  }

  .img-frame {
    aspect-ratio: 16 / 10;
  }

  .contact-label { letter-spacing: 3px; }

  .lightbox-close {
    top: 14px;
    right: 14px;
  }
}
