/* ═══════════════════════════════════════════════════════════
   DIANA GALLERY LIGHTBOX - GUTENBERG BLOCK VERSION
   Enhanced styling for WordPress Gutenberg Gallery Block
═══════════════════════════════════════════════════════════ */

/* ── GUTENBERG GALLERY GRID ────────────────────────────── */
.wp-block-gallery.diana-gallery--lightbox {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.wp-block-gallery.diana-gallery--lightbox .wp-block-image {
  position: relative;
  margin: 0 !important;
}

/* ── GALLERY ITEM HOVER EFFECTS ────────────────────────── */
.wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox {
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin: 0 !important;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(56, 0, 54, 0.1);
}

.wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox img {
  transition: transform 0.4s ease;
  cursor: pointer;
}

/* ── BANSKÁ BYSTRICA LOGO OVERLAY (BALANCED HERALDIC VERSION) ─────────── */
.wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox::before {
    content: '' !important;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* The Purple Overlay */
    background-color: rgba(56, 0, 54, 0.4); 
    
    /**
     * Balanced SVG Geometry:
     * - Standard proportions (not too tall)
     * - 8 equal-height stripes (10 units each)
     * - Starts with White, ends with Red
     * - Dark outline for clarity
     */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3CclipPath id='s'%3E%3Cpath d='M20,10 h60 v50 c0,20 -25,30 -30,30 s-30,-10 -30,-30 z'/%3E%3C/clipPath%3E%3C/defs%3E%3Cg clip-path='url(%23s)'%3E%3Crect width='100' height='100' fill='white'/%3E%3Crect y='20' width='100' height='10' fill='%23d00'/%3E%3Crect y='40' width='100' height='10' fill='%23d00'/%3E%3Crect y='60' width='100' height='10' fill='%23d00'/%3E%3Crect y='80' width='100' height='10' fill='%23d00'/%3E%3C/g%3E%3Cpath d='M20,10 h60 v50 c0,20 -25,30 -30,30 s-30,-10 -30,-30 z' fill='none' stroke='%23333' stroke-width='1.2' opacity='0.8'/%3E%3C/svg%3E");
    
    background-repeat: no-repeat;
    background-position: center;
    background-size: 80px auto; 
    
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--radius);
    z-index: 10;
    pointer-events: none;
}

.wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox:hover::before {
    opacity: 1;
}

/* ── HIDE FIGCAPTION ON HOVER (OPTIONAL) ───────────────── */
.wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox figcaption {
  position: static;
  background: transparent;
  margin-top: 0.5rem;
  padding: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  opacity: 1;
  transition: opacity 0.3s ease;
}

.wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox:hover figcaption {
  opacity: 0.7;
}

/* ── LIGHTBOX MODAL STYLES ─────────────────────────────── */
#diana-lightbox-gutenberg {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.2s ease;
}

#diana-lightbox-gutenberg.is-open {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── LIGHTBOX IMAGE WRAPPER ────────────────────────────── */
.diana-lightbox-gutenberg__img-wrap {
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.diana-lightbox-gutenberg__img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  display: block;
}

/* ── LIGHTBOX CAPTION ──────────────────────────────────── */
.diana-lightbox-gutenberg__caption {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  margin-top: 1.2rem;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  line-height: 1.5;
  max-width: 90vw;
}

/* ── LIGHTBOX CONTROLS ─────────────────────────────────── */
.diana-lightbox-gutenberg__close,
.diana-lightbox-gutenberg__prev,
.diana-lightbox-gutenberg__next {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--white);
  font-size: 1.6rem;
  cursor: pointer;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 300;
}

/* Shared hover styles (colors, border, shadow) */
.diana-lightbox-gutenberg__close:hover,
.diana-lightbox-gutenberg__prev:hover,
.diana-lightbox-gutenberg__next:hover {
  background: rgba(255, 194, 14, 0.2);
  border-color: rgba(255, 194, 14, 0.4);
  color: var(--yellow);
  box-shadow: 0 4px 20px rgba(255, 194, 14, 0.2);
}

/* Close button hover (Top right - simple scale) */
.diana-lightbox-gutenberg__close:hover {
  transform: scale(1.1);
}

/* Navigation arrows hover (Must combine vertical centering + scale) */
.diana-lightbox-gutenberg__prev:hover,
.diana-lightbox-gutenberg__next:hover {
  transform: translateY(-50%) scale(1.1);
}

/* Close button - top right */
.diana-lightbox-gutenberg__close {
  top: 1.5rem;
  right: 1.5rem;
}

/* Navigation buttons */
.diana-lightbox-gutenberg__prev {
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.diana-lightbox-gutenberg__next {
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

/* ── POST INFO ────────────────────────────────── */
.diana-lightbox-gutenberg__hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.9rem; /* Slightly larger for the title */
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.02em;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
}

/* ── RESPONSIVE MOBILE ────────────────────────────────── */
@media (max-width: 768px) {
  .diana-lightbox-gutenberg__close,
  .diana-lightbox-gutenberg__prev,
  .diana-lightbox-gutenberg__next {
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
  }

  .diana-lightbox-gutenberg__close {
    top: 1rem;
    right: 1rem;
  }

  .diana-lightbox-gutenberg__prev {
    left: 1rem;
  }

  .diana-lightbox-gutenberg__next {
    right: 1rem;
  }

  #diana-lightbox-gutenberg {
    padding: 1rem;
  }

  .diana-lightbox-gutenberg__img-wrap {
    max-width: 95vw;
  }

  .diana-lightbox-gutenberg__caption {
    font-size: 0.85rem;
    margin-top: 0.8rem;
  }

  .diana-lightbox-gutenberg__hint {
    font-size: 0.75rem;
    bottom: 1rem;
    max-width: 80vw;
    white-space: normal; /* Allow title to wrap on small screens */
    text-align: center;
  }
}

@media (max-width: 480px) {
  .diana-lightbox-gutenberg__close,
  .diana-lightbox-gutenberg__prev,
  .diana-lightbox-gutenberg__next {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .diana-lightbox-gutenberg__prev {
    left: 0.5rem;
  }

  .diana-lightbox-gutenberg__next {
    right: 0.5rem;
  }

  #diana-lightbox-gutenberg {
    padding: 0.5rem;
  }

  .diana-lightbox-gutenberg__caption {
    font-size: 0.8rem;
  }
}

/* ── PRINT STYLES ──────────────────────────────────────── */
@media print {
  #diana-lightbox-gutenberg { display: none !important; }
  
  .wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox {
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox:hover {
    transform: none;
    box-shadow: none;
  }

  .wp-block-gallery.diana-gallery--lightbox figure.diana-gallery__item--lightbox::before {
    display: none;
  }
}

/* Prevent background scrolling when lightbox is open */
html.diana-lightbox-active,
html.diana-lightbox-active body {
  overflow: hidden !important;
  height: 100% !important;
  /* This prevents the website from shifting to the right when the scrollbar disappears */
  scrollbar-gutter: stable; 
}

/* Ensure the lightbox itself doesn't create a scrollbar */
#diana-lightbox-gutenberg {
  overflow: hidden;
  touch-action: none;
}