/* ==========================================================================
   portfolio.css - Bühne + Dock + Lightbox der Portfolio-Seite (2026-09-29)
   Eingebunden NACH kontakt.css / bewertung-footer.css. Ersetzt für /portfolio
   die alten Klassen .portfolio-stage / .portfolio-dock (bleiben in styles.css
   ungenutzt stehen, Rückbau = portfolio.jsx zurück + diesen <link> entfernen).

   Regeln:
   - Bühne + Dock sind ZUSAMMEN genau ein Bildschirm (100svh, Kopfleiste
     abgezogen): Dock unten, knapp über dem Rand; die Bühne nimmt den Rest.
     svh statt dvh: die Höhe springt nicht, wenn die Browserleiste ein- oder
     ausfährt.
   - Bilder werden nie beschnitten (object-fit: contain) und liegen auf einem
     ruhigen, dunklen Grund mit weichgezeichnetem Hauch des Bildes.
   - Bildwechsel NUR als Crossfade: opacity, 420 ms, ease-out. Die alte Lage
     bleibt darunter voll stehen, bis die neue deckt (kein Leerbild).
   - reduced-motion: Wechsel sofort.
   ========================================================================== */

:root { --pf-grund: #0E0D0C; }

/* ---------- Bühne: ein Bildschirm ---------- */
.pf-buehne {
  --pf-rand: 32px;
  --pf-vs: 64px;             /* Vorschau-Kante im Dock */
  --pf-luft-unten: 12px;
  box-sizing: border-box;
  height: 100vh;
  height: 100svh;
  max-width: 1544px;
  margin: -52px auto 0;  /* fest, NICHT an --pf-kopf: sonst wandert die Bühne, wenn die Kopfleiste beim Scrollen ihre Höhe ändert */
  padding: calc(var(--pf-kopf, 80px) + 8px) var(--pf-rand) max(var(--pf-luft-unten), env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
  /* Das obere Polster liegt über dem Ende des Kopfbereichs - Klicks gehen durch */
  pointer-events: none;
}
.pf-buehne > * { pointer-events: auto; }

.pf-buehne__kopf {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.pf-buehne__zurueck { min-height: 44px; }
.pf-buehne__albumname {
  color: var(--fg-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pf-buehne__bild {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: var(--pf-grund);
  cursor: zoom-in;
  touch-action: pan-y pinch-zoom;   /* waagrecht wischen gehört uns */
  -webkit-user-select: none;
  user-select: none;
}
.pf-buehne__bild::after {           /* Lesbarkeit der Unterschrift */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0) 62%, rgba(0,0,0,0.55) 100%);
}

/* ---------- Crossfade-Lagen (Bühne + Lightbox) ---------- */
.pf-wechsel { position: absolute; inset: 0; }
.pf-wechsel__lage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--pf-grund);
  opacity: 0;
  transition: opacity 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
.pf-wechsel__lage.ist-da { opacity: 1; }
.pf-wechsel__hauch {
  position: absolute;
  inset: -48px;
  background-size: cover;
  background-position: center;
  filter: blur(32px) saturate(1.05);
  opacity: 0.34;
}
.pf-wechsel__lage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
}

/* ---------- Beschriftung, Zähler, Pfeile auf der Bühne ---------- */
.pf-buehne__zaehler {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background-color: rgba(18, 18, 18, 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), inset 0 0 0 1px rgba(255,255,255,0.12);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.pf-buehne__unterschrift {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 22px;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  color: #FFFFFF;
  pointer-events: none;
}
.pf-buehne__text { min-width: 0; }
.pf-buehne__meta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
}
.pf-buehne__titel {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(20px, 2.6vw, 36px);
  letter-spacing: -0.015em;
  line-height: 1.04;
  margin: 6px 0 0;
  text-transform: uppercase;
  overflow-wrap: break-word;
  hyphens: auto;
}
.pf-buehne__oeffnen {
  pointer-events: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--fg);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 200ms cubic-bezier(0.22, 1, 0.36, 1), color 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.pf-buehne__oeffnen:hover { background: var(--accent-active); color: #FFFFFF; }
.pf-buehne__oeffnen:active { transform: scale(0.97); }

.pf-buehne__pfeil {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border: 0;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  background-color: rgba(18, 18, 18, 0.45);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), inset 0 0 0 1px rgba(255,255,255,0.12);
  cursor: pointer;
  opacity: 0.82;
  transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1), background-color 200ms cubic-bezier(0.22, 1, 0.36, 1), color 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.pf-buehne__pfeil:hover { opacity: 1; background-color: #FFFFFF; color: var(--fg); }
.pf-buehne__pfeil:active { transform: scale(0.95); }
.pf-buehne__pfeil--zurueck { left: 16px; }
.pf-buehne__pfeil--weiter { right: 16px; }

.pf-buehne__oeffnen:focus-visible,
.pf-buehne__pfeil:focus-visible {
  outline: 2px solid #FFFFFF;
  outline-offset: 3px;
}

/* ---------- Dock ---------- */
.pf-dock {
  flex: none;
  min-width: 0;
  padding: 6px;
  border-radius: 20px;
  background: #FFFFFF;
  box-shadow:
    inset 0 0 0 1px var(--border),
    0 12px 32px -20px rgba(10, 10, 10, 0.28);
}
.pf-dock--leer { height: calc(var(--pf-vs) + 10px); }
.pf-dock__spur {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  border-radius: 14px;
  /* weiche Kanten zeigen: da geht es weiter */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}
.pf-dock__spur::-webkit-scrollbar { display: none; }
.pf-dock__reihe {
  display: flex;
  gap: 6px;
  width: max-content;
  margin: 0 auto;
  padding: 5px 14px;           /* Platz für Aktiv-Ring und Fokus */
}
.pf-dock__knopf {
  flex: none;
  position: relative;
  width: var(--pf-vs);
  height: var(--pf-vs);
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2, #F4F1EC);   /* ruhiger Platzhalter, kein Grau-Blitz */
  cursor: pointer;
  scroll-snap-align: center;
  opacity: 0.6;
  transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
.pf-dock__knopf img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pf-dock__knopf:hover { opacity: 1; }
.pf-dock__knopf.ist-aktiv {
  opacity: 1;
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--accent-active);
}
.pf-dock__knopf:focus-visible {
  opacity: 1;
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}
.pf-dock__typ {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(0,0,0,0.6);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat-Blase weicht, solange die Bühne im Bild ist (lag sonst über dem Dock) */
body.pf-buehne-im-bild .chat-bubble {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none !important;
}

/* ---------- Lightbox: gleiche Crossfade-Lagen, Bild füllt die freie Höhe ---------- */
.lightbox.pf-lb {
  padding: max(76px, calc(env(safe-area-inset-top, 0px) + 64px)) 96px max(16px, env(safe-area-inset-bottom, 0px));
  align-items: stretch;
}
.pf-lb .pf-lb__inner {
  max-width: none;
  width: 100%;
  height: 100%;
  gap: 14px;
  min-height: 0;
}
.pf-lb__bild {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  touch-action: pan-y pinch-zoom;
  container-type: size;
}
.pf-lb .pf-wechsel__lage { background: #0A0A0A; }
.pf-lb .pf-wechsel__hauch { display: none; }
.pf-lb__video {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pf-lb__video iframe {
  width: min(100cqw, 100cqh * 16 / 9);
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
}
.pf-lb .lightbox__thumbs { flex: none; }
.pf-lb .lightbox__thumb { width: 58px; height: 44px; }
.pf-lb .lightbox__caption { flex: none; }

/* ---------- Handy hochkant / schmal ---------- */
@media (max-width: 760px) {
  .pf-buehne {
    --pf-rand: 10px;
    --pf-vs: 48px;
    --pf-luft-unten: 10px;
    gap: 8px;
    margin-top: -44px;
    padding-top: calc(var(--pf-kopf, 64px) + 6px);
  }
  .pf-buehne__bild { border-radius: 16px; }
  .pf-buehne__zaehler { top: 10px; left: 10px; padding: 6px 10px; font-size: 9px; letter-spacing: 0.14em; }
  .pf-buehne__unterschrift { left: 14px; right: 10px; bottom: 10px; gap: 12px; align-items: center; }
  .pf-buehne__meta { font-size: 9px; letter-spacing: 0.16em; }
  .pf-buehne__titel { font-size: clamp(16px, 5vw, 22px); margin-top: 3px; }
  .pf-buehne__oeffnen { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .pf-buehne__oeffnen-wort {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .pf-dock { padding: 4px; border-radius: 16px; }
  .pf-dock__reihe { gap: 5px; padding: 5px 10px; }
  .pf-dock__knopf { border-radius: 8px; }
  .pf-buehne__kopf .pf-buehne__albumname { font-size: 11px; }

  .lightbox.pf-lb { padding: calc(64px + env(safe-area-inset-top, 0px)) 0 max(12px, env(safe-area-inset-bottom, 0px)); }
}

/* Touch-Geräte: Pfeile weg (Wischen + Dock), mehr Bild */
@media (pointer: coarse) {
  .pf-buehne__pfeil { display: none; }
  .pf-buehne__bild { cursor: default; }
}

/* ---------- Handy quer / sehr flache Fenster ---------- */
@media (orientation: landscape) and (max-height: 560px) {
  .pf-buehne {
    --pf-rand: 16px;
    --pf-vs: 44px;
    --pf-luft-unten: 6px;
    gap: 6px;
    margin-top: -60px;
    padding-top: calc(var(--pf-kopf, 64px) + 4px);
    padding-left: max(var(--pf-rand), env(safe-area-inset-left, 0px));
    padding-right: max(var(--pf-rand), env(safe-area-inset-right, 0px));
  }
  .pf-buehne__bild { border-radius: 12px; }
  .pf-buehne__zaehler { top: 8px; left: 8px; padding: 5px 9px; font-size: 9px; }
  .pf-buehne__unterschrift { left: 12px; right: 8px; bottom: 8px; align-items: center; }
  .pf-buehne__meta { display: none; }
  .pf-buehne__titel { font-size: 15px; margin: 0; }
  .pf-buehne__oeffnen { width: 44px; height: 44px; padding: 0; justify-content: center; }
  .pf-buehne__oeffnen-wort {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .pf-dock { padding: 2px; border-radius: 14px; }
  .pf-dock__reihe { padding: 4px 10px; gap: 5px; }

  .lightbox.pf-lb { padding: calc(52px + env(safe-area-inset-top, 0px)) 72px max(8px, env(safe-area-inset-bottom, 0px)); }
  .pf-lb .pf-lb__inner { gap: 6px; }
  .pf-lb .lightbox__caption { display: none; }
  .pf-lb .lightbox__thumb { width: 50px; height: 44px; }
}

/* ---------- Ruhe für bewegungsempfindliche Menschen ---------- */
@media (prefers-reduced-motion: reduce) {
  .pf-wechsel__lage,
  .pf-dock__knopf,
  .pf-buehne__pfeil,
  .pf-buehne__oeffnen { transition: none; }
  .pf-buehne__oeffnen:active,
  .pf-buehne__pfeil:active { transform: none; }
}

/* Platzhalter, solange das Raster auf das erste Bühnenbild wartet */
.pf-raster-platz { height: 60vh; }

/* ---------- macOS-Dock-Vergrößerung (nur echte Maus) ----------
   Die Vorschauen wachsen per transform nach oben in einen durchsichtigen
   Freiraum (padding-top der Spur, per negativem margin über den unteren
   Bühnenrand gelegt). Der Freiraum nimmt keine Klicks an (pointer-events),
   das Dock selbst bleibt, wo es ist. Werte in portfolio.jsx (PfDock). */
.pf-dock { position: relative; z-index: 3; }
@media (hover: hover) and (pointer: fine) {
  .pf-dock__spur {
    padding-top: 104px;
    margin-top: -104px;
    pointer-events: none;
  }
  .pf-dock__reihe { pointer-events: auto; padding-inline: 44px; }
  .pf-dock__knopf {
    transform-origin: bottom center;
    transition: opacity 200ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  .pf-dock__knopf { transition: none; transform: none !important; }
}
/* Während der Vergrößerung alle Vorschauen deckend - halbtransparente,
   überlappende Bilder wirkten trüb */
.pf-dock__spur[data-lupe="1"] .pf-dock__knopf { opacity: 1; }

/* ---------- Handy: Bühne folgt dem Finger (nur ≤ 720 px + Finger) ----------
   Drei Tafeln nebeneinander; die Spur bewegt sich nur per transform.
   Rechner: unverändert Crossfade. */
.pf-spur {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.pf-spur__tafel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--pf-grund);
}
.pf-spur__tafel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
}
.pf-buehne__bild.ist-wischbar { touch-action: pan-y; }
.pf-wisch-hinweis {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background-color: rgba(18, 18, 18, 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), inset 0 0 0 1px rgba(255,255,255,0.12);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 320ms cubic-bezier(0.23, 1, 0.32, 1);
}
.pf-wisch-hinweis.ist-da { opacity: 1; }
.pf-spur__tafel img { opacity: 0; transition: opacity 240ms cubic-bezier(0.23, 1, 0.32, 1); }
.pf-spur__tafel img.ist-da { opacity: 1; }
