.gallery-overlay {
  position: fixed;
  inset: 0;
  background: rgba(231, 230, 226, 0.97);
  
  z-index: 100;
  display: none;
  flex-direction: column;
  pointer-events: auto;
}
.gallery-overlay.open { display: flex; }
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  color: var(--ink);
  font-size: 0.95rem;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.gallery-close {
  background: transparent;
  border: 1px solid var(--control-line);
  color: var(--ink);
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}
.gallery-close:hover { background: var(--line-soft); }
.gallery-grid {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
  align-content: start;
}
.gallery-grid img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  background: var(--line-soft);
  display: block;
}
.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(24, 25, 26, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
  cursor: zoom-out;
}
.gallery-lightbox.open { display: flex; }
.gallery-lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
}
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.4rem;
    padding: 0.5rem;
  }
  .gallery-grid img { height: 120px; }
}
