/* A photo opened large inside the page (ui/photo-viewer.js): the dark
   backdrop, the photo in its frame, the close button and the toolbar. */
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 2147480000;
  overscroll-behavior: contain;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.photo-viewer[data-state="closing"] {
  pointer-events: none;
}

.photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 10, 18, 0.82);
  -webkit-backdrop-filter: blur(12px) saturate(1.05);
  backdrop-filter: blur(12px) saturate(1.05);
}

/* The frame keeps the photo's open place; the photo inside it zooms and
   moves. At rest it may grow past the frame. */
.photo-viewer-frame {
  position: absolute;
  overflow: visible;
  transform-origin: 0 0;
  will-change: transform, clip-path;
  border-radius: 16px;
}

.photo-viewer-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
  background: #1a1722;
  transform-origin: 50% 50%;
  will-change: transform;
  cursor: zoom-in;
  -webkit-user-drag: none;
}

.photo-viewer.is-zoomed .photo-viewer-image {
  cursor: grab;
}

.photo-viewer .photo-viewer-image.is-grabbing {
  cursor: grabbing;
}

/* Buttons and double-clicks ease into their zoom; a pinch or drag follows
   the fingers at once. */
.photo-viewer-image.is-easing {
  transition: transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
}

.photo-viewer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}

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

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

/* The toolbar: what the photo is, which of the appointment's photos, zoom. */
.photo-viewer-bar {
  position: absolute;
  bottom: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 24px);
  padding: 6px 8px 6px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(24, 22, 32, 0.78);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  font: 600 13px/1.2 var(--font-sans, Inter, ui-sans-serif, system-ui, sans-serif);
  transform: translateX(-50%);
  white-space: nowrap;
}

.photo-viewer-caption {
  overflow: hidden;
  max-width: 220px;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.88);
}

.photo-viewer-paging,
.photo-viewer-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.photo-viewer-paging[hidden],
.photo-viewer-caption[hidden] {
  display: none;
}

.photo-viewer-count {
  min-width: 40px;
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.photo-viewer-bar button {
  display: inline-grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: transparent;
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 140ms ease, opacity 140ms ease;
}

.photo-viewer-bar button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.photo-viewer-bar button:disabled {
  opacity: 0.35;
  cursor: default;
}

.photo-viewer-level {
  min-width: 56px !important;
}

.photo-viewer :is(.photo-viewer-close, .photo-viewer-bar button):focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .photo-viewer-close {
    top: 10px;
    right: 10px;
  }

  .photo-viewer-bar {
    bottom: 12px;
    gap: 8px;
    padding-left: 12px;
  }

  .photo-viewer-caption {
    max-width: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-viewer-image.is-easing {
    transition: none;
  }
}
