/* ==========================================================================
   Email Signature Generator — tool UI only
   The generated signature itself is deliberately raw table + inline-styled
   HTML (that is the product); only the surrounding tool chrome is themed here.
   Layout follows the Image Placeholder tool: a single-column .tool-grid form
   with the live preview below everything.
   ========================================================================== */

/* Two fields per row; stacks to one column on narrow screens. Each row is its
   own grid so hiding a conditional field never reflows another row's pairing. */
.es-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
  align-items: start;
}

@media (max-width: 600px) {
  .es-row {
    grid-template-columns: 1fr;
  }
}

/* Prefixed input — a static URL base sits before the field so it is obvious the
   user types only their username (e.g. "linkedin.com/in/ ▸ erlenmasson"). */
.es-affix {
  display: flex;
  align-items: stretch;
  border: var(--border-s) solid var(--border-primary);
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--background-primary);
}

.es-affix-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-s);
  background: var(--background-faded);
  color: var(--text-secondary);
  font-size: var(--font-s);
  white-space: nowrap;
  border-right: var(--border-s) solid var(--border-primary);
}

.es-affix input {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.es-affix input:focus {
  outline: none;
  box-shadow: none;
}

.es-affix:focus-within {
  border-color: var(--text-primary);
}

/* Invalid state — subtle danger border (non-blocking; copy still works). */
.tool-grid-field > input[aria-invalid="true"],
.es-affix:has(input[aria-invalid="true"]) {
  border-color: var(--status-danger);
}

/* The rendered signature sits on a neutral surface, square corners. */
.es-preview {
  padding: var(--space-l);
  background-color: var(--background-secondary);
  border: var(--border-s) solid var(--border-primary);
  overflow-x: auto;
}

/* The design system appends an external-link glyph to a[target="_blank"]. That
   styling never reaches a real inbox, so suppress it inside the preview only —
   the copied HTML is unaffected. */
.es-preview a[target="_blank"]::after {
  content: none;
}

/* Raw HTML source view (toggled with the Preview segmented control). Hidden by
   default — JS sets inline display to switch, since a global textarea display
   rule would otherwise override the [hidden] attribute. */
.es-html-view {
  display: none;
  width: 100%;
  min-height: 360px;
  font-family: monospace;
  font-size: var(--font-s);
  white-space: pre;
}

/* Small heading above the preview — a label visually, not a form <label>. */
.es-group-label {
  display: block;
}

/* Screen-reader-only status region for copy success/failure announcements. */
.es-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
