.gallery {
  display: flex;
  gap: 16px; /* better spacing */
  flex-wrap: wrap;
  justify-content: center;
}

.photo {
  flex: 1 1 240px;
  max-width: 260px;
  border: 1px solid #ccc;
  padding: 8px;
  background: #f9f9f9;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease;
}

.photo:hover {
  transform: scale(1.02);
}

.photo img {
  width: 100%;
  height: 180px;         /* fixed height for uniform grid */
  object-fit: cover;     /* crop images to fit cleanly */
  border-radius: 4px;
}

.photo figcaption {
  display: -webkit-box;
  -webkit-line-clamp: 3;        /* Number of lines to show */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
  line-height: 1.4;
  max-height: calc(1.4em * 3);  /* Line height × number of lines */
}

.modal-backdrop {
  display: flex;
  justify-content: center;
  align-items: flex-start;  /* 👈 Align to top instead of center */
  padding-top: 60px;        /* 👈 Space from top */
  padding-bottom: 40px;     /* Optional: still keeps breathing room */
}

.modal-content {
  background: #fff;
  padding: 48px 16px 16px;  /* extra top padding for the button */
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 8px;
  box-shadow: 0 0 10px #000;
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#closeModalBtn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  font-size: 1rem;
  color: red;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  z-index: 2;
  transition: color 0.2s ease;
}

.modalStyle {
  margin-top: 40px; /* ensures spacing from the close button */
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 4px;
}


#closeModalBtn:hover {
  color: #c00;
}

#photoModal {
  display: flex;
  justify-content: center;
  align-items: flex-start;  /* Align to top */
  padding-top: 60px;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 9999;
}

.folder-gallery {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.folder-card {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: #f9f9f9;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.folder-card:hover {
  background-color: #eef5f1;
}

.folder-thumb {
  display: flex;
  align-items: center;
  gap: 16px;
}

.folder-thumb img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid #ccc;
}

.folder-label {
  font-size: 1.5rem;
  font-weight: 600;
  color: #345c45;
}