/* =========================================================
   RANDO EVENT GALLERY
   ========================================================= */

.rando-event-gallery {
  --gap: 12px;
  --radius: 14px;
  --thumb: 96px;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb), 1fr));
  gap: var(--gap);
  margin: 0;
  padding: 0;
}

@media (max-width: 520px) {
  .rando-event-gallery {
    --gap: 10px;
    --thumb: 84px;
  }
}

/* =========================================================
   GALLERY ITEM (THUMBNAIL)
   ========================================================= */

.rando-gallery-item {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: #f2f2f2;
  border: 1px solid rgba(0,0,0,.08);
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
  touch-action: manipulation;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

/* square ratio */
.rando-gallery-item::before {
  content: "";
  display: block;
  padding-top: 100%;
}

.rando-gallery-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none; /* IMPORTANT: anchor gets the click */
  transform: scale(1.02);
  transition: transform .22s ease, filter .22s ease;
}

/* hover + focus */
@media (hover: hover) {
  .rando-gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
    border-color: rgba(59,130,246,.4);
  }

  .rando-gallery-item:hover img {
    transform: scale(1.08);
    filter: saturate(1.1) contrast(1.05);
  }
}

.rando-gallery-item:focus,
.rando-gallery-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.4);
}

/* tap feedback */
.rando-gallery-item:active {
  transform: scale(.97);
}

/* =========================================================
   MAGNIFIER BADGE
   ========================================================= */

.rando-gallery-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  background: rgba(0,0,0,.6);
  display: grid;
  place-items: center;
  color: #fff;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

/* magnifier icon */
.rando-gallery-badge::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.rando-gallery-badge::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
  bottom: 11px;
  right: 9px;
}

@media (hover: hover) {
  .rando-gallery-item:hover .rando-gallery-badge {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   LIGHTBOX OVERLAY
   ========================================================= */

.rando-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.82);
  z-index: 999999;
  padding: 16px;
}

.rando-lightbox:target {
  display: grid;
  place-items: center;
}

/* =========================================================
   LIGHTBOX PANEL
   ========================================================= */

.rando-lightbox__panel {
  position: relative;
  background: #111;
  border-radius: 16px;
  max-width: 96vw;
  max-height: 88vh;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
  animation: randoZoom .18s ease-out;
}

@keyframes randoZoom {
  from { transform: scale(.96); opacity: .85; }
  to { transform: scale(1); opacity: 1; }
}

.rando-lightbox__panel img {
  display: block;
  max-width: 96vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
}

/* =========================================================
   LIGHTBOX CAPTION
   ========================================================= */

.rando-gallery-caption {
  padding: 10px 14px;
  font-size: 14px;
  color: #ddd;
  background: rgba(0,0,0,.55);
  border-top: 1px solid rgba(255,255,255,.08);
}

/* =========================================================
   CLOSE BUTTON
   ========================================================= */

.rando-lightbox__close {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  color: #fff;
  text-decoration: none;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.2);
  backdrop-filter: blur(6px);
}

.rando-lightbox__close:hover {
  background: rgba(255,255,255,.15);
}

.rando-lightbox__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.45);
}

/* =========================================================
   SAFETY FIXES (WORDPRESS / THEMES)
   ========================================================= */

.rando-event-gallery a {
  pointer-events: auto;
}

.rando-event-gallery img {
  user-select: none;
  -webkit-user-drag: none;
}

























/* =========================================================
   LIGHTBOX NAVIGATION — VERTICALLY CENTERED
   ========================================================= */

/* Lightbox grid */
.rando-lightbox.is-open{
  display: grid !important;
  grid-template-columns: minmax(64px, 96px) minmax(0, 1fr) minmax(64px, 96px);
  align-items: center;
}

/* Panel stays centered */
.rando-lightbox__panel{
  grid-column: 2;
  justify-self: center;
}

/* Nav buttons */
.rando-lightbox__nav{
  position: fixed !important;           /* center relative to viewport */
  top: 50% !important;
  transform: translateY(-50%) !important;

  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;

  font-size: 34px;
  line-height: 1;
  color: #fff;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.2);
  cursor: pointer;
  user-select: none;

  z-index: 1000000;
}

.rando-lightbox__prev{
  left: 16px !important;
}

.rando-lightbox__next{
  right: 16px !important;
}

.rando-lightbox__nav:hover{
  background: rgba(255,255,255,.15);
}

/* Close button stays top-right */
.rando-lightbox__close{
  z-index: 1000001 !important;
}

/* =========================================================
   Mobile adjustments
   ========================================================= */

@media (max-width: 700px){
  .rando-lightbox__nav{
    width: 56px;
    height: 56px;
    font-size: 36px;
    background: rgba(0,0,0,.55);
  }

  .rando-lightbox__prev{
    left: 12px !important;
  }

  .rando-lightbox__next{
    right: 12px !important;
  }
}
