:root {
  --gap: 1.2rem;
  --max-width: 1400px;
  --bg: #fafafa;
  --fg: #111;
  font-family: system-ui, sans-serif;
}

body {
  margin: 10;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  width: 100%;
  max-width: var(--max-width);
  padding: 2rem 1rem 1rem;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 600;
}

.gallery {
  width: 100%;
  max-width: var(--max-width);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--gap);
  padding: 1rem;
}

.gallery-item {
  display: block;
}

.gallery img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  border-radius: 4px;
  background: #ddd;
  transition: transform .2s ease;
}

.gallery img:hover {
  transform: scale(1.02);
}

/* LIGHTBOX BASE */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.lightbox:target {
  display: flex;
}

/* DARK OVERLAY — THIS CLOSES THE MODAL */
.lightbox .overlay {
  position: absolute;
  inset: 0;
  display: block;
  content: "";
  z-index: 1;
}

/* IMAGE + CLOSE BUTTON CONTAINER */
.lightbox .content {
  position: relative;
  z-index: 2; /* above overlay */
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  display: block;
  border-radius: 6px;
  pointer-events: none; /* prevents image from blocking clicks outside it */
}

/* VISIBLE CLOSE BUTTON */
.lightbox .close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 32px;
  height: 32px;
  background: #fff;
  color: #000;
  border-radius: 50%;
  font-size: 24px;
  line-height: 32px;
  text-align: center;
  text-decoration: none;
  font-weight: bold;
  z-index: 3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.lightbox .close:hover {
  background: #ddd;
}

