.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--gap);
  }
  .gallery a {
    display: block; position: relative; overflow: hidden; border-radius: 5px;
    background: #111; box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
    margin: 2px;
  }
  .gallery img {
    width: 100%; height: 160px; object-fit: cover;
    transition: transform .25s ease, opacity .25s ease; opacity: .92;
    display: block;
  }
  .gallery a:hover img { transform: scale(1.04); opacity: 1; }

  /* Lightbox */
  .lightbox {
    position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
    background: rgba(0,0,0,.92); z-index: 9999; padding: 24px;
  }
  .lightbox.open { display: flex; }
  .lb-inner { position: relative; max-width: 95vw; max-height: 90vh; }
  .lb-image {
    max-width: 95vw; max-height: 80vh; border-radius: 12px; display: block;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
  }
  .lb-caption {
    text-align: center; margin-top: 10px; font-size: 14px; color: #dcdcdc;
    line-height: 1.35; max-width: 90vw;
  }

  /* Controls */
  .lb-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.12);
    color: #fff; width: 44px; height: 44px; border-radius: 50%;
    display: grid; place-items: center; cursor: pointer; user-select: none;
    font-size: 20px;
  }
  .lb-prev { left: -56px; }
  .lb-next { right: -56px; }
  .lb-close {
    position: absolute; top: -52px; right: -4px; width: 40px; height: 40px; font-size: 18px;
  }
  .lb-btn:hover { background: rgba(255,255,255,.12); }
  @media (max-width: 640px) {
    .lb-prev { left: 8px; }
    .lb-next { right: 8px; }
    .lb-close { top: -48px; right: 0; }
  }