/* ==========================================================================
   Minik Kartallar — Hero eagle wing motion ("Süzülüş + Rüzgâr", Issue #1)
   The eagle is vectorised 1:1 from the official logo and split at the
   shoulders into three layers: back wing (under body) · body · front wing.

   Two independent motion channels, so they never fight:
     · idle  → `rotate` / `translate` properties: a very light breath while waiting
     · wind  → `transform`: one slow wing-beat driven by scrolling (incl. touch drag),
               via CSS scroll-driven animation — no scroll listener.
   All motion is keyed on .mk-motion-ready, printed by a one-line <head> script
   only when the admin switch (enable_wing_motion) is on and the visitor has not
   asked for reduced motion. Without it the eagle is simply static.
   No ovals, discs or blobs behind the eagle — it flies on a clear ground.
   ========================================================================== */

:root{
  /* Shoulder pivots on the logo's 300×268 eagle crop: back (124,136), front (193,158). */
  --mk-pivot-back:41.33% 50.75%;
  --mk-pivot-front:64.33% 58.96%;
  --mk-amp:1;
  --mk-ease-air:cubic-bezier(.45,0,.25,1);
  --mk-ease-settle:cubic-bezier(.16,1,.3,1);
}
@media (max-width:780px){:root{--mk-amp:.7}}

/* ---------- Layered eagle ---------- */
.mk-hero__visual{isolation:isolate}
.mk-eagle{
  position:absolute;z-index:3;pointer-events:none;
  top:clamp(0px,1.5vw,18px);left:clamp(-78px,-5vw,-30px);
  width:clamp(170px,20vw,300px);aspect-ratio:300/268;
}
.mk-eagle__tilt,.mk-eagle__layer{position:absolute;inset:0}
.mk-eagle__layer{display:block;width:100%;height:100%;overflow:visible}
.mk-eagle__wing--back{transform-origin:var(--mk-pivot-back)}
.mk-eagle__wing--front{transform-origin:var(--mk-pivot-front)}
.mk-eagle__tilt{transform-origin:56% 62%;filter:drop-shadow(0 14px 18px rgba(7,26,46,.16))}
@media (max-width:780px){
  .mk-eagle{left:6px;top:4px;width:clamp(118px,34vw,160px)}
  /* No filter on phones: a filtered parent would repaint every frame of the idle breath. */
  .mk-eagle__tilt{filter:none}
}

/* ---------- Entrance: settle into place once ---------- */
.mk-motion-ready .mk-eagle{animation:mk-eagle-in 1.2s var(--mk-ease-settle) both}
@keyframes mk-eagle-in{from{opacity:0;translate:0 14px}to{opacity:1;translate:none}}

/* ---------- Idle breath (rotate/translate) + wind (transform) ---------- */
.mk-motion-ready .mk-eagle__wing--back{
  animation:mk-eagle-settle-back 1.5s var(--mk-ease-settle) both,
            mk-eagle-idle-back 8s var(--mk-ease-air) 1.64s infinite;
}
.mk-motion-ready .mk-eagle__wing--front{
  animation:mk-eagle-settle-front 1.5s var(--mk-ease-settle) both,
            mk-eagle-idle-front 8s var(--mk-ease-air) 1.5s infinite;
}
.mk-motion-ready .mk-eagle__tilt{animation:mk-eagle-idle-body 8s var(--mk-ease-air) 1.5s infinite}

@supports (animation-timeline:scroll()){
  .mk-motion-ready .mk-eagle__wing--back{
    animation:mk-eagle-settle-back 1.5s var(--mk-ease-settle) both,
              mk-eagle-idle-back 8s var(--mk-ease-air) 1.64s infinite,
              mk-eagle-beat-back linear both;
    animation-timeline:auto,auto,scroll(root);animation-range:normal,normal,0 55vh;
  }
  .mk-motion-ready .mk-eagle__wing--front{
    animation:mk-eagle-settle-front 1.5s var(--mk-ease-settle) both,
              mk-eagle-idle-front 8s var(--mk-ease-air) 1.5s infinite,
              mk-eagle-beat-front linear both;
    animation-timeline:auto,auto,scroll(root);animation-range:normal,normal,0 55vh;
  }
  .mk-motion-ready .mk-eagle__tilt{
    animation:mk-eagle-idle-body 8s var(--mk-ease-air) 1.5s infinite,
              mk-eagle-climb linear both;
    animation-timeline:auto,scroll(root);animation-range:normal,0 55vh;
  }
}
/* Browsers without scroll timelines: one slow beat the first time the hero is scrolled away. */
@supports not (animation-timeline:scroll()){
  .mk-motion-ready .mk-eagle.is-lifted .mk-eagle__wing--back{
    animation:mk-eagle-beat-back 2.4s var(--mk-ease-air) both,mk-eagle-idle-back 8s var(--mk-ease-air) infinite}
  .mk-motion-ready .mk-eagle.is-lifted .mk-eagle__wing--front{
    animation:mk-eagle-beat-front 2.4s var(--mk-ease-air) both,mk-eagle-idle-front 8s var(--mk-ease-air) infinite}
  .mk-motion-ready .mk-eagle.is-lifted .mk-eagle__tilt{
    animation:mk-eagle-idle-body 8s var(--mk-ease-air) infinite,mk-eagle-climb 2.4s var(--mk-ease-air) both}
}
/* Off-screen: pause only the idle breath (always 2nd on wings, 1st on body); the scroll-linked beat stays in sync. */
.mk-eagle.is-offscreen .mk-eagle__wing--back,
.mk-eagle.is-offscreen .mk-eagle__wing--front{animation-play-state:running,paused,running}
.mk-eagle.is-offscreen .mk-eagle__tilt{animation-play-state:paused,running}

@keyframes mk-eagle-settle-back{from{transform:rotate(calc(-8deg * var(--mk-amp)))}to{transform:none}}
@keyframes mk-eagle-settle-front{from{transform:rotate(calc(8deg * var(--mk-amp)))}to{transform:none}}

/* Very light breath: ≈2° wings, 2px body, then a long calm hold. */
@keyframes mk-eagle-idle-back{
  0%,64%,100%{rotate:0deg}
  24%{rotate:calc(2.2deg * var(--mk-amp))}
  46%{rotate:calc(-.8deg * var(--mk-amp))}
}
@keyframes mk-eagle-idle-front{
  0%,64%,100%{rotate:0deg}
  24%{rotate:calc(-2deg * var(--mk-amp))}
  46%{rotate:calc(.7deg * var(--mk-amp))}
}
@keyframes mk-eagle-idle-body{
  0%,64%,100%{translate:0 0}
  24%{translate:0 calc(-2px * var(--mk-amp))}
  46%{translate:0 calc(.6px * var(--mk-amp))}
}

/* Wind: down-stroke, up-stroke, then a lifted glide while climbing out of the hero. */
@keyframes mk-eagle-climb{
  0%{transform:none}
  40%{transform:translate3d(0,calc(6px * var(--mk-amp)),0) rotate(1deg)}
  100%{transform:translate3d(calc(-10px * var(--mk-amp)),calc(-70px * var(--mk-amp)),0) rotate(-6deg)}
}
@keyframes mk-eagle-beat-back{
  0%{transform:none}
  38%{transform:rotate(calc(-7deg * var(--mk-amp))) scale(.98)}
  78%{transform:rotate(calc(5deg * var(--mk-amp)))}
  100%{transform:rotate(calc(3deg * var(--mk-amp)))}
}
@keyframes mk-eagle-beat-front{
  0%{transform:none}
  34%{transform:rotate(calc(7deg * var(--mk-amp))) scaleY(.96)}
  74%{transform:rotate(calc(-5deg * var(--mk-amp)))}
  100%{transform:rotate(calc(-3deg * var(--mk-amp)))}
}

/* ---------- Reduced motion: always wins, even if the class was printed ---------- */
@media (prefers-reduced-motion:reduce){
  .mk-eagle,.mk-eagle__tilt,.mk-eagle__layer{animation:none!important;transition:none!important;opacity:1!important;transform:none!important;rotate:none!important;translate:none!important}
}
