/*
 * Portfolio-galerij (template-parts/sections/section-portfolio.php).
 * Filterknoppen, raster met vierkante tegels, "Toon meer" en de lightbox.
 * Alleen geladen op pagina's met deze sectie (functions.php).
 */

.js-portfolio [hidden] {
  display: none !important;
}

/* --- Filterknoppen (zelfde stijl als de stoffilter in de configurator) --- */
.portfolio-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-bottom: var(--gutter-2);
}
.portfolio-filter-pill {
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 0.7rem 1.6rem;
  border: 0.1rem solid var(--medium-grey-color);
  border-radius: 10rem;
  background-color: var(--white);
  color: var(--text-color);
  cursor: pointer;
  transition: var(--transition);
}
.portfolio-filter-pill:hover {
  border-color: var(--secondary-color);
}
.portfolio-filter-pill.active {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: var(--white);
}

/* --- Raster --- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (width < 992px) {
  .portfolio-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (width < 768px) {
  .portfolio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }
}
.portfolio-tegel {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  overflow: hidden;
  background-color: var(--light-grey-color);
  cursor: zoom-in;
}
.portfolio-tegel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.portfolio-tegel:hover img,
.portfolio-tegel:focus-visible img {
  transform: scale(1.05);
}
.portfolio-tegel:focus-visible {
  outline: 0.3rem solid var(--primary-color);
  outline-offset: 0.2rem;
}
.portfolio-item[data-type="video"] .portfolio-tegel {
  cursor: pointer;
}
/* Play-knop op video-tegels. */
.portfolio-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5.6rem;
  height: 5.6rem;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: var(--white);
  transition: var(--transition);
}
.portfolio-tegel:hover .portfolio-play {
  transform: translate(-50%, -50%) scale(1.08);
}
/* Optionele tekst: onderin de tegel, zichtbaar bij hover/focus. */
.portfolio-tekst {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.4rem 1.2rem 1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
  color: var(--white);
  font-size: var(--fs-sm);
  text-align: left;
  line-height: 1.35;
  opacity: 0;
  transition: var(--transition);
}
.portfolio-tegel:hover .portfolio-tekst,
.portfolio-tegel:focus-visible .portfolio-tekst {
  opacity: 1;
}
@media (hover: none) {
  .portfolio-tekst {
    display: none; /* op touch alleen in de grote weergave */
  }
}

.portfolio-meer {
  display: flex;
  justify-content: center;
  margin-top: var(--gutter-2);
}

/* --- Lightbox --- */
html.portfolio-lb-open {
  overflow: hidden;
}
.portfolio-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  padding: 6rem 2rem 2rem;
  background-color: rgba(0, 0, 0, 0.9);
}
.portfolio-lightbox[hidden] {
  display: none;
}
.portfolio-lb-inhoud {
  margin: 0;
  max-width: min(120rem, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}
.portfolio-lb-media img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 14rem);
  object-fit: contain;
}
.portfolio-lb-media.is-video {
  width: min(120rem, calc(100vw - 16rem), calc((100dvh - 14rem) * 16 / 9));
  aspect-ratio: 16 / 9;
}
.portfolio-lb-media.is-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.portfolio-lb-tekst {
  color: var(--white);
  font-size: var(--fs-md);
  text-align: center;
  max-width: 72rem;
}
.portfolio-lb-sluit,
.portfolio-lb-pijl {
  flex: none;
  width: 4.8rem;
  height: 4.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.1rem solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: transparent;
  color: var(--white);
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}
.portfolio-lb-sluit:hover,
.portfolio-lb-pijl:hover,
.portfolio-lb-sluit:focus-visible,
.portfolio-lb-pijl:focus-visible {
  background-color: var(--white);
  color: var(--text-color);
}
.portfolio-lb-sluit {
  position: absolute;
  top: 1.6rem;
  right: 1.6rem;
  font-size: 3rem;
}
@media (width < 768px) {
  /* Pijlen onderin; swipen werkt ook. */
  .portfolio-lightbox {
    padding: 6rem 1rem 8rem;
  }
  .portfolio-lb-pijl {
    position: absolute;
    bottom: 1.6rem;
  }
  .portfolio-lb-vorige {
    left: calc(50% - 6rem);
  }
  .portfolio-lb-volgende {
    right: calc(50% - 6rem);
  }
  .portfolio-lb-media.is-video {
    width: calc(100vw - 2rem);
  }
}
