/**
 * XWK Speech Mode — structural styles + text highlight.
 * All colors resolved from site CSS custom properties.
 *
 * @package XWK_Access_Suite
 */

/* ── Voice picker ────────────────────────────────────────────────────────── */
.xwk-speech__voice-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.xwk-speech__voice-label {
  font-size: 0.875em;
  color: var(--text-secondary, inherit);
  white-space: nowrap;
}

.xwk-speech__voice-select {
  min-height: 2.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-default, currentColor);
  border-radius: var(--radius-sm, 4px);
  background: var(--bg-secondary, transparent);
  color: var(--text-primary, inherit);
  font-family: inherit;
  font-size: 0.875em;
  cursor: pointer;
  max-width: 220px;
}

.xwk-speech__voice-select:focus-visible {
  outline: 2px solid var(--focus-ring, Highlight);
  outline-offset: 2px;
}

/* ── Widget layout ───────────────────────────────────────────────────────── */
.xwk-speech {
  display: inline-flex;
  flex-direction: column;
  gap: 0.5rem;
  font-family: inherit;
  font-size: inherit;
}

.xwk-speech__toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Transport controls ──────────────────────────────────────────────────── */
.xwk-speech__transport {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.xwk-speech__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  min-height: 2.25rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-default, currentColor);
  border-radius: var(--radius-sm, 4px);
  background: var(--bg-secondary, transparent);
  color: var(--text-primary, inherit);
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  font-size: 0.9em;
  transition: background 0.1s, opacity 0.1s;
}

.xwk-speech__btn:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.06));
}

.xwk-speech__btn:focus-visible {
  outline: 2px solid var(--focus-ring, Highlight);
  outline-offset: 2px;
}

.xwk-speech__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Play/Pause: visually slightly larger to emphasise it. */
.xwk-speech__btn--play-pause {
  min-width: 2.75rem;
  font-size: 1em;
}

/* ── Highlighted text ────────────────────────────────────────────────────── */
.xwk-speech-highlight {
  background-color: var(--highlight-bg, #ffe082) !important;
  color: var(--highlight-text, #000) !important;
  border-radius: 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

[data-theme="dark"] .xwk-speech-highlight {
  background-color: var(--highlight-bg-dark, #7b5e00) !important;
  color: var(--highlight-text-dark, #fff) !important;
}

/* ── Fallback message ────────────────────────────────────────────────────── */
.xwk-speech__fallback {
  font-size: 0.875em;
  color: var(--fg-warning, #c00);
  margin: 0;
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .xwk-speech__btn {
    transition: none;
  }
}
