/* === Portfolio Page === */

:root {
  --pf-gap: 6px;
  --pf-bg: #0f0f0f;
  --pf-header-h: 56px;
  --pf-control-top: 0.6rem;
  --pf-control-size: 36px;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--pf-bg);
  color: rgba(255, 255, 255, 0.85);
  font-family: "Bebas Neue", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === Header === */

.pf-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--pf-header-h);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 2vw;
  background: rgba(15, 15, 15, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.pf-back {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  font-size: clamp(0.85rem, 2vw, 1rem);
  letter-spacing: 0.12em;
  transition: color 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.pf-back:hover {
  color: #fff;
}

/* === Filter Toggle + Dropdown === */

.pf-filter {
  position: fixed;
  top: var(--pf-control-top);
  left: 1rem;
  right: auto;
  z-index: 1098;
  display: flex;
  align-items: center;
}

.pf-cat-toggle,
.pf-cat-btn {
  background: rgba(14, 14, 14, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.72);
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(0.8rem, 1.6vw, 0.95rem);
  letter-spacing: 0.13em;
  padding: 0.18em 0.82em;
  min-height: var(--pf-control-size);
  border-radius: 3px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.25s ease;
  white-space: nowrap;
}

.pf-cat-toggle:hover,
.pf-cat-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(20, 20, 20, 0.78);
}

.pf-cat-toggle.filtered,
.pf-cat-btn.active {
  color: #fff;
  border-color: #fff;
  background: rgba(24, 24, 24, 0.84);
}

/* === Kategorie-Dropdown === */

.pf-cat-dropdown {
  position: fixed;
  top: var(--pf-header-h);
  left: 0;
  right: 0;
  z-index: 99;
  background: rgba(15, 15, 15, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  padding: 0 2vw;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

.pf-cat-dropdown.open {
  max-height: min(70vh, 560px);
  padding: 0.75em 2vw;
  opacity: 1;
  pointer-events: all;
  overflow-y: auto;
  overflow-x: hidden;
}

.pf-cat-group {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.pf-cat-group-sub {
  min-height: 34px;
  align-items: flex-start;
}

.pf-sub-placeholder {
  min-height: 34px;
  width: 100%;
  opacity: 0;
  pointer-events: none;
}

/* === Gallery Container === */

.pf-gallery {
  position: relative;
  width: 100%;
}

/* === Gallery Items === */

.pf-item {
  position: absolute;
  overflow: hidden;
  cursor: pointer;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Entrance: alle Items unsichtbar bis .loaded gesetzt wird */
.pf-gallery:not(.loaded) .pf-item {
  opacity: 0;
  transform: translateY(14px);
}

.pf-item[data-visible="false"] {
  opacity: 0;
  pointer-events: none;
}

.pf-item[data-visible="true"] {
  opacity: 1;
}

.pf-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.pf-item:hover img {
  transform: scale(1.04);
}

/* === Lightbox === */

.pf-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.pf-lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.pf-lb-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  display: block;
  transition: opacity 0.15s ease;
}

.pf-lb-close {
  position: absolute;
  top: var(--pf-control-top);
  left: 1rem;
  right: auto;
  background: rgba(14, 14, 14, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
  width: var(--pf-control-size);
  height: var(--pf-control-size);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.25s ease;
  z-index: 10;
  line-height: 1;
}

.pf-lb-close:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.52);
  background: rgba(20, 20, 20, 0.78);
}

.pf-lb-prev,
.pf-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.55);
  font-family: "Bebas Neue", sans-serif;
  font-size: 2.2rem;
  width: 2.8rem;
  height: 5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease;
  z-index: 10;
  line-height: 1;
  padding-bottom: 0.1em;
}

.pf-lb-prev {
  left: 1.2rem;
}

.pf-lb-next {
  right: 1.2rem;
}

.pf-lb-prev:hover,
.pf-lb-next:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

/* Arrow-Buttons nur auf Desktop */
@media (max-width: 1024px) {
  .pf-filter {
    left: 1rem;
    right: auto;
  }

  .pf-cat-toggle,
  .pf-cat-btn {
    min-height: 34px;
  }

  .pf-cat-group-sub {
    min-height: 34px;
  }

  .pf-sub-placeholder {
    min-height: 34px;
  }

  /* Mobile stabil halten: Haupt- und Unterkategorie behalten konstante Zeilenhöhe */
  .pf-cat-group-main,
  .pf-cat-group-sub {
    min-height: 72px;
    align-content: flex-start;
  }

  .pf-lb-prev,
  .pf-lb-next {
    display: none;
  }

  /* Dropdown auf Mobile: volle Kategorienliste sichtbar */
  .pf-cat-dropdown {
    flex-wrap: wrap;
    max-height: min(72vh, 560px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .pf-cat-dropdown.open {
    max-height: min(72vh, 560px);
    overflow-y: auto;
    overflow-x: hidden;
  }
}
