* { box-sizing: border-box; }

/* Die Seite selbst scrollt (nicht mehr ein fester Container): so behandelt Safari die untere Leiste normal */
html, body {
  margin: 0;
  background: #fff;
}

.scroller {
  position: relative;
}

@font-face {
  font-family: "Rahere";
  src: url("./Font/ULGA-Type-Rahere-Roman-Display-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Aesteticoformal";
  src: url("./Font/Aestetico Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ===== Filter links, Name rechts (fest, vertikal zentriert) ===== */
.filters {
  position: fixed;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-family: "Aesteticoformal", serif;
  font-weight: 500;
}
.filters button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: clamp(13px, 0.8vw, 14px);
  line-height: 1.2;
  color: #888888;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color .2s ease;
}
.filters button:hover,
.filters button.active { color: #111; }

/* Langer/kurzer Kategoriename */
.filters .short { display: none; }

.site-info {
  position: fixed;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  z-index: 2;
  white-space: nowrap;
  font-family: "Aesteticoformal", serif;
  font-weight: 500;
  font-size: clamp(15px, 0.8vw, 15px);
  line-height: 1.2;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
}

/* Kopie des Namens (nur iPhone, siehe unten) */
.site-info-ghost { display: none; }

.site-info .site-name {
  display: block;
  font-family: "Rahere", serif;
  font-weight: 400;
  color: #000;
}

/* Infoblock unter dem Namen, linksbündig mit dem Namen */
.site-info .site-details {
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 3px;
  text-align: left;
  white-space: nowrap;
  font-size: inherit;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  transition: opacity .1s ease;
}
.site-info .site-details p { margin: 0 0 12px; }
.site-info .site-details p:last-child { margin-bottom: 0; }

/* Cinematographer */
.site-info .site-details .role {
  font-family: "Rahere", serif;
  font-weight: 400;
  color: #000;
}

/* Email und Instagram: kleiner, ohne Unterstrich, schwarz */
.site-info .site-details a {
  font-size: 11px;
  color: #000;
  text-decoration: none;
  transition: opacity .15s ease;
}
.site-info .site-details a:hover { opacity: .5; }

/* Block erscheint, wenn die Maus auf dem Namen/Block liegt */
.site-info:hover .site-details,
.site-info:focus-within .site-details {
  opacity: 1;
  pointer-events: auto;
}

/* Fold-out und Mute-Button: am Desktop nicht sichtbar */
.info-fold { display: none; }
.fold-row { display: none; }

/* ===== Layout ===== */
.videos {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0;
  pointer-events: none;
}

.video-item {
  --ui: #fff;
  position: relative;
  z-index: 1;
  width: min(60vw, 790px);
  min-width: 500px;
  pointer-events: auto;
}
.video-item[hidden] { display: none; }

.video-frame {
  position: relative;
  aspect-ratio: var(--ratio, 16 / 9);
  background: #000;
  overflow: hidden;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none;
}

/* Eigenes Video-Element (iPhone/iPad): unsichtbar, bis es spielt; dahinter liegt das Vorschaubild */
.video-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}
.video-frame video.is-ready { opacity: 1; }

/* iPhone: Button deckt das Thumbnail ab, bleibt aber selbst unsichtbar */
.thumb-play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Play-Icon: einfach weiß, ohne Effekt */
.thumb-play-label {
  display: block;
  line-height: 0;
  color: #fff;
}
.thumb-play-label svg {
  display: block;
  width: 18px;                   /* Größe des Icons */
  height: 18px;
  fill: currentColor;
  transform: translateX(1px);    /* Dreieck optisch mittig */
}

/* ===== Leiste im Video ===== */
.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 40px 18px 14px;
  background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
  color: var(--ui);
}

.ctrl-btn {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  line-height: 0;
  transition: opacity .2s;
}
.ctrl-btn:hover { opacity: .5; }

.ctrl-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

/* ===== Timeline (eckige Enden) ===== */
.seek {
  position: relative;
  flex: 1;
  height: 20px;
  cursor: pointer;
  touch-action: none;
}
.seek::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 4px;
  transform: translateY(-50%);
  border-radius: 0;
  background: rgba(255,255,255,.35);
}
.seek-fill {
  position: absolute;
  left: 0;
  top: 50%;
  height: 4px;
  width: 0%;
  transform: translateY(-50%);
  border-radius: 0;
  background: var(--ui);
  pointer-events: none;
}

/* ===== Vollbild ===== */
.video-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  background: #000;
  cursor: default;
}
.video-frame:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  background: #000;
  cursor: default;
}
.video-frame:fullscreen video,
.video-frame:-webkit-full-screen video { object-fit: contain; }

/* Ersatz-Vollbild (nur im iframe-Fallback): Bunnys Player bekommt die Berührungen */
.video-frame.pseudo-fs {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  aspect-ratio: auto;
  background: #000;
}
.video-frame.pseudo-fs iframe { pointer-events: auto; }
.video-frame.pseudo-fs .controls { display: none; }
.video-item:has(.pseudo-fs) { z-index: 50; }
body.pseudo-fs-open .site-info,
body.pseudo-fs-open .filters,
body.pseudo-fs-open .fold-row { display: none; }
body.pseudo-fs-open::before { display: none; }

.pseudo-close {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  color: #fff;
  place-items: center;
  cursor: pointer;
}
.pseudo-close svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}
.video-frame.pseudo-fs .pseudo-close { display: grid; }

.ctrl-btn.fs-min { display: none; }
.video-frame.is-fs .ctrl-btn.fs-min { display: block; }
.video-frame.is-fs .ctrl-btn.fs { display: none; }

.video-frame.is-fs .controls {
  --ui: #fff;
  padding: 70px 32px 28px;
  background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
  pointer-events: none;
}
.video-frame.is-fs .ctrl-btn svg { width: 20px; height: 20px; }

/* ===== Titelzeile unter dem Video ===== */
.caption {
  position: absolute;
  left: 3px;
  right: 3px;
  top: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-top: 4px;
  font-family: "Aesteticoformal", serif;
  font-weight: 500;
  font-size: clamp(12px, 0.8vw, 13px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #333333;
  opacity: 0;
  transition: opacity .15s linear;
}

.video-item.in-view.hovered .caption { opacity: 1; }
.caption-director {
  color: #a6a6a6;
  text-align: right;
}

/* ===== Leiste nur bei Mauskontakt zeigen ===== */
@media (hover: hover) {
  .video-item .controls {
    opacity: 0;
    transition: opacity .25s ease;
  }
  .video-item:hover .controls { opacity: 1; }
}

/* Im Vollbild gilt die Steuerung über show-ui */
.video-frame.is-fs .controls { opacity: 0; }
.video-frame.is-fs.show-ui .controls {
  opacity: 1;
  pointer-events: auto;
  transition: opacity .1s ease;
}
.video-frame.is-fs:not(.show-ui) { cursor: none; }

/* ===== Touch-Geräte: Infoblock immer sichtbar ===== */
@media (hover: none) {
  .site-info .site-details { opacity: 1; pointer-events: auto; }
}

/* ===== Kleine Bildschirme / iPhone ===== */
@media (max-width: 900px) {

  /* Schwarze Leiste direkt unter dem Video, darunter die Titelzeile (nur iPhone) */
  .video-item { --ui: #000; }
  .video-item .controls {
    top: 100%;
    bottom: auto;
    left: 0;
    right: 0;
    height: 20px;
    margin-top: 0;
    padding: 0 4px;          /* 4 px Abstand zum Bildschirmrand */
    gap: 12px;
    background: none;
    opacity: 1;
  }

  /* Play/Pause und Mute am iPhone ausblenden: nur Timeline + Vollbild */
  .video-item .ctrl-btn.play,
  .video-item .ctrl-btn.mute { display: none; }
  .video-item .seek::before { background: rgba(0,0,0,.18); }
  .video-item .caption {
    left: 4px;               /* 4 px Abstand zum Bildschirmrand */
    right: 4px;
    margin-top: 24px;        /* unter der Leiste */
  }
  .video-frame.is-fs .controls {
    --ui: #fff;
    margin-top: 0;
    top: auto;
    bottom: 0;
    height: auto;
    padding: 70px 32px 28px;
    background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
  }
  .video-frame.is-fs .seek::before { background: rgba(255,255,255,.35); }
  .video-frame.is-fs .ctrl-btn.play,
  .video-frame.is-fs .ctrl-btn.mute { display: block; }
  .video-item { width: 100%; min-width: 0; }   /* Video von Bildschirmkante zu Bildschirmkante */

  /* iPhone im Thumbnail-Modus: Titel und Credits als zentrierter Fließtext unter dem Bild */
  .thumb-mode .video-item .caption {
    display: block;
    left: 12px;              /* seitlicher Abstand des Textblocks */
    right: 12px;
    margin-top: 4px;         /* Abstand zum Thumbnail */
    font-size: 12px;         /* Größe von Titel und Credits */
    line-height: 1.3;
    letter-spacing: 0.03em;
    text-align: center;
    white-space: normal;
    text-wrap: wrap;         /* normaler Umbruch: die erste Zeile wird so voll wie möglich */
  }
  .thumb-mode .caption-title,
  .thumb-mode .caption-director {
    display: inline;
    flex: none;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    text-align: center;
  }
  .thumb-mode .caption-title { margin-right: .6em; }   /* Abstand zwischen Titel und Credits */
  .thumb-mode .fold-row { justify-content: flex-end; }
  .thumb-mode .fold-row .mute-fab { display: none; }

  /* Weißer Balken: gehört zu .site-info (schwarzer Name = Loch im Balken, Video scheint durch) */
  body::before { display: none; }

  .site-info {
    top: 0;
    left: 0;
    right: 0;
    height: 100px;                 /* gleicher Wert wie HEADER_H im JS */
    padding-top: 22px;             /* Position des Namens */
    transform: none;
    text-align: center;
    z-index: 5;
    pointer-events: none;
    font-size: 24px;
    background: #fff;              /* der weiße Balken */
    color: #000;
    mix-blend-mode: screen;        /* Weiß bleibt Weiß, Schwarz (der Name) zeigt das Video dahinter */
  }
  .site-info .site-name { color: #000; }
  .site-info .site-details { display: none; }

  /* Kopie des Namens: weiß mit Difference, invertiert genau die Stelle im Loch (auf Weiß = schwarz) */
  .site-info-ghost {
    display: block;
    position: fixed;
    top: 22px;
    left: 0;
    right: 0;
    height: auto;
    padding: 0;
    z-index: 7;
    pointer-events: none;
    text-align: center;
    font-size: 24px;
    transform: none;
    background: none;
    color: #fff;
    mix-blend-mode: difference;
  }
  .site-info-ghost .site-name { color: #fff; }
  .site-info-ghost .site-details { display: none; }
  body.pseudo-fs-open .site-info-ghost { display: none; }

  /* Kategorien mittig unter dem Namen, "Music" statt "Music Video" */
  .filters {
    top: 62px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    gap: 7px;
    z-index: 6;
  }
  .filters button { font-size: 12px; }   /* gleiche Größe wie Titel und Credits */
  .filters .full { display: none; }
  .filters .short { display: inline; }

  /* Caption und Credits immer sichtbar, in einer Zeile */
  .caption {
    opacity: 1;
    gap: 8px;
    font-size: 9px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    transition: none;
  }
  .caption-title,
  .caption-director {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Unten: Mute-Pille links am Rand, Contact-Pille rechts, fixiert.
     Untere Ebene (.fold-row): weiße Pille mit Kontrast-Effekt, Schrift unsichtbar, nimmt die Berührungen an.
     Obere Ebene (.fold-row-text): Kopie nur mit Schrift, ohne Hintergrund. */
  .fold-row {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));   /* über der schwebenden Safari-Leiste; kleiner = weiter unten */
    z-index: 6;
    display: flex;
    flex-direction: row;
    justify-content: space-between;   /* Mute links, Contact rechts */
    align-items: stretch;             /* beide Pillen gleich hoch */
    pointer-events: none;             /* die Zeile selbst blockiert keine Berührungen */
    mix-blend-mode: difference;       /* Kontrast mit dem, was dahinter liegt */
  }
  .fold-row > * { pointer-events: auto; }

  .mute-fab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: transparent;               /* Schrift/Icon kommt von der oberen Ebene */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  /* Unsichtbar vergrößerte Tippfläche (je 30 px nach allen Seiten) */
  .mute-fab::after {
    content: "";
    position: absolute;
    top: -30px;
    right: -30px;
    bottom: -30px;
    left: -30px;
  }
  .mute-fab svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
  }

  /* Fold-out: eine zusammenhängende Pille */
  .info-fold {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    background: #fff;
    border-radius: 999px;             /* abgerundet */
    font-family: "Aesteticoformal", serif;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .info-fold-links {
    display: flex;
    flex-direction: row;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: max-width .35s ease, opacity .2s ease;
  }
  .info-fold-links a {
    color: transparent;
    text-decoration: none;
    background: none;
    padding: 6px 0 6px 12px;
    border-radius: 0;
  }
  .info-fold.open .info-fold-links {
    max-width: 230px;
    opacity: 1;
    pointer-events: auto;
  }

  .info-fold-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px 6px 12px;
    border: 0;
    border-radius: 0;
    background: none;
    color: transparent;
    font: inherit;
    text-transform: uppercase;
    letter-spacing: inherit;
    cursor: pointer;
  }
  .info-fold-btn svg { width: 15px; height: 15px; transition: transform .3s ease; }
  .info-fold.open .info-fold-btn svg { transform: rotate(180deg); }

  /* Obere Ebene: gleiche Pille, nur Schrift, kein Blend, keine Berührung.
     Die Schriftfarbe setzt das JS (weiß oder schwarz, je nach Helligkeit dahinter). */
  .fold-row-text {
    --pill-text: #fff;
    z-index: 7;
    mix-blend-mode: normal;
  }
  .fold-row-text,
  .fold-row-text * { pointer-events: none !important; }
  .fold-row-text .mute-fab,
  .fold-row-text .info-fold { background: transparent; }
  .fold-row-text .mute-fab,
  .fold-row-text .info-fold-btn,
  .fold-row-text .info-fold-links a {
    color: var(--pill-text);
    transition: color .2s ease;
  }
}