/* --- Projects Section --- */
#projects {
  text-align: center;
  padding: 120px 20px;
  position: relative;
  background: linear-gradient(135deg, #0a0e17 0%, #1a1f3a 50%, #0f1525 100%);
  font-family: "Poppins", sans-serif;
  color: #fff;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* **FIX**: Define CSS Variables (Place this in your main stylesheet) */
:root {
  --primary-accent: #6e45e2;
  --secondary-accent: #88d3ce;
  --text-secondary: #c0c0c0;
  --bg-dark-secondary: rgba(22, 27, 34, 0.6);
  --bg-dark-primary: #0a0e17;
}

/* Background effect for projects section */
#projects::before {
  content: "";
  position: absolute;
  top: 20%;
  right: 10%;
  width: 60%;
  height: 60%;
  max-width: 1000px;
  z-index: 0;
}

.projects-header {
  text-align: center;
  margin-bottom: 5rem;
  position: relative;
  z-index: 1;
}

.projects-header h2 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: 60px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--secondary-accent) 0%, var(--primary-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-family: "Orbitron", sans-serif;
  display: inline-block;
}

.projects-header .projects-intro {
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 700px;
  margin: 0 auto;
  color: var(--text-secondary);
}

/* --- Projects Container (Horizontal Scroll) --- */
.projects-container {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 20px;
  margin-bottom: 50px;
  position: relative;
  z-index: 1;

  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch; /* Improves smooth scrolling on iOS */

  /* **FIX**: Consistent scrollbar styling */
  scrollbar-width: thin;
  scrollbar-color: var(--primary-accent) rgba(26, 31, 58, 0.4);
}

.projects-container::-webkit-scrollbar {
  height: 8px;
}

.projects-container::-webkit-scrollbar-track {
  background: rgba(26, 31, 58, 0.4);
  border-radius: 10px;
}

.projects-container::-webkit-scrollbar-thumb {
  background: var(--primary-accent);
  border-radius: 10px;
}

/* --- Project Card Styling --- */
.project-card {
  background: rgba(26, 31, 58, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  overflow: hidden;
  width: 350px;
  flex: 0 0 auto;
  transition: transform 0.4s ease, box-shadow 0.4s ease, opacity 0.6s ease-out;
  border: 1px solid rgba(136, 211, 206, 0.2);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);

  opacity: 0;
  transform: translateY(40px);
  white-space: normal; /* **FIX**: Allows text to wrap normally inside the card */
}

.project-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.project-card:hover {
  transform: translateY(-15px) scale(1.03);
  box-shadow: 0 25px 50px rgba(110, 69, 226, 0.4);
  border-color: rgba(136, 211, 206, 0.4);
}

/* --- Project Image Area --- */
.project-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
  filter: brightness(0.8) grayscale(0.2);
}

.project-card:hover .project-image img {
  transform: scale(1.1);
  filter: brightness(1) grayscale(0);
}

/* **FIX**: Ongoing Tag - Use a more reliable positioning method */
.ongoing-tag {
  position: absolute;
  top: 15px; /* Adjust top and right to place it neatly */
  right: 15px;
  background: linear-gradient(135deg, var(--secondary-accent), var(--primary-accent));
  color: white;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 5px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

/* Project Overlay with Links */
.project-overlay {
  padding: 1rem;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(110, 69, 226, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.project-card:hover .project-overlay {
  opacity: 1;
}

.project-links {
  display: flex;
  gap: 20px;
}

.project-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  border-radius: 50%;
  color: white;
  font-size: 1.5rem;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.project-link:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* --- Project Info --- */
.project-info {
  padding: 25px;
  text-align: left;
  background: rgba(26, 31, 58, 0.8);
  border-top: 1px solid rgba(136, 211, 206, 0.1);
}

.project-info h3 {
  font-family: "Orbitron", sans-serif;
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 10px;
}

.project-info .project-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.project-tags .tag {
  background: var(--bg-dark-secondary);
  color: var(--primary-accent);
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(136, 211, 206, 0.1);
  transition: background 0.3s ease, color 0.3s ease;
}

.project-tags .tag:hover {
  background: var(--primary-accent);
  color: var(--bg-dark-primary);
}

/* --- Call to Action Button --- */
.projects-cta {
  text-align: center;
  margin-top: 3rem;
  position: relative;
  z-index: 1;
}

.projects-btn {
  padding: 15px 40px;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--secondary-accent), var(--primary-accent));
  border: none;
  border-radius: 50px;
  color: white;
  cursor: pointer;
  transition: all 0.4s ease;
  font-family: "Orbitron", sans-serif;
  font-weight: 600;
  letter-spacing: 1px;
  box-shadow: 0 10px 30px rgba(110, 69, 226, 0.3);
}

.projects-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 15px 40px rgba(110, 69, 226, 0.5);
}

/* --- Responsive Design for Mobile --- */
@media (max-width: 768px) {
  .projects-container {
    padding: 10px;
    gap: 20px;
  }

  .project-card {
    width: 300px;
  }

  .projects-header h2 {
    font-size: 2rem;
  }

  .projects-header .projects-intro {
    font-size: 1rem;
  }
}