/* =====================================================================
   Nova Gallery — Front-End Styles
   ===================================================================== */

:root {
  --nova-accent:        #1a1a2e;
  --nova-accent-light:  #e94560;
  --nova-bg:            #f7f7f9;
  --nova-surface:       #ffffff;
  --nova-text:          #1a1a2e;
  --nova-muted:         #888;
  --nova-radius:        6px;
  --nova-gap:           12px;
  --nova-transition:    0.28s ease;
}

/* ── Wrapper ──────────────────────────────────────────────────── */
.nova-gallery-wrap {
  font-family: inherit;
  max-width: 100%;
  box-sizing: border-box;
}

.nova-gallery-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--nova-text);
}

.nova-gallery-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--nova-muted);
  border: 2px dashed #ddd;
  border-radius: var(--nova-radius);
}

/* ── Filter bar ───────────────────────────────────────────────── */
.nova-gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}

.nova-filter-btn {
  padding: 6px 16px;
  border: 2px solid var(--nova-accent);
  background: transparent;
  color: var(--nova-accent);
  border-radius: 999px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  transition: background var(--nova-transition), color var(--nova-transition);
}

.nova-filter-btn:hover,
.nova-filter-btn.active {
  background: var(--nova-accent);
  color: #fff;
}

/* ── Sort bar ─────────────────────────────────────────────────── */
.nova-gallery-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
  font-size: .85rem;
  color: var(--nova-muted);
}

.nova-sort-select {
  padding: 4px 10px;
  border: 1px solid #ccc;
  border-radius: var(--nova-radius);
  font-size: .85rem;
  cursor: pointer;
  background: #fff;
}

/* ── Grid ─────────────────────────────────────────────────────── */
.nova-gallery-grid {
  display: grid;
  gap: var(--nova-gap);
}

/* Grid layout */
.nova-layout-grid {
  grid-template-columns: repeat( var(--nova-columns, 3), 1fr );
}

/* Masonry layout (CSS columns fallback; JS enhances) */
.nova-layout-masonry {
  column-count: var(--nova-columns, 3);
  column-gap: var(--nova-gap);
  display: block;
}

.nova-layout-masonry .nova-gallery-item {
  break-inside: avoid;
  margin-bottom: var(--nova-gap);
  display: inline-block;
  width: 100%;
}

/* ── Item ─────────────────────────────────────────────────────── */
.nova-gallery-item {
  position: relative;
  border-radius: var(--nova-radius);
  overflow: hidden;
  background: var(--nova-bg);
  transition: transform var(--nova-transition), box-shadow var(--nova-transition);
  cursor: pointer;
}

.nova-gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}

.nova-gallery-item.nova-hidden {
  display: none;
}

.nova-gallery-thumb {
  position: relative;
  overflow: hidden;
  line-height: 0;
}

.nova-gallery-thumb img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform .45s ease;
}

.nova-gallery-item:hover .nova-gallery-thumb img {
  transform: scale(1.05);
}

.nova-gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26,26,46,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--nova-transition);
}

.nova-gallery-item:hover .nova-gallery-overlay {
  opacity: 1;
}

.nova-open-lightbox {
  font-size: 1.8rem;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  user-select: none;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.5));
}

.nova-gallery-meta {
  background: var(--nova-surface);
  padding: 6px 10px 8px;
}

.nova-gallery-caption {
  margin: 0 0 4px;
  font-size: .82rem;
  color: var(--nova-muted);
}

.nova-file-link {
  display: block;
  font-size: .75rem;
  color: var(--nova-accent-light);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer; /* keep pointer even though parent is pointer too */
}

.nova-file-link:hover {
  text-decoration: underline;
}

/* Slideshow active item highlight */
.nova-gallery-item.nova-slide-active .nova-gallery-thumb {
  box-shadow: 0 0 0 3px var(--nova-accent-light);
}

/* ── Slideshow controls ───────────────────────────────────────── */
.nova-slideshow-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.nova-slideshow-controls button {
  padding: 8px 20px;
  border: 2px solid var(--nova-accent);
  background: transparent;
  color: var(--nova-accent);
  border-radius: var(--nova-radius);
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--nova-transition), color var(--nova-transition);
}

.nova-slideshow-controls button:hover {
  background: var(--nova-accent);
  color: #fff;
}

/* ── Lightbox ─────────────────────────────────────────────────── */
.nova-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nova-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.88);
  cursor: pointer;
}

.nova-lightbox-inner {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: novaFadeUp .28s ease;
}

@keyframes novaFadeUp {
  from { opacity:0; transform: translateY(24px); }
  to   { opacity:1; transform: translateY(0); }
}

.nova-lb-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  min-height: 80px;
}

.nova-lb-img {
  max-width: 88vw;
  max-height: 80vh;
  border-radius: var(--nova-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  display: block;
}

.nova-lb-loader {
  position: absolute;
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: novaSpinner .8s linear infinite;
  display: none;
}

.nova-lb-loading .nova-lb-loader { display: block; }
.nova-lb-loading .nova-lb-img    { opacity: 0; }

@keyframes novaSpinner {
  to { transform: rotate(360deg); }
}

.nova-lb-caption {
  color: rgba(255,255,255,.85);
  font-size: .9rem;
  margin-top: 12px;
  text-align: center;
  min-height: 1.2em;
}

.nova-lb-counter {
  color: rgba(255,255,255,.5);
  font-size: .8rem;
  margin-top: 4px;
}

/* Nav buttons */
.nova-lb-close,
.nova-lb-prev,
.nova-lb-next {
  position: absolute;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--nova-transition);
  line-height: 1;
}

.nova-lb-close:hover,
.nova-lb-prev:hover,
.nova-lb-next:hover {
  background: rgba(255,255,255,.3);
}

.nova-lb-close {
  top: -48px; right: 0;
  font-size: 1.5rem;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}

.nova-lb-prev,
.nova-lb-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.4rem;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
}

.nova-lb-prev { left: -56px; }
.nova-lb-next { right: -56px; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nova-layout-grid    { grid-template-columns: repeat(2,1fr); }
  .nova-layout-masonry { column-count: 2; }
  .nova-lb-prev { left: -40px; }
  .nova-lb-next { right: -40px; }
}

@media (max-width: 480px) {
  .nova-layout-grid    { grid-template-columns: 1fr; }
  .nova-layout-masonry { column-count: 1; }
  .nova-lb-prev { left: -32px; }
  .nova-lb-next { right: -32px; }
}
