/* Portfolio category galleries */
.is-portfolio .inner-page,
.is-portfolio .site-shell {
  overflow: visible;
}

body.portfolio-loading .portfolio-scroll {
  opacity: 0;
  pointer-events: none;
}

.portfolio-scroll__hint {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 2rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.portfolio-scroll__hint span {
  width: 2rem;
  height: 1px;
  background: var(--accent);
}

.portfolio-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: end;
  margin-bottom: clamp(2rem, 5vw, 4rem);
  padding-bottom: clamp(1.5rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(215, 196, 106, 0.16);
}

.portfolio-intro__copy {
  max-width: 760px;
}

.portfolio-intro h2 {
  margin: 0.75rem 0 1rem;
  max-width: 12ch;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 0.9;
  text-transform: uppercase;
}

.portfolio-intro__nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.portfolio-intro__nav a {
  display: flex;
  align-items: center;
  min-height: 3.1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(215, 196, 106, 0.26);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.25;
  text-transform: uppercase;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.025);
}

.portfolio-intro__nav a:hover {
  border-color: var(--accent);
  background: rgba(215, 196, 106, 0.08);
}

.portfolio-scroll__chapter {
  margin-bottom: clamp(3rem, 8vw, 6rem);
}

/* Galerie über Seiten-Padding hinaus — kein schwarzer Rand links/rechts */
.is-portfolio .portfolio-scroll__chapter .gallery-wrap {
  width: min(100%, 1380px);
  max-width: calc(100vw - 2 * clamp(0.75rem, 2vw, 1.5rem));
  margin-left: auto;
  margin-right: auto;
}

.portfolio-scroll__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 2rem;
  align-items: end;
  padding: 0 0 1.25rem;
  max-width: min(1380px, calc(100vw - 2 * clamp(0.75rem, 2vw, 1.5rem)));
  margin-inline: auto;
}

.portfolio-scroll__subtitle {
  margin: 0.5rem 0 1.25rem;
  color: var(--muted);
  line-height: 1.55;
  max-width: 34rem;
}

.portfolio-scroll__head .btn {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.gallery-wrap {
  position: relative;
  width: 100%;
  height: min(82vh, 760px);
  min-height: 620px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8vh auto 12vh;
  overflow: hidden;
  box-sizing: border-box;
}

.gallery {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  flex: none;
  box-sizing: border-box;
}

/* Layout presets for the portfolio categories */
.gallery--product,
.gallery--space,
.gallery--clarity {
  display: grid;
  gap: clamp(0.45rem, 1vw, 0.85rem);
  transform-origin: center center;
}

.gallery--product {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  justify-content: center;
  align-content: center;
}

.gallery--product .gallery__item:nth-child(1) { grid-area: 1 / 1 / 3 / 2; }
.gallery--product .gallery__item:nth-child(2) { grid-area: 1 / 2 / 2 / 3; }
.gallery--product .gallery__item:nth-child(3) { grid-area: 2 / 2 / 4 / 3; }
.gallery--product .gallery__item:nth-child(4) { grid-area: 1 / 3 / 3 / 4; }
.gallery--product .gallery__item:nth-child(5) { grid-area: 3 / 1 / 4 / 2; }
.gallery--product .gallery__item:nth-child(6) { grid-area: 3 / 3 / 5 / 4; }
.gallery--product .gallery__item:nth-child(7) { grid-area: 4 / 1 / 5 / 2; }
.gallery--product .gallery__item:nth-child(8) { grid-area: 4 / 2 / 5 / 3; }

.gallery--taste {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.45rem, 1.1vw, 1rem);
  padding-inline: clamp(0.3rem, 1vw, 0.8rem);
}

.gallery--taste .gallery__item {
  flex: none;
  width: auto;
  aspect-ratio: 2 / 3;
}

.gallery--taste .gallery__item:nth-child(1),
.gallery--taste .gallery__item:nth-child(8) { height: 20%; }
.gallery--taste .gallery__item:nth-child(2),
.gallery--taste .gallery__item:nth-child(7) { height: 28%; }
.gallery--taste .gallery__item:nth-child(3) { height: 56%; }
.gallery--taste .gallery__item:nth-child(4),
.gallery--taste .gallery__item:nth-child(6) { height: 42%; }
.gallery--taste .gallery__item:nth-child(5) { height: 34%; }

.gallery--space {
  grid-template-columns: 1.15fr 0.9fr 1.05fr 0.85fr;
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.gallery--space .gallery__item:nth-child(1) { grid-area: 1 / 1 / 3 / 2; }
.gallery--space .gallery__item:nth-child(2) { grid-area: 1 / 2 / 2 / 3; }
.gallery--space .gallery__item:nth-child(3) { grid-area: 1 / 3 / 4 / 5; }
.gallery--space .gallery__item:nth-child(4) { grid-area: 2 / 2 / 4 / 3; }
.gallery--space .gallery__item:nth-child(5) { grid-area: 3 / 1 / 5 / 2; }
.gallery--space .gallery__item:nth-child(6) { grid-area: 4 / 3 / 5 / 4; }
.gallery--space .gallery__item:nth-child(7) { grid-area: 4 / 4 / 5 / 5; }
.gallery--space .gallery__item:nth-child(8) { grid-area: 4 / 2 / 5 / 3; }

.gallery--portrait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.55rem, 1vw, 0.9rem);
  padding-inline: clamp(0.5rem, 1.5vw, 1rem);
}

.gallery--portrait .gallery__item {
  flex: 0 1 12%;
  aspect-ratio: 3 / 4;
}

.gallery--portrait .gallery__item:nth-child(1),
.gallery--portrait .gallery__item:nth-child(8) { height: 42%; }
.gallery--portrait .gallery__item:nth-child(2),
.gallery--portrait .gallery__item:nth-child(7) { height: 52%; }
.gallery--portrait .gallery__item:nth-child(3) { height: 70%; }
.gallery--portrait .gallery__item:nth-child(4),
.gallery--portrait .gallery__item:nth-child(6) { height: 58%; }
.gallery--portrait .gallery__item:nth-child(5) { height: 48%; }

.gallery--clarity {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
}

.gallery--clarity .gallery__item:nth-child(1) { grid-area: 1 / 1 / 2 / 2; }
.gallery--clarity .gallery__item:nth-child(2) { grid-area: 1 / 4 / 2 / 5; }
.gallery--clarity .gallery__item:nth-child(3) { grid-area: 1 / 2 / 3 / 4; }
.gallery--clarity .gallery__item:nth-child(4) { grid-area: 2 / 1 / 3 / 2; }
.gallery--clarity .gallery__item:nth-child(5) { grid-area: 2 / 4 / 3 / 5; }
.gallery--clarity .gallery__item:nth-child(6) { grid-area: 3 / 1 / 4 / 2; }
.gallery--clarity .gallery__item:nth-child(7) { grid-area: 3 / 2 / 4 / 3; }
.gallery--clarity .gallery__item:nth-child(8) { grid-area: 3 / 4 / 4 / 5; }

.gallery--dream {
  position: relative;
}

.gallery--dream .gallery__item {
  position: absolute;
  width: 25%;
  height: 30%;
  background-color: #020302;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 18px 70px rgba(0, 0, 0, 0.42);
}

.gallery--dream .gallery__item:nth-child(1) { left: 2%; top: 6%; width: 23%; height: 29%; }
.gallery--dream .gallery__item:nth-child(2) { left: 28%; top: 6%; width: 18%; height: 29%; }
.gallery--dream .gallery__item:nth-child(3) { left: 49%; top: 6%; width: 22%; height: 29%; }
.gallery--dream .gallery__item:nth-child(4) { left: 74%; top: 6%; width: 23%; height: 29%; }
.gallery--dream .gallery__item:nth-child(5) { left: 2%; top: 42%; width: 23%; height: 29%; }
.gallery--dream .gallery__item:nth-child(6) { left: 28%; top: 42%; width: 18%; height: 29%; }
.gallery--dream .gallery__item:nth-child(7) { left: 49%; top: 42%; width: 22%; height: 29%; }
.gallery--dream .gallery__item:nth-child(8) { left: 74%; top: 42%; width: 23%; height: 29%; }

.gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background-color: #0a0b0a;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: 50% 50%;
  transform-origin: center center;
  will-change: transform, opacity, filter, width, height;
  filter: brightness(0.82) saturate(0.9);
}

.gallery__item.is-hero {
  z-index: 5;
  filter: brightness(1) saturate(1.06);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.gallery__item:not(.is-hero) {
  filter: brightness(0.78) saturate(0.88);
}

.gallery--dream .gallery__item,
.gallery--dream .gallery__item.is-hero,
.gallery--dream .gallery__item:not(.is-hero) {
  opacity: 1;
  filter: none;
}

.caption {
  position: absolute;
  inset: 0;
  z-index: 120;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.65rem;
  padding: clamp(1.5rem, 5vw, 4rem);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}

.caption__mood {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  font-style: italic;
  color: var(--accent);
  line-height: 1.45;
  max-width: 30ch;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9), 0 0 22px rgba(0, 0, 0, 0.65);
}

.caption__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 8vw, 5.8rem);
  font-weight: 500;
  text-transform: uppercase;
  line-height: 0.9;
  color: var(--ink);
  text-shadow: 0 8px 36px rgba(0, 0, 0, 0.75);
  max-width: 11ch;
}

/* Mobile: Filmstreifen */
.portfolio-strip {
  display: none;
}

@media (max-width: 768px) {
  .portfolio-intro {
    grid-template-columns: 1fr;
  }

  .portfolio-intro__nav {
    grid-template-columns: 1fr;
  }

  .portfolio-scroll__head {
    grid-template-columns: 1fr;
    padding-inline: clamp(1rem, 4vw, 1.5rem);
  }

  .portfolio-scroll__head .btn {
    grid-row: auto;
    grid-column: auto;
    justify-self: start;
  }

  .gallery-wrap {
    display: none;
  }

  .portfolio-strip {
    display: block;
    padding: 0 clamp(1rem, 4vw, 1.5rem) 2rem;
    overflow: hidden;
  }

  .portfolio-strip__rail {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .portfolio-strip__rail::-webkit-scrollbar {
    display: none;
  }

  .portfolio-strip__frame {
    flex: 0 0 min(82vw, 360px);
    margin: 0;
    scroll-snap-align: center;
    border-radius: 4px;
    overflow: hidden;
    background: #0a0b0a;
  }

  .portfolio-strip__frame img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
  }

  .portfolio-strip__frame figcaption {
    padding: 0.5rem 0.65rem 0.75rem;
    font-size: 0.78rem;
    color: var(--muted);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-scroll__hint {
    display: none;
  }

  .gallery-wrap {
    display: flex;
    height: auto;
    min-height: auto;
    margin: 2rem auto;
  }

  .portfolio-strip {
    display: none;
  }

  .gallery__item,
  .caption {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
