/* Project Cards - Improved Layout */
.project {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

body.dark-mode .project {
  background-color: #2a2a2a;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.project:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

body.dark-mode .project:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.project-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Project Card Image Section */
.project-card {
  width: 100%;
  height: 200px;
  overflow: hidden;
  position: relative;
  background-color: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-mode .project-card {
  background-color: #1a1a1a;
}

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

.project:hover .project-card img {
  transform: scale(1.05);
}

/* Special sizing for specific project images */
#news_digest_header {
  object-fit: contain;
  padding: 20px;
  background-color: #fff;
}

body.dark-mode #news_digest_header {
  background-color: #2a2a2a;
}

#fitbook-logo {
  object-fit: contain;
  padding: 30px;
  background-color: #fff;
}

body.dark-mode #fitbook-logo {
  background-color: #2a2a2a;
}

/* Project Info Section */
.project-info {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.project-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: #333;
  line-height: 1.3;
}

body.dark-mode .project-name {
  color: #fff;
}

.project-description {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

body.dark-mode .project-description {
  color: #ccc;
}

/* Project Tech Stack */
.project-tech-stack {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.tech-icon-small {
  width: 20px;
  height: 20px;
  object-fit: contain;
  opacity: 0.8;
  transition: all 0.3s ease;
  border-radius: 3px;
}

.tech-icon-small:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Fix for Express.js logo in project cards dark mode */
body.dark-mode .tech-icon-small[alt="Express.js"],
body.dark-mode .tech-icon-small[alt="Express"] {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 2px;
}

/* Fix for MIPS Assembly logo in project cards dark mode */
body.dark-mode .tech-icon-small[alt="MIPS Assembly"] {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 2px;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 1.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .project-card {
    height: 180px;
  }
  
  .project-info {
    padding: 1.25rem;
  }
  
  .project-name {
    font-size: 1.15rem;
  }
  
  .project-description {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .projects-grid {
    gap: 1rem;
  }
  
  .project-card {
    height: 160px;
  }
  
  .project-info {
    padding: 1rem;
  }
  
  .project-name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  
  .project-description {
    font-size: 0.85rem;
  }
  
  #news_digest_header,
  #fitbook-logo {
    padding: 15px;
  }
}

/* Ensure consistent card heights */
@media (min-width: 769px) {
  .project {
    min-height: 350px;
  }
}

/* Add a subtle border to separate image from text */
.project-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
}

body.dark-mode .project-card::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}