html.lg-lock-scroll {
  scroll-behavior: auto !important;
}

.gallery-hub {
  padding: clamp(2rem, 5vw, 3rem) 0;
}

.gallery-hub[hidden] {
  display: none !important;
}

.gallery-hub.is-visible {
  display: block;
}

.gallery-hub.is-loading .gal-feed {
  min-height: 120px;
}

.gal-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 1.25rem;
  padding: 4px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(244, 114, 182, 0.2);
  border-radius: 999px;
  max-width: 420px;
}

.gal-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink-600);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.gal-tab.is-active {
  background: linear-gradient(135deg, var(--brand-600), #a78bfa);
  color: #fff;
  box-shadow: 0 4px 14px rgba(244, 114, 182, 0.35);
}

.gal-feed {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: min(100%, 520px);
  margin: 0 auto;
}

.gal-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(244, 114, 182, 0.14);
  border-radius: 18px;
  padding: 12px 12px 14px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
}

.gal-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.gal-card-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-800);
}

.gal-card-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-500);
  font-variant-numeric: tabular-nums;
}

.gal-slider-wrap {
  position: relative;
}

.gal-slider {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: none;
  border-radius: 12px;
  padding: 0 2px;
}

.gal-slider::-webkit-scrollbar {
  display: none;
}

.gal-slide {
  flex: 0 0 88%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  border: none;
  padding: 0;
  margin: 0;
  background: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  cursor: grab;
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: min(78vw, 380px);
  touch-action: pan-x;
  user-select: none;
}

.gal-slide:active {
  cursor: grabbing;
}

.gal-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gal-slide.is-loaded img {
  opacity: 1;
}

.gal-slide-skel {
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #f1f5f9 8%, #e2e8f0 18%, #f1f5f9 33%);
  background-size: 200% 100%;
  animation: gal-skel 1.1s linear infinite;
}

@keyframes gal-skel {
  to { background-position: -200% 0; }
}

.gal-slide.is-loaded .gal-slide-skel {
  display: none;
}

.gal-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 8px;
  border-radius: 999px;
  pointer-events: none;
}

.gal-dl {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.75rem;
  z-index: 2;
}

.gal-controls {
  margin-top: 10px;
}

.gal-progress {
  height: 4px;
  background: rgba(244, 114, 182, 0.18);
  border-radius: 999px;
  overflow: hidden;
}

.gal-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand-600), #a78bfa);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.gal-scrubber {
  width: 100%;
  height: 6px;
  margin: 10px 0 0;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(90deg, rgba(244, 114, 182, 0.2), rgba(167, 139, 250, 0.2));
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.gal-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), #a78bfa);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.gal-scrubber::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), #a78bfa);
  border: 2px solid #fff;
}

.gal-empty {
  text-align: center;
  color: var(--ink-500);
  font-size: 0.9rem;
  padding: 2rem 1rem;
}

.gal-anchor {
  display: none;
}

/* Fullscreen gallery viewer */
.gal-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gal-viewer[hidden] {
  display: none !important;
}

.gal-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.gal-viewer-panel {
  position: relative;
  z-index: 1;
  width: min(100vw, 900px);
  height: min(100dvh, 900px);
  display: flex;
  flex-direction: column;
  padding: 48px 12px 20px;
}

.gal-viewer-media {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  gap: 12px;
}

.gal-viewer-media img,
.gal-viewer-media video {
  max-width: 100%;
  max-height: calc(100dvh - 160px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.gal-viewer-download {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.gal-viewer-footer {
  text-align: center;
  color: #fff;
  padding-top: 12px;
}

.gal-viewer-caption {
  font-size: 0.95rem;
  font-weight: 600;
}

.gal-viewer-count {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-top: 4px;
}

.gal-viewer-close,
.gal-viewer-prev,
.gal-viewer-next {
  position: absolute;
  z-index: 2;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gal-viewer-close {
  top: 8px;
  right: 8px;
  font-size: 1.8rem;
}

.gal-viewer-prev {
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
}

.gal-viewer-next {
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}

@media (min-width: 768px) {
  .gal-feed {
    max-width: 560px;
  }

  .gal-slide {
    flex-basis: 72%;
    max-height: 420px;
  }
}
