/*!
 * Drohnen-Blick.de – Medien: Foto-Lightbox + Referenzfilm-Player
 * Gehört zu /assets/media.js · Stand 2026-09-16
 * Farben kommen aus den Design-Tokens der jeweiligen Seite (mit Fallback).
 */
:root {
  --db-gold: var(--gold, #B8922A);
  --db-gold-light: var(--gold-light, #D4A843);
  --db-gold-soft: var(--gold-soft, #F5EDD5);
  --db-gold-text: var(--gold-text, #826410);
  --db-ink: var(--ink, var(--text-primary, #1C1C1E));
  --db-ink-2: var(--ink-2, var(--text-secondary, #48484A));
  --db-ink-3: var(--ink-3, var(--text-tertiary, #8E8E93));
  --db-ease: cubic-bezier(.2, .7, .2, 1);
  --db-font-head: 'Montserrat', sans-serif;
  --db-font-body: 'Inter', sans-serif;
}

/* Nur für Screenreader sichtbar */
.lb-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ════════ Galerie-Links (Klick = Lightbox) ════════ */
.lb-link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.lb-link:focus { outline: none; }
.lb-link:focus-visible { outline: 3px solid var(--db-gold); outline-offset: -3px; }
.lb-link img { display: block; }

.lb-zoom {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 3;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .88);
  color: var(--db-ink);
  box-shadow: 0 4px 14px rgba(28, 28, 30, .18);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity .3s var(--db-ease), transform .3s var(--db-ease);
  pointer-events: none;
}
.lb-zoom svg { width: 16px; height: 16px; display: block; }
.lb-link:hover .lb-zoom,
.lb-link:focus-visible .lb-zoom { opacity: 1; transform: translateY(0); }
@media (hover: none) {
  .lb-zoom { opacity: .85; transform: none; width: 32px; height: 32px; top: 10px; right: 10px; }
}

/* Bildunterschriften liegen über dem Bild – Klicks sollen zum Link durchgehen */
.gal-item .gal-cap,
.portfolio-item .portfolio-caption,
.ref-cap { pointer-events: none; }

/* Startseite: Karussell-Karte (Link füllt die Karte) */
.gal-item > .lb-link { border-radius: inherit; }

/* Immobilienfotografie: Hover-Captions auf Touch/Tablet dauerhaft zeigen */
.portfolio-item > .lb-link { border-radius: inherit; }
.portfolio-item .portfolio-caption { z-index: 2; }
@media (max-width: 1023px), (hover: none) {
  .portfolio-item .portfolio-caption { opacity: 1; transform: none; }
}

/* Leistungen: Slider-Folien sind jetzt Links */
.gallery-track > .lb-link {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
}
.gallery-wrap .lb-zoom { top: 12px; right: 12px; }

/* ════════ Referenz-Sektion ════════ */
.ref-sec { position: relative; isolation: isolate; }
.ref-glow {
  position: absolute;
  left: 0; right: 0; top: 18%;
  height: 62%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(60% 50% at 50% 42%, var(--db-gold-soft), rgba(245, 237, 213, 0) 72%);
  opacity: .6;
}
.ref-chips {
  list-style: none;
  display: flex; flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0; padding: 0;
}
.ref-chips li {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-family: var(--db-font-body);
  font-size: 13px; font-weight: 500; line-height: 1;
  color: var(--db-ink-2);
  background: rgba(255, 255, 255, .66);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .06), 0 1px 4px rgba(0, 0, 0, .04);
  white-space: nowrap;
}
.ref-chips .dot { color: var(--db-gold); font-weight: 700; }
@media (max-width: 640px) {
  /* Die Chip-Zeile läuft bis an den Bildschirmrand; clip verhindert, dass
     die Randüberstände (100vw inkl. Scrollbar) die Seite seitlich verschieben. */
  .ref-sec { overflow-x: clip; }
  .ref-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    /* Innenabstand oben/unten gibt dem Chip-Schatten Platz – sonst schneidet
       der Scroll-Container ihn mit harter Kante ab. Die negativen Außenabstände
       gleichen das aus: Die Chips stehen exakt wie vorher. */
    margin: 4px calc(50% - 50vw) -16px;
    padding: 14px calc(50vw - 50%) 22px;
    scroll-padding-inline: calc(50vw - 50%);
  }
  .ref-chips::-webkit-scrollbar { display: none; }
}

.ref-player { margin-top: clamp(28px, 4vw, 48px); }
.ref-player .dbv {
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 40px 90px -40px rgba(28, 28, 30, .45);
}
.ref-player--sm .dbv { border-radius: 16px; }
@media (max-width: 640px) {
  .ref-player .dbv { border-radius: 18px; }
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}
@media (max-width: 1023px) { .ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .ref-grid { gap: 10px; } }
.ref-item {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  background: #E6E6EB;
  border: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .06), 0 1px 4px rgba(0, 0, 0, .04);
}
.ref-grid--sm .ref-item { border-radius: 16px; }
@media (max-width: 640px) { .ref-item { border-radius: 14px; } }
.ref-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .6s var(--db-ease);
}
.ref-item .lb-link:hover img { transform: scale(1.04); }
.ref-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 28px 16px 12px;
  color: #fff;
  font-family: var(--db-font-head);
  font-size: .68rem; font-weight: 600; line-height: 1.3;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: linear-gradient(to top, rgba(28, 28, 30, .72), rgba(28, 28, 30, 0));
}
@media (max-width: 640px) {
  .ref-cap { font-size: .56rem; letter-spacing: .06em; padding: 18px 10px 9px; }
}
.ref-more {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 22px;
  font-family: var(--db-font-head);
  font-size: .72rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--db-gold-text);
  text-decoration: none;
}
.ref-more svg { transition: transform .3s var(--db-ease); }
.ref-more:hover svg { transform: translateX(4px); }
.ref-more:focus-visible { outline: 2px solid var(--db-gold); outline-offset: 4px; border-radius: 4px; }

/* ════════ Film-Player (Teaser → Film mit Ton) ════════ */
.dbv {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  background: #141416;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.dbv.is-enhanced { cursor: pointer; }
.dbv > .dbv-poster,
.dbv > video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  max-width: none;
  margin: 0;
  display: block;
  object-fit: cover;
}
.dbv-teaser { z-index: 1; opacity: 0; transition: opacity .6s var(--db-ease); }
.dbv.is-teasing .dbv-teaser { opacity: 1; }
.dbv > .dbv-film {
  z-index: 4;
  object-fit: contain;
  background: #000;
  opacity: 0;
  transition: opacity .25s ease;
}
.dbv[data-state="playing"] > .dbv-film,
.dbv[data-state="paused"] > .dbv-film,
.dbv[data-state="ended"] > .dbv-film { opacity: 1; }
.dbv[data-state="playing"],
.dbv[data-state="paused"],
.dbv[data-state="ended"] { cursor: auto; }

.dbv-scrim {
  position: absolute; inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(28, 28, 30, .55), rgba(28, 28, 30, 0) 45%),
    radial-gradient(ellipse at center, rgba(28, 28, 30, .16), rgba(28, 28, 30, 0) 70%);
  transition: opacity .25s ease, background-color .25s ease;
}
.dbv-label {
  position: absolute;
  left: clamp(14px, 2.4vw, 26px);
  bottom: clamp(12px, 2vw, 22px);
  z-index: 3;
  font-family: var(--db-font-head);
  font-size: 11px; font-weight: 600; line-height: 1;
  letter-spacing: .2em; text-transform: uppercase;
  color: rgba(255, 255, 255, .88);
  pointer-events: none;
  transition: opacity .25s ease;
}
.dbv-ui {
  position: absolute; inset: 0;
  z-index: 5;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
  transition: opacity .25s ease;
}
.dbv-play {
  display: inline-flex; align-items: center;
  gap: 14px;
  height: 56px;
  padding: 0 26px 0 8px;
  border-radius: 999px;
  border: 1px solid #fff;
  background: rgba(255, 255, 255, .92);
  color: var(--db-ink);
  font-family: var(--db-font-head);
  font-size: 15px; font-weight: 600; line-height: 1;
  letter-spacing: .01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 12px 30px -10px rgba(28, 28, 30, .5);
  transition: transform .3s var(--db-ease), box-shadow .3s var(--db-ease);
}
.dbv-play:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -10px rgba(28, 28, 30, .55); }
.dbv-play:focus { outline: none; }
.dbv-play:focus-visible { outline: 3px solid var(--db-gold); outline-offset: 3px; }
.dbv-play-icon {
  position: relative;
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--db-gold), var(--db-gold-light));
  color: #fff;
  transition: transform .3s var(--db-ease);
}
.dbv-play:hover .dbv-play-icon { transform: scale(1.06); }
.dbv-play-icon svg { width: 14px; height: 14px; margin-left: 2px; display: block; }
.dbv-dur { color: #8E8E93; } /* steht auf dunklem Play-Button */
.dbv-short { display: none; }
.dbv-spinner {
  display: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  animation: dbv-spin 1.2s linear infinite;
}
@keyframes dbv-spin { to { transform: rotate(360deg); } }
.dbv[data-state="loading"] .dbv-play { cursor: progress; }
.dbv[data-state="loading"] .dbv-play-icon svg { display: none; }
.dbv[data-state="loading"] .dbv-spinner { display: block; }

.dbv-note {
  display: none;
  max-width: 36ch;
  margin: 0;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(28, 28, 30, .72);
  color: #fff;
  font-family: var(--db-font-body);
  font-size: 13px; line-height: 1.45;
}
.dbv.is-slow .dbv-note--slow { display: block; }
.dbv[data-state="error"] .dbv-note--error { display: block; }
.dbv-note a { color: var(--db-gold-light); text-decoration: underline; }

/* Film läuft oder ist pausiert: Bedien-Ebene ausblenden, native Controls nutzen */
.dbv[data-state="playing"] .dbv-ui,
.dbv[data-state="paused"] .dbv-ui,
.dbv[data-state="playing"] .dbv-label,
.dbv[data-state="paused"] .dbv-label,
.dbv[data-state="ended"] .dbv-label,
.dbv[data-state="playing"] .dbv-scrim,
.dbv[data-state="paused"] .dbv-scrim { opacity: 0; pointer-events: none; }
.dbv[data-state="playing"] .dbv-ui,
.dbv[data-state="paused"] .dbv-ui { visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s; }

/* Ende: Nochmal ansehen + Anfrage */
.dbv-end { display: none; flex-wrap: wrap; justify-content: center; gap: 12px; }
.dbv[data-state="ended"] .dbv-play { display: none; }
.dbv[data-state="ended"] .dbv-end { display: flex; }
.dbv[data-state="ended"] .dbv-ui { background: rgba(28, 28, 30, .6); z-index: 6; }
.dbv-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-family: var(--db-font-head);
  font-size: 12px; font-weight: 600; line-height: 1;
  letter-spacing: .1em; text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .3s var(--db-ease), box-shadow .3s var(--db-ease), background-color .3s;
}
.dbv-btn:hover { transform: translateY(-2px); }
.dbv-btn:focus { outline: none; }
.dbv-btn:focus-visible { outline: 3px solid var(--db-gold-light); outline-offset: 3px; }
.dbv-btn--ghost { background: rgba(255, 255, 255, .08); color: #fff; border: 1px solid rgba(255, 255, 255, .9); }
.dbv-btn--ghost:hover { background: rgba(255, 255, 255, .18); }
.dbv-btn--gold { background: linear-gradient(135deg, var(--db-gold), var(--db-gold-light)); color: #fff; border: 1px solid transparent; }
.dbv-btn--gold:hover { box-shadow: 0 12px 28px rgba(184, 146, 42, .38); }
.dbv-btn svg { width: 14px; height: 14px; }

/* Fehler: Erneut versuchen statt Play */
.dbv-retry { display: none; }
.dbv[data-state="error"] .dbv-ui { background: rgba(28, 28, 30, .55); }
.dbv[data-state="error"] .dbv-play { display: none; }
.dbv[data-state="error"] .dbv-retry { display: inline-flex; }

@media (max-width: 640px) {
  .dbv-play { height: 48px; gap: 10px; padding: 0 20px 0 6px; font-size: 14px; }
  .dbv-play-icon { width: 36px; height: 36px; }
  .dbv-long { display: none; }
  .dbv-short { display: inline; }
  .dbv-label { display: none; }
  .dbv-end { flex-direction: column; align-items: stretch; }
  .dbv-btn { height: 44px; }
}

/* Pausiert: runder Fortsetzen-Knopf in der Mitte (native Leiste bleibt nutzbar) */
.dbv-resume {
  display: none;
  position: absolute;
  left: 50%; top: 50%;
  z-index: 6;
  width: 64px; height: 64px;
  margin: -32px 0 0 -32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  place-items: center;
  background: linear-gradient(135deg, var(--db-gold), var(--db-gold-light));
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .55);
  transition: transform .25s var(--db-ease);
}
.dbv-resume svg { width: 22px; height: 22px; margin-left: 3px; display: block; }
.dbv-resume:hover { transform: scale(1.06); }
.dbv-resume:focus { outline: none; }
.dbv-resume:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.dbv[data-state="paused"] .dbv-resume { display: grid; }
.dbv > .dbv-film:focus { outline: none; }
.dbv > .dbv-film:focus-visible { outline: 3px solid var(--db-gold); outline-offset: -3px; }

/* Leistungen: Player füllt die Spalte der Karte */
.dbv--fill { aspect-ratio: 16 / 9; }
@media (min-width: 1024px) {
  .dbv--fill { aspect-ratio: auto; height: 100%; min-height: 380px; }
}

/* ════════ PhotoSwipe-Anpassungen ════════ */
:root .pswp {
  --pswp-bg: #0B0B0D;
  --pswp-placeholder-bg: #1C1C1E;
  --pswp-icon-color: #FFFFFF;
  --pswp-icon-color-secondary: rgba(28, 28, 30, .55);
  --pswp-icon-stroke-color: rgba(28, 28, 30, .55);
  --pswp-error-text-color: #FFFFFF;
  font-family: var(--db-font-body);
}
.pswp__counter { font-family: var(--db-font-head); font-weight: 600; letter-spacing: .08em; }
.pswp__db-caption {
  position: absolute;
  left: 50%; bottom: 20px;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(92vw, 900px);
  padding: 10px 18px;
  border-radius: 14px;
  background: rgba(11, 11, 13, .62);
  color: #fff;
  text-align: center;
  pointer-events: none;
  transition: opacity .25s ease;
}
.pswp__db-caption[hidden] { display: none; }
.pswp__db-caption b {
  display: block;
  font-family: var(--db-font-head);
  font-size: 12px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--db-gold-light);
}
.pswp__db-caption small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255, 255, 255, .66);
}
.pswp:not(.pswp--ui-visible) .pswp__db-caption,
.pswp--zoomed-in .pswp__db-caption { opacity: 0; }
.pswp__db-hint {
  position: absolute;
  left: 50%; top: 18px;
  transform: translateX(-50%);
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  color: var(--db-ink);
  font-family: var(--db-font-head);
  font-size: 12px; font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.35;
  text-align: center;
  text-wrap: balance;
  /* darf auf schmalen Handys umbrechen, statt am Rand abgeschnitten zu werden */
  width: max-content;
  max-width: calc(100% - 32px);
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
  transition: opacity .5s ease, transform .5s ease;
}
.pswp__db-hint.is-hidden { opacity: 0; transform: translate(-50%, -8px); }
@media (max-width: 700px) {
  .pswp__db-caption { bottom: 12px; padding: 8px 12px; }
  .pswp__db-hint { top: 64px; border-radius: 16px; }
}
@media (max-width: 480px) {
  .pswp__db-hint > span { display: block; }
  .pswp__db-hint > .db-hint-sep { display: none; }
}
/* Hintergrund bei offener Lightbox sperren (Leertaste, Bild ab/auf, Pos1/Ende).
   Auf der Startseite stoppt zusätzlich Lenis; ohne Lenis greift nur diese Regel. */
html.db-lb-open { overflow: hidden; }
/* Custom-Cursor der Startseite unter der Lightbox ausblenden */
html.db-lb-open #cursor-dot,
html.db-lb-open #cursor-ring { opacity: 0 !important; }

@media (prefers-reduced-motion: reduce) {
  .dbv-teaser { display: none !important; }
  .lb-link img,
  .ref-item img,
  .gal-item:hover img { transition: none !important; transform: none !important; }
  .dbv-spinner { animation-duration: 3s; }
  .pswp__db-hint { transition: none; }
}
