/**********************************************
 PORTFOLIO PAGE — SCOPED STYLING ONLY
 (place this file at assets/css/portfolio.css)
**********************************************/

/* --- page-scoped reset to avoid leaking global header/footer styles --- */
.portfolio-page,
.portfolio-page * {
  box-sizing: border-box;
  font-family: inherit; /* keep template font but avoid weird overrides */
  color: inherit;
}

/* make sure the immediate container doesn't inherit dark overlays */
.portfolio-page {
  background: transparent;
  color: #1b1b1b;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ FILTER BUTTONS ============ */
.portfolio-page .td-portfolio-filter-btn {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 12px;
}

/* Center active filter on mobile */
@media (max-width: 768px) {
  .portfolio-page .td-portfolio-filter-btn {
    justify-content: flex-start;
  }
}
.portfolio-page .td-portfolio-filter-btn button {
  border: 0;
  background: rgba(0,0,0,0.03);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  color: #111;
  transition: background 200ms ease, transform 160ms ease;
}
.portfolio-page .td-portfolio-filter-btn button:hover {
  transform: translateY(-2px);
  background: rgba(0,0,0,0.06);
}
.portfolio-page .td-portfolio-filter-btn button.active {
  background: #0b0b0b;
  color: #fff;
  box-shadow: 0 6px 20px rgba(11,11,11,0.18);
}

/* mobile visual indicator */
.portfolio-page .td-portfolio-filter-btn::-webkit-scrollbar { height: 6px; }
.portfolio-page .td-portfolio-filter-btn::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 6px; }

/* Ensure scrollbar is visible on mobile */
.portfolio-page .td-portfolio-filter-btn {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}

/* Add gradient fade effect to indicate more content */
.portfolio-page .td-portfolio-filter-btn::before,
.portfolio-page .td-portfolio-filter-btn::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.portfolio-page .td-portfolio-filter-btn::before {
  left: 0;
  background: linear-gradient(to right, white, transparent);
}

.portfolio-page .td-portfolio-filter-btn::after {
  right: 0;
  background: linear-gradient(to left, white, transparent);
}

.portfolio-page .td-portfolio-filter-btn[data-scrolled="true"]::before,
.portfolio-page .td-portfolio-filter-btn[data-scrolled="true"]::after {
  opacity: 1;
}

/* ============ PORTFOLIO GRID ============ */
.portfolio-page .grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 0 -12px;
}
.portfolio-page .grid-item {
  padding: 0 12px;
  flex: 1 1 calc(33.333% - 24px);
}
@media (max-width: 992px) {
  .portfolio-page .grid-item { flex: 1 1 calc(50% - 20px); }
}
@media (max-width: 600px) {
  .portfolio-page .grid-item { flex: 1 1 100%; padding: 0 8px; }
}

/* ============ CARD WRAPPER ============ */
.portfolio-page .td-portfolio-filter-wrapper {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  transition: transform .25s ease, box-shadow .25s ease;
  min-height: 220px;
  box-shadow: 0 6px 18px rgba(12,12,12,0.06);
  cursor: pointer;
  display: flex;
  align-items: stretch;
}
.portfolio-page .td-portfolio-filter-wrapper:focus { outline: 2px solid rgba(11,94,255,0.12); outline-offset: 4px; }
.portfolio-page .td-portfolio-filter-wrapper:hover { transform: translateY(-6px); box-shadow: 0 10px 30px rgba(12,12,12,0.12); }

/* ============ IMAGE & VIDEO ============ */
.portfolio-page .td-portfolio-filter-thumb {
  width: 100%;
  height: 100%;
  display: block;
}
.portfolio-page .td-portfolio-filter-thumb img,
.portfolio-page .td-portfolio-filter-thumb video {
  width: 100%;
  height: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
}

/* small caption placeholder if you want later */
.portfolio-page .td-portfolio-filter-caption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  color: #fff;
  text-shadow: 0 3px 10px rgba(0,0,0,0.6);
  font-weight: 700;
  font-size: 14px;
}

/**********************************************
 LIGHTBOX (RESPONSIVE)
**********************************************/
#lightboxOverlay.portfolio-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(3,3,3,0.95);
  display: none;
  justify-content: center;
  align-items: center;
  padding: 18px;
  z-index: 99999;
  flex-direction: column;
}

/* Remove lightbox scrollbars completely */
#lightboxOverlay {
  overflow: hidden !important;
}

#lightboxContent {
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 auto !important;
  max-height: 90vh !important;
}

/* Make sure main area never exceeds the viewport */
.lb-main {
  max-height: 80vh !important;
  overflow: hidden !important;
}

/* Ensure image/video adjusts and never causes scroll */
.lb-main img,
.lb-main video {
  max-height: 80vh !important;
  height: auto !important;
  object-fit: contain !important;
}

/* content area */
.portfolio-page .lb-main {
  width: 100%;
  max-width: 1200px;
  max-height: 78vh;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}
.portfolio-page .lb-main img,
.portfolio-page .lb-main video,
.portfolio-page .lb-main .lb-placeholder {
  width: 100%;
  height: auto;
  max-height: 78vh;
  border-radius: 12px;
  object-fit: contain;
  display: block;
  background: #111;
}

/* loader */
.portfolio-page #lbLoader {
  display: none;
  color: #fff;
  font-size: 14px;
  margin-top: 8px;
}

/* THUMBNAILS */
.portfolio-page .lb-thumbs {
  width: 100%;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px;
  align-items: center;
}
.portfolio-page .lb-thumb {
  flex: 0 0 auto;
  width: 90px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #222;
}
.portfolio-page .lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portfolio-page .lb-thumb.active { border-color: #fff; transform: scale(1.03); box-shadow: 0 6px 16px rgba(0,0,0,0.6); }

/* NAVIGATION */
.portfolio-page .lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 32px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  padding: 10px 14px;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}
#lbPrev { left: 18px; }
#lbNext { right: 18px; }

/* CLOSE BUTTON */
#lightboxClose {
  position: absolute;
  top: 12px;
  right: 18px;
  font-size: 28px;
  background: rgba(255,255,255,0.06);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

/* responsive tweaks */
@media (max-width: 992px) {
  .portfolio-page .lb-nav { font-size: 24px; padding: 8px 10px; }
  #lbPrev { left: 8px; }
  #lbNext { right: 8px; }
  .portfolio-page .lb-thumb { width: 74px; height: 54px; }
}

@media (max-width: 600px) {
  .portfolio-page .lb-main { max-height: 62vh; }
  .portfolio-page .lb-thumb { width: 64px; height: 44px; }
}
