/* Styles for the Projekte section (Projects) */

/* Section container */
.projects-section {
  padding: 4rem 1rem;
}

/* Section heading */
.projects-section h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 3rem;
}

/* Wrapper for all project items */
.projects-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Individual project item */
.project-item {
  display: flex;
  align-items: center;
  /* Increase the gap between image and text for more breathing room */
  /* Use a larger gap for better separation between the image and its description */
  gap: 8rem;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

/* Make every second item reverse order to alternate text/image positions */
.project-item:nth-child(even) {
  flex-direction: row-reverse;
}

/* When project item becomes visible */
.project-item.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Image container */
/* Image container. Increase width and height so rotated images fit without being cut off. */
.project-image {
  position: relative;
  width: 45%;
  /* Allow the container to grow to accommodate rotation without cutting corners */
  height: 320px;
  /* Let rotated images extend beyond the container bounds so edges aren’t clipped */
  overflow: visible;
  transition: transform 0.7s ease-out;

  /* Show a pointer cursor to indicate interactivity */
  cursor: pointer;
}

/* Apply initial horizontal translation based on odd/even placement */
.project-item:nth-child(odd) .project-image {
  transform: translateX(-80px);
}

.project-item:nth-child(even) .project-image {
  transform: translateX(80px);
}

/* When item visible, reset translation */
.project-item.visible .project-image {
  transform: translateX(0);
}

/* Image styling */
.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  display: block;

  /* Smooth transform transitions for hover/active states */
  transition: transform 0.4s ease;
}

/* Apply rotation to images based on odd/even index */
.project-item:nth-child(odd) .project-image img {
  /* Slightly reduce rotation for a subtler angle */
  transform: rotate(7deg);
}

.project-item:nth-child(even) .project-image img {
  transform: rotate(-10deg);
}

/* Hover and click interactions for project images */
/* On hover: straighten the image and zoom in slightly */
.project-image:hover img {
  /* Override any rotation defined for odd/even items */
  transform: rotate(0deg) scale(1.05) !important;
}
/* On active (mouse down): keep it straight but scale down a bit for a pressed effect */
.project-image:active img {
  transform: rotate(0deg) scale(0.95) !important;
}

/* Text container */
/* Text container. Reduce width to create more space between image and text. */
.project-text {
  width: 50%;
  /* Use flexbox to allow the CTA to sit at the bottom of the text container */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.project-text h3 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.project-text p {
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

/* "Mehr erfahren" link */
.project-link {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  gap: 0.5rem;
  transition: color 0.3s ease;

  /* Align the link to the right within the flex container */
  align-self: flex-end;
}

.project-link:hover .arrow {
  transform: translateX(4px);
}

.project-link .arrow {
  transition: transform 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .project-item {
    flex-direction: column;
    text-align: left;
    /* Reduce the gap on smaller screens to avoid excessive vertical spacing */
    gap: 0rem;
  }
  .project-item:nth-child(even) {
    flex-direction: column;
  }
  /* Limit widths so images and text don’t stretch across the viewport */
  .project-image,
  .project-text {
    width: 90%;
    margin-left: auto;
    margin-right: auto;
  }
  .project-image {
    /* Prevent the image from stretching too wide on mid-sized screens */
    max-width: 500px;
    height: 250px;
  }
  .project-text {
    max-width: 600px;
  }
    /* Rotation für Mobile komplett deaktivieren */
  .project-item:nth-child(odd) .project-image img,
  .project-item:nth-child(even) .project-image img {
    transform: rotate(0deg) !important;
  }

  /* Hover soll nur noch zoomen, ohne Rotation */
  .project-image:hover img {
    transform: scale(1.05) !important;
  }
  .project-image:active img {
    transform: scale(0.95) !important;
  }
}