/* Rectangle grid for premium look */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 300px); /* Increased height for premium look */
  gap: 3rem 4rem;
  padding: 3rem 2vw;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 700px;
}

/* Premium card style with full image coverage */
.project-card {
  position: relative;
  background: #23272a;
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(41, 118, 255, 0.15);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  height: 100%;
  display: block;
}

.project-card:hover,
.project-card:focus {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 60px rgba(41, 118, 255, 0.25);
}

/* Full image coverage */
.project-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: filter 0.4s ease, transform 0.4s ease;
  border-radius: 1.5rem;
}

/* Default overlay for title */
.project-card .project-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(0deg, rgba(35, 39, 42, 0.95) 0%, rgba(35, 39, 42, 0.7) 50%, transparent 100%);
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  color: #fff;
  z-index: 3;
  border-bottom-left-radius: 1.5rem;
  border-bottom-right-radius: 1.5rem;
  transition: opacity 0.4s ease;
}

.project-card .project-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #00f7ff;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Hover overlay with details */
.project-card .project-hover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  background: linear-gradient(135deg, rgba(35, 39, 42, 0.95) 0%, rgba(24, 26, 27, 0.98) 100%);
  color: #ffffff;
  padding: 2rem 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
  border-radius: 1.5rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.project-card .project-hover .project-title {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: #00f7ff;
}

.project-card .project-hover .project-description {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: #e2e8f0;
  opacity: 0.9;
}

.project-card .project-hover .project-tech {
  font-size: 0.95rem;
  color: #3b82f6;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-top: 1px solid rgba(59, 130, 246, 0.3);
  padding-top: 1rem;
}

/* Hover effects */
.project-card:hover .project-hover,
.project-card:focus .project-hover {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.project-card:hover .project-info,
.project-card:focus .project-info {
  opacity: 0;
}

.project-card:hover img,
.project-card:focus img {
  filter: blur(1px) brightness(0.4);
  transform: scale(1.05);
}

/* Projects header styling */
.projects-header {
  text-align: center;
  margin: 3rem 0;
  padding: 0 2rem;
}

.projects-header h1 {
  font-size: 3rem;
  font-weight: 700;
  color: #00f7ff;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #00f7ff 0%, #2976ff 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.projects-header p {
  font-size: 1.2rem;
  color: #bdbdbd;
  max-width: 600px;
  margin: 0 auto;
}

/* Modal styles */
.project-modal {
  position: fixed;
  inset: 0;
  background: rgba(24,26,27,0.97);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 2vw;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.project-modal-content {
  background: #23272a;
  border-radius: 1.2rem;
  max-width: 80vw;
  width: 80vw;
  min-width: 0;
  padding: 2.5rem 2rem 2rem 2rem;
  box-shadow: 0 8px 40px #2976ff33;
  position: relative;
  color: #fff;
  animation: modalPop 0.3s;
}

@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.project-modal-content img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
  margin-top: 2.0rem;
  border-radius: 0.8rem;
  object-fit: cover;
  height: 50%;
  max-width: 50%;
  max-height: 260px;
}

.project-modal-content h1 {
  color: #00f7ff;
  margin-bottom: 0.7rem;
}

.project-modal-content .project-tech {
  color: #3b82f6;
  margin-bottom: 1.2rem;
}

.project-modal-content .project-desc {
  color: #ffffff;
  margin-bottom: 1.5rem;
  font-size: 1.08rem;
}

.project-modal-content .modal-links {
  display: flex;
  align-items: center;   /* Ensures vertical alignment */
  gap: 1.2rem;
  margin-bottom: 1.5rem;
}

.project-modal-content .modal-links a {
  color: #2976ff;
  font-weight: 600;
  text-decoration: underline;
  transition: color 0.2s;
}

.project-modal-content .modal-links a:hover {
  color: #00f7ff;
}

.project-modal-content .modal-links a svg,
.project-modal-content .modal-links a img {
  display: inline-block;
  vertical-align: middle;
  margin: 0.7em;
}

.project-modal-content .modal-links a[aria-label="Live Link"] {
  text-decoration: none;
  font-size: 1.1rem;
}

.project-modal-content .modal-links a[aria-label="Live Link"] svg {
  margin: 0 0 0 0.2em;
  vertical-align: middle;
}

.project-modal-content .close-modal {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s;
}

.project-modal-content .close-modal:hover {
  color: #ff4d6d;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .project-grid {
    max-width: 1200px;
    gap: 2.5rem 3rem;
  }
}

@media (max-width: 900px) {
  .project-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 2rem;
    min-height: 0;
    padding: 2rem 1rem;
  }
  .project-card {
    height: 280px;
  }
  .projects-header h1 {
    font-size: 2.5rem;
  }
}

@media (max-width: 600px) {
  .project-card {
    height: 250px;
  }
  .project-card .project-hover {
    padding: 1.5rem 1rem;
  }
  .projects-header {
    margin: 2rem 0;
  }
  .projects-header h1 {
    font-size: 2rem;
  }
}

/* Modal styles - Updated for better mobile support */
.project-modal {
  position: fixed;
  inset: 0;
  background: rgba(24,26,27,0.97);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 1rem; /* Reduced from 2vw */
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.project-modal-content {
  background: #23272a;
  border-radius: 1.2rem;
  max-width: 90vw; /* Reduced from 80vw */
  width: 100%;
  max-height: 90vh; /* Add max-height */
  overflow-y: auto; /* Add scrolling */
  min-width: 0;
  padding: 2.5rem 2rem 2rem 2rem;
  box-shadow: 0 8px 40px #2976ff33;
  position: relative;
  color: #fff;
  animation: modalPop 0.3s;
}

@keyframes modalPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.project-modal-content img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
  margin-top: 2.0rem;
  border-radius: 0.8rem;
  object-fit: cover;
  height: auto; /* Changed from 50% */
  max-width: 100%; /* Changed from 50% */
  max-height: 300px; /* Increased from 260px */
}

.project-modal-content h1 {
  color: #00f7ff;
  margin-bottom: 0.7rem;
  font-size: 1.8rem; /* Add explicit size */
  line-height: 1.2;
}

.project-modal-content .project-tech {
  color: #3b82f6;
  margin-bottom: 1.2rem;
}

.project-modal-content .project-desc {
  color: #ffffff;
  margin-bottom: 1.5rem;
  font-size: 1.08rem;
  line-height: 1.6;
}

.project-modal-content .modal-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap; /* Allow wrapping on small screens */
}

.project-modal-content .modal-links a {
  color: #2976ff;
  font-weight: 600;
  text-decoration: underline;
  transition: color 0.2s;
}

.project-modal-content .modal-links a:hover {
  color: #00f7ff;
}

.project-modal-content .modal-links a svg,
.project-modal-content .modal-links a img {
  display: inline-block;
  vertical-align: middle;
  margin: 0.7em;
}

.project-modal-content .modal-links a[aria-label="Live Link"] {
  text-decoration: none;
  font-size: 1.1rem;
}

.project-modal-content .modal-links a[aria-label="Live Link"] svg {
  margin: 0 0 0 0.2em;
  vertical-align: middle;
}

.project-modal-content .close-modal {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s;
  z-index: 10;
}

.project-modal-content .close-modal:hover {
  color: #ff4d6d;
}

/* Mobile-specific modal styles */
@media (max-width: 768px) {
  .project-modal {
    padding: 0.5rem;
    align-items: flex-start; /* Start from top on mobile */
    padding-top: 2rem;
  }
  
  .project-modal-content {
    max-width: 95vw;
    width: 95vw;
    max-height: 85vh;
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    margin: 0;
  }
  
  .project-modal-content h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }
  
  .project-modal-content img {
    max-width: 100%;
    max-height: 200px;
    margin-top: 1rem;
    margin-bottom: 1rem;
  }
  
  .project-modal-content .project-desc {
    font-size: 1rem;
  }
  
  .project-modal-content .modal-links {
    gap: 1rem;
    justify-content: center;
  }
  
  .project-modal-content .modal-links a img {
    height: 35px;
    width: 35px;
  }
  
  .project-modal-content .close-modal {
    top: 0.8rem;
    right: 0.8rem;
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  .project-modal {
    padding: 0.25rem;
    padding-top: 1rem;
  }
  
  .project-modal-content {
    max-width: 98vw;
    width: 98vw;
    max-height: 90vh;
    padding: 1.5rem 1rem;
    border-radius: 0.8rem;
  }
  
  .project-modal-content h1 {
    font-size: 1.3rem;
  }
  
  .project-modal-content .project-desc {
    font-size: 0.95rem;
    line-height: 1.5;
  }
  
  .project-modal-content img {
    max-height: 150px;
  }
  
  .project-modal-content .modal-links a[aria-label="Live Link"] {
    font-size: 1rem;
  }
  
  .project-modal-content .close-modal {
    font-size: 1.5rem;
    top: 0.5rem;
    right: 0.5rem;
  }
}

/* Custom scrollbar for modal content */
.project-modal-content::-webkit-scrollbar {
  width: 6px;
}

.project-modal-content::-webkit-scrollbar-track {
  background: #2d3748;
  border-radius: 3px;
}

.project-modal-content::-webkit-scrollbar-thumb {
  background: #2976ff;
  border-radius: 3px;
}

.project-modal-content::-webkit-scrollbar-thumb:hover {
  background: #00f7ff;
}