/* Bewegung auf der Produkte-Übersicht und den App-Seiten. Wird nach theme.css geladen.
   Alles gilt nur ohne reduzierte Bewegung; Einblendungen zusätzlich nur mit ui.js (Klasse .motion). */

@media (prefers-reduced-motion: no-preference) {
  /* Weicher Seitenwechsel: das Kartenbild der Übersicht wird zum grossen Bild der App-Seite.
     Browser ohne Unterstützung wechseln die Seite wie gewohnt. */
  @view-transition { navigation: auto; }
  .app-aufgetischt .app-card-shot, .app-page.app-aufgetischt .app-hero-art { view-transition-name: app-aufgetischt; }
  .app-familiennachlass .app-card-shot, .app-page.app-familiennachlass .app-hero-art { view-transition-name: app-familiennachlass; }
  .app-getstronger .app-card-shot, .app-page.app-getstronger .app-hero-art { view-transition-name: app-getstronger; }
  .app-migraene .app-card-shot, .app-page.app-migraene .app-hero-art { view-transition-name: app-migraene; }
  ::view-transition-group(*) { animation-duration: .5s; animation-timing-function: cubic-bezier(.3, .7, .2, 1); }

  /* Übersicht: Karten */
  .app-card-shot img { transition: translate .5s cubic-bezier(.2, .7, .2, 1), scale .5s cubic-bezier(.2, .7, .2, 1); }
  .app-card:hover .app-card-shot img { translate: 0 -8px; scale: 1.05; }
  .app-card:hover .app-card-shot.window img { translate: 0 -4px; scale: 1.025; }
  .app-card-more { transition: translate .3s ease; }
  .app-card:hover .app-card-more { translate: 6px 0; }
  .app-card { transition: translate .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s, border-color .25s; }
  .app-card:hover { translate: 0 -6px; box-shadow: 0 18px 36px rgba(0, 0, 0, .28); }
  .motion main.container .app-card[data-reveal] { transition: opacity .8s ease var(--d, 0s), transform .8s cubic-bezier(.2, .7, .2, 1) var(--d, 0s), translate .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s, border-color .25s; }
  .motion .app-card .app-card-shot img { animation: app-slide-up 1s cubic-bezier(.2, .7, .2, 1) both; }
  .motion .app-card:nth-child(2) .app-card-shot img { animation-delay: .12s; }
  .motion .app-card:nth-child(3) .app-card-shot img { animation-delay: .24s; }
  .motion .app-card:nth-child(4) .app-card-shot img { animation-delay: .36s; }

  /* App-Seite: Einstieg baut sich nacheinander auf */
  .app-hero-copy > * { animation: app-rise .8s cubic-bezier(.2, .7, .2, 1) both; }
  .app-hero-copy > :nth-child(2) { animation-delay: .08s; }
  .app-hero-copy > :nth-child(3) { animation-delay: .2s; }
  .app-hero-copy > :nth-child(4) { animation-delay: .32s; }
  .app-hero-copy > :nth-child(5) { animation-delay: .44s; }

  /* Geräte fahren ins Bild und folgen leicht dem Mauszeiger und dem Scrollen (ui.js) */
  .app-hero-art { position: relative; isolation: isolate; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .4s ease-out; }
  .app-hero-art::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: radial-gradient(260px circle at var(--mx, 70%) var(--my, 25%), rgba(255, 255, 255, .16), transparent 70%); pointer-events: none; }
  .app-hero-art img { animation: app-device-in 1.1s .15s cubic-bezier(.2, .75, .2, 1) both; transition: translate .4s ease-out; box-shadow: 0 18px 34px rgba(0, 0, 0, .3); }
  .app-hero-art img:first-child { translate: calc(var(--px, 0) * 8px) calc(var(--py, 0) * 6px + var(--sy, 0) * -10px); }
  .app-hero-art img + img { animation-name: app-device-in-right; animation-delay: .32s; translate: calc(var(--px, 0) * 18px) calc(var(--py, 0) * 12px + var(--sy, 0) * -44px); }

  /* Kurzer Strich unter den Zwischentiteln */
  .app-block h2::after { content: ""; display: block; width: 56px; height: 3px; margin-top: 10px; background: var(--link); transform-origin: left; }
  .motion .app-block h2::after { transform: scaleX(0); transition: transform .7s .25s cubic-bezier(.3, .6, .2, 1); }
  .motion .app-block.is-in h2::after { transform: scaleX(1); }

  /* Funktionen: Linie zeichnet sich, Text folgt */
  .motion .feature-grid li { position: relative; border-top-color: transparent; }
  .motion .feature-grid li::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px; background: var(--hair); transform: scaleX(0); transform-origin: left; transition: transform .9s cubic-bezier(.3, .6, .2, 1) var(--d, 0s), background-color .3s, height .3s; }
  .motion .feature-grid li.is-in::before { transform: scaleX(1); }
  .feature-grid li h3 { transition: color .25s, translate .3s ease; }
  .feature-grid li:hover h3 { color: var(--link); translate: 4px 0; }
  .motion .feature-grid li:hover::before { background: var(--link); height: 2px; }

  /* Bildschirmaufnahmen steigen leicht gekippt auf und heben sich beim Überfahren */
  .motion main.container .phone-gallery figure[data-reveal] { transform: translateY(48px) rotate(3deg) scale(.94); transition: opacity .8s ease var(--d, 0s), transform .9s cubic-bezier(.2, .75, .2, 1) var(--d, 0s); }
  .motion main.container .window-gallery figure[data-reveal] { transform: translateY(32px) scale(.93); transition: opacity .8s ease var(--d, 0s), transform .9s cubic-bezier(.2, .75, .2, 1) var(--d, 0s); }
  .motion main.container :is(.phone-gallery, .window-gallery) figure[data-reveal].is-in { transform: none; }
  :is(.phone-gallery, .window-gallery) img { transition: translate .35s cubic-bezier(.2, .7, .2, 1), scale .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s, border-color .25s; }
  .phone-gallery figure:hover img { translate: 0 -10px; scale: 1.04; box-shadow: 0 18px 32px rgba(0, 0, 0, .35); border-color: var(--link); }
  .window-gallery figure:hover img { translate: 0 -6px; scale: 1.015; box-shadow: 0 18px 32px rgba(0, 0, 0, .35); border-color: var(--link); }

  /* Stand und Pläne: Zeilen gleiten ein, Zeichen springen auf */
  .motion main.container .plan-grid li[data-reveal] { transform: translateX(-24px); transition: opacity .6s ease var(--d, 0s), transform .6s cubic-bezier(.2, .7, .2, 1) var(--d, 0s); }
  .motion main.container .plan-grid li[data-reveal].is-in { transform: none; }
  .motion .plan-grid li::before { scale: 0; transition: scale .45s cubic-bezier(.3, 1.8, .5, 1) calc(var(--d, 0s) + .3s); }
  .motion .plan-grid li.is-in::before { scale: 1; }
  .plan-grid .next li.is-in::before { animation: app-wait 2s 1.2s ease-in-out 2; }

  .app-nav a, .products-end .text-link { transition: translate .25s ease, text-underline-offset .25s, color .2s; }
  .app-nav a:last-child:hover { translate: 4px 0; }
}

@keyframes app-rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes app-slide-up { from { opacity: 0; transform: translateY(70px); } to { opacity: 1; transform: none; } }
@keyframes app-device-in { from { opacity: 0; transform: translateY(90px) rotate(-7deg); } to { opacity: 1; transform: none; } }
@keyframes app-device-in-right { from { opacity: 0; transform: translateY(130px) rotate(8deg); } to { opacity: 1; transform: none; } }
@keyframes app-wait { 50% { opacity: .25; } }

@media print {
  .motion main.container [data-reveal] { opacity: 1 !important; translate: none !important; }
  .plan-grid li::before, .feature-grid li::before { scale: 1 !important; }
}
