/**
 * Petsure Gallery Widget Styles
 *
 * Style Variants:
 * - classic  → current default: hover caption, zoom on hover, search icon
 * - overlay  → permanent gradient overlay + caption always visible
 * - cards    → caption below image in a card, shadow
 * - minimal  → clean image-only, no caption, subtle border-radius
 * - masonry  → native CSS multi-column waterfall (column-count based).
 *              Items render once, in original order; the browser handles
 *              column placement on its own. Responsive: 4 → 2 → 1 columns.
 *
 * Border radius: owned entirely by .petsure-gallery-item. It clips its
 * own overflow, so the image, caption, and any overlay inherit the
 * rounded shape automatically — no descendant repeats the radius value.
 */

/* ============================================================ */
/*  GRID LAYOUT (shared base)                                   */
/* ============================================================ */

.petsure-gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--petsure-gallery-cols, 4), 1fr);
  gap: 12px;
  margin-top: 20px;
}

/* ============================================================ */
/*  SWIPER LAYOUT (shared base)                                 */
/* ============================================================ */

.petsure-gallery-swiper {
  overflow: hidden;
  width: 100%;
  position: relative;
}

.petsure-gallery-swiper .swiper-wrapper {
  align-items: stretch;
}

.petsure-gallery-swiper .swiper-slide {
  height: auto;
  display: flex;
}

/* Fallback grid when Swiper is not initialized */
.petsure-gallery-swiper:not(.swiper-initialized) .swiper-wrapper.petsure-swiper-static {
  display: grid;
  gap: 12px;
}

.petsure-gallery-swiper:not(.swiper-initialized) .swiper-wrapper.petsure-swiper-static.petsure-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.petsure-gallery-swiper:not(.swiper-initialized) .swiper-wrapper.petsure-swiper-static.petsure-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.petsure-gallery-swiper:not(.swiper-initialized) .swiper-wrapper.petsure-swiper-static.petsure-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.petsure-gallery-swiper:not(.swiper-initialized) .swiper-wrapper.petsure-swiper-static.petsure-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.petsure-gallery-swiper:not(.swiper-initialized) .swiper-wrapper.petsure-swiper-static.petsure-cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.petsure-gallery-swiper:not(.swiper-initialized) .swiper-wrapper.petsure-swiper-static.petsure-cols-6 {
  grid-template-columns: repeat(6, 1fr);
}

/* ============================================================ */
/*  SHARED: Gallery Item                                        */
/* ============================================================ */

.petsure-gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.petsure-gallery-image {
  position: relative;
  overflow: hidden;
}

.petsure-gallery-image img {
  display: block;
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.4s ease;
}

.petsure-gallery-link {
  display: block;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: inherit;
}

/* Lightbox expand icon (shared) */
.petsure-gallery-link::after {
  content: '\f065';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  color: var(--petsure-primary);
  border-radius: 50%;
  font-size: 18px;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
  pointer-events: none;
}

.petsure-gallery-link:hover::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ============================================================ */
/*  STYLE: CLASSIC (hover caption + zoom)                       */
/* ============================================================ */

.petsure-gallery-style-classic .petsure-gallery-item:hover .petsure-gallery-image img {
  transform: scale(1.05);
  filter: brightness(1.08);
}

.petsure-gallery-style-classic .petsure-gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: var(--petsure-white);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.petsure-gallery-style-classic .petsure-gallery-item:hover .petsure-gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================ */
/*  STYLE: OVERLAY (permanent dark overlay + always-visible cap) */
/* ============================================================ */

.petsure-gallery-style-overlay .petsure-gallery-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, var(--petsure-black));
  opacity: 0.6;
  z-index: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.petsure-gallery-style-overlay .petsure-gallery-item:hover .petsure-gallery-image::before {
  opacity: 0.75;
}

.petsure-gallery-style-overlay .petsure-gallery-image img {
  filter: saturate(0.95) brightness(0.95);
  transition: transform 0.5s ease, filter 0.5s ease;
}

.petsure-gallery-style-overlay .petsure-gallery-item:hover .petsure-gallery-image img {
  transform: scale(1.06);
  filter: saturate(1.1) brightness(1.05);
}

.petsure-gallery-style-overlay .petsure-gallery-caption {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  color: var(--petsure-white);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  z-index: 2;
  opacity: 1;
  transform: translateY(0);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.petsure-gallery-style-overlay .petsure-gallery-link::after {
  background: rgba(0, 0, 0, 0.5);
  color: var(--petsure-white);
  width: 42px;
  height: 42px;
  font-size: 15px;
}

/* ============================================================ */
/*  STYLE: CARDS (image + caption below in card)                */
/* ============================================================ */

.petsure-gallery-style-cards .petsure-gallery-item {
  background: var(--petsure-white);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.petsure-gallery-style-cards .petsure-gallery-item:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  transform: translateY(-3px);
}

.petsure-gallery-style-cards .petsure-gallery-image img {
  height: 220px;
}

.petsure-gallery-style-cards .petsure-gallery-item:hover .petsure-gallery-image img {
  transform: scale(1.04);
}

.petsure-gallery-style-cards .petsure-gallery-caption {
  position: relative;
  padding: 12px 16px 14px;
  color: var(--petsure-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  pointer-events: none;
}

.petsure-gallery-style-cards .petsure-gallery-link::after {
  background: rgba(0, 0, 0, 0.45);
  color: var(--petsure-white);
  width: 42px;
  height: 42px;
  font-size: 15px;
}

/* ============================================================ */
/*  STYLE: MINIMAL (clean image-only, no caption, subtle)       */
/* ============================================================ */

.petsure-gallery-style-minimal .petsure-gallery-image img {
  height: 260px;
}

.petsure-gallery-style-minimal .petsure-gallery-item:hover .petsure-gallery-image img {
  transform: scale(1.03);
  filter: brightness(1.02);
}

.petsure-gallery-style-minimal .petsure-gallery-caption {
  display: none;
}

.petsure-gallery-style-minimal .petsure-gallery-link::after {
  background: rgba(255, 255, 255, 0.85);
  width: 40px;
  height: 40px;
  font-size: 14px;
}

/* ============================================================ */
/*  STYLE: MASONRY — native CSS multi-column waterfall          */
/* ============================================================ */

.petsure-gallery-grid.petsure-gallery-style-masonry {
  display: block;
  column-count: 4;
  column-gap: 12px;
}

.petsure-gallery-grid.petsure-gallery-style-masonry .petsure-gallery-item {
  break-inside: avoid;
  width: 100%;
  margin-bottom: 12px;
}

.petsure-gallery-grid.petsure-gallery-style-masonry .petsure-gallery-image img {
  height: auto !important;
  min-height: auto !important;
  object-fit: contain;
}

.petsure-gallery-grid.petsure-gallery-style-masonry .petsure-gallery-item:hover .petsure-gallery-image img {
  transform: scale(1.04);
  filter: brightness(1.05);
}

.petsure-gallery-grid.petsure-gallery-style-masonry .petsure-gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 14px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
  color: var(--petsure-white);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  pointer-events: none;
}

.petsure-gallery-grid.petsure-gallery-style-masonry .petsure-gallery-link::after {
  background: rgba(0, 0, 0, 0.6);
  color: var(--petsure-white);
  width: 38px;
  height: 38px;
  font-size: 13px;
}

@media (max-width: 1024px) {
  .petsure-gallery-grid.petsure-gallery-style-masonry {
    column-count: 2;
  }
}

@media (max-width: 767px) {
  .petsure-gallery-grid.petsure-gallery-style-masonry {
    column-count: 1;
  }
}

/* ============================================================ */
/*  ARROWS                                                      */
/* ============================================================ */

.petsure-gallery-arrow {
  width: 44px;
  height: 44px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--petsure-white);
  color: var(--petsure-primary);
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  font-size: 16px;
}

.petsure-gallery-arrow:hover {
  background: var(--petsure-accent);
  color: var(--petsure-white);
  box-shadow: 0 4px 16px rgba(var(--petsure-accent-rgb), 0.3);
}

.petsure-gallery-prev {
  left: 10px;
}

.petsure-gallery-next {
  right: 10px;
}

/* ============================================================ */
/*  DOTS                                                        */
/* ============================================================ */

.petsure-gallery-swiper .petsure-swiper-dots {
  position: relative;
  bottom: auto !important;
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.petsure-gallery-swiper .petsure-swiper-dots .swiper-pagination-bullet {
  width: 10px;
  height: 10px;
  background: rgba(var(--petsure-primary-rgb), 0.3);
  opacity: 1;
  transition: all 0.3s ease;
  border-radius: 50%;
}

.petsure-gallery-swiper .petsure-swiper-dots .swiper-pagination-bullet-active {
  width: 28px;
  border-radius: 5px;
  background: var(--petsure-primary);
}

/* ============================================================ */
/*  RESPONSIVE                                                  */
/* ============================================================ */

@media (max-width: 1024px) {
  .petsure-gallery-grid:not(.petsure-gallery-style-masonry) {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .petsure-gallery-grid:not(.petsure-gallery-style-masonry) {
    grid-template-columns: repeat(2, 1fr);
  }
}