/* Widget: the embeddable converter (/widget/conversor, .wg-*) and the page that
   explains it (/widget). Tokens come from theme.css. */

/* ---------- embeddable panel ---------- */
/* Transparent page: any height the host gives the iframe beyond the panel is invisible. */
body.wg-body { background: transparent; margin: 0; }

.wg-panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px;
  max-width: 400px;
  color: var(--ink);
}

.wg-rate {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.wg-rate-label { color: var(--ink-soft); font-size: 14px; }
.wg-rate-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.wg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.wg-label {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
}
.wg-input {
  width: 100%;
  padding: 10px 11px;
  font-family: var(--font-body);
  font-size: 16px; /* below 16px iOS zooms the host page on focus */
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
}
.wg-input::placeholder { color: var(--ink-dim); }
.wg-input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.wg-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 10px;
  margin-top: 10px;
  font-size: 12px;
}
.wg-fresh { color: var(--ink-dim); }
.wg-foot a { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.wg-foot a:hover { text-decoration: underline; }

/* ---------- instructions page (/widget) ---------- */
html, body { min-height: 100%; }
body:not(.wg-body) { display: flex; flex-direction: column; }

.main-content {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 52px 16px 56px;
}
.page-title {
  font-size: clamp(28px, 4vw, 34px);
  text-align: center;
  margin: 0 0 8px;
}
.page-subtitle {
  text-align: center;
  color: var(--ink-soft);
  margin: 0 0 32px;
  font-size: 16px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto 24px;
}
.panel-title { margin: 0 0 12px; font-size: 20px; }
.panel-card p { color: var(--ink-soft); line-height: 1.6; margin: 0 0 12px; }

.preview-frame {
  display: block;
  width: 360px;
  max-width: 100%;
  height: 270px;
  border: 0;
  margin: 0 auto;
}

.snippet {
  margin: 0 0 12px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.copy-status { font-size: 13.5px; color: var(--ink-soft); }
.copy-status.is-error { color: var(--neg); }

/* FAQ (same rules as the converter) */
.faq { max-width: 680px; margin: 40px auto 0; }
.faq-title { font-size: 20px; text-align: center; margin: 0 0 14px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 2px; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.faq p { margin: 10px 0 2px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; }

/* Tool widgets are taller; the preview scrolls inside instead of stretching the page. */
.preview-frame.is-tool { width: 480px; height: 560px; }
.preview-frame { margin-bottom: 14px; }
.widget-index { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin: 0 auto 26px; max-width: 680px; }
.widget-index a { color: var(--accent-2); font-size: 14.5px; }
