/* ==========================================================================
   Kretanje

   Sve animacije vrijede samo kad <html> ima klasu .motion (postavlja je
   skripta, osim kad korisnik traži smanjeno kretanje). Element s
   [data-reveal] dobije .is-in kad dođe u vidno polje i animacija krene
   jednom. Bez skripte sve se odmah prikazuje u konačnom stanju.
   ========================================================================== */

@keyframes appear { to { opacity: 1; } }
@keyframes stroke-in { to { stroke-dashoffset: 0; } }

/* --- krug liturgijske godine: godina se iscrta od došašća do danas ------------ */

.motion .ring .ring-season,
.motion .ring .ring-period__arc { stroke-dashoffset: 1; }
.motion .ring .ring-month,
.motion .ring .ring-tick,
.motion .ring .ring-period,
.motion .ring .ring-seam,
.motion .ring .ring-year,
.motion .ring .ring__center { opacity: 0; }
.motion .ring .ring-hand { opacity: 0; transform: rotate(0deg); }

.motion .ring.is-in .ring-season { animation: stroke-in var(--dur) linear var(--delay) forwards; }
.motion .ring.is-in .ring-period__arc { animation: stroke-in .6s ease-out var(--delay) forwards; }
.motion .ring.is-in .ring-month,
.motion .ring.is-in .ring-tick,
.motion .ring.is-in .ring-period,
.motion .ring.is-in .ring-seam,
.motion .ring.is-in .ring-year { animation: appear .5s ease var(--delay) forwards; }
.motion .ring.is-in .ring__center { animation: appear 1s ease .3s forwards; }

/* kazaljka putuje s potezom i stane na današnjem danu */
.motion .ring.is-in .ring-hand { animation: ring-hand var(--dur) linear var(--delay) forwards; }
@keyframes ring-hand {
  0% { opacity: 0; transform: rotate(0deg); }
  6% { opacity: 1; }
  100% { opacity: 1; transform: rotate(var(--to)); }
}
.motion .ring.is-in .ring-today-dot { animation: ring-land .7s cubic-bezier(.3, 1.6, .5, 1) var(--land) both; }
@keyframes ring-land {
  0% { transform: scale(1); }
  45% { transform: scale(1.7); }
  100% { transform: scale(1); }
}
.motion .ring.is-in .ring-today-pulse { animation: ring-pulse 2.8s ease-out calc(var(--land) + .4s) infinite; }
@keyframes ring-pulse {
  0% { opacity: .5; transform: scale(1); }
  100% { opacity: 0; transform: scale(3.2); }
}

/* vježbe koje kreću bilo kada: točka koja neprestano kruži */
.motion .year-point__orbit { animation: orbit 7s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }

/* --- uvodni tekst se "upisuje" riječ po riječ dok se čita ------------------------ */

.motion [data-ink] .ink-word { opacity: .16; transition: opacity .4s ease; }
.motion [data-ink] .ink-word.is-lit { opacity: 1; }

/* --- vježbe: obavijest stigne kad je vidiš --------------------------------------- */
/* Spusti se kao obavijest na zaključanom zaslonu, ikona aplikacije poskoči
   i odašilje valove, a vrijeme se iz "sada" promijeni u 7:30. */

.motion .notif { opacity: 0; transform: translateY(-26px) scale(.9); filter: blur(6px); }
.motion .notif.is-in { animation: notif-in .85s cubic-bezier(.18, 1.25, .4, 1) .25s forwards; }
@keyframes notif-in {
  0% { opacity: 0; transform: translateY(-26px) scale(.9); filter: blur(6px); }
  55% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
.motion .notif.is-in .notif__icon { animation: notif-icon .6s cubic-bezier(.3, 1.8, .5, 1) .55s both; }
@keyframes notif-icon {
  0% { transform: scale(.6); }
  100% { transform: scale(1); }
}
/* valovi oko ikone */
.motion .notif::before,
.motion .notif::after {
  content: ""; position: absolute; left: 14px; top: 50%; width: 36px; height: 36px; margin-top: -18px;
  border-radius: 11px; border: 2px solid #0079E9; opacity: 0; pointer-events: none;
}
.motion .notif.is-in::before { animation: notif-ping 1.4s ease-out .7s 2; }
.motion .notif.is-in::after { animation: notif-ping 1.4s ease-out 1.1s 2; }
@keyframes notif-ping {
  0% { opacity: .7; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.1); }
}
/* "sada" dok je obavijest svježa */
.motion .notif time { position: relative; color: transparent; }
.motion .notif time::before { content: "sada"; position: absolute; right: 0; top: 0; color: #8C8C8C; opacity: 0; }
.motion .notif.is-in time { animation: notif-time 3.6s step-end forwards; }
.motion .notif.is-in time::before { animation: notif-now 3.6s step-end forwards; }
@keyframes notif-time { 0% { color: transparent; } 100% { color: #8C8C8C; } }
@keyframes notif-now { 0% { opacity: 1; } 100% { opacity: 0; } }

/* --- riječ: dva mobitela se rašire iz hrpe ---------------------------------------- */

.motion .feature__visual--pair .phone { transition: transform 1.2s cubic-bezier(.2, .8, .2, 1) .15s; }
.motion .feature__visual--pair:not(.is-in) .phone--back { transform: scale(.88); }
.motion .feature__visual--pair:not(.is-in) .phone--front { transform: none; }

/* --- efa se napuni: prvo devet desetina, onda desetina za tebe -------------------- */

.motion .efa-measure .efa-measure__liquid { transform: translateY(600px); }
.motion .efa-measure .efa-measure__you,
.motion .efa-measure .efa-measure__part { opacity: 0; }
.motion .efa-measure.is-in .efa-measure__liquid { animation: efa-fill 1.6s cubic-bezier(.35, .6, .2, 1) .2s forwards; }
@keyframes efa-fill { to { transform: translateY(0); } }
.motion .efa-measure.is-in .efa-measure__you { animation: appear .7s ease 1.7s forwards; }
.motion .efa-measure.is-in .efa-measure__part { animation: appear .6s ease 1.1s forwards; }
.motion .efa-measure.is-in .efa-measure__part--you { animation-delay: 1.9s; }

/* --- molitve: zrna krunice zasvijetle jedno za drugim ------------------------------- */

.motion .categories li + li::before { opacity: .25; transform: scale(.6); }
.motion .categories.is-in li + li::before { animation: bead .7s ease .3s forwards; }
.motion .categories.is-in li:nth-child(3)::before { animation-delay: .6s; }
.motion .categories.is-in li:nth-child(4)::before { animation-delay: .9s; }
.motion .categories.is-in li:nth-child(5)::before { animation-delay: 1.2s; }
.motion .categories.is-in li:nth-child(6)::before { animation-delay: 1.5s; }
.motion .categories.is-in li:nth-child(7)::before { animation-delay: 1.8s; }
@keyframes bead {
  0% { opacity: .25; transform: scale(.6); }
  55% { opacity: 1; transform: scale(1.8); }
  100% { opacity: 1; transform: scale(1); }
}

/* --- o nama: brojke se odbroje (skripta), redci se pojave jedan za drugim ------------ */

.motion .facts > div { opacity: 0; transform: translateY(14px); }
.motion .facts.is-in > div { animation: rise .7s cubic-bezier(.2, .7, .2, 1) forwards; }
.motion .facts.is-in > div:nth-child(2) { animation-delay: .12s; }
.motion .facts.is-in > div:nth-child(3) { animation-delay: .24s; }
.motion .facts.is-in > div:nth-child(4) { animation-delay: .36s; }

/* --- naslovnica: "Zastani." se smiri -------------------------------------------- */
/* Raspršena, mutna slova skupe se i izoštre, sve sporije, kao kad se umiriš;
   točka padne posljednja. Znak iza mobitela se iscrta, a zatim mirno diše (site.css). */

.motion .hero__letters { animation: gather 2s cubic-bezier(.16, 1, .3, 1) .1s both; }
@keyframes gather { from { letter-spacing: var(--spread); } }

.motion .hero__letters > span:not(.hero__stop) {
  animation: letter-in 1.4s cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: calc(.1s + var(--i) * 40ms + var(--i) * var(--i) * 18ms);
}
@keyframes letter-in {
  from { opacity: 0; filter: blur(16px); }
  45% { opacity: 1; }
  to { opacity: 1; filter: blur(0); }
}

.motion .hero__stop { animation: stop-land .9s cubic-bezier(.3, 1.5, .55, 1) 1.2s both; }
@keyframes stop-land {
  from { opacity: 0; transform: translateY(-.5em); }
  35% { opacity: 1; }
  to { opacity: 1; transform: none; }
}

.motion .hero__line { animation: focus-in 1.3s ease .95s both; }
@keyframes focus-in { from { opacity: 0; filter: blur(8px); } }

.motion .today__dot { animation: breathe 10s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 5px var(--lit-bg), 0 0 0 6px var(--lit-edge); }
  50% {
    box-shadow: 0 0 0 9px color-mix(in srgb, var(--lit-bg) 55%, transparent),
      0 0 0 10px color-mix(in srgb, var(--lit-edge) 55%, transparent);
  }
}

/* --- dubina dok skrolaš (samo preglednici koji to podržavaju) --------------------- */
/* Mobiteli putuju malo sporije od teksta, a krug iza njih se otvori. */

@supports (animation-timeline: view()) {
  .motion .feature__visual > .phone {
    animation: drift linear both; animation-timeline: view(); animation-range: cover;
  }
  .motion .feature__visual--pair .phone--back {
    --drift: 80px;
    animation: drift linear both; animation-timeline: view(); animation-range: cover;
  }
  @keyframes drift {
    from { translate: 0 var(--drift, 44px); }
    to { translate: 0 calc(var(--drift, 44px) * -1); }
  }

  .motion .feature__visual::before {
    animation: open-up linear both; animation-timeline: view(); animation-range: entry 0% cover 45%;
  }
  @keyframes open-up { from { scale: .78; opacity: 0; } }
}

/* --- molitve: od mobitela se šire valovi dok molitva svira -------------------------- */

.motion .is-sounding .waves i { animation: wave 4.2s cubic-bezier(.25, .6, .35, 1) infinite; }
.motion .is-sounding .waves i:nth-child(2) { animation-delay: 1.4s; }
.motion .is-sounding .waves i:nth-child(3) { animation-delay: 2.8s; }
@keyframes wave {
  from { opacity: .9; transform: scale(.6); }
  to { opacity: 0; transform: scale(1.18); }
}

/* --- prijelaz među stranicama ------------------------------------------------------- */
/* Stranice se pretope jedna u drugu, a slika novosti ili vježbi preraste
   u veliku sliku na stranici koja se otvori. */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
.site-header { view-transition-name: site-header; }
.news-card__img, .news-page__figure img, .exercise-card__img, .exercise-hero__img { view-transition-class: photo; }
::view-transition-group(*) { animation-duration: .55s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; }
::view-transition-old(*.photo), ::view-transition-new(*.photo) { height: 100%; object-fit: cover; overflow: clip; }
