.loadAllButton {
  display: flex; /* block-level flex so margin: auto can center it */
  align-items: center;
  justify-content: center;
  margin: 0 auto; /* center the button horizontally */
  font-size: 18px;
  padding: 10px 16px;
  min-height: 44px;
}

.years {
  display: flex;
  flex-direction: column;
  gap: 25px;
  padding: 15px;
}

.yearSection {
  border: 5px solid #219EBC;
  padding: 0 15px 15px;
  border-radius: 10px;
  background-color: rgba(1, 27, 40, 0.8);
}

.albumDiv {
  margin-bottom: 30px;
}

.photosDiv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  justify-items: center;
  align-items: center; /* ensures items in a row align vertically center relative to tallest */
  grid-auto-rows: auto;
}

.photosDiv img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5px;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  align-self: center; /* center shorter images vertically within the grid row */
}
.photosDiv img:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Ensure the loaded-count text spans the full grid row */
.photosDiv > p {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  text-align: left; /* keep this left-aligned */
}

/*
center the buttons container but keep its internal buttons left-aligned.
Setting width to max-content allows the container to size to its longest
button row, then margin auto centers that block on the page.
*/
.buttonsDiv {
  display: flex;
  justify-content: center; /* center the button block */
  gap: 15px;
  margin: 10px auto 0;
  flex-wrap: wrap; /* allow buttons to wrap instead of overflowing */
  max-width: 100%;
  padding: 0 8px; /* small side padding so wrapped buttons don't touch screen edges */
}

/* Make individual buttons not shrink and keep readable */
.buttonsDiv .commonButton {
  /* use inline-flex so text is vertically centered regardless of font metrics */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex: 0 0 auto;
  font-size: 18px; /* slightly larger for readability */
  padding: 10px 14px; /* increase tap target */
  min-height: 42px; /* keep consistent vertical size */
  box-sizing: border-box;
}

/* Responsive improvements: increase number of columns on narrower screens
   without squishing images. Lower the min column width at smaller
   breakpoints so more columns can fit on mobile. */
@media (max-width: 800px) {
  .photosDiv {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }
  .buttonsDiv {
    gap: 12px;
  }
}

@media (max-width: 480px) {
  /* Fit more small tiles on very small phones */
  .photosDiv {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
  }

  /* Make load buttons and top button a bit more compact */
  .loadAllButton,
  .commonButton {
    font-size: 15px;
    padding: 9px 12px;
    min-height: 40px;
  }

  /* Reduce margins so content uses available space */
  .years {
    padding: 8px;
    gap: 12px;
  }

  .buttonsDiv {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0; /* allow full-width centering */
  }

  .buttonsDiv .commonButton {
    width: auto; /* keep intrinsic size */
    font-size: 14px;
    padding: 8px 12px;
  }

  /* Hide the 'Load More' button on mobile so only 'Load Remaining' remains */
  .loadMoreButton {
    display: none !important;
  }
}
