/* Озвучивание статьи (js/blog-tts.js, разметка в post.php). Обе темы. */

.post-tts {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 0;
}
.post-tts[hidden] { display: none; }

.post-tts__play,
.post-tts__stop {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 18px 0 6px;
  border: 1px solid var(--tt-stroke, #CCD3DF);
  border-radius: 22px;
  background: transparent;
  color: var(--tt-h2, #30333B);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.post-tts__play:hover,
.post-tts__stop:hover { border-color: var(--tt-h4, #9CA2AD); }
.post-tts__play:focus-visible,
.post-tts__stop:focus-visible { outline: 2px solid var(--tt-blue, #1665C4); outline-offset: 2px; }

.post-tts__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tt-accent, #F60C2B);
  color: #fff;
}
.post-tts__icon svg { display: block; }
.post-tts .post-tts__i-pause,
.post-tts.is-playing .post-tts__i-play { display: none; }
.post-tts.is-playing .post-tts__i-pause { display: block; }

.post-tts__stop {
  width: 44px;
  padding: 0;
  justify-content: center;
}
.post-tts__stop[hidden] { display: none; }

/* Волна рядом с кнопкой, пока идёт чтение */
.post-tts__wave {
  display: none;
  align-items: center;
  gap: 3px;
  height: 18px;
  margin-left: 4px;
}
.post-tts.is-playing .post-tts__wave { display: inline-flex; }
.post-tts__wave i {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: var(--tt-accent, #F60C2B);
  animation: post-tts-wave 1s ease-in-out infinite;
}
.post-tts__wave i:nth-child(2) { animation-delay: -.8s; }
.post-tts__wave i:nth-child(3) { animation-delay: -.6s; }
.post-tts__wave i:nth-child(4) { animation-delay: -.4s; }
@keyframes post-tts-wave {
  0%, 100% { transform: scaleY(.3); }
  50%      { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .post-tts__wave i { animation: none; transform: scaleY(.6); }
}

/* Абзац, который сейчас читается */
.post-tts-reading {
  background: rgba(246, 12, 43, .07);
  box-shadow: 0 0 0 6px rgba(246, 12, 43, .07);
  border-radius: 4px;
  transition: background-color .2s;
}

/* Тёмная тема */
html[data-theme="dark"] .post-tts__play,
html[data-theme="dark"] .post-tts__stop {
  border-color: var(--dk-border, rgba(255,255,255,.12));
  color: var(--dk-text, #E6E9EF);
}
html[data-theme="dark"] .post-tts__play:hover,
html[data-theme="dark"] .post-tts__stop:hover { background: var(--dk-surface-2, #212836); }
html[data-theme="dark"] .post-tts-reading {
  background: rgba(255, 77, 125, .12);
  box-shadow: 0 0 0 6px rgba(255, 77, 125, .12);
}
