/* ============================================================
   buutce — Landing / Login motion layer ("Living Ledger")
   docs/LANDING_MOTION_REDESIGN.md §6, §10–12

   Pure enhancement. Every rule that moves something sits inside
   @media (prefers-reduced-motion: no-preference); the reduced
   block at the bottom is a belt-and-braces hard stop. Without
   this file the page is complete and static.

   Loops are 12–24s (ambient), never 1–2s gimmicks. Only
   transform / opacity / stroke-dashoffset are animated — no
   layout properties on loops.
   ============================================================ */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* -- Entrance: ~1.15s total, CSS-only, never blocks interaction -- */
  .enter { animation: l-enter .62s var(--l-ease, ease-out) both; animation-delay: var(--enter-delay, 0ms); }
  @keyframes l-enter {
    from { opacity: 0; transform: translate3d(0, 14px, 0); }
    to   { opacity: 1; transform: none; }
  }
  .ledger-stage { animation: l-stage-in 1.4s ease-out both; }
  @keyframes l-stage-in { from { opacity: 0; } to { opacity: 1; } }

  /* -- Ambient tonal drift (24s, almost imperceptible) -- */
  .ledger-ambient { animation: l-ambient 24s ease-in-out infinite alternate; will-change: transform; }
  @keyframes l-ambient {
    from { transform: translate3d(-1.5%, 0, 0) scale(1); }
    to   { transform: translate3d(1.5%, -1%, 0) scale(1.05); }
  }

  /* -- Financial paths: one short teal segment travelling each curve -- */
  .ledger-paths .lp-flow {
    stroke-dasharray: 70 930; opacity: .55;
    animation: l-flow 16s linear infinite;
  }
  .ledger-paths .lp-flow-1 { animation-duration: 18s; animation-delay: -4s; }
  .ledger-paths .lp-flow-2 { animation-duration: 22s; animation-delay: -13s; opacity: .4; }
  .ledger-paths .lp-flow-3 { animation-duration: 14s; animation-delay: -8s; opacity: .35; }
  @keyframes l-flow {
    from { stroke-dashoffset: 1000; }
    to   { stroke-dashoffset: 0; }
  }

  /* -- Hero balance: curve trace + row-by-row focus (16s loop) -- */
  .bc-run { stroke-dasharray: 160 1000; stroke-dashoffset: 160; animation: l-curve 12s cubic-bezier(.45, 0, .25, 1) 1.2s infinite; }
  @keyframes l-curve {
    0%   { stroke-dashoffset: 160; }
    70%  { stroke-dashoffset: -1000; }
    100% { stroke-dashoffset: -1000; }
  }
  /* transform-only (compositor) — no layout on the loop */
  .balance-row::before { animation: l-row 16s ease-in-out infinite backwards; will-change: transform; }
  .balance-row:nth-child(2)::before { animation-delay: 4s; }
  .balance-row:nth-child(3)::before { animation-delay: 8s; }
  .balance-row:nth-child(4)::before { animation-delay: 12s; }
  @keyframes l-row {
    0%, 25%, 100% { transform: scaleY(0); }
    4%, 21%       { transform: scaleY(1); }
  }

  /* -- Scroll reveals (only when JS is present to un-hide them) -- */
  .motion-js [data-reveal] {
    opacity: 0; transform: translate3d(0, 16px, 0);
    transition: opacity .8s var(--l-ease, ease-out), transform .8s var(--l-ease, ease-out);
  }
  .motion-js [data-reveal].is-visible { opacity: 1; transform: none; }
  .motion-js .shot-row .shot:nth-child(2) { transition-delay: .08s; }
  .motion-js .shot-row .shot:nth-child(3) { transition-delay: .16s; }

  /* -- "Tek görünüm" connector draws when the section enters view -- */
  .motion-js [data-flow]::after { transform: scaleX(0); transition: transform 1.8s var(--l-ease, ease-out) .25s; }
  .motion-js [data-flow].is-visible::after { transform: scaleX(1); }
  .motion-js [data-flow] .view-step::before { transition: background-color .4s ease; }
  .motion-js [data-flow].is-visible .view-step::before { background: var(--color-brand-accent); }
  .motion-js [data-flow].is-visible .view-step:nth-child(1)::before { transition-delay: .4s; }
  .motion-js [data-flow].is-visible .view-step:nth-child(2)::before { transition-delay: .85s; }
  .motion-js [data-flow].is-visible .view-step:nth-child(3)::before { transition-delay: 1.3s; }
  .motion-js [data-flow].is-visible .view-step:nth-child(4)::before { transition-delay: 1.75s; }
}

/* Static state of the hero balance (also the reduced-motion state):
   Net Servet carries the focus marker. */
.balance-row--net::before { transform: scaleY(1); }

/* Mobile performance mode: drop non-essential layers. The canvas
   (ledger fragments + posting line) stays as the single signature. */
@media (max-width: 720px) {
  .ledger-paths { display: none; }
  .ledger-ambient { animation: none; }
}

/* HARD accessibility stop. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ledger-paths .lp-flow { display: none; }
  .enter, .ledger-stage, .ledger-ambient, .bc-run,
  .balance-row::before { animation: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  [data-flow]::after { transform: none !important; transition: none !important; }
  [data-depth] { translate: none !important; }
}
