/*
 * Totemia GIS — photos of a place (gis-poi-photos.js): the panel section, the
 * in-panel gallery, and the full-screen viewer. Flat surfaces on the GIS
 * tokens; the viewer is a solid dark ground, not a translucent one.
 */

.gis-photo-section .gis-place-strip {
  margin-bottom: 14px;
}

/* ── Add photo ───────────────────────────────────────────────────────────── */

.gis-photo-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--gis-line);
  border-radius: 8px;
  background: var(--gis-paper);
  color: var(--gis-green);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .gis-photo-add:hover {
    border-color: var(--gis-green);
    background: var(--gis-ivory);
  }
}

.gis-photo-add:active {
  transform: scale(0.97);
}

.gis-photo-add:disabled {
  cursor: progress;
  opacity: 0.6;
}

.gis-photo-add:focus-visible {
  outline: 0;
  border-color: var(--gis-gold);
  box-shadow: 0 0 0 3px rgba(196, 152, 31, 0.28);
}

/* A determinate bar for one finite upload — the only kind of bar allowed. */
.gis-photo-progress {
  height: 4px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--gis-place-band, #e6e9ec);
}

.gis-photo-progress span {
  display: block;
  height: 100%;
  background: var(--gis-green);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform var(--duration) var(--ease-out);
}

.gis-photo-status {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--gis-muted);
}

.gis-photo-status:empty {
  display: none;
}

/* ── Byline: who posted it, and when ─────────────────────────────────────── */

.gis-photo-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
}

.gis-photo-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--gis-ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

a.gis-photo-person:hover {
  text-decoration: underline;
}

.gis-photo-person img,
.gis-photo-initial {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.gis-photo-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gis-place-band, #e6e9ec);
  color: var(--gis-muted);
  font-size: 12px;
  font-weight: 800;
}

.gis-photo-date {
  font-size: 13px;
  color: var(--gis-muted);
}

.gis-photo-byline.is-dark .gis-photo-person {
  color: #ffffff;
}

.gis-photo-byline.is-dark .gis-photo-date {
  color: rgba(255, 255, 255, 0.72);
}

.gis-photo-remove {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 2px solid var(--gis-red);
  border-radius: 8px;
  background: var(--gis-paper);
  color: var(--gis-red);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.gis-photo-remove[hidden] {
  display: none;
}

/* ── Gallery, inside the panel ───────────────────────────────────────────── */

.gis-photo-gallery {
  position: absolute;
  inset: var(--gis-place-head-room, 76px) 0 0 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  background: var(--gis-paper);
}

.gis-photo-gallery-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 10px 8px;
  border-bottom: 1px solid var(--gis-line);
}

.gis-photo-gallery-back {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gis-ink);
  cursor: pointer;
}

.gis-photo-gallery-back:hover {
  background: var(--gis-ivory);
}

.gis-photo-gallery-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.gis-photo-gallery-sub {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--gis-muted);
}

.gis-photo-gallery-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px 16px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.gis-photo-item + .gis-photo-item {
  margin-top: 22px;
}

.gis-photo-item-image {
  display: block;
  width: 100%;
  max-height: 520px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: var(--gis-ivory);
  cursor: zoom-in;
}

.gis-photo-item-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gis-photo-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

/* ── Viewer, over the whole map ──────────────────────────────────────────── */

.gis-photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #0b0d0f;
  color: #ffffff;
  font-family: var(--gis-font);
}

.gis-photo-viewer-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px 20px;
}

.gis-photo-viewer-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gis-photo-viewer-count {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.gis-photo-viewer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
}

.gis-photo-viewer-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Native scroll-snap: a swipe or trackpad flick carries its own momentum. */
.gis-photo-viewer-track {
  display: flex;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.gis-photo-viewer-track::-webkit-scrollbar {
  display: none;
}

.gis-photo-viewer-slide {
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 12px;
  box-sizing: border-box;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.gis-photo-viewer-slide img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gis-photo-viewer-arrow {
  position: absolute;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.gis-photo-viewer-arrow.is-prev { left: 16px; }
.gis-photo-viewer-arrow.is-next { right: 16px; }

.gis-photo-viewer-arrow:hover {
  background: rgba(255, 255, 255, 0.24);
}

.gis-photo-viewer-arrow:active {
  transform: scale(0.94);
}

.gis-photo-viewer-arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

.gis-photo-viewer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px max(14px, env(safe-area-inset-bottom));
}

.gis-photo-viewer-foot .gis-photo-remove {
  background: transparent;
  border-color: #ff8a7d;
  color: #ff8a7d;
}

@media (hover: none), (pointer: coarse) {
  /* Touch swipes; arrows would only cover the photo. */
  .gis-photo-viewer-arrow {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gis-photo-add,
  .gis-photo-progress span,
  .gis-photo-viewer-arrow {
    transition: none;
  }

  .gis-photo-add:active,
  .gis-photo-viewer-arrow:active {
    transform: none;
  }
}

.gis-photo-person small { font-size: 11px; }
.gis-photo-viewer-foot { max-height: 42dvh; overflow-y: auto; }
@media (max-width: 932px) {
  .gis-photo-viewer-foot { flex-wrap: wrap; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
}
