/* Styles for the <nessemble-assembler> Web Component. Scoped to `.na-*` classes
   to avoid clashing with host page CSS (mdBook docs, the marketing site).

   Sizing is `em`-based (never `rem`) so the component scales with the host
   page's body text. mdBook sets the root font-size to 62.5% (1rem = 10px), so
   `rem` units would render the editor/output far smaller than the surrounding
   prose; `em` inherits the 16px body size instead. The monospace editor and
   byte output are sized at 0.875em to match a documentation code block (mdBook's
   `code` is 0.875em), so the assembled bytes line up with an adjacent snippet. */

.na-host {
  display: block;
  margin: 1em 0;
  border: 1px solid rgba(127, 127, 127, 0.35);
  border-radius: 6px;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.na-editor {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0.75em;
  border: 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.35);
  resize: vertical;
  font-family: "Source Code Pro", "SFMono-Regular", ui-monospace, Menlo, Consolas,
    monospace;
  font-size: 0.875em;
  line-height: 1.45;
  tab-size: 4;
  color: inherit;
  background: rgba(127, 127, 127, 0.04);
}

.na-editor:focus {
  outline: 2px solid #4a90d9;
  outline-offset: -2px;
}

.na-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  align-items: center;
  padding: 0.5em 0.75em;
  background: rgba(127, 127, 127, 0.08);
}

.na-btn {
  appearance: none;
  cursor: pointer;
  padding: 0.3em 0.75em;
  border: 1px solid rgba(127, 127, 127, 0.45);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 0.85em;
  line-height: 1.2;
  text-decoration: none;
}

.na-btn:hover {
  background: rgba(127, 127, 127, 0.15);
}

.na-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.na-primary {
  border-color: #3572a5;
  background: #3572a5;
  color: #fff;
}

.na-primary:hover {
  background: #2c608c;
}

.na-download {
  margin-left: auto;
}

.na-output {
  margin: 0;
  padding: 0.75em;
  overflow-x: auto;
  font-family: "Source Code Pro", "SFMono-Regular", ui-monospace, Menlo, Consolas,
    monospace;
  font-size: 0.875em;
  line-height: 1.45;
  white-space: pre;
  color: inherit;
}

.na-output.na-error {
  color: #b00020;
  background: rgba(176, 0, 32, 0.06);
}

@media (prefers-color-scheme: dark) {
  .na-output.na-error {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
  }
}
