/* =====================================================================================================================
   Demo shell: header, navigation drawer, page frame, demo section cards and the home page.
   Mobile first: the base rules are the phone layout, min-width queries add to it. Colours come from the theme's CSS
   variables only, so the shell follows Dark, Light and High Contrast. Mirrored into the WASM host (MirrorDemoAssets).
   ===================================================================================================================== */

.demo-shell {
    /* Fluid spacing: grows with the viewport between a phone and a wide desktop. */
    --demo-space-1: clamp(0.5rem, 0.4rem + 0.5vw, 0.875rem);
    --demo-space-2: clamp(0.75rem, 0.55rem + 1vw, 1.5rem);
    --demo-space-3: clamp(1.25rem, 0.9rem + 1.75vw, 2.5rem);
    --demo-gutter: clamp(0.75rem, 0.45rem + 1.5vw, 2rem);
    --demo-radius: 14px;
    --demo-hairline: color-mix(in srgb, var(--text) 12%, transparent);
    /* Muted text that still reads 4.5:1 on the background and the surface in every theme. */
    --demo-muted: color-mix(in srgb, var(--text) 82%, var(--surface));
    /* Coloured text: a mix with --text keeps it readable on the surface in both themes. */
    --demo-accent-text: color-mix(in srgb, var(--primary) 55%, var(--text));
    --demo-header-height: 56px;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    width: 100%;
    min-width: 0;
    background-color: var(--background);
    color: var(--text);
}

/* ---------------------------------------------------------------------------------------------------------------------
   Header: compact, always on top (the page scrolls inside the drawer container below it).
   --------------------------------------------------------------------------------------------------------------------- */

.demo-header {
    position: sticky;
    top: 0;
    z-index: 6;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    box-sizing: content-box;
    height: var(--demo-header-height);
    /* Clear of the notch / status bar and the rounded corners in landscape (viewport-fit=cover). */
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: max(0.25rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.25rem, env(safe-area-inset-right, 0px));
    background-color: var(--navbar);
    color: var(--text);
    border-bottom: 1px solid var(--demo-hairline);
    box-shadow: 0 2px 12px -6px color-mix(in srgb, var(--black) 45%, transparent);
}

/* The update strip above the header keeps the status bar clear itself: no second inset below it. */
.demo-shell:has(> .dws-update-banner) > .demo-header {
    padding-top: 0;
}

.demo-header__toggle,
.demo-header__actions {
    flex: 0 0 auto;
}

.demo-header__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

/* 44 x 44 touch targets (the icon buttons were 36 x 42). */
.demo-header .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
}

.demo-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 0.25rem;
}

/* The logo is a DwsImage: its wrapper is the flex item, and the circle outranks the image's Shape class. */
.demo-brand > .dws-image-wrapper {
    display: flex;
    flex: 0 0 auto;
}

.demo-brand .dws-image.demo-brand__logo {
    border-radius: 50%;
}

.demo-brand__logo {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 4px;
    border-radius: 50%;
    background-color: var(--primary);
    cursor: pointer;
}

.demo-brand__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
    line-height: 1.2;
}

.demo-brand__eyebrow,
.demo-brand__title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.demo-brand__eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--demo-accent-text);
}

.demo-brand__title {
    font-size: clamp(1rem, 0.92rem + 0.4vw, 1.2rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.demo-brand__title-short {
    display: none;
}

/* The full title needs about 200px: below 380px the short one is shown, the full one stays for screen readers. */
@media (max-width: 379.98px) {
    .demo-brand {
        gap: 0.5rem;
        padding-left: 0;
    }

    .demo-brand__logo {
        width: 32px;
        height: 32px;
    }

    .demo-brand__title-full {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .demo-brand__title-short {
        display: inline;
    }
}

@media (min-width: 992px) {
    .demo-shell {
        --demo-header-height: 60px;
    }

    .demo-header {
        padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
        padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    }
}

/* ---------------------------------------------------------------------------------------------------------------------
   User menu (Shared/DemoUserMenu.razor, ported from ReClaim ReGear's UserMenu): the header's right-hand menu with the
   account and help pages and the settings.
   --------------------------------------------------------------------------------------------------------------------- */

.demo-user-menu {
    position: relative;
}

.demo-user-menu__button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    padding: 0 0.5rem;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.demo-user-menu__button:hover,
.demo-user-menu__button[aria-expanded="true"] {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.demo-user-menu__button:focus-visible,
.demo-user-menu__item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.demo-user-menu__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    /* A tinted circle with --text: --primary-text on --primary reads only 2.84:1. */
    background: color-mix(in srgb, var(--primary) 28%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 60%, transparent);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
}

.demo-user-menu__name {
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Catches the click outside the panel; transparent, the page stays visible. */
.demo-user-menu__backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.demo-user-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 41;
    min-width: 16rem;
    max-width: calc(100vw - 1rem);
    max-height: calc(100dvh - var(--demo-header-height) - 1rem);
    overflow-y: auto;
    padding: 0.375rem;
    border: 1px solid var(--demo-hairline);
    border-radius: 12px;
    background: var(--surface, var(--background));
    color: var(--text);
    box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--black) 55%, transparent);
}

/* Static SSR demo: the panel is a native popover in the top layer, placed under the header's right edge. */
.demo-user-menu__panel[popover] {
    position: fixed;
    inset: auto;
    top: calc(var(--demo-header-height, 3.5rem) + 0.25rem);
    right: 0.5rem;
    margin: 0;
}

.demo-user-menu__header {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    padding: 0.5rem 0.625rem 0.625rem;
    border-bottom: 1px solid var(--demo-hairline);
    margin-bottom: 0.25rem;
}

.demo-user-menu__meta {
    color: var(--demo-muted);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.demo-user-menu__group + .demo-user-menu__group {
    margin-top: 0.25rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--demo-hairline);
}

.demo-user-menu__group-title {
    display: block;
    padding: 0.375rem 0.625rem 0.25rem;
    color: var(--demo-accent-text);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.demo-user-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.demo-user-menu__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 40px;
    padding: 0 0.625rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.demo-user-menu__item:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--text);
}

.demo-user-menu__item[aria-current="page"] {
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    font-weight: 600;
}

.demo-user-menu__sep {
    height: 1px;
    margin: 0.25rem 0;
    background: var(--demo-hairline);
}

/* Touch screens: 44px rows like the drawer's. */
@media (pointer: coarse) {
    .demo-user-menu__item {
        min-height: 44px;
    }
}

/* ---------------------------------------------------------------------------------------------------------------------
   Navigation drawer
   --------------------------------------------------------------------------------------------------------------------- */

/* As an overlay (below lg) the drawer leaves at least 15% of the screen for the backdrop, which closes it on a tap. Side
   drawers only: a bottom sheet (a DwsDataGrid filter panel on a phone) keeps the full width. */
.demo-shell .dws-drawer--overlay:not(.dws-drawer--bottom) {
    max-width: min(300px, 85vw);
}

.demo-shell .dws-drawer__content {
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
}

/* Comfortable rows on touch screens and in the overlay drawer: 44px items, search field and clear button. */
@media (max-width: 991.98px), (pointer: coarse) {
    .demo-shell .dws-drawer .dws-list-item {
        min-height: 44px;
    }

    .demo-shell .dws-drawer .input-group .form-control,
    .demo-shell .dws-drawer .dws-adornment {
        min-height: 44px;
    }

    .demo-shell .dws-drawer .dws-adornment {
        min-width: 44px;
        justify-content: center;
    }
}

/* ---------------------------------------------------------------------------------------------------------------------
   Page frame
   --------------------------------------------------------------------------------------------------------------------- */

.demo-shell .dws-main-content {
    padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

.demo-shell .basepage {
    padding-inline: var(--demo-gutter);
}

/* Page titles are single long component names (DwsDateTimeRangePicker): they scale with the viewport and, as a last
   resort, break inside the word instead of running out of the page. */
.demo-shell .basepage h1 {
    margin-top: var(--demo-space-2);
    margin-bottom: var(--demo-space-1);
    font-size: clamp(1.6rem, 1.1rem + 2.4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.015em;
    overflow-wrap: anywhere;
}

.demo-shell .basepage h1 + p {
    max-width: 75ch;
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
    color: var(--demo-muted);
}

/* Demo sections: cards with fluid spacing and a calm outline instead of a hard edge. */
.demo-shell .dws-demo-section-paper-style {
    margin-top: var(--demo-space-3);
    padding: var(--demo-space-2);
    border: 1px solid var(--demo-hairline);
    border-radius: var(--demo-radius);
}

.demo-shell .dws-demo-section-head-text {
    margin-bottom: 0.5rem;
    font-size: clamp(1.15rem, 1rem + 0.75vw, 1.5rem);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.demo-shell .dws-demo-section-description {
    max-width: 80ch;
    color: var(--demo-muted);
}

.demo-shell .dws-demo-section-controls,
.demo-shell .dws-demo-section-example {
    border-width: 2px;
}

.demo-shell .dws-demo-section-controls {
    border-bottom-width: 0;
    border-radius: var(--demo-radius) var(--demo-radius) 0 0;
    margin-bottom: 0;
}

.demo-shell .dws-demo-section-example {
    padding: var(--demo-space-1);
    border-radius: 0 0 var(--demo-radius) var(--demo-radius);
}

@media (pointer: coarse) {
    .demo-shell .dws-demo-section-controls .btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Phones: the page-tool handles in the bottom corners are 44px tall, a little see-through until used, and the page
   ends with room below its last line so nothing stays hidden under them (or under the home indicator). */
@media (max-width: 575.98px) {
    .demo-shell .dws-basepage-frame {
        --dws-basepage-anchor-button-size: 2.75rem;
        --dws-basepage-anchor-margin: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .demo-shell .dws-basepage-anchor__handle {
        opacity: 0.8;
    }

    .demo-shell .dws-basepage-anchor__handle:hover,
    .demo-shell .dws-basepage-anchor__handle:focus-visible,
    .demo-shell .dws-basepage-anchor__handle[aria-expanded="true"] {
        opacity: 1;
    }

    .demo-shell .basepage {
        padding-bottom: calc(2.75rem + 24px);
    }
}

/* ---------------------------------------------------------------------------------------------------------------------
   Home page
   --------------------------------------------------------------------------------------------------------------------- */

.demo-home {
    display: flex;
    flex-direction: column;
    gap: var(--demo-space-3);
    padding-block: var(--demo-space-2) var(--demo-space-3);
}

.demo-home__hero {
    padding: var(--demo-space-3) var(--demo-space-2);
    border: 1px solid var(--demo-hairline);
    border-radius: calc(var(--demo-radius) + 4px);
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 18%, var(--surface)), var(--surface) 70%);
}

.demo-home__eyebrow {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--demo-accent-text);
}

.demo-shell .basepage .demo-home__hero h1 {
    margin-top: 0;
}

.demo-home__lead {
    max-width: 62ch;
    margin: 0;
    font-size: clamp(1rem, 0.95rem + 0.35vw, 1.2rem);
    color: var(--demo-muted);
}

.demo-home__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: var(--demo-space-2);
}

.demo-home__button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.5rem 1.125rem;
    border: 2px solid var(--primary);
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
    background-color: transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

/* The buttons are DwsLinks and a DwsButton, whose icons bring their own 0.5rem end margin; the links keep full opacity
   on hover (the background marks it). */
.demo-home__button:is(.dws-link, .btn) {
    gap: 0;
    --dws-link-hover-opacity: 1;
}

.demo-home__card.dws-link {
    --dws-link-hover-opacity: 1;
}

.demo-home__button--primary {
    /* --black on primary lightened with --white: 7:1 or more in every theme (the theme primary-text is 2.8:1 in Light). */
    color: var(--black);
    background-color: color-mix(in srgb, var(--primary) 70%, var(--white));
}

.demo-home__button:hover,
.demo-home__button:focus-visible {
    color: var(--text);
    background-color: color-mix(in srgb, var(--primary) 22%, transparent);
}

.demo-home__button--primary:hover,
.demo-home__button--primary:focus-visible {
    color: var(--black);
    background-color: color-mix(in srgb, var(--primary) 55%, var(--white));
}

.demo-home__section-title {
    margin: 0 0 var(--demo-space-1);
    font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
    font-weight: 700;
}

.demo-home__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
    gap: var(--demo-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.demo-home__card {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    height: 100%;
    min-height: 44px;
    padding: var(--demo-space-2);
    border: 1px solid var(--demo-hairline);
    border-radius: var(--demo-radius);
    background-color: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.demo-home__card:hover,
.demo-home__card:focus-visible {
    color: var(--text);
    border-color: var(--primary);
}

@media (prefers-reduced-motion: no-preference) {
    .demo-home__card:hover {
        transform: translateY(-2px);
    }
}

.demo-home__card-icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 12px;
    font-size: 1.125rem;
    color: var(--demo-accent-text);
    background-color: color-mix(in srgb, var(--primary) 16%, transparent);
}

.demo-home__card-title {
    display: block;
    font-weight: 700;
}

.demo-home__card-text {
    display: block;
    margin-top: 0.125rem;
    font-size: 0.9rem;
    color: var(--demo-muted);
}

.demo-home__status {
    padding: var(--demo-space-2);
    border: 1px solid var(--demo-hairline);
    border-radius: var(--demo-radius);
    background-color: var(--surface);
}

.demo-home__status-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.375rem 1rem;
    margin: 0;
}

.demo-home__status-grid dt {
    font-weight: 400;
    color: var(--demo-muted);
}

.demo-home__status-grid dd {
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.demo-home__status-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--demo-space-1);
}

.demo-home__status-dot {
    flex: 0 0 auto;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    background-color: var(--error);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--error) 25%, transparent);
}

.demo-home__status-dot--excellent { background-color: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 25%, transparent); }
.demo-home__status-dot--good { background-color: var(--info); box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 25%, transparent); }
.demo-home__status-dot--fair { background-color: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 25%, transparent); }

.demo-home__meta {
    margin: var(--demo-space-1) 0 0;
    font-size: 0.875rem;
    color: var(--demo-muted);
    overflow-wrap: anywhere;
}

/* "Go to Home" on /access-denied: a 44px target in a colour that reads 4.5:1 in every theme (plain --link was 3.99:1). */
.demo-access-denied__home {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: 0.5rem;
    color: color-mix(in srgb, var(--link) 60%, var(--text));
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------------------------------------------------------------------------------------------------------------------
   Document pages (About, Installation): a hero, then one card per topic. Code blocks scroll inside their card, never
   the page; the copy button is a 44px target on touch screens.
   --------------------------------------------------------------------------------------------------------------------- */

.demo-doc {
    display: flex;
    flex-direction: column;
    gap: var(--demo-space-2);
    max-width: 72rem;
    min-width: 0;
    padding-block: var(--demo-space-1) var(--demo-space-3);
}

.demo-doc__eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--demo-accent-text);
}

.demo-shell .basepage .demo-doc__hero h1 {
    margin-top: 0;
}

.demo-shell .basepage .demo-doc__lead {
    max-width: 70ch;
    margin: 0;
    font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
    color: var(--demo-muted);
}

.demo-doc__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: var(--demo-space-1) 0 0;
}

.demo-doc__card {
    min-width: 0;
    padding: var(--demo-space-2);
    border: 1px solid var(--demo-hairline);
    border-radius: var(--demo-radius);
    background-color: var(--surface);
    color: var(--text);
}

.demo-doc__card > :last-child {
    margin-bottom: 0;
}

.demo-doc__title {
    margin: 0 0 var(--demo-space-1);
    font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
    font-weight: 700;
    line-height: 1.25;
}

.demo-doc__subtitle {
    margin: var(--demo-space-2) 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.demo-doc__list {
    margin: 0 0 var(--demo-space-1);
    padding-inline-start: 1.25rem;
}

.demo-doc__list li + li {
    margin-top: 0.375rem;
}

.demo-doc__toc {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
    gap: 0 var(--demo-space-1);
    margin: 0;
    padding-inline-start: 1.5rem;
}

.demo-doc__toc a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: color-mix(in srgb, var(--link) 60%, var(--text));
    text-underline-offset: 3px;
}

.demo-doc__facts {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    gap: 0.5rem 1rem;
    margin: 0 0 var(--demo-space-1);
}

.demo-doc__facts dt {
    font-weight: 400;
    color: var(--demo-muted);
}

.demo-doc__facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.demo-doc__card code {
    overflow-wrap: anywhere;
}

/* Prose names API members in plain text too (AddILoggerToDwsLoggerServiceAdapter() on /install pushed the page 12 px
   sideways at 320 px). Breaks only a word that does not fit. */
.demo-doc__card :is(p, li, dd, h2, h3) {
    overflow-wrap: anywhere;
}

/* Phones: label above value, so a long runtime description does not squeeze the labels. */
@media (max-width: 479.98px) {
    .demo-doc__facts {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.125rem;
    }

    .demo-doc__facts dd + dt {
        margin-top: 0.5rem;
    }
}

.demo-doc__note {
    font-size: 0.9rem;
    color: var(--demo-muted);
}

.demo-doc__callout {
    margin: var(--demo-space-1) 0;
    padding: var(--demo-space-1) var(--demo-space-2);
    border-inline-start: 4px solid var(--warning);
    border-radius: 0 var(--demo-radius) var(--demo-radius) 0;
    background-color: color-mix(in srgb, var(--warning) 12%, var(--surface));
}

.demo-doc__callout p {
    margin: 0.25rem 0 0;
}

.demo-doc__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: var(--demo-space-1);
}

.demo-doc__code {
    max-width: 100%;
    height: auto;
    margin: 0.5rem 0 var(--demo-space-1);
    padding: 0.75rem;
    border: 1px solid var(--demo-hairline);
    border-radius: calc(var(--demo-radius) - 4px);
    background-color: var(--background);
}

.demo-doc__code pre {
    max-height: 28rem;
    margin: 0;
    overflow: auto;
    font-size: 0.85rem;
}

.demo-doc__code pre code {
    overflow-wrap: normal;
}

/* The DwsClipboard of a snippet: above the code, not floated beside it (a float would narrow the scrolling <pre> on
   phones), aligned to the end, with its "Copied" / error line wrapping in front of the button on a narrow screen. */
.dws-clipboard.demo-doc__copy-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin: 0 0 0.5rem;
}

.demo-doc__copy-row :is(.copy-success, .copy-error) {
    order: -1;
    white-space: normal;
}

.demo-doc__copy {
    min-height: 32px;
}

@media (pointer: coarse) {
    .demo-doc__copy {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Settings dialog: the check box labels are the tap targets; on a touch screen each row is at least 44px tall. */
@media (pointer: coarse) {
    .demo-settings .dws-checkbox-label {
        display: flex;
        align-items: center;
        min-height: 44px;
    }
}

/* Headings: DwsTypography Heading1-4 scale with the viewport and break a word that is too long in the library itself
   (0.1.5), so the page titles and section headings need no rules of their own here. A paragraph can still hold a long
   component name such as "DwsDateTimeRangePicker". */
.demo-main p.dws-typography {
    overflow-wrap: anywhere;
}

/* Back / Forward of the navigation service (IDwsNavigationService), right before the personal menu. */
.demo-header__history {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    margin-left: auto;
}

.demo-header__history + .demo-header__actions {
    margin-left: 0;
}

/* The navigation demo (Pages/Components/Navigation.razor). */
.navigation-demo__facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
}

.navigation-demo__facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.navigation-demo__journal {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.navigation-demo__entry--current {
    font-weight: 600;
}

.navigation-demo__stack {
    height: 280px;
    overflow: hidden;
}

.navigation-demo__platforms th[scope="row"] {
    white-space: nowrap;
}

/* The platform in effect. */
.navigation-demo__platform--current {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    font-weight: 600;
}

/* Previous / next component page at the end of every component page (DemoPageNavigation). Two cards side by side; on a
   phone they stack, previous first, each the full width. */
.demo-page-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--dws-space-3, 1rem);
    margin: var(--dws-space-5, 2rem) 0 var(--dws-space-3, 1rem);
}

.demo-page-nav__link {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
    border-radius: var(--border-radius);
    color: var(--text);
    text-decoration: none;
}

.demo-page-nav__link:hover,
.demo-page-nav__link:focus-visible {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.demo-page-nav__link--next {
    grid-column: 2;
    align-items: flex-end;
    text-align: end;
}

.demo-page-nav__direction {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: color-mix(in srgb, var(--text) 82%, transparent);
}

.demo-page-nav__title {
    max-width: 100%;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .demo-page-nav {
        grid-template-columns: minmax(0, 1fr);
    }

    .demo-page-nav__link--next {
        grid-column: 1;
    }
}

/* App update demo, "The app's own offline notice": a page in miniature, the banner above its content. */
.demo-appupdate-frame {
    border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
    border-radius: var(--border-radius);
    overflow: visible;
}

.demo-appupdate-frame__page {
    padding: 1.5rem 1rem;
    color: color-mix(in srgb, var(--text) 82%, var(--surface));
}
