/* ===== GALLERY GRID ===== */
.gallery-section-title {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.5rem 0 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1rem;
}

/* Smaller grid inside gitgraph-detail panels */
.gallery-panel-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  aspect-ratio: 4/3;
  background: var(--bg-tertiary);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s, opacity 0.2s;
  opacity: 0.85;
}

.gallery-item:hover img {
  transform: scale(1.05);
  opacity: 1;
}

.gallery-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.6rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-overlay span {
  font-size: 0.7rem;
  color: #fff;
  line-height: 1.3;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  z-index: 2000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  color: var(--text-secondary);
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 2001;
  transition: color 0.15s;
  line-height: 1;
}

.lightbox-close:hover {
  color: #fff;
}

.lightbox-content {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: var(--radius);
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
  animation: lightbox-zoom 0.3s ease;
}

@keyframes lightbox-zoom {
  from { transform: scale(0.85); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.lightbox-caption {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.8rem;
  max-width: 600px;
  line-height: 1.5;
}

.lightbox-caption small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ===== LIGHTBOX NAV ARROWS ===== */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  font-size: 1.6rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  z-index: 2001;
  line-height: 1;
  padding: 0;
}

.lightbox-nav:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.lightbox-prev {
  left: 1.2rem;
}

.lightbox-next {
  right: 1.2rem;
}

/* Photo counter */
.lightbox-counter {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

/* ===== RESPONSIVE ===== */
@media screen and (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.4rem;
  }

  .gallery-panel-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .lightbox-content {
    max-width: 95vw;
    max-height: 75vh;
  }

  .lightbox-nav {
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.2rem;
  }

  .lightbox-prev { left: 0.5rem; }
  .lightbox-next { right: 0.5rem; }
}

@media screen and (max-width: 400px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.3rem;
  }

  .gallery-panel-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}