/* @level scene */
/*
 * scene.css — the page's layout grid: topbar + sidebar + main.
 *
 * Loaded by index.html directly (NOT via bridge.loadStyle) so the
 * grid renders before JS executes — no FOUC, no reflow when
 * organisms mount.
 *
 * 16m: introduced when the body went from a vertical stack to a
 * two-column grid. The slot classes are scene-level chrome; the
 * organisms that mount into them own their own appearance.
 */

body {
  margin: 0;
  /* The DEFAULT is now the humanist sans — prose + labels read as design, not code. The technical bits
   * (dial values, ports, clock, counts) re-declare --m-font-mono so they stay precise. */
  font-family: var(--m-font-sans);
  font-size: var(--m-size-font-md);
  -webkit-font-smoothing: antialiased;        /* crisper sans on macOS (no layout change) */
  -moz-osx-font-smoothing: grayscale;
  background: var(--m-surface-base);
  color: var(--m-content-secondary);
  display: grid;
  grid-template-columns: 220px 1fr;   /* nav arc: tighter sidebar — the compact tiles don't need 280px */
  grid-template-rows: auto 1fr;
  grid-template-areas: "topbar topbar" "sidebar main";
  height: 100vh;
  overflow: hidden;
}

/* Hamburger toggle (scene.js): the palette sidebar is visible by DEFAULT; collapsing it — only on an
   explicit hamburger click, never auto-hidden — drops its column to 0 and hides it, handing the full
   width to the canvas. A second click restores it. */
/* Collapsing the palette keeps ONLY its hamburger visible (so it can always be reopened — Ross): the search
   + the tile list hide, and the sidebar narrows to fit just the hamburger. The canvas takes the rest. */
body.palette-hidden { grid-template-columns: auto 1fr; }
body.palette-hidden .page-sidebar { overflow: visible; padding: var(--m-size-space-2); }
body.palette-hidden .palette-search-wrap,
body.palette-hidden #palette { display: none; }

/* palette REMOVED from sight (scene.js SHOW_PALETTE=false): the taskbar Browse subsumes it. Collapse the grid
   to a single column so the canvas (main) spans the full width — no empty sidebar gutter. */
body.palette-off { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }

/* The hard studio topbar is a bare host for the shared chrome-bar (chrome THREAD 3), which is a self-contained
   full-bleed bar with its OWN padding / border / background. So this stays a plain block (no padding, gap, or
   border of its own — the chrome-bar provides all of them); the block-level flex bar fills the width, and its
   internal spacer pins the mode selector + "···" overflow to the right edge. */
.page-topbar {
  grid-area: topbar;
  display: block;
}

.page-sidebar {
  grid-area: sidebar;
  overflow-y: auto;
  padding: var(--m-size-space-3);
  border-right: 1px solid var(--m-border-default);
}

.page-main {
  grid-area: main;
  overflow-y: auto;
  padding: var(--m-size-space-3) var(--m-size-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--m-size-space-3);
}

/* ── Scrollbars (16n) ──────────────────────────────────────────
 *
 * One scrollbar style across the app — quiet, thin, drawn from
 * the design tokens so it stays coherent across themes. The
 * standard `scrollbar-*` properties cover Firefox and modern
 * Chromium; the `::-webkit-scrollbar` pseudo-elements cover
 * older Chromium and Safari. The `*` selector cascades into
 * every scrollable element (sidebar, main, log, palette grid,
 * any future surface) without each having to opt in.
 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--m-border-emphasis) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--m-border-default);
  border-radius: var(--m-size-radius-sm);
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--m-border-emphasis);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

/* The app's ONE failure/status surface. Promoted out of the canvas column (canvas-view.css) because
 * the Easy/Moderate skins are position:fixed full-screen at z-1100 and covered it — the surface was
 * invisible in two of three modes. z-1700 clears the measured ceiling (.easy-menu at 1600); dialogs
 * are 1500, skins 1100. pointer-events:none so it never blocks a control underneath; the × opts in. */
.canvas-status {
  display: none;
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: var(--m-size-space-4); z-index: 1700;
  max-width: min(90vw, 560px); pointer-events: none;
  padding: var(--m-size-space-2) var(--m-size-space-3);
  border-radius: var(--m-size-radius-md);
  background: var(--m-surface-raised); border: 1px solid var(--m-border-subtle);
  font-size: var(--m-size-font-sm); color: var(--m-content-tertiary);
}
/* Only warn/error un-hide — the plan's named fallback, taken on measured evidence rather than the
 * default. `ok` is not just the 40-odd localised user sentences ("Link copied", "Saved …"): scene.js's
 * kernel-intent router publishes `_status` level `ok` with `describe(intent, result)` after EVERY
 * successful mutation, and `describe`'s default branch returns the bare intent kind. Measured with the
 * display rule on: spawning a node toasts "spawned gain as n#4", and EASY MODE — the beginner on-ramp —
 * toasts "consolidate_clocks". Untranslated developer prose with internal ids, on every gesture.
 * Making `ok`/`info` visible is right, but it needs that router publish to stop being a toast first
 * (it has no other consumer than this surface and telemetry). Follow-up, not this task's diff. */
.canvas-status.warn, .canvas-status.error { display: block; }
.canvas-status.ok    { color: var(--m-interactive-primary); }
.canvas-status.warn  { color: var(--m-wire-control); }
.canvas-status.error { color: var(--m-color-status-danger); }
.canvas-status-x     { pointer-events: auto; margin-left: var(--m-size-space-2); }

/* The pre-boot failure shell (CLAUDE.md rule 3, second static exception). Removed by the boot script
 * on success; on failure it becomes the only thing on screen, so it must be readable with no JS. */
#boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: var(--m-size-space-4); text-align: center;
  color: var(--m-content-tertiary); font-size: var(--m-size-font-sm);
}
#boot h1 { font-size: var(--m-size-font-lg); color: var(--m-content-primary); }
