/* Seamless Material Studio: the page's arrangement only. Every control's look (buttons, fields, switches, menus, dialogs,
   toasts) and every colour comes from Myth Engine's editor kit (vendor/myth-ui/myth-ui.css) and its theme tokens, as Myth's
   UI standards ask (Myth/docs/UI-STANDARDS.md, "Local CSS may"). */

.material-host { flex: 1 1 auto; min-height: 0; display: flex; }
.material-host > .myth-editor-layout { flex: 1 1 auto; min-width: 0; }
/* Whatever the page hides (a setting that does not apply to the surface on show) stays hidden, whatever its arrangement. */
.material-host [hidden], .material-export [hidden] { display: none !important; }

/* The Preview Area: its toolbar, the view, the surface's maps, the status line. */
.material-preview { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.material-preview > .myth-preview-viewport { flex: 1 1 auto; min-height: 0; position: relative; display: flex; flex-direction: column; }
/* The bar's right end: Settings, and Export at its full width. (The kit spaces the bar's groups and buttons, and moves what
   does not fit into its More menu.) */
.material-toolbar-end { flex: none; overflow: visible; }
.material-toolbar-end > #export { flex: none; white-space: nowrap; }
.material-viewport { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; }

/* The view: the lit slab or ball, or the flat tile, over a quiet grey ground with a soft shadow under the slab, the same in
   every theme so the material's own colours read true. The canvases are laid over the stage, so their drawing size never
   sets the stage's size. */
.material-stage { position: relative; isolation: isolate; flex: 1 1 auto; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(ellipse at 47% 32%, #55595c, #3b3e41 45%, #222427 90%); }
.material-stage::before { content: ''; position: absolute; left: 25%; right: 25%; bottom: 12%; height: 12%; border-radius: 50%; background: #16191ba6; filter: blur(18px); z-index: -1; }
.material-stage > canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -2px; }
.material-stage > #model { cursor: grab; }
.material-stage > #model:active { cursor: grabbing; }
.material-stage[data-tool="pan"] > #view { cursor: grab; }
.material-stage[data-tool="paint"] > #view, .material-stage[data-tool="erase"] > #view { cursor: crosshair; }
/* Baking the maps: in the middle of the view. */
.material-busy { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none; display: flex; align-items: center; gap: 10px; padding: 6px 14px; border-radius: 14px; white-space: nowrap;
  background: var(--myth-ui-surface-raised, var(--panel)); border: 1px solid var(--myth-ui-border, var(--border)); }
.material-busy > .myth-ui-progress { width: 90px; }
/* The navigation's Light menu: the Light Angle slider with its number box. */
.material-light { display: flex; flex-direction: column; gap: 10px; min-width: 260px; }

/* The surface's maps under the view, each at a glance; a click shows it alone. */
.material-maps { flex: none; padding: 8px 12px; }
.material-channels { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.material-card { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; min-height: 0; height: auto; padding: 4px; white-space: normal; text-align: left; }
.material-card > canvas, .material-card > img { display: block; width: 100%; border-radius: 3px; object-fit: cover; }
.material-channel > canvas { height: 44px; }
.material-card > .myth-ui-choice-card-title { font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }

/* The status strip (the kit's myth-editor-statusbar): the surface's name, its size and source, and what just happened. */
.material-status-group { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex: 1 1 auto; }
.material-title { white-space: nowrap; }
.material-meta { white-space: nowrap; color: var(--myth-ui-text-muted, var(--text-muted)); font-variant-numeric: tabular-nums; }
.material-note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--myth-ui-text-muted, var(--text-muted)); }
.material-note.error { color: var(--myth-ui-danger, #e5534b); }

/* Settings, behind the toolbar's menu button: the theme, the side panels, the keys. */
.material-settings { display: flex; flex-direction: column; gap: 10px; min-width: 260px; }
.material-buttons { display: flex; flex-wrap: wrap; gap: 6px; }

/* The Library drawer: find, filter, and the surfaces as cards. */
.material-library { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 14px; }
.material-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.material-preset > canvas, .material-preset > img { height: auto; aspect-ratio: 72 / 64; }
.material-readout { display: block; color: var(--myth-ui-text-muted, var(--text-muted)); font-size: 12px; line-height: 1.5; }

/* The properties. Reset to Defaults sits beside the filter box at the top; the filter takes the rest of the row. */
.material-host .myth-ui-property-inspector-toolbar { display: flex; align-items: center; gap: 6px; }
.material-host .myth-ui-property-inspector-toolbar > .myth-ui-property-inspector-search { flex: 1 1 auto; min-width: 0; }
.material-host .myth-ui-property-inspector-toolbar > #resetDefaults { flex: none; white-space: nowrap; }
.material-rows { display: contents; }
.material-switch-row { display: flex; }
.material-seed { display: flex; align-items: center; gap: 6px; min-width: 0; }
.material-seed > .myth-ui-number-input { flex: 1 1 auto; min-width: 0; }
.material-seed > .myth-ui-button { flex: none; }

/* Export's dialog. */
.material-export { width: min(520px, 94vw); }
.material-export .myth-ui-dialog-body { display: flex; flex-direction: column; gap: 12px; }
.material-export-about { margin: 0; }

/* In a narrow window Myth's editor layout stacks its columns (the kit's own query: the editor 980 px wide or less). The
   view then comes first and fills the screen but for the top of the drawers' row, which shows below it so it is plain
   there is more (the library and the properties, on the drawers' rail) as the editor scrolls. */
@container (max-width: 980px) {
  .material-host .myth-editor-layout-main { order: -1 !important; height: calc(100svh - 56px) !important; }
  .material-host .myth-editor-layout-main > .material-preview { height: 100%; }
}
/* A phone: the maps under the view become one row that scrolls sideways. */
@media (max-width: 700px) {
  .material-channels { display: flex; overflow-x: auto; }
  .material-channel { flex: 0 0 76px; }
  .material-channel > canvas { height: 34px; }
  .material-channel > .myth-ui-choice-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
}
