/* Bewegung & Tiefe – bewusst leicht: animiert werden nur transform, translate,
   scale und opacity (laufen auf der Grafikkarte, kein Ruckeln).
   Alles greift erst, wenn assets/js/motion.js die Klasse .has-motion setzt –
   ohne JavaScript oder mit „Bewegung reduzieren“ bleibt die Seite statisch. */

/* ---------- Scrollytelling „Ein Tag bei uns“ (auch ohne Animation sichtbar) ---------- */

.story__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 48px;
}

.story-step {
  display: grid;
  gap: 10px;
  max-width: 560px;
}

.story-step__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-img);
  margin-bottom: 10px;
}

.story-step p:last-child { color: var(--text-2); }

.story__visual { display: none; }

/* ---------- Text-Animation der Hauptüberschrift ---------- */

.has-motion .split-word {
  display: inline-block;
  overflow: clip;
  vertical-align: top;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

.has-motion .split-word > span {
  display: inline-block;
  translate: 0 105%;
  animation: hc-word-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--i, 0) * 45ms + 80ms);
}

@keyframes hc-word-in {
  to { translate: 0 0; }
}

/* ---------- Hero: Einblenden & Tiefe ---------- */

.has-motion .hero__content > :not(h1) {
  opacity: 0;
  translate: 0 16px;
  transition: opacity 0.6s ease, translate 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.has-motion .hero.is-in .hero__content > :not(h1) { opacity: 1; translate: 0 0; }
.has-motion .hero.is-in .hero__content > :nth-child(1) { transition-delay: 0ms; }
.has-motion .hero.is-in .hero__content > :nth-child(3) { transition-delay: 450ms; }
.has-motion .hero.is-in .hero__content > :nth-child(4) { transition-delay: 550ms; }
.has-motion .hero.is-in .hero__content > :nth-child(5) { transition-delay: 650ms; }

.has-motion .hero-mosaic img {
  scale: 1.04;
  transition: scale 1.4s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.8s ease;
}

.has-motion .hero-mosaic__top,
.has-motion .hero-mosaic__bottom { opacity: 0; }

.has-motion .hero.is-in .hero-mosaic img { scale: 1; opacity: 1; }
.has-motion .hero.is-in .hero-mosaic__top { transition-delay: 200ms; }
.has-motion .hero.is-in .hero-mosaic__bottom { transition-delay: 350ms; }

/* ---------- Einblenden beim Scrollen ---------- */

.has-motion .reveal {
  opacity: 0;
  translate: 0 28px;
  transition: opacity 0.7s ease, translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--d, 0ms);
}

.has-motion .reveal.is-in { opacity: 1; translate: 0 0; }

/* ---------- Parallax: nur wo der Browser scroll-gesteuerte Animationen kann ---------- */

@supports (animation-timeline: view()) {
  /* Hero-Bilder bewegen sich unterschiedlich schnell – Tiefenwirkung */
  .has-motion .hero-mosaic__main,
  .has-motion .hero-mosaic__top,
  .has-motion .hero-mosaic__bottom {
    animation: linear both;
    animation-timeline: scroll(root);
    animation-range: 0 90vh;
  }
  .has-motion .hero-mosaic__main { animation-name: hc-depth-1; }
  .has-motion .hero-mosaic__top { animation-name: hc-depth-2; }
  .has-motion .hero-mosaic__bottom { animation-name: hc-depth-3; }

  @keyframes hc-depth-1 { to { translate: 0 48px; } }
  @keyframes hc-depth-2 { to { translate: 0 -24px; } }
  @keyframes hc-depth-3 { to { translate: 0 -56px; } }

  /* Galeriebilder gleiten im Rahmen, während man vorbeiscrollt */
  .has-motion .gallery img {
    scale: 1.14;
    animation: hc-drift linear both;
    animation-timeline: view();
  }

  @keyframes hc-drift {
    from { translate: 0 -6%; }
    to { translate: 0 6%; }
  }
}

/* ---------- 3D-Neigung von Karten (nur mit Maus) ---------- */

@media (hover: hover) and (pointer: fine) {
  .has-motion .tilt {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: opacity 0.7s ease, translate 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.5s ease, box-shadow 0.5s ease;
    transition-delay: var(--d, 0ms), var(--d, 0ms), 0ms, 0ms;
  }

  .has-motion .tilt.is-tilting {
    transition-duration: 0.7s, 0.8s, 0.1s, 0.3s;
    box-shadow: 0 22px 44px rgba(26, 24, 22, 0.16);
  }
}

/* ---------- Scrollytelling auf großen Bildschirmen ---------- */

@media (min-width: 900px) {
  .has-motion .story__layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 72px;
  }

  .has-motion .story__visual { display: block; }

  .has-motion .story__frame {
    position: sticky;
    top: calc(50vh - min(32vh, 290px));
    height: min(64vh, 580px);
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--ink);
  }

  .has-motion .story__frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.7s ease;
  }

  .has-motion .story__frame img.is-active { opacity: 1; }

  .has-motion .story__count {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(26, 24, 22, 0.85);
    color: var(--on-dark);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.08em;
  }

  .has-motion .story__progress {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 1;
    height: 4px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(245, 241, 234, 0.35);
  }

  .has-motion .story__progress span {
    display: block;
    height: 100%;
    background: var(--brass);
    transform-origin: left center;
    transform: scaleX(var(--p, 0.2));
    transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .has-motion .story__steps { gap: 0; }

  .has-motion .story-step {
    min-height: 62vh;
    align-content: center;
    opacity: 0.28;
    transition: opacity 0.5s ease;
  }

  .has-motion .story-step.is-active { opacity: 1; }
  .has-motion .story-step__img { display: none; }
}

@media print {
  .has-motion .reveal,
  .has-motion .hero__content > *,
  .has-motion .hero-mosaic img { opacity: 1 !important; translate: none !important; }
}
