/* IBM Plex Sans (variable) and IBM Plex Mono. SIL OFL: site/fonts/OFL.txt and OFL-Mono.txt. */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("./fonts/ibm-plex-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("./fonts/ibm-plex-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/ibm-plex-mono-latin-ext-400.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/ibm-plex-mono-latin-ext-500.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #141311;
  --raise: #1f1c19;
  --inset: #100f0d;
  --line: #453f38;
  --text: #f6f1ea;
  --muted: #d5cdc2;
  --faint: #bfb6ab;
  --coral: #ff6b57;
  --coral-hover: #ff7d6c;
  --coral-press: #f05541;
  --ink: #2a1210;
  --mint: #b6efd0;
  --mint-bg: #1a3329;
  --amber: #f2d48a;
  --amber-bg: #2c2618;
  --sans: "IBM Plex Sans", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  font-size: 100%;
}

html, body { margin: 0; }

body {
  min-height: 100vh;
  font: 400 1rem/1.55 var(--sans);
  letter-spacing: 0.005em;
  color: var(--text);
  background: var(--bg);
}

::selection {
  background: var(--coral);
  color: var(--ink);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 5;
  background: var(--coral);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 650;
  text-decoration: none;
}

.skip:focus { top: 12px; }

a { color: inherit; }

h1, h2, p { margin: 0; }

h1 {
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}

h2 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: balance;
}

.top, main, footer {
  position: relative;
  width: min(1040px, calc(100% - 48px));
  margin-inline: auto;
}

.top { padding: 18px 0 4px; }

.brandrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand svg { display: block; flex: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted);
  font-size: 0.8125rem;
  letter-spacing: 0;
  background: var(--inset);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  flex: none;
}

.lede {
  margin-top: 10px;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.0625rem;
  line-height: 1.5;
}

main {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  align-items: stretch;
  padding-top: 12px;
}

.editor, .report {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-width: 0;
}

.editor {
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

.editor.drag { border-color: var(--coral); }

.editor.busy textarea { opacity: 0.55; }

.panel-head { display: grid; gap: 6px; }

.panel-head p, .meta, .note, .catalog, #stephelp {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.45;
  letter-spacing: 0;
}

kbd {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--inset);
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 200px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--inset);
  color: var(--text);
  padding: 14px 14px;
  font: 400 0.875rem/1.55 var(--mono);
  letter-spacing: 0;
  white-space: pre;
  overflow: auto;
  caret-color: var(--coral);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

textarea::placeholder { color: var(--faint); opacity: 1; }

textarea[aria-invalid="true"] { border-color: var(--amber); }

textarea:focus-visible { border-color: var(--coral); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

button, .filebtn {
  font: 600 0.9375rem/1 var(--sans);
  letter-spacing: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}

button.primary {
  background: var(--coral);
  border-color: transparent;
  color: var(--ink);
}

button.primary:hover { background: var(--coral-hover); }

button.primary:active { background: var(--coral-press); }

button.ghost:hover, .filebtn:hover { background: rgba(246, 241, 234, 0.06); }

button.tiny { padding: 8px 12px; min-height: 40px; font-size: 0.8125rem; }

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.filebtn { position: relative; display: inline-flex; align-items: center; }

.filebtn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

#status {
  min-height: 1.45em;
  color: var(--amber);
  font-size: 0.9375rem;
}

#status.ok { color: var(--mint); }

.report {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-margin-top: 16px;
}

#empty h2 { font-size: 1.375rem; }

#empty p { margin-top: 8px; color: var(--muted); }

#empty ul {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

#empty li {
  position: relative;
  padding: 12px 0 12px 28px;
  border-bottom: 1px solid var(--line);
}

#empty li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 18px;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--mint);
  border-bottom: 2px solid var(--mint);
  transform: rotate(-45deg);
}

#empty em { font-style: normal; color: var(--mint); font-weight: 600; }

#empty-error h2 {
  color: var(--amber);
  font-size: 1.375rem;
}

#out {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
}

#out.just-ready { animation: settle 200ms var(--ease); }

@keyframes settle {
  from { filter: blur(3px); transform: translateY(6px); }
  to { filter: none; transform: none; }
}

#out > .actions { margin-top: auto; }

#out[hidden],
#empty[hidden],
#empty-idle[hidden],
#empty-error[hidden] { display: none; }

.name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

#wf-name {
  font-size: 1.375rem;
  overflow-wrap: anywhere;
}

.badge {
  flex: none;
  margin-top: 3px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--inset);
  color: var(--faint);
}

.badge.on { background: var(--mint-bg); color: var(--mint); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.stats div { padding: 10px 12px 12px; }

.stats div + div { border-left: 1px solid var(--line); }

.stats dt {
  color: var(--faint);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stats dd {
  margin: 2px 0 0;
  font-size: 1.375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stats div:has(dd.hot) { background: var(--amber-bg); }

.stats dd.hot { color: var(--amber); }

.filebar {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 6px 6px 12px;
  min-width: 0;
}

.filebar code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0;
}

.note.warn { color: var(--amber); }

.note.calm { color: var(--mint); }

.nodes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  /* ponytail: the list scrolls past ~440px. Upgrade: virtualize if a workflow has hundreds of nodes. */
  max-height: 440px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  border-top: 1px solid var(--line);
}

.nodes li {
  position: relative;
  padding: 4px 0 4px 18px;
  border-bottom: 1px solid var(--line);
  line-height: 1.35;
}

.nodes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid var(--faint);
}

.nodes li.trigger::before { background: var(--coral); border-color: var(--coral); }

.nodes li.disabled .node-name,
.nodes li.disabled .node-type { color: var(--faint); }

.node-top, .goes, .credline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
}

.node-top { justify-content: space-between; }

.node-name { font-weight: 600; }

.node-type, .goes, .credline {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0;
}

.goes-mark {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}

.goes-mark svg { display: block; }

.credline b { color: var(--muted); font-weight: 600; font-family: var(--sans); }

footer {
  margin-top: 8px;
  padding: 16px 0 32px;
  border-top: 1px solid var(--line);
}

.foot-head {
  display: flex;
  justify-content: space-between;
  gap: 12px 24px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

#stephelp { max-width: 46ch; }

.steps { display: flex; flex-wrap: wrap; gap: 8px; }

.step { display: inline-flex; align-items: center; gap: 8px; }

.step[aria-pressed="true"] {
  background: var(--mint-bg);
  color: var(--mint);
  border-color: transparent;
}

.step[aria-pressed="true"]::before {
  content: "";
  width: 0.5em;
  height: 0.28em;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translateY(-1px);
}

.catalog { margin-top: 16px; max-width: 72ch; }

.catalog span { color: var(--text); font-family: var(--mono); font-size: 0.875em; letter-spacing: 0; }

@media (max-width: 860px) {
  .top, main, footer { width: min(1040px, calc(100% - 32px)); }
  main { grid-template-columns: 1fr; padding-top: 20px; }
  textarea { min-height: 200px; }
  .foot-head { display: grid; gap: 6px; }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats div:nth-child(odd) { border-left: 0; }
  .stats div:nth-child(2) { border-left: 1px solid var(--line); }
  .stats div:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

@media (max-width: 420px) {
  .top, main, footer { width: min(1040px, calc(100% - 24px)); }
  .top { padding-top: 16px; }
  .lede { font-size: 1rem; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  #run, #download { grid-column: 1 / -1; }
  .actions button, .filebtn { justify-content: center; width: 100%; }
  textarea { min-height: 160px; }
}

@media (pointer: coarse) {
  button.tiny { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (forced-colors: active) {
  button.primary { border: 1px solid ButtonText; }
  .live-dot, .nodes li::before { forced-color-adjust: none; }
}
