/* Reset all margins, paddings and set box-sizing */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body styling */
body {
  font-family: Arial, sans-serif;
  background: #000;
  color: #fff;
}

/* Fullscreen container for the main image */
#imageShowcase {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; /* fill the viewport vertically */
  overflow: hidden;
}

/* Main displayed image */
#displayImage {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* show the whole image without distortion */
  background: #000;
}

/* Container for thumbnails pinned to the bottom */
#thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  padding: 10px 12px;
  z-index: 5;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.6) 30%,
    rgba(0, 0, 0, 0.85) 100%
  );
}

/* Individual thumbnail styling */
.thumbnail {
  width: 150px;
  height: 100px;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  object-fit: cover; /* crop aesthetically to thumbnail */
  transition: transform 0.15s, border-color 0.15s;
}

.thumbnail:hover {
  transform: translateY(-2px);
}

/* Highlight currently selected thumbnail */
.selectedThumbnail {
  border-color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4) inset;
}

/* Side arrows — vertically centred at the edges */
.arrows {
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
  pointer-events: none; /* allow clicks to pass through except on buttons */
}

/* Arrow buttons */
.arrow {
  pointer-events: auto;
  width: 20px; /* three times smaller than before */
  height: 20px; /* three times smaller than before */
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 9px; /* three times smaller */
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.arrow:hover {
  background: rgba(0, 0, 0, 0.85);
  transform: scale(1.03);
}

/* Mobile: hide thumbnails to give space */
@media (max-width: 480px) {
  #thumbnails {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto; /* enable horizontal scrolling */
    gap: 8px; /* spacing between thumbnails */
    padding: 5px;
    background: rgba(0, 0, 0, 0.5); /* semi-transparent background */
  }
  .arrow {
    width: 18px;
    height: 18px;
    font-size: 8px;
  }
}

/* Container for thumbnails + toggle button */
#thumbnailsContainer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Wrapper for toggle button */
#toggleWrapper {
  width: 100%;
  display: flex;
  justify-content: center; /* center the button above thumbnails */
  margin-bottom: 5px;
  z-index: 6; /* ensure it's above thumbnails */
}

/* Toggle button styling */
#toggleThumbnails {
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  padding: 5px 10px;
  font-size: 16px;
}

/* Hide thumbnails when minimized */
#thumbnailsContainer.minimized #thumbnails {
  display: none; /* hides miniatures */
}

/* ----------------- Mobile devices improvement ----------------- */
/* For screens up to 480px wide, instead of hiding thumbnails completely,
   we allow horizontal scrolling so users can still see thumbnails in portrait mode */
@media (max-width: 480px) {
  #thumbnails {
    display: flex; /* show thumbnails */
    flex-direction: row; /* align horizontally */
    overflow-x: auto; /* enable horizontal scrolling */
    flex-wrap: nowrap; /* prevent wrapping to next line */
    gap: 8px; /* spacing between thumbnails */
    padding: 5px;
    background: rgba(0, 0, 0, 0.5); /* semi-transparent background */
    max-width: 100%;
  }

  .thumbnail {
    width: 70px; /* smaller thumbnails for mobile */
    height: 50px;
    border-radius: 8px;
  }

  .arrow {
    width: 18px; /* keep arrow buttons small */
    height: 18px;
    font-size: 8px;
  }
}
