/* ============================================================================
   demo-stand.css: the CI4 STAND TOOLBAR (stand-restructure-spec.md §2).

   The one slim demo-chrome bar above the product website. Written for the CI4
   stand, but NOT CI4-only any more: the Joomla template (tpl_fw_demo) and the WP
   theme (fw-demo) ship a copy of this file and reproduce the same toolbar with
   the same classes, so a rule added here must be re-copied into both mirrors
   (that is what makes their popover's role rows look identical). Colors via
   the stand's --demo-* tokens (demo-tokens-fwre.css); the product site below is
   styled by the active design's own files. Replaces the retired sidebar
   demo-frame chrome (demo-frame.css).
   ============================================================================ */

body.demo-stand-layout {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--demo-bg);
    color: var(--demo-ink);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.demo-stand-layout .fwre-site-main { flex: 1; }   /* footer pins to the viewport bottom on short pages */

.demo-stand {
    position: sticky;
    top: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 4px 14px;
    background: var(--demo-topbar);
    border-bottom: 1px solid var(--demo-border);
    box-shadow: var(--demo-shadow-sm);
    font-size: 0.82rem;
}

/* Baseline: the small suffix sits on the brand text's baseline (not v-centered); the icon re-centers itself. */
.demo-stand-brand { display: inline-flex; align-items: baseline; gap: 7px; color: var(--demo-ink); text-decoration: none; font-size: 1.2rem; font-weight: 600; white-space: nowrap; }
.demo-stand-brand img { width: 22px; height: 22px; border-radius: 5px; display: block; align-self: center; }
/* Fixed rem: the suffix keeps its original size (0.82rem bar font x 80%), independent of the enlarged brand. */
.demo-stand-brand small { font-size: 0.656rem; font-weight: 500; color: var(--demo-ink-muted); }

/* True viewport centering (absolute, not flex:1): the center group must not move when a
   side grows - e.g. the reset pill enlarging on hover. The 768px query still hides it. */
.demo-stand-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap; }
.demo-stand-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }

/* Shared pill (badge, links, toggles): compact stand idiom. */
.demo-stand-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--demo-border-strong);
    border-radius: 999px;
    background: var(--demo-hover);
    color: var(--demo-ink);
    text-decoration: none;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color var(--demo-fast) var(--demo-ease), color var(--demo-fast) var(--demo-ease);
}
.demo-stand-pill:hover { background: var(--demo-surface-2); }
.demo-stand-pill:focus-visible { outline: 2px solid var(--demo-accent); outline-offset: 2px; }
.demo-stand-pill[aria-pressed="true"] { color: var(--demo-on-accent); background: var(--demo-gradient); border-color: transparent; }

.demo-stand-version { font-variant-numeric: tabular-nums; }
.demo-stand-version b { font-weight: 700; }
.demo-stand-clock { font-variant-numeric: tabular-nums; font-weight: 700; }

/* CTA — deliberately NOT a pill: amber, bigger, near-square corners, matching the
   official design's Download button (#FFBF00 / #323232 ink / 3px radius / 37px). */
.demo-stand-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 37px;
    padding: 0 20px;
    border-radius: 3px;
    background: var(--demo-cta);
    color: var(--demo-on-cta);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: filter var(--demo-fast) var(--demo-ease);
}
.demo-stand-cta:hover { filter: brightness(1.08); color: var(--demo-on-cta); }

/* Reset pill: collapsed label that enlarges the pill on hover (the retired
   demo-frame.css .demo-reset-badge contract, ported to the stand). Margins, not the
   pill's flex gap, space the label so the collapsed state adds no double gap. */
.demo-stand-reset { gap: 0; }
.demo-stand-reset > [fwk-icon] { margin-right: 6px; }
.demo-stand-reset-label {
    font-size: 0.7rem;
    color: var(--demo-ink-muted);
    white-space: nowrap;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    margin-right: 0;
    transition: max-width 0.35s ease, opacity 0.25s ease, margin-right 0.35s ease;
}
.demo-stand-reset:hover .demo-stand-reset-label { max-width: 8rem; opacity: 1; margin-right: 6px; }

/* The stand reuses the demo-lang select + devview toggle contracts from the frame.
   (Theme toggle retired: the stand is dark-only.) The select is skinned to the pill
   idiom explicitly: it is a native <select>, and without these the browser's default
   light UA styling shows (the old dark skin retired with demo-frame.css). */
.demo-stand .demo-lang-select {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    font: inherit;
    border-radius: 999px;
    border: 1px solid var(--demo-border-strong);
    background: var(--demo-hover);
    color: var(--demo-ink);
    cursor: pointer;
}
.demo-stand .demo-lang-select:hover { background: var(--demo-surface-2); }

/* Admin-demo popover (foundation drop; carries the demo logins + reset hint). Closed by default —
   same FOUC guard as .fwre-ms-drop (docs/engineering-gotchas.md "FOUC"): this carries the fwk-drop
   ATTRIBUTE for JS behaviour but not the framework's own .fwk-drop CLASS, so it never inherited
   fw-uikit's baseline .fwk-drop{display:none} — it rendered fully expanded for one paint before the
   fwk-drop JS component attached and collapsed it. Gate on .fwk-open (the class the JS already
   toggles), mirroring the framework's own pattern. */
.demo-stand-about { display: none; }
.demo-stand-about.fwk-open {
    display: block;
    width: 330px;   /* the one-click role rows below need this much for name + credentials */
    padding: 14px 16px;
    border: 1px solid var(--demo-border-strong);
    border-radius: var(--demo-radius);
    background: var(--demo-surface);
    box-shadow: var(--demo-shadow);
    color: var(--demo-ink);
    font-size: 0.8rem;
}
.demo-stand-about dl { margin: 0; }
.demo-stand-about dt { color: var(--demo-ink-muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 14px; }
.demo-stand-about dt:first-child { margin-top: 0; }
.demo-stand-about dt a { color: var(--demo-accent); text-decoration: none; }
.demo-stand-about dt a:hover { text-decoration: underline; }
.demo-stand-about dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; }
.demo-stand-about p { margin: 6px 0 0; color: var(--demo-ink-muted); }

/* ── One-click demo role switch (.demo-roles, app/Views/layouts/_demo_roles.php) ──────────────────
   Shared by the two surfaces that publish the demo logins: this popover and the /login page (which
   links this sheet for exactly that reason — the component is defined ONCE). Each row is a submit
   button, so it must be reset out of the browser's button chrome and back into a link-like row.
   Container-scoped tweaks live at the bottom. */
.demo-roles { display: flex; flex-direction: column; gap: 4px; margin: 0; }
/* Both mirrors wrap each row in its OWN <form>: CI4 posts a role key to its own
   controller, while those two post real credentials to the platform's own login, which cannot be
   expressed as one form with role-keyed buttons. `display: contents` drops the wrapper out of the
   layout so the button stays the flex child and all three platforms render the identical rows.
   No-op on CI4, which has no form here. */
.demo-roles form { display: contents; }
/* p.…, not .…: the popover's own `.demo-stand-about p` rule is equally specific and would
   otherwise keep the bottom margin at 0. Same weight + later in the file = this one wins. */
p.demo-roles-lead { margin: 0 0 8px; color: var(--demo-ink-muted); font-size: 0.75rem; line-height: 1.4; }
.demo-roles-note { display: block; opacity: 0.8; }   /* "the password is the e-mail" — shown only while that holds */
.demo-role {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--demo-radius-sm, 6px);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.demo-role:hover,
.demo-role:focus-visible { background: var(--demo-surface-2); border-color: var(--demo-border-strong); }
.demo-role-icon { flex: 0 0 auto; color: var(--demo-accent); line-height: 0; }
.demo-role-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 auto; }
/* Flex + wrap: the "you are here" badge sits beside a short role name and drops to its own line
   behind a long one ("Agent (contributor) login") instead of running under the chevron. */
.demo-role-name { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 0.8rem; font-weight: 600; color: var(--demo-ink); }
.demo-role-creds {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.68rem;
    color: var(--demo-ink-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.demo-role-go { flex: 0 0 auto; color: var(--demo-ink-muted); line-height: 0; }
.demo-role:hover .demo-role-go { color: var(--demo-accent); }
/* The role you are already signed in as: marked, still clickable (it becomes "go to my area"). */
.demo-role--current { border-color: var(--demo-accent); background: var(--demo-surface-2); }
.demo-role-badge {
    padding: 0 6px;
    border-radius: 999px;
    background: var(--demo-accent);
    color: var(--demo-bg);
    font-size: 0.6rem;
    font-style: normal;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}
.demo-role-signout {
    align-self: flex-start;
    margin-top: 4px;
    padding: 4px 10px;
    border: 0;
    background: transparent;
    color: var(--demo-ink-muted);
    font: inherit;
    font-size: 0.75rem;
    text-decoration: underline;
    cursor: pointer;
}
.demo-role-signout:hover { color: var(--demo-ink); }

/* Dev-view region (design-system dropdown) stays hidden unless toggled, same contract.
   Its trigger reads as plain text: no pill border/padding/fill. */
.demo-devview { display: none; }
[data-devview="on"] .demo-devview { display: inline-flex; }
/* The toolbar instance is NOT the in-page dev banner (demo-pages.css .demo-devview):
   undo the banner's dashed border/padding/fill here, higher specificity wins. */
.demo-stand .demo-devview { margin: 0; padding: 0; border: 0; background: transparent; }
.demo-devview > .demo-stand-pill { border: 0; padding: 0; background: transparent; }
.demo-devview > .demo-stand-pill:hover { background: transparent; color: var(--demo-accent); }
/* Its dropdown is dark like the rest of the stand chrome (UIKit ships it light). */
.demo-devview .fwk-dropdown {
    border: 1px solid var(--demo-border-strong);
    border-radius: var(--demo-radius);
    background: var(--demo-surface);
    box-shadow: var(--demo-shadow);
    color: var(--demo-ink);
}
.demo-devview .fwk-dropdown-nav > li > a { color: var(--demo-ink-muted); }
.demo-devview .fwk-dropdown-nav > li > a:hover { color: var(--demo-ink); }
.demo-devview .fwk-dropdown-nav > li.fwk-active > a { color: var(--demo-accent); }

@media (max-width: 768px) {
    .demo-stand-center { display: none; }   /* keep brand + actions; promo/versions hide */
}
