/* The live demo (apps.core.demo): the account menu, the chooser (the front door, laid out as the
   agency's sign-in page), the page that signs a visitor in and the short notices. Loaded only in
   demo mode, after pms.css (templates/base.html), and written in its tokens: the same emerald, gold,
   type and shapes. Nothing here sits above the product's own shells: the pages look as they do in
   real use.
   - The account menu (templates/demo/_accounts.html) is a disclosure: in the console it opens
     upward from the person's card at the foot of the sidebar, inside it (the sidebar clips what
     leaves it); in a portal it drops from the initials in the header. Its button says whether it is
     open (aria-expanded); Escape, a click or the focus elsewhere closes it (ui.js). Each account is
     a form that signs in as that person, the current one aria-current; Start over comes last. Every
     row is at least 48 px to touch.
   - The chooser is laid out like the sign-in pages (entrance.html): the emerald panel beside the
     accounts from 960 px, a short emerald header with the accounts on a sheet under it on phones. */

/* ---------- The account menu ---------- */
.acct { position: relative; }
.acct__menu {
  position: absolute; z-index: 30; overflow-y: auto; overscroll-behavior: contain;
  padding: 5px; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-3);
  font: 400 0.875rem/1.4 var(--font); letter-spacing: 0; text-align: start;
}
.acct__menu:not([hidden]) { animation: acct-in 160ms var(--ease) both; }
@keyframes acct-in { from { opacity: 0; transform: translateY(var(--acct-from, -4px)); } }
.acct__menu ul { list-style: none; margin: 0; padding: 0; }
.acct__menu form { margin: 0; }
.acct__title { margin: 0; padding: 8px 8px 0; color: var(--heading); font-size: 0.875rem; font-weight: 650; letter-spacing: -0.006em; }
.acct__group { margin: 0; padding: 10px 8px 4px; color: var(--text-3); font: 600 0.75rem/1.4 var(--font); }
.acct__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 7px 8px;
  border: 0; border-radius: 9px; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color var(--dur) var(--ease);
}
.acct__item:hover { background: var(--surface-2); }
.acct .acct__menu .acct__item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.acct__item[aria-busy="true"] { cursor: progress; }
.acct__avatar {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  font: 650 0.75rem/1 var(--font); letter-spacing: 0.02em;
}
.acct__item--staff .acct__avatar { background: var(--brand); color: var(--accent-soft); }
.acct__item--portal .acct__avatar { background: var(--brand-tint-2); color: var(--brand); }
.acct__who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.acct__who b { color: var(--heading); font-size: 0.875rem; font-weight: 600; }
.acct__who span { color: var(--text-2); font-size: 0.8125rem; }
.acct__item[aria-current="true"] { background: var(--brand-tint); }
.acct__item > .i { flex: none; }
.acct__item[aria-current="true"] > .i { width: 16px; height: 16px; color: var(--brand); stroke-width: 2.4; }
/* Start over: quieter, under a rule, its icon where the others have their initials */
.acct__reset { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.acct__item--reset > .i {
  box-sizing: border-box; width: 32px; height: 32px; padding: 8px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2); stroke-width: 2;
}
.acct__item--reset .acct__who b { font-weight: 600; }

/* In the console: the person's card is the button, and the menu opens upward over the sidebar's
   menu, as wide as the card */
.ws-staff .acct--side { position: static; flex: 1; min-width: 0; }
.ws-staff .acct--side + .side__signout { margin-inline-start: -6px; }
.ws-staff .side__me {
  display: flex; align-items: center; gap: 8px; width: calc(100% + 6px); min-height: 44px; margin-block: -4px; margin-inline: -6px 0;
  padding-block: 4px; padding-inline: 6px 2px;
  border: 0; border-radius: 9px; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.ws-staff .side__me:hover, .ws-staff .acct.is-open .side__me { background: rgba(255, 255, 255, 0.07); }
.ws-staff .side__me:focus-visible { outline-offset: 0; }
.ws-staff .side__me .who { display: block; }
.ws-staff .acct__chev { flex: none; width: 12px; height: 12px; color: var(--side-tx-3); transform: rotate(180deg); transition: transform var(--dur) var(--ease); }
.ws-staff .acct.is-open .acct__chev { transform: none; }
.ws-staff .acct--side .acct__menu {
  --acct-from: 4px; inset-inline: 0; bottom: calc(100% + 8px);
  max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px);
}

/* In a portal: the initials are the button, and the menu drops under the header at its end */
.ws-portal .acct--head { flex: none; }
.ws-portal .acct--head .initials { position: relative; padding: 0; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ws-portal .acct--head .initials::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }   /* 44 px to touch */
.ws-portal .acct.is-open .initials { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.ws-portal .acct--head .acct__menu {
  top: calc(100% + 12px); inset-inline-end: -4px; width: min(320px, calc(100vw - 24px));
  max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px);
}
/* Phones: clear of the tab bar at the foot of the screen */
@media (max-width: 899px) {
  .ws-portal .acct--head .acct__menu { max-height: calc(100vh - 176px); max-height: calc(100dvh - 176px - env(safe-area-inset-bottom)); }
}

/* ---------- The chooser (/demo/) ---------- */
@media (min-width: 960px) {
  .demo-door { grid-template-columns: minmax(400px, 42%) minmax(0, 1fr); }
  .demo-door .entrance__form { align-items: flex-start; padding: 48px 48px 64px; }
}
@media (min-width: 1280px) { .demo-door .entrance__form { padding-inline: 64px; } }
.demo-door .entrance__art .logo img { height: 44px; }
@media (min-width: 600px) { .demo-door .entrance__art .logo img { height: 48px; } }
@media (min-width: 960px) { .demo-door .entrance__art .logo img { height: 60px; } }
.demo-door .entrance__art .copy > p:not(.eyebrow):not(.h1) { max-width: 32em; }
.demo-door .entrance__art .h1 { text-wrap: balance; }
/* Phones: a short header, so the accounts start on the first screen */
@media (max-width: 599px) {
  .demo-door .entrance__art .h1 { font-size: 1.875rem; }
  .demo-door .entrance__art .copy > p:not(.eyebrow):not(.h1) { display: none; }
}
/* On the emerald: a gold pill to carry on, a light outline to start over (as on the covers) */
.demo-door__now { margin-top: 20px; gap: 10px; }
.demo-door__now form { margin: 0; }
.demo-door__now .btn:not(.btn-ghost) {
  --btn-bg: var(--accent); --btn-fg: var(--brand-ink); --btn-bd: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
}
.demo-door__now .btn:not(.btn-ghost):hover { --btn-bg: var(--accent-soft); --btn-bd: var(--accent-soft); }
.demo-door__now .btn-ghost { --btn-bg: transparent; --btn-fg: #fff; --btn-bd: rgba(255, 255, 255, 0.42); box-shadow: none; }
.demo-door__now .btn-ghost:hover { --btn-bg: rgba(255, 255, 255, 0.1); --btn-bd: rgba(255, 255, 255, 0.72); }
@media (min-width: 960px) { .demo-door__now { margin-top: 28px; } }
/* A short screen beside the panel (the website's laptop frame is 1024 by 640): a smaller panel,
   so the logo, the words, both buttons and the skyline still fit in it */
@media (min-width: 960px) and (max-height: 760px) {
  .demo-door .entrance__art { --bp-sky: 96px; padding-top: 28px; }
  .demo-door .entrance__art .logo img { height: 48px; }
  .demo-door .entrance__art .copy { margin-bottom: 20px; }
  .demo-door .entrance__art .h1 { font-size: 2.25rem; }
  .demo-door .entrance__art .copy > p:not(.eyebrow):not(.h1) { margin-top: 12px; font-size: 0.9375rem; }
  .demo-door__now { margin-top: 18px; }
  .demo-door__now .btn { min-height: 42px; padding-inline: 18px; }
}

.demo-door__panel { width: 100%; max-width: 680px; }
.demo-door__panel > .notice { margin-bottom: 24px; }
/* Light, then its key words in bold emerald, as the sign-in form's title */
.demo-door__title { margin: 0; font-size: clamp(1.625rem, 1.45rem + 0.7vw, 2.125rem); font-weight: var(--bp-light, 400); letter-spacing: -0.03em; line-height: 1.1; }
.demo-door__title b { color: var(--brand); font-weight: var(--bp-bold, 680); }
.demo-door__lede { margin: 8px 0 0; color: var(--text-2); font-size: 0.9375rem; line-height: 1.55; max-width: 38em; }

.demo-group { margin-top: 26px; }
.demo-group__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 16px; margin-bottom: 10px; }
.demo-group__head h2 { margin: 0; font-size: 0.9375rem; font-weight: 650; letter-spacing: -0.01em; }
.demo-group__head p { margin: 0; color: var(--text-3); font-size: 0.8125rem; }

/* A group's roles: one card, a row each; the row's arrow is the form's button and its hit area the
   whole row */
.demo-roles {
  list-style: none; margin: 0; padding: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-1);
}
.demo-role {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) 36px; grid-template-areas: "avatar head go" "avatar try go";
  align-items: start; gap: 3px 14px; padding: 15px 16px 16px;
  box-shadow: inset 0 1px 0 var(--line-soft);
  transition: background-color var(--dur) var(--ease);
}
.demo-role:first-child { box-shadow: none; }
.demo-role:hover { background: var(--surface-2); }
.demo-role.is-current { background: var(--brand-tint); }
.demo-role__avatar {
  grid-area: avatar; display: inline-grid; place-items: center; width: 40px; height: 40px; margin-top: 1px; border-radius: 50%;
  font: 650 0.8125rem/1 var(--font); letter-spacing: 0.02em;
}
.demo-role--staff .demo-role__avatar { background: var(--brand); color: var(--accent-soft); }
.demo-role--portal .demo-role__avatar { background: var(--brand-tint-2); color: var(--brand); }
.demo-role.is-current .demo-role__avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }
.demo-role__head { grid-area: head; margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.demo-role__name { color: var(--heading); font-size: 1rem; font-weight: 650; letter-spacing: -0.012em; line-height: 1.35; }
.demo-role__title { color: var(--brand); font-size: 0.8125rem; font-weight: 600; }
.demo-role__now {
  align-self: center; padding: 2px 8px; border-radius: 999px; background: var(--brand-tint-2); color: var(--brand);
  font-size: 0.75rem; font-weight: 600; line-height: 1.4;
}
.demo-role__try { grid-area: try; margin: 0; color: var(--text-2); font-size: 0.875rem; line-height: 1.5; }
.demo-role form { grid-area: go; align-self: center; margin: 0; }
.demo-role__go {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--brand); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform 220ms var(--ease);
}
.demo-role__go .i { width: 18px; height: 18px; stroke-width: 2; }
.demo-role__go::after { content: ""; position: absolute; inset: 0; }
.demo-role__go:focus-visible { outline: none; }
.demo-role__go:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -3px; border-radius: var(--r-l); }
.demo-role:hover .demo-role__go { background: var(--brand); color: var(--on-brand); box-shadow: none; transform: translateX(2px); }
[dir="rtl"] .demo-role:hover .demo-role__go { transform: translateX(-2px); }
.demo-role__go[aria-busy="true"] { cursor: progress; }
@media (max-width: 559px) {
  .demo-role { grid-template-columns: 36px minmax(0, 1fr) 32px; gap: 3px 12px; padding: 14px 14px 15px; }
  .demo-role__avatar { width: 36px; height: 36px; font-size: 0.75rem; }
  .demo-role__go { width: 32px; height: 32px; }
  .demo-role__go .i { width: 16px; height: 16px; }
}

/* ---------- Opening a copy (/demo/start/<persona>/): the website's calm emerald screen ---------- */
.demo-wait {
  /* the skyline (2400 by 293) always wider than the screen, so neither of its ends shows */
  --bp-sky: max(80px, calc(12.3vw + 8px));
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; place-items: center;
  min-height: 100vh; min-height: 100dvh;
  padding: 48px var(--gutter) calc(var(--bp-sky) + 32px);
  background: radial-gradient(90% 70% at 50% 0%, color-mix(in srgb, var(--brand-glow) 80%, transparent) 0%, transparent 70%),
    linear-gradient(170deg, var(--brand) 0%, var(--brand-deep) 52%, var(--brand-ink) 100%);
  color: var(--on-dark-2); text-align: center;
}
.demo-wait > .skyline { position: absolute; inset-inline: 0; bottom: 0; z-index: -1; }
.demo-wait__box { display: flex; flex-direction: column; align-items: center; max-width: 34rem; }
.demo-wait__logo { width: auto; height: 56px; margin-bottom: 28px; }
@media (min-width: 768px) { .demo-wait__logo { height: 72px; margin-bottom: 36px; } }
.demo-wait h1 {
  color: #fff; font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.75rem); font-weight: var(--bp-light, 400);
  letter-spacing: -0.035em; line-height: 1.08;
}
.demo-wait h1 b { color: var(--accent-soft); font-weight: var(--bp-bold, 680); }
.demo-wait__text { max-width: 28em; margin: 14px auto 0; color: var(--on-dark-2); font-size: 1rem; line-height: 1.55; text-wrap: balance; }
.demo-wait__bar { display: block; width: min(220px, 60vw); height: 2px; margin-top: 30px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.demo-wait__bar i { display: block; width: 40%; height: 100%; border-radius: inherit; background: var(--accent-soft); animation: demo-slide 1.6s var(--ease) infinite; }
@keyframes demo-slide { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
.demo-wait form { margin: 0; }
.demo-wait .btn {
  margin-top: 24px; --btn-bg: var(--accent); --btn-fg: var(--brand-ink); --btn-bd: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.24);
}
.demo-wait .btn:hover { --btn-bg: var(--accent-soft); --btn-bd: var(--accent-soft); }
.demo-wait :focus-visible { outline-color: var(--focus-dark); }

/* ---------- The notices (busy, too many copies, switched off): the error pages' cover ---------- */
.demo-notice .cover__body .eyebrow { margin-bottom: 16px; }
.demo-notice .cover__body h1 b { display: block; }   /* "The demo is busy," then "try again in a minute." */

/* ---------- Motion, forced colours, print ---------- */
@media (prefers-reduced-motion: reduce) {
  .acct__menu:not([hidden]), .demo-wait__bar i { animation: none; }
  .demo-wait__bar i { width: 100%; opacity: 0.5; }
  .acct__item, .ws-staff .side__me, .ws-staff .acct__chev, .demo-role, .demo-role__go { transition: none; }
}
@media (forced-colors: active) {
  .acct__menu, .demo-roles { border-color: CanvasText; }
  .acct__item[aria-current="true"], .demo-role.is-current { outline: 2px solid CanvasText; outline-offset: -2px; }
  .ws-staff .side__me { border: 1px solid ButtonText; }
  .demo-wait { background: Canvas; color: CanvasText; }
  .demo-wait > .skyline { display: none; }
  /* The light logo keeps a small emerald tile, as on the sign-in panel */
  .demo-wait__logo { forced-color-adjust: none; box-sizing: content-box; padding: 6px 8px; border-radius: 8px; background: var(--brand-ink); }
}
@media print {
  .acct__menu { display: none; }
}
