/* Live/editable preview panels for the "Reactions on your blog" guide.
   Page-scoped: only blog-reactions.html links this. Everything is namespaced under
   .tb-preview and drives off the docs design tokens (style.scss :root), so the panels
   track light/dark with no JS. The real embed renders inside an <iframe srcdoc> so each
   float bar's body-level dock stays contained to its own frame. */

.tb-preview {
  margin: 22px 0;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  overflow: clip;
}

.tb-preview__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1.5px solid var(--border);
}
.tb-preview__label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.tb-preview__hint { font-size: 13px; color: var(--muted); }

.tb-preview__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  padding: 14px 16px;
}
.tb-field { display: flex; flex-direction: column; gap: 4px; }
.tb-field > span {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.tb-preview select,
.tb-preview input,
.tb-preview textarea {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
.tb-preview select { min-width: 8.5rem; }
.tb-preview textarea {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
  min-height: 5.2rem;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}
.tb-preview select:focus,
.tb-preview input:focus,
.tb-preview textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 22%, transparent);
}

.tb-btn {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tb-btn:hover { color: var(--accent); border-color: var(--accent); }
.tb-btn.tb-btn--go { color: var(--text); }
.tb-btn.ok { color: var(--accent); border-color: var(--accent); }

/* Editable playground body */
.tb-editor { padding: 0 16px 14px; }
.tb-editor__row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.tb-editor__row .tb-preview__hint { margin-left: auto; }

/* Read-only generated snippet (a div, never a <pre> — so the global copy-button
   script in base.html leaves it alone; this panel carries its own copy button). */
.tb-snippet { position: relative; padding: 0 16px 12px; }
.tb-code {
  display: block;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}
.tb-code .tb-attr { color: var(--accent); }
/* Match the site's <pre> copy button: reveal on hover/focus so it doesn't sit over the code. */
.tb-snippet .tb-copy {
  position: absolute;
  top: 8px;
  right: 24px;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tb-snippet:hover .tb-copy,
.tb-snippet .tb-copy:focus { opacity: 1; }

/* The stage that holds the real embed, in its own frame */
.tb-stage { padding: 0 16px 16px; }
.tb-stage iframe {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  display: block;
}
.tb-stage__cap {
  margin: 8px 2px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.tb-preview__fallback { padding: 16px; margin: 0; color: var(--muted); font-size: 14px; }
