/* responsive layout for project pages*/

@media (max-width: 768px) {
  .grid-item {
    position: relative !important; /* Allow it to flow with the page */
    top: auto !important;          /* Reset top */
    right: auto !important;        /* Reset right */
    width: 100% !important;        /* Full width */
    height: auto !important;       /* Auto height */
    margin-top: 1rem;
  }

  .grid-item img,
  .grid-item img.top-aligned {
    width: 100% !important;
    height: auto !important;
    object-fit: cover !important;
    object-position: top !important;
  }

    .grid-item .overlay {
    opacity: 1 !important; /* Always show overlay on mobile */
  }
  
  /* Remove hover effect on mobile since overlay is always visible */
  .grid-item:hover .overlay {
    opacity: 1; /* Keep it visible on tap/hover too */
  }

  .project-page .overlay {
    padding: 1rem !important; /* Normal padding for mobile */
    padding-left: 1rem !important; /* Override any inherited padding */
    padding-right: 1rem !important; /* Override any inherited padding */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .project-page .overlay h2 {
    font-size: 1.1rem;
    line-height: 1.3;
    width: 100%;
    margin-bottom: 0.5rem; /* Add some space between title and description */
    white-space: normal; /* Allow normal text wrapping */
  }

  .project-page .overlay p {
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    width: 100%;
    white-space: normal; /* Allow normal text wrapping */
    max-width: none; /* Remove any width constraints */
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

/* Desktop padding for project pages - moved outside mobile media query */
@media (min-width: 769px) {
  .project-page .overlay {
    padding-left: 200px !important;
    padding-right: 200px !important;
  }
}

/* Maintain desktop styles above 768px */

/* Card styles */
.grid-item {
  position: absolute;
  top: 0; /* Position at top of page */
  right: 0; /* Position at right edge */
  width: 75vw; /* 75% of viewport width */
  height: 75vh; /* 75% of viewport height */
  aspect-ratio: unset;
  overflow: hidden;
  border-radius: 0.1rem;
  background: var(--bg-card);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.grid-item img.top-aligned {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top !important; 
    transition: transform 0.35s ease !important;
}

.project-page .grid-item img.top-aligned {
    object-position: top;
}

.grid-item:hover img {
  transform: scale(1.05);
}

/* Overlay */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.grid-item:hover .overlay {
  opacity: 1;
}

.overlay h2 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.overlay p {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Drawer styles */
.drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 100%;
  max-width: 500px;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  z-index: 1000;
  overflow-y: auto;
}

.drawer.open {
  right: 0;
}

.drawer-content {
  padding: 2rem;
  height: 100%;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e5e5;
}

.drawer-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: background-color 0.2s;
  color: #666;
}

.close-btn:hover {
  background-color: #f0f0f0;
}

.drawer-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.drawer-description {
  line-height: 1.6;
  color: #555;
  margin-bottom: 2rem;
}

.project-details {
  margin-bottom: 2rem;
}

.detail-item {
  margin-bottom: 1rem;
}

.detail-label {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.25rem;
}

.detail-value {
  color: #666;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.tag {
  background: #f0f8ff;
  color: #0066cc;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  margin-top: auto;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: all 0.2s;
}

.btn-primary {
  background: #0066cc;
  color: white;
}

.btn-primary:hover {
  background: #0052a3;
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background: #ececec;
}

/* Backdrop */
.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 999;
}

.drawer-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* Responsive */
@media (max-width: 768px) {
  .drawer {
    width: 100%;
    max-width: none;
  }

  .drawer-content {
    padding: 1.5rem;
  }
}