.review-photos {

  .review-photos__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .review-photos__thumb {
    position: relative;
    display: block;
    width: 80px;
    height: 80px;
    border-radius: 0.5rem;
    overflow: hidden;

    &:hover {
      box-shadow: 0 0 0 2px #cad8ee;
    }

    img,
    video {
      width: 100%;
      height: 100%;
      object-fit: cover;
      cursor: zoom-in;
    }
    video {
      pointer-events: none;
    }
  }
  .review-photos__thumb--video::after {
    content: "▶";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgb(0 0 0 / 25%);
    color: #fff;
    pointer-events: none;
  }
  .review-photos__dialog {
    width: 760px;
    max-width: calc(100vw - 2rem);
    height: min(760px, calc(100vh - 48px));
    margin: auto;
    padding: 1.25rem;
    border: 0;
    border-radius: 1rem;
    background: var(--color-white);
    color: var(--color-black);
    box-sizing: border-box;
    overflow: auto;
    overscroll-behavior: contain;

    &[open] {
      display: grid;
      grid-template-rows: auto minmax(0, 1fr) auto;
      gap: 1rem;
    }

    &::backdrop {
      background: rgb(0 0 0 / 60%);
    }

    .review-photos__header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1rem;

      h2 {
        margin: 0;
        font-size: 1.125rem;
      }

      form {
        margin: 0;
        flex-shrink: 0;
      }

      button {
        display: grid;
        place-items: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 0;
        cursor: pointer;

        svg {
          display: block;
          width: 1.125rem;
          height: 1.125rem;
          color: var(--color-black);

          &:hover {
            color: var(--blue);
          }
        }
      }
    }
  }
  .review-photos__dialog button:focus-visible,
  .review-photos__thumb:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
  }

  .review-photos__stage button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--review-photos-arrow-size);
    height: var(--review-photos-arrow-size);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--blue);
    color: var(--color-white);
    cursor: pointer;

    svg {
      display: block;
      flex-shrink: 0;
      width: 1.375rem;
      height: 1.375rem;

      path {
        transform: translate(0.477px, 0.363px);
      }
    }
    &:hover {
      background-color: #163879;
    }

    &:disabled {
      background-color: #f0f0f0;
      color: var(--color-dark-gray);
    }
  }

  .review-photos__stage button[hidden],
  .review-photos__stage .swiper-button-lock {
    display: none;
  }
  .review-photos__stage {
    --review-photos-arrow-size: 56px;

    display: grid;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: var(--review-photos-arrow-size) minmax(0, 1fr) var(
        --review-photos-arrow-size
      );
    align-items: center;
    gap: 1rem;
    isolation: isolate;
  }
  .review-photos__arrow {
    position: relative;
    z-index: 2;
    grid-row: 1;
  }
  .review-photos__prev {
    grid-column: 1;

    svg {
      rotate: 90deg;
    }
  }
  .review-photos__next {
    grid-column: 3;

    svg {
      rotate: -90deg;
    }
  }
  .review-photos__slider {
    position: relative;
    z-index: 1;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;

    .swiper-wrapper {
      display: flex;
      height: 100%;
    }
    .swiper-slide {
      flex-shrink: 0;
      width: 100%;
      height: 100%;

      .media-block {
        width: 100%;
        height: 100%;
        background-color: #f7f7f7;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 0.75rem;

        img,
        video {
          display: block;
          width: 100%;
          height: 100%;
          object-fit: contain;
        }

        video {
          width: auto;
          height: auto;
          max-width: 100%;
          max-height: 100%;
          border-radius: 0.5rem;
        }
      }
    }
  }

  .review-photos__counter {
    position: static;
    width: auto;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--color-dark-gray);
  }

  @media (max-width: 575px) {
    .review-photos__list {
      gap: 0.5rem;
    }

    .review-photos__thumb {
      width: 64px;
      height: 64px;
    }

    .review-photos__dialog {
      width: calc(100vw - 1rem);
      max-width: calc(100vw - 1rem);
      max-height: calc(100vh - 1rem);
      padding: 1rem;

      &[open] {
        gap: 0.75rem;
      }
    }

    .review-photos__header {
      gap: 0.5rem;

      h2 {
        font-size: 1rem;
        line-height: 1.4;
      }
    }

    .review-photos__stage {
      --review-photos-arrow-size: 36px;

      gap: 0.5rem;
    }

    .review-photos__counter {
      align-self: center;
      font-size: 0.875rem;
    }
  }

  @media (max-height: 500px) and (min-width: 576px) {
    .review-photos__dialog {
      max-height: calc(100vh - 1rem);
      padding: 0.75rem 1rem;

      &[open] {
        row-gap: 0.5rem;
      }
    }
  }
}
