/* =========================================
   Kindergartenschätze - Bewegung
   Grundsätze: nur transform/opacity animieren (läuft auf der Grafikkarte),
   weiche "Ausroll"-Kurven, nichts wackelt ohne Grund. Ohne JavaScript oder
   mit "Bewegung reduzieren" ist die Seite vollständig und ruhig.
   ========================================= */
:root {
  --sanft: cubic-bezier(.16, 1, .3, 1);      /* rollt weich aus */
  --feder: cubic-bezier(.34, 1.56, .64, 1);   /* federt leicht nach */
}

/* Weiche Seitenwechsel (Browser, die es koennen) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 220ms ease-out both seiteRaus; }
::view-transition-new(root) { animation: 380ms var(--sanft) both seiteRein; }
@keyframes seiteRaus { to { opacity: 0; } }
@keyframes seiteRein { from { opacity: 0; transform: translateY(10px); } }
.kopf { view-transition-name: kopf; }

/* ---------- Hereingleiten beim Scrollen ---------- */
html.leben .rein { opacity: 0; transform: translate3d(0, 28px, 0); transition: opacity .9s var(--sanft), transform .9s var(--sanft); transition-delay: var(--v, 0ms); }
html.leben .rein.da { opacity: 1; transform: none; }

/* ---------- Bilder blenden weich ein ----------
   Nur Bilder, die beim Erscheinen noch nicht geladen sind, bekommen .laedt
   (Bilder aus dem Zwischenspeicher sind sofort da, nichts bleibt versteckt). */
.karte-bild img, .blatt-bild img, .sv-bild img, .mat-zeile img, .vorschau-blatt img, .neu-im-abo img { transition: opacity .6s ease, transform .8s var(--sanft); }
img.laedt { opacity: 0; }

/* ---------- Kopfzeile ---------- */
.kopf { transition: transform .4s var(--sanft), box-shadow .3s ease, background .3s ease; }
.kopf.gescrollt { box-shadow: 0 6px 24px rgba(74, 42, 32, .08); background: rgba(255, 250, 245, .97); }
.kopf.weg { transform: translateY(-100%); }
.logo .truhe { transition: transform .5s var(--feder); transform-origin: 50% 85%; }
.logo:hover .truhe { transform: rotate(-8deg) scale(1.08); }
.nav a { position: relative; border-bottom-color: transparent !important; }
.nav a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px; background: var(--rot); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--sanft); }
.nav a:hover::after, .nav a.aktiv::after { transform: scaleX(1); }

/* ---------- Startbereich ---------- */
html.leben .held-text > * { animation: hochSanft 1s var(--sanft) backwards; }
html.leben .held-text > :nth-child(1) { animation-delay: .05s; }
html.leben .held-text > :nth-child(2) { animation-delay: .12s; }
html.leben .held-text > :nth-child(3) { animation-delay: .22s; }
html.leben .held-text > :nth-child(4) { animation-delay: .32s; }
html.leben .held-text > :nth-child(5) { animation-delay: .42s; }
html.leben .held-text > :nth-child(6) { animation-delay: .5s; }
@keyframes hochSanft { from { opacity: 0; transform: translate3d(0, 22px, 0); } }
/* Erst nach dem Laden eingefuegte Teile (Stichworte, Knopf) kommen gestaffelt dazu */
html.leben .gefragt .chip { animation: hochSanft .7s var(--sanft) backwards; }
html.leben .gefragt .chip:nth-of-type(2) { animation-delay: .05s; } html.leben .gefragt .chip:nth-of-type(3) { animation-delay: .1s; }
html.leben .gefragt .chip:nth-of-type(4) { animation-delay: .15s; } html.leben .gefragt .chip:nth-of-type(5) { animation-delay: .2s; }
html.leben .gefragt .chip:nth-of-type(n+6) { animation-delay: .25s; }
html.leben .ueberrasch { animation: hochSanft .8s var(--sanft) .2s backwards; }
/* Textmarker zieht ueber "Mehr Zeit" */
html.leben .held .markiert { background-size: 0% 100%; background-repeat: no-repeat; animation: markieren 1s cubic-bezier(.65, 0, .35, 1) .7s forwards; }
@keyframes markieren { to { background-size: 100% 100%; } }

/* Schatzkiste: geht auf, sobald die Materialien da sind (.los), dann steigen die Blaetter heraus
   und faechern sich auf. Vorher steht die Kiste geschlossen da. */
html.leben .schatzkiste:not(.los) .kiste-deckel { transform: scaleY(.1); }
html.leben .schatzkiste:not(.los) .kiste-licht { opacity: 0; }
.kiste-deckel { transform-box: fill-box; transform-origin: 50% 100%; }
.kiste-licht { transform-box: fill-box; transform-origin: 50% 60%; }
html.leben .schatzkiste.los .kiste-deckel { animation: deckelAuf .9s var(--feder) .1s backwards; }
html.leben .schatzkiste.los .kiste-licht { animation: lichtAn 1s ease-out .35s backwards, leuchten 5s ease-in-out 1.4s infinite; }
html.leben .schatzkiste.los .kiste-hinten, html.leben .schatzkiste.los .kiste-vorne { animation: kisteHopp .55s var(--feder) backwards; }
html.leben .schatzkiste.los .blatt { animation: ausDerKiste 1.25s var(--sanft) backwards; animation-delay: calc(.5s + var(--i, 0) * .12s); }
html.leben .schatzkiste.los .blatt.vorne { animation-delay: .62s; }
html.leben .schatzkiste.los .blatt-zettel { animation: zettelDrauf .6s var(--feder) 1.55s backwards; }
html.leben .schatzkiste.los .nicole-marke { animation: anhaenger 1.1s var(--feder) 1.75s backwards; }
html.leben .schatzkiste.los .kiste-strahlen { animation: strahlen 1.2s ease-out .45s backwards; }
html.leben .schatzkiste.los .kiste-funken i { animation: funkeln 3.2s ease-in-out infinite; }
.kiste-funken i:nth-child(1) { animation-delay: 1.3s !important; } .kiste-funken i:nth-child(2) { animation-delay: 1.9s !important; }
.kiste-funken i:nth-child(3) { animation-delay: 1.5s !important; } .kiste-funken i:nth-child(4) { animation-delay: 2.6s !important; }
.kiste-funken i:nth-child(5) { animation-delay: 2.2s !important; }
@keyframes deckelAuf { 0% { transform: scaleY(.1); } 30% { transform: scaleY(.18) translateY(-3px); } 100% { transform: scaleY(1); } }
@keyframes lichtAn { from { opacity: 0; transform: scale(.4); } }
@keyframes leuchten { 50% { opacity: .78; transform: scale(1.05); } }
@keyframes kisteHopp { 0% { translate: 0 0; } 40% { translate: 0 -10px; } 100% { translate: 0 0; } }
@keyframes ausDerKiste { 0% { --raus: 0; --auf: 0; } 55% { --raus: 1; --auf: 0; } 100% { --raus: 1; --auf: 1; } }
@keyframes zettelDrauf { from { opacity: 0; transform: scale(1.6) rotate(-10deg); } }
@keyframes anhaenger { 0% { opacity: 0; transform: translateY(-16px) rotate(14deg); } 45% { opacity: 1; transform: rotate(-7deg); } 70% { transform: rotate(4deg); } 100% { transform: none; } }
@keyframes strahlen { from { opacity: 0; } }
@keyframes funkeln { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 18% { opacity: 1; transform: scale(1) rotate(45deg); } 36% { opacity: 0; transform: scale(.4) rotate(90deg); } }
/* In Ruhe schweben die Blaetter ganz leicht, jedes im eigenen Takt */
.blatt-schwebt { animation: schweben 6.5s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -2.1s); }
@keyframes schweben { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -7px, 0); } }
.nicole-marke { transition: rotate .6s var(--feder); }
.nicole-marke:hover { rotate: 3deg; }

/* ---------- Kritzel ploppen beim Laden nacheinander auf (sie bleiben danach stehen) ---------- */
html.leben .kritzel-teil { animation: kritzelRein .9s var(--feder) backwards; animation-delay: calc(260ms + var(--i, 0) * 70ms); }
@keyframes kritzelRein { from { opacity: 0; scale: .3; } }

/* ---------- Ueberrasch mich ---------- */
.ueberrasch { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; background: #fff; border: 2px dashed #E9C9BC; border-radius: 999px; padding: 6px 18px 6px 6px; font-weight: 800; color: var(--tinte); cursor: pointer; transition: border-color .25s, transform .4s var(--feder), box-shadow .3s; }
.ueberrasch:hover { border-color: var(--rot); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(194, 66, 47, .14); }
.ueberrasch img { width: 38px; height: 31px; }
@media (max-width: 360px) { .ueberrasch { font-size: 14.5px; gap: 8px; padding-right: 14px; } .ueberrasch img { width: 32px; height: 26px; } }
.ueberrasch:hover img { animation: wackeln .7s ease-in-out; }
.ueberrasch.oeffnet img { animation: kisteAuf .8s ease-in-out forwards; }
@keyframes wackeln { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(4deg); } }
@keyframes kisteAuf { 0% { transform: scale(1); } 35% { transform: scale(1.25) rotate(-10deg); } 65% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1.6) translateY(-6px); opacity: 0; } }
.funke { position: fixed; pointer-events: none; z-index: 300; font-size: 18px; color: var(--gelb); animation: funke .9s ease-out forwards; }
@keyframes funke { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(.6); opacity: 0; } }

/* ---------- Karten & Kacheln ---------- */
.karte { transition: transform .5s var(--sanft), box-shadow .5s var(--sanft), border-color .3s; }
.karte:hover { transform: translate3d(0, -6px, 0); }
/* Lichtschein folgt der Maus (nur Deckkraft und Position eines Verlaufs) */
.karte::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1; opacity: 0; transition: opacity .4s ease;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .28), transparent 45%); }
.karte:hover::after { opacity: 1; }
.karte .merk { z-index: 2; }
.karte:hover .karte-bild img { transform: scale(1.06); }
.karte .karte-blatt { transition: transform .6s var(--feder); }
.karte:hover .karte-blatt { transform: translateY(-8px) rotate(-2deg); }
.thema { transition: transform .5s var(--sanft); }
.thema img { transition: transform .9s var(--sanft), opacity .6s ease; }
.thema:hover img { transform: scale(1.07); }
.thema svg { transition: transform .5s var(--feder); }
.thema:hover svg { transform: rotate(-10deg) scale(1.15); }
.vorteil .ikon { transition: transform .5s var(--feder), background .3s, color .3s; }
.vorteil:hover .ikon { transform: rotate(-8deg) scale(1.1); background: var(--rot); color: #fff; }
.chip { transition: transform .35s var(--feder), filter .2s; }
.chip:hover { transform: translateY(-2px) scale(1.04); filter: saturate(1.2); }

/* ---------- Knoepfe: Druck & Welle ---------- */
.knopf, .icon-knopf, .themen-chips button, .reiter button { position: relative; overflow: hidden; }
.knopf { transition: background .2s, border-color .2s, color .2s, transform .25s var(--feder), box-shadow .25s; }
.knopf-rot:hover { box-shadow: 0 8px 20px rgba(194, 66, 47, .28); }
.knopf:active, .icon-knopf:active { transform: scale(.96); }
.welle { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .22; transform: scale(0); animation: welle .65s ease-out forwards; }
@keyframes welle { to { transform: scale(1); opacity: 0; } }
.knopf-rot .welle, .knopf-dunkel .welle { background: #fff; opacity: .35; }
/* Herz beim Merken */
[data-merk].an svg { animation: herzPop .5s var(--feder); fill: var(--rot); }
@keyframes herzPop { 0% { transform: scale(.6); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.herzchen { position: fixed; pointer-events: none; z-index: 300; color: var(--rot); animation: herzchen .85s ease-out forwards; }
@keyframes herzchen { to { transform: translate(var(--dx), var(--dy)) scale(.4) rotate(var(--r)); opacity: 0; } }

/* ---------- Preise ---------- */
.preis-karte { transition: transform .5s var(--sanft), box-shadow .5s var(--sanft); }
.preis-karte:hover { transform: translateY(-6px); box-shadow: 0 22px 46px rgba(74, 42, 32, .14); }
.zettel { animation: zettel 4s ease-in-out infinite; }
.abo-preis.wechsel > * { animation: hochSanft .45s var(--sanft) backwards; }
.abo-preis.wechsel > :nth-child(2) { animation-delay: .06s; } .abo-preis.wechsel > :nth-child(3) { animation-delay: .12s; }
@keyframes zettel { 50% { transform: rotate(-2deg) translateY(-2px); } }
.frage summary .pm { transition: transform .4s var(--feder), background .2s; }
.frage summary:hover .pm { background: var(--rot-hell); }
.frage[open] .antwort { animation: hochSanft .45s var(--sanft); }

/* ---------- Lesefortschritt (Materialseite) - laeuft direkt mit dem Scrollen ---------- */
.lese-fortschritt { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 70; background: var(--rot); transform-origin: left; transform: scaleX(0); pointer-events: none; }
@supports (animation-timeline: scroll()) {
  .lese-fortschritt { animation: fortschritt linear both; animation-timeline: scroll(root); }
  @keyframes fortschritt { to { transform: scaleX(1); } }
  /* Nicoles Foto bewegt sich beim Scrollen ganz leicht mit */
  .nicole-foto img { animation: parallaxe linear both; animation-timeline: view(); animation-range: entry 0% exit 100%; }
  @keyframes parallaxe { from { transform: scale(1.08) translateY(-3%); } to { transform: scale(1.08) translateY(3%); } }
}
@supports not (animation-timeline: scroll()) { .lese-fortschritt { display: none; } }

/* ---------- Nach oben ---------- */
.nach-oben { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--tinte); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 24px rgba(0,0,0,.18); transform: translateY(90px); transition: transform .5s var(--feder), background .2s; }
.nach-oben.da { transform: none; }
.nach-oben:hover { background: var(--rot); }

/* ---------- Konfetti ---------- */
.konfetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; }

/* ---------- Dialoge springen weich auf ---------- */
dialog.fenster[open] { animation: aufspringen .45s var(--sanft); }
dialog.fenster[open]::backdrop { animation: einblenden .3s ease-out; }
@keyframes aufspringen { from { opacity: 0; transform: translateY(18px) scale(.97); } }
@keyframes einblenden { from { opacity: 0; } }
.toast { animation: toastRein .5s var(--feder); }
.cookie-hinweis:not([hidden]) { animation: hochSanft .6s var(--sanft); }

/* ---------- Bewegung reduzieren: alles ruhig ---------- */
@media (prefers-reduced-motion: reduce) {
  html.leben .rein { opacity: 1 !important; transform: none !important; transition: none !important; }
  img.laedt { opacity: 1; }
  .blatt-schwebt, .zettel, .nicole-foto img { animation: none !important; }
  .schatzkiste *, .schatzkiste { animation: none !important; translate: none !important; }
  .kiste-deckel { transform: none !important; } .kiste-licht { opacity: 1 !important; }
  .kritzel-teil { animation: none !important; translate: -50% -50% !important; }
  .brief-zettel, .brief-klappe, .brief-siegel { transition: none !important; }
  html.leben .held .markiert { background-size: 100% 100%; animation: none; }
  .kopf.weg { transform: none; }
  .karte:hover, .preis-karte:hover, .thema:hover { transform: none; }
  @view-transition { navigation: none; }
}

/* ---------- Drucken: alles sichtbar, nichts Bewegtes ---------- */
@media print {
  html.leben .rein { opacity: 1 !important; transform: none !important; }
  img.laedt { opacity: 1 !important; }
  .nach-oben, .cookie-hinweis, .bearbeiten-knopf, .lese-fortschritt, .konfetti { display: none !important; }
}
