/* Photos on posts: the slideshow (components/slideshow.js) and the picker in composers (components/photo-picker.js). */

/* ---------- Slideshow ---------- */

.slideshow {
  position: relative;
  background: var(--surface-sunken);
}

.slideshow__track {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.slideshow__track::-webkit-scrollbar {
  display: none;
}

.slideshow__track:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

.slideshow__slide {
  flex: 0 0 100%;
  display: grid;
  place-items: center;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.slideshow__slide a {
  display: block;
  width: 100%;
}

.slideshow__slide img {
  display: block;
  width: 100%;
  max-height: 640px;
  object-fit: contain;
  user-select: none;
}

.slideshow__arrow {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  transform: translateY(-50%);
  transition: opacity 0.15s;
}

.slideshow__arrow--previous {
  left: 10px;
}

.slideshow__arrow--next {
  right: 10px;
}

.slideshow__arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

.slideshow__count {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.slideshow__dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  display: flex;
  gap: 2px;
  transform: translateX(-50%);
}

/* A big enough tap target around a small dot. */
.slideshow__dot {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
}

.slideshow__dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.55);
  box-shadow: 0 0 2px rgb(0 0 0 / 0.5);
}

.slideshow__dot[aria-current="true"]::before {
  background: #fff;
}

/* Phones swipe; the arrows just get in the way of the photo there. */
@media (hover: none) and (pointer: coarse) {
  .slideshow__arrow {
    display: none;
  }
}

/* ---------- Picker ---------- */

.photo-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.photo-picker__item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  cursor: grab;
}

.photo-picker__item.is-dragging {
  opacity: 0.4;
}

.photo-picker__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.photo-picker__number {
  position: absolute;
  top: 6px;
  left: 6px;
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: rgb(0 0 0 / 0.6);
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
}

.photo-picker__remove,
.photo-picker__move button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.6);
  color: #fff;
}

.photo-picker__remove {
  position: absolute;
  top: 6px;
  right: 6px;
}

.photo-picker__move {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
}

.photo-picker__move button:disabled {
  visibility: hidden;
}

/* ---------- Where slideshows sit ---------- */

/* Edge to edge in a post card, like the single photo was. */
.post .slideshow {
  border-block: 1px solid var(--line);
}

/* Inside notes, threads, replies and work updates: a rounded box in the text column. */
.note__content .slideshow,
.thread .slideshow,
.reply .slideshow {
  margin-top: 10px;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

/* The Photos grid marks posts with more than one photo. */
.photo-tile__many {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #fff;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.6));
}
