/* Интерактивные блоки статей блога — пара к /seo/blog-widgets.js.
   Токены — из /seo/page.css. Без JS блок выглядит как аккуратная врезка
   с обычным текстом; классы .bw-on и кнопки появляются только со скриптом. */

.bw {
  margin: 28px 0;
  padding: clamp(16px, 4vw, 24px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--sh);
  container-type: inline-size;
}
.bw > :last-child {
  margin-bottom: 0;
}
.bw-title {
  margin: 0 0 6px;
  font-family: var(--f-display);
  font-size: clamp(15px, 3.8vw, 18px);
  font-weight: 700;
  line-height: 1.3;
}
.bw-title::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  border-radius: 3px;
  background: var(--accent);
  transform: rotate(45deg) translateY(-2px);
}
.bw-lead {
  margin: 0 0 14px;
  color: var(--text-mut);
  font-size: 15px;
}
.bw [hidden] {
  display: none !important;
}

/* общие кнопки */
.bw-btn,
.bw-opt,
.bw-check,
.bw-tab,
.bw-link,
.bw-play {
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.bw-btn {
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  padding: 11px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.15s ease;
}
.bw-btn:hover {
  background: var(--primary-h);
}
.bw-btn:active {
  transform: scale(0.97);
}
.bw-link {
  display: inline-block;
  margin: 12px 0 0 14px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 14px;
  text-decoration: underline;
}
.bw button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* --- quiz --- */
.bw-q {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.bw-q:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.bw-ask {
  margin: 0 0 10px;
  font-weight: 600;
}
.bw-opts {
  display: grid;
  gap: 8px;
}
.bw-opt {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  text-align: left;
  line-height: 1.45;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.bw-opt:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.bw-opt:disabled {
  cursor: default;
  opacity: 0.7;
}
.bw-opt.is-ok {
  border-color: var(--success);
  background: #e9f6ee;
  opacity: 1;
}
.bw-opt.is-bad {
  border-color: #d9534f;
  background: #fbecec;
  opacity: 1;
}
.bw-why {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--muted);
  font-size: 15px;
  animation: bw-in 0.35s ease-out;
}
.bw-score {
  margin: 16px 0 0;
  font-weight: 600;
  color: var(--primary);
}
.bw-score:empty {
  display: none;
}
.bw:not(.bw-on) li[data-ok] {
  font-weight: 600;
}

/* --- check --- */
.bw-checks {
  display: grid;
  gap: 8px;
}
.bw-check {
  position: relative;
  padding: 11px 14px 11px 46px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  text-align: left;
  line-height: 1.45;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.bw-check::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 12px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.bw-check[aria-pressed='true'] {
  border-color: var(--primary);
  background: #f1edfe;
}
.bw-check[aria-pressed='true']::before {
  border-color: var(--primary);
  background: var(--primary) center / 14px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.bw-count {
  margin: 14px 0 8px;
  font-weight: 600;
  color: var(--text-mut);
  font-size: 15px;
}
.bw-res {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: #fff8e8;
  font-size: 15px;
}
.bw-on .bw-res {
  animation: bw-in 0.35s ease-out;
}

/* --- voices --- */
.bw[data-bw='voices'] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
/* 10 голосов ложатся ровно 5+5; 2 колонки на телефоне дают 5 одинаковых рядов.
   Медиа-запрос, а не контейнерный: .bw сам себе контейнер и себя не опрашивает. */
@media (min-width: 720px) {
  .bw[data-bw='voices'] {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
.bw[data-bw='voices'] > .bw-title,
.bw[data-bw='voices'] > .bw-lead,
.bw[data-bw='voices'] > p {
  grid-column: 1 / -1;
}
.bw-voice {
  position: relative;
  margin: 0;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  text-align: center;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.bw .bw-voice img {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  border-radius: 50%;
  object-fit: cover;
}
.bw-voice figcaption {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-mut);
}
.bw-voice figcaption b {
  display: block;
  color: var(--ink);
  font-size: 15px;
}
.bw-voice audio {
  width: 100%;
  margin-top: 8px;
}
/* со скриптом вся карточка — кнопка «послушать» */
.bw-play {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 0;
  border-radius: 14px;
  background: none;
}
.bw-play-ico {
  position: absolute;
  top: 58px;
  left: calc(50% + 20px);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary) center / 12px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 1.5v9l7.5-4.5z' fill='%23fff'/%3E%3C/svg%3E");
  box-shadow: 0 4px 10px rgba(108, 77, 242, 0.35);
}
.bw-voice:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.bw-voice.is-playing {
  border-color: var(--primary);
  background: #f1edfe;
}
.bw-voice.is-playing .bw-play-ico {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 2h2v8H3zM7 2h2v8H7z' fill='%23fff'/%3E%3C/svg%3E");
}
.bw-voice.is-playing img {
  animation: bw-pulse 1.4s ease-in-out infinite;
}

/* --- breath --- */
.bw-breath {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 10px 0 4px;
}
.bw-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff4d6, var(--accent) 45%, #c9b8ff 100%);
  box-shadow: 0 0 0 10px rgba(108, 77, 242, 0.08), 0 10px 30px rgba(108, 77, 242, 0.2);
  transform: scale(0.55);
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
}
.bw-circle.is-in,
.bw-circle.is-hold {
  transform: scale(1);
}
.bw-circle.is-out {
  transform: scale(0.55);
}
.bw-phase {
  margin: 0;
  min-height: 1.6em;
  font-weight: 600;
  text-align: center;
}
.bw[data-bw='breath'] .bw-btn {
  display: flex;
  margin: 12px auto 0;
}

/* --- words --- */
.bw-calc {
  display: grid;
  gap: 12px;
}
.bw-range-label {
  font-weight: 600;
}
.bw-range-val {
  display: inline-block;
  min-width: 1.4em;
  color: var(--primary);
  font-family: var(--f-display);
}
.bw-range {
  width: 100%;
  accent-color: var(--primary);
}
.bw-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 10px;
}
.bw-stat {
  padding: 14px;
  border-radius: 14px;
  background: var(--muted);
}
.bw-stat b {
  display: block;
  font-family: var(--f-display);
  font-size: clamp(20px, 6cqi, 28px);
  color: var(--primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.bw-stat span {
  font-size: 14px;
  color: var(--text-mut);
}

/* --- pick --- */
.bw-card {
  margin: 4px 0 0;
  min-height: 3.4em;
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff8e8, #f1edfe);
  font-family: var(--f-read);
  font-size: 18px;
  line-height: 1.5;
}
.bw-card.is-new {
  animation: bw-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- scale --- */
.bw-range-scale {
  margin: 4px 0 12px;
}
.bw-level {
  --lvl: 0;
  padding: 14px 16px;
  border-radius: 14px;
  border-left: 6px solid hsl(calc(140 - 140 * var(--lvl)) 60% 50%);
  background: var(--muted);
  font-size: 15px;
  transition: border-color 0.3s ease;
}
.bw-level li {
  list-style: none;
}
.bw-level b {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
}

/* --- tabs --- */
.bw-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 14px;
}
.bw-tab {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-mut);
  font-weight: 600;
  font-size: 14px;
}
.bw-tab[aria-selected='true'] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.bw section[data-tab] {
  margin-top: 12px;
}
.bw:not(.bw-tabbed) section[data-tab]::before {
  content: attr(data-tab);
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  color: var(--primary);
}
.bw-tabbed section[data-tab] {
  margin-top: 0;
  animation: bw-in 0.3s ease-out;
}
.bw section[data-tab] > :last-child {
  margin-bottom: 0;
}

/* --- миф / факт: нативные <details>, работают и без скрипта --- */
.bw-myth {
  margin: 10px 0;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.bw-myth summary {
  position: relative;
  padding: 13px 44px 13px 16px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
.bw-myth summary::-webkit-details-marker {
  display: none;
}
.bw-myth summary::after {
  content: 'правда?';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--text-mut);
  font-size: 12px;
  font-weight: 500;
}
.bw-myth[open] summary::after {
  content: 'разбор';
  background: var(--accent);
  color: var(--ink);
}
.bw-myth > :not(summary) {
  margin: 0;
  padding: 0 16px 14px;
}
.bw-myth[open] > :not(summary) {
  animation: bw-in 0.3s ease-out;
}

@keyframes bw-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes bw-pop {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes bw-pulse {
  50% {
    transform: scale(1.06);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bw *,
  .bw *::before,
  .bw *::after,
  .bw-myth > * {
    animation: none !important;
    transition-duration: 0s !important;
  }
}

@container (max-width: 360px) {
  .bw-myth summary {
    padding-right: 16px;
  }
  .bw-myth summary::after {
    position: static;
    display: inline-block;
    margin-left: 8px;
    transform: none;
  }
}
