/* ====================================== */
/* PROJECTS PAGE SPECIFIC STYLES          */
/* ====================================== */

/* Projects Container */
.projects-container {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr; /* This ensures equal height on Desktop */
  gap: 5rem;
  margin-top: 3rem;
}

/* Project Row Structure */
.project-row {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  background-color: #1c1c1c;
  border: 0.0625rem solid #333;
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: 0 0.25rem 0.5rem rgba(255, 255, 255, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  
  /* Ensure the card fills the grid cell height on desktop */
  height: 100%; 
  box-sizing: border-box;
}

.project-row:hover {
  transform: translateY(-0.3rem);
  box-shadow: 0 0.5rem 1rem rgba(255, 255, 255, 0.1);
}

/* Project Image */
.project-image {
  flex: 0 0 45%;
  max-width: 45%;
}

.project-image img {
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
  border: 1px solid #333;
  object-fit: cover;
  aspect-ratio: 16 / 9;
}

/* Project Details */
.project-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0rem;
  margin-bottom: 0.75rem;
}

.project-title-row h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  color: #ffffff;
}

.project-details p {
  margin: 0;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  line-height: 1.6;
  color: #e1e1e1;
}

/* GitHub Button */
.github-button {
  display: inline-block;
  transition: transform 0.2s ease;
  line-height: 0;
}

.github-button:hover {
  transform: scale(1.2);
}

.github-button img {
  width: clamp(2rem, 5vw, 2.5rem);
  height: clamp(2rem, 5vw, 2.5rem);
  aspect-ratio: 1 / 1;
  cursor: pointer;
  border: none;
  object-fit: contain;
  display: block;
}

/* Tech Badges */
.tech-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.5rem 0;
}

.tech-badges .badge {
  background-color: #2d2d2d;
  color: #ffffff;
  padding: 0.4rem 0.8rem;
  border: 1px solid #444;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Fun Mode Animations */
@keyframes slideInFromLeft {
  0% {
    opacity: 0;
    transform: translateX(-100px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromRight {
  0% {
    opacity: 0;
    transform: translateX(100px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

body.fun-mode .project-row:nth-of-type(odd) {
  opacity: 0;
  animation: slideInFromLeft 2s ease 0.1s forwards;
}

body.fun-mode .project-row:nth-of-type(even) {
  opacity: 0;
  animation: slideInFromRight 2s ease 0.1s forwards;
}

body:not(.fun-mode) .project-row {
  opacity: 1;
  animation: none !important;
}

/* ====================================== */
/* MOBILE RESPONSIVE                      */
/* ====================================== */

@media screen and (max-width: 768px) {
  .projects-container {
    /* Switch off Grid on mobile to prevent height forcing */
    display: flex;
    flex-direction: column;
    gap: 3rem;
    grid-auto-rows: unset; 
  }

  .project-row {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    /* Reset height to allow card to grow with content */
    height: auto; 
  }

  .project-image {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .project-details {
    gap: 1rem;
  }

  .github-button {
    align-self: flex-start;
  }

  .project-row:not(:has(.github-button)) .project-title-row {
    justify-content: center;
  }
}

@media screen and (max-width: 480px) {
  .projects-container {
    gap: 2rem;
  }

  .project-details h2 {
    font-size: 1.5rem;
  }

  .project-details p {
    font-size: 0.95rem;
  }

  .github-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  .tech-badges {
    justify-content: center;
  }

  .project-title-row {
    width: 100%;
    box-sizing: border-box;
  }

  .github-button {
    padding: 0;
    margin: 0;
  }
}