:root {
  color-scheme: light;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
}

/* Live preview keeps scrolling available without reducing the authored width. */
html[data-designer-live-preview='true'],
html[data-designer-live-preview='true'] body {
  scrollbar-width: none;
}

html[data-designer-live-preview='true']::-webkit-scrollbar,
html[data-designer-live-preview='true'] body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#content {
  min-width: 0;
}


.runtime-design-document,
.runtime-design-document > .runtime-layout-container {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.runtime-layout-container.layout-section {
  width: 100%;
  box-sizing: border-box;
}

.runtime-layout-container.canvas-grid {
  position: relative;
  min-width: 0;
  box-sizing: border-box;
}

.runtime-layout-container.canvas-grid[data-layout-mode='stack'],
.runtime-layout-container.canvas-grid[data-layout-mode='row'],
.runtime-layout-container.canvas-grid[data-layout-mode='grid'] {
  display: flex;
  gap: inherit;
  min-height: 0;
}

.runtime-layout-container.canvas-grid[data-layout-mode='stack'] {
  flex-direction: column;
  align-items: var(--layout-align, stretch);
}

.runtime-layout-container[data-layout-mode='row']:is([data-layout-align='stretch'], :not([data-layout-align])) > .layout-container {
  /* Match Studio: stretch the box; the saved min-height remains a lower bound. */
  height: auto !important;
}

.runtime-layout-container.canvas-grid[data-layout-mode='row'] {
  flex-flow: row wrap;
  align-items: var(--layout-align, stretch);
}

.runtime-layout-container.canvas-grid[data-layout-mode='grid'] {
  display: grid;
  grid-template-columns: repeat(var(--layout-columns, 3), minmax(0, 1fr));
  align-items: var(--layout-align, stretch);
}

.runtime-layout-container.canvas-grid:not([data-layout-mode='free']) > .canvas-item {
  position: relative !important;
  inset: auto !important;
  width: auto !important;
  max-width: 100%;
  transform: none !important;
}

/* A shared article grows through its Auto/Grid ancestry. CanvasGrid writes
   pixel heights for placement, which must not constrain this content path. */
.runtime-layout-container[data-page-content-flow='true'] {
  height: auto !important;
  /* Preserve the saved split ratio and shrinking. A content-sized flex basis
     forced long articles onto a new row beside an otherwise valid sidebar. */
}

/* A page design occupies the explicit outlet without inheriting a fixed canvas width. */
.runtime-page-design {
  width: 100%;
  min-width: 0;
}

/* Navigation disclosures participate in Auto/Grid flow. Fixed Free placement
   still honors the author's canvas dimensions. */
.runtime-layout-container.canvas-grid:not([data-layout-mode='free']) > .canvas-item:is([data-widget-id='navigationMenu'], [data-widget-id='breadcrumb']) {
  height: auto !important;
  min-height: 0 !important;
  flex: 0 0 auto;
}
.runtime-layout-container.canvas-grid:not([data-layout-mode='free']) > .canvas-item:is([data-widget-id='navigationMenu'], [data-widget-id='breadcrumb']) > .canvas-item-content {
  height: auto !important;
}

.runtime-design-document .runtime-layout-container.canvas-grid[data-layout-height],
.runtime-design-document .runtime-layout-container[data-layout-height] {
  height: var(--layout-height) !important;
}

.runtime-design-document .runtime-layout-container.canvas-grid[data-layout-position='sticky'],
.runtime-design-document .runtime-layout-container[data-layout-position='sticky'] {
  position: sticky !important;
  top: 0 !important;
  align-self: start;
}

/* Explicit flow display rules must not override a saved visibility condition. */
.runtime-layout-container[data-layout-interaction][hidden] {
  display: none !important;
}
