.p2vr-wrap{
  --p2vr-cols-desktop: 4;
  --p2vr-cols-mobile: 3;
  --p2vr-gap: 12px;
  --p2vr-thumb-height: auto;

  --p2vr-modal-width: 92vw;
  --p2vr-modal-height: 82vh;
  --p2vr-modal-max-width: 1100px;
  --p2vr-modal-max-height: 700px;

  --p2vr-close-bg: #ffffff;
  --p2vr-close-radius: 14px;
  --p2vr-close-color: #111111;
}

.p2vr-gallery{
  display: grid;
  grid-template-columns: repeat(var(--p2vr-cols-desktop), minmax(0, 1fr));
  gap: var(--p2vr-gap);
}

@media (max-width: 640px){
  .p2vr-gallery{
    grid-template-columns: repeat(var(--p2vr-cols-mobile), minmax(0, 1fr));
  }
}

.p2vr-thumb{
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.p2vr-thumb img{
  width: 100%;
  height: var(--p2vr-thumb-height);
  display: block;
  border-radius: 10px;
  object-fit: cover;
}

.p2vr-modal{
  position: fixed;
  inset: 0;
  z-index: 2147483647;
}

.p2vr-modal[hidden]{ display:none; }

.p2vr-modal__overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
}

.p2vr-modal__panel{
  position: relative;
  width: var(--p2vr-modal-width);
  height: var(--p2vr-modal-height);
  max-width: var(--p2vr-modal-max-width);
  max-height: var(--p2vr-modal-max-height);
  margin: 6vh auto 0;
  background: #111;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

.p2vr-iframe{
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* Close nupp: "väline" ehk mitte iframe sees */
.p2vr-close{
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--p2vr-close-bg);
  border-radius: var(--p2vr-close-radius);
  border: 0;
  color: var(--p2vr-close-color);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.p2vr-close span{ transform: translateY(-1px); }

.p2vr-close:focus{
  outline: 2px solid rgba(255,255,255,.8);
  outline-offset: 2px;
}
