:root {
  --box-size: min(70vw, 70vh);
  --lightbox-size: min(90vw, 90vh);
}
body {
  margin: 0;
  background: #0f1115;
  color: #e6e6e6;
  font-family: system-ui, sans-serif;
  display: grid;
  place-items: center;
  height: 100vh;
}
.wrap {
  display: grid;
  gap: 10px;
  justify-items: center;
}
.gallery {
  width: var(--box-size);
  height: var(--box-size);
  background: #1a1e26;
  border-radius: 20px;
  display: flex;            /* change from grid */
  justify-content: center;  /* center horizontally */
  align-items: center;      /* center vertically */
  overflow: hidden;
  cursor: pointer;
}

.gallery img {
  max-width: 100%;
  max-height: 100%;
  width: auto;       /* ensure natural scaling */
  height: auto;      /* ensure natural scaling */
  object-fit: contain; /* keeps aspect ratio, no cropping */
  display: block;
}


.controls {
  display: flex;
  gap: 20px;
  justify-content: center;
}
button {
  background: #232938;
  color: #e6e6e6;
  border: 1px solid #2e3547;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.caption {
  margin-top: 8px;
  font-size: 14px;
  max-width: 70vw;
  text-align: center;
}
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: none;
  justify-content: center; /* flex centering */
  align-items: center;     /* flex centering */
}

.lightbox img {
  max-width: var(--lightbox-size);
  max-height: var(--lightbox-size);
  width: auto;
  height: auto;
  object-fit: contain;
}
