/* ILoveSport.kz — живой главный экран: видео/фото, смена стартов, обратный отсчёт. Pair with hero.js.
   Работает без JS (виден первый старт). Всё движение выключается под prefers-reduced-motion. */

/* ---------- фон: слои с кроссфейдом ---------- */
.hero__bg { position: absolute; inset: 0; z-index: 0; transform: translate3d(0, var(--py, 0px), 0); will-change: transform; }
.hero__bg .hero__img { transform: none; will-change: auto; }
.hero__layer { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s var(--ease-out); overflow: hidden; }
.hero__layer.is-active { opacity: 1; }
/* медленный Ken Burns у активного слоя */
.hero__layer.is-active .hero__img { animation: hero-zoom 2.8s var(--ease-out) backwards, hero-kb 28s ease-in-out 2.8s infinite alternate; }
@keyframes hero-kb { to { scale: 1.2; translate: -1.6% -1.2%; } }
.hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 65%; opacity: 0; transition: opacity 1s var(--ease-out); background: transparent; }
.hero__video.is-playing { opacity: 1; }
.hero__layer.is-video .hero__img { animation-play-state: paused; }

/* ---------- слайды: стопка в одной ячейке, высота = самый высокий ---------- */
.hero__slides { display: grid; touch-action: pan-y; }
.hero__slide { grid-area: 1 / 1; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .55s var(--ease-out), visibility 0s linear .55s; }
.hero__slide.is-active { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .6s var(--ease-out) .25s, visibility 0s; }
.hero__slide .hero__title span > i { transition: transform .95s var(--ease-out); }
.hero__slide:not(.is-active) .hero__title span > i { transform: translate3d(0, 105%, 0); transition-duration: .01s; }
.hero__slide.is-active .hero__title span:nth-child(1) > i { transition-delay: .3s; }
.hero__slide.is-active .hero__title span:nth-child(2) > i { transition-delay: .4s; }
.hero__slide.is-active .hero__title span:nth-child(3) > i { transition-delay: .5s; }
.hero__slide .hero__kicker, .hero__slide .hero__count, .hero__slide .hero__row { transition: transform .8s var(--ease-out); }
.hero__slide:not(.is-active) .hero__kicker, .hero__slide:not(.is-active) .hero__count, .hero__slide:not(.is-active) .hero__row { transform: translate3d(0, 16px, 0); transition-duration: .01s; }
.hero__slide.is-active .hero__count { transition-delay: .55s; }
.hero__slide.is-active .hero__row { transition-delay: .65s; }
.hero__facts dd { overflow-wrap: anywhere; }

/* ---------- обратный отсчёт: цифры табло ---------- */
.hero__count { display: grid; gap: 10px; margin: 0 0 var(--s5); min-height: 84px; align-content: start; }
.hero__count:empty { min-height: 0; margin: 0; }
.hero__count-label { font: 500 15px/1 var(--f-body); color: #D5DEE9; }
.hero__count-row { display: flex; align-items: center; gap: 4px; font: 800 clamp(30px, 7.4vw, 54px)/1 var(--f-display); color: var(--paper); }
.cd-g { display: inline-flex; gap: 3px; }
.dg { position: relative; display: inline-grid; place-items: center; width: .66em; height: 1.22em; border-radius: 6px; overflow: hidden; background: rgba(9, 21, 38, .62); }
.dg > span { display: block; font-variant-numeric: tabular-nums; }
.dg--tick > span { animation: dg-in .5s var(--ease-out) both; }
@keyframes dg-in { from { transform: translate3d(0, -60%, 0); opacity: 0; } }
.cd-u { font: 600 clamp(14px, 3.4vw, 18px)/1 var(--f-body); color: #D5DEE9; margin: 0 10px 0 6px; align-self: flex-end; padding-bottom: .5em; }
.cd-sep { width: .35em; text-align: center; opacity: .7; }

/* ---------- кнопки-точки ---------- */
.hero__ctl { display: none; align-items: center; gap: 0; margin-top: var(--s4); }
.hero.is-live .hero__ctl { display: flex; }
.hero__dot { position: relative; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.hero__dot:first-child { margin-left: -10px; }
.hero__dot i { position: relative; display: block; width: 10px; height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .55); overflow: hidden; transition: width .45s var(--ease-out), background-color .2s; }
.hero__dot:hover i { background: rgba(255, 255, 255, .9); }
.hero__dot.is-active i { width: 40px; background: rgba(255, 255, 255, .32); }
.hero__dot i::after { content: ''; position: absolute; inset: 0; background: var(--paper); transform-origin: left; transform: scaleX(0); }
.hero__dot.is-active i::after { transform: scaleX(var(--p, 0)); }
.hero.is-still .hero__dot.is-active i::after { transform: scaleX(1); }
.hero__pause { width: 44px; height: 44px; margin-left: 6px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.hero__pause span { display: block; width: 12px; height: 14px; border-left: 4px solid var(--paper); border-right: 4px solid var(--paper); box-sizing: border-box; transition: border-width .2s; }
.hero__pause[aria-pressed="true"] span { width: 0; height: 0; border: 0 solid transparent; border-width: 7px 0 7px 12px; border-left-color: var(--paper); }
.hero.is-still .hero__pause { display: none; }

@media (max-width: 639px) {
  .hero__count { min-height: 66px; }
  .hero__ctl { margin-top: var(--s4); }
}
@media (prefers-reduced-motion: reduce) {
  .hero__layer { transition: none; }
  .hero__layer.is-active .hero__img { animation: none !important; }
  .hero__video { display: none; }
  .hero__slide, .hero__slide.is-active { transition: none; }
  .hero__slide .hero__title span > i, .hero__slide .hero__kicker, .hero__slide .hero__count, .hero__slide .hero__row { transition: none !important; }
  .dg--tick > span { animation: none; }
}

/* ---------- компоновка плаката: без вылета за экран ---------- */
.hero .wrap { padding-block: clamp(40px, 7svh, 72px) var(--s6); }
.hero__title { font-size: clamp(60px, min(17vw, 20svh), 196px); }
@media (min-width: 640px) {
  .hero__ctl { position: absolute; top: clamp(32px, 6svh, 64px); right: var(--gutter, 24px); margin: 0; }
  .hero__count-row { font-size: clamp(34px, 5vw, 46px); }
}
@media (min-width: 1200px) {
  .hero__slide { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s6); align-content: end; }
  .hero__slide > * { grid-column: 1 / -1; }
  .hero__slide .hero__title { grid-column: 1; grid-row: 2; margin-bottom: var(--s5); }
  .hero__slide .hero__count { grid-column: 2; grid-row: 2; align-self: end; justify-items: end; margin-bottom: var(--s5); min-height: 0; }
  .hero__count-row { font-size: 54px; }
}

/* 1024–1199: факты и кнопки друг под другом (иначе «Республики» ломается посреди слова) */
@media (min-width: 1024px) and (max-width: 1199px) {
  .hero__row { grid-template-columns: minmax(0, 1fr); }
  .hero__facts dd { overflow-wrap: break-word; }
  .hero .wrap { padding-block: clamp(32px, 5svh, 56px) var(--s6); }
  .hero__title { font-size: clamp(60px, min(15vw, 17svh), 160px); }
}
