/* S8: live demos */
.demos {
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 200ms;
  --t-mid: 450ms;
  --t-slow: 700ms;
  --stagger: 55ms;
}
.demos__tabs {
  position: relative;
  display: flex;
  width: fit-content;
  gap: 2px;
  padding: 4px;
  margin: 0 auto 14px max(0px, calc((100% - var(--content)) / 2));
  border-radius: 999px;
  background: var(--dark-2);
  box-shadow: var(--hair);
}
.demos__tabs [role=tab] {
  scroll-margin-top: 96px; /* a focused or scrolled-to tab clears the fixed nav */
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--on-dark-2);
  font: 600 1rem / 1 var(--font-sans);
  padding: 14px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--t-fast) 120ms, transform 250ms var(--ease);
}
.demos__tabs [role=tab][aria-selected="true"] { color: var(--accent-ink); }
/* scripts off: no glider, so the selected tab carries its own amber */
html:not(.js) .demos__tabs [role=tab][aria-selected="true"] { background: var(--accent); }
.demos__glider {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 999px;
  background: var(--accent);
  clip-path: inset(4px calc(100% - 4px) 4px 4px round 999px);
  transition: clip-path 320ms var(--ease);
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .demos__tabs [role=tab]:hover { transform: translateY(-2px); }
}

.frame {
  position: relative;
  max-width: var(--content);
  margin: 0 auto;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--dark-2);
  outline: 1px solid var(--line-dark);
  outline-offset: -1px;
  will-change: clip-path;
}
.frame__poster, .frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.frame__poster {
  object-fit: cover;
  object-position: top left;
  transition: opacity 350ms linear, transform 1200ms var(--ease);
}
.frame.swap .frame__poster { opacity: 0; transform: scale(1.03); }
.frame__start {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--dark) 52%, transparent);
  transition: opacity 300ms linear;
}
.frame.live .frame__start, .frame.live .frame__poster { opacity: 0; pointer-events: none; }
#startDemo {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 1em 1.75em;
  font-size: 1.0625rem;
}
.demos__foot {
  max-width: var(--content);
  margin: 14px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  color: var(--mute-text);
  font-size: .95rem;
}

.demos__foot .link { color: var(--ink); text-decoration-color: var(--accent); }

@media (max-width: 699.98px) {
  .demos__tabs { width: 100%; margin: 0 0 12px; }
  .demos__tabs [role=tab] { flex: 1 1 0; padding: 12px 8px; font-size: .9rem; }
  .frame { aspect-ratio: 3 / 4; }
  #startDemo { font-size: .95rem; }
  .demos__foot { flex-direction: column; }
}

/* S9: phone demos (MoneyMate). Wider than 700px the frame keeps its size and the app sits in a centred
   390 x 844 phone, scaled to the frame's height (demos.js sets --ps); the frame is at least 630px tall there so the
   phone is never scaled below 0.7. At 700px and under the app fills the frame. */
.frame--phone .frame__poster { object-position: center; }
@media (min-width: 701px) {
  .frame--phone { width: 100%; min-height: 630px; }   /* a definite width, so the minimum height cannot widen the frame */
  .frame--phone iframe {
    inset: auto;
    left: 50%;
    top: 50%;
    width: 390px;
    height: 844px;
    transform: translate(-50%, -50%) scale(var(--ps, .8));
    border-radius: 44px;
    background: #FFF6EC;
    box-shadow: 0 0 0 7px var(--dark), 0 0 0 8px var(--line-dark), var(--shadow);
  }
}
@media (max-width: 700px) {
  .frame--phone { aspect-ratio: auto; height: min(844px, 82svh); }
}
/* S14: device frames. NOC Console and ITSM Tool sit in a browser window, WinForge in a desktop-app window, the two
   phone apps keep the phone. The chrome is decoration (aria-hidden), quiet, in the palette's own neutrals. It lives
   inside the frame, so the frame keeps its size and the content area gives up only the bar (36px; 26px on phones). */
.frame { --bar: 36px; }
.frame__chrome {
  position: absolute; z-index: 2; top: 0; left: 0; right: 0; height: var(--bar);
  display: none; align-items: center;
  background: var(--dark); color: var(--on-dark-2);
  box-shadow: inset 0 -1px 0 var(--line-dark);
  transition: opacity 350ms linear;
  pointer-events: none; user-select: none;
}
.frame.swap .frame__chrome { opacity: 0; }
.frame--browser .frame__chrome--browser { display: grid; }
.frame--desktop .frame__chrome--desktop { display: flex; }
.frame--browser .frame__poster, .frame--browser iframe, .frame--browser .frame__start,
.frame--desktop .frame__poster, .frame--desktop iframe, .frame--desktop .frame__start {
  top: var(--bar); height: calc(100% - var(--bar));
}
.frame__chrome--browser { grid-template-columns: 1fr auto 1fr; gap: 12px; padding: 0 14px; }
.chrome__dots { display: flex; gap: 7px; }
.chrome__dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--faint-dark); }
.chrome__dots i:nth-child(2) { opacity: .7; }
.chrome__dots i:nth-child(3) { opacity: .45; }
.chrome__addr {
  display: flex; align-items: center; gap: 8px; min-width: 0; width: min(380px, 44vw); height: 24px; padding: 0 12px;
  border-radius: 999px; background: color-mix(in srgb, var(--on-dark) 7%, transparent); box-shadow: inset 0 0 0 1px var(--line-dark);
  font: 500 11.5px / 1 var(--font-mono); letter-spacing: .01em; color: var(--on-dark-2);
}
.chrome__addr svg { flex: none; color: var(--accent); }
.chrome__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame__chrome--desktop { padding: 0 0 0 14px; gap: 10px; }
.chrome__icon { flex: none; color: var(--accent); }
.chrome__title { font: 500 12.5px / 1 var(--font-sans); color: var(--on-dark); }
.chrome__ctl { display: flex; margin-left: auto; height: 100%; }
.chrome__ctl svg { box-sizing: content-box; width: 10px; height: 10px; padding: 0 18px; align-self: center; color: var(--on-dark-2); }
@media (max-width: 700px) {
  .frame { --bar: 26px; }
  .chrome__dots, .chrome__ctl { display: none; }
  .frame__chrome--browser { grid-template-columns: 1fr; justify-items: center; padding: 0 12px; }
  .chrome__addr { width: auto; max-width: 100%; height: 20px; padding: 0 10px; font-size: 11px; }
  .frame__chrome--desktop { padding: 0 12px; }
}

/* five tabs on a phone: widths follow the labels, one line each down to 381px (smaller below 480px), then smaller still and allowed to wrap, so the row never widens the page */
@media (max-width: 699.98px) {
  .demos__tabs [role=tab] { flex: 1 1 auto; min-width: min-content; padding: 12px 4px; font-size: .8rem; white-space: nowrap; }
}
@media (min-width: 700px) and (max-width: 860px) {
  .demos__tabs [role=tab] { padding: 14px 12px; font-size: .9rem; }
}
@media (max-width: 480px) {
  .demos__tabs [role=tab] { padding: 12px 3px; font-size: .72rem; }
}
@media (max-width: 380px) {
  .demos__tabs { gap: 3px; padding: 3px; }
  .demos__tabs [role=tab] { min-width: min-content; padding: 10px 3px; font-size: .66rem; line-height: 1.15; white-space: normal; }  /* a label never shrinks below its longest word, so it keeps its 3px padding */
}


@media (prefers-reduced-motion: reduce) {
  .demos__glider { transition: none; }
  .demos__tabs [role=tab] { transition: none; transform: none; }
  .frame__poster, .frame__start, .frame__chrome { transition: none; }
  .frame.swap .frame__poster { transform: none; }
  .frame { will-change: auto; }
}
