/* Über mich — Bildeffekte. Drei Kamera-Motive:
   1. Profilbild: Sucher stellt scharf (Fokusrahmen rastet ein, Bild "entwickelt" sich)
   2. Studiobild: Mitzieher — Bewegungsunschärfe löst sich beim Scrollen auf
   3. Silhouette: Verschluss öffnet sich, die Sonne geht auf
   --p (0…1) setzt js/ueber-effekte.js je nach Scrollposition.
   Ohne JavaScript oder bei "Bewegung reduzieren" bleibt alles im Endzustand. */

/* .fx-sucher bekommt KEIN position — sonst geht das sticky des Profilbilds verloren */
.fx-mitzieher, .fx-sonne { position: relative; }

/* ---------- 1 Sucher ---------- */
.fx-sucher picture { display: block; position: relative; overflow: hidden; }
.fx-sucher__rahmen { position: absolute; inset: 0; pointer-events: none; }
.fx-sucher__rahmen i {
  position: absolute; inline-size: 44px; block-size: 44px;
  border: 0 solid var(--c-accent);
  transition: transform 1100ms cubic-bezier(.16,1.25,.3,1) 250ms, opacity 400ms ease 1600ms, border-color 300ms;
}
.fx-sucher__rahmen i:nth-child(1) { inset-block-start: 14px; inset-inline-start: 14px; border-block-start-width: 3px; border-inline-start-width: 3px; }
.fx-sucher__rahmen i:nth-child(2) { inset-block-start: 14px; inset-inline-end: 14px;   border-block-start-width: 3px; border-inline-end-width: 3px; }
.fx-sucher__rahmen i:nth-child(3) { inset-block-end: 14px;   inset-inline-start: 14px; border-block-end-width: 3px;   border-inline-start-width: 3px; }
.fx-sucher__rahmen i:nth-child(4) { inset-block-end: 14px;   inset-inline-end: 14px;   border-block-end-width: 3px;   border-inline-end-width: 3px; }
/* Fokuspunkt auf dem Gesicht */
.fx-sucher__punkt {
  position: absolute; inset-block-start: 30%; inset-inline-start: 50%;
  inline-size: 84px; block-size: 84px; translate: -50% -50%;
  border: 2px solid var(--c-accent);
  opacity: 0; scale: 2.2;
  transition: scale 600ms cubic-bezier(.16,1.3,.3,1) 600ms, opacity 200ms ease 600ms;
}
.fx-sucher__punkt::after { content: ""; position: absolute; inset: 50% auto auto 50%; inline-size: 4px; block-size: 4px; translate: -50% -50%; background: var(--c-accent); }
.fx-sucher img { transition: scale 2600ms cubic-bezier(.2,.8,.2,1); }
/* Autofokus "pumpt": unscharf → fast scharf → wieder weg → sitzt */
@keyframes fx-fokus {
  0%   { filter: blur(22px) brightness(.35) saturate(0) contrast(1.2); }
  35%  { filter: blur(3px)  brightness(.6)  saturate(.2) contrast(1.1); }
  52%  { filter: blur(12px) brightness(.62) saturate(.25); }
  70%  { filter: blur(0)    brightness(1.18) saturate(1.1); }
  100% { filter: none; }
}
@keyframes fx-bestaetigt {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: 0 0 0 2px var(--c-accent), 0 0 24px var(--c-accent); }
}
@keyframes fx-punkt-blink { 0%, 60%, 100% { opacity: 1; } 30%, 80% { opacity: .25; } }

.fx-an .fx-sucher:not(.ist-da) .fx-sucher__rahmen i:nth-child(1) { transform: translate(-60px, -60px); }
.fx-an .fx-sucher:not(.ist-da) .fx-sucher__rahmen i:nth-child(2) { transform: translate(60px, -60px); }
.fx-an .fx-sucher:not(.ist-da) .fx-sucher__rahmen i:nth-child(3) { transform: translate(-60px, 60px); }
.fx-an .fx-sucher:not(.ist-da) .fx-sucher__rahmen i:nth-child(4) { transform: translate(60px, 60px); }
.fx-an .fx-sucher:not(.ist-da) img { filter: blur(22px) brightness(.35) saturate(0) contrast(1.2); scale: 1.14; }
.fx-an .fx-sucher.ist-da img { animation: fx-fokus 1900ms cubic-bezier(.3,.6,.3,1) both; }
.fx-an .fx-sucher.ist-da .fx-sucher__punkt { opacity: 1; scale: 1; animation: fx-punkt-blink 900ms steps(1) 900ms 1; }
/* Scharf: Rahmen und Punkt blitzen einmal auf — wie die Fokusbestätigung im Sucher */
.fx-an .fx-sucher.ist-scharf picture { animation: fx-bestaetigt 650ms ease-out 1; }
/* Nach dem Scharfstellen: Punkt verschwindet, Rahmen bleibt dezent */
.fx-an .fx-sucher.ist-scharf .fx-sucher__punkt { opacity: 0; scale: .7; transition: opacity 500ms ease 350ms, scale 500ms ease 350ms; }
.fx-an .fx-sucher.ist-scharf .fx-sucher__rahmen i { border-color: rgb(255 255 255 / .55); }
.fx-sucher:hover .fx-sucher__rahmen i { border-color: var(--c-accent); }

/* ---------- 2 Mitzieher ---------- */
.fx-mitzieher picture { display: block; overflow: hidden; }
.fx-mitzieher img { will-change: transform, filter; }
.fx-an .fx-mitzieher img {
  filter: url(#fx-bewegung);
  transform: translateX(calc((1 - var(--p, 1)) * -6%)) scale(1.06);
}
.fx-mitzieher__streifen {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 7px, rgb(255 255 255 / .05) 7px 8px);
  mix-blend-mode: screen;
  opacity: 0;
}
.fx-an .fx-mitzieher__streifen { opacity: calc((1 - var(--p, 1)) * 1); }

/* ---------- 3 Sonnenaufgang ---------- */
.fx-sonne picture { display: block; position: relative; overflow: hidden; }
.fx-an .fx-sonne picture {
  /* Verschluss: öffnet sich vom Schlitz in der Mitte nach außen */
  clip-path: inset(calc((1 - min(1, var(--p, 1) * 1.6)) * 46%) 0 calc((1 - min(1, var(--p, 1) * 1.6)) * 46%) 0);
}
.fx-an .fx-sonne img {
  filter: brightness(calc(.45 + var(--p, 1) * .55)) saturate(calc(.6 + var(--p, 1) * .5));
  transform: scale(calc(1.14 - var(--p, 1) * .14));
  transform-origin: 37% 16%;
}
.fx-sonne__licht {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 37% 16%, rgb(255 236 200 / .95) 0 4%, rgb(255 200 120 / .45) 9%, rgb(255 170 90 / .12) 26%, transparent 46%),
    linear-gradient(97deg, transparent 0 30%, rgb(255 230 190 / .18) 36%, transparent 44%);
  mix-blend-mode: screen;
  opacity: 0;
}
.fx-an .fx-sonne__licht { opacity: calc(max(0, var(--p, 1) - .35) * 1.55); }
/* Lichtstreif, der einmal über das Bild zieht */
.fx-sonne__flare {
  position: absolute; inset-block: 0; inline-size: 30%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgb(255 225 180 / .28), transparent);
  mix-blend-mode: screen; opacity: 0;
  inset-inline-start: calc(-30% + var(--p, 1) * 130%);
}
.fx-an .fx-sonne__flare { opacity: calc(1 - var(--p, 1)); }

/* Text kommt Zeile für Zeile, wenn das Licht da ist */
.fx-an .antrieb__text > * {
  opacity: calc((var(--p, 1) - .45 - var(--i, 0) * .08) * 4);
  translate: 0 calc(clamp(0px, (1 - (var(--p, 1) - var(--i, 0) * .08) * 1.4) * 32px, 32px));
}

@media (prefers-reduced-motion: reduce) {
  .fx-an .fx-sucher img, .fx-an .fx-mitzieher img, .fx-an .fx-sonne img, .fx-an .fx-sonne picture { filter: none; transform: none; clip-path: none; scale: 1; }
  .fx-an .antrieb__text > * { opacity: 1; translate: none; }
  .fx-sonne__licht { opacity: .5 !important; }
  .fx-sonne__flare, .fx-mitzieher__streifen, .fx-sucher__punkt { display: none; }
  .fx-sucher__rahmen i { transform: none !important; transition: none; }
}
