/**
 * Блок «Кто уже рассказал» (.zb-speakers) — стили дочерней темы.
 *
 * Подключается из functions.php (zoobiznes_speakers_assets).
 * Все правила — строго под .zb-speakers.
 *
 * Макет: Figma node 2128:45308 (+ правки: ×1.5, 2 ряда).
 * Токены: .cursor/rules/zoobiznes-design-system.mdc (тёмная тема).
 */

.zb-speakers {
  --zb-content: 1200px;
  --zb-bg: #111111;
  --zb-card-bg: #091f1e;
  --zb-card-border: #18302f;
  --zb-on-dark: #fefaee;
  --zb-on-dark-alt: #fffaea;
  --zb-brand-dark: #b9f078;
  --zb-muted: #656565;
  --zb-logo-cream: #fff9ea;
  --zb-logo-empty: rgba(255, 255, 255, 0.03);
  /* база макета ×1.5 */
  --zb-card-w: 413px;
  --zb-card-h: 210px;
  --zb-card-gap: 30px;
  --zb-logo: 72px;
  --zb-card-pad: 30px;
  --zb-card-radius: 22px;
  --zb-row-gap: 30px;
  --zb-fade: 160px;
  --zb-marquee-dur-1: 150s;
  --zb-marquee-dur-2: 240s;
  --zb-scale: 1;

  --zb-font-display: "Geologica", "Inter", system-ui, sans-serif;
  --zb-font-body: "Inter", system-ui, -apple-system, sans-serif;
  --zb-font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  position: relative;
  isolation: isolate;
  overflow: hidden;
  /* top −20px от 70; bottom +80px от 80 — внутри тёмного фона */
  padding: 50px 0 160px;
  background: var(--zb-bg);
  font-family: var(--zb-font-body);
  color: var(--zb-on-dark);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  /* гасим типичный margin WP-блока (~40px) — иначе светлая полоса снизу */
  margin-bottom: -40px !important;
}

.zb-speakers *,
.zb-speakers *::before,
.zb-speakers *::after {
  box-sizing: border-box;
}

.zb-speakers br {
  display: none;
}

.zb-speakers__title br,
.zb-speakers__name br,
.zb-speakers__speaker br {
  display: block;
}

.zb-speakers .zb-speakers__title {
  margin: 0 auto 52px !important;
  max-width: calc(100% - 32px);
  padding: 0 16px;
  font-family: var(--zb-font-display) !important;
  font-weight: 400 !important;
  font-size: calc(40px * var(--zb-scale)) !important;
  line-height: 0.8 !important;
  letter-spacing: -0.04em !important;
  color: var(--zb-on-dark-alt) !important;
  text-align: center !important;
  font-style: normal !important;
}

.zb-speakers__marquee {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: calc(var(--zb-row-gap) * var(--zb-scale));
  width: 100%;
  overflow: hidden;
  cursor: default;
}

/* Мягкое затухание поверх рядов (не mask — иначе при сдвигах «чёрная полоса») */
.zb-speakers__marquee::before,
.zb-speakers__marquee::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(var(--zb-fade) * var(--zb-scale));
  z-index: 3;
  pointer-events: none;
}

.zb-speakers__marquee::before {
  left: 0;
  background: linear-gradient(
    90deg,
    var(--zb-bg) 0%,
    rgba(17, 17, 17, 0.85) 35%,
    rgba(17, 17, 17, 0) 100%
  );
}

.zb-speakers__marquee::after {
  right: 0;
  background: linear-gradient(
    270deg,
    var(--zb-bg) 0%,
    rgba(17, 17, 17, 0.85) 35%,
    rgba(17, 17, 17, 0) 100%
  );
}

.zb-speakers__row {
  position: relative;
  z-index: 1;
  width: 100%;
  overflow: hidden;
}

.zb-speakers__track {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: calc(var(--zb-card-gap) * var(--zb-scale));
  width: max-content;
  will-change: transform;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.zb-speakers__row--1 .zb-speakers__track {
  animation-name: zb-speakers-marquee;
  animation-duration: var(--zb-marquee-dur-1);
}

.zb-speakers__row--2 .zb-speakers__track {
  animation-name: zb-speakers-marquee-reverse;
  animation-duration: var(--zb-marquee-dur-2);
  /* ~58% фазы — с противоположным направлением реже совпадает с рядом 1 */
  animation-delay: calc(var(--zb-marquee-dur-2) * -0.58);
}

.zb-speakers__marquee.is-paused .zb-speakers__track,
.zb-speakers__marquee:hover .zb-speakers__track {
  animation-play-state: paused;
}

@media (hover: none) {
  .zb-speakers__marquee:hover .zb-speakers__track {
    animation-play-state: running;
  }

  .zb-speakers__marquee.is-paused .zb-speakers__track {
    animation-play-state: paused;
  }
}

@keyframes zb-speakers-marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes zb-speakers-marquee-reverse {
  from {
    transform: translateX(-50%);
  }
  to {
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .zb-speakers__track {
    animation: none !important;
    transform: none !important;
  }

  .zb-speakers__marquee {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .zb-speakers__marquee::before,
  .zb-speakers__marquee::after {
    display: none;
  }

  .zb-speakers__track {
    padding: 0 16px;
  }
}

.zb-speakers .zb-speakers__card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 auto;
  width: calc(var(--zb-card-w) * var(--zb-scale));
  height: calc(var(--zb-card-h) * var(--zb-scale));
  padding: calc(var(--zb-card-pad) * var(--zb-scale));
  background: var(--zb-card-bg);
  border: 1px solid var(--zb-card-border);
  border-radius: calc(var(--zb-card-radius) * var(--zb-scale));
  text-decoration: none !important;
  color: inherit !important;
  transition: border-color 200ms ease, background-color 200ms ease;
}

.zb-speakers a.zb-speakers__card:hover,
.zb-speakers a.zb-speakers__card:focus-visible {
  border-color: rgba(185, 240, 120, 0.35);
  background: #0b2423;
}

.zb-speakers .zb-speakers__card--empty,
.zb-speakers .zb-speakers__card--static {
  pointer-events: none;
  cursor: default;
}

.zb-speakers__top {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: calc(18px * var(--zb-scale));
  min-height: calc(var(--zb-logo) * var(--zb-scale));
}

.zb-speakers__logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--zb-logo) * var(--zb-scale));
  height: calc(var(--zb-logo) * var(--zb-scale));
  overflow: hidden;
  border-radius: calc(8px * var(--zb-scale));
  background: var(--zb-logo-empty);
}

.zb-speakers__logo--cream {
  background: var(--zb-logo-cream);
}

.zb-speakers__logo--white {
  background: #ffffff;
}

.zb-speakers__logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.zb-speakers .zb-speakers__name {
  flex: 1 1 auto;
  margin: 0 !important;
  padding-top: calc(3px * var(--zb-scale));
  font-family: var(--zb-font-body) !important;
  font-weight: 500 !important;
  font-size: calc(17px * var(--zb-scale)) !important;
  line-height: 1.2 !important;
  letter-spacing: 0.04em !important;
  color: var(--zb-on-dark) !important;
}

.zb-speakers .zb-speakers__meta {
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--zb-scale));
  margin: 0 !important;
}

.zb-speakers .zb-speakers__speaker,
.zb-speakers .zb-speakers__city {
  margin: 0 !important;
  font-family: var(--zb-font-mono) !important;
  font-weight: 400 !important;
  font-size: calc(13px * var(--zb-scale)) !important;
  line-height: 1.25 !important;
  letter-spacing: 0.04em !important;
  color: var(--zb-muted) !important;
}

.zb-speakers .zb-speakers__foot {
  margin: calc(52px * var(--zb-scale)) auto 0 !important;
  max-width: calc(100% - 32px);
  padding: 0 16px;
  font-family: var(--zb-font-body) !important;
  font-weight: 400 !important;
  font-size: calc(18px * var(--zb-scale)) !important;
  line-height: 1.1 !important;
  color: var(--zb-on-dark) !important;
  text-align: center !important;
}

.zb-speakers .zb-speakers__foot-accent {
  color: var(--zb-brand-dark) !important;
}

/* Планшет / мобилка: те же 2 ряда, меньший масштаб */
@media (max-width: 1024px) {
  .zb-speakers {
    --zb-scale: 0.72;
    --zb-fade: 96px;
    --zb-marquee-dur-1: 130s;
    --zb-marquee-dur-2: 210s;
    padding: 36px 0 144px;
  }

  .zb-speakers .zb-speakers__title {
    margin-bottom: 40px !important;
  }
}

@media (max-width: 640px) {
  .zb-speakers {
    --zb-scale: 0.58;
    --zb-fade: 64px;
    --zb-marquee-dur-1: 110s;
    --zb-marquee-dur-2: 190s;
    padding: 28px 0 136px;
  }

  .zb-speakers .zb-speakers__title {
    margin-bottom: 32px !important;
    font-size: 28px !important;
  }

  .zb-speakers .zb-speakers__foot {
    font-size: 14px !important;
    margin-top: 36px !important;
  }
}
