/* -----------------------------------------------------------
   Global Resets & Basics
   ----------------------------------------------------------- */
html {
  box-sizing: border-box;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: inherit;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  background: #333;
  color: #fff;
  font-size: 18px;
  /* Updated Font as requested */
  font-family: 'IBM Plex Sans', "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Advent Pro', "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* -----------------------------------------------------------
   Image Gallery Styling
   ----------------------------------------------------------- */
.container {
  max-width: 900px;
  margin: 80px auto 0;
  text-align: center;
  /* Added padding to prevent content hitting edges on mobile */
  padding: 0 10px;
}

.container__img-holder {
  max-width: 280px;
  display: inline-block;
  vertical-align: top;
  margin-bottom: 20px;
  margin-left: 16px;
  cursor: pointer;
  transition: transform 0.2s ease; /* Slight interaction effect */
}

/* Hover effect for better UX */
.container__img-holder:hover {
  transform: translateY(-5px);
}

.container .container__img-holder:nth-child(3n+1) {
  margin-left: 0;
}

.container__img-holder img {
  width: 100%;
  height: 220px;
  object-fit: cover; /* Ensures images don't stretch weirdly */
  display: block;
  border-radius: 4px; /* Slight polish */
}

.container__img-holder b {
  display: block;
  margin-top: 5px;
  font-weight: 600;
}

/* -----------------------------------------------------------
   Popup / Overlay Styling
   ----------------------------------------------------------- */
.img-popup {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.85); /* Darker background for better focus */
  display: flex;
  justify-content: center;
  align-items: center;
  display: none; /* Hidden by default */
  z-index: 9999; /* Ensures it sits on top of everything */
  cursor: pointer; /* Indicates clicking outside closes it */
}

.img-popup img {
  max-width: 90%;
  max-height: 90vh; /* Prevents image from being taller than screen */
  width: auto;      /* Maintain aspect ratio */
  opacity: 0;
  transform: translateY(-100px);
  cursor: default;  /* Standard cursor over image */
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  border: 2px solid #fff;
}

/* -----------------------------------------------------------
   Close Button
   ----------------------------------------------------------- */
.close-btn {
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  position: absolute;
  top: 20px;
  right: 20px;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  transition: background 0.3s;
  z-index: 10000;
}

.close-btn:hover {
  background: rgba(255,255,255,0.3);
}

.close-btn .bar {
  width: 25px;
  height: 3px;
  background: #fff; /* White bars for better contrast on dark overlay */
  position: absolute;
  border-radius: 2px;
}

.close-btn .bar:nth-child(1) {
  transform: rotate(45deg);
}

.close-btn .bar:nth-child(2) {
  transform: rotate(-45deg);
}

/* -----------------------------------------------------------
   Active States & Animations
   ----------------------------------------------------------- */
.opened {
  display: flex;
  animation: fadeIn 0.3s forwards;
}

.opened img {
  animation: slideIn 0.4s ease-out forwards;
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -----------------------------------------------------------
   Responsive
   ----------------------------------------------------------- */
@media screen and (max-width: 880px) {
  .container .container__img-holder:nth-child(3n+1) {
    margin-left: 16px;
  }
  
  .container__img-holder {
    margin-left: 0;
    margin-right: 0;
    display: block;
    max-width: 100%;
    margin-bottom: 30px;
  }
  
  .container__img-holder img {
    height: auto;
  }
}