/* 1. GLOBAL RESET - Fixed missing '*' selector */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #0f0f11;
  color: #e0e0e0;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

/* 2. GLOBAL IMAGE FIX - Prevents images from breaking layout */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 3. HEADER & NAV */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(15, 15, 17, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #222;
  z-index: 100;
  height: 80px; /* Explicit height for consistency */
  display: flex;
  align-items: center;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 100%;
}

.logo {
  font-size: clamp(1.6rem, 4.5vw, 1.8rem);
  font-weight: 700;
  color: #a78bfa;
  text-decoration: none;
  z-index: 101; /* Ensure logo stays above mobile menu if needed */
}

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-links a {
  color: #ccc;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
}

/* Accessibility Focus States */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 4px;
  border-radius: 4px;
}

.hamburger {
  display: none;
  font-size: 1.8rem;
  background: none;
  border: none;
  color: #e0e0e0;
  cursor: pointer;
  padding: 0.75rem;
  z-index: 101; /* Ensure button is clickable above menu */
}

/* 4. HERO SECTION */
.hero {
  min-height: 85vh;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #0f0f11, #1a1a24);
  padding-top: 80px; /* Offset for fixed header */
}

.hero h1 {
  font-size: clamp(2.8rem, 7.5vw, 5.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.highlight {
  color: #c084fc;
}

.lead {
  font-size: clamp(1.15rem, 3.8vw, 1.5rem);
  color: #aaa;
  margin: 1.5rem 0 2.5rem;
  max-width: 65ch;
}

/* 5. BUTTONS */
.btn {
  padding: 0.95rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
  min-height: 48px; /* Touch target size */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-size: 1rem;
}

.btn.primary {
  background: #a78bfa;
  color: #0f0f11;
}

.btn.primary:hover {
  background: #c4b5fd;
  transform: translateY(-3px);
}

.btn.outline {
  border: 2px solid #666;
  color: #ddd;
  background: transparent;
}

.btn.outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #fff;
}

/* 6. SECTIONS */
.section {
  padding: 130px 0;
}

h2 {
  font-size: clamp(2.2rem, 5.5vw, 3rem);
  text-align: center;
  margin-bottom: 3rem;
  color: #fff;
}

/* 7. ABOUT */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.profile-photo {
  width: 100%;
  height: auto;
  border-radius: 12px;
}

/* 8. PROJECTS */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.view-all {
  color: #c084fc;
  text-decoration: none;
  font-weight: 600;
}

.view-all:hover {
  text-decoration: underline;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Adjusted minmax for better mobile fit */
  gap: 2rem;
}

.project-card {
  background: #16161a;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #222;
  transition: all 0.4s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-12px);
  border-color: #a78bfa;
  box-shadow: 0 15px 35px rgba(167, 139, 250, 0.15);
}

.project-img {
  height: 220px;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #777;
  font-size: 1.1rem;
  font-weight: 500;
  width: 100%;
  object-fit: cover;
}

.project-content {
  padding: 1.8rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.project-content h3 {
  margin-bottom: 0.8rem;
  color: #fff;
  font-size: 1.25rem;
}

.project-content h3 a {
  color: inherit;
  text-decoration: none;
}

.project-content h3 a:hover {
  color: #c084fc;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto; /* Pushes tags to bottom */
  padding-top: 1rem;
}

.tag {
  background: #2d1b47;
  color: #c4b5fd;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
}

/* 9. CONTACT & FOOTER */
.contact-section {
  text-align: center;
}

.contact-text {
  font-size: clamp(1.2rem, 3.5vw, 1.35rem);
  color: #bbb;
  margin-bottom: 3rem;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}

.social-link {
  color: #ccc;
  font-size: 1.3rem;
  text-decoration: none;
  transition: color 0.3s;
}

.social-link:hover {
  color: #c084fc;
}

footer {
  padding: 3rem 0;
  text-align: center;
  color: #666;
  border-top: 1px solid #222;
}

/* 10. RESPONSIVE MEDIA QUERIES */
@media (max-width: 768px) {
  .hamburger {
    display: block;
  }

  header {
    height: 4.5rem; /* Shorter header on mobile */
  }

  .hero {
    min-height: auto;
    padding: 6rem 0 4rem;
    text-align: center;
    justify-content: center;
  }
  
  .hero h1 {
    margin-bottom: 1.5rem;
  }

  .lead {
    margin-left: auto;
    margin-right: auto;
  }

  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 320px;
  }

  /* Mobile Menu Logic */
  .nav-links {
    position: fixed;
    top: 4.5rem;
    left: 0;
    right: 0;
    background: #0f0f11;
    flex-direction: column;
    padding: 2rem;
    gap: 1.8rem;
    transform: translateY(-150%); /* Hide completely */
    transition: transform 0.4s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    z-index: 99; /* Below header, above content */
    border-bottom: 1px solid #222;
  }

  .nav-links.show {
    transform: translateY(0);
  }

  .nav-links a {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    display: block;
    text-align: center;
  }

  .section {
    padding: 4rem 0 2rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .profile-photo {
    max-width: 280px;
    margin: 0 auto;
  }

  .projects-grid {
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 1.5rem;
  }
  
  .section-header {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero h1 {
    font-size: clamp(2.3rem, 8.5vw, 3.4rem);
  }

  .lead {
    font-size: 1.1rem;
  }

  h2 {
    font-size: 2.1rem;
  }

  .project-tags .tag {
    font-size: 0.82rem;
    padding: 4px 10px;
  }
  
  .contact-links {
    gap: 1.5rem;
  }
}

/* GitHub repo enhancements */
.stars {
  color: #f4a261;
  font-weight: 600;
  font-size: 1.05rem;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin: 1rem 0;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.project-meta a,
.project-meta span {
  color: #c084fc;
}

.project-meta a:hover {
  text-decoration: underline;
}
