/* ============================================================
   CREAMY – pulsující sféra (puls layer)
   Verze 1.1 · mix variant 1a + 1c, bez efektu na tlačítku

   Odkaz patří jako poslední <link> v <head>, za všechny
   stránkové <style> bloky. Nemění markup, pracuje jen
   s existujícími třídami webu. Bez JS zůstane web jako dnes.

   Změny proti 1.0 (13. 8. 2026):
   - vlna kolem sféry odstraněna (dekorativní smyčka navíc,
     ořezávala se o overflow:hidden na .cm-closing a .cm-case)
   - dech zpomalen na 8 s, amplituda 1.045 → 1.025
   - keyframe už nepřepisuje box-shadow; místo něj brightness
     podle design systému, takže si každá sféra drží svůj stín
   - odrážky v heru zhasínají jen uvnitř .cm-hero-proof
   - křivka sjednocena na cubic-bezier(0.2, 0.8, 0.2, 1)
   ============================================================ */

@keyframes cm-sf-breathe {
  0%, 100% { scale: 1;     filter: brightness(1); }
  50%      { scale: 1.025; filter: brightness(1.05); }
}
@keyframes cm-sf-beat {
  0%, 100% { scale: 1; }
  18%      { scale: 1.5; }
  36%      { scale: 1; }
  54%      { scale: 1.28; }
}
@keyframes cm-sf-pop {
  0%   { opacity: 0; scale: 0.2; }
  60%  { opacity: 1; scale: 1.22; }
  100% { opacity: 1; scale: 1; }
}

/* ── 1 · Dech velkých sfér v dekoraci ────────────────────────
   scale + brightness, aby transform zůstal volný pro náklon
   a box-shadow každé třídy zůstal její vlastní. */
.cm-sphere,
.cm-manifest-sphere,
.cm-op-manifesto-sphere,
.cm-footer-sphere,
.cm-case::after {
  animation: cm-sf-breathe var(--cm-sf-dur, 8s) cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
  will-change: scale;
}

/* ── 2 · Náklon dekorace za kurzorem ─────────────────────────
   Proměnné --cm-sf-x / --cm-sf-y nastavuje sfera-puls.js.
   Základní transform každé třídy musí zůstat zachovaný. */
.cm-sphere,
.cm-ring,
.cm-footer-sphere,
.cm-footer-ring,
.cm-op-manifesto-sphere,
.cm-op-manifesto-ring {
  transform: translate(var(--cm-sf-x, 0px), var(--cm-sf-y, 0px));
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.cm-manifest-sphere,
.cm-manifest-ring-1,
.cm-manifest-ring-2 {
  transform: translateY(-50%) translate(var(--cm-sf-x, 0px), var(--cm-sf-y, 0px));
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── 3 · Tečka v logu: jeden tep po načtení ──────────────────
   Na přejetí reaguje web vlastním scale(1.18) v hlavním CSS;
   druhý efekt by se s ním násobil, proto tu žádný není. */
.cm-logo-dot { will-change: scale; }
.cm-logo-dot.is-beat { animation: cm-sf-beat 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* ── 4 · Odrážky v heru: kaskáda při vstupu do viewportu ─────
   Zhasíná se jen uvnitř hera. Stejná koule slouží jako marker
   i jinde na webu a tam musí zůstat vidět. */
.cm-sf .cm-hero-proof .cm-hp-sphere { opacity: 0; }
.cm-sf .cm-hero-proof.is-in .cm-hp-sphere {
  animation: cm-sf-pop 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.cm-sf .cm-hero-proof.is-in .cm-hp-item:nth-child(2) .cm-hp-sphere { animation-delay: 0.13s; }
.cm-sf .cm-hero-proof.is-in .cm-hp-item:nth-child(3) .cm-hp-sphere { animation-delay: 0.26s; }

/* ── 5 · Návrat nahoru = ukazatel přečtené délky stránky ───── */
.cm-totop::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(#E52F5A calc(var(--cm-sf-p, 0) * 360deg), rgba(31, 15, 18, 0.14) 0);
  -webkit-mask: radial-gradient(circle, transparent 0 calc(50% - 3px), #000 calc(50% - 3px));
  mask: radial-gradient(circle, transparent 0 calc(50% - 3px), #000 calc(50% - 3px));
  pointer-events: none;
}

/* ── 6 · Respekt k nastavení systému ─────────────────────────
   Vypíná pohyb, ne funkci. Ukazatel čtení zůstává. */
@media (prefers-reduced-motion: reduce) {
  .cm-sphere,
  .cm-manifest-sphere,
  .cm-op-manifesto-sphere,
  .cm-footer-sphere,
  .cm-case::after,
  .cm-logo-dot.is-beat { animation: none; }
  .cm-sf .cm-hero-proof .cm-hp-sphere { opacity: 1; animation: none; }
  .cm-sphere,
  .cm-ring,
  .cm-footer-sphere,
  .cm-footer-ring,
  .cm-op-manifesto-sphere,
  .cm-op-manifesto-ring,
  .cm-manifest-sphere,
  .cm-manifest-ring-1,
  .cm-manifest-ring-2 { transition: none; }
}
