/* Projects grid section */
.projects-section {
  margin: 3rem auto;
  max-width: 1200px;
}

.projects-section h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 2rem;
  color: var(--text-color);
  text-align: center;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 0 auto;
}

.project-card {
  background-color: var(--bg-bright-color);
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text-color);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  /* Make project cards square (1:1) using aspect-ratio; content will be clipped if it overflows */
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.project-card:hover,
.project-card:focus {
  border-color: var(--accent-color);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  outline: none;
}

.project-card h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-color);
}

.project-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Spacing between meta rows */
.project-meta p {
  margin: 0 0 0.45rem 0;
}

/* Truncate description to 3 lines and append ellipsis */
.project-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
  }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 768px) {
  .projects-section {
    margin: 1.5rem auto;
  }

  .projects-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.25rem;
  }

  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }

  .project-card {
    padding: 1.25rem;
    /* Remove fixed square aspect on mobile for better content fit */
    aspect-ratio: auto;
    min-height: 180px;
  }

  .project-card h3 {
    font-size: 1.1rem;
  }

  .project-card p {
    font-size: 0.875rem;
  }

  .project-card-footer {
    font-size: 0.8rem;
  }
}

/* ===== Responsive: Small phone ===== */
@media (max-width: 480px) {
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .project-card {
    padding: 1rem;
    min-height: auto;
  }

  .project-card h3 {
    font-size: 1rem;
  }

  .project-card p {
    font-size: 0.85rem;
  }

  .project-desc {
    -webkit-line-clamp: 2;
  }
}