/* Alles in einer App (#funktionen, Neubau 21.11.), Prefix af-.
   Bento-Raster mit sechs Kacheln. Jede Kachel: Kopf (Icon, Titel, ein Satz) oben, darunter eine Flaeche,
   die von unten aus der Kachel waechst: echter App-Screen im Handy-Anschnitt, Bildausschnitt im Fenster,
   Foto oder kleines Widget im App-Stil (Creme-Grund, weisse Karten, gruene und orange Pillen).
   Handy: 2 Spalten (a a / b c / f f / d e), ab 960 px: 3 Spalten (a a b / c d b / e f f).
   Bewegung nur mit ds/ff-funktionen.js (Klasse af-bewegt), ohne Skript und bei reduzierter Bewegung ist alles sofort sichtbar. */

.ffn .af{--af-creme:#F4F1EA;--af-orange:#EA580C;--af-orange-grund:#FFEDD5;--af-rund:24px;padding:64px 0 64px}
.ffn .af .ds-kopf{margin-bottom:28px}
.ffn .af .ds-kopf p{font-size:1.02rem;line-height:1.5}

.ffn .af-raster{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-areas:"a a" "b c" "f f" "d e";gap:12px;margin:0;padding:0;list-style:none}
.ffn .af-liste{grid-area:a}.ffn .af-bon{grid-area:b}.ffn .af-kuehl{grid-area:c}
.ffn .af-rezept{grid-area:d}.ffn .af-geld{grid-area:e}.ffn .af-chami{grid-area:f}

/* Kachel */
.ffn .af-k{position:relative;display:flex;flex-direction:column;min-width:0;overflow:hidden;border-radius:var(--af-rund);background:#fff;border:1px solid var(--ds-kante);
  box-shadow:0 1px 2px rgba(17,24,39,.04),0 18px 40px -28px rgba(17,24,39,.22)}
.ffn .af-text{position:relative;z-index:1;padding:16px 16px 14px}
.ffn .af-ic{display:inline-grid;place-items:center;width:32px;height:32px;margin-bottom:10px;border-radius:10px;background:var(--ds-gruen-grund);color:var(--ds-gruen-tief)}
.ffn .af-ic .ic{width:17px;height:17px}
.ffn .af-k h3{font-size:1rem;font-weight:700;letter-spacing:-.015em;line-height:1.25;color:var(--ds-tinte)}
.ffn .af-k .af-text p{margin-top:5px;font-size:.84rem;line-height:1.45;color:var(--ds-leise)}
.ffn .af-chips{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 0;padding:0;list-style:none}
.ffn .af-chips li{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border-radius:999px;background:var(--ds-gruen-grund);color:var(--ds-gruen-tief);font-size:.74rem;font-weight:650;white-space:nowrap}
.ffn .af-chips .ic{width:13px;height:13px}
/* 22.11.: Stichpunkte statt Saetze */
.ffn .af-stich{display:grid;gap:6px;margin:10px 0 0;padding:0;list-style:none}
.ffn .af-stich li{display:flex;align-items:flex-start;gap:7px;font-size:.8rem;line-height:1.3;font-weight:600;color:var(--ds-tinte)}
.ffn .af-stich .ic{flex:0 0 auto;width:18px;height:18px;padding:3px;margin-top:-1px;border-radius:6px;background:var(--ds-gruen-grund);color:var(--ds-gruen-tief)}
/* Icon im Kopf: kraeftiger, mit leichtem Verlauf */
.ffn .af-ic{background:linear-gradient(150deg,var(--ds-gruen) 0%,var(--ds-gruen-tief) 100%);color:#fff;box-shadow:0 6px 14px -6px rgba(22,163,74,.55),inset 0 1px 0 rgba(255,255,255,.25)}
/* Bon: Scan-Linie ueber dem Handy */
.ffn .af-scan{position:absolute;left:0;right:0;top:0;height:22%;pointer-events:none;opacity:0;
  background:linear-gradient(180deg,rgba(34,197,94,0) 0%,rgba(34,197,94,.22) 85%,rgba(34,197,94,.9) 100%);border-bottom:2px solid #22C55E}

/* Flaeche: waechst von unten aus der Kachel, oben gerundet */
.ffn .af-bild{position:relative;flex:1 1 auto;min-height:180px;margin:0 10px;overflow:hidden;border-radius:18px 18px 0 0;background:var(--af-creme)}
.ffn .af-liste .af-bild{min-height:250px}
.ffn .af-chami .af-bild{min-height:200px;background:linear-gradient(160deg,var(--ds-gruen-grund-2) 0%,var(--ds-gruen-grund) 100%)}

/* Echter Screen im Handy-Anschnitt (Rahmen aus ff-ein.css/ff-umbau.css) */
.ffn .af-handy.ds-handy{position:absolute;top:16px;left:50%;width:210px;margin-left:-105px;padding:7px}
.ffn .af-handy .ds-handy-schirm{box-shadow:0 0 0 5px var(--hy-glas)}
.ffn .af-bon .af-handy.ds-handy{width:142px;margin-left:-71px;top:14px;padding:5px}
.ffn .af-bon .af-handy .ds-handy-schirm{box-shadow:0 0 0 3.5px var(--hy-glas)}

/* Bildausschnitt eines Screens: Bild auf Fensterbreite, per Verschiebung beschnitten */
.ffn .af-fenster{position:absolute;inset:12px 12px 0;overflow:hidden;border-radius:14px 14px 0 0;background:var(--af-creme);box-shadow:0 0 0 1px rgba(17,24,39,.06),0 12px 28px -14px rgba(17,24,39,.28)}
.ffn .af-fenster img{position:absolute;top:0;left:0;width:100%;height:auto;max-width:none}
.ffn .af-kuehl .af-fenster img{width:104%;left:-2%;transform:translateY(-15.8%)}
.ffn .af-geld .af-fenster{background:#F1F6EF}
.ffn .af-geld .af-fenster img{width:118%;left:-9%;transform:translateY(-49%)}

/* Kleine Karte im App-Stil, schwebt ueber der Flaeche */
.ffn .af-karte{position:absolute;z-index:2;display:flex;align-items:center;gap:8px;padding:6px 10px 6px 6px;border-radius:14px;background:#fff;
  box-shadow:0 0 0 1px rgba(17,24,39,.05),0 10px 24px -10px rgba(17,24,39,.3);font-size:.74rem;line-height:1.2;color:var(--ds-tinte)}
.ffn .af-karte img{display:block;width:34px;height:34px;flex:0 0 auto;border-radius:10px;background:var(--af-creme);object-fit:cover}
.ffn .af-karte b{display:block;font-weight:700}
.ffn .af-pille{display:inline-flex;align-items:center;gap:4px;height:20px;margin-top:3px;padding:0 8px;border-radius:999px;font-size:.68rem;font-weight:700;white-space:nowrap}
.ffn .af-pille.orange{background:var(--af-orange-grund);color:#C2410C}
.ffn .af-pille.gruen{background:var(--ds-gruen-grund);color:var(--ds-gruen-tief)}
.ffn .af-pille .ic{width:11px;height:11px}
.ffn .af-liste .af-karte{left:10px;bottom:16px}
.ffn .af-kuehl .af-karte{left:8px;right:8px;bottom:10px;padding-right:6px}
.ffn .af-kuehl .af-karte img{width:30px;height:30px}
.ffn .af-bon .af-marke{position:absolute;z-index:2;left:50%;bottom:12px;transform:translateX(-50%);display:inline-flex;align-items:center;gap:6px;height:30px;padding:0 12px 0 5px;border-radius:999px;background:#fff;
  box-shadow:0 0 0 1px rgba(17,24,39,.05),0 10px 24px -10px rgba(17,24,39,.3);font-size:.74rem;font-weight:700;color:var(--ds-tinte);white-space:nowrap}
.ffn .af-haken{display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--ds-gruen);color:#fff}
.ffn .af-haken .ic{width:12px;height:12px;stroke-width:3}

/* Rezepte: Foto mit Karte */
.ffn .af-rezept .af-bild{background:#E9E2D6}
.ffn .af-rezept .af-foto{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 58%}
.ffn .af-rezept .af-karte{left:8px;right:8px;bottom:10px;gap:7px;padding:6px 10px 6px 6px}
.ffn .af-rund{display:flex}
.ffn .af-rund img{width:28px;height:28px;border-radius:50%;border:2px solid #fff;background:#fff;object-fit:cover}
.ffn .af-rund img+img{margin-left:-7px}
.ffn .af-rezept .af-karte span{color:var(--ds-leise);font-weight:600}

/* Chami: Gespraech */
.ffn .af-gespraech{position:absolute;inset:14px 12px 12px 86px;display:flex;flex-direction:column;justify-content:flex-end;gap:8px}
.ffn .af-blase{max-width:300px;padding:9px 12px;border-radius:16px;font-size:.8rem;line-height:1.4}
.ffn .af-blase.du{align-self:flex-end;display:flex;white-space:nowrap;align-items:center;gap:7px;border-bottom-right-radius:5px;background:var(--ds-gruen-tief);color:#fff}
.ffn .af-blase.du .ic{width:14px;height:14px;flex:0 0 auto}
.ffn .af-blase.er{align-self:flex-start;border-bottom-left-radius:5px;background:#fff;color:var(--ds-tinte);box-shadow:0 0 0 1px rgba(17,24,39,.05),0 8px 20px -12px rgba(17,24,39,.3)}
.ffn .af-eingabe{display:flex;align-items:center;gap:6px;height:38px;margin-top:4px;padding:0 5px 0 12px;border-radius:999px;background:#fff;box-shadow:0 0 0 1px rgba(17,24,39,.06);font-size:.78rem;color:var(--ds-leiser)}
.ffn .af-eingabe span{flex:1 1 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ffn .af-eingabe i{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--ds-gruen-grund);color:var(--ds-gruen-tief)}
.ffn .af-eingabe i:last-child{background:var(--ds-gruen);color:#fff}
.ffn .af-eingabe .ic{width:14px;height:14px}
.ffn .af-figur{position:absolute;left:-4px;bottom:-14px;width:96px;height:auto}

/* schmal: Warnkarte im Kuehlschrank kompakt */
@media (max-width:639px){
  .ffn .af-kuehl .af-karte{left:6px;right:6px;gap:6px;padding:5px}
  .ffn .af-kuehl .af-karte img{width:26px;height:26px}
  .ffn .af-kuehl .af-pille .ic{display:none}
  .ffn .af-rezept .af-karte{font-size:.7rem}
  .ffn .af-rezept .af-rund img{width:24px;height:24px}
}

/* ab 640 px: mehr Luft */
@media (min-width:640px){
  .ffn .af-stich{gap:7px;margin-top:12px}
  .ffn .af-stich li{font-size:.9rem;align-items:center}
  .ffn .af-stich .ic{width:22px;height:22px;padding:4px;margin-top:0;border-radius:7px}
  .ffn .af-raster{gap:16px}
  .ffn .af-text{padding:22px 22px 18px}
  .ffn .af-k h3{font-size:1.1rem}
  .ffn .af-k .af-text p{font-size:.92rem}
  .ffn .af-bild{min-height:230px;margin:0 14px}
  .ffn .af-bon .af-handy.ds-handy{width:190px;margin-left:-95px;padding:6px}
  .ffn .af-gespraech{left:120px;inset-inline-end:16px}
  .ffn .af-figur{width:128px}
}

/* ab 960 px: Bento mit 3 Spalten, breite Kacheln mit Text links */
@media (min-width:960px){
  .ffn .af{padding:96px 0 88px}
  .ffn .af .ds-kopf{margin-bottom:44px}
  .ffn .af-raster{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:400px 400px 380px;grid-template-areas:"a a b" "c d b" "e f f";gap:18px}
  .ffn .af-k{border-radius:28px}
  .ffn .af-text{padding:26px 26px 20px}
  .ffn .af-k h3{font-size:1.2rem}
  .ffn .af-k .af-text p{font-size:.95rem;max-width:34ch}
  .ffn .af-ic{width:38px;height:38px;border-radius:12px;margin-bottom:14px}
  .ffn .af-ic .ic{width:20px;height:20px}
  .ffn .af-bild{min-height:0;margin:0 16px}

  .ffn .af-breit{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr)}
  .ffn .af-breit .af-text{align-self:center;padding:30px 12px 30px 32px}
  .ffn .af-breit .af-bild{margin:20px 20px 0 0}
  .ffn .af-breit .af-text p{font-size:1rem}

  .ffn .af-liste .af-handy.ds-handy{width:250px;margin-left:-125px;top:28px;padding:8px}
  .ffn .af-liste .af-karte{left:22px;bottom:30px}
  .ffn .af-bon .af-handy.ds-handy{width:268px;margin-left:-134px;top:26px;padding:8px}
  .ffn .af-bon .af-handy .ds-handy-schirm,.ffn .af-liste .af-handy .ds-handy-schirm{box-shadow:0 0 0 6px var(--hy-glas)}
  .ffn .af-bon .af-marke{bottom:24px;height:36px;font-size:.82rem;padding-right:14px}
  .ffn .af-haken{width:24px;height:24px}
  .ffn .af-fenster{inset:16px 16px 0}
  .ffn .af-karte{font-size:.8rem}
  .ffn .af-kuehl .af-karte,.ffn .af-rezept .af-karte{left:14px;right:auto;bottom:14px}
  .ffn .af-gespraech{inset:24px 28px 24px 150px;justify-content:center}
  .ffn .af-figur{width:150px;left:0;bottom:-18px}
  .ffn .af-blase{font-size:.88rem}
}

/* Bewegung beim Reinscrollen (nur mit Skript, nur ohne reduzierte Bewegung) */
@media (prefers-reduced-motion:no-preference){
  .ffn .af-bewegt .af-k{opacity:0;transform:translateY(26px);transition:opacity .7s cubic-bezier(.16,1,.3,1),transform .7s cubic-bezier(.16,1,.3,1);transition-delay:calc(var(--i,0) * 70ms)}
  .ffn .af-bewegt .af-k.af-da{opacity:1;transform:none}
  .ffn .af-bewegt .af-handy,.ffn .af-bewegt .af-fenster,.ffn .af-bewegt .af-foto{transform:translateY(40px);transition:transform 1.1s cubic-bezier(.16,1,.3,1);transition-delay:calc(var(--i,0) * 70ms + 120ms)}
  .ffn .af-bewegt .af-foto{transform:scale(1.08)}
  .ffn .af-bewegt .af-da .af-handy,.ffn .af-bewegt .af-da .af-fenster,.ffn .af-bewegt .af-da .af-foto{transform:none}
  .ffn .af-bewegt .af-karte,.ffn .af-bewegt .af-marke,.ffn .af-bewegt .af-blase,.ffn .af-bewegt .af-eingabe{opacity:0;translate:0 10px;scale:.96;transition:opacity .5s ease,translate .6s cubic-bezier(.16,1,.3,1),scale .6s cubic-bezier(.16,1,.3,1);transition-delay:calc(var(--i,0) * 70ms + var(--d,520ms))}
  .ffn .af-bewegt .af-da :is(.af-karte,.af-marke,.af-blase,.af-eingabe){opacity:1;translate:0 0;scale:1}
  .ffn .af-bewegt .af-blase.er{--d:1100ms}
  .ffn .af-bewegt .af-eingabe{--d:1500ms}
  .ffn .af-k{transition:box-shadow .3s}
  @media (hover:hover){
    .ffn .af-bewegt .af-k.af-da:hover .af-handy{transform:translateY(-6px);transition-delay:0s;transition-duration:.5s}
    .ffn .af-k:hover{box-shadow:0 1px 2px rgba(17,24,39,.04),0 26px 50px -28px rgba(17,24,39,.3)}
    .ffn .af-k:hover .af-handy{transform:translateY(-6px);transition-delay:0s;transition-duration:.5s}
  }
}

/* 22.11.: kleine Bewegungen pro Kachel, laufen erst, wenn die Kachel da ist (af-da) */
@media (prefers-reduced-motion:no-preference){
  .ffn .af-bewegt .af-stich li{opacity:0;transform:translateX(-8px);transition:opacity .45s ease,transform .5s cubic-bezier(.16,1,.3,1);transition-delay:calc(var(--i,0) * 70ms + 260ms)}
  .ffn .af-bewegt .af-stich li:nth-child(2){transition-delay:calc(var(--i,0) * 70ms + 340ms)}
  .ffn .af-bewegt .af-stich li:nth-child(3){transition-delay:calc(var(--i,0) * 70ms + 420ms)}
  .ffn .af-bewegt .af-stich li:nth-child(4){transition-delay:calc(var(--i,0) * 70ms + 500ms)}
  .ffn .af-bewegt .af-da .af-stich li{opacity:1;transform:none}
  .ffn .af-bewegt .af-ic{transform:scale(.6) rotate(-12deg);opacity:0;transition:transform .6s cubic-bezier(.34,1.56,.64,1),opacity .3s ease;transition-delay:calc(var(--i,0) * 70ms + 150ms)}
  .ffn .af-bewegt .af-da .af-ic{transform:none;opacity:1}
  /* Bon: Scan-Linie faehrt ueber den Bon */
  .ffn .af-da .af-scan{animation:af-scan 2.6s cubic-bezier(.45,0,.55,1) .9s infinite}
  /* Angebot und Ablauf-Hinweis: sanftes Schweben, Pille pulsiert */
  .ffn .af-da.af-liste .af-karte{animation:af-schweben 4.5s ease-in-out 1.4s infinite}
  .ffn .af-da.af-kuehl .af-pille.orange,.ffn .af-da.af-liste .af-pille.orange{animation:af-puls 2.4s ease-out 1.6s infinite}
  .ffn .af-da.af-kuehl .af-pille .ic{animation:af-wackeln 2.4s ease-in-out 1.6s infinite;transform-origin:50% 50%}
  /* Haushaltsbuch: Ausschnitt rollt langsam durch die Kategorien */
  .ffn .af-da.af-geld .af-fenster img{animation:af-rollen 9s ease-in-out 1.5s infinite alternate}
  /* Chami: Mikrofon-Knopf atmet */
  .ffn .af-da.af-chami .af-eingabe i:last-child{animation:af-puls-gruen 2s ease-out 2s infinite}
  /* Icon im Kopf reagiert beim Ueberfahren */
  @media (hover:hover){
    .ffn .af-k .af-ic{transition:transform .4s cubic-bezier(.34,1.56,.64,1)}
    .ffn .af-bewegt .af-k.af-da:hover .af-ic,.ffn .af-k:hover .af-ic{transform:scale(1.08) rotate(-6deg);transition-delay:0s}
  }
}
@keyframes af-scan{0%{top:-22%;opacity:0}12%{opacity:1}70%{top:100%;opacity:1}78%,100%{top:100%;opacity:0}}
@keyframes af-schweben{0%,100%{translate:0 0}50%{translate:0 -5px}}
@keyframes af-puls{0%{box-shadow:0 0 0 0 rgba(234,88,12,.4)}70%,100%{box-shadow:0 0 0 7px rgba(234,88,12,0)}}
@keyframes af-puls-gruen{0%{box-shadow:0 0 0 0 rgba(22,163,74,.45)}70%,100%{box-shadow:0 0 0 9px rgba(22,163,74,0)}}
@keyframes af-wackeln{0%,60%,100%{transform:none}70%{transform:rotate(-14deg)}80%{transform:rotate(12deg)}90%{transform:rotate(-6deg)}}
@keyframes af-rollen{0%,15%{transform:translateY(-49%)}85%,100%{transform:translateY(-60%)}}

/* Handy-Feinschliff 22.11.: Stichpunkte duerfen umbrechen und sind lesbar, Bon-Etikett passt in die Kachel */
.ffn .af-stich{grid-template-columns:minmax(0,1fr)}
.ffn .af-stich li{min-width:0;font-size:.85rem;-webkit-hyphens:auto;hyphens:auto}
.ffn .af-bon .af-marke{max-width:calc(100% - 12px)}
@media (max-width:400px){
  .ffn .af-bon .af-marke{gap:4px;padding:0 8px 0 4px;font-size:.68rem}
  .ffn .af-bon .af-haken{width:18px;height:18px}
}
@media (min-width:640px){.ffn .af-stich li{font-size:.9rem}}
