/* Blends, on the landing page (site/index.html, #blends; played by site/mock/blends.js).

   A blend is a space several circles share: one chat and one call, each message tagged with the circle it is said
   from (lib/circles/blend.dart). Its mark is three circles of red, green and blue light overlapping as light does,
   cyan, magenta and yellow where two meet and white where all three do (lib/ui/circles/blend_ui.dart, BlendMark),
   and that mark is the picture here: each circle a disc of its own light, apart at first, then drawn together.

   Beside them a phone has the blend's chat as the app draws it (test/shots/21-hangout-chat-dark.png): the name over
   a run of bubbles, and beside it the pill in the writer's circle's colour (CircleTagChip). The board is always
   night: light only adds up on a dark page. Behind it, the site's stars. */

.bl { --bl-r: #ff2d2d; --bl-g: #2dff5a; --bl-b: #2d6bff;   /* BlendMarkPainter's red, green and blue */
      --bl-hr: #ff6b61; --bl-hg: #4cd571; --bl-hb: #4ea1ff; } /* the three circles' own colours (mock.css's hues) */

.bl-steps { list-style: none; margin: 0 0 2.4rem; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.5rem; counter-reset: bl; font-size: .9rem; font-weight: 600; color: var(--u-ink-2); }
.bl-steps li { display: flex; align-items: center; gap: .55rem; white-space: nowrap; transition: color .3s ease; }
.bl-steps li::before {
  counter-increment: bl; content: counter(bl); flex: none; width: 1.45rem; height: 1.45rem; display: grid; place-items: center;
  font-family: var(--u-display); font-style: italic; font-weight: 900; font-size: .82rem; line-height: 1;
  border: 1.25px solid currentColor; border-radius: 3px; transform: skewX(var(--u-slant));
  transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}
.bl[data-run] .bl-steps li { color: var(--u-ink-3); }
.bl[data-run] .bl-steps li.is-done { color: var(--u-ink-2); }
.bl[data-run] .bl-steps li.is-on { color: var(--u-ink); }
.bl[data-run] .bl-steps li.is-on::before { background: var(--u-ink); color: var(--u-bg); border-color: var(--u-ink); }

.bl-board {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 21rem); gap: clamp(1rem, 4vw, 3rem); align-items: center;
  padding: clamp(1rem, 3vw, 2.4rem); background-color: #040406; color: #fff; overflow: hidden; isolation: isolate;
}
.bl-board::before { /* a faint wash of the three lights behind it all, over the stars (.u-stars) */
  content: ""; position: absolute; inset: -20%; z-index: 0; pointer-events: none; opacity: .12;
  background: radial-gradient(40% 40% at 30% 25%, var(--bl-r), transparent 70%), radial-gradient(40% 40% at 20% 80%, var(--bl-g), transparent 70%), radial-gradient(40% 40% at 55% 75%, var(--bl-b), transparent 70%);
  filter: blur(40px);
}
.bl-board > * { position: relative; }

/* --- the three lights -------------------------------------------------------------------------------------- */
.bl-lights { position: relative; width: 100%; max-width: 34rem; margin: 0 auto; aspect-ratio: 1 / 1; isolation: isolate; }
.bl-disc {
  position: absolute; width: 44%; aspect-ratio: 1; border-radius: 50%; translate: -50% -50%;
  background: var(--c); mix-blend-mode: screen; opacity: .16;
  box-shadow: 0 0 60px -6px var(--c);
  transition: left 1.2s cubic-bezier(.6, 0, .2, 1), top 1.2s cubic-bezier(.6, 0, .2, 1), opacity .6s ease, scale .6s cubic-bezier(.3, 1.6, .5, 1);
}
.bl-disc::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--c); opacity: .9; mix-blend-mode: normal; }
.bl-disc[data-c='r'] { --c: var(--bl-r); left: 50%; top: 25%; }
.bl-disc[data-c='g'] { --c: var(--bl-g); left: 26.6%; top: 65.5%; }
.bl-disc[data-c='b'] { --c: var(--bl-b); left: 73.4%; top: 65.5%; }
.bl-disc.is-in { opacity: .75; }
.bl-disc.is-pop { scale: 1.06; }
/* Drawn together: three round a centre, each reaching it, as the mark has them. */
.bl[data-merged] .bl-disc[data-c='r'] { left: 50%; top: 38.4%; }
.bl[data-merged] .bl-disc[data-c='g'] { left: 38.2%; top: 58.8%; }
.bl[data-merged] .bl-disc[data-c='b'] { left: 61.8%; top: 58.8%; }

/* Each circle's name, its people, and (at the end) the spaces it keeps to itself. In its light while apart; out at
   its edge once the lights meet. */
.bl-label {
  position: absolute; z-index: 2; translate: -50% -50%; display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center;
  transition: left 1.2s cubic-bezier(.6, 0, .2, 1), top 1.2s cubic-bezier(.6, 0, .2, 1); pointer-events: none;
}
.bl-label[data-c='r'] { --h: var(--bl-hr); left: 50%; top: 25%; }
.bl-label[data-c='g'] { --h: var(--bl-hg); left: 26.6%; top: 65.5%; }
.bl-label[data-c='b'] { --h: var(--bl-hb); left: 73.4%; top: 65.5%; }
.bl[data-merged] .bl-label[data-c='r'] { left: 50%; top: 7%; }
.bl[data-merged] .bl-label[data-c='g'] { left: 14%; top: 90%; }
.bl[data-merged] .bl-label[data-c='b'] { left: 86%; top: 90%; }
.bl-label b { font-family: var(--u-display); font-style: italic; font-weight: 800; font-size: clamp(.95rem, 2.2vw, 1.25rem); line-height: 1; text-shadow: 0 1px 12px rgba(0, 0, 0, .9); white-space: nowrap; }
.bl-faces { display: flex; }
.bl-faces i {
  width: 1.8rem; height: 1.8rem; margin-left: -.22rem; display: grid; place-items: center; border-radius: 50%;
  font-style: normal; font-size: .62rem; font-weight: 700; color: var(--h); background: #111216; box-shadow: 0 0 0 2px #040406;
}
.bl-faces i:first-child { margin-left: 0; }
.bl-tag { /* "Host", "Open to blend", "Joined" */
  font-size: .68rem; font-weight: 700; letter-spacing: .02em; padding: .12rem .5rem; border-radius: 999px;
  color: #fff; background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .22); white-space: nowrap;
  transition: opacity .35s ease;
}
.bl-tag:empty { opacity: 0; }
.bl-own { list-style: none; margin: .1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; align-items: center; }
.bl-own li {
  display: flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; color: rgba(255, 255, 255, .82);
  padding: .14rem .5rem; border-radius: 999px; background: rgba(17, 18, 22, .88); border: 1px solid rgba(255, 255, 255, .12); white-space: nowrap;
  opacity: 0; translate: 0 -.3rem; transition: opacity .4s ease, translate .4s ease;
}
.bl-own li svg { width: .7rem; height: .7rem; color: var(--h); }
.bl[data-own] .bl-own li { opacity: 1; translate: 0 0; }
.bl[data-own] .bl-own li + li { transition-delay: .12s; }
.bl-label[data-c='r'] .bl-own { display: none; } /* the host's sit under the light: see .bl-own--r */
.bl-own--r { position: absolute; z-index: 2; left: 50%; top: 18%; translate: -50% 0; flex-direction: row; }

/* The blended space, in the white where all three meet. */
.bl-hub {
  position: absolute; z-index: 3; left: 50%; top: 52%; translate: -50% -50%; display: flex; align-items: center; gap: .35rem;
  font-size: clamp(.7rem, 1.6vw, .85rem); font-weight: 800; color: #050507; white-space: nowrap;
  padding: .3rem .7rem; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 0 30px 8px rgba(255, 255, 255, .5);
  opacity: 0; scale: .8; transition: opacity .5s ease .5s, scale .5s cubic-bezier(.3, 1.6, .5, 1) .5s;
}
.bl-hub svg { width: .95rem; height: .95rem; }
.bl[data-merged] .bl-hub { opacity: 1; scale: 1; }

/* The invite, handed from the host to each circle in turn. */
.bl-code {
  position: absolute; z-index: 4; translate: -50% -50%; display: flex; align-items: center; gap: .35rem;
  font-size: .74rem; font-weight: 700; color: #050507; padding: .3rem .65rem; border-radius: 999px; background: #fff;
  box-shadow: 0 6px 24px -4px rgba(255, 255, 255, .6); white-space: nowrap; opacity: 0;
  left: 50%; top: 39%; transition: left 1s cubic-bezier(.6, 0, .2, 1), top 1s cubic-bezier(.6, 0, .2, 1), opacity .3s ease;
}
.bl-code svg { width: .85rem; height: .85rem; }
.bl-code.is-on { opacity: 1; }
.bl-code[data-at='g'] { left: 26.6%; top: 79.5%; }
.bl-code[data-at='b'] { left: 73.4%; top: 79.5%; }

/* --- the phone: the blend's chat --------------------------------------------------------------------------- */
.bl-phone {
  width: 100%; max-width: 21rem; margin: 0 auto; aspect-ratio: 412 / 760; display: flex; flex-direction: column;
  background: #000; border-radius: 2rem; border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 0 0 6px #121318, 0 30px 80px -20px rgba(0, 0, 0, .9);
  overflow: hidden; font-family: var(--u-body); font-size: 13.5px; color: #fff;
}
.bl-ph-head { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1rem .75rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.bl-ph-mark { width: 2.1rem; height: 2.1rem; flex: none; display: grid; place-items: center; border-radius: 50%; background: #16171c; color: rgba(255, 255, 255, .7); }
.bl-ph-mark svg { width: 1.2rem; height: 1.2rem; }
.bl-ph-mark .is-blend { display: none; width: 1.55rem; height: 1.55rem; }
.bl[data-blend-on] .bl-ph-mark .is-blend { display: block; }
.bl[data-blend-on] .bl-ph-mark .is-space { display: none; }
.bl-ph-title { min-width: 0; display: flex; flex-direction: column; }
.bl-ph-title b { font-size: 1.02rem; }
.bl-ph-title small { font-size: .74rem; color: rgba(255, 255, 255, .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bl-call {
  margin: .6rem .8rem 0; display: flex; align-items: center; gap: .55rem; padding: .45rem .55rem .45rem .7rem; border-radius: 999px;
  background: #101114; border: 1px solid rgba(255, 255, 255, .08); font-size: .78rem; color: rgba(255, 255, 255, .75);
  opacity: 0; translate: 0 -.4rem; transition: opacity .4s ease, translate .4s ease;
}
.bl[data-call] .bl-call { opacity: 1; translate: 0 0; }
.bl-call .bl-faces i { width: 1.45rem; height: 1.45rem; font-size: .55rem; box-shadow: 0 0 0 2px #101114, 0 0 0 3.5px var(--h); margin-left: -.3rem; }
.bl-call .bl-faces i:first-child { margin-left: 0; }
.bl-call span:nth-child(2) { flex: 1; }
.bl-call .bl-join { font-weight: 700; color: #050507; background: #fff; padding: .22rem .7rem; border-radius: 999px; }
.bl-live { display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: #4cd571; margin-right: .3rem; box-shadow: 0 0 6px #4cd571; }

.bl-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: .5rem; padding: .8rem .8rem .4rem; overflow: hidden; }
.bl-note { align-self: center; text-align: center; font-size: .72rem; color: rgba(255, 255, 255, .5); max-width: 90%; animation: bl-in .4s ease both; }
.bl-note b { color: rgba(255, 255, 255, .8); font-weight: 600; }
.bl-msg { display: flex; flex-direction: column; align-items: flex-start; gap: .22rem; animation: bl-in .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.bl-who { display: flex; align-items: center; gap: .35rem; padding-left: .2rem; font-size: .74rem; font-weight: 700; color: var(--h); }
.bl-bubble { max-width: 85%; padding: .5rem .8rem; border-radius: 1.1rem; background: #1f2024; line-height: 1.3; }
.bl-msg--out { align-items: flex-end; }
.bl-msg--out .bl-bubble { background: #fff; color: #050507; }
.bl-pill { /* CircleTagChip, small: a dot and the circle's name, in its colour */
  display: inline-flex; align-items: center; gap: .22rem; padding: .05rem .4rem; border-radius: 999px;
  font-size: .64rem; font-weight: 600; color: var(--h); background: color-mix(in srgb, var(--h) 14%, transparent);
}
.bl-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--h); }
.bl-composer { margin: .4rem .7rem .9rem; padding: .65rem 1rem; border-radius: 999px; background: #121316; color: rgba(255, 255, 255, .4); font-size: .82rem; }
[data-h='r'] { --h: var(--bl-hr); }
[data-h='g'] { --h: var(--bl-hg); }
[data-h='b'] { --h: var(--bl-hb); }

@keyframes bl-in { from { opacity: 0; translate: 0 .5rem; } }

.bl-foot { margin: 1.6rem auto 0; max-width: 46rem; text-align: center; font-size: .92rem; color: var(--u-ink-2); }
.bl-foot svg { width: 1rem; height: 1rem; vertical-align: -.15rem; margin-right: .3rem; }

@media (max-width: 820px) {
  .bl-board { grid-template-columns: 1fr; }
  .bl-phone { max-width: 19rem; aspect-ratio: 412 / 640; }
  .bl-steps { margin-bottom: 1.8rem; font-size: .84rem; gap: .45rem 1rem; }
}
@media (max-width: 480px) {
  .bl-own li { font-size: .64rem; padding: .1rem .4rem; }
  .bl-faces i { width: 1.4rem; height: 1.4rem; font-size: .55rem; }
  .bl[data-merged] .bl-label[data-c='g'] { left: 17%; top: 81%; }
  .bl[data-merged] .bl-label[data-c='b'] { left: 83%; top: 81%; }
  .bl[data-merged] .bl-label[data-c='r'] { top: 8%; }
  .bl-own--r { top: 19%; }
}
@media (prefers-reduced-motion: reduce) {
  .bl-disc, .bl-label, .bl-hub, .bl-code, .bl-own li, .bl-call, .bl-msg, .bl-note { transition: none; animation: none; }
}
