/* Blog image gallery
   Full-width main image with prev/next arrows, thumbnail row below
   sized so 4.5 thumbs fit across the column width. */

.gallery {
  margin: 2rem 0;
}

.gallery-main {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--card-border, var(--border));
  background: var(--bg-subtle, rgba(0, 0, 0, 0.05));
}

.gallery-main-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 14, 26, 0.55);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

[data-theme="light"] .gallery-nav {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-body);
}

.gallery-nav:hover {
  background: var(--accent);
  color: #0a0e1a;
  border-color: var(--accent);
}

.gallery-prev { left: 0.75rem; }
.gallery-next { right: 0.75rem; }

.gallery-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.gallery-thumbs::-webkit-scrollbar {
  height: 6px;
}

.gallery-thumbs::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.gallery-thumb {
  flex: 0 0 calc((100% - 4 * 0.5rem) / 4.5);
  aspect-ratio: 16 / 10;
  padding: 0;
  margin: 0;
  border: 1px solid var(--card-border, var(--border));
  border-radius: 0.375rem;
  background: none;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s, opacity 0.15s;
  opacity: 0.7;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb:hover {
  opacity: 1;
}

.gallery-thumb.is-active {
  border-color: var(--accent);
  opacity: 1;
}

@media (max-width: 560px) {
  .gallery-thumb {
    flex: 0 0 calc((100% - 3 * 0.5rem) / 3.5);
  }
  .gallery-nav {
    width: 2rem;
    height: 2rem;
  }
}
