/* =========================
   GLOBAL
========================= */

:root{
  --ui-pad-x: 48px;
  --ui-pad-y: 40px;
  --gap: 40px;

  --txt: rgba(255,255,255,0.92);
  --txt-dim: rgba(255,255,255,0.78);

  --blackGlow: drop-shadow(0 0 14px rgba(0,0,0,0.85));
  --whiteGlow: drop-shadow(0 0 14px rgba(255,255,255,0.35));
}

*{ box-sizing: border-box; }

html, body{ overscroll-behavior: none; }

body{
  margin: 0;
  min-height: 100vh;
  color: white;
  background: black;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans", "Liberation Sans", sans-serif;

  /* Background: NICHT cover (damit es weniger "gezoomt" wirkt wie vorher) */
  background-image: url("./img/ClipsAnimation_Background_Ver3.webp");
  background-repeat: no-repeat;
   background-position: center center;
  background-size: cover;
  background-attachment: scroll; /* explizit: bewegt sich normal mit */
}

::-webkit-scrollbar{ width: 0; background: transparent; }

body.vm-open{ overflow: hidden; }

/* =========================
   HEADER UI
========================= */

.back-arrow{
  position: fixed;
  top: 28px;
  left: 32px;
  z-index: 1200;
  display: inline-flex;
  pointer-events: auto;
}

.back-arrow img{
  width: clamp(80px, 12vw, 128px);
  height: auto;
  display: block;
  transition: transform 0.2s ease;
}

.back-arrow:hover img{ transform: scale(1.1); }

/* Title centered + scroll shrink in ALL stages */
.page-title{
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  pointer-events: none;
}

.page-title img{
  width: clamp(420px, 33vw, 690px);
  height: auto;
  display: block;
  filter: brightness(92%);
  transition:
    width 0.35s cubic-bezier(0.4,0,0.2,1),
    transform 0.35s cubic-bezier(0.4,0,0.2,1),
    filter 0.25s ease;
}

.page-title.is-small{
  top: 10px;
}

.page-title.is-small img{
  width: clamp(330px, 24vw, 540px);
  filter: brightness(100%);
}

/* Mobile/Hochkant: größer, aber nicht stumpf 1.5x */
@media (max-width: 600px), (max-aspect-ratio: 3/4){
  .back-arrow{ top: 22px; left: 18px; }
  .back-arrow img{ width: clamp(72px, 14vw, 120px); }

  .page-title img{
    width: 86vw;
    max-width: 690px;
  }
  .page-title.is-small img{
    width: 62vw;
    max-width: 540px;
  }
}

/* =========================
   BASIC FILM LIST
========================= */

.films{
  padding: 270px 0 0;
  width: 100%;
}

.film-item{
  /* wieder kleiner/luftiger als die zuletzt zu große Version */
  width: min(820px, calc(100vw - 2 * clamp(16px, 7vw, 180px)));
  margin: 0 auto 78px;

  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Headings: +50% Größe, black glow always, white on hover */
.film-heading{
  appearance: none;
  border: none;
  background: transparent;
  color: var(--txt);
  text-align: left;

  font-weight: 780;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  font-size: clamp(1.8rem, 2.4vw, 2.55rem);
  padding: 0;
  cursor: pointer;

  filter: var(--blackGlow);
  transition: filter 0.22s ease, transform 0.22s ease, opacity 0.22s ease;
}

.film-heading:hover{
  filter: var(--whiteGlow);
  transform: translateY(-1px);
}

/* Video clickable wrapper */
.film-video-btn{
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}

/* Video glow on hover */
.film-video{
  width: 100%;
  height: auto;
  display: block;

  border-radius: 0;
  outline: none;

  filter: brightness(0.98);
  transition: transform 0.25s ease, filter 0.25s ease;
}

.film-video-btn:hover .film-video{
  filter: brightness(1.05) drop-shadow(0 0 16px rgba(255,255,255,0.25));
  transform: scale(1.01);
}

@media (max-width: 700px){
  .film-item{
    width: calc(100vw - 40px);
  }
}

/* =========================
   FOOTER
========================= */

.site-footer{
  margin-top: 120px;
  background: rgba(255,255,255,0.96);
  color: #111;
  box-shadow: 0 -18px 40px rgba(0,0,0,0.45);
}

.footer-inner{
  width: min(1100px, calc(100vw - 2 * clamp(16px, 6vw, 140px)));
  margin: 0 auto;
  padding: 42px 0;

  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: start;
}

.impressum h3{
  margin: 0 0 10px;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.impressum p{
  margin: 0 0 10px;
  line-height: 1.45;
  font-size: 0.98rem;
}

.impressum a{
  color: #111;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-logo img{
  width: clamp(120px, 12vw, 180px);
  height: auto;
  display: block;
  opacity: 0.92;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.footer-logo:hover img{
  opacity: 1;
  transform: scale(1.03);
}

@media (max-width: 700px){
  .footer-inner{
    grid-template-columns: 1fr;
  }
}

/* =========================
   VIDEO MODAL (vm)
========================= */

.vm{
  position: fixed;
  inset: 0;
  z-index: 6000;

  opacity: 0;
  pointer-events: none;

  /* set by JS */
  --stageH: 70vh;
  
  transform: scale(0.99);
  transition: transform 0.45s cubic-bezier(0.4,0,0.2,1), opacity 0.25s ease;
  
}

.vm.is-open{
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);

}

.vm-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  backdrop-filter: blur(6px);
  z-index: 1;
}

.vm-frame{
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: var(--ui-pad-y) var(--ui-pad-x);
  display: flex;
  flex-direction: column;
  gap: 28px;

  opacity: 0;
  transition: opacity 0.25s ease;
}

@media (max-width: 600px), (max-aspect-ratio: 3/4){
  .vm-frame{
    padding: 28px 20px;
  }
}

.vm.is-open .vm-frame{
  opacity: 1;
}

/* Scroll containment (single source of truth)
   - Stage 0/2: frame does NOT scroll
   - Stage 3/4: frame scrolls (stack/flow) */
.vm[data-stage="0"] .vm-frame,
.vm[data-stage="2"] .vm-frame{
  overflow: hidden;
}

.vm[data-stage="3"] .vm-frame,
.vm[data-stage="4"] .vm-frame{
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;

  display: block;
}

/* hide scrollbars inside modal */
.vm *{ scrollbar-width: none; }
.vm *::-webkit-scrollbar{ width: 0; height: 0; }

/* header */
.vm-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
}

/* Stage 3/4: spacing between header and content in normal flow */
.vm[data-stage="3"] .vm-header,
.vm[data-stage="4"] .vm-header{
  margin-bottom: 28px;
}

.vm-titleline{
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.vm-title{
  font-weight: 820;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: white;
  font-size: clamp(1.35rem, 1.9vw, 1.85rem);
}

/* Close */
.vm-close{
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}

.vm-close img{
  width: clamp(28px, 3.2vw, 44px);
  height: auto;
  display: block;
  opacity: 0.9;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.vm-close:hover img{
  opacity: 1;
  transform: scale(1.06);
}

/* layout base */
.vm-layout{
  gap: var(--gap);
  align-items: stretch;
  min-height: 0;
  position: relative;
  z-index: 1;
}

/* -------------------------
   Stage 0 / 2 (Desktop): 2 columns + gutters
   Video size is height-based (JS sets --stageH)
------------------------- */

.vm[data-stage="0"] .vm-layout,
.vm[data-stage="2"] .vm-layout{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--gap);
  align-items: stretch;

  /* gutters */
  padding-left: 4%;
  padding-right: 4%;

  /* match the height-driven video sizing */
  height: var(--stageH);
}

.vm[data-stage="2"] .vm-layout{
  padding-left: 3%;
  padding-right: 3%;
}

/* Description: normal flow, no inner scroll anywhere */
.vm-desc{
  min-width: 0;
  min-height: 0;
}

.vm-desc-inner{
  height: auto;
  overflow: visible;
  color: rgba(255,255,255,0.84);
  line-height: 1.55;
  font-size: 1rem;
}

/* Video column */
.vm-video{
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
}

/* Stage 0/2: push video to the right */
.vm[data-stage="0"] .vm-video,
.vm[data-stage="2"] .vm-video{
  justify-content: flex-end;
}

/* Stage 0/2: height-based sizing */
.vm[data-stage="0"] .vm-video-frame,
.vm[data-stage="2"] .vm-video-frame{
  height: var(--stageH);
  width: auto;          /* shrink-wrap to video */
  max-width: 100%;
  min-width: 0;
  min-height: 0;

  display: flex;
  justify-content: center;
  align-items: center;
}

.vm[data-stage="0"] .vm-video-el,
.vm[data-stage="2"] .vm-video-el{
  height: 100%;
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* -------------------------
   Stage 3 (Stack): frame scroll + width-based video
------------------------- */
.vm[data-stage="3"] .vm-layout{
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  align-items: stretch;
}

/* Stage 3: ensure order is VIDEO then DESC (DOM order is opposite) */
.vm[data-stage="3"] .vm-video{ order: 1; }
.vm[data-stage="3"] .vm-desc{ order: 2; }


.vm[data-stage="3"] .vm-video-frame{
  width: 100%;
  height: auto;
  max-height: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.vm[data-stage="3"] .vm-video-el{
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

/* -------------------------
   Stage 4 (Flow/Mobile): like stage 3, with tighter spacing
------------------------- */
.vm[data-stage="4"] .vm-layout{
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  gap: 22px;
  align-items: stretch;
}

/* Stage 4: ensure order is VIDEO then DESC */
.vm[data-stage="4"] .vm-video{ order: 1; }
.vm[data-stage="4"] .vm-desc{ order: 2; }


.vm[data-stage="4"] .vm-video-frame{
  width: 100%;
  height: auto;
  max-height: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.vm[data-stage="4"] .vm-video-el{
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
}

/* NAV BUTTONS (arrows) */
.vm-nav{
  position: absolute;
  top: var(--navY, 50%); 
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(0,0,0,0.0);

  border-radius: 999px;
  box-shadow: 0 0 18px rgba(0,0,0,0.65);

  cursor: pointer;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.vm-nav:hover{
  box-shadow: 0 0 18px rgba(255,255,255,0.75);
}

/* Nav visibility is controlled by JS via .controls-visible */
.vm.controls-visible .vm-nav{
  opacity: 1;
  pointer-events: auto;
  box-shadow: 0 0 18px rgba(255,255,255,0.75);
}

/* Positioning: one on the left, one on the right (overlay; does not affect layout) */
.vm-prev{ left: -10px; }
.vm-next{ right: -10px; }

/* Accessibility: keyboard focus should show the button even if autohide is on */
.vm-nav:focus-visible{
  outline: 2px solid rgba(255,255,255,0.75);
  outline-offset: 4px;
  box-shadow: 0 0 18px rgba(255,255,255,0.75);
}

/* CSS arrows */
.vm-arrow{
  display: block;
  width: 10px;
  height: 10px;
  margin: 0 auto;
  border-top: 2px solid rgba(255,255,255,0.9);
  border-right: 2px solid rgba(255,255,255,0.9);
}

.vm-arrow-left{ transform: rotate(-135deg); }
.vm-arrow-right{ transform: rotate(45deg); }
