/* Schema Gallery Frontend Styles */
/* Show hint only on mobile and center under slider */
.sg-mobile-scroll-hint {
  display: none; /* hidden by default */
}
.schema-unique-note {
  color: #d9e0ff;
  font-size: 0.95rem;
  text-align: center;
  margin-top: 8px;
  line-height: 1.5;
}
.schema-unique-note em {
  display: block;
  margin-top: 4px;
  font-style: italic;
  opacity: 0.9;
}
.schema-unique-note {
  color: #e0e6ff;
  font-size: 0.95rem;
  text-align: center;
  margin: 10px 0 0;
  font-weight: 600;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .schema-unique-note {
    white-space: normal;
    font-size: 0.9rem;
  }
}
@media (max-width: 767px) {
  .sg-mobile-scroll-hint {
    display: block;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    opacity: 0.85;
    margin: 8px auto 4px;
    letter-spacing: 0.3px;
    width: 100%;
  }
}


.sg-powered-by {
  text-align: center;
  margin-top: 20px;
  margin-bottom: 0;
  font-size: 10px;
  font-weight: 300!important;
  color: #555; /* slightly darker for contrast */
  opacity: 0.85;
  line-height: 1.4;
  letter-spacing: 0.3px;
}

.sg-powered-by a {
  color: #555;
  text-decoration: none;
  font-weight: 400;
  transition: all 0.2s ease;
}

.sg-powered-by a:hover {
  color: #1f4170;
  text-decoration: underline;
  opacity: 1;
}


/* ===== VIDEO SUPPORT STYLES ===== */

/* Lightbox Video Container */
.sg-lightbox-video-container {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.sg-lightbox-video-wrapper {
	position: relative;
	width: 90vw;
	max-width: 1200px;
	padding-bottom: 56.25%; /* 16:9 aspect ratio */
	height: 0;
}

.sg-lightbox-video-wrapper iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border-radius: 4px;
}

/* Hide image when video is showing */
.sg-lightbox-img {
	max-width: 85vw;
	max-height: 75vh;
	object-fit: contain;
}

/* Video Play Icon Overlay on Thumbnails */
.sg-item-video {
	position: relative;
}

.sg-video-play-icon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	pointer-events: none;
	z-index: 2;
	opacity: 0.9;
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.sg-item-video:hover .sg-video-play-icon {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1.1);
}

.sg-video-play-icon svg {
	filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

/* Video Thumbnail Styling with Gradient */
.sg-item-video img {
	position: relative;
}

.sg-item-video::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(
		to bottom,
		rgba(0,0,0,0) 0%,
		rgba(0,0,0,0.1) 50%,
		rgba(0,0,0,0.3) 100%
	);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.3s ease;
	border-radius: var(--sg-border-radius, 16px);
}

.sg-item-video:hover::after {
	opacity: 1;
}

/* Ensure video items work in masonry layout */
.sg-layout-masonry .sg-item-video {
	position: relative;
}

/* Video items in carousel - ensure play icon is visible */
.sg-theme-carousel .sg-item-video .sg-video-play-icon {
	opacity: 1;
}

/* Video items in compact grid */
.sg-theme-compact .sg-item-video .sg-video-play-icon svg {
	width: 48px;
	height: 36px;
}

/* ===== END VIDEO SUPPORT STYLES ===== */

/* Gallery Grid */
.sg-gallery { 
  margin: 1.5rem 0; 
}

/* Base Grid Layout - for default grid and when no special theme is applied */
.sg-gallery:not(.sg-layout-masonry):not(.sg-theme-carousel):not(.sg-theme-compact) .sg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* Dynamic column counts for Grid layout only (not carousel or compact) */
.sg-gallery.sg-layout-grid:not(.sg-theme-carousel):not(.sg-theme-compact)[data-columns="2"] .sg-grid {
  grid-template-columns: repeat(2, 1fr) !important;
}

.sg-gallery.sg-layout-grid:not(.sg-theme-carousel):not(.sg-theme-compact)[data-columns="3"] .sg-grid {
  grid-template-columns: repeat(3, 1fr) !important;
}

.sg-gallery.sg-layout-grid:not(.sg-theme-carousel):not(.sg-theme-compact)[data-columns="4"] .sg-grid {
  grid-template-columns: repeat(4, 1fr) !important;
}

.sg-gallery.sg-layout-grid:not(.sg-theme-carousel):not(.sg-theme-compact)[data-columns="5"] .sg-grid {
  grid-template-columns: repeat(5, 1fr) !important;
}

/* Responsive grid columns */
@media (max-width: 1024px) {
  .sg-gallery.sg-layout-grid:not(.sg-theme-carousel):not(.sg-theme-compact)[data-columns="4"] .sg-grid,
  .sg-gallery.sg-layout-grid:not(.sg-theme-carousel):not(.sg-theme-compact)[data-columns="5"] .sg-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 640px) {
  .sg-gallery:not(.sg-layout-masonry):not(.sg-theme-carousel):not(.sg-theme-compact) .sg-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ===== Masonry Layout (Pro) ===== */
.sg-gallery.sg-layout-masonry {
  width: 100% !important;
  max-width: 100% !important;
}

.sg-gallery.sg-layout-masonry .sg-grid {
  display: block !important;
  column-count: 3 !important;
  column-gap: 16px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  
  /* Kill all grid properties */
  grid-template-columns: none !important;
  grid-auto-flow: unset !important;
  grid-auto-rows: unset !important;
  grid-template-rows: unset !important;
}

/* Dynamic column counts based on data attribute */
.sg-gallery.sg-layout-masonry[data-masonry-cols="2"] .sg-grid {
  column-count: 2 !important;
}

.sg-gallery.sg-layout-masonry[data-masonry-cols="3"] .sg-grid {
  column-count: 3 !important;
}

.sg-gallery.sg-layout-masonry[data-masonry-cols="4"] .sg-grid {
  column-count: 4 !important;
}

.sg-gallery.sg-layout-masonry[data-masonry-cols="5"] .sg-grid {
  column-count: 5 !important;
}

.sg-gallery.sg-layout-masonry .sg-item {
  display: inline-block;
  width: 100%;
  margin-bottom: 16px;
  break-inside: avoid;
}

.sg-gallery.sg-layout-masonry .sg-item img {
  height: auto;
}

/* Responsive masonry columns */
@media (max-width: 1024px) {
  .sg-gallery.sg-layout-masonry[data-masonry-cols="4"] .sg-grid,
  .sg-gallery.sg-layout-masonry[data-masonry-cols="5"] .sg-grid {
    column-count: 2 !important;
  }
}

@media (max-width: 640px) {
  .sg-gallery.sg-layout-masonry .sg-grid,
  .sg-gallery.sg-layout-masonry[data-masonry-cols="2"] .sg-grid,
  .sg-gallery.sg-layout-masonry[data-masonry-cols="3"] .sg-grid,
  .sg-gallery.sg-layout-masonry[data-masonry-cols="4"] .sg-grid,
  .sg-gallery.sg-layout-masonry[data-masonry-cols="5"] .sg-grid {
    column-count: 1 !important;
  }
}

/* ===== Carousel/Slider Theme ===== */
.sg-gallery.sg-theme-carousel {
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: visible;
  position: relative;
  padding: 20px 0;
}


.sg-gallery.sg-theme-carousel .sg-grid {
  display: flex !important;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 20px;
  padding: 20px 10px;
  
  /* Override any grid/masonry styles */
  grid-template-columns: none !important;
  column-count: 1 !important;
}

/* Scrollbar styling - Polished Motion Illusion Version */
.sg-gallery.sg-theme-carousel .sg-grid::-webkit-scrollbar {
  height: 22px;
}

.sg-gallery.sg-theme-carousel .sg-grid::-webkit-scrollbar-track {
  background: #eceff1;
  border-radius: 10px;
  margin: 0 40px;
}

.sg-gallery.sg-theme-carousel .sg-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.35);
}

.sg-gallery.sg-theme-carousel .sg-grid::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.45);
}

.sg-gallery.sg-theme-carousel .sg-grid::-webkit-scrollbar-thumb:active {
  background: linear-gradient(135deg, #4a3d8f 0%, #1f4170 100%);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3);
}


.sg-gallery.sg-theme-carousel .sg-item {
  flex: 0 0 auto;
  width: 320px;
  scroll-snap-align: start;
  display: block !important;
  break-inside: auto;
  margin-bottom: 0 !important;
}

/* Show peek of next/prev items */
.sg-gallery.sg-theme-carousel .sg-grid::before,
.sg-gallery.sg-theme-carousel .sg-grid::after {
  content: '';
  flex: 0 0 20px;
}

/* Responsive carousel */
@media (max-width: 768px) {
  .sg-gallery.sg-theme-carousel .sg-item {
    width: 280px;
  }
}

@media (max-width: 480px) {
  .sg-gallery.sg-theme-carousel .sg-item {
    width: 85vw;
  }
  
  .sg-gallery.sg-theme-carousel .sg-grid {
    gap: 15px;
  }
}

/* Carousel pagination */
.sg-gallery.sg-theme-carousel .sg-pagination {
  margin-top: 30px;
}

/* Thumbnail Title Overlay */
.sg-thumb-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
  color: #fff;
  padding: 30px 12px 12px 12px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
}

.sg-item a {
  position: relative;
  display: block;
}

.sg-item a:hover .sg-thumb-title {
  opacity: 1;
}

/* Gallery Items */
.sg-item {
  position: relative;
  background: #fff;
  border: 2px solid #fff;
  border-radius: var(--sg-border-radius, 16px); 
  overflow: hidden;
  box-shadow: 
    0 6px 16px rgba(0,0,0,0.15), 
    0 2px 6px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255,255,255,0.8);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sg-item:hover {
  transform: translateY(-8px);
  box-shadow: 
    0 16px 32px rgba(0,0,0,0.25), 
    0 8px 16px rgba(0,0,0,0.15),
    inset 0 1px 0 rgba(255,255,255,0.9);
  border-color: #fafafa;
}

.sg-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  transition: transform 0.4s ease;
}

.sg-item:hover img {
  transform: scale(1.05);
}

.sg-caption {
  font-size: 14px;
  padding: 10px 12px;
  color: #1f2937;
}

.sg-empty, 
.sg-error { 
  color: #6b7280; 
}

/* ===== Lightbox ===== */
.sg-lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  z-index: 9999;
  padding: 60px 20px 60px;
  box-sizing: border-box;
}

.sg-lightbox-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.sg-lightbox-container {
  position: relative;
  display: inline-block;
  max-width: 95vw;
}

.sg-lightbox-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  padding: 8px;
  border-radius: 6px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.sg-lightbox-content img {
  max-width: 85vw;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.sg-lightbox-title {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, rgba(0,0,0,0) 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  padding: 50px 20px 16px 20px;
  pointer-events: none;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  border-radius: 0 0 4px 4px;
}

.sg-lightbox-close {
  position: absolute;
  top: -40px;
  right: -40px;
  font-size: 36px;
  color: #fff;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 10000;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.sg-lightbox-close:hover {
  transform: scale(1.15);
}

.sg-lightbox-prev,
.sg-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 48px;
  width: 50px;
  height: 100px;
  border-radius: 5%;
  background: rgba(242, 108, 79, 0.3);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: all 0.25s ease;
  z-index: 10001;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.sg-lightbox-prev:hover,
.sg-lightbox-next:hover {
  transform: translateY(-50%) scale(1.15);
  background: rgba(139, 115, 85, 1);
}

.sg-lightbox-prev {
  left: -60px;
}

.sg-lightbox-next {
  right: -60px;
}

.sg-lightbox-counter {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 20px;
  z-index: 10000;
  white-space: nowrap;
}

/* ===== Pagination ===== */
.sg-pagination {
  margin-top: 20px;
  text-align: center;
}

.sg-pagination a {
  display: inline-block;
  margin: 0 4px;
  padding: 8px 14px;
  border-radius: 6px;
  background: #f3f4f6;
  color: #1f2937;
  font-weight: 500;
  text-decoration: none;
  transition: background .2s, color .2s;
}

.sg-pagination a:hover {
  background: #1f4170;
  color: #fff;
}

.sg-pagination .active {
  background: #1f4170;
  color: #fff;
  pointer-events: none;
}

.sg-pagination .sg-prev,
.sg-pagination .sg-next {
  font-weight: 600;
}

/* ===== Responsive Mobile ===== */
@media (max-width: 768px) {
  .sg-lightbox-overlay {
    padding: 50px 10px 10px;
  }
  
  .sg-lightbox-container {
    max-width: 100vw;
  }
  
  .sg-lightbox-content {
    padding: 6px;
  }
  
  .sg-lightbox-content img {
    max-width: 95vw;
    max-height: 75vh;
  }
  
  /* Video responsive adjustments */
  .sg-lightbox-video-wrapper {
    width: 95vw;
    padding-bottom: 53.4375%;
  }
  
  .sg-lightbox-title {
    font-size: 16px;
    padding: 40px 16px 12px 16px;
    bottom: 6px;
    left: 6px;
    right: 6px;
  }
  
  .sg-lightbox-close {
    top: 15px;
    right: 15px;
    font-size: 32px;
    width: 44px;
    height: 44px;
  }
  
  .sg-lightbox-prev,
  .sg-lightbox-next {
    font-size: 40px;
    width: 50px;
    height: 50px;
    background-color: rgba(255,255,255,0.15);
  }
  
  .sg-lightbox-prev {
    left: 15px;
  }
  
  .sg-lightbox-next {
    right: 15px;
  }
  
  .sg-lightbox-counter {
    bottom: 20px;
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* ===== Compact Grid Theme ===== */
.sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 4px;
  
  /* Override masonry */
  column-count: initial !important;
}

.sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-item {
  margin-bottom: 0 !important;
  break-inside: auto;
  border-radius: var(--sg-border-radius, 8px);  /* Use CSS variable with 8px fallback */
  box-shadow: 
    0 4px 12px rgba(0,0,0,0.25),
    0 2px 4px rgba(0,0,0,0.15),
    0 1px 2px rgba(0,0,0,0.1);
}
.sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-item:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 12px 24px rgba(0,0,0,0.35),
    0 6px 12px rgba(0,0,0,0.2),
    0 2px 4px rgba(0,0,0,0.15);
}

.sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-item img {
  height: 160px;
}

/* Responsive compact grid */
@media (max-width: 1200px) {
  .sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  
  .sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-item img {
    height: 140px;
  }
}

@media (max-width: 768px) {
  .sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 3px;
  }
  
  .sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-item img {
    height: 120px;
  }
}

@media (max-width: 480px) {
  .sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 2px;
  }
  
  .sg-gallery.sg-theme-compact:not(.sg-layout-masonry) .sg-item img {
    height: 100px;
  }
}

/* Compact pagination */
.sg-gallery.sg-theme-compact .sg-pagination {
  margin-top: 30px;
}
/* Force single column on phones for GRID layout, even when [data-columns="2"|"3"|...] is set */
@media (max-width: 767px) {
  .sg-gallery.sg-layout-grid:not(.sg-theme-carousel):not(.sg-theme-compact)[data-columns] .sg-grid {
    grid-template-columns: 1fr !important;
  }
}
/* Mobile landscape - make videos fit properly like images do */
@media (orientation: landscape) and (max-height: 500px) {
    .sg-lightbox-video-container {
        width: 100% !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .sg-lightbox-video-wrapper {
        position: relative;
        width: 90vw !important;
        max-width: 90vw !important;
        padding-bottom: 50.625% !important; /* 16:9 ratio at 90vw */
        height: 0 !important;
    }
    
    .sg-lightbox-video-wrapper iframe {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }
}
/* Mobile landscape - make videos fill available space */
@media (orientation: landscape) and (max-height: 500px) {
    .sg-lightbox-video-wrapper {
        width: 80vw !important;
        max-width: none !important;
        padding-bottom: 0 !important;
        height: 85vh !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .sg-lightbox-video-wrapper iframe {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
    }
}