/* ============================================================
   Visual Portfolio Pro — Frontend Styles v1.1
   ============================================================ */

:root {
  /* These defaults are overridden by inline CSS from settings */
  --vpp-accent:            #c9a96e;
  --vpp-dark:              #1a1a1a;
  --vpp-mid:               #555;
  --vpp-light:             #f8f7f5;
  --vpp-white:             #ffffff;
  --vpp-radius:            4px;
  --vpp-gap:               20px;
  --vpp-transition:        0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --vpp-font-title:        'Cormorant Garamond', Georgia, serif;
  --vpp-font-body:         'Jost', sans-serif;
  /* Color overrides (set by inline CSS from settings) */
  --vpp-cat-title-size:    13px;
  --vpp-cat-title-color:   #1a1a1a;
  --vpp-cat-desc-color:    #555555;
  --vpp-item-title-color:  #1a1a1a;
  --vpp-item-loc-color:    #555555;
  --vpp-sec-title-color:   #1a1a1a;
  --vpp-back-btn-color:    #1a1a1a;
  --vpp-back-btn-hover-bg:    #1a1a1a;
  --vpp-back-btn-hover-color: #ffffff;
  /* Background color overrides (set by inline CSS from settings) */
  --vpp-bg-wrap:           transparent;
  --vpp-bg-cat-thumb:      #1a1a1a;
  --vpp-bg-placeholder:    #111111;
  --vpp-bg-item-thumb:     #222222;
  --vpp-border-item:       #e8e4df;
  --vpp-bg-cat-info:       transparent;
}

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;500;600&family=Jost:wght@300;400;500&display=swap');

/* ── Wrapper ─────────────────────────────────────────────── */
/* No max-width / padding here — the container width and spacing
   are controlled by Elementor (or the theme). The plugin fills
   whatever space is given to it. */
.vpp-portfolio-wrap {
  font-family: var(--vpp-font-body);
  color: var(--vpp-dark);
  width: 100%;
  background: var(--vpp-bg-wrap);
  /* Contain this widget's own stacking context so its content can
     never paint over sibling Elementor sections below/above it,
     even if the section overflows on small screens. */
  isolation: isolate;
}

/* ── Category Grid ───────────────────────────────────────── */
.vpp-categories-grid {
  display: grid;
  /* Default fallback — overridden by .vpp-cat-cols-N + inline CSS */
  grid-template-columns: repeat(auto-fill, minmax(max(120px, calc(100% / 5 - 1px)), 1fr));
  gap: 0;
}

/* Responsive breakpoints — minimum 2 columns always */
@media (max-width: 1100px) { .vpp-categories-grid { grid-template-columns: repeat(auto-fill, minmax(max(120px, calc(100% / 3 - 1px)), 1fr)); } }
@media (max-width: 700px)  { .vpp-categories-grid { grid-template-columns: repeat(2, 1fr); } }
/* Never go to 1 column — always keep 2 cols on mobile */

/* Extra breathing room below the last row on mobile so the next
   Elementor section can never sit on top of / hide the last row's
   title block, regardless of that section's own spacing. */
@media (max-width: 700px) {
  .vpp-categories-grid {
    padding-bottom: 40px;
  }
}

/* Tighter letter-spacing/size on mobile so long category names
   (e.g. "Weddings & Engagements") fit on a single line instead of
   wrapping to a 2nd line that can get clipped by the next section. */
@media (max-width: 700px) {
  .vpp-cat-title {
    font-size: 11px;
    letter-spacing: .08em;
  }
}

.vpp-cat-card {
  cursor: pointer;
  position: relative;
  /* No overflow:hidden here — clipping is handled by the thumb itself */
}

.vpp-cat-thumb {
  aspect-ratio: 3 / 4;
  position: relative;
  overflow: hidden; /* clips the zoom */
  background-color: var(--vpp-bg-cat-thumb);
}

/* On mobile, use a less tall ratio so grid doesn't become enormous */
@media (max-width: 700px) {
  .vpp-cat-thumb {
    aspect-ratio: 4 / 5;
  }
}

/* On very small screens, shrink further — 2-col grid x flatter ratio
   keeps total section height reasonable and avoids overflow into
   the next Elementor section */
@media (max-width: 460px) {
  .vpp-cat-thumb {
    aspect-ratio: 1 / 1;
  }
}

/* Cover image via ::before so we scale it without touching layout */
.vpp-cat-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: inherit;
  background-size: cover;
  background-position: center;
  transition: transform var(--vpp-transition);
}
.vpp-cat-card:hover .vpp-cat-thumb::before {
  transform: scale(1.06);
}

/* Generic placeholder: SVG inline via CSS */
.vpp-cat-thumb-placeholder {
  background-image: none !important;
  background-color: var(--vpp-bg-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Suppress the zoom ::before on placeholders — nothing to zoom */
.vpp-cat-thumb-placeholder::before {
  display: none !important;
}
.vpp-cat-thumb-placeholder::after {
  content: '';
  display: block;
  width: 60px;
  height: 60px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 60' fill='none'%3E%3Crect x='8' y='12' width='44' height='36' rx='3' stroke='%23c9a96e' stroke-width='1.5'/%3E%3Ccircle cx='22' cy='24' r='5' stroke='%23c9a96e' stroke-width='1.5'/%3E%3Cpolyline points='8,42 24,26 36,36 46,24 52,30' stroke='%23c9a96e' stroke-width='1.5'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: .6;
}

.vpp-cat-overlay {
  position: absolute;
  inset: 0;
  z-index: 1; /* above the ::before image layer */
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 55%);
  display: flex;
  align-items: flex-end;
  padding: 16px 14px;
  opacity: 0;
  transition: opacity var(--vpp-transition);
}
.vpp-cat-card:hover .vpp-cat-overlay { opacity: 1; }

.vpp-cat-count {
  color: rgba(255,255,255,.85);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.vpp-cat-info {
  padding: 16px 10px 20px;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: border-color var(--vpp-transition);
  background: var(--vpp-bg-cat-info);
}
.vpp-cat-card:hover .vpp-cat-info {
  border-bottom-color: var(--vpp-accent);
}

.vpp-cat-title {
  font-family: var(--vpp-font-title);
  font-size: var(--vpp-cat-title-size);
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin: 0 0 4px;
  color: var(--vpp-cat-title-color);
}

.vpp-cat-desc {
  font-size: 12px;
  color: var(--vpp-cat-desc-color);
  margin: 0;
}

/* ── Items container ─────────────────────────────────────── */
.vpp-items-container {
  width: 100%;
  /* The next Elementor section (e.g. testimonials) overlaps this
     block on mobile by a fixed offset baked into that section's own
     spacing. Keep this block ABOVE that overlap so it always renders
     fully (including the back button) before the next section starts. */
  position: relative;
  z-index: 1;
}

/* Extra bottom buffer on mobile — the items grid goes to 1 column and
   gets much taller, so it needs more room before the next section. */
@media (max-width: 700px) {
  .vpp-items-container {
    padding-bottom: 40px;
  }
}

/* ── Category title (items view) ────────────────────────── */
.vpp-category-title {
  font-family: var(--vpp-font-title);
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 300;
  letter-spacing: .2em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 10px;
  color: var(--vpp-sec-title-color);
}
.vpp-category-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--vpp-accent);
  margin: 12px auto 40px;
}

/* ── Back button — now at the bottom ────────────────────── */
.vpp-back-wrap {
  display: flex;
  justify-content: center;
  margin-top: 0;
  padding-top: 20px;
  padding-bottom: 60px;
}

.vpp-back-btn {
  background: transparent !important;
  border: 1px solid var(--vpp-back-btn-color) !important;
  padding: 10px 28px;
  font-family: var(--vpp-font-body);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--vpp-back-btn-color) !important;
  transition: all var(--vpp-transition);
}
.vpp-back-btn:hover {
  background: var(--vpp-back-btn-hover-bg) !important;
  color: var(--vpp-back-btn-hover-color) !important;
  border-color: var(--vpp-back-btn-hover-bg) !important;
}

/* ── Items grid ──────────────────────────────────────────── */
.vpp-items-grid {
  display: grid;
  gap: var(--vpp-gap);
  grid-template-columns: repeat(3, 1fr); /* default — overridden by .vpp-cols-N */
}
.vpp-items-grid.vpp-cols-2 { grid-template-columns: repeat(2, 1fr); }
.vpp-items-grid.vpp-cols-4 { grid-template-columns: repeat(4, 1fr); }
.vpp-items-grid.vpp-cols-5 { grid-template-columns: repeat(5, 1fr); }
.vpp-items-grid.vpp-cols-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1100px) {
  .vpp-items-grid.vpp-cols-5,
  .vpp-items-grid.vpp-cols-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .vpp-items-grid,
  .vpp-items-grid.vpp-cols-2,
  .vpp-items-grid.vpp-cols-4,
  .vpp-items-grid.vpp-cols-5,
  .vpp-items-grid.vpp-cols-6 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 520px) {
  .vpp-items-grid,
  .vpp-items-grid.vpp-cols-2,
  .vpp-items-grid.vpp-cols-4,
  .vpp-items-grid.vpp-cols-5,
  .vpp-items-grid.vpp-cols-6 { grid-template-columns: 1fr !important; }
}

/* ── Item Card ───────────────────────────────────────────── */
.vpp-item-card {
  cursor: pointer;
  /* No overflow:hidden here — card must never push into the grid */
}

.vpp-item-thumb {
  aspect-ratio: 4 / 3;
  position: relative;
  overflow: hidden; /* clips the zoom inside the thumb box */
  background-color: var(--vpp-bg-item-thumb);
}

/* The actual cover image lives in a ::before pseudo so we can
   scale it independently without touching layout or clipping */
.vpp-item-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: inherit;
  background-size: cover;
  background-position: center;
  transition: transform var(--vpp-transition);
}
.vpp-item-card:hover .vpp-item-thumb::before {
  transform: scale(1.06);
}

.vpp-item-overlay {
  position: absolute;
  inset: 0;
  z-index: 1; /* above the ::before image layer */
  background: rgba(0,0,0,.28);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--vpp-transition);
}
.vpp-item-card:hover .vpp-item-overlay { opacity: 1; }

.vpp-type-icon {
  width: 52px;
  height: 52px;
  border: 2px solid #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transform: scale(.8);
  transition: transform var(--vpp-transition);
}
.vpp-type-icon svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
}
.vpp-item-card:hover .vpp-type-icon { transform: scale(1); }

/* Video badge always visible — uses ::after because ::before is the zoom image layer */
.vpp-item-card[data-type="video"] .vpp-item-thumb::after {
  content: '▶';
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 3px;
  z-index: 2;
  letter-spacing: .05em;
}

.vpp-item-meta {
  padding: 12px 4px 16px;
  text-align: center;
}

.vpp-item-title {
  font-family: var(--vpp-font-title);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin: 0 0 4px;
  color: var(--vpp-item-title-color);
}

/* Subcategory location (only rendered when term->parent > 0) */
.vpp-cat-location {
  display: block;
  font-size: 11px;
  color: var(--vpp-item-loc-color);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── Lightbox ────────────────────────────────────────────── */
.vpp-lightbox {
  position: fixed;
  inset: 0;
  /* Max signed 32-bit int — guaranteed above any Elementor / theme / plugin element */
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Small safety padding so nav buttons never touch viewport edge */
  padding: 20px;
}

.vpp-lb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 10, .93);
  backdrop-filter: blur(4px);
}

.vpp-lb-content {
  position: relative;
  z-index: 1;
  width: 92vw;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.vpp-lb-media {
  width: 100%;
  max-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vpp-lb-media img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
}
.vpp-lb-media iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
}

.vpp-lb-info {
  margin-top: 16px;
  text-align: center;
  color: #fff;
}
.vpp-lb-title {
  font-family: var(--vpp-font-title);
  font-size: 20px;
  font-weight: 300;
  letter-spacing: .15em;
  text-transform: uppercase;
  margin: 0 0 4px;
}

.vpp-lb-close,
.vpp-lb-prev,
.vpp-lb-next {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 32px;
  line-height: 1;
  padding: 8px;
  transition: opacity .2s, transform .2s;
  opacity: .8;
}
.vpp-lb-close:hover, .vpp-lb-prev:hover, .vpp-lb-next:hover { opacity: 1; }

.vpp-lb-close { top: -40px; right: 0; font-size: 28px; }
.vpp-lb-prev  { left: -52px; top: 50%; transform: translateY(-50%); font-size: 44px; }
.vpp-lb-next  { right: -52px; top: 50%; transform: translateY(-50%); font-size: 44px; }
.vpp-lb-prev:hover { transform: translateY(-50%) translateX(-3px); }
.vpp-lb-next:hover { transform: translateY(-50%) translateX(3px); }

@media (max-width: 768px) {
  .vpp-lb-prev { left: 4px; font-size: 32px; }
  .vpp-lb-next { right: 4px; font-size: 32px; }
  .vpp-lb-close { top: -36px; }
}

/* ── Loading spinner ─────────────────────────────────────── */
.vpp-spinner {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}
.vpp-spinner::after {
  content: '';
  width: 36px;
  height: 36px;
  border: 2px solid #ddd;
  border-top-color: var(--vpp-accent);
  border-radius: 50%;
  animation: vpp-spin .7s linear infinite;
}
@keyframes vpp-spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────── */
.vpp-empty {
  text-align: center;
  color: var(--vpp-mid);
  font-size: 14px;
  padding: 60px 0;
}

/* ── Fade-in animation ───────────────────────────────────── */
.vpp-item-card, .vpp-cat-card {
  animation: vpp-fadein .4s ease both;
}
@keyframes vpp-fadein {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
