/* Layout of the showcase itself. Every value reads a library token, so the site is repainted by
   the theme editor exactly like the components it presents. */

/* The site's shell takes the window's height, so only the main area scrolls (OmniMain Scrollable) and the
   header and the menu stay in place. Scoped to the site's own shell, not to the shells drawn in examples. */
#showcase-theme > .omni-layout {
    block-size: 100dvh;
}

/* One track as wide as the page, and items capped to it, not to their longest word: the auto track and the item
   width grew to the longest unbreakable word of the title, which a theme in tracked capitals makes wider
   than a phone, and pushed the page sideways. The title then breaks that word (overflow-wrap) inside its box. */
.showcase-hero {
    display: grid;
    gap: var(--omni-space-md);
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    padding-block: var(--omni-space-xl);
}

.showcase-hero > * {
    max-inline-size: 100%;
}

.showcase-hero__lead {
    color: var(--omni-color-text-muted);
    font-size: var(--omni-font-size-lg);
    margin: 0;
    max-width: 46rem;
}

.showcase-cards,
.showcase-presets {
    display: grid;
    gap: var(--omni-space-lg);
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    padding-block: var(--omni-space-md);
}

.showcase-code {
    background: var(--omni-color-surface-muted);
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    font-size: var(--omni-font-size-sm);
    overflow-x: auto;
    padding: var(--omni-space-md);
}

/* A fieldset is at least as wide as its content by default: without min-inline-size, the token
   rows widened the page on a phone. */
.showcase-tokens {
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    display: grid;
    gap: var(--omni-space-sm);
    margin-block: var(--omni-space-lg);
    max-inline-size: 100%;
    padding: var(--omni-space-lg);
}

.showcase-token {
    align-items: center;
    display: grid;
    gap: var(--omni-space-sm);
    grid-template-columns: minmax(10rem, 1fr) auto minmax(8rem, 2fr);
}

.showcase-token__label {
    color: var(--omni-color-text);
    font-size: var(--omni-font-size-sm);
}

.showcase-token__color {
    block-size: var(--omni-control-height);
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    inline-size: 3rem;
    padding: 0;
}

.showcase-token__text {
    background: var(--omni-color-surface);
    block-size: var(--omni-control-height);
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    color: var(--omni-color-text);
    font-family: var(--omni-font-family);
    font-size: var(--omni-font-size-base);
    grid-column: 3;
    padding-inline: var(--omni-space-sm);
}

.showcase-token__text:focus-visible,
.showcase-token__color:focus-visible {
    box-shadow: var(--omni-focus-ring);
    outline: none;
}

/* On a phone the label and the swatch share a row and the value takes the next one. */
@media (max-width: 36rem) {
    .showcase-token { grid-template-columns: minmax(0, 1fr) auto; }
    .showcase-token__text { grid-column: 1 / -1; }
}

/* Workflows page of the gallery: the sign-in page in miniature, a muted dashed frame sets it apart from the rest of the preview. */
.gallery-workflows-login { background: var(--omni-color-surface-muted); border: var(--omni-border-width) dashed var(--omni-color-border); border-radius: var(--omni-radius); padding-inline: var(--omni-space-md); }

/* Personnalisateur : la barre de réglages de la maquette, puis l'aperçu et son rail de contrastes. */
.showcase-workshop-bar { align-items: end; background: var(--omni-color-surface-muted); border: var(--omni-border-width) solid var(--omni-color-border); border-radius: var(--omni-radius); display: flex; flex-wrap: wrap; gap: var(--omni-space-md) var(--omni-space-lg); margin-block: var(--omni-space-lg); padding: var(--omni-space-md) var(--omni-space-lg); }
.showcase-workshop-bar > * { min-inline-size: 10rem; }
.showcase-workshop-bar__field { display: grid; gap: var(--omni-field-gap); }
.showcase-workshop { align-items: start; display: grid; gap: var(--omni-space-xl); grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem); }
@media (max-width: 70rem) { .showcase-workshop { grid-template-columns: minmax(0, 1fr); } }
.showcase-workshop__stage { min-inline-size: 0; }
.showcase-workshop__rail { display: grid; gap: var(--omni-space-md); min-inline-size: 0; }
.showcase-stage { display: grid; gap: var(--omni-space-lg); grid-template-columns: minmax(0, 1fr); }
/* L'aperçu est plus étroit que la galerie : ses rangées de boutons et de badges passent à la ligne,
   comme dans la maquette, au lieu de courir sous le rail des contrastes. */
.showcase-stage .omni-stack--horizontal { flex-wrap: wrap; }
/* One track that may shrink: an auto track took the widest demo's minimum width and widened the page on
   a phone under the themes with spaced capitals. No fill of its own: the block lies on the theme scope,
   which already paints the surface, and a theme's colour field (Givre) shows through it. */
.showcase-stage__scroll { max-inline-size: 100%; overflow-x: auto; }
.showcase-stage__block { background: transparent; border: var(--omni-border-width) solid var(--omni-color-border); border-radius: var(--omni-radius); display: grid; gap: var(--omni-space-md); grid-template-columns: minmax(0, 1fr); min-inline-size: 0; padding: var(--omni-section-pad); }
.showcase-stage__head { align-items: center; display: flex; flex-wrap: wrap; gap: var(--omni-space-sm) var(--omni-space-md); justify-content: space-between; }
.showcase-stage__head .omni-heading { margin: 0; }
.showcase-stage__density { align-items: center; display: inline-flex; gap: var(--omni-space-sm); }

/* « Forcer le survol » : un navigateur ne fige pas :hover, ces règles rejouent celles du paquet sur
   l'aperçu, avec les mêmes jetons, le temps de comparer les survols d'un thème d'un coup d'œil. */
.showcase-force-hover .omni-button:not(:disabled),
.showcase-force-hover .omni-split-button > :is(.omni-split-button__main, .omni-split-button__toggle):not(:disabled) { background: var(--omni-button-fill-hover); }
.showcase-force-hover .omni-tabs__tab { background: var(--omni-color-surface-hover); color: var(--omni-color-text); }
.showcase-force-hover :is(.omni-panel-menu__link, .omni-panel-menu__summary, .omni-menu__item) { background: var(--omni-color-surface-hover); }
.showcase-force-hover .omni-data-grid--row-hover tbody > tr { --omni-row-fill: color-mix(in srgb, var(--omni-color-text) 7%, transparent); }
.showcase-force-hover .omni-data-grid thead > tr > .omni-data-grid__column--sortable { background: var(--omni-header-fill-hover); color: var(--omni-color-text); }

.showcase-contrasts,
.showcase-swatches { display: grid; gap: 2px; list-style: none; margin: 0; padding: 0; }
.showcase-contrast { align-items: baseline; display: flex; font-size: var(--omni-font-size-sm); gap: var(--omni-space-sm); justify-content: space-between; padding-block: 2px; }
.showcase-contrast > :first-child { min-inline-size: 0; }
.showcase-contrast__ratio { flex: none; font-family: var(--omni-font-family-monospace); white-space: nowrap; }
.showcase-contrast--failed { color: var(--omni-color-danger); font-weight: 600; }
.showcase-swatch { align-items: center; display: grid; font-size: var(--omni-font-size-sm); gap: var(--omni-space-sm); grid-template-columns: auto minmax(0, 1fr) auto; }
.showcase-swatch__chip { block-size: 1.25rem; border: var(--omni-border-width) solid var(--omni-color-border); border-radius: var(--omni-radius-sm, var(--omni-radius)); inline-size: 1.25rem; }
.showcase-swatch__value { font-family: var(--omni-font-family-monospace); max-inline-size: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.showcase-swatch__chip-accent-fill { background: var(--omni-color-accent-fill); }
.showcase-swatch__chip-success-fill { background: var(--omni-color-success-fill); }
.showcase-swatch__chip-info-fill { background: var(--omni-color-info-fill); }
.showcase-swatch__chip-warning-fill { background: var(--omni-color-warning-fill); }
.showcase-swatch__chip-danger-fill { background: var(--omni-color-danger-fill); }
.showcase-swatch__chip-accent { background: var(--omni-color-accent); }
.showcase-swatch__chip-accent-strong { background: var(--omni-color-accent-strong); }
.showcase-swatch__chip-success { background: var(--omni-color-success); }
.showcase-swatch__chip-info { background: var(--omni-color-info); }
.showcase-swatch__chip-warning { background: var(--omni-color-warning); }
.showcase-swatch__chip-danger { background: var(--omni-color-danger); }
.showcase-swatch__chip-text { background: var(--omni-color-text); }
.showcase-swatch__chip-text-muted { background: var(--omni-color-text-muted); }
.showcase-swatch__chip-border { background: var(--omni-color-border); }
.showcase-swatch__chip-surface { background: var(--omni-color-surface); }
.showcase-swatch__chip-surface-muted { background: var(--omni-color-surface-muted); }
.showcase-swatch__chip-surface-hover { background: var(--omni-color-surface-hover); }
.showcase-swatch__chip-surface-highlight { background: var(--omni-color-surface-highlight); }


/* Gallery pages (PLAN-005): the frame around every page, settings on the left and preview on the right
   on a wide screen, stacked below; the examples themselves carry no class of the showcase. */
.gallery-page {
    min-inline-size: 0;
}

.gallery-page__description {
    max-inline-size: 60rem;
}

.gallery-page__body {
    align-items: start;
    display: grid;
    gap: var(--omni-space-md);
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 75rem) {
    .gallery-page__body {
        grid-template-columns: minmax(20rem, 2fr) minmax(0, 3fr);
    }

    .gallery-page__body--single {
        grid-template-columns: minmax(0, 1fr);
    }
}

.gallery-page__settings,
.gallery-page__preview {
    display: flex;
    flex-direction: column;
    gap: var(--omni-space-md);
    min-inline-size: 0;
}

.gallery-preview {
    min-inline-size: 0;
}

/* The Mobile tab: the preview in the screen of a standard phone, 360 x 780 CSS pixels, centred in a
   frame that recalls its shape; the content scrolls inside the screen as it would on the phone. */
.gallery-phone {
    border: 0.5rem solid var(--omni-color-border);
    border-radius: 1.5rem;
    box-sizing: content-box;
    inline-size: 360px;
    margin-inline: auto;
    max-inline-size: calc(100% - 1rem);
}

.gallery-phone__screen {
    block-size: 780px;
    display: flex;
    flex-direction: column;
    gap: var(--omni-space-md);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.gallery-theme-picker {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--omni-space-xs);
}

.gallery-theme-picker__select {
    min-inline-size: 11rem;
}

/* Gallery shell (PLAN-005 fidelity): the gallery menu lives in the sidebar, the home is a dashboard of
   family cards, and the cards of a page keep a rhythm between their hint and their example. */
.gallery-preview .omni-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--omni-space-md);
    min-inline-size: 0;
}

/* The home of the gallery: the family cards flow in columns at least 17rem wide, a short card under a
   tall one, with no script to measure them. */
.gallery-home__grid {
    column-gap: var(--omni-space-lg);
    column-width: 17rem;
}

/* The search above the cards, as wide as a comfortable line; the status line under it is empty (and
   takes no room) until no component matches. */
.gallery-home__search {
    max-inline-size: 28rem;
}

.gallery-home__empty {
    color: var(--omni-color-text-muted);
    margin: 0;
}

.gallery-home__empty:empty {
    display: none;
}

.gallery-home__family {
    break-inside: avoid;
    margin-block-end: var(--omni-space-lg);
}

.gallery-home__family .omni-card__header {
    align-items: center;
    background: var(--omni-color-surface-muted);
    border-start-end-radius: inherit;
    border-start-start-radius: inherit;
    display: flex;
    gap: var(--omni-space-sm);
}

.gallery-home__family .omni-card__body {
    padding: var(--omni-space-xs);
}

.gallery-home__family-icon {
    align-items: center;
    /* Mixed into the surface rather than a subtle token, so the square reads on a dark theme too. */
    background: color-mix(in srgb, var(--omni-color-accent) 18%, var(--omni-color-surface));
    block-size: 2.25rem;
    border-radius: var(--omni-radius);
    color: var(--omni-color-accent);
    display: inline-flex;
    flex: none;
    inline-size: 2.25rem;
    justify-content: center;
}

.gallery-home__family .gallery-home__family-title {
    flex: 1 1 auto;
    font-size: 1.125rem;
    margin: 0;
    min-inline-size: 0;
}

.gallery-home__pages {
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
}

.gallery-home__pages .gallery-home__page {
    align-items: center;
    border-radius: var(--omni-radius);
    color: var(--omni-color-text);
    display: flex;
    gap: var(--omni-space-sm);
    padding: var(--omni-space-xs) var(--omni-space-sm);
}

.gallery-home__page .omni-icon {
    color: var(--omni-color-text-muted);
    flex: none;
}

.gallery-home__pages .gallery-home__page:hover {
    background: var(--omni-color-surface-hover);
}

.gallery-home__page:hover .omni-icon {
    color: var(--omni-color-accent);
}

/* Buttons page, rest / hover / press comparison. A browser cannot freeze :hover or :active, so the page
   repaints the two rules of the package with the same tokens around an ordinary column of buttons. */
.gallery-buttons-hover .omni-button:not(:disabled) {
    background: var(--omni-button-fill-hover);
}

.gallery-buttons-press .omni-button:not(:disabled) {
    background: var(--omni-button-fill-active);
    box-shadow: var(--omni-button-press-shadow, var(--omni-button-shadow));
    transform: var(--omni-button-press-transform, translateY(1px));
}

.gallery-buttons-press :is(.omni-button--ghost, .omni-button--ghostdanger):not(:disabled) {
    box-shadow: 0 0 #0000;
}

/* Rows and columns page: a row that does not wrap overflows, so its example sits in a strip that scrolls. */
.gallery-rows-clip {
    overflow-x: auto;
}

/* Page shell page: the miniature scrolls inside its frame, a sticky header sticks to it, and the wide canvas
   scrolls sideways so the three content widths can be told apart. The rules reach the example by its own
   layout classes, so the example itself carries no showcase class. */
.gallery-shell-markup {
    color: var(--omni-color-text-muted);
    font-size: var(--omni-font-size-sm);
    overflow-wrap: anywhere;
}

.gallery-shell-viewport {
    block-size: 18rem;
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    overflow: auto;
}

.gallery-shell-viewport--short {
    block-size: auto;
    max-block-size: 12rem;
}

.gallery-shell-canvas {
    background: var(--omni-color-surface-muted);
    min-block-size: 100%;
}

.gallery-shell-canvas--wide {
    inline-size: 100rem;
}

/* With its own scrolling the miniature takes the height of the frame and its main area is what scrolls. */
.gallery-shell-canvas--fill,
.gallery-shell-canvas--fill > .omni-layout {
    block-size: 100%;
}

.gallery-shell-viewport--short:has(.gallery-shell-canvas--fill) {
    block-size: 12rem;
}

.gallery-shell-canvas > .omni-layout {
    background: var(--omni-color-surface);
    outline: var(--omni-border-width) dashed var(--omni-color-accent);
    outline-offset: -0.0625rem;
}

.gallery-shell-canvas .omni-header {
    align-items: center;
    background: var(--omni-color-surface-muted);
    display: flex;
    gap: var(--omni-space-sm);
    padding: var(--omni-space-sm) var(--omni-space-md);
}

.gallery-shell-canvas .omni-header .omni-heading {
    flex: 1 1 auto;
    margin: 0;
}

.gallery-shell-canvas .omni-main {
    flex: 1 1 auto;
}

/* A main area that scrolls by itself takes its margin from the package, which also centres the column. */
.gallery-shell-canvas .omni-main:not(.omni-main--scrollable) {
    padding: var(--omni-space-md);
}

.gallery-shell-canvas .omni-main .omni-heading {
    margin-block-start: 0;
}

/* The text columns are tinted to show the width of the column. */
.gallery-shell-canvas .omni-main p {
    background: color-mix(in srgb, var(--omni-color-accent) 8%, transparent);
}

/* Tabs in a frame of fixed height: only the selected panel scrolls. */
.gallery-shell-tabs {
    block-size: 13rem;
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    display: flex;
    flex-direction: column;
    padding: var(--omni-space-sm);
}

/* A whole application shell in its frame. */
.gallery-shell-app {
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    overflow: hidden;
}

.gallery-shell-app .omni-main {
    align-content: start;
    display: grid;
    flex: 1 1 auto;
    gap: var(--omni-space-md);
    padding: var(--omni-section-pad);
}

/* Side menu page: the miniature shell gets a height and contains the veil of a floating menu, which is
   fixed to the window otherwise; contained, it covers the preview and not the page. */
.gallery-shell-stage {
    block-size: 22rem;
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    contain: layout paint;
    display: flex;
    flex-direction: column;
}

.gallery-shell-stage > .omni-layout {
    block-size: 100%;
    display: flex;
    flex-direction: column;
}

/* Loading bar page: the colour is a variable declared on the bar itself, so each class sits on the bar. */
.gallery-loading-bar-accent {
    --omni-loading-bar-color: var(--omni-color-accent);
}

.gallery-loading-bar-success {
    --omni-loading-bar-color: var(--omni-color-success);
}

.gallery-loading-bar-warning {
    --omni-loading-bar-color: var(--omni-color-warning);
}

.gallery-loading-bar-danger {
    --omni-loading-bar-color: var(--omni-color-danger);
}

/* Layout, Forms, Overlays fidelity */
/* The examples carry no class of the showcase: each page wraps its example in a gallery-* div and these
   rules reach the Omni* markup inside it. */

/* Context menus page: the right-click zone is a target to aim at, the file list is bordered rows. */
.gallery-context-zone .omni-context-menu__trigger > .omni-stack {
    border: 0.125rem dashed var(--omni-color-border);
    border-radius: var(--omni-radius);
    box-sizing: border-box;
    color: var(--omni-color-text-muted);
    min-block-size: 8rem;
    padding: var(--omni-space-md);
    text-align: center;
}

.gallery-context-zone .omni-context-menu__trigger .omni-text {
    color: inherit;
}

.gallery-context-rows .omni-context-menu__trigger > .omni-stack,
.gallery-overflow-rows .omni-stack--vertical > .omni-stack--justify-between {
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    box-sizing: border-box;
    padding: var(--omni-space-sm) var(--omni-space-md);
}

.gallery-context-rows .omni-context-menu__trigger > .omni-stack:hover,
.gallery-overflow-rows .omni-stack--vertical > .omni-stack--justify-between:hover {
    background: var(--omni-color-surface-hover);
}

/* Overflow menu page: the name takes the free room, the three-dot menu stays at the end of the row. */
.gallery-overflow-rows .omni-stack--justify-between > .omni-stack:first-child {
    flex: 1 1 auto;
    min-inline-size: 0;
}

/* Check boxes and switches page: the states matrix scrolls inside its box on a small screen. */
.gallery-toggles-matrix {
    max-inline-size: 100%;
    overflow-x: auto;
}

.gallery-toggles-matrix table {
    border-collapse: collapse;
}

.gallery-toggles-matrix th,
.gallery-toggles-matrix td {
    border-block-end: var(--omni-border-width) solid var(--omni-color-border);
    padding: var(--omni-space-sm) var(--omni-space-md);
    text-align: start;
    vertical-align: middle;
    white-space: nowrap;
}

.gallery-toggles-matrix thead th {
    color: var(--omni-color-text-muted);
    font-size: var(--omni-font-size-sm);
    font-weight: 600;
}

.gallery-toggles-matrix tbody th {
    font-weight: 600;
}

/* Stacks page: the main stack sits in a dashed frame taller than its items, so Justify and Align act in a
   vertical stack; the specimens sit on a muted tray. */
/* An overflow left to spill (Overflow None) scrolls in the preview rather than widening the page on a phone. */
.gallery-stacks-main,
.gallery-stacks-overflows {
    max-inline-size: 100%;
    overflow-x: auto;
}

.gallery-stacks-main .omni-column > :is(.omni-stack, .omni-stack-scroll) {
    border: var(--omni-border-width) dashed var(--omni-color-border);
    border-radius: var(--omni-radius);
    box-sizing: border-box;
    min-inline-size: 0;
    padding: var(--omni-space-sm);
}

.gallery-stacks-main .omni-column > .omni-stack,
.gallery-stacks-main .omni-column > .omni-stack-scroll > .omni-stack {
    min-block-size: 12rem;
}

.gallery-stacks-tray .omni-stack:has(> .omni-card) {
    background: var(--omni-color-surface-muted);
    border-radius: var(--omni-radius);
    padding: var(--omni-space-xs);
}

/* Stacks and rows pages: the numbered blocks are compact, small and centred. */
.gallery-stacks-tray .omni-stack > .omni-card,
.gallery-rows .omni-column > .omni-card {
    font-size: var(--omni-font-size-sm);
    text-align: center;
}

.gallery-stacks-tray .omni-stack > .omni-card > .omni-card__body,
.gallery-rows .omni-column > .omni-card > .omni-card__body {
    /* 0.25rem at the comfortable density, following the density as the package's card padding does. */
    padding: calc(var(--omni-item-pad-y) * 4 / 7) var(--omni-space-sm);
}

/* Rows and columns page: the main row sits in a dashed frame. */
.gallery-rows-frame > .omni-row {
    border: var(--omni-border-width) dashed var(--omni-color-border);
    border-radius: var(--omni-radius);
    box-sizing: border-box;
    padding: var(--omni-space-sm);
}

/* Fieldsets, sign-up validation and cards pages: a form or a card is no wider than a real one would be. */
.gallery-fieldsets-fields {
    max-inline-size: 28rem;
    min-inline-size: 0;
}

.gallery-validation-signup,
.gallery-cards-stage {
    max-inline-size: 32rem;
    min-inline-size: 0;
}

/* A host class that sets the documented card-frame hook: every card inside draws no border. */
.gallery-cards-stage--borderless {
    --omni-card-border-width: 0;
}

/* Navigation, Selection, Shell fidelity */

/* Selection pages: the main field of the autocomplete, drop-down and multi-select pages stops at a readable
   width, and the text boxes of the settings keep to one size. */
.gallery-selection-field .omni-form-field {
    max-inline-size: 26rem;
}

.gallery-selection-setting-input {
    inline-size: 14rem;
    max-inline-size: 100%;
}

/* Slider page: an upright slider has no length of its own, so every upright preview is given one. */
.gallery-slider .omni-slider--vertical .omni-slider__input {
    flex: 0 0 auto;
    height: 10rem;
}

/* Upload page: the file fields stop at 36rem and the picked files sit in a compact table that scrolls
   sideways inside its own wrapper. */
.gallery-upload .omni-upload {
    max-inline-size: 36rem;
}

.gallery-upload div:has(> table) {
    max-inline-size: 100%;
    overflow-x: auto;
}

.gallery-upload table {
    border-collapse: collapse;
    font-size: var(--omni-font-size-sm);
    inline-size: 100%;
}

.gallery-upload :is(th, td) {
    border-block-end: var(--omni-border-width) solid var(--omni-color-border);
    padding: var(--omni-space-xs) var(--omni-space-sm);
    text-align: start;
}

.gallery-upload td {
    font-variant-numeric: tabular-nums;
}

.gallery-upload :is(th, td):nth-child(3) {
    text-align: end;
}

/* App menu and profile menu pages: the menu sits at the end of a bordered bar tall enough for it to open. */
.gallery-menu-bar .omni-card__body > .omni-stack > .omni-stack:first-child {
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    min-block-size: 16rem;
    padding: var(--omni-space-sm) var(--omni-space-md);
}

.gallery-menu-samples .omni-card__body > .omni-stack:first-child {
    min-block-size: 10rem;
}

/* Tabs page: a panel has room below its content as well as above. */
.gallery-tabs .omni-tabs__panel {
    padding-block-end: var(--omni-space-md);
}

/* Breadcrumbs page: the links are a bulleted list. */
.gallery-link-list ul {
    display: flex;
    flex-direction: column;
    gap: var(--omni-space-xs);
    margin: 0;
    padding-inline-start: var(--omni-space-lg);
}

.gallery-link-list .omni-link {
    align-items: center;
    display: inline-flex;
    gap: var(--omni-space-xs);
}

/* Loading bar page: a dashed track around the header the bar is laid over, so the bar is seen on its track. */
.gallery-loading-bar-frame .omni-card__body > .omni-stack > div:first-child {
    border: var(--omni-border-width) dashed var(--omni-color-border);
    border-radius: var(--omni-radius);
    overflow: hidden;
}

/* Side menu page: with the menu at the end the toggle follows it to the end of the header. */
.gallery-shell-stage--end .omni-header {
    flex-direction: row-reverse;
}

.gallery-shell-stage--end .omni-header .omni-sidebar-toggle {
    margin-inline: 0 calc(-1 * var(--omni-header-pad-x));
}
/* Actions, Feedback, Foundations fidelity */

/* The stage: the component under test alone in a dashed frame of a stable height, so the preview does not
   jump when an option changes. The example marks its stage as a group; the page wrapper frames it. */
.gallery-actions-stage [role="group"],
.gallery-feedback-stage [role="group"] {
    border: var(--omni-border-width) dashed var(--omni-color-border);
    border-radius: var(--omni-radius);
    box-sizing: border-box;
    min-block-size: 6rem;
    padding: var(--omni-space-lg);
}

.gallery-actions-stage [role="group"] {
    align-items: center;
    display: flex;
    justify-content: center;
}

/* Buttons: variants as rows, sizes or states as columns; the matrix scrolls in its box on a narrow screen. */
.gallery-buttons-matrix {
    max-inline-size: 100%;
    overflow-x: auto;
}

.gallery-buttons-matrix table {
    border-collapse: collapse;
}

.gallery-buttons-matrix th,
.gallery-buttons-matrix td {
    border-block-end: var(--omni-border-width) solid var(--omni-color-border);
    padding: var(--omni-space-sm) var(--omni-space-md);
    text-align: start;
    vertical-align: middle;
    white-space: nowrap;
}

.gallery-buttons-matrix thead th {
    color: var(--omni-color-text-muted);
    font-size: var(--omni-font-size-sm);
    font-weight: 600;
}

.gallery-buttons-matrix tbody th {
    font-weight: 600;
}

/* Skeletons: a profile row keeps the circle at its own size, the picture at a fixed width and gives the
   lines the room left. */
.gallery-skeletons-profile .omni-row {
    max-inline-size: 32rem;
}

.gallery-skeletons-profile .omni-row > .omni-skeleton--circle {
    flex: 0 0 auto;
}

.gallery-skeletons-profile .omni-row > .omni-skeleton--rectangle {
    flex: 0 0 8rem;
}

/* Icons: a uniform grid of tiles, the icon above its name, the name cut by an ellipsis. */
.gallery-icons-grid .omni-row[role="group"] {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
}

.gallery-icons-grid .omni-row[role="group"] > .omni-button {
    font-weight: 400;
    min-inline-size: 0;
    padding: var(--omni-space-md) var(--omni-space-sm);
}

.gallery-icons-grid .omni-row[role="group"] .omni-button__content {
    flex-direction: column;
    gap: var(--omni-space-xs);
    max-inline-size: 100%;
    min-inline-size: 0;
}

.gallery-icons-grid .omni-row[role="group"] .omni-button__content > span {
    font-size: var(--omni-font-size-sm);
    max-inline-size: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Images: the stage of the single image, then the box an image is asked to fit, imposed in CSS because the
   package leaves the height automatic, so that Natural stretches and Contain and Cover show their frame.
   The boxes are told by the width and height the example writes on the image. */
.gallery-images-stage [role="group"] {
    align-items: center;
    background: var(--omni-color-surface-muted);
    border: var(--omni-border-width) dashed var(--omni-color-border);
    border-radius: var(--omni-radius);
    box-sizing: border-box;
    justify-content: center;
    min-block-size: 14rem;
    padding: var(--omni-space-md);
}

.gallery-images-stage .omni-image[width][height] {
    background: var(--omni-color-surface);
    outline: var(--omni-border-width) dashed var(--omni-color-accent);
}

.gallery-images-stage .omni-image[width="240"][height="120"] {
    block-size: 7.5rem;
    inline-size: 15rem;
}

.gallery-images-stage .omni-image[width="120"][height="200"] {
    block-size: 12.5rem;
    inline-size: 7.5rem;
}

.gallery-images-stage .omni-image[width="160"][height="160"] {
    block-size: 10rem;
    inline-size: 10rem;
}

/* Typography: the stage is narrower than its card and the frames narrower still, so Truncate always has a
   line to cut at every width. */
.gallery-typography-stage [role="group"] {
    border: var(--omni-border-width) dashed var(--omni-color-border);
    border-radius: var(--omni-radius);
    box-sizing: border-box;
    max-inline-size: 28rem;
    padding: var(--omni-space-md);
}

.gallery-typography-narrow [role="group"] {
    border: var(--omni-border-width) dashed var(--omni-color-border);
    border-radius: var(--omni-radius);
    box-sizing: border-box;
    max-inline-size: 20rem;
    padding: var(--omni-space-sm);
}

/* Theme: a scope in the preview shows its edge; the sample sits straight in it, so its colour field or
   canvas is not hidden under a card. */
.gallery-theme-frame .omni-theme-scope {
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius-lg);
    padding: var(--omni-space-lg);
}

/* Scheduling fidelity */

/* Scheduler: the example marks one appointment apart through the Class of the appointment, with an OE
   utility class; the page makes sure that tint wins over the background the view gives an appointment. */
.gallery-scheduler .omni-scheduler__appointment.omni-u-bg-warning-subtle {
    background: var(--omni-color-warning-subtle);
}

/* Tree, spreadsheet, collections fidelity */
/* The examples carry no class of the showcase: each page wraps its example in a gallery-* div and these
   rules reach the Omni* markup inside it. */

/* Hints and echoes: small, muted, free to break anywhere; the figures inside them read in the text colour. */
.gallery-tree-hint,
.gallery-sheet-hint,
.gallery-tree-stage .omni-text--muted,
.gallery-sheet-stage .omni-text--muted {
    font-size: var(--omni-font-size-sm);
    margin: 0;
    overflow-wrap: anywhere;
}

.gallery-tree-hint code,
.gallery-sheet-hint code,
.gallery-tree-stage .omni-text--muted :is(strong, code),
.gallery-sheet-stage .omni-text--muted :is(strong, code) {
    color: var(--omni-color-text);
}

/* Tree page: the hand-written tree and the generated tree are no wider than a navigation tree would be. */
.gallery-tree-capped .omni-tree {
    max-inline-size: 36rem;
}

/* Tree page, moving items: the tree grid sits in a box of fixed height and scrolls inside it, and its rows
   keep a minimum height with their text cut on one line. */
.gallery-tree-move .omni-data-grid {
    block-size: 36rem;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    min-block-size: 0;
}

.gallery-tree-move .omni-data-grid__table > tbody > tr:not(.omni-data-grid__spacer),
.gallery-tree-move .omni-data-grid__table > tbody > tr:not(.omni-data-grid__spacer) > td,
.gallery-tree-move .omni-data-grid__table > tfoot > tr,
.gallery-tree-move .omni-data-grid__table > tfoot > tr > td {
    min-block-size: 2.75rem;
}

.gallery-tree-move .omni-data-grid__table > tbody > tr:not(.omni-data-grid__spacer) > td {
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    white-space: nowrap;
}

/* Spreadsheet page: the column width is the package's variable, redefined on the class of the page. */
.gallery-sheet-stage .omni-spreadsheet {
    --omni-spreadsheet-height: 30rem;
}

.gallery-sheet-narrow .omni-spreadsheet {
    --omni-spreadsheet-column-width: 5.5rem;
}

.gallery-sheet-wide .omni-spreadsheet {
    --omni-spreadsheet-column-width: 10rem;
}

/* Details page: a side panel narrower than the responsive threshold of a description list (30rem). */
.gallery-details-aside {
    max-inline-size: 20rem;
}

/* Spreadsheet page: the echo of the active cell, the total and the size is a compact two-column list. */
.gallery-sheet-stage .omni-description-list {
    font-size: var(--omni-font-size-sm);
    row-gap: var(--omni-space-xs);
}

.gallery-sheet-stage .omni-description-list__item {
    border-block-start: 0;
    padding-block: 0;
}

.gallery-sheet-stage .omni-description-list__label {
    font-weight: 650;
}

/* Spreadsheet page: the JSON of the model scrolls in a box of bounded height. */
.gallery-sheet-stage .omni-code-block__pre {
    max-block-size: 14rem;
    overflow: auto;
    word-break: break-all;
}

/* Charts fidelity */
/* A chart is square and takes the whole width of its card: it is bounded so that it stays readable. A pie
   and its legend are wider than tall, so they share the same cap. */
.gallery-charts-chart,
.gallery-charts-pie {
    max-inline-size: 36rem;
    min-inline-size: 0;
}

/* The figures a chart writes under itself when it is given a data table. */
:is(.gallery-charts-chart, .gallery-charts-pie) .omni-chart__data table {
    border-collapse: collapse;
    font-size: var(--omni-font-size-sm);
    margin-block-start: var(--omni-space-sm);
}

:is(.gallery-charts-chart, .gallery-charts-pie) .omni-chart__data caption {
    font-weight: 650;
    padding-block-end: var(--omni-space-xs);
    text-align: start;
}

:is(.gallery-charts-chart, .gallery-charts-pie) .omni-chart__data :is(th, td) {
    border-block-end: var(--omni-border-width) solid var(--omni-color-border);
    padding: var(--omni-space-xs) var(--omni-space-sm);
    text-align: start;
}

:is(.gallery-charts-chart, .gallery-charts-pie) .omni-chart__data td {
    font-variant-numeric: tabular-nums;
    text-align: end;
}

/* The single gauge is a half circle of a fixed, modest width. */
.gallery-charts-gauge {
    max-inline-size: 22rem;
}

/* The gauge samples: each gauge fills its tile and its caption sits centred under it. */
.gallery-charts-gauges .omni-arc-gauge {
    inline-size: 100%;
}

.gallery-charts-gauges .omni-stack {
    text-align: center;
}

/* Data fidelity: the look of the data pages, kept off the examples (which carry only omni-* classes). */
/* Data grid: the flight number reads as a code, a cancelled flight is struck through, the cabin load is bold above its thresholds. */
.gallery-data-grid td[data-omni-col="Number"] { font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: 0.02em; }
.gallery-data-grid td[data-omni-col="LoadFactor"] { font-variant-numeric: tabular-nums; font-weight: 650; }
.gallery-data-grid .flight-cancelled td { color: var(--omni-color-text-muted); text-decoration: line-through; }
.gallery-data-grid .omni-data-grid__detail .omni-icon { color: var(--omni-color-accent); flex: 0 0 auto; }
.gallery-data-grid .omni-description-list { font-size: var(--omni-font-size-sm); }
/* Data list: a bounded height gives the virtualisation a scroll to follow. */
.gallery-data-list [role="region"], .gallery-data-list-virtual [role="region"] { border: var(--omni-border-width) solid var(--omni-color-border); border-radius: var(--omni-radius); overflow-y: auto; }
.gallery-data-list [role="region"] { max-block-size: 30rem; }
.gallery-data-list-virtual [role="region"] { max-block-size: 16rem; padding: var(--omni-space-sm); }
.gallery-data-list strong { font-variant-numeric: tabular-nums; }
.gallery-data-list-samples { min-inline-size: 0; }
/* Data grid variants: frames of fixed or bounded size. */
.gallery-data-sizing [role="group"][aria-label^="Frame of"], .gallery-data-truncation [role="group"][aria-label^="Frame of"] { max-inline-size: 100%; min-inline-size: 0; }
#demo-grid-fit-box { max-inline-size: 22rem; }
#demo-grid-scope { block-size: 30rem; border: var(--omni-border-width) solid var(--omni-color-border); border-radius: var(--omni-radius); display: flex; flex-direction: column; gap: var(--omni-space-sm); overflow-y: auto; padding: var(--omni-space-md); }
#demo-grid-scope > .omni-text { margin: 0; }
#demo-grid-fill-box { block-size: 36rem; border: var(--omni-border-width) solid var(--omni-color-border); border-radius: var(--omni-radius); display: flex; flex-direction: column; gap: var(--omni-space-md); overflow-y: auto; padding: var(--omni-space-md); }

/* Diagram fidelity */
/* The facts echoed under the map: a label column as wide as its longest label, the values taking the room left. */
.gallery-diagram-facts {
    display: grid;
    gap: var(--omni-space-xs) var(--omni-space-md);
    grid-template-columns: max-content 1fr;
    margin: 0;
}

.gallery-diagram-facts dt {
    color: var(--omni-color-text-muted);
}

.gallery-diagram-facts dd {
    margin: 0;
    min-inline-size: 0;
    overflow-wrap: anywhere;
}

/* Editor fidelity */
/* The examples carry no class of the showcase: each page wraps its example in a gallery-* div and these
   rules reach the Omni* markup inside it. */

/* HTML editor page: the bound HTML rendered outside the editor, in a bordered frame. */
.gallery-editor-rendered .omni-rich-text {
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    padding: var(--omni-space-md);
}

/* Code reading page: a frame of fixed height whose bar belongs to the page; the comparison takes the rest of it. */
.gallery-code-reading-fill > .omni-stack > .omni-stack {
    block-size: 24rem;
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    padding: var(--omni-space-md);
}

/* Drawing pad page: the exported PNG on a chequered backdrop, so that its transparent background shows. */
.gallery-ink-backdrop {
    background-color: var(--omni-color-surface);
    background-image:
        linear-gradient(45deg, var(--omni-color-surface-muted) 25%, transparent 25%, transparent 75%, var(--omni-color-surface-muted) 75%),
        linear-gradient(45deg, var(--omni-color-surface-muted) 25%, transparent 25%, transparent 75%, var(--omni-color-surface-muted) 75%);
    background-position: 0 0, 0.5rem 0.5rem;
    background-size: 1rem 1rem;
    border: var(--omni-border-width) solid var(--omni-color-border);
    border-radius: var(--omni-radius);
    max-inline-size: 100%;
    overflow: auto;
    padding: var(--omni-space-sm);
}

.gallery-ink-backdrop img {
    display: block;
    max-inline-size: 100%;
    block-size: auto;
}

/* Media stage page: a participant is a coloured placeholder (a tint of a theme colour over the surface), the
   place a video tile takes in a real call. The tint keeps the text colour of the theme readable in both modes. */
.gallery-media-placeholder {
    --gallery-media-tint: var(--omni-color-accent);
    align-items: center;
    background-color: color-mix(in srgb, var(--gallery-media-tint) 22%, var(--omni-color-surface));
    color: var(--omni-color-text);
    display: flex;
    flex-direction: column;
    gap: var(--omni-space-xs);
    justify-content: center;
    min-block-size: 0;
    padding: var(--omni-space-xs);
}

.gallery-media-placeholder--2 { --gallery-media-tint: var(--omni-color-success); }
.gallery-media-placeholder--3 { --gallery-media-tint: var(--omni-color-info); }
.gallery-media-placeholder--4 { --gallery-media-tint: var(--omni-color-warning); }
.gallery-media-placeholder--5 { --gallery-media-tint: var(--omni-color-danger); }
.gallery-media-placeholder--6 { --gallery-media-tint: var(--omni-color-text-muted); }
.gallery-media-placeholder--7 { --gallery-media-tint: var(--omni-color-accent-strong); }

.gallery-media-placeholder__initials {
    align-items: center;
    background-color: color-mix(in srgb, var(--gallery-media-tint) 55%, var(--omni-color-surface));
    border-radius: 50%;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-inline-size: 2.25rem;
    aspect-ratio: 1;
}

.gallery-media-placeholder__name {
    font-weight: 600;
    max-inline-size: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Media tile page: two tiles side by side when the page is wide (the second one square, so the same strokes land on a
   picture placed differently), one under the other on a phone. The tile paints its own stage; only the layout is here. */
.gallery-media-tiles {
    align-items: start;
    display: grid;
    gap: var(--omni-space-md);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}

.gallery-media-tile--square { --omni-media-tile-aspect: 1; }

.gallery-media-export {
    border-radius: var(--omni-radius);
    display: block;
    max-inline-size: 100%;
    block-size: auto;
}

/* Structured document page: the style key "emphasis" the example host puts on a run is drawn bold. */
.gallery-structured-emphasis {
    font-weight: 700;
}

/* The map of the Map page: its height through the variable OmniMap reads, lower on a phone. */
.gallery-map {
    --omni-map-height: 28rem;
}

@media (max-width: 40rem) {
    .gallery-map {
        --omni-map-height: 20rem;
    }
}

/* The header row of the demo tables is a tinted band; only the body rows keep their separating lines. */
:is(.gallery-toggles-matrix, .gallery-upload, .gallery-buttons-matrix, .gallery-charts-chart .omni-chart__data, .gallery-charts-pie .omni-chart__data) thead :is(th, td) {
    background: var(--omni-color-surface-muted);
    border-block-end: 0;
}
