/* Анімації демо-сайту «Адреналін».
   Працюють лише з JS (html.motion) і вимикаються при prefers-reduced-motion. Без JS сайт виглядає як раніше. */

/* ---------- прогрес прокрутки й хедер ---------- */
.m-progress {
  position: fixed; inset: 0 0 auto; z-index: 20; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--red) 60%, var(--yellow));
  transform: scaleX(0); transform-origin: 0 50%; pointer-events: none;
}
.hdr { transition: box-shadow .3s ease; }
.hdr.is-scrolled { box-shadow: 0 10px 28px -18px rgba(20, 22, 26, .45); }

/* ---------- hero ---------- */
.motion .hero__billboard { overflow: hidden; }
.motion .hero__body { position: relative; z-index: 1; }
.motion .hero__photo { animation: m-zoom 2.2s cubic-bezier(.16, 1, .3, 1) both; will-change: translate; }
@keyframes m-zoom { from { scale: 1.16; opacity: .35; } to { scale: 1.03; opacity: 1; } }

.motion .hero h1 { visibility: hidden; }
.motion-live .hero h1 { visibility: visible; }
.motion .hero h1 .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.motion .hero h1 .w > span {
  display: inline-block; transform: translateY(110%) rotate(4deg); transform-origin: 0 100%;
  animation: m-rise 1s cubic-bezier(.2, .9, .2, 1) forwards;
  animation-delay: calc(.35s + var(--i, 0) * .1s);
}
@keyframes m-rise { to { transform: none; } }

.motion .hero__location, .motion .hero__lead, .motion .hero__actions {
  opacity: 0; transform: translateY(20px);
  animation: m-fade .9s cubic-bezier(.2, .9, .2, 1) forwards;
}
.motion .hero__location { animation-delay: .2s; }
.motion .hero__lead { animation-delay: .85s; }
.motion .hero__actions { animation-delay: 1s; }
@keyframes m-fade { to { opacity: 1; transform: none; } }
.motion .hero__location::before { animation: m-blink 1.8s ease-in-out 1.2s infinite; }
@keyframes m-blink { 50% { scale: .55; opacity: .55; } }
.m-num { font-variant-numeric: tabular-nums; color: var(--yellow); font-weight: 700; }

/* ЕКГ-лінія — мотив із лого «Адреналін» */
.m-ecg {
  position: absolute; z-index: 0; left: 0; right: 0; top: 34%;
  width: 100%; height: auto; overflow: visible; pointer-events: none;
  filter: drop-shadow(0 0 7px rgba(216, 35, 42, .85));
}
.m-ecg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.m-ecg .base {
  stroke: var(--red); stroke-width: 3; opacity: .9;
  stroke-dasharray: var(--len); stroke-dashoffset: var(--len);
  animation: m-draw 1.9s .55s cubic-bezier(.65, 0, .35, 1) forwards;
}
.m-ecg .beam {
  stroke: var(--yellow); stroke-width: 4; opacity: 0;
  stroke-dasharray: 70 var(--len); stroke-dashoffset: 70;
  animation: m-beam 2.8s 2.45s linear infinite;
}
@keyframes m-draw { to { stroke-dashoffset: 0; } }
@keyframes m-beam { 0% { opacity: 1; stroke-dashoffset: 70; } 100% { opacity: 1; stroke-dashoffset: calc(-1 * var(--len)); } }

/* кнопки hero: магніт + стрілка */
.hero__actions .btn { transition: background-color .18s ease, color .18s ease, border-color .18s ease, translate .35s cubic-bezier(.2, .9, .2, 1); }
.motion .hero .btn--red > span { display: inline-block; animation: m-nudge 1.7s ease-in-out 2.2s infinite; }
@keyframes m-nudge { 50% { translate: 3px 3px; } }

/* блиск на основних кнопках */
.btn--red, .btn--yellow { position: relative; overflow: hidden; isolation: isolate; }
.btn--red::after, .btn--yellow::after {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; left: -70%; width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
  transform: skewX(-20deg); transition: left .75s cubic-bezier(.2, .9, .2, 1);
}

/* жовта смуга → бігучий рядок */
.hero__strip.is-marquee { display: block; position: relative; overflow: hidden; padding: 0; }
.hero__strip.is-marquee > p { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.m-marquee { display: flex; width: max-content; animation: m-marq 32s linear infinite; }
.m-marquee__group { display: flex; flex: none; }
.m-marquee span {
  display: inline-flex; align-items: center; gap: 24px; padding: 11px 24px 11px 0; white-space: nowrap;
  font: 700 clamp(14px, 1.6vw, 21px)/1.2 var(--condensed); letter-spacing: .04em; text-transform: uppercase;
}
.m-marquee span::after { content: ""; width: 9px; height: 9px; background: var(--red); transform: rotate(45deg); }
.m-marquee span:nth-child(3n)::after { background: var(--blue); }
@keyframes m-marq { to { transform: translateX(-50%); } }
.hero__strip:hover .m-marquee { animation-play-state: paused; }

/* ---------- поява при прокрутці ---------- */
.motion [data-m] {
  opacity: 0; transform: translateY(30px);
  transition: opacity .85s cubic-bezier(.2, .9, .2, 1), transform .85s cubic-bezier(.2, .9, .2, 1),
              translate .35s cubic-bezier(.2, .9, .2, 1), box-shadow .35s ease, border-color .35s ease;
  transition-delay: calc(var(--d, 0) * 75ms);
}
.motion [data-m].in { opacity: 1; transform: none; }
.motion [data-m="wipe"] { opacity: 1; transform: none; clip-path: inset(0 0 100% 0); transition: clip-path 1.05s cubic-bezier(.77, 0, .18, 1); }
.motion [data-m="wipe"].in { clip-path: inset(0 0 -20% 0); }
.motion .sec-head h2::after {
  content: ""; display: block; width: 64px; height: 6px; margin-top: 14px; background: var(--yellow);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .9s .45s cubic-bezier(.2, .9, .2, 1);
}
.motion .sec-head h2.in::after { transform: none; }
.motion .cab h2::after { background: var(--yellow); }
.motion .training__figure img { scale: 1.14; transition: scale 1.8s cubic-bezier(.16, 1, .3, 1); }
.motion .training__figure.in img { scale: 1; }

/* ---------- картки залів ---------- */
.hall { position: relative; isolation: isolate; }
.hall::before {
  content: ""; position: absolute; inset: -1px -1px auto; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--red));
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .45s cubic-bezier(.2, .9, .2, 1);
}
.hall::after {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 30%), rgba(28, 79, 160, .11), transparent 62%);
  transition: opacity .3s ease;
}
.hall h3 span { transition: color .3s ease; }

/* ---------- абонементи ---------- */
.plan { position: relative; }
.plan__price { font-variant-numeric: tabular-nums; }
.plan--highlight::before {
  content: ""; position: absolute; inset: -4px -1px auto; height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--red), var(--yellow), var(--blue)); background-size: 300% 100%;
  animation: m-flow 4s linear infinite;
}
@keyframes m-flow { to { background-position: 300% 0; } }

@media (hover: hover) and (pointer: fine) {
  .btn--red:hover::after, .btn--yellow:hover::after { left: 135%; }
  .hall:hover, .plan:hover { translate: 0 -6px; box-shadow: 0 22px 40px -26px rgba(20, 22, 26, .55); border-color: var(--blue); }
  .hall:hover::before { transform: none; }
  .hall:hover::after { opacity: 1; }
  .hall:hover h3 span { color: var(--red); }
  .hall, .plan { transition: translate .35s cubic-bezier(.2, .9, .2, 1), box-shadow .35s ease, border-color .35s ease; }
}

@media (min-width: 820px) {
  .m-ecg { left: auto; top: auto; bottom: 18%; width: min(62%, 780px); }
}

@media (prefers-reduced-motion: reduce) {
  .m-progress, .m-ecg, .m-marquee { display: none; }
}
