/* ============================================================
   Jaipuria Smart Gallery — Frontend Styles
   Brand: Primary #ef7f1a (Orange) | Secondary #432357 (Purple)
   ============================================================ */

/* ── CSS Custom Properties ──────────────────────────────────────────────── */
:root {
  --jsg-primary:       #ef7f1a;
  --jsg-secondary:     #432357;
  --jsg-primary-dark:  #d66e0f;
  --jsg-secondary-dark:#321a44;
  --jsg-bg:            #f8f9fc;
  --jsg-card-bg:       #ffffff;
  --jsg-text:          #1a1e2e;
  --jsg-muted:         #8a90a8;
  --jsg-border:        #e8eaf2;
  --jsg-radius:        16px;
  --jsg-radius-sm:     10px;
  --jsg-shadow:        0 4px 24px rgba(67,35,87,.10);
  --jsg-shadow-hover:  0 12px 40px rgba(67,35,87,.18);
  --jsg-transition:    .3s cubic-bezier(.4,0,.2,1);
}

/* ── Wrapper ────────────────────────────────────────────────────────────── */
.jsg-gallery-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--jsg-text);
  padding: 0;
}
.jsg-gallery-wrapper *, .jsg-gallery-wrapper *::before, .jsg-gallery-wrapper *::after {
  box-sizing: border-box;
}

/* ── Override aggressive theme styles ───────────────────────────────────── */
/* Force all headings inside gallery to correct size — themes often set h3 very large */
.jsg-gallery-wrapper h1,
.jsg-gallery-wrapper h2,
.jsg-gallery-wrapper h3,
.jsg-gallery-wrapper h4,
.jsg-gallery-wrapper h5,
.jsg-gallery-wrapper h6 {
  font-size: inherit !important;
  line-height: inherit !important;
  font-weight: inherit !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  color: inherit !important;
}

/* SVG icons — themes often hide SVGs globally; restore them inside gallery */
.jsg-gallery-wrapper svg,
.jsg-lightbox svg {
  display: inline-block !important;
  fill: currentColor !important;
  stroke: none !important;
  overflow: visible !important;
}
.jsg-gallery-wrapper svg *,
.jsg-lightbox svg * {
  fill: inherit !important;
  stroke: none !important;
}

/* ── Controls Bar ────────────────────────────────────────────────────────── */
.jsg-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}
@media (min-width: 640px) {
  .jsg-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
}

/* Search */
.jsg-search-wrap {
  position: relative;
  flex-shrink: 0;
}
.jsg-search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  pointer-events: none;
}
.jsg-search-input {
  padding: 11px 18px 11px 42px !important;
  border: 2px solid #bbbfcf !important;
  border-radius: 50px !important;
  font-size: 14px !important;
  background: #fff !important;
  width: 260px !important;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color var(--jsg-transition), box-shadow var(--jsg-transition);
  color: var(--jsg-text) !important;
}
.jsg-search-input:focus {
  border-color: var(--jsg-primary) !important;
  box-shadow: 0 0 0 4px rgba(239,127,26,.12) !important;
}

/* Year Filter Tabs */
.jsg-year-tabs {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.jsg-year-tab {
  display: inline-block !important;
  padding: 8px 18px !important;
  border-radius: 50px !important;
  border: 2px solid #bbbfcf !important;
  background: #fff !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #8a90a8 !important;
  cursor: pointer !important;
  transition: all var(--jsg-transition);
  line-height: 1.4 !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: none !important;
}
.jsg-year-tab:hover {
  border-color: var(--jsg-primary) !important;
  color: var(--jsg-primary) !important;
  background: #fff !important;
}
.jsg-year-tab.active {
  background: var(--jsg-primary) !important;
  border-color: var(--jsg-primary) !important;
  color: #fff !important;
}

/* ── Events Grid ─────────────────────────────────────────────────────────── */
.jsg-events-grid {
  display: grid;
  gap: 24px;
}
.jsg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.jsg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.jsg-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1023px) {
  .jsg-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
  .jsg-cols-3,
  .jsg-cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 479px) {
  .jsg-cols-2,
  .jsg-cols-3,
  .jsg-cols-4 { grid-template-columns: 1fr; }
}

/* Masonry layout via JS (class added by gallery.js) */
.jsg-layout-masonry { align-items: start; }

/* ── Event Card ──────────────────────────────────────────────────────────── */
.jsg-event-card {
  background: var(--jsg-card-bg);
  border-radius: var(--jsg-radius);
  box-shadow: var(--jsg-shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--jsg-transition), box-shadow var(--jsg-transition);
  border: 1px solid rgba(0,0,0,.04);
  position: relative;
}
.jsg-event-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--jsg-shadow-hover);
}

/* Animate-in states */
.jsg-event-card.jsg-animate-fade   { animation: jsg-fade-in .5s ease forwards; }
.jsg-event-card.jsg-animate-scale  { animation: jsg-scale-in .45s ease forwards; }
.jsg-event-card.jsg-animate-slide  { animation: jsg-slide-up .45s ease forwards; }

@keyframes jsg-fade-in  { from { opacity:0; } to { opacity:1; } }
@keyframes jsg-scale-in { from { opacity:0; transform: scale(.9); } to { opacity:1; transform: scale(1); } }
@keyframes jsg-slide-up { from { opacity:0; transform: translateY(24px); } to { opacity:1; transform: translateY(0); } }

/* Card Image */
.jsg-card-image-wrap {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--jsg-secondary);
}
.jsg-card-image {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
  will-change: transform;
}
.jsg-event-card:hover .jsg-card-image {
  transform: scale(1.06);
}
.jsg-card-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--jsg-secondary), var(--jsg-secondary-dark));
  font-size: 48px;
}

/* Hover Overlay */
.jsg-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(67,35,87,.45) 60%,
    rgba(67,35,87,.8) 100%
  );
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--jsg-transition);
}
.jsg-event-card:hover .jsg-card-overlay { opacity: 1; }

.jsg-view-btn {
  background: var(--jsg-primary);
  color: #fff;
  padding: 10px 22px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .5px;
  transform: translateY(8px);
  transition: transform var(--jsg-transition);
  white-space: nowrap;
}
.jsg-event-card:hover .jsg-view-btn {
  transform: translateY(0);
}

/* Image Count Badge */
.jsg-image-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
  letter-spacing: .3px;
}

/* Card Body */
.jsg-card-body {
  padding: 16px 18px 18px;
}
.jsg-card-title {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--jsg-text) !important;
  margin: 0 0 8px !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
}
.jsg-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.jsg-year-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, var(--jsg-primary), #f5a254);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 50px;
  letter-spacing: .3px;
}
.jsg-date-label {
  font-size: 12px;
  color: var(--jsg-muted);
}

/* ── Load More / No Results ─────────────────────────────────────────────── */
.jsg-load-more-wrap {
  text-align: center;
  margin-top: 40px;
}
.jsg-btn-load-more {
  background: transparent;
  color: var(--jsg-secondary);
  border: 2px solid var(--jsg-secondary);
  padding: 12px 36px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--jsg-transition);
}
.jsg-btn-load-more:hover {
  background: var(--jsg-secondary);
  color: #fff;
}

.jsg-no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--jsg-muted);
}
.jsg-no-results span { font-size: 48px; display: block; margin-bottom: 12px; }
.jsg-no-results p { font-size: 15px; }

/* ── Loading Skeleton ─────────────────────────────────────────────────────── */
.jsg-skeleton {
  background: var(--jsg-card-bg);
  border-radius: var(--jsg-radius);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.04);
}
.jsg-skeleton-img {
  aspect-ratio: 16/10;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: jsg-shimmer 1.5s infinite;
}
.jsg-skeleton-body { padding: 16px 18px 18px; }
.jsg-skeleton-line {
  height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: jsg-shimmer 1.5s infinite;
  margin-bottom: 10px;
}
.jsg-skeleton-line.short { width: 50%; }
@keyframes jsg-shimmer { to { background-position-x: -200%; } }

/* ══════════════════════════════════════════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════════════════════════════════════════ */

.jsg-lightbox {
  position: fixed; inset: 0; z-index: 999999;
  display: flex; align-items: center; justify-content: center;
}
.jsg-lightbox-backdrop {
  position: absolute; inset: 0;
  background: rgba(10,8,18,.94);
  backdrop-filter: blur(8px);
}
.jsg-lightbox-inner {
  position: relative; z-index: 1;
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
}

/* ── Lightbox Header ──────────────────────────────────────────────────────── */
.jsg-lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(0,0,0,.3);
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.jsg-lightbox-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
}
.jsg-lightbox-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.jsg-lc-btn {
  width: 38px !important; height: 38px !important;
  background: rgba(255,255,255,.1) !important;
  border: 1px solid rgba(255,255,255,.2) !important;
  border-radius: 8px !important;
  color: rgba(255,255,255,.9) !important;
  cursor: pointer !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  transition: background var(--jsg-transition), color var(--jsg-transition);
  padding: 0 !important;
  text-decoration: none !important;
  line-height: 1 !important;
}
.jsg-lc-btn svg {
  width: 20px !important; height: 20px !important;
  fill: currentColor !important;
  display: block !important;
  pointer-events: none !important;
}
.jsg-lc-btn:hover { background: rgba(255,255,255,.25) !important; color: #fff !important; }
.jsg-lc-close:hover { background: rgba(220,50,50,.7) !important; color: #fff !important; }

/* ── Lightbox Stage ───────────────────────────────────────────────────────── */
.jsg-lightbox-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}

/* Navigation Arrows */
.jsg-nav-btn {
  position: absolute !important; z-index: 100 !important;
  top: 50% !important; transform: translateY(-50%) !important;
  width: 52px !important; height: 52px !important;
  background: rgba(255,255,255,.18) !important;
  border: 2px solid rgba(255,255,255,.35) !important;
  border-radius: 50% !important;
  color: #fff !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  cursor: pointer !important;
  transition: background var(--jsg-transition), transform var(--jsg-transition);
  padding: 0 !important;
  pointer-events: all !important;
  text-decoration: none !important;
  line-height: 1 !important;
}
.jsg-nav-btn svg {
  width: 28px !important; height: 28px !important;
  fill: #ffffff !important;
  display: block !important;
  pointer-events: none !important;
}
.jsg-nav-btn svg * { fill: #ffffff !important; }
.jsg-nav-prev { left: 20px !important; }
.jsg-nav-next { right: 20px !important; }
.jsg-nav-btn:hover {
  background: var(--jsg-primary) !important;
  transform: translateY(-50%) scale(1.08) !important;
  border-color: var(--jsg-primary) !important;
}
@media (max-width: 479px) {
  .jsg-nav-btn { width: 40px !important; height: 40px !important; }
  .jsg-nav-prev { left: 10px !important; }
  .jsg-nav-next { right: 10px !important; }
}

/* Swiper container */
.jsg-swiper {
  width: 100%; height: 100%;
}
.jsg-swiper .swiper-slide {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 100px;
  pointer-events: none;   /* let clicks pass through to nav buttons */
}
@media (max-width: 480px) { .jsg-swiper .swiper-slide { padding: 8px 60px; } }
.jsg-swiper .swiper-slide img {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  transition: transform var(--jsg-transition);
  pointer-events: all;    /* re-enable on the image itself for zoom/double-click */
}
/* Zoom applied via JS transform */
.jsg-swiper .swiper-slide img.zoomed {
  cursor: zoom-out;
}

/* ── Lightbox Footer ──────────────────────────────────────────────────────── */
.jsg-lightbox-footer {
  background: rgba(0,0,0,.3);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 16px;
}
.jsg-lc-counter {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
  background: rgba(255,255,255,.1);
  padding: 4px 14px;
  border-radius: 50px;
}

/* Thumbnail strip */
.jsg-lc-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  justify-content: center;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
  padding: 2px 0;
}
.jsg-lc-thumbs::-webkit-scrollbar { height: 4px; }
.jsg-lc-thumbs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.jsg-lc-thumb {
  width: 48px; height: 36px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  opacity: .5;
  border: 2px solid transparent;
  transition: opacity var(--jsg-transition), border-color var(--jsg-transition);
  flex-shrink: 0;
}
.jsg-lc-thumb.active {
  opacity: 1;
  border-color: var(--jsg-primary);
}

/* Open / Close animations */
.jsg-lightbox.jsg-lb-opening .jsg-lightbox-backdrop { animation: jsg-lb-bg-in .3s ease forwards; }
.jsg-lightbox.jsg-lb-closing .jsg-lightbox-backdrop { animation: jsg-lb-bg-out .25s ease forwards; }
.jsg-lightbox.jsg-lb-opening .jsg-lightbox-inner   { animation: jsg-lb-inner-in  .35s ease forwards; }
.jsg-lightbox.jsg-lb-closing .jsg-lightbox-inner   { animation: jsg-lb-inner-out .25s ease forwards; }

@keyframes jsg-lb-bg-in    { from { opacity:0; } to { opacity:1; } }
@keyframes jsg-lb-bg-out   { from { opacity:1; } to { opacity:0; } }
@keyframes jsg-lb-inner-in  { from { opacity:0; transform: scale(.97); } to { opacity:1; transform: scale(1); } }
@keyframes jsg-lb-inner-out { from { opacity:1; transform: scale(1); } to { opacity:0; transform: scale(.97); } }

/* Fullscreen mode */
.jsg-lightbox:-webkit-full-screen,
.jsg-lightbox:-moz-full-screen,
.jsg-lightbox:fullscreen {
  background: #000;
}
.jsg-lightbox:-webkit-full-screen .jsg-lightbox-stage,
.jsg-lightbox:fullscreen .jsg-lightbox-stage {
  height: calc(100vh - 130px);
}

/* ── Hidden / visible helpers ────────────────────────────────────────────── */
.jsg-hidden { display: none !important; }
