/**
 * FAST one-page — maksimum CSS sahne geçişleri
 * Scroll-driven animations (view / scroll timeline) + class fallback
 */

:root {
  --scene-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --scene-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --scene-blur: 16px;
  --scene-travel-x: 120px;
  --scene-travel-y: 32px;
}

/* ─── Sahne köprüsü (üst/alt yumuşak geçiş) ─── */
.op-scene--video::before,
.op-scene--hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: clamp(48px, 8vh, 96px);
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(5, 6, 10, 0.72) 0%, transparent 100%);
  opacity: 0.85;
  transition: opacity 0.7s var(--scene-ease);
}

.op-scene--video.is-scene-active::before,
.op-scene--hero.is-scene-active::before {
  opacity: 0.35;
}

/* ─── Scroll progress (saf CSS) ─── */
@supports (animation-timeline: scroll()) {
  html.css-scroll-scenes .cm-progress__bar {
    animation: cssScrollProgress linear forwards;
    animation-timeline: scroll(root);
    animation-range: 0% 100%;
    transform-origin: left center;
  }

  @keyframes cssScrollProgress {
    from {
      transform: scaleX(0);
    }
    to {
      transform: scaleX(1);
    }
  }
}

/* ─── Scroll-driven: video + scrim + panel ─── */
@supports (animation-timeline: view()) {
  html.css-scroll-scenes .op-scene--video .op-scene__video.is-ready:not(.is-error),
  html.css-scroll-scenes .op-scene--hero .op-scene__video.is-ready:not(.is-error) {
    animation: cssSceneVideoReveal linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 45%;
  }

  html.css-scroll-scenes .op-scene--video .op-scene__scrim,
  html.css-scroll-scenes .op-scene--hero .op-scene__scrim {
    animation: cssSceneScrimReveal linear both;
    animation-timeline: view();
    animation-range: entry 5% cover 50%;
  }

  html.css-scroll-scenes .op-scene--video .op-scene__media,
  html.css-scroll-scenes .op-scene--hero .op-scene__media {
    animation: cssSceneMediaSettle linear both;
    animation-timeline: view();
    animation-range: entry 0% exit 100%;
  }

  html.css-scroll-scenes .op-scene--video.is-scene-active .op-scene__media:has(.op-scene__video.is-playing:not(.is-error)),
  html.css-scroll-scenes .op-scene--hero.is-scene-active .op-scene__media:has(.op-scene__video.is-playing:not(.is-error)) {
    animation:
      cssSceneMediaSettle linear both,
      cssKenBurns 22s ease-in-out infinite alternate;
    animation-timeline: view(), auto;
    animation-range: entry 0% exit 100%, normal;
  }

  /* Metin animasyonları scene-motion-go + sceneInLeft/Right (home-onepage-scenes.css) */
}

@keyframes cssSceneVideoReveal {
  0% {
    opacity: 0;
    filter: blur(var(--scene-blur));
  }
  40% {
    opacity: 0.6;
    filter: blur(calc(var(--scene-blur) * 0.4));
  }
  100% {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes cssSceneScrimReveal {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

@keyframes cssSceneMediaSettle {
  entry 0% {
    transform: scale(1.04);
  }
  entry 100% {
    transform: scale(1);
  }
  exit 0% {
    transform: scale(1);
  }
  exit 100% {
    transform: scale(1.03);
  }
}

@keyframes cssScenePanelLeft {
  from {
    opacity: 0;
    transform: translate3d(calc(var(--scene-travel-x) * -0.45), var(--scene-travel-y), 0);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

@keyframes cssScenePanelRight {
  from {
    opacity: 0;
    transform: translate3d(calc(var(--scene-travel-x) * 0.45), var(--scene-travel-y), 0);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

@keyframes cssSceneEyebrowLeft {
  from {
    opacity: 0;
    transform: translate3d(-72px, 18px, 0);
    filter: blur(12px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

@keyframes cssSceneEyebrowRight {
  from {
    opacity: 0;
    transform: translate3d(72px, 18px, 0);
    filter: blur(12px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

@keyframes cssSceneWordLeft {
  from {
    opacity: 0;
    transform: translate3d(calc(var(--scene-travel-x) * -0.85), 22px, 0);
    filter: blur(14px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

@keyframes cssSceneWordRight {
  from {
    opacity: 0;
    transform: translate3d(calc(var(--scene-travel-x) * 0.85), 22px, 0);
    filter: blur(14px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

@keyframes cssSceneAccentIn {
  from {
    opacity: 0;
    transform: translate3d(96px, 16px, 0) scale(0.92);
    filter: blur(14px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes cssScrollHintIn {
  from {
    opacity: 0;
    transform: translate3d(-50%, 18px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes cssScrollHintBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(6px);
  }
}

@keyframes cssSceneFormIn {
  from {
    opacity: 0;
    transform: translate3d(48px, 12px, 0);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    filter: blur(0);
  }
}

/* ─── Aktif sahne: hafif Ken Burns (media katmanında — video transform çakışmaz) ─── */
.op-scene--video.is-scene-active .op-scene__media:has(.op-scene__video.is-playing:not(.is-error)) {
  animation: cssKenBurns 22s ease-in-out infinite alternate;
}

@keyframes cssKenBurns {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.045);
  }
}

/* ─── Scroll hint (fallback, her tarayıcı) ─── */
.op-scene__scroll-hint {
  opacity: 0.55;
  transition: opacity 0.5s ease;
}

.op-scene.is-scene-active .op-scene__scroll-hint {
  opacity: 1;
  visibility: visible;
}

.op-scene:not(.is-scene-active) .op-scene__scroll-hint {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.op-scene__scroll-hint svg {
  animation: cssScrollHintBob 2.4s var(--scene-ease) infinite;
}

/* ─── Dock nav: scroll ile cam efekti ─── */
body.fast-onepage:not(.is-contact-active) .fast-nav__dock {
  transition:
    background 0.45s var(--scene-ease),
    border-color 0.45s var(--scene-ease),
    box-shadow 0.45s var(--scene-ease),
    transform 0.45s var(--scene-ease);
}

@supports (animation-timeline: scroll()) {
  html.css-scroll-scenes body.fast-onepage .fast-nav__dock {
    animation: cssNavDockDepth linear both;
    animation-timeline: scroll(root);
    animation-range: 0% 12%;
  }

  @keyframes cssNavDockDepth {
    from {
      background: rgba(5, 6, 10, 0.55);
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    }
    to {
      background: rgba(5, 6, 10, 0.82);
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.38);
    }
  }
}

/* ─── İletişim sahnesi cam panel ─── */
.op-scene--contact .op-scene__contact-panel {
  transition:
    transform 0.9s var(--scene-ease),
    box-shadow 0.9s var(--scene-ease);
}

.op-scene--contact.is-scene-active .op-scene__contact-panel {
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* ─── Fallback: view() yok — mevcut class animasyonları güçlendir ─── */
html:not(.css-scroll-scenes) .op-scene.scene-motion-go .mu-blur-in.is-visible .mu-blur-in__word {
  animation-duration: 1s !important;
}

html:not(.css-scroll-scenes) .op-scene.scene-motion-go .mu-blur-in.is-visible [data-mu-blur-target] {
  animation-duration: 0.95s !important;
}

@media (prefers-reduced-motion: reduce) {
  html.css-scroll-scenes .op-scene--video .op-scene__video,
  html.css-scroll-scenes .op-scene .mu-blur-in__word,
  html.css-scroll-scenes .op-scene .op-scene__content.mu-blur-in,
  html.css-scroll-scenes .cm-progress__bar {
    animation: none !important;
  }

  .op-scene--video.is-scene-active .op-scene__video.is-playing {
    animation: none !important;
  }

  .op-scene__scroll-hint svg {
    animation: none !important;
  }
}
