/* The live demo window, on top of the project page's style.css (its colours, type, tabs and HUD cell).
   On its own the page has a slim bar back to the project page; framed in it (?embed=1) only the window shows,
   and the frame takes the height this page reports. */

html.embed, html.embed body { overflow: hidden; background: transparent; }
html.embed .bar { display: none; }

/* ------------------------------------------------------------ the page on its own */
.bar { border-bottom: 1px solid var(--hair-soft); }
.bar__inner { width: min(1060px, 100% - 2 * var(--gutter)); margin-inline: auto; height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.bar__brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 17px; text-decoration: none; }
.bar__brand i { font-family: var(--font-text); font-style: normal; font-weight: 500; font-size: 15px; color: var(--grey); }
.bar__back { font-size: 15px; font-weight: 500; color: var(--grey); text-decoration: none; }
.bar__back::before { content: "\2190\00a0"; }
.bar__back:hover { color: var(--ink); }

.demo { width: min(1060px, 100% - 2 * var(--gutter)); margin: 32px auto 48px; }
html.embed .demo { width: 100%; margin: 0; padding: 2px 0 4px; }

/* ------------------------------------------------------------ tabs: the site's, centred and joined to the window */
.demo__tabs { justify-content: center; margin-bottom: 18px; }
.demo__tabs .tab { min-width: 200px; }
.demo__tabs .tab b { display: block; }

/* ------------------------------------------------------------ the window: a square stage and the controls */
/* the stage's children are all absolute, so its column is a share of the window, not its content */
.win {
  --side: 360px;
  display: grid; grid-template-columns: minmax(0, 1fr) var(--side);
  max-width: 980px; margin-inline: auto;
  border: 1.5px solid var(--hair);
  background: #fff;
}
.side { border-left: 1.5px solid var(--hair); display: flex; flex-direction: column; min-width: 0; }

.screen { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: #fff; isolation: isolate; }
.screen > * { position: absolute; }
.screen__frame { inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #fff; z-index: 1; }
.screen__poster { inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; transition: opacity .35s, filter .35s; }
.screen__poster.is-missing { visibility: hidden; }

/* the cover: the start button low on the still, under the face */
.screen__cover {
  inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 0 16px 9%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 55%, rgba(255, 255, 255, .85) 100%);
}
.run {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 15px 26px; border: 1.5px solid var(--ink);
  background: var(--ink); color: #fff;
  font-size: 17px; font-weight: 700; line-height: 1; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.run svg { width: 15px; height: 15px; fill: currentColor; }
.run:hover, .run:focus-visible { background: var(--gala); border-color: var(--gala); }
.run__meta { margin: 0; padding: 3px 10px; background: rgba(255, 255, 255, .92); font-size: 14.5px; color: var(--grey); font-variant-numeric: tabular-nums; }

/* loading: the still stays, washed out, with the download bar over it */
.screen__load {
  left: 50%; bottom: 9%; transform: translateX(-50%); z-index: 3;
  width: min(320px, 76%); padding: 12px 16px 14px;
  background: rgba(255, 255, 255, .94); border: 1px solid var(--hair-soft);
  text-align: center; display: none;
}
.screen__load p { margin: 0 0 9px; font-size: 14.5px; color: var(--grey); font-variant-numeric: tabular-nums; white-space: nowrap; }
.screen__track { height: 4px; background: var(--hair-soft); overflow: hidden; }
.screen__track i { display: block; height: 100%; width: 0; background: var(--gala); transition: width .2s ease; }

.screen__err {
  inset: 0; z-index: 3; display: none;
  flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px;
  padding: 16px; background: #fff; text-align: center;
}
.screen__err p { margin: 0; max-width: 34em; font-size: 15px; line-height: 1.45; color: var(--grey); }
.screen__err video { flex: 1; min-height: 0; width: auto; max-width: 100%; aspect-ratio: 9 / 16; border-radius: 8px; background: var(--band); }

/* the readouts over the live view */
.screen__fps { top: 12px; left: 12px; z-index: 4; font-size: 13px; padding: 3px 9px; display: none; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--hud-fg); animation: blink 1.6s ease-in-out infinite; }
.screen.is-paused .dot { animation: none; opacity: .45; }
@keyframes blink { 50% { opacity: .35; } }
.screen__tools { top: 10px; right: 10px; z-index: 4; display: none; gap: 6px; }
.tool {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: rgba(255, 255, 255, .92); border: 1.5px solid var(--hair); color: var(--grey); cursor: pointer;
  transition: border-color .15s, color .15s;
}
.tool:hover, .tool:focus-visible { border-color: var(--ink); color: var(--ink); }
.tool[hidden] { display: none; }
.tool svg { width: 15px; height: 15px; fill: currentColor; }
.tool .i-play, .screen.is-paused .tool .i-pause { display: none; }
.screen.is-paused .tool .i-play { display: block; }
.screen__hint {
  left: 12px; bottom: 10px; z-index: 4; margin: 0; padding: 3px 9px;
  background: rgba(255, 255, 255, .9); font-size: 13.5px; color: var(--grey);
  pointer-events: none; opacity: 0; transition: opacity .5s;
}
.screen__hint.is-on { opacity: 1; }

.screen[data-phase="loading"] .screen__cover, .screen[data-phase="live"] .screen__cover, .screen[data-phase="error"] .screen__cover { display: none; }
.screen[data-phase="loading"] .screen__poster { filter: grayscale(.6); opacity: .5; }
.screen[data-phase="loading"] .screen__load { display: block; }
.screen[data-phase="live"] .screen__poster { opacity: 0; pointer-events: none; }
.screen[data-phase="live"] .screen__fps { display: inline-flex; }
.screen[data-phase="live"] .screen__tools { display: flex; }
.screen[data-phase="error"] .screen__err { display: flex; }
.screen[data-phase="error"] .screen__poster { display: none; }

/* full screen: the faces keep a square view in the middle (their viewers fit the width), the bodies take it all */
.screen:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; }
.screen:fullscreen[data-m="agora"] .screen__frame, .screen:fullscreen[data-m="flex"] .screen__frame,
.screen:fullscreen[data-m="agora"] .screen__poster, .screen:fullscreen[data-m="flex"] .screen__poster {
  inset: 0; margin: auto; width: min(100vw, 100vh); height: min(100vw, 100vh);
}

/* ------------------------------------------------------------ controls */
.ctl { padding: 16px 18px 18px; border-bottom: 1px solid var(--hair-soft); }
.ctl__title { margin: 0 0 10px; font-family: var(--font-head); font-size: 13.5px; font-weight: 700; color: var(--grey); letter-spacing: .01em; }
.ctl__title small { font-family: var(--font-text); font-weight: 500; font-size: 13px; color: var(--light); margin-left: 6px; }
.ctl--row { display: flex; flex-wrap: wrap; gap: 14px 26px; }
.ctl[hidden], #ctlPeople[hidden] { display: none; }

.thumbs { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 8px; }
.thumb {
  position: relative; padding: 0; aspect-ratio: 1 / 1; overflow: hidden;
  border: 1.5px solid var(--hair-soft); background: #fff; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { border-color: var(--grey); }
.thumb.is-on { border-color: var(--gala); box-shadow: 0 0 0 2px var(--gala); }
.thumbs--small { --cols: 8; gap: 5px; }
.thumbs--small .thumb.is-on { box-shadow: 0 0 0 1.5px var(--gala); }
/* "own": the clip this identity was recorded in */
.thumb[data-own]::after {
  content: ""; position: absolute; right: 3px; bottom: 3px; width: 6px; height: 6px; background: var(--gala);
}

.chips, .seg { display: flex; flex-wrap: wrap; }
.chip {
  margin: 0 -1.5px -1.5px 0; padding: 8px 13px;
  background: #fff; border: 1.5px solid var(--hair); color: var(--grey);
  font-size: 15px; font-weight: 600; line-height: 1.15; cursor: pointer;
  transition: background .15s, color .15s;
}
.chip:hover { color: var(--gala); }
.chip.is-on { position: relative; z-index: 1; background: var(--gala-bg2); border-color: var(--gala); color: var(--gala); }

/* the paper's CPU numbers for this host: the host's time, then GALA's */
.speed { margin-top: auto; padding: 14px 18px 16px; background: var(--gala-bg); }
.speed__cap { margin: 0 0 8px; font-size: 13.5px; color: var(--grey); line-height: 1.35; }
.speed__rows { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 2px 14px; }
.speed__rows span { font-size: 15px; font-weight: 600; }
.speed__rows b { font-size: 20px; line-height: 1.25; text-align: right; font-variant-numeric: tabular-nums; }
.speed__rows em { grid-row: 1 / 3; grid-column: 3; align-self: center; font-style: normal; font-family: var(--font-head); font-weight: 700; font-size: 22px; color: var(--ink); padding-left: 12px; border-left: 1px solid rgba(0, 0, 0, .15); }
.speed__note { margin: 6px 0 0; font-size: 12.5px; color: var(--light); }

.demo__foot { margin: 14px auto 0; max-width: 820px; text-align: center; font-size: 14.5px; line-height: 1.5; color: var(--light); text-wrap: balance; }

/* ------------------------------------------------------------ narrow: the stage on top, the controls under it */
@media (max-width: 760px) {
  .win { grid-template-columns: minmax(0, 1fr); }
  .side { border-left: 0; border-top: 1.5px solid var(--hair); }
  .demo__tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .demo__tabs .tab { min-width: 0; text-align: center; }
  .ctl { padding: 12px 14px 14px; }
  /* one row of thumbnails that scrolls sideways */
  .thumbs { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 68px; overflow-x: auto; scrollbar-width: none; padding: 3px; margin: -3px; }
  .thumbs::-webkit-scrollbar { display: none; }
  .thumbs--small { grid-auto-columns: 40px; }
  .speed { margin-top: 0; }
  .run { padding: 13px 20px; font-size: 16px; }
}
@media (max-width: 640px) {
  .demo { width: calc(100% - 2 * var(--gutter)); margin-top: 20px; }
  html.embed .demo { width: 100%; }
  .bar__brand i { display: none; }
  .demo__foot { font-size: 13.5px; }
}
