.stt-demo {
  /* Matches the article container so the demo lines up with the prose above it. */
  width: min(920px, calc(100% - 40px));
  margin: 32px auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card-lg);
  background:
    linear-gradient(150deg, rgba(255, 253, 254, 0.96), rgba(255, 240, 248, 0.92)),
    var(--color-bg-card);
  box-shadow: var(--shadow-card);
  padding: 26px;
}

.stt-demo h3 {
  margin: 0;
  color: var(--color-text);
  font-size: 22px;
  line-height: 1.2;
}

.stt-demo__lead {
  margin: 10px 0 0;
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.stt-demo__panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

/* A lone panel should not stretch across the whole card. */
.stt-demo--single .stt-demo__panels {
  grid-template-columns: minmax(240px, 460px);
}

.stt-demo__panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.78);
  padding: 16px;
}

.stt-demo__panel-label {
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stt-demo__record {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-brand);
  color: #fff;
  padding: 12px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease;
}

.stt-demo__record:hover:not(:disabled) {
  background: var(--color-brand-hover);
}

.stt-demo__record:disabled {
  opacity: 0.6;
  cursor: default;
}

.stt-demo__record-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
}

.stt-demo__record--active {
  background: var(--color-danger, #c0392b);
}

.stt-demo__record--active .stt-demo__record-dot {
  animation: stt-demo-pulse 1.1s ease-in-out infinite;
}

@keyframes stt-demo-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .stt-demo__record--active .stt-demo__record-dot { animation: none; }
}

.stt-demo__timer,
.stt-demo__hint {
  color: var(--color-text-hint);
  font-size: 13px;
}

.stt-demo__file {
  display: inline-flex;
  align-items: center;
  border: 1px dashed var(--color-brand);
  border-radius: var(--radius-element);
  background: rgba(224, 187, 255, 0.16);
  color: var(--color-brand);
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
}

.stt-demo__file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.stt-demo__file:focus-within {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.stt-demo__status {
  margin: 16px 0 0;
  min-height: 22px;
  color: var(--color-text-muted);
  font-size: 14px;
}

.stt-demo__status[data-tone="error"] { color: var(--color-error, #b3261e); }
.stt-demo__status[data-tone="ok"] { color: var(--color-success, #2c7a63); }

.stt-demo__result.hidden { display: none; }

.stt-demo__result-label {
  display: block;
  margin-bottom: 8px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.stt-demo__text {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-element);
  background: #fff;
  color: var(--color-text);
  padding: 14px;
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.stt-demo__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.stt-demo__copy {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--color-text);
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.stt-demo__copy:hover { border-color: var(--color-brand); color: var(--color-brand); }

.stt-demo__cta {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-brand);
  color: #fff;
  padding: 11px 20px;
  font-weight: 700;
  text-decoration: none;
}

.stt-demo__cta:hover { background: var(--color-brand-hover); color: #fff; }

.stt-demo--busy { opacity: 0.92; }

@media (min-width: 960px) {
  .stt-demo { width: min(920px, calc(100% - 48px)); }
}

/* Inside a landing section the surrounding section already sets the width. */
.landing-section > .stt-demo {
  width: 100%;
  margin: 24px 0 0;
}

@media (max-width: 640px) {
  .stt-demo { padding: 20px; }
  .stt-demo h3 { font-size: 20px; }
}
