/* Блок Testimonial — демо-відео на всю ширину + кроки (розділи), прив'язані до
   таймлайну. Примітиви .rnum/.rlbl/.link-arr/.odo — глобальні. */
.testi {
  padding-top: var(--section-gap)
}

/* Теглайн + заголовок — по центру. Розмір заголовка дублюємо з ВИЩОЮ специфічністю
   (.testi.wrap > .h2 = 0-3-0), бо wp-admin common.css має .wrap h2:first-child{font-size:23px}
   (0-2-1), яке в редакторі перебиває наш .h2 — наш клас .wrap збігається з адмінським wrapper. */
.testi > .tagline {
  justify-content: center;
  text-align: center
}

.testi.wrap > .h2 {
  font-size: clamp(30px, 3.8vw, 52px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin-bottom: clamp(26px, 4vw, 44px);
  text-align: center
}

/* Смуга відео + кроки — у МЕЖАХ контенту секції (.wrap), вирівняно з цитатою
   та рештою сторінки (без full-bleed, щоб медіа не «вилазило» за контент). */
.testi-media-in {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 24%, 350px);
  gap: clamp(20px, 2.4vw, 34px);
  align-items: start
}

/* Лише відео АБО лише кроки — одна колонка на всю ширину. */
.testi-media-in.is-solo {
  grid-template-columns: 1fr
}

/* ---- Відео 16:9 ---- */
.testi-video {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--ink);
  /* Тінь у колір фону — щоб не виділялась халою на лавандовому фоні (зливається). */
  box-shadow: 0 24px 60px var(--bg)
}

.testi-vid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: block
}

/* Затемнення постера для читабельності фігури/кнопки; зникає після старту */
.testi-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--ink-rgb), .10), rgba(var(--ink-rgb), .40));
  transition: opacity .35s ease
}

.testi-video.is-started .testi-scrim {
  opacity: 0
}

/* Кнопка play поверх постера (до першого запуску) */
.testi-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: clamp(64px, 7vw, 84px);
  height: clamp(64px, 7vw, 84px);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(255, 255, 255, .94);
  color: var(--ink);
  display: grid;
  place-items: center;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .32);
  transition: transform .2s ease, opacity .3s ease, visibility .3s;
  z-index: 3
}

.testi-play svg {
  width: 34%;
  height: 34%
}

.testi-play:hover {
  transform: scale(1.08)
}

.testi-play:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px
}

.testi-video.is-started .testi-play {
  opacity: 0;
  visibility: hidden
}

/* ---- Кроки (розділи) ---- */
.testi-steps {
  position: relative;
  min-width: 0
}

/* Стрілки — лише для горизонтальної стрічки (вмикає медіа ≤960). */
.tnav-row {
  display: none
}

/* Затухання-підказки прокрутки: плавний фейд у колір фону (як край смуги
   логотипів на скріні), а не темна тінь. JS вмикає fade-top / fade-bot, коли
   є прихований контент угорі/внизу списку (список обмежений висотою відео).
   rgba(248,246,255,0) = --bg (#F8F6FF) з нульовою прозорістю — без сірого відтінку. */
.testi-steps::before,
.testi-steps::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 44px;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity .2s ease
}

.testi-steps::before {
  top: 0;
  background: linear-gradient(180deg, var(--bg), rgba(248, 246, 255, 0))
}

.testi-steps::after {
  bottom: 0;
  background: linear-gradient(0deg, var(--bg), rgba(248, 246, 255, 0))
}

.testi-steps.fade-top::before {
  opacity: 1
}

.testi-steps.fade-bot::after {
  opacity: 1
}

.tsteps {
  list-style: none;
  margin: 0;
  padding: 2px 6px 2px 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* max-height задає JS = висота відео; тут — плавний скрол і тонкий скролбар */
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--ink-rgb), .28) transparent
}

.tsteps::-webkit-scrollbar {
  width: 8px
}

.tsteps::-webkit-scrollbar-thumb {
  background: rgba(var(--ink-rgb), .24);
  border-radius: 99px
}

.tsteps::-webkit-scrollbar-track {
  background: transparent
}

.tstep {
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  position: relative;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease
}

.tstep:hover {
  border-color: rgba(var(--lime-rgb), .55);
  transform: translateX(2px)
}

.tstep:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px
}

.tstep.on {
  border-color: transparent;
  background: var(--ink);
  color: #fff
}

.tstep-idx {
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  background: var(--mint);
  color: var(--ink)
}

.tstep.on .tstep-idx {
  background: var(--lime);
  color: var(--ink)
}

/* Активний крок: замість номера — play (коли на паузі) / pause (коли грає).
   Клік по активному кроку керує відтворенням (див. main.js). */
.testi .tstep.on .tstep-idx {
  font-size: 0;
  position: relative
}

.testi:not(.is-playing) .tstep.on .tstep-idx::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor
}

.testi.is-playing .tstep.on .tstep-idx::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 11px;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor
}

.tstep-c {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1
}

.tstep-hd {
  display: flex;
  align-items: baseline;
  gap: 10px
}

.tstep-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.01em;
  min-width: 0
}

.tstep-time {
  margin-left: auto;
  flex: none;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums
}

.tstep.on .tstep-time {
  color: rgba(255, 255, 255, .72)
}

.tstep-tx {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--muted)
}

.tstep.on .tstep-tx {
  color: rgba(255, 255, 255, .8)
}

/* Прогрес усередині активного кроку (JS оновлює width на i) */
.tstep-bar {
  display: none;
  height: 3px;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, .18)
}

.tstep.on .tstep-bar {
  display: block
}

.tstep-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: var(--lime);
  transition: width .25s linear
}

/* ---- Адаптив ---- */
@media (max-width:960px) {
  .testi-media-in {
    grid-template-columns: 1fr;
    gap: clamp(16px, 4vw, 24px)
  }

  /* Планшет/мобілка: навігація кроків — горизонтальна стрічка зі скролом. */
  .tsteps {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
    max-height: none !important;
    gap: 12px;
    padding: 2px 2px 8px;
    scroll-snap-type: x proximity
  }

  .tsteps::-webkit-scrollbar {
    height: 8px
  }

  /* Картка вужча за доріжку — сусідня визирає збоку, тож видно, що список
     продовжується. Snap proximity, щоб гортання не «клацало» надто жорстко. */
  .tsteps>li {
    flex: 0 0 auto;
    width: min(78vw, 300px);
    scroll-snap-align: center;
    /* Картки однакової висоти — по найвищій. <li> вже тягнеться (stretch),
       але кнопка всередині лишалась за своїм контентом. */
    display: flex
  }

  .tsteps>li>.tstep {
    flex: 1 1 auto;
    width: 100%;
    height: 100%
  }

  /* Затінення по боках — підказка, що доріжка продовжується. Класи ставить JS:
     зникає на краях, щоб не висіти дарма. */
  /* Краї доріжки згасають маскою, а не накладкою: накладка лежала б під
     картками (у них власний stacking context) і обрізаний край усе одно
     різав би око. Маска ж діє на сам скрол-контейнер. */
  .tsteps {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%)
  }

  /* вертикальні фейди — лише для десктопного режиму */
  .testi-steps::before,
  .testi-steps::after {
    display: none
  }

  /* Стрілки стоять окремим рядом під стрічкою — не накривають картки. */
  .tnav-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px
  }

  .tnav {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: opacity .2s ease, background .2s ease, border-color .2s ease
  }

  .tnav:hover {
    border-color: var(--ink)
  }

  .tnav:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px
  }

  /* На краю доріжки стрілка приглушена (а не зникає) — інакше ряд «стрибав» би. */
  .tnav[disabled] {
    opacity: .35;
    pointer-events: none
  }

  /* фейди-підказки зверху/знизу не потрібні при горизонтальному скролі */
  .testi-steps::before,
  .testi-steps::after {
    display: none
  }
}

@media (max-width:560px) {
  .tstep {
    padding: 12px 13px;
    gap: 11px
  }
}

@media (prefers-reduced-motion:reduce) {

  .testi-scrim,
  .tstep-bar i {
    transition: none
  }
}
