/*
 * The site's photo slider (includes/core/photo-slider.php, js/components/swipers.js):
 * the «Галерея» block, photos pulled out of a news text, the departments' news
 * and gallery, a graduate's student-year photos and documents.
 *
 *   .slider-img-container  — the slider, 730px at most, centred
 *   .slider-img            — the photos, each whole in a frame of one shape
 *   .slider-img-thumb      — the optional strip of thumbnails
 *   .slider-img-controls   — the row under it: ‹ dots or «3 / 24» › in the
 *                            middle, the full-screen button at its right end
 */

.slider-img-container {
  width: 100%;
  margin: 0 auto !important;
}

@media (min-width: 900px) {
  .slider-img-container {
    max-width: 45.625rem;
  }
}

@media (min-width: 600px) and (max-width: 899px) {
  .slider-img-container {
    max-width: 34.375rem;
  }
}

/* A news text's own gallery stands apart from the paragraphs around it. */
.slider-img-container--post {
  margin-top: 40px !important;
  margin-bottom: 40px !important;
}

.slider-img,
.slider-img * {
  box-sizing: border-box;
}

.slider-img {
  width: 100%;
}

.slider-img__content {
  position: relative;
  width: 100%;
}

.slider-img__content__container {
  padding-top: 82.191%;
}

.slider-img__content a {
  display: block;
  cursor: zoom-in;
}

.slider-img__content img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  /* Whole, and never larger than the file: a small old photo (254px) stays
     sharp at its own size in the middle of the frame instead of being
     stretched to 730px. */
  object-fit: scale-down;
}

/* ------------------------------------------------------------ thumbnails */

.slider-img-thumb {
  margin-top: 1.5rem;
}

@media (min-width: 900px) {
  .slider-img-thumb {
    margin-top: 1.875rem;
  }
}

.slider-img-thumb.swiper .swiper-slide {
  border: 1px solid transparent;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}

.slider-img-thumb.swiper .swiper-slide.swiper-slide-thumb-active {
  border-color: var(--color-border-strong);
  opacity: 1;
}

/* ------------------------------------------------- the row under a slider */

/* One small group in the middle of the row: ‹ dots › — thin chevrons with no
   frame, close to the dots; the full-screen button at the row's right end. The
   side columns are equal, so the group stays centred under the photo. */
.slider-img-controls {
  display: grid;
  grid-template-columns: minmax(40px, 1fr) auto auto auto minmax(40px, 1fr);
  align-items: center;
  column-gap: 8px;
  width: 100%;
  margin-top: 12px;
}

.slider-img-controls[hidden] {
  display: none;
}

.slider-img-controls .slider-img-prev {
  grid-column: 2;
}

.slider-img-controls .slider-img-pagination {
  grid-column: 3;
}

.slider-img-controls .slider-img-next {
  grid-column: 4;
}

.slider-img-controls .slider-img-full {
  grid-column: 5;
  justify-self: end;
}

.slider-img-controls .slider-img-prev,
.slider-img-controls .slider-img-next,
.slider-img-controls .slider-img-full {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-accent);
  cursor: pointer;
  transition: color 0.2s ease;
  appearance: none;
}

.slider-img-controls .slider-img-prev svg,
.slider-img-controls .slider-img-next svg {
  width: 22px;
  height: 22px;
}

.slider-img-controls .slider-img-full svg {
  width: 20px;
  height: 20px;
}

@media (hover: hover) and (pointer: fine) {
  .slider-img-controls .slider-img-prev:hover,
  .slider-img-controls .slider-img-next:hover,
  .slider-img-controls .slider-img-full:hover {
    color: var(--color-text-heading);
  }
}

/* Swiper marks an arrow it cannot use (a slider set to stop at its ends). */
.slider-img-controls .swiper-button-disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.slider-img-controls .slider-img-pagination {
  display: flex;
  justify-content: center;
  min-width: 0;
}

/* Dots: round, 8px, 24px apart centre to centre — WCAG 2.2 (2.5.8) lets a
   target be smaller than 24px when a 24px circle around each touches no other.
   The active one is a mark laid over them that flows from dot to dot (the
   script moves its two round ends and the bar between them). */
.slider-dots {
  position: relative;
  display: inline-flex;
  flex-wrap: nowrap;
}

.slider-dots__dot {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  appearance: none;
}

.slider-dots__dot::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-muted);
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .slider-dots__dot:hover::before {
    opacity: 0.8;
  }
}

.slider-dots__mark {
  position: absolute;
  top: 8px;
  left: 0;
  width: 0;
  height: 8px;
  pointer-events: none;
}

.slider-dots__end,
.slider-dots__bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 8px;
  background: var(--color-accent);
  will-change: transform;
}

.slider-dots__end {
  width: 8px;
  border-radius: 50%;
}

.slider-dots__bar {
  width: 1px;
  transform-origin: 0 50%;
}

/* Too many photos for dots: «3 / 24». */
.slider-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  color: var(--color-text-muted);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.slider-counter__current {
  color: var(--color-text-heading);
  font-weight: 600;
}
