/* Workbench chrome. Self-contained on purpose.
   The sidebar, inspector and notices deliberately do NOT read the active
   variable set: a theme that renders the review surface unreadably must still
   leave the workbench navigable, and a screenshot of the host pane should
   contain the product's pixels and nothing of the harness's. */

:root {
  --wb-bg: #14161a;
  --wb-panel: #1b1e24;
  --wb-line: #2a2f38;
  --wb-text: #d7dae0;
  --wb-muted: #8b93a1;
  --wb-accent: #8a9a63;
  --wb-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --wb-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wb-bg);
  color: var(--wb-text);
  font-family: var(--wb-ui);
  font-size: 14px;
}

/* ol-mioe: there used to be a `:where(*)` reset here, neutralising the bare
   element rules a vendored theme aims at the whole document. It is gone because
   the thing it defended against is gone: the theme stylesheet is now loaded
   into the host pane's own document (src/host-frame.ts), which this document is
   not. A reset could always be beaten by a more specific theme rule — Things'
   `body:not(.default-font-color) strong` is (0,2,1) — and the document boundary
   cannot be. */

/* ol-wzar: this is `height`, not `min-height`, and the difference is the whole
   bug. `min-height: 100vh` is a floor: once the sidebar's own content grew past
   the viewport, the grid row grew with it, the main column stretched to match,
   and the host pane inherited a ~1900px box with the product floating in the
   middle of it. The sidebar's `overflow-y: auto` could never fire, because an
   element with no height constraint does not overflow — it just gets taller.
   Capping the grid is what gives that rule something to overflow against. */
.wb {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100vh;
}

/* ---- sidebar ---- */

.wb-sidebar {
  border-right: 1px solid var(--wb-line);
  background: var(--wb-panel);
  padding: 20px 16px 32px;
  overflow-y: auto;
  min-height: 0;
}

.wb-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.wb-brand-name {
  font-weight: 600;
}

.wb-badge {
  border: 1px solid var(--wb-accent);
  border-radius: 999px;
  color: var(--wb-accent);
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  text-transform: uppercase;
}

.wb-blurb {
  color: var(--wb-muted);
  font-size: 12px;
  line-height: 1.55;
  margin: 0 0 20px;
}

.wb-blurb code {
  font-family: var(--wb-mono);
  font-size: 11px;
}

.wb-honesty {
  border-top: 1px solid var(--wb-line);
  border-bottom: 1px solid var(--wb-line);
  margin-bottom: 8px;
  padding: 4px 0 12px;
}

.wb-not-built,
.wb-caveats {
  list-style: none;
  margin: 8px 0 4px;
  padding: 0;
}

.wb-not-built li,
.wb-caveats li {
  color: var(--wb-muted);
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: 10px;
}

.wb-not-built strong,
.wb-caveats strong {
  color: var(--wb-text);
}

.wb-caveats {
  margin-bottom: 12px;
}

.wb-phase {
  border: 1px solid var(--wb-line);
  border-radius: 999px;
  color: var(--wb-muted);
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.04em;
  margin-left: 4px;
  padding: 1px 7px;
  text-transform: uppercase;
  white-space: nowrap;
}

.wb-nav-heading {
  color: var(--wb-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin: 18px 0 8px;
  text-transform: uppercase;
}

.wb-nav-note {
  color: var(--wb-muted);
  font-size: 11px;
  line-height: 1.5;
  margin: 0 0 8px;
}

.wb-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wb-nav-item {
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  color: var(--wb-text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  text-align: left;
}

.wb-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.wb-nav-item.is-active {
  background: rgba(138, 154, 99, 0.14);
  border-left-color: var(--wb-accent);
  color: #fff;
}

.wb-nav-item:focus-visible {
  outline: 2px solid var(--wb-accent);
  outline-offset: -2px;
}

.wb-counts {
  color: var(--wb-muted);
  font-family: var(--wb-mono);
  font-size: 11px;
  line-height: 1.6;
  margin-top: 24px;
}

/* ---- stage ---- */

.wb-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* `overflow: auto` rather than nothing: the host pane keeps a 520px floor, so on
   a short viewport the stage must scroll rather than push the page taller again
   and reintroduce ol-wzar by the back door. */
.wb-stage {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

/* The host pane: an <iframe> holding the product's own document (ol-mioe).
   Everything about how the PRODUCT looks is declared inside that document — the
   variable set, packages/plugin/styles.css and the Obsidian-shell layout rules
   all live there (src/host-frame.ts). What is left here is the frame's box, and
   only that, which is the whole point: nothing the harness declares can reach
   the pixels a WB-2 screenshot captures. */
.wb-host {
  background: #1e1e1e;
  border: 1px solid var(--wb-line);
  border-radius: 8px;
  display: block;
  flex: 1;
  /* `min(520px, 100%)`, not a bare 520px (ol-wzar). The floor exists so the
     product is never rendered in a squashed box, but as a hard value it made
     the pane 3px taller than the stage at the 832px test viewport — enough to
     overflow, and the visual baselines then captured a sliver of the inspector
     below it. Clamped to the stage, the floor still applies wherever there is
     room for it and stops being a floor where there is not. */
  min-height: min(520px, 100%);
  min-width: 0;
}

/* ---- inspector ---- */

/* A DEFINITE height, not a max (ol-wzar). As a max it was sized by its own
   copy, which varies per state — so the stage above it, and therefore the
   product pane, changed height from state to state and every visual baseline
   came out a different size. Pinning it means the pane is one predictable size
   for a given viewport, so a baseline diff can only be the product changing,
   never the harness's own commentary getting longer. */
.wb-inspector {
  border-top: 1px solid var(--wb-line);
  background: var(--wb-panel);
  height: min(240px, 34vh);
  overflow-y: auto;
  padding: 14px 24px 20px;
}

.wb-inspector-note {
  line-height: 1.55;
  margin-bottom: 6px;
  max-width: 90ch;
}

.wb-inspector-note--dim {
  color: var(--wb-muted);
  font-size: 12px;
}

.wb-inspector-row {
  align-items: baseline;
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.wb-inspector-label {
  color: var(--wb-muted);
  flex: 0 0 140px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wb-inspector-value {
  font-family: var(--wb-mono);
  font-size: 12px;
}

.wb-inspector-log {
  min-width: 0;
}

.wb-inspector-log-path {
  color: var(--wb-accent);
  font-family: var(--wb-mono);
  font-size: 11px;
  margin-top: 8px;
}

.wb-inspector-log-json {
  background: #101216;
  border: 1px solid var(--wb-line);
  border-radius: 4px;
  font-family: var(--wb-mono);
  font-size: 11px;
  margin: 4px 0 0;
  overflow-x: auto;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---- notices ---- */

.wb-notices {
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: fixed;
  right: 16px;
  width: min(420px, calc(100vw - 32px));
  z-index: 50;
}

.wb-notice {
  background: #232830;
  border: 1px solid var(--wb-line);
  border-left: 3px solid var(--wb-accent);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 12px;
}

.wb-fatal {
  background: #3a1a1a;
  color: #ffd9d4;
  font-family: var(--wb-mono);
  font-size: 12px;
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  /* Stacked, so the viewport cap is released deliberately (ol-wzar): with one
     column the sidebar sits ABOVE the stage, and capping the page would trap it
     in a short scroller with the demo pushed off-screen below. Here the page is
     meant to be taller than the viewport and scroll as a page. */
  .wb {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .wb-sidebar {
    border-bottom: 1px solid var(--wb-line);
    border-right: 0;
    overflow-y: visible;
  }

  .wb-stage {
    overflow: visible;
  }
}
