/**
 * Portfolio Filter Gallery - Core Styles
 * Lightweight replacement for Bootstrap grid
 * 
 * @package Portfolio_Filter_Gallery
 * @version 2.0.0
 */

/* ==========================================================================
   CSS Variables & Defaults
   ========================================================================== */

.pfg-gallery-wrapper {
  --pfg-cols-xl: 4;
  --pfg-cols-lg: 3;
  --pfg-cols-md: 2;
  --pfg-cols-sm: 1;
  --pfg-gap: 20px;
  --pfg-border-width: 0px;
  --pfg-border-color: #ffffff;
  --pfg-border-radius: 0px;
  --pfg-filter-bg: #3858e9;
  --pfg-filter-text: #ffffff;
  --pfg-overlay-bg: rgba(0, 0, 0, 0.6);
  --pfg-transition: 0.3s ease;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  box-sizing: border-box;
}

.pfg-gallery-wrapper *,
.pfg-gallery-wrapper *::before,
.pfg-gallery-wrapper *::after {
  box-sizing: inherit;
}

/* ==========================================================================
   Gallery Preloader
   ========================================================================== */

.pfg-gallery-wrapper.pfg-loading {
  position: relative;
  min-height: 300px;
}

.pfg-gallery-wrapper.pfg-loading .pfg-grid {
  opacity: 0;
  visibility: hidden;
}

.pfg-preloader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.pfg-preloader-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--pfg-filter-bg, #3858e9);
  border-radius: 50%;
  animation: pfg-spin 0.8s linear infinite;
}

.pfg-preloader-text {
  font-size: 14px;
  color: #64748b;
}

@keyframes pfg-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* CSS-only fallback: hide preloader after 3s animation delay */
@keyframes pfg-fade-out {
  0%, 90% { opacity: 1; visibility: visible; }
  100% { opacity: 0; visibility: hidden; }
}

.pfg-preloader {
  animation: pfg-fade-out 3.5s forwards;
}

.pfg-gallery-wrapper.pfg-loaded .pfg-preloader {
  display: none;
  animation: none;
}

.pfg-gallery-wrapper.pfg-loaded .pfg-grid {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

/* ==========================================================================
   Filter Buttons
   ========================================================================== */

.pfg-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.pfg-filters--top {
  justify-content: flex-start;
}

.pfg-filters--center {
  justify-content: center;
}

.pfg-filters--right {
  justify-content: flex-end;
}

/* ==========================================================================
   Sidebar Layout
   ========================================================================== */

.pfg-gallery-wrapper--sidebar {
  display: flex;
  gap: 30px;
  overflow: visible;
}

.pfg-gallery-wrapper--sidebar-right {
  flex-direction: row-reverse;
}

.pfg-gallery-wrapper--sidebar .pfg-filters {
  flex-direction: column;
  flex-wrap: nowrap;
  flex-shrink: 0;
  width: 240px;
  margin-bottom: 0;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  align-self: flex-start;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-x: hidden;
  overflow-y: auto;
  gap: 6px;
}

/* Custom scrollbar for sidebar */
.pfg-gallery-wrapper--sidebar .pfg-filters::-webkit-scrollbar {
  width: 4px;
}

.pfg-gallery-wrapper--sidebar .pfg-filters::-webkit-scrollbar-track {
  background: transparent;
}

.pfg-gallery-wrapper--sidebar .pfg-filters::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.pfg-gallery-wrapper--sidebar .pfg-gallery-main {
  flex: 1;
  min-width: 0;
}

/* Sidebar filter buttons - vertical style */
.pfg-gallery-wrapper--sidebar .pfg-filter {
  width: 100%;
  justify-content: flex-start;
  padding: 10px 14px;
  border-radius: 8px;
  text-align: left;
  font-size: 14px;
  background: var(--pfg-filter-bg, #3858e9);
  color: var(--pfg-filter-text, #fff);
  position: relative;
  overflow: visible;
}

.pfg-gallery-wrapper--sidebar .pfg-filter:hover {
  background: var(--pfg-filter-active-bg, var(--pfg-filter-bg, #3858e9));
  opacity: 0.85;
  color: var(--pfg-filter-text, #fff);
}

.pfg-gallery-wrapper--sidebar .pfg-filter--active {
  background: var(--pfg-filter-active-bg, var(--pfg-filter-bg, #3858e9));
  color: var(--pfg-filter-text, #fff);
}

/* Color dot in sidebar - inline with text */
.pfg-gallery-wrapper--sidebar .pfg-filter-color {
  flex-shrink: 0;
}

/* CRITICAL: Override hierarchical filter styles for sidebar */
.pfg-gallery-wrapper--sidebar .pfg-filter-group {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  margin-bottom: 4px;
}

.pfg-gallery-wrapper--sidebar .pfg-filter--parent {
  width: 100% !important;
}

.pfg-gallery-wrapper--sidebar .pfg-filter-children {
  margin-left: 0;
  margin-top: 4px;
  padding-left: 20px;
  border-left: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.pfg-gallery-wrapper--sidebar .pfg-filter-children .pfg-filter {
  padding: 8px 12px;
  font-size: 13px;
  width: 100%;
}

/* Sidebar filter count badge - inline style (not tooltip) */
.pfg-gallery-wrapper--sidebar .pfg-filter-count {
  position: static;
  margin-left: auto;
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  color: #64748b;
  opacity: 1;
  transform: none;
  box-shadow: none;
  pointer-events: auto;
  max-width: none;
  overflow: visible;
  display: inline-block;
}

.pfg-gallery-wrapper--sidebar .pfg-filter--active .pfg-filter-count {
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
}

/* Reset hover tooltip style for sidebar */
.pfg-gallery-wrapper--sidebar.pfg-filters--count-hover .pfg-filter-count {
  position: static;
  opacity: 1;
  transform: none;
  top: auto;
  right: auto;
}

/* Responsive sidebar - collapse on mobile */
@media (max-width: 768px) {
  .pfg-gallery-wrapper--sidebar {
    flex-direction: column;
  }

  .pfg-gallery-wrapper--sidebar .pfg-filters {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 15px;
    position: static;
    max-height: none;
  }

  .pfg-gallery-wrapper--sidebar .pfg-filter {
    width: auto;
    padding: 8px 16px;
  }

  .pfg-gallery-wrapper--sidebar .pfg-filter-children {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.pfg-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  background: var(--pfg-filter-bg, #3858e9);
  color: var(--pfg-filter-text, #ffffff);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all var(--pfg-transition);
}

.pfg-filter-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pfg-filter:hover,
.pfg-filter:focus {
  background: var(--pfg-filter-bg, #3858e9);
  opacity: 0.85;
  color: var(--pfg-filter-text, #ffffff);
  outline: none;
}

.pfg-filter--active {
  background: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
  color: var(--pfg-filter-text);
}

.pfg-filter--active:hover,
.pfg-filter--active:focus {
  background: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
  color: var(--pfg-filter-text);
  opacity: 0.9;
}

.pfg-filter-count {
  opacity: 0.7;
  font-size: 0.85em;
  margin-left: 2px;
}

/* Hover-only count display - Tooltip style badge */
.pfg-filters--count-hover .pfg-filter {
  position: relative;
}

.pfg-filters--count-hover .pfg-filter-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--pfg-filter-active-bg, #333);
  color: #fff;
  font-size: 0.7em;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  opacity: 0;
  transform: scale(0.5) translateY(5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin-left: 0;
}

.pfg-filters--count-hover .pfg-filter:hover .pfg-filter-count {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ==========================================================================
   Filter Style Variations
   ========================================================================== */

/* Buttons (Default) - Already styled above */
.pfg-filters--buttons .pfg-filter {
  border-radius: 6px;
}

/* Pills - Fully rounded */
.pfg-filters--pills .pfg-filter {
  border-radius: 50px;
  padding: 10px 24px;
}

/* Minimal - Text only, no background, no border */
.pfg-filters--minimal .pfg-filter {
  background: transparent !important;
  border: none !important;
  padding: 8px 16px;
  color: #64748b;
  font-weight: 500;
  border-radius: 0;
  box-shadow: none;
}

.pfg-filters--minimal .pfg-filter:hover {
  background: transparent !important;
  color: #1e293b;
}

.pfg-filters--minimal .pfg-filter--active {
  background: transparent !important;
  color: var(--pfg-filter-active-bg, var(--pfg-filter-bg)) !important;
  font-weight: 600;
}

.pfg-filters--minimal .pfg-filter--active:hover {
  background: transparent !important;
  color: var(--pfg-filter-active-bg, var(--pfg-filter-bg)) !important;
  opacity: 0.8;
}

.pfg-filters--minimal .pfg-filter--selected {
  background: transparent !important;
  color: var(--pfg-filter-active-bg, var(--pfg-filter-bg)) !important;
  font-weight: 600;
}

/* Outline - Bordered */
.pfg-filters--outline .pfg-filter {
  background: transparent;
  border: 2px solid #e2e8f0;
  color: #64748b;
  padding: 8px 18px;
  border-radius: 6px;
}

.pfg-filters--outline .pfg-filter:hover {
  background: transparent;
  border-color: #94a3b8;
  color: #475569;
}

.pfg-filters--outline .pfg-filter--active {
  background: transparent;
  border-color: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
  color: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
}

.pfg-filters--outline .pfg-filter--active:hover {
  opacity: 0.8;
}

.pfg-filters--outline .pfg-filter--selected {
  background: transparent !important;
  border-color: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
  color: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
}

/* Underline - Only bottom border on active, no other borders */
.pfg-filters--underline .pfg-filter {
  background: transparent !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  padding: 10px 16px;
  color: #64748b;
  font-weight: 500;
  border-radius: 0;
  box-shadow: none;
}

.pfg-filters--underline .pfg-filter:hover {
  background: transparent !important;
  color: #1e293b;
  border-bottom-color: #e2e8f0 !important;
}

.pfg-filters--underline .pfg-filter--active {
  background: transparent !important;
  color: var(--pfg-filter-active-bg, var(--pfg-filter-bg)) !important;
  border-bottom-color: var(
    --pfg-filter-active-bg,
    var(--pfg-filter-bg)
  ) !important;
  font-weight: 600;
}

.pfg-filters--underline .pfg-filter--active:hover {
  background: transparent !important;
  color: var(--pfg-filter-active-bg, var(--pfg-filter-bg)) !important;
  opacity: 0.9;
}

.pfg-filters--underline .pfg-filter--selected {
  background: transparent !important;
  color: var(--pfg-filter-active-bg, var(--pfg-filter-bg)) !important;
  border-bottom-color: var(
    --pfg-filter-active-bg,
    var(--pfg-filter-bg)
  ) !important;
  font-weight: 600;
}

/* Multi-select mode - selected filters */
.pfg-filters--multi .pfg-filter--selected {
  background: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
  color: var(--pfg-filter-text);
  position: relative;
  padding-right: 32px; /* Make room for checkmark */
}

.pfg-filters--multi .pfg-filter--selected::after {
  content: "✓";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85em;
  font-weight: bold;
}

/* AND/OR Logic Toggle - More prominent styling */
.pfg-logic-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-left: auto;
  border: 2px solid var(--pfg-filter-bg);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.pfg-logic-btn {
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--pfg-filter-bg);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pfg-logic-btn:hover {
  background: rgba(56, 88, 233, 0.1);
}

.pfg-logic-btn--active {
  background: var(--pfg-filter-bg);
  color: var(--pfg-filter-text);
}

.pfg-logic-btn--active:hover {
  background: var(--pfg-filter-bg);
  opacity: 0.9;
}

/* Hierarchical Filters - Inline groups with children below parent */
.pfg-filters--hierarchical {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.pfg-filter-group {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.pfg-filter--parent {
  font-weight: 600;
  background: #334155;
  color: #fff;
  border-radius: 6px;
  width: fit-content;
}

.pfg-filter--parent:hover {
  background: #1e293b;
  color: #fff;
}

.pfg-filter--parent.pfg-filter--active,
.pfg-filter--parent.pfg-filter--selected {
  background: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
  color: var(--pfg-filter-text);
}

.pfg-filter-children {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-left: 10px;
  margin-left: 4px;
  border-left: 3px solid var(--pfg-filter-bg);
  align-items: center;
}

/* Nested children (3rd level and beyond) */
.pfg-filter-children .pfg-filter-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  padding: 0;
}

.pfg-filter-children .pfg-filter-children {
  padding-left: 8px;
  margin-left: 3px;
  border-left-width: 2px;
}

.pfg-filter--child {
  font-size: 13px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.pfg-filter--child:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.pfg-filter--child.pfg-filter--active,
.pfg-filter--child.pfg-filter--selected {
  background: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
  color: var(--pfg-filter-text);
  border-color: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
}

/* Orphan filters - same style as filter groups but as single buttons */
.pfg-filters--hierarchical
  > .pfg-filter:not(.pfg-filter--parent):not(.pfg-filter--child) {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 16px;
  align-self: center;
  font-size: 14px;
}

.pfg-filters--hierarchical
  > .pfg-filter:not(.pfg-filter--parent):not(.pfg-filter--child):hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Active state for orphan filters (All button, standalone filters) */
.pfg-filters--hierarchical
  > .pfg-filter:not(.pfg-filter--parent):not(
    .pfg-filter--child
  ).pfg-filter--active,
.pfg-filters--hierarchical
  > .pfg-filter:not(.pfg-filter--parent):not(
    .pfg-filter--child
  ).pfg-filter--selected {
  background: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
  color: var(--pfg-filter-text);
  border-color: var(--pfg-filter-active-bg, var(--pfg-filter-bg));
}

/* Dropdown style filters */
.pfg-filters--dropdown {
  position: relative;
}

.pfg-filters--dropdown select {
  padding: 12px 40px 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff
    url('data:image/svg+xml;charset=utf-8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"%3E%3Cpath fill="%23475569" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"/%3E%3C/svg%3E')
    right 12px center no-repeat;
  background-size: 16px;
  cursor: pointer;
  min-width: 200px;
  appearance: none;
}

/* ==========================================================================
   Search Box
   ========================================================================== */

.pfg-search {
  margin-bottom: 20px;
}

.pfg-search-input {
  width: 100%;
  max-width: 300px;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color var(--pfg-transition);
}

.pfg-search-input:focus {
  outline: none;
  border-color: var(--pfg-filter-bg);
  box-shadow: 0 0 0 3px rgba(56, 88, 233, 0.1);
}

/* ==========================================================================
   Gallery Grid
   ========================================================================== */

.pfg-grid {
  display: grid;
  grid-template-columns: repeat(var(--pfg-cols-sm), 1fr);
  gap: var(--pfg-gap);
}

@media (min-width: 576px) {
  .pfg-grid {
    grid-template-columns: repeat(var(--pfg-cols-sm), 1fr);
  }
}

@media (min-width: 768px) {
  .pfg-grid {
    grid-template-columns: repeat(var(--pfg-cols-md), 1fr);
  }
}

@media (min-width: 992px) {
  .pfg-grid {
    grid-template-columns: repeat(var(--pfg-cols-lg), 1fr);
  }
}

@media (min-width: 1200px) {
  .pfg-grid {
    grid-template-columns: repeat(var(--pfg-cols-xl), 1fr);
  }
}

/* Masonry layout - JS-powered positioning for variable heights + correct order */
.pfg-grid--masonry {
  position: relative;
  display: block;
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pfg-grid--masonry .pfg-item {
  border-radius: var(--pfg-radius, 8px);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(15px) translateZ(0);
  will-change: transform, opacity, left, top;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    top 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease-out,
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transition-delay: var(--pfg-stagger-delay, 0ms);
}

/* Show items after mosaic layout positions them */
.pfg-grid--masonry .pfg-item.pfg-item--positioned {
  opacity: 1;
  transform: translateY(0) translateZ(0);
}

/* ==========================================================================
   Grid Layout - Fixed Height Images (non-masonry)
   ========================================================================== */

/* Fixed-height grid: crops images to same aspect ratio */
.pfg-grid--fixed-height .pfg-item {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.pfg-grid--fixed-height .pfg-item-link {
  display: block;
  width: 100%;
  height: 100%;
}

.pfg-grid--fixed-height .pfg-item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Grid with cards/captions: fixed aspect ratio image, caption below */
.pfg-grid--grid .pfg-item {
  display: flex;
  flex-direction: column;
}

.pfg-grid--grid .pfg-item-link {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.pfg-grid--grid .pfg-item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.pfg-grid--grid .pfg-caption {
  width: 100%;
  padding-top: 10px;
  /* Below-image captions are always visible */
}

/* Grayscale effect */
.pfg-grid--grayscale .pfg-item-image {
  filter: grayscale(100%);
  transition: filter var(--pfg-transition);
}

.pfg-grid--grayscale .pfg-item:hover .pfg-item-image {
  filter: grayscale(0%);
}

/* RTL support */
.pfg-grid[dir="rtl"] {
  direction: rtl;
}

/* ==========================================================================
   Justified Layout
   ========================================================================== */

.pfg-grid--justified {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pfg-gap, 10px);
  align-items: flex-start;
}

.pfg-grid--justified .pfg-item {
  flex-grow: var(--item-aspect, 1);
  min-width: 100px;
  overflow: visible;
  display: flex;
  flex-direction: column;
}

/* Image link container has the fixed height */
.pfg-grid--justified .pfg-item-link {
  width: 100%;
  height: var(--pfg-row-height, 200px);
  display: block;
  overflow: hidden;
}

.pfg-grid--justified .pfg-item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Caption below image can expand naturally */
.pfg-grid--justified .pfg-caption {
  width: 100%;
  padding-top: 10px;
  /* Below-image captions are always visible */
}

/* Last row handling */
.pfg-grid--justified-last-left {
  justify-content: flex-start;
}

.pfg-grid--justified-last-left .pfg-item:last-child {
  flex-grow: 0;
}

/* ==========================================================================
   Packed Layout (CSS Grid Dense)
   ========================================================================== */

/* Default packed layout - mosaic with overlay captions */
.pfg-grid--packed {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(var(--pfg-packed-min, 150px), 1fr)
  );
  grid-auto-rows: var(--pfg-packed-min, 150px);
  grid-auto-flow: row; /* Changed from 'dense' to preserve DOM/sort order */
  gap: var(--pfg-gap, 10px);
}

.pfg-grid--packed .pfg-item {
  overflow: hidden;
}

.pfg-grid--packed .pfg-item-link {
  display: block;
  width: 100%;
  height: 100%;
}

.pfg-grid--packed .pfg-item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Size variations - spans grid cells */
.pfg-grid--packed .pfg-item--wide {
  grid-column: span 2;
}

.pfg-grid--packed .pfg-item--tall {
  grid-row: span 2;
}

.pfg-grid--packed .pfg-item--large {
  grid-column: span 2;
  grid-row: span 2;
}

/* Packed layout: Caption overlay (default) */
.pfg-grid--packed .pfg-item-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 15px 15px;
  background: linear-gradient(
    to top,
    var(--pfg-overlay-color, rgba(0, 0, 0, 0.8)) 0%,
    rgba(0, 0, 0, 0.4) 60%,
    transparent 100%
  );
  z-index: 5;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pfg-grid--packed .pfg-item:hover .pfg-item-caption {
  opacity: 1;
  transform: translateY(0);
}

.pfg-grid--packed .pfg-item-caption .pfg-item-title {
  color: var(--pfg-title-color, #fff);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  font-size: 0.95em;
  margin-bottom: 4px;
  display: block;
}

.pfg-grid--packed .pfg-item-caption .pfg-item-categories {
  color: var(--pfg-category-color, rgba(255, 255, 255, 0.85));
  font-size: 0.8em;
  display: block;
}

/* Packed with cards mode - JS-powered mosaic with captions below */
.pfg-grid--packed.pfg-grid--packed-cards {
  position: relative;
  display: block !important; /* Override CSS Grid to use JS positioning */
  transition: height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pfg-grid--packed.pfg-grid--packed-cards .pfg-item {
  overflow: visible;
  border-radius: var(--pfg-radius, 8px);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(15px) translateZ(0);
  will-change: transform, opacity, left, top;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    top 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease-out,
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transition-delay: var(--pfg-stagger-delay, 0ms);
}

/* Show items after mosaic layout positions them */
.pfg-grid--packed.pfg-grid--packed-cards .pfg-item.pfg-item--positioned {
  opacity: 1;
  transform: translateY(0) translateZ(0);
}

.pfg-grid--packed.pfg-grid--packed-cards .pfg-item-link {
  display: block;
  overflow: hidden;
  border-radius: var(--pfg-radius, 8px);
}

/* Creative Agency template - top-only border radius (no bottom corners) */
.pfg-template-creative-agency .pfg-item {
  border-radius: var(--pfg-border-radius) var(--pfg-border-radius) 0 0;
}

.pfg-grid--packed.pfg-grid--packed-cards .pfg-item-caption {
  position: static !important;
  background: var(--pfg-caption-bg, #ffffff) !important;
  padding: 12px 10px;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
}

.pfg-grid--packed.pfg-grid--packed-cards .pfg-item-caption .pfg-item-title {
  color: var(--pfg-filter-active-color, #e91e63);
  text-shadow: none;
  font-size: 0.9em;
  margin-bottom: 4px;
}

.pfg-grid--packed.pfg-grid--packed-cards
  .pfg-item-caption
  .pfg-item-categories {
  color: var(--pfg-primary-color, #3858e9);
  font-size: 0.75em;
}

/* Product price in packed cards - use primary color */
.pfg-grid--packed.pfg-grid--packed-cards
  .pfg-item-caption
  .pfg-product-caption-price {
  color: var(--pfg-primary-color, #3858e9);
  font-size: 0.85em;
  font-weight: 600;
}

/* Responsive: reduce spans on small screens */
@media (max-width: 768px) {
  .pfg-grid--packed .pfg-item--wide,
  .pfg-grid--packed .pfg-item--tall,
  .pfg-grid--packed .pfg-item--large {
    grid-column: span 1;
    grid-row: span 1;
  }
}

/* ==========================================================================
   Gallery Items
   ========================================================================== */

.pfg-item {
  position: relative;
  border-radius: var(--pfg-border-radius);
  border: var(--pfg-border-width) solid var(--pfg-border-color);
  background: #f8fafc;
  overflow: hidden; /* Clips children to rounded corners */
  /* Smooth animation properties - using cubic-bezier for natural motion */
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, transform;
}

/* Hidden state - completely remove from layout */
.pfg-item--hidden {
  display: none !important;
}

/* Fade-in animation when items appear after filtering */
.pfg-item--visible {
  animation: pfgFadeInSmooth 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pfgFadeInSmooth {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Staggered animation delay with natural easing */
.pfg-item[data-delay="1"] {
  transition-delay: 0.02s;
}
.pfg-item[data-delay="2"] {
  transition-delay: 0.04s;
}
.pfg-item[data-delay="3"] {
  transition-delay: 0.06s;
}
.pfg-item[data-delay="4"] {
  transition-delay: 0.08s;
}
.pfg-item[data-delay="5"] {
  transition-delay: 0.1s;
}
.pfg-item[data-delay="6"] {
  transition-delay: 0.12s;
}

.pfg-item-link {
  display: block;
  position: relative;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.pfg-item-image {
  display: block;
  width: 100%;
  height: auto;
  transition: transform var(--pfg-transition);
}

/* ==========================================================================
   Item Overlays
   ========================================================================== */

/* Legacy overlay class (for backwards compatibility) */
.pfg-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: var(--pfg-overlay-color, rgba(0, 0, 0, 0.7));
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* New overlay caption class */
.pfg-item-caption--overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 50px 15px 15px;
  background: linear-gradient(
    to top,
    var(--pfg-overlay-color, rgba(0, 0, 0, 0.7)) 0%,
    transparent 100%
  );
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  z-index: 5;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pfg-item:hover .pfg-item-overlay,
.pfg-item:hover .pfg-item-caption--overlay {
  opacity: 1;
  transform: translateY(0);
}

/* Overlay text colors */
.pfg-item-overlay .pfg-item-title,
.pfg-item-caption--overlay .pfg-item-title {
  color: var(--pfg-caption-text, #fff);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.pfg-item-overlay .pfg-item-categories,
.pfg-item-caption--overlay .pfg-item-categories {
  color: var(--pfg-primary-color, #3858e9);
  font-size: 0.85em;
  margin-top: 4px;
}

.pfg-item-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.pfg-item-number {
  display: inline-block;
  width: 24px;
  height: 24px;
  background: var(--pfg-filter-bg);
  color: var(--pfg-filter-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 24px;
  text-align: center;
  border-radius: 50%;
  margin-bottom: 8px;
}

/* ==========================================================================
   Type Indicator Icons (Video/Link in corner)
   ========================================================================== */

.pfg-item-type-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: background 0.2s ease, transform 0.2s ease;
}

.pfg-item-type-icon svg {
  display: block;
}

.pfg-item:hover .pfg-item-type-icon {
  background: rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
}

.pfg-item-type-icon--video {
  background: rgba(220, 38, 38, 0.85); /* YouTube red */
}

.pfg-item:hover .pfg-item-type-icon--video {
  background: rgba(220, 38, 38, 1);
}

/* Vimeo blue color variant */
.pfg-item-type-icon--vimeo {
  background: rgba(26, 183, 234, 0.85); /* Vimeo blue #1ab7ea */
}

.pfg-item:hover .pfg-item-type-icon--vimeo {
  background: rgba(26, 183, 234, 1);
}

.pfg-item-type-icon--link {
  background: var(--pfg-primary-color, rgba(59, 130, 246, 0.85));
}

.pfg-item:hover .pfg-item-type-icon--link {
  background: var(--pfg-primary-color, rgba(59, 130, 246, 1));
}

/* ==========================================================================
   Card Caption (title below image) - NOT overlay captions
   ========================================================================== */

.pfg-item-caption:not(.pfg-item-caption--overlay) {
  padding: 14px 16px;
  background: var(--pfg-caption-bg, #ffffff);
  /* Border radius is inherited from parent via overflow:hidden */
}

.pfg-item-caption:not(.pfg-item-caption--overlay) .pfg-item-title {
  margin: 0 0 4px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--pfg-caption-text, #1e293b);
  line-height: 1.4;
}

.pfg-item-caption:not(.pfg-item-caption--overlay) .pfg-item-categories {
  font-size: 13px;
  color: var(--pfg-filter-bg, #3858e9);
  font-weight: 500;
}

.pfg-item-caption:not(.pfg-item-caption--overlay) .pfg-item-number {
  margin-bottom: 8px;
  color: var(--pfg-caption-text, #1e293b);
}

/* ==========================================================================
   Dual Action Icons (link + lightbox)
   ========================================================================== */

.pfg-item-link--dual {
  display: block;
  position: relative;
  cursor: default;
}

.pfg-item-actions {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 16px;
  opacity: 0;
  z-index: 10;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pfg-item:hover .pfg-item-actions {
  opacity: 1;
}

.pfg-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #1e293b;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease;
}

.pfg-action-btn svg {
  width: 22px;
  height: 22px;
}

.pfg-action-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  background: #fff;
  color: var(--pfg-filter-bg, #3858e9);
}

.pfg-action-btn:active {
  transform: scale(1.05);
}

/* Background overlay when dual icons are shown */
.pfg-item-link--dual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
  pointer-events: none;
}

.pfg-item:hover .pfg-item-link--dual::before {
  opacity: 1;
}

/* Video play button */
.pfg-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--pfg-transition), background var(--pfg-transition);
}

.pfg-video-play svg {
  width: 24px;
  height: 24px;
  margin-left: 3px;
}

.pfg-item:hover .pfg-video-play {
  transform: translate(-50%, -50%) scale(1.1);
  background: #fff;
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */

/* Fade */
.pfg-item-hover--fade:hover .pfg-item-image {
  opacity: 0.85;
}

/* Zoom */
.pfg-item-hover--zoom:hover .pfg-item-image {
  transform: scale(1.08);
}

/* Lift */
.pfg-item-hover--lift {
  transition: transform var(--pfg-transition), box-shadow var(--pfg-transition);
}

.pfg-item-hover--lift:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Overlay */
.pfg-item-hover--overlay .pfg-item-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pfg-overlay-bg);
  opacity: 0;
  transition: opacity var(--pfg-transition);
}

.pfg-item-hover--overlay:hover .pfg-item-link::after {
  opacity: 1;
}

/* Slide up */
.pfg-item-hover--slide-up .pfg-item-overlay {
  transform: translateY(100%);
  opacity: 1;
}

.pfg-item-hover--slide-up:hover .pfg-item-overlay {
  transform: translateY(0);
}

/* Dark overlay */
.pfg-item-hover--dark-overlay .pfg-item-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity var(--pfg-transition);
}

.pfg-item-hover--dark-overlay:hover .pfg-item-link::after {
  opacity: 1;
}

/* Color reveal (for grayscale galleries) */
.pfg-item-hover--color-reveal .pfg-item-image {
  filter: grayscale(100%);
}

.pfg-item-hover--color-reveal:hover .pfg-item-image {
  filter: grayscale(0%);
}

/* Subtle */
.pfg-item-hover--subtle:hover .pfg-item-image {
  transform: scale(1.02);
}

/* Overlay zoom */
.pfg-item-hover--overlay-zoom .pfg-item-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pfg-overlay-bg);
  opacity: 0;
  transition: opacity var(--pfg-transition);
}

.pfg-item-hover--overlay-zoom:hover .pfg-item-link::after {
  opacity: 1;
}

.pfg-item-hover--overlay-zoom:hover .pfg-item-image {
  transform: scale(1.1);
}

/* Slide in */
.pfg-item-hover--slide-in .pfg-item-overlay {
  transform: translateX(-100%);
  opacity: 1;
  background: var(--pfg-overlay-bg);
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pfg-item-hover--slide-in:hover .pfg-item-overlay {
  transform: translateX(0);
}

/* ==========================================================================
   Error & Empty States
   ========================================================================== */

.pfg-error,
.pfg-empty {
  padding: 40px 20px;
  text-align: center;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
}

.pfg-empty {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}

/* ==========================================================================
   Animation for filtering
   ========================================================================== */

.pfg-item {
  animation: pfgFadeIn 0.4s ease;
}

@keyframes pfgFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.pfg-filter:focus-visible,
.pfg-item-link:focus-visible {
  outline: 2px solid var(--pfg-filter-bg);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .pfg-item,
  .pfg-item-image,
  .pfg-item-overlay,
  .pfg-filter,
  .pfg-video-play {
    transition: none;
    animation: none;
  }
}

/* ==========================================================================
   Print styles
   ========================================================================== */

@media print {
  .pfg-filters,
  .pfg-search,
  .pfg-item-overlay,
  .pfg-video-play {
    display: none;
  }

  .pfg-grid {
    display: block;
  }

  .pfg-item {
    page-break-inside: avoid;
    margin-bottom: 20px;
  }
}

/* ==========================================================================
   Pagination Styles
   ========================================================================== */

/* Hidden by pagination - remove from layout */
.pfg-item--paginated-hidden {
  display: none !important;
}

/* Pagination wrapper */
.pfg-pagination-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
  gap: 10px;
}

/* Load More Button */
.pfg-load-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: var(--pfg-filter-bg, #3858e9);
  color: var(--pfg-filter-text, #fff);
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pfg-load-more:hover {
  background: var(--pfg-filter-active-bg, #2d4ad4);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(56, 88, 233, 0.3);
}

.pfg-load-more:active {
  transform: translateY(0);
}

.pfg-load-more.loading {
  opacity: 0.7;
  pointer-events: none;
}

.pfg-load-more-count {
  opacity: 0.8;
  font-weight: 400;
  font-size: 13px;
}

.pfg-load-more-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pfgSpin 0.8s linear infinite;
}

/* Numbered Pagination */
.pfg-numbered-pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.pfg-pagination-btn {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #475569;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.pfg-pagination-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.pfg-pagination-btn.active {
  background: var(--pfg-filter-bg, #3858e9);
  color: var(--pfg-filter-text, #fff);
}

.pfg-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Infinite Scroll Loader */
.pfg-scroll-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  color: #64748b;
  font-size: 14px;
}

.pfg-scroll-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--pfg-filter-bg, #3858e9);
  border-radius: 50%;
  animation: pfgSpin 0.8s linear infinite;
}

.pfg-scroll-trigger {
  height: 1px;
  visibility: hidden;
}

@keyframes pfgSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Load more items animation */
@keyframes pfgSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   WooCommerce Product Gallery Styles
   ========================================================================== */

/* Product item container */
.pfg-product-item {
  position: relative;
}

.pfg-product-item .pfg-item-inner {
  position: relative;
  overflow: hidden;
}

/* Sale Badge */
.pfg-sale-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  padding: 4px 10px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Product Price */
.pfg-product-price {
  display: block;
  margin: 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.pfg-product-price del {
  opacity: 0.6;
  font-size: 13px;
  margin-right: 6px;
}

.pfg-product-price ins {
  text-decoration: none;
  color: #10b981;
}

/* View Product Button */
.pfg-view-product {
  display: inline-block;
  padding: 8px 20px;
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 25px;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.pfg-product-item:hover .pfg-view-product {
  background: #fff;
  color: #1e293b;
  border-color: #fff;
  transform: scale(1.05);
}

/* Out of Stock */
.pfg-out-of-stock .pfg-item-image {
  filter: grayscale(50%);
}

.pfg-out-of-stock::after {
  content: "Out of Stock";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 4px;
}

/* Product overlay enhancements */
.pfg-product-item .pfg-item-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.pfg-product-item .pfg-item-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

/* On Sale Animation */
.pfg-on-sale .pfg-sale-badge {
  animation: pfgPulse 2s ease-in-out infinite;
}

@keyframes pfgPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Product item hover effects */
.pfg-product-item .pfg-item-link:hover .pfg-item-image {
  transform: scale(1.05);
}

/* Product Caption Below Styles */
.pfg-product-item .pfg-item-caption {
  padding: 12px;
  text-align: center;
}

.pfg-product-caption-price {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: #16a34a;
}

.pfg-product-caption-price del {
  color: #94a3b8;
  font-weight: 400;
  margin-right: 6px;
}

.pfg-product-caption-price ins {
  text-decoration: none;
  color: #16a34a;
}

/* View Product Button in Caption */
.pfg-product-caption {
  text-align: center;
}

.pfg-view-product-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 18px;
  background: var(--pfg-primary-color, #3858e9);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.pfg-view-product-btn:hover {
  background: var(--pfg-hover-color, #2d4ad4);
  color: #fff;
  transform: translateY(-2px);
}



/* Caption in overlay mode - inside link */
.pfg-item-caption--overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 15px;
  background: linear-gradient(
    transparent,
    var(--pfg-overlay-color, rgba(0, 0, 0, 0.7))
  );
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pfg-item-link:hover .pfg-item-caption--overlay {
  opacity: 1;
  transform: translateY(0);
}

/* Product Hover Effects - same as images */
.pfg-item[data-id] .pfg-item-link:hover .pfg-item-image {
  transform: scale(1.05);
}

/* Product overlay - gradient at bottom like images */
.pfg-item .pfg-item-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  background: linear-gradient(to top, var(--pfg-overlay-color, rgba(0, 0, 0, 0.7)) 0%, transparent 100%);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px 15px;
  text-align: left;
  min-height: 80px;
}

.pfg-item .pfg-item-link:hover .pfg-item-overlay {
  opacity: 1;
  transform: translateY(0);
}

/* Product price in overlay */
.pfg-item .pfg-product-price {
  color: var(--pfg-title-color, #fff);
  font-size: 16px;
  font-weight: 600;
  margin-top: 6px;
}

.pfg-item .pfg-product-price del {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 400;
  margin-right: 6px;
}

.pfg-item .pfg-product-price ins {
  text-decoration: none;
}

/* Sale badge positioning */
.pfg-item .pfg-sale-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
}

/* ==========================================================================
   Watermark Overlay
   ========================================================================== */

.pfg-watermark {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  padding: 8px 12px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Watermark text styling */
.pfg-watermark-text {
  display: inline-block;
  white-space: nowrap;
}

/* Watermark image styling */
.pfg-watermark-image {
  max-width: 80px;
  max-height: 40px;
  width: auto;
  height: auto;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Position variants */
.pfg-watermark--top-left {
  top: 10px;
  left: 10px;
}

.pfg-watermark--top-center {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.pfg-watermark--top-right {
  top: 10px;
  right: 10px;
}

.pfg-watermark--center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.pfg-watermark--bottom-left {
  bottom: 10px;
  left: 10px;
}

.pfg-watermark--bottom-center {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.pfg-watermark--bottom-right {
  bottom: 10px;
  right: 10px;
}

/* Ensure proper positioning context for watermark */
.pfg-item-link {
  position: relative;
}

.pfg-item-link--dual {
  position: relative;
}

