/* Gallery viewer component — hero, thumbs, dots, lightbox (.gv-*)
   Page integration: directory.css
   Load on directory-details, directory-regions, directory-item-details */

.gv-wrap {
  width: 100%;
  --gv-radius: 14px;
  --gv-brand: var(--teal, #4f46e5);
  --gv-brand-h: var(--teal-h, #4338ca);
}

.gv-stage {
  position: relative;
  border-radius: var(--gv-radius) var(--gv-radius) 0 0;
  overflow: hidden;
  background: #eef2f6;
}

.gv-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 200px;
  max-height: 420px;
  overflow: hidden;
  background: #0f172a;
  cursor: zoom-in;
  outline: none;
}

.gv-hero--placeholder {
  border-radius: var(--gv-radius);
  cursor: default;
}

.gv-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.gv-hero-img.is-changing {
  opacity: 0.35;
}

.gv-hero:hover .gv-hero-img:not(.is-changing) {
  transform: scale(1.03);
}

.gv-hero-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.35) 0%, transparent 28%),
    linear-gradient(0deg, rgba(15, 23, 42, 0.55) 0%, transparent 42%);
}

.gv-hero-top {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  z-index: 3;
  pointer-events: none;
}

.gv-counter {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.gv-hero-controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  z-index: 2;
  pointer-events: none;
}

.gv-hero-nav {
  pointer-events: all;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  color: #fff;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s;
}

.gv-hero:hover .gv-hero-nav,
.gv-hero:focus-within .gv-hero-nav {
  opacity: 1;
  transform: translateY(0);
}

.gv-hero-nav:hover {
  background: color-mix(in srgb, var(--gv-brand) 85%, transparent);
  border-color: rgba(255, 255, 255, 0.25);
}

.gv-hero-expand {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.gv-hero-expand:hover {
  background: var(--gv-brand);
  transform: scale(1.05);
}

.gv-dots {
  display: none;
  justify-content: center;
  gap: 7px;
  padding: 12px 14px 14px;
  background: var(--card, #fff);
  border-top: 1px solid var(--border, #e5e9f0);
}

.gv-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  transition: width 0.2s ease, background 0.2s ease;
}

.gv-dot.active {
  width: 22px;
  background: var(--gv-brand);
}

.gv-thumbs-rail {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px 14px;
  background: var(--card, #fff);
  border-top: 1px solid var(--border, #e5e9f0);
  border-radius: 0 0 var(--gv-radius) var(--gv-radius);
}

.gv-thumb-scroll {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border, #e5e9f0);
  border-radius: 50%;
  background: #f8fafc;
  color: #475569;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.gv-thumb-scroll:hover {
  background: #eceafb;
  border-color: #c6cbf3;
  color: var(--gv-brand);
}

.gv-thumb-scroll[hidden] {
  display: none;
}

.gv-thumbs {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 2px 0;
}

.gv-thumbs::-webkit-scrollbar {
  display: none;
}

.gv-thumb {
  position: relative;
  flex: 0 0 88px;
  width: 88px;
  height: 66px;
  aspect-ratio: 4 / 3;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: #f1f5f9;
  opacity: 0.72;
  scroll-snap-align: center;
  transition: border-color 0.2s, opacity 0.2s, transform 0.2s, box-shadow 0.2s;
}

.gv-thumb:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.gv-thumb.active {
  border-color: var(--gv-brand);
  opacity: 1;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.22);
  transform: translateY(-2px);
}

.gv-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gv-credit {
  padding: 10px 16px 12px;
  font-size: 11px;
  line-height: 1.55;
  color: #64748b;
  background: #f8fafc;
  border-top: 1px solid var(--border, #e5e9f0);
}

.gv-credit a {
  color: var(--gv-brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.gv-thumb-cover {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: color-mix(in srgb, var(--gv-brand) 90%, transparent);
  border-radius: 4px;
  line-height: 1.2;
  max-width: calc(100% - 8px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gv-hero-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  background: linear-gradient(135deg, var(--gv-brand) 0%, var(--gv-brand-h) 100%);
}

/* Lightbox */
.gv-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.gv-lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.gv-lb-inner {
  position: relative;
  width: min(92vw, 1100px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 48px;
  box-sizing: border-box;
}

.gv-lb-img {
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  object-fit: contain;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  display: block;
}

.gv-lb-close {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 10051;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.gv-lb-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.gv-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 1;
}

.gv-lb-nav:hover {
  background: rgba(255, 255, 255, 0.3);
}

.gv-lb-prev {
  left: 0;
}

.gv-lb-next {
  right: 0;
}

.gv-lb-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  z-index: 10051;
}

.gv-lb-credit {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92vw, 720px);
  padding: 8px 14px;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  z-index: 10051;
}

.gv-lb-credit a {
  color: #c4b5fd;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .gv-hero {
    aspect-ratio: 4 / 3;
    min-height: 200px;
    max-height: none;
  }

  .gv-hero-nav {
    opacity: 1;
    transform: none;
    width: 40px;
    height: 40px;
    font-size: 22px;
  }

  .gv-dots {
    display: flex;
  }

  .gv-thumbs-rail {
    padding: 10px 10px 12px;
  }

  .gv-thumb {
    flex: 0 0 72px;
    width: 72px;
    height: 54px;
  }

  .gv-thumb-scroll {
    display: none;
  }

  .gv-lb-inner {
    padding: 0 40px;
  }
}

@media (max-width: 600px) {
  .gv-lb-inner {
    padding: 0 36px;
  }

  .gv-lb-prev {
    left: 4px;
  }

  .gv-lb-next {
    right: 4px;
  }
}
