/* =======================================================================
   TALS — FILMS (Refined • Footer SSOT + Slider)
   - Footer yüksekliği tek yerden: --footer-h (+ --safe-b) ve --app-hf
   - Desktop: 3 kart yan yana grid
   - Mobil (≤1023.98px): her slaytta 1 kart, dikey slider (section-nav uyumlu)
   ======================================================================= */

/* ---- Kart / Görsel ---- */
#films .film-card {
  position: relative;
  /* border-radius: var(--films-card-radius, 18px); */
  overflow: hidden;
  isolation: isolate;
  box-shadow: var(--films-shadow, 0 14px 40px rgba(0, 0, 0, 0.35));
  background: #111;
}
#films .film-bg {
  position: absolute;
  inset: 0;
  background: var(--bg, none) 50% 50% / cover no-repeat;
  transform: scale(1.02);
  will-change: transform;
}
#films .film-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 55%);
  z-index: 1;
  pointer-events: none;
}

/* TITLE — sol altta, daha aşağı (Customizer değişkenleriyle) */
#films .film-title {
  position: absolute;
  left: 16px;
  bottom: var(--films-title-bottom-d, 24px); /* Customizer: Desktop başlık alt boşluk */
  margin: 0;
  z-index: 2;
  color: #fff;
  font-family: var(
    --films-title-font-d,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Inter,
    Helvetica,
    Arial
  );
  font-weight: 800;
  font-size: var(--films-title-size-d, clamp(18px, 2.6vw, 28px));
  line-height: 1.15;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* PLAY — tam orta + glass + hover anim (Customizer değişkenleriyle) */
#films .film-play {
  position: absolute;
  left: 50%;
  top: 50%;
  bottom: auto;
  z-index: 2;

  width: var(--films-play-size, 64px);
  height: var(--films-play-size, 64px);
  border-radius: 999px;

  border: 1px solid var(--films-play-border, var(--films-glass-b, rgba(255, 255, 255, 0.22)));
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 55%),
    rgba(var(--films-play-bg-rgb, 0, 0, 0), var(--films-play-bg-a, 0.45));

  display: grid;
  place-items: center;
  cursor: pointer;

  -webkit-appearance: none;
  appearance: none;

  -webkit-backdrop-filter: blur(var(--films-play-blur, 10px)) saturate(140%);
  backdrop-filter: blur(var(--films-play-blur, 10px)) saturate(140%);

  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);

  /* MERKEZ SABİT */
  transform: translate(-50%, -50%);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    filter 0.18s ease;
}
#films .film-play::before {
  content: '';
  width: calc(var(--films-play-size, 64px) / 3);
  height: calc(var(--films-play-size, 64px) / 3);
  background: var(--films-play-icon, #ffffff);
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23fff" d="M8 5v14l11-7z"/></svg>')
    no-repeat 50% 50%;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23fff" d="M8 5v14l11-7z"/></svg>')
    no-repeat 50% 50%;
}

/* Glass “sheen” */
#films .film-play::after {
  content: '';
  position: absolute;
  inset: -40%;
  pointer-events: none;
  background:
    radial-gradient(closest-side at 30% 25%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 60%),
    radial-gradient(closest-side at 70% 75%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 62%);
  opacity: 0.9;
  transform: translate(-6%, -8%) rotate(12deg);
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}

@media (hover: hover) {
  #films .film-play:hover {
    /* MERKEZ KORUNUR */
    transform: translate(-50%, -52%) scale(1.04);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
    filter: saturate(1.08);
  }
  #films .film-play:hover::after {
    transform: translate(6%, 8%) rotate(12deg);
    opacity: 1;
  }
}

#films .film-play:active {
  transform: translate(-50%, -48%) scale(0.98);
}

/* === FILMS — Kart içinde inline video oynatıcı ==================== */

/* Kart oynarken arka planı kapat */
#films .film-card.is-playing .film-bg {
  opacity: 0;
  pointer-events: none;
}

/* Inline player: kartın tamamını kaplasın */
#films .film-inline-frame {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #000;
  overflow: hidden;
}

/* Inline player kapatma düğmesi */
#films .film-inline-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 6;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

#films .film-inline-close::before {
  content: '';
  width: 16px;
  height: 16px;
  background: #fff;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23fff" d="M6.4 4.9 4.9 6.4 10.5 12 4.9 17.6 6.4 19.1 12 13.5 17.6 19.1 19.1 17.6 13.5 12 19.1 6.4 17.6 4.9 12 10.5z"/></svg>')
    no-repeat 50% 50%;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23fff" d="M6.4 4.9 4.9 6.4 10.5 12 4.9 17.6 6.4 19.1 12 13.5 17.6 19.1 19.1 17.6 13.5 12 19.1 6.4 17.6 4.9 12 10.5z"/></svg>')
    no-repeat 50% 50%;
}

#films .film-inline-frame iframe,
#films .film-inline-frame video {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  object-fit: cover;
}

/* Oynarken play butonu hafif bastırılmış dursun (merkez korunur) */
#films .film-card.is-playing .film-play {
  transform: translate(-50%, -50%) scale(0.96);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

/* =======================================================================
   SECTION • Footer-merkezli yükseklik
   - Section yüksekliği styles.css’ten (var(--app-hf)) gelir
   ======================================================================= */
#films {
  position: relative;
  /* height/min-height BURADAN KALDIRILDI; section yükseklikleri
     #asp-sections > section kuralından gelir */
  background: var(--section-bg, #0b0b0f);
  overflow: clip;
}

/* Viewport: header-aware, footer zaten app-hf’ten düşüldü */
#films .films-viewport,
#films .tals-films__viewport {
  position: absolute;
  left: 0;
  right: 0;

  /* HEADER varsa onun altından başla,
     yoksa sadece safe-area-top kadar yukarıdan başlar */
  top: var(--header-safe);

  /* FOOTER app-hf’te zaten düşüldüğü için burada 0 kullanıyoruz */
  bottom: 0;

  background: var(--section-bg, #0b0b0f);
  overflow: hidden;
}

/* Desktop: 3 kart yan yana grid (track) */
#films .films-grid,
#films .tals-films__track {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: clamp(6px, 1.2vw, 12px);
  /* padding: clamp(8px, 2vw, 14px); */
}

/* =======================================================================
   MODAL (scope'lu + global fallback teklerine indirildi)
   ======================================================================= */
.film-modal[hidden],
#films .film-modal[hidden] {
  display: none !important;
}

#films .film-modal {
  position: absolute;
  top: var(--header-safe, var(--sa-top, 0px));
  bottom: var(--footer-safe, 0px);
  left: 0;
  right: 0;
  z-index: 2147483200;
  display: none;
  padding: clamp(16px, 3vw, 32px);
  background:
    radial-gradient(60rem 60rem at 10% 0%, rgba(255, 255, 255, 0.08), transparent 45%),
    rgba(0, 0, 0, 0.9);
  pointer-events: auto;
}

.film-modal .film-inner,
#films .film-modal .film-inner {
  position: relative;
  width: min(1100px, 86vw);
  aspect-ratio: 16/9;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.55);
}
.film-modal .film-player iframe,
#films .film-modal .film-player iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}
.film-modal .film-close,
#films .film-modal .film-close {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2147483201;
}
.film-modal .film-close::before,
#films .film-modal .film-close::before {
  content: '';
  width: 16px;
  height: 16px;
  background: #fff;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23fff" d="M6.4 4.9 4.9 6.4 10.5 12 4.9 17.6 6.4 19.1 12 13.5 17.6 19.1 19.1 17.6 13.5 12 19.1 6.4 17.6 4.9 12 10.5z"/></svg>')
    no-repeat 50% 50%;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23fff" d="M6.4 4.9 4.9 6.4 10.5 12 4.9 17.6 6.4 19.1 12 13.5 17.6 19.1 19.1 17.6 13.5 12 19.1 6.4 17.6 4.9 12 10.5z"/></svg>')
    no-repeat 50% 50%;
}

/* Modal açıkken scroll kilidi (global) */
html.modal-open,
body.modal-open {
  overflow: hidden;
}

/* [ROLLBACK: films-hide-header-while-playing] */
html.films-playing .site-header,
body.films-playing .site-header {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ---- Kontrol Barı (modal içi) ---- */
#films .film-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: env(safe-area-inset-bottom, 0px); /* [GÜNCEL] footer'dan bağımsız, yalnız safe-area */
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  justify-content: flex-start;
  align-items: center;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  z-index: 3;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
#films .film-controls[hidden] {
  display: none !important;
}

#films .film-controls .film-pp,
#films .film-controls .film-mute {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
#films .film-controls .film-pp::before {
  content: '';
  width: 16px;
  height: 16px;
  background: #fff;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8 5v14l11-7z" fill="%23fff"/></svg>')
    no-repeat 50% 50%;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8 5v14l11-7z" fill="%23fff"/></svg>')
    no-repeat 50% 50%;
}
#films .film-controls .film-pp.is-playing::before {
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 5h4v14H6zm8 0h4v14h-4z" fill="%23fff"/></svg>')
    no-repeat 50% 50%;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 5h4v14H6zm8 0h4v14h-4z" fill="%23fff"/></svg>')
    no-repeat 50% 50%;
}
#films .film-controls .film-mute::before {
  content: '';
  width: 18px;
  height: 18px;
  background: #fff;
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 9v6h4l5 5V4L9 9H5z" fill="%23fff"/></svg>')
    no-repeat 50% 50%;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 9v6h4l5 5V4L9 9H5z" fill="%23fff"/></svg>')
    no-repeat 50% 50%;
}
#films .film-controls .film-mute.is-muted::before {
  -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16 7.82V4l-7 5H5v6h4l7 5v-5.82l2.59 2.59 1.41-1.41L4.41 3.86 3 5.27 16 18.27V7.82z" fill="%23fff"/></svg>')
    no-repeat 50% 50%;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16 7.82V4l-7 5H5v6h4l7 5v-5.82l2.59 2.59 1.41-1.41L4.41 3.86 3 5.27 16 18.27V7.82z" fill="%23fff"/></svg>')
    no-repeat 50% 50%;
}
#films .film-controls .time,
#films .film-controls .title {
  color: #fff;
  font:
    600 12px/1.2 ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Inter,
    Helvetica,
    Arial;
  opacity: 0.92;
}
#films .film-controls .progress {
  position: relative;
  height: 3px;
  flex: 1 1 auto;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
#films .film-controls .progress > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--prog, 0%);
  background: #fff;
  opacity: 0.9;
}

/* =======================================================================
   MOBİL SLIDER (≤1023.98px)
   - Her film slaytı neredeyse tam bir ekran
   - Section-nav her "sonraki" jestinde 1 slayt kaydırır
   ======================================================================= */
@media (max-width: 1023.98px) {
  #films .film-inline-close {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: calc(env(safe-area-inset-left, 0px) + 12px);
    right: auto;
  }

  /* Viewport: section içinde yine header-safe kadar aşağıdan başlasın;
     mobile'da da app-hf tekrar kullanılmıyor. */
  #films .films-viewport,
  #films .tals-films__viewport {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--header-safe);
    bottom: 0;
    height: auto;
    min-height: 0;
    background: var(--section-bg, #0b0b0f);
    overflow: hidden;
  }

  /* Track: dikey slider (JS transform: translateY%) */
  #films .films-grid,
  #films .tals-films__track {
    position: absolute;
    inset: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    will-change: transform;
    transition: transform 420ms cubic-bezier(0.33, 0.01, 0.18, 0.99);
  }

  /* Her slaytta 1 kart, viewport yüksekliğinde */
  #films .tals-films__slide,
  #films [data-film-slide] {
    flex: 0 0 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* MOBIL FULL-BLEED: kart ekranı TAM kaplasın */
  #films .tals-films__slide,
  #films [data-film-slide] {
    flex: 0 0 100%;
    height: 100%;
    min-height: 100%;
    display: flex;
    align-items: stretch; /* ESKİ: center */
    justify-content: stretch; /* ESKİ: center */
  }

  #films .tals-films__slide .film-card,
  #films [data-film-slide] .film-card,
  #films .tals-films__slide .films-card,
  #films [data-film-slide] .films-card {
    width: 100%;
    height: 100%;
    max-width: none; /* ✅ kaldır */
    max-height: none; /* ✅ kaldır */
    margin: 0; /* ✅ kaldır */
    border-radius: 0; /* ✅ full-bleed hissi */
    box-shadow: none; /* ✅ */
    overflow: hidden;
  }

  /* CTA parametreleri (opsiyonel) */
  #films {
    --films-cta-bg: rgba(0, 0, 0, 0.45);
    --films-cta-blur: 8px;
    --films-cta-radius: 22px;
    --films-cta-gap: clamp(10px, 2.5vw, 16px);
    --films-cta-py: clamp(12px, 4vw, 20px);
    --films-cta-px: clamp(16px, 5vw, 28px);
  }

  #films .film-cta {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--films-cta-gap);
    padding: var(--films-cta-py) var(--films-cta-px);
    max-width: min(90vw, 600px);
    background: var(--films-cta-bg);
    -webkit-backdrop-filter: blur(var(--films-cta-blur));
    backdrop-filter: blur(var(--films-cta-blur));
    border-radius: var(--films-cta-radius);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    z-index: 3;
    pointer-events: none; /* içteki buton hariç */
  }
  #films .film-cta .film-play {
    position: static !important;
    transform: none !important;
    width: var(--films-play-size, 64px);
    height: var(--films-play-size, 64px);
    pointer-events: auto;
  }
  #films .film-cta .film-title {
    position: static !important;
    transform: none !important;
    margin-top: var(--films-title-bottom-m, 28px);
    text-align: center !important;
    font-size: clamp(18px, 4.6vw, 22px);
    line-height: 1.25;
    font-weight: 700;
    text-wrap: balance;
    word-break: break-word;
    max-width: 100%;
  }

  /* Alternatif: CTA'yı kapsayıcı olmadan mutlak merkezlemek isterseniz */
  #films .film-play.centered,
  #films .film-title.centered {
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
  }
  #films .film-play.centered {
    top: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 3 !important;
  }
  #films .film-title.centered {
    top: calc(50% + var(--films-title-bottom-m, 56px)) !important;
    z-index: 3 !important;
    max-width: min(88vw, 34ch);
    text-align: center !important;
  }

  /* Mobil sabit “İzle” butonu (films-more) */
  #films .films-more {
    position: fixed;
    left: clamp(24px, 4vw, 64px);
    z-index: 2147483000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font:
      600 13px/1.2 system-ui,
      -apple-system,
      Segoe UI,
      Roboto,
      Inter,
      Helvetica,
      Arial;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    cursor: pointer;
  }
  #films .films-more svg {
    width: 18px;
    height: 18px;
  }

  /* Mobilde (CTA kullanılmayan durumlar) başlık alt boşluk */
  #films .film-title {
    bottom: var(--films-title-bottom-m, 28px);
    font-family: var(
      --films-title-font-m,
      system-ui,
      -apple-system,
      Segoe UI,
      Roboto,
      Inter,
      Helvetica,
      Arial
    );
    font-size: var(--films-title-size-m, 22px);
    line-height: 1.15;
  }

  /* CTA kullanılmıyorsa da play merkezde kalsın */
  #films .film-play {
    left: 50%;
    top: 50%;
    bottom: auto;
  }
}

@media (max-width: 1024px) {
  #films .film-title {
    bottom: var(--films-title-bottom-m, 28px);
  }
}

/* =======================================================================
   Erişilebilirlik / Etkileşim
   ======================================================================= */
#films .film-play,
#films .film-cta {
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Nav kilidinde kaydırma davranışı */
html[data-nav-lock='1'],
html[data-nav-lock='1'] body {
  scroll-behavior: auto !important;
  overscroll-behavior: contain;
}
html[data-nav-lock='1'] * {
  scroll-behavior: auto !important;
}

/* (Opsiyonel) Kartlar slaydı tamamen kaplasın: destek sınıfları */
#films .tals-films__slide,
#films [data-film-slide] {
  height: 100%;
}
#films .tals-films__slide .film-card,
#films [data-film-slide] .film-card,
#films .tals-films__slide .films-card,
#films [data-film-slide] .films-card {
  height: 100%;
  max-height: 100%;
}
