/* embed.css — Compact styles for the Catnip embeddable widget */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --cream: #FDF6EC;
  --ink: #2A2118;
  --warm: #E8A04C;
  --warm-dark: #D4912F;
  --sketch: #5C4A3A;
  --soft: #8B7160;
  --editor-bg: #1E1A15;
  --editor-fg: #E8DDD0;
  --cat-halo: #FAF7F0;
  --cat-halo-dark: #1A1610;
}

html, body {
  height: 100%;
  min-height: 300px;
  overflow: hidden;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background: var(--cream);
  color: var(--ink);
}

/* ── Layout ────────────────────────────────────────────────────────── */

.embed-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 300px;
}

/* ── Toolbar ────────────────────────────────────────────────────────── */

.embed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  height: 40px;
  background: white;
  border-bottom: 1.5px solid var(--soft);
  flex-shrink: 0;
  gap: 8px;
}

.embed-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.embed-lang-select {
  padding: 3px 22px 3px 7px;
  border: 1.5px solid var(--sketch);
  border-radius: 5px;
  background: var(--cream);
  font-family: 'Caveat', 'Space Grotesk', cursive;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sketch);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235C4A3A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
}

.embed-lang-select:focus {
  outline: 2px solid var(--warm);
  outline-offset: 1px;
}

.btn-run {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  background: var(--warm);
  color: white;
  border: none;
  border-radius: 7px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn-run:hover  { background: var(--warm-dark); transform: translateY(-1px); }
.btn-run:active { transform: translateY(0); }
.btn-run:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Editor / Output split ─────────────────────────────────────────── */

.embed-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.embed-editor-pane {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  border-right: 1.5px solid var(--soft);
}

#embed-editor {
  width: 100%;
  height: 100%;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Menlo', monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 10px 12px;
  background: var(--editor-bg);
  color: var(--editor-fg);
  border: none;
  resize: none;
  outline: none;
  overflow: auto;
  tab-size: 2;
  white-space: pre;
}

.embed-output-pane {
  width: 38%;
  min-width: 120px;
  max-width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: var(--cream);
}

.embed-output-label {
  padding: 4px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--soft);
  border-bottom: 1px solid rgba(92, 74, 58, 0.15);
  flex-shrink: 0;
  background: white;
}

#embed-output {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
  font-size: 11.5px;
  line-height: 1.55;
  background: var(--cream);
}

.embed-output-line {
  margin: 0;
  padding: 1px 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.embed-output-line.warn  { color: #c88a00; }
.embed-output-line.error { color: #c03030; }
.embed-output-line.info  { color: var(--soft); }
.embed-output-line.done-ok  { color: #4a9c4a; font-style: italic; font-size: 0.9em; }
.embed-output-line.done-err { color: #c03030; font-style: italic; font-size: 0.9em; }
.embed-output-line.timeout  { color: #c88a00; font-style: italic; font-size: 0.9em; }

/* ── Cat overlay (sits over editor pane) ───────────────────────────── */

#embed-cat-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
  color: var(--ink);
}

.embed-cat {
  position: absolute;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ── Footer ─────────────────────────────────────────────────────────── */

.embed-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 3px 10px;
  height: 24px;
  background: white;
  border-top: 1px solid rgba(92, 74, 58, 0.15);
  flex-shrink: 0;
}

.embed-footer a {
  font-size: 0.68rem;
  color: var(--soft);
  text-decoration: none;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.embed-footer a:hover { color: var(--warm); }

/* ── Dark theme ─────────────────────────────────────────────────────── */

[data-theme="dark"] {
  --cream: #1A1610;
  --ink: #E8DDD0;
  --soft: #8B7160;
  --sketch: #c9b8a8;
  --cat-halo: #1A1610;
}

[data-theme="dark"] .embed-toolbar,
[data-theme="dark"] .embed-output-label,
[data-theme="dark"] .embed-footer {
  background: #14110d;
}

[data-theme="dark"] .embed-output-pane,
[data-theme="dark"] #embed-output {
  background: #1A1610;
}

[data-theme="dark"] .embed-toolbar { border-bottom-color: #3a2e24; }
[data-theme="dark"] .embed-editor-pane { border-right-color: #3a2e24; }
[data-theme="dark"] .embed-output-label { border-bottom-color: #3a2e24; }
[data-theme="dark"] .embed-footer { border-top-color: #3a2e24; }

[data-theme="dark"] .embed-lang-select {
  background-color: #2e2318;
  color: #c9b8a8;
  border-color: #5c4a3a;
}

[data-theme="dark"] #embed-cat-overlay { color: #f0e6d2; }
[data-theme="dark"] #embed-cat-overlay { --cat-halo: #1A1610; }

/* ── Responsive (fills whatever iframe size the host gives) ─────────── */

@media (max-width: 420px) {
  .embed-output-pane {
    width: 34%;
    min-width: 90px;
  }
  #embed-editor { font-size: 12px; padding: 8px; }
}
