/* Custom styles for hover effects */

/* Tech Knowledge Icons */
.grid-container {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(5, 1fr);
}

/* Grid layouts are defined in the media queries below */
.grid-item {
  position: relative;
}

.grid-item .icon-tooltip {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  white-space: nowrap;
  z-index: 100;
}

.grid-item:hover .icon-tooltip {
  opacity: 1;
  visibility: visible;
}

/* Center the last 3 icons in grid for larger screens */
@media (min-width: 992px) {
  .grid-container {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .grid-item:nth-last-child(3),
  .grid-item:nth-last-child(2),
  .grid-item:nth-last-child(1) {
    grid-column: span 1;
  }
  
  .grid-item:nth-last-child(3) {
    grid-column-start: 2;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  .grid-container {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .grid-item:nth-last-child(3),
  .grid-item:nth-last-child(2),
  .grid-item:nth-last-child(1) {
    grid-column: span 1;
  }
  
  .grid-item:nth-last-child(3) {
    grid-column-start: 2;
  }
}

/* Mobile grid layout */
@media (max-width: 767px) {
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tech icons responsive behavior for touch devices */
@media (max-width: 991px) {
  .grid-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .grid-item .icon-tooltip {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    opacity: 0;
    visibility: hidden;
  }
  
  .grid-item:hover .icon-tooltip {
    opacity: 1;
    visibility: visible;
  }
}

/* Project Cards */
.project-card {
  overflow: hidden;
  position: relative;
  margin-bottom: 30px;
  height: 300px;
  transition: height 0.3s ease-in-out;
  display: flex;
  flex-direction: row;
  cursor: default;
}

.project-card:hover {
  height: 360px; /* Increase height by 20% on hover */
}

.project-card__img {
  position: relative;
  height: 100%;
  overflow: hidden;
  width: 100%;
  transition: all 0.3s ease-in-out;
  flex: 1 0 100%;
}

.project-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.project-card:hover .project-card__img {
  flex: 0 0 25%;
  width: 25%;
}

.project-card__info {
  position: relative;
  width: 0%;
  opacity: 0;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 0;
  overflow-y: auto;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
  border-left: 1px solid #eee;
  height: 100%;
  transition: all 0.3s ease-in-out;
  flex: 0 0 0%;
}

.project-card:hover .project-card__info {
  width: 75%;
  flex: 0 0 75%;
  opacity: 1;
  padding: 20px;
}

/* Adjust project card layout for hover effect */
.col-md-6.col-lg-5.project-card__img {
  width: 100%;
  max-width: 100%;
  flex: 0 0 100%;
  height: 100%;
  transition: all 0.3s ease-in-out;
}

.project-card:hover .col-md-6.col-lg-5.project-card__img {
  width: 25%;
  max-width: 25%;
  flex: 0 0 25%;
}

.col-md-6.col-lg-7.project-card__info {
  width: 0%;
  max-width: 0%;
  flex: 0 0 0%;
  overflow: hidden;
  height: 100%;
  transition: all 0.3s ease-in-out;
  opacity: 0;
}

.project-card:hover .col-md-6.col-lg-7.project-card__info {
  width: 75%;
  max-width: 75%;
  flex: 0 0 75%;
  opacity: 1;
}

/* Media queries for responsive behavior */
@media (max-width: 991px) {
  /* Disable hover effects on tablets and mobile */
  .project-card {
    height: auto !important; /* Override desktop height */
    display: flex;
    flex-direction: column !important;
    transition: none !important;
  }
  
  .project-card:hover {
    height: auto !important; /* Prevent height increase on mobile */
  }
  
  .project-card__img, 
  .project-card:hover .project-card__img {
    width: 100% !important;
    height: auto !important;
    position: static;
    transition: none !important;
    flex: 0 0 auto !important;
    max-width: 100% !important;
  }
  
  .project-card__info,
  .project-card:hover .project-card__info {
    position: static;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    opacity: 1 !important;
    transition: none !important;
    box-shadow: none;
    border-left: none;
    border-top: 1px solid #eee;
    padding: 20px 15px !important;
    overflow: visible;
    height: auto !important;
  }
  
  .col-md-6.col-lg-5.project-card__img,
  .project-card:hover .col-md-6.col-lg-5.project-card__img {
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    transition: none !important;
  }
  
  .col-md-6.col-lg-7.project-card__info,
  .project-card:hover .col-md-6.col-lg-7.project-card__info {
    position: static;
    flex: 1 !important;
    height: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    opacity: 1 !important;
    transition: none !important;
  }
}