/* ═══════════════════════════════════════════════════════════════
   DEMO SHELL — what is the same in every demo (owner, 2026-11-26; DAMA is the reference).
   Loaded last by the seven demos. Each demo keeps its palette and fonts.
   ═══════════════════════════════════════════════════════════════ */

/* The scrollbar's room is always kept: the name does not move from one page to the other. */
html { scrollbar-gutter: stable; }

/* ── Home: a filled house with no box, so it never looks like the selected tab. ──
   :not(#mv) only raises the weight above each demo's own rules. On DAMA's dark phone bar the house is inverted. */
html body a:is(.back-arrow, .fx-home):not(#mv), html body a:is(.back-arrow, .fx-home):not(#mv):is(:hover, :active) { background: transparent; border-color: transparent; box-shadow: none; }
html body a:is(.back-arrow, .fx-home):not([hidden]):not(#mv) { display: grid; place-items: center; padding: 0; }
html body a:is(.back-arrow, .fx-home):not(#mv) svg.mv-house { display: block; width: 40px; height: 40px; fill: currentColor; stroke: none; transition: transform .15s ease; }
html body a:is(.back-arrow, .fx-home):not(#mv):hover svg.mv-house { transform: translateY(-1px) scale(1.05); }
@media (max-width: 640px) {
    html body[data-hero] a.back-arrow:not(#mv) { color: #f3f7f4; }
}

/* ── The demo's name: centred over the page, its letters standing on the foot of the house. ──
   --mv-foot is that line, measured from the top: the house ends at 41/48 of its drawing. The name box starts at the
   top of the bar; its ::before is an empty strut as tall as the line, and flex baseline alignment puts the text on it. */
html { --mv-foot: 54px; }                                            /* 16 + (48 - 40) / 2 + 40 * 41 / 48 */
@media (max-width: 640px) { html { --mv-foot: 44px; } }              /*  8 + (44 - 40) / 2 + 40 * 41 / 48 */
html body :is(.dm-wm, .fx-wm, .ms-name, .nq-wm, .st-wm, .kx-wm, .pv-wm):not(#mv) {
    position: absolute; grid-area: auto / 1 / auto / -1; justify-self: stretch; top: 0; bottom: auto; left: 0; right: 0; width: max-content; margin-inline: auto !important; transform: none;
    display: flex; flex-wrap: nowrap; align-items: baseline; justify-content: center;
    height: auto; min-height: 0; margin-top: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; zoom: 1; white-space: nowrap; line-height: 1.2;
}
html body :is(.dm-wm, .fx-wm, .ms-name, .nq-wm, .st-wm, .kx-wm, .pv-wm)::before { content: ""; align-self: baseline; width: 0; height: var(--mv-foot); margin: 0; padding: 0; border: 0; background: none; flex: none; }
/* the same empty box after the name: where its parts have a gap, the strut's gap is matched and the name stays centred */
html body :is(.dm-wm, .fx-wm, .ms-name, .nq-wm, .st-wm, .kx-wm, .pv-wm)::after { content: ""; width: 0; height: 0; flex: none; }
html body :is(.ms-name, .nq-wm) svg { align-self: baseline; }
html body .fx-wm > * { align-self: baseline; }
html body .st-wm > b { align-self: baseline; }
/* the name is the way back to the project's main page (owner, 2026-11-27) */
html body a:is(.dm-wm, .fx-wm, .ms-name, .nq-wm, .st-wm, .kx-wm, .pv-wm):not(#mv) { text-decoration: none; cursor: pointer; pointer-events: auto; transition: opacity .15s ease; }   /* the top band lets clicks through: the name takes them (owner, 2026-11-29) */
html body a:is(.dm-wm, .fx-wm, .ms-name, .nq-wm, .st-wm, .kx-wm, .pv-wm):not(#mv):hover { opacity: .88; }

/* Herald's name is a pill (the way to the posts page, with the page picker beside it), exactly as tall as the house
   that is drawn: same top, same foot (owner, 2026-11-27). The drawing spans 8..41 of its 48, so 40px * 33 / 48.
   A name on two lines fits inside it. */
html body[data-engine] > header.hq-hd .hdr-right:not(#mv) { position: static; }
html body[data-engine] > header.hq-hd .hd-menu:not(#mv) { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-end; height: var(--mv-foot); width: max-content; max-width: min(520px, calc(100% - 136px)); margin: 0 auto; padding: 0; }
html body[data-engine] > header.hq-hd .hd-menu .hd-menu__btn:not(#mv) { display: flex; align-items: center; gap: 0; width: auto; max-width: 100%; min-width: 0; min-height: 0; height: 27.5px; box-sizing: border-box; margin: 0; padding: 0; border: 1px solid var(--q-line-2, #d7dbe2); border-radius: 14px; background: #fff; line-height: 1.2; justify-content: center; cursor: auto; }
html body[data-engine] > header.hq-hd .hd-menu__btn:not(#mv)::after { content: none; }
html body[data-engine] > header.hq-hd .hd-menu__btn > .hd-home:not(#mv) { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; align-self: stretch; min-height: 0; padding: 0 10px; border-radius: 14px; color: inherit; text-decoration: none; }
html body[data-engine] > header.hq-hd .hd-home > :not(.hd-ctx):not(#mv) { flex: none; }
html body[data-engine] > header.hq-hd .hd-menu__btn .hd-ctx:not(#mv) { display: block; flex: 0 1 auto; min-width: 0; font-size: 13px; line-height: 15px; text-align: left; }
html body[data-engine] > header.hq-hd .hd-menu__btn .hd-ctx b:not(#mv) { display: block; white-space: normal; overflow-wrap: anywhere; line-height: inherit; max-height: 25px; overflow: hidden; text-overflow: clip; }
html body[data-engine] > header.hq-hd .hd-menu__btn > .hd-pick:not(#mv) { position: relative; display: grid; place-items: center; flex: none; align-self: stretch; width: 30px; min-height: 0; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--q-line, #e6e9ee); border-radius: 0 14px 14px 0; background: none; color: inherit; cursor: pointer; }
/* 44px targets, 28px to the eye */
html body[data-engine] > header.hq-hd :is(.hd-home, .hd-pick):not(#mv)::after { content: ""; position: absolute; inset: -9px 0; }
html body[data-engine] > header.hq-hd .hd-home > :not(.hd-ctx):not(#mv) { width: 17px; height: 17px; }
/* from the tablet up the whole name is on one line, never cut */
@media (min-width: 641px) {
    html body[data-engine] > header.hq-hd .hd-menu:not(#mv):not(#mw) { max-width: calc(100% - 136px); }
    html body[data-engine] > header.hq-hd .hd-menu__btn .hd-ctx b:not(#mv) { white-space: nowrap; overflow-wrap: normal; max-height: none; }
}
/* a long name takes two smaller lines inside the pill; a very long one a third, the pill growing upwards (its foot stays on the house's), never cut */
@media (max-width: 640px) {
    html body[data-engine] > header.hq-hd .hd-menu__btn .hd-ctx:not(#mv):not(#mw), html body[data-engine] > header.hq-hd .hd-menu__btn .hd-ctx b:not(#mv):not(#mw) { font-size: 11.5px; line-height: 12.5px; }
    html body[data-engine] > header.hq-hd .hd-menu__btn .hd-ctx b:not(#mv):not(#mw) { max-height: none; }
    html body[data-engine] > header.hq-hd .hd-menu .hd-menu__btn:not(#mv):not(#mw) { height: auto; min-height: 27.5px; max-height: var(--mv-foot); }
}

/* ── Info: the buttons are symbols alone and the whole row is the button. ── */
html body .mv-row { position: relative; cursor: pointer; }
html body .mv-go:not(#mv) { display: grid; place-items: center; flex: none; width: 36px; height: 36px; min-width: 36px; max-width: 36px; padding: 0; gap: 0; }
html body .mv-row .mv-go:not(#mv) { position: static; }
html body .mv-row .mv-go:not(#mv)::before { content: none; }
html body .mv-row a.mv-go:not(#mv)::after { content: ""; display: block; position: absolute; inset: 0; z-index: 1; width: auto; height: auto; border: 0; border-radius: 12px; background: none; transform: none; }
html body .mv-row:has(a.mv-go:focus-visible) { outline: 2px solid currentColor; outline-offset: 2px; }
html body .mv-row:has(a.mv-go):hover { filter: brightness(.975); }
html body a.res-item .res-item__go.mv-go:not(#mv)::after, html body a.res-item .res-item__go.mv-go:not(#mv)::before { content: none; }
html body .mv-go .mv-sr:not(#mv) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html body .mv-go svg.mv-ico:not(#mv) { display: block; width: 18px; height: 18px; margin: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Test pages: the base address and its choice on one line, centred on each other. ── */
html body .mv-target.mv-target { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "k code"; align-items: center; justify-items: start; gap: 8px 16px; }
html body .mv-target__k { grid-area: k; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .7; line-height: 1.3; }
html body .mv-target > code { grid-area: code; display: block; max-width: 100%; margin: 0; padding: 5px 8px; border-radius: 6px; background: rgba(127, 139, 150, .14); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
@media (max-width: 640px) {
    html body .mv-target.mv-target { grid-template-columns: minmax(0, 1fr); grid-template-areas: "k" "code"; gap: 6px 12px; }
}

/* A small movement on a click, the same in every demo; none with reduced motion. */
@media (prefers-reduced-motion: no-preference) {
    html body .mv-row:has(a.mv-go) { transition: transform .12s ease, filter .15s ease; }
    html body .mv-row:has(a.mv-go):active { transform: scale(.99); }
}

/* ── The end of a page: room under the last line, so the sections bar of a phone and whatever floats over it
   (--mv-lift: a demo's own bar or button) cover nothing. There is no back-to-top button (owner, 2026-11-29). ── */
html body :is(.content:not(.st-classic), .fx-main, .st-main):not(#mv):not(#mw) { padding-bottom: 48px; }
@media (max-width: 640px) {
    html body :is(.content:not(.st-classic), .fx-main, .st-main):not(#mv):not(#mw) { padding-bottom: calc(100px + var(--mv-lift, 0px) + env(safe-area-inset-bottom)); }
}

/* ── The air under the top band (owner, 2026-11-27): the first thing on every page of every demo starts at the same
   height, the one of DAMA's «Cerca». Each demo applies it to its own container, at the end of its stylesheet. ── */
html { --mv-top: 84px; }
@media (max-width: 640px) { html { --mv-top: 80px; } }

/* ── Test pages (owner, 2026-11-27): the same sizes in every demo, none of them large. ── */
html body :is(#testing-preset, #testing-method-display):not(#mv):not(#mw) { font-size: 13px; }
html body #testing-payload:not(#mv):not(#mw) { font-size: 12.5px; line-height: 1.55; }
html body :is(.test-result, #testing-result, #testing-response):not(#mv):not(#mw) { font-size: 12.5px; line-height: 1.55; }
/* «Run test» and «New test» take their whole row (owner, 2026-11-27: half a row looked unfinished). */
html body :is(#testing-run, button[onclick="resetTest()"]):not(#mv):not(#mw) { display: flex; align-items: center; justify-content: center; width: 100%; max-width: none; min-height: 46px; margin-left: 0; margin-right: 0; align-self: stretch; justify-self: stretch; }
html body :is(.tf):has(> :is(#testing-run, button[onclick="resetTest()"])) { display: block; width: 100%; }

/* Info, two columns (owner, 2026-11-29): no card grows because the other column is longer. js/info-fit.js lets one card
   close a small gap (never Risorse); in the Support or Test card the row inside fills what it gained. */
html body [data-mv-fit="extra"].mv-fit-grow:not(#mv), html body [data-mv-fit].mv-fit-grow:not(#mv):has(> .info-box) { display: flex; flex-direction: column; }
html body [data-mv-fit].mv-fit-grow:not(#mv) > .info-box { flex: 1 1 auto; }
html body [data-mv-fit="extra"].mv-fit-grow:not(#mv) > :last-child { flex: 1 1 auto; }
html body [data-mv-fit="extra"].mv-fit-grow:not(#mv) > .info-box { display: flex; flex-direction: column; }
html body [data-mv-fit="extra"].mv-fit-grow:not(#mv) > .info-box > :last-child { flex: 1 1 auto; }
