/* =========================================================
   Static Noir Mint Dark — Post Images Viewer (NO JS)
   One-line horizontal thumbnail scroll + single large image
   ========================================================= */

.image-viewer-wrapper {
  width: min(100%, var(--content-max));
  margin: 8px auto 18px;
  padding-inline: var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--text);
}

/* Local cards/buttons/messages (scoped) */
.image-viewer-wrapper .card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  backdrop-filter: saturate(1.1) blur(2px);
  padding: 12px;
}

.image-viewer-wrapper .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-primary);
  color: var(--text);
  border: none;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow .25s ease, transform .12s ease;
}

.image-viewer-wrapper .btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--glow);
}

.image-viewer-wrapper .btn:focus-visible {
  outline: 2px solid rgba(56,189,148,.55);
  outline-offset: 2px;
}

.image-viewer-wrapper .btn.tiny {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: .95rem;
}

.image-viewer-wrapper .message {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
}

/* Header */
.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.viewer-title {
  margin: 0;
  font-size: 1.25rem;
}

/* ── One-line horizontal thumbnail rail (overflow hidden on Y) ── */
.thumb-rail {
  overflow: hidden; /* contain any vertical overflow */
}

.thumb-rail .thumb-row {
  display: flex;
  flex-wrap: nowrap;          /* stay on ONE line */
  gap: 8px;
  overflow-x: auto;           /* horizontal scroll */
  overflow-y: hidden;         /* hide vertical overflow */
  padding-bottom: 4px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity; /* optional: nicer scroll */
}

.thumb-rail .thumb {
  flex: 0 0 auto;              /* fixed-size tiles */
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  scroll-snap-align: start;
}

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

/* ── Stage (large image area) — one visible at a time via :target ── */
.stage {
  position: relative;
}

.stage .full {
  display: none;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.18);
  min-height: clamp(280px, 58vh, 520px);
}

.stage .full img {
  display: block;
  width: 100%;
  height: clamp(280px, 58vh, 520px);
  max-height: none;
  object-fit: contain;
  object-position: center;
  background: rgba(0,0,0,.12);
}

.stage .full .caption {
  padding: 8px 10px;
  font-size: .95rem;
  color: var(--muted);
  background: rgba(255,255,255,.04);
  border-top: 1px solid var(--border);
}

/* Show selected figure */
.stage .full:target {
  display: block;
}

/* Default when no #target present */
.stage .full.default {
  display: block;
}

/* Hide the default when a target exists (prevents duplicates) */
.stage .full:target ~ .full.default {
  display: none;
}

/* Responsive */
@media (max-width: 640px) {
  .thumb-rail .thumb {
    width: 72px;
    height: 72px;
  }

  .stage .full img {
    height: clamp(220px, 48vh, 360px);
    max-height: none;
  }

  .stage .full {
    min-height: clamp(220px, 48vh, 360px);
  }
}

/* === Added: anchor id prefix coverage (img-*) === */
/* Images are rendered with ids like img-123 so hash-links have consistent scroll offset */
figure[id^="img-"] {
  scroll-margin-top: 96px;
}
