/*=============== BASE ===============*/

.card__article img {
  display: block;
  max-width: 100%;
  height: auto;
}

/*=============== CARD ===============*/
.product-container {
  display: grid;
  place-items: center;
  margin-inline: 1.5rem;
  padding-block: 10rem;
  padding-bottom: 15rem;
}

.card__container {
  display: flex;
  flex-wrap: wrap;
  gap: 5rem;
  justify-content: center;
}

.card__article {
  position: relative;
  overflow: hidden;
}

.card__article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 1.5rem;
  background-color: rgba(0, 0, 0, 0); /* Start with no darkening */
  transition: background-color 0.3s ease;
  z-index: 0; /* Place it above the image but below card content */
}

.card__article:hover::before {
  background-color: rgba(0, 0, 0, 0.5); /* Darken overlay when hovered */
}

.card__img {
  width: 328px;
  border-radius: 1.5rem;
}

.card__data {
  width: 280px;
  background-color: var(--white);
  padding: 1.5rem 2rem;
  box-shadow: 0 8px 24px hsla(0, 0%, 0%, .15);
  border-radius: 1rem;
  position: absolute;
  bottom: -9rem;
  left: 0;
  right: 0;
  margin-inline: auto;
  opacity: 0;
  transition: opacity 1s 1s;
  text-align: center;
}

.card__description {
  display: block;
  font-size: .813rem;
  margin-bottom: .25rem;
}

.card__title {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--green);
  margin-bottom: .75rem;
}

.card__button {
    user-select: none;
    -moz-user-select: none;
    background: var(--blue-light) none repeat scroll 0 0;
    border: none;
    border-radius: 50px;
    color: var(--white);
    cursor: pointer;
    display: inline-block;
    font-size: .813rem; /* Keep original font size */
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.4;
    margin-bottom: 0;
    padding: 10px 20px; /* Adjusted to keep a smaller size compared to btn-one */
    text-align: center;
    text-decoration: none; /* Keep original property */
    text-transform: capitalize;
    touch-action: manipulation;
    transition: all 0.3s ease 0s;
    vertical-align: middle;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.card__button::before {
    content: "";
    position: absolute;
    -webkit-transition-duration: 800ms;
    transition-duration: 800ms;
    width: 200%;
    height: 200%;
    top: 110%;
    left: 50%;
    background: var(--gold);
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
    border-radius: 50%;
    z-index: -1;
}

.card__button:hover {
    color: var(--black);
}

.card__button:hover::before {
    top: -40%;
}


/* Naming animations in hover */
.card__article:hover .card__data {
  animation: show-data 1s forwards;
  opacity: 1;
  transition: opacity .3s;
}

.card__article:hover {
  animation: remove-overflow 2s forwards;
}

.card__article:not(:hover) {
  animation: show-overflow 2s forwards;
}

.card__article:not(:hover) .card__data {
  animation: remove-data 1s forwards;
}

/* Card animation */
@keyframes show-data {
  50% {
    transform: translateY(-10rem);
  }
  100% {
    transform: translateY(-7rem);
  }
}

@keyframes remove-overflow {
  to {
    overflow: initial;
  }
}

@keyframes remove-data {
  0% {
    transform: translateY(-7rem);
  }
  50% {
    transform: translateY(-10rem);
  }
  100% {
    transform: translateY(.5rem);
  }
}

@keyframes show-overflow {
  0% {
    overflow: initial;
    pointer-events: none;
  }
  50% {
    overflow: hidden;
  }
}

/*=============== BREAKPOINTS ===============*/
/* For small devices */
@media screen and (max-width: 340px) {
  .product-container {
    margin-inline: 1rem;
  }

  .card__data {
    width: 250px;
    padding: 1rem;
  }
}

/* For medium devices (768px - 1119px) */
@media screen and (min-width: 768px) and (max-width: 1167px) {
  .card__container {
    max-width: calc(656px + 5rem); /* 2 cards of 328px each + gap */
    margin: 0 auto;
  }
}

/* For large devices (1120px - 1560px) */
@media screen and (min-width: 1168px) and (max-width: 1560px) {
  .card__container {
    max-width: calc(1312px + 15rem); /* 4 cards of 328px each + gaps */
    margin: 0 auto;
  }

  .card__img {
    width: 348px;
  }

  .card__data {
    width: 316px;
    padding-inline: 2.5rem;
  }
}

/* For extra-large devices (1561px and above) */
@media screen and (min-width: 1561px) {
  .card__container {
    max-width: calc(1312px + 15rem); /* 4 cards of 328px each + gaps */
    margin: 0 auto;
  }

  .card__img {
    width: 348px;
  }

  .card__data {
    width: 316px;
    padding-inline: 2.5rem;
  }
}
