/* TaktFlo Cinema — Apple-inspirierte Tiefe, Hintergrundbilder, Scroll-Motion */

/* Scroll-Fortschritt (0–1) wird per cinema.js auf :root gesetzt */
:root {
  --tf-scroll: 0;
}

/* ─── Hero: Mesh, Glows, Foto, Grain ─── */
.tf-hero--cinema {
  position: relative;
  overflow: clip;
  isolation: isolate;
  padding-top: clamp(2rem, 6vw, 3.5rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.tf-cinema-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.tf-cinema-layer__mesh {
  position: absolute;
  inset: -40% -20%;
  background:
    radial-gradient(ellipse 70% 50% at 30% 20%, rgba(59, 130, 246, 0.2), transparent 60%),
    radial-gradient(ellipse 60% 45% at 75% 80%, rgba(99, 102, 241, 0.15), transparent 55%),
    radial-gradient(ellipse 80% 60% at 50% 50%, rgba(37, 99, 235, 0.1), transparent 60%),
    linear-gradient(175deg, #e8ebf0 0%, #d8dce4 40%, #cdd2dc 100%);
  animation: tfMeshDrift 22s ease-in-out infinite alternate;
  transform: translate3d(0, calc(var(--tf-scroll, 0) * -40px), 0);
}

@keyframes tfMeshDrift {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1.02);
  }
  100% {
    transform: translate3d(2%, 1%, 0) scale(1.06);
  }
}

.tf-cinema-layer__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  animation: tfGlowPulse 8s ease-in-out infinite;
}

.tf-cinema-layer__glow--1 {
  width: min(65vw, 520px);
  height: min(65vw, 520px);
  top: -15%;
  right: -10%;
  background: rgba(59, 130, 246, 0.25);
  transform: translate3d(0, calc(var(--tf-scroll, 0) * -80px), 0);
}

.tf-cinema-layer__glow--2 {
  width: min(50vw, 400px);
  height: min(50vw, 400px);
  bottom: 10%;
  left: -12%;
  background: rgba(99, 102, 241, 0.2);
  animation-delay: -3s;
  transform: translate3d(0, calc(var(--tf-scroll, 0) * -120px), 0);
}

@keyframes tfGlowPulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.08);
  }
}

.tf-cinema-layer__photo {
  display: none;
}

.tf-cinema-layer__grain {
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.tf-hero--cinema .tf-container {
  position: relative;
  z-index: 1;
}

.tf-hero--cinema .tf-share-flow {
  filter: drop-shadow(0 20px 40px rgba(15, 23, 42, 0.15));
}

.tf-hero--cinema .tf-hero__title {
  animation: tfCinemaTitleIn 1.15s var(--tf-ease-out) 0.15s both;
}

.tf-hero--cinema .tf-eyebrow {
  animation: tfCinemaFadeUp 0.9s var(--tf-ease-out) both;
}

@keyframes tfCinemaTitleIn {
  from {
    opacity: 0;
    filter: blur(14px);
    transform: translate3d(0, 28px, 0);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0);
  }
}

@keyframes tfCinemaFadeUp {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* Features: dezentes Hintergrundmotiv */
#funktionen.tf-section {
  position: relative;
  isolation: isolate;
  overflow: clip;
}

#funktionen.tf-section::before {
  content: "";
  position: absolute;
  inset: -20% -10%;
  z-index: 0;
  pointer-events: none;
  background: url("../images/Metronom.png") 92% 20% / min(42vw, 380px) no-repeat;
  opacity: 0.045;
  filter: blur(1px);
  transform: translate3d(calc(var(--tf-scroll, 0) * -40px), calc(var(--tf-scroll, 0) * 30px), 0)
    rotate(-6deg);
}

#funktionen.tf-section > .tf-container {
  position: relative;
  z-index: 1;
}

/* ─── Horizontale Bildgalerie (Scroll-Snap) ─── */
.tf-cinema-gallery {
  position: relative;
  padding: clamp(2.5rem, 6vw, 4rem) 0 clamp(2rem, 5vw, 3rem);
  overflow: hidden;
}

.tf-cinema-gallery::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 50% at 30% 50%, rgba(59, 130, 246, 0.08), transparent 60%);
  pointer-events: none;
}

.tf-cinema-gallery__eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tf-accent);
}

.tf-cinema-gallery__title {
  margin: 0 0 1.75rem;
  font-family: var(--tf-display);
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 16ch;
}

.tf-cinema-gallery__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: max(1.25rem, env(safe-area-inset-left));
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1rem;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.tf-cinema-gallery__track {
  display: flex;
  gap: 1.15rem;
  padding-inline: max(1.25rem, env(safe-area-inset-left)) 2.5rem;
  width: max-content;
  animation: tfGalleryDrift 48s linear infinite;
}

.tf-cinema-gallery__viewport:hover .tf-cinema-gallery__track,
.tf-cinema-gallery__viewport:focus-within .tf-cinema-gallery__track {
  animation-play-state: paused;
}

@keyframes tfGalleryDrift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-12%, 0, 0);
  }
}

.tf-cinema-gallery__card {
  flex: 0 0 auto;
  width: min(78vw, 340px);
  margin: 0;
  scroll-snap-align: start;
  border-radius: var(--tf-radius-lg);
  overflow: hidden;
  background: var(--tf-bg-card);
  border: 1px solid var(--tf-border);
  box-shadow: var(--tf-shadow-lg);
  transition:
    transform 0.45s var(--tf-ease-spring),
    box-shadow 0.45s var(--tf-ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .tf-cinema-gallery__card:hover {
    transform: translate3d(0, -8px, 0) scale(1.03);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.18);
  }
}

.tf-cinema-gallery__card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: linear-gradient(145deg, #dce0e8, #c4c9d4);
}

.tf-cinema-gallery__card figcaption {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--tf-text);
}

.tf-cinema-gallery__card--featured {
  width: min(85vw, 400px);
  border-color: rgba(242, 101, 34, 0.35);
  box-shadow: 0 24px 56px rgba(242, 101, 34, 0.12);
}

/* ─── Vollflächige Szenen-Hintergründe ─── */
.tf-cinema-scene {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.tf-section--showcase.tf-showcase--cinema,
.tf-section--cinema-devices,
.tf-section--cinema-cta {
  position: relative;
  isolation: isolate;
  overflow: clip;
}

.tf-section--showcase.tf-showcase--cinema > .tf-container,
.tf-section--cinema-devices > .tf-container,
.tf-section--cinema-cta > .tf-container {
  position: relative;
  z-index: 1;
}

.tf-cinema-scene--showcase {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(59, 130, 246, 0.12), transparent 55%),
    linear-gradient(180deg, #c4c9d4 0%, #d0d4dc 50%, #bcc1cb 100%);
}

.tf-cinema-scene--showcase::after {
  content: "";
  position: absolute;
  inset: 10% 5%;
  background: url("../images/Notationen.png") center / contain no-repeat;
  opacity: 0.06;
  filter: blur(2px);
  transform: scale(1.15);
}

.tf-cinema-scene--devices {
  background: transparent;
}

.tf-cinema-scene--devices::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 55% 40% at 50% 30%, rgba(59, 130, 246, 0.08), transparent 70%);
}

.tf-section--cinema-devices .tf-section__title,
.tf-section--cinema-devices .tf-section__subtitle,
.tf-section--cinema-devices .tf-devices-overlap__hint {
  color: var(--tf-text);
}

.tf-section--cinema-devices .tf-section__subtitle {
  color: var(--tf-muted);
}

.tf-cinema-scene--cta {
  display: none;
}

.tf-section--cinema-cta .tf-cta__title,
.tf-section--cinema-cta .tf-cta__text {
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
}

/* ─── Showcase: Sticky + Zoom beim Scrollen ─── */
.tf-showcase--cinema .tf-showcase__item {
  --cinema-progress: 0;
}

/* Geräte: Parallax-Tiefe */
.tf-section--cinema-devices .tf-devices-overlap__item {
  transition: transform 0.35s var(--tf-ease-out);
  will-change: transform;
}

.tf-section--cinema-devices .tf-devices-overlap__item--phone {
  transform: translate3d(0, calc(var(--device-parallax-phone, 0) * 1px), 0);
}

.tf-section--cinema-devices .tf-devices-overlap__item--tablet {
  transform: translate3d(0, calc(var(--device-parallax-tablet, 0) * 1px), 0);
}

.tf-section--cinema-devices .tf-devices-overlap__item--laptop {
  transform: translate3d(0, calc(var(--device-parallax-laptop, 0) * 1px), 0);
}

/* Schritte: Linie wächst */
.tf-steps.tf-reveal-stagger.is-visible::before {
  content: "";
  position: absolute;
  left: 1.65rem;
  top: 2.5rem;
  bottom: 2rem;
  width: 2px;
  background: linear-gradient(180deg, var(--tf-accent), transparent);
  transform-origin: top;
  animation: tfStepsLine 1.2s var(--tf-ease-out) 0.2s both;
}

.tf-steps {
  position: relative;
}

@keyframes tfStepsLine {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

/* Blur-Reveal für Sektionstitel */
html.tf-cinema-js .tf-cinema-blur:not(.is-cinema-visible) {
  opacity: 0.4;
  filter: blur(10px);
  transform: translate3d(0, 20px, 0);
}

html.tf-cinema-js .tf-cinema-blur.is-cinema-visible {
  opacity: 1;
  filter: blur(0);
  transform: translate3d(0, 0, 0);
  transition:
    opacity 0.85s var(--tf-ease-out),
    filter 0.85s var(--tf-ease-out),
    transform 0.85s var(--tf-ease-spring);
}

@media (prefers-reduced-motion: reduce) {
  .tf-cinema-layer__mesh,
  .tf-cinema-layer__glow,
  .tf-cinema-layer__photo,
  .tf-cinema-gallery__track,

  .tf-showcase--cinema .tf-showcase__figure,
  .tf-showcase--cinema .tf-showcase__copy {
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
  }

  .tf-section--cinema-devices .tf-devices-overlap__item {
    transform: none !important;
  }
}
