/* run.workbooks.sh — minimal monochrome chrome around an iframe.
 * Same palette as the lander; if a user lands here from workbooks.sh
 * the UI shouldn't feel like a different app. */
:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --fg-muted: #555;
  --line: #ececec;
  --code-bg: #f5f5f5;
  --accent: #0a0a0a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --fg: #f5f5f5;
    --fg-muted: #9a9a9a;
    --line: #1c1c1c;
    --code-bg: #141414;
    --accent: #f5f5f5;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
main.empty .chrome { display: none; }
main.hover .welcome { outline: 2px dashed var(--fg); outline-offset: -1.5rem; }

/* Welcome / drop zone — fills the viewport when no workbook is loaded. */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
}
main:not(.empty) .welcome { display: none; }
.welcome .logo { width: 56px; height: 56px; margin-bottom: 2rem; }
.welcome .logo svg { width: 100%; height: 100%; display: block; }
.welcome h1 {
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.welcome .lede {
  color: var(--fg-muted);
  margin: 0 0 1.25rem;
  max-width: 36em;
  font-size: 1rem;
}
.welcome .cta {
  color: var(--fg-muted);
  margin: 0;
  font-size: 0.85rem;
}
.welcome .cta a { color: var(--fg); }
.welcome code, .welcome kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
.welcome kbd {
  background: var(--code-bg);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
}

/* Chrome strip across the top once a workbook is loaded. */
.chrome {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-size: 0.85rem;
}
.chrome .title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
}
.chrome .filename {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chrome .state {
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.chrome .state[data-variant="ok"]    { color: #10b981; }
.chrome .state[data-variant="error"] { color: #f43f5e; }

.chrome .actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}
.btn:hover { background: var(--code-bg); }
.btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn.primary:hover { opacity: 0.85; background: var(--accent); }
.btn.ghost {
  border-color: transparent;
  color: var(--fg-muted);
}
.btn.ghost:hover { color: var(--fg); }

/* The iframe itself — fills the rest of the viewport. */
#frame {
  flex: 1;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}
main.empty #frame { display: none; }

footer {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  display: flex;
  gap: 1rem;
}
main:not(.empty) ~ footer { display: none; }
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: var(--fg); }
