.what-we-do-section {
  background-color: white;
}

.what-we-do-content {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
}

.what-we-do-title {
  color: var(--secondary);
}
/* i need the height of orange-card to be the same height of what-we-do-cards height */
.orange-card {
  max-width: 420px;
  min-width: 320px;
  background-color: #f79334;
  color: white;
  display: flex;
  flex-direction: column;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  perspective: 1000px;
}

/* Flip animation states */
.orange-card.flip-in {
  animation: flipIn 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

.orange-card.flip-out {
  animation: flipOut 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

/* Flip animation keyframes */
@keyframes flipIn {
  0% {
    transform: rotateY(-90deg) scale(0.8);
    opacity: 0;
  }
  50% {
    transform: rotateY(-45deg) scale(0.9);
    opacity: 0.7;
  }
  100% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes flipOut {
  0% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: rotateY(90deg) scale(0.8);
    opacity: 0;
  }
}

/* Content animation for smooth transitions */
.orange-card-content {
  transition: all 0.3s ease-in-out;
  z-index: 2;
  height: 100%;
  position: relative;
  padding: 25px;

}

.orange-card.flip-in .orange-card-content {
  animation: contentFadeIn 0.4s ease-in-out 0.2s both;
}

@keyframes contentFadeIn {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Ensure smooth animation on all screen sizes */
@media (max-width: 767px) {
  .orange-card {
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
  }
  
  .orange-card.flip-in {
    animation: flipInMobile 0.5s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
  }
  
  .orange-card.flip-out {
    animation: flipOutMobile 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
  }
}

@keyframes flipInMobile {
  0% {
    transform: rotateY(-90deg) scale(0.9);
    opacity: 0;
  }
  50% {
    transform: rotateY(-45deg) scale(0.95);
    opacity: 0.7;
  }
  100% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes flipOutMobile {
  0% {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: rotateY(90deg) scale(0.9);
    opacity: 0;
  }
}

.orange-card-title {
  font-size: var(--font-size-title-md);
  font-weight: 700;
}

.orange-card-desc {
  font-size: var(--font-size-body-md);
  font-weight: 400;
  margin-bottom: 15px;
}

.orange-card-img {
  position: absolute;
  inset-inline-start: 0;
  bottom: 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  z-index: 1;
}

.orange-card-img img {
  width: 155px;
  height: 180px;
  filter: grayscale(100%) brightness(0) invert(1);
}

.read-more {
  color: white;
}

.what-we-do-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
}

.card {
  border-radius: 20px;
  text-align: center;
  text-decoration: none;
  color: black;
  display: flex
;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.card-image-wrapper {
  padding: 15px;
  border: 1px solid #77777740;
  border-radius: 10px;
  background-color: transparent;
  transition: background-color 0.3s ease, transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 120px;
}

.card img {
  padding: 0;
  transition: none;
  filter: none;
  max-width: 80px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.card:hover .card-image-wrapper {
  background-color: var(--orange);
}

.card:hover img {
  filter: grayscale(100%) brightness(0) invert(1);
}

.card-text {
  font-size: var(--font-size-body-xs);
  font-weight: 500;
  color: #757b7e;
  margin-bottom: 20px;
}

/* mobile */
@media (max-width: 767px) {
  .what-we-do-content {
    flex-direction: column;
    margin: auto;
    width: 100%;
  }

  .what-we-do-cards {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .orange-card {
    width: 100%;
    max-width: 100%;
  }

  .orange-card-title {
    margin-bottom: 10px;
  }

  .orange-card-desc {
    font-size: var(--font-size-body-md);
  }

  .orange-card-img {
    position: absolute;
    inset-inline-start: 0;
    bottom: -50px;
    padding: 0px 15px;
    z-index: 1;
  }

  .orange-card-img img {
    width: 80px;
    height: 80px;
  }
  
  .orange-card-content {
    position: relative;
    z-index: 2;
  }
  
  .read-more {
    font-size: var(--font-size-body-md);
  }

  .card-image-wrapper {
    height: 100px;
  }
  
  .card img {
    max-width: 70px;
    max-height: 70px;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .card-text {
    font-size: var(--font-size-body-xs);
  }
}

/* tablet */
@media (min-width: 768px) and (max-width: 1024px) {
  .what-we-do-content {
    flex-direction: column;
    justify-content: center;
  }
  .orange-card {
    width: 100%;
  }

  .orange-card-title {
    font-size: var(--font-size-title-md);
  }

  .orange-card-desc {
    font-size: var(--font-size-body-md);
  }
  
  .orange-card-img {
    position: absolute;
    inset-inline-start: 0;
    bottom: -50px;
    z-index: 1;
  }
  
  .orange-card-img img {
    width: 80px;
    height: 80px;
  }
  
  .orange-card-content {
    position: relative;
    z-index: 2;
  }
  
  .read-more {
    font-size: var(--font-size-body-md);
  }

  .what-we-do-cards {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }
}

/* small desktop */
@media (min-width: 1025px) and (max-width: 1280px) {
  .what-we-do-content {
    flex-direction: column;
    justify-content: center;
  }
  .orange-card {
    width: 100%;
    max-width: 100%;
  }

  .orange-card-title {
    font-size: var(--font-size-title-md);
    margin-bottom: 10px;
  }

  .orange-card-desc {
    font-size: var(--font-size-body-md);
  }
  
  .orange-card-img {
    position: absolute;
    inset-inline-start: 0;
    bottom: -50px;
    z-index: 1;
  }
  
  .orange-card-img img {
    width: 80px;
    height: 80px;
  }
  
  .orange-card-content {
    position: relative;
    z-index: 2;
  }
  
  .read-more {
    font-size: var(--font-size-body-md);
  }

  .what-we-do-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1280px){
  .orange-card{
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    min-height: 320px;
  }
}