/* Video on the air (js/video.js): the picture of the one talking inside the
   walkie's screen. It lives in the element that is the look's display and
   lies on that display's glass alone, never on its frame. Where the display
   is a picture (.shaped), video.js clips it to the glass's outline traced on
   that picture (SHAPES) and draws an even black rim inside along it; a css
   box keeps the box's own corners, the lens drawing its rim. Over it lies
   the lens (.vmon-lens: a glare, the shadow of the glass's edge, the screen's
   lines), as if the face were behind the same glass. A tap shows it on the
   whole screen of the phone. Whoever talks sees themselves, mirrored. A
   picture, whatever the theme: always on black. */

/* Some looks set every child of their display to position: relative. */
.vmon { position: absolute !important; z-index: 30; inset: 0; overflow: hidden; border-radius: 16px; background: #000; color: #fff;
  cursor: zoom-in; -webkit-tap-highlight-color: transparent; isolation: isolate; animation: vmon-on .24s ease-out; }
.vmon[hidden] { display: none; }
.vmon-direction, .vmon-you { display: none; }
.vmon:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.vhost { position: relative; } /* the screen holds the picture (amber's and machined's glass were static) */
.vmon.shaped { inset: 0 !important; border-radius: 0; } /* the whole picture of the display; the clip makes the glass */
/* Pulse: the picture covers the top of the walkie, from the top of the screen
   down to the air line under its display (video.js AREA, --varea-h). */
.vmon.area:not(.big) { inset: 0 0 auto 0 !important; height: var(--varea-h, 55%); border-radius: 0 0 22px 22px; }

.vmon-cam { position: absolute; inset: 0; width: 100%; height: 100%; }
/* The picture fits the glass's box (the whole display where it is a css box). */
.vmon-rx, .vmon-self { position: absolute; left: var(--gl, 0%); top: var(--gt, 0%); width: var(--gw, 100%); height: var(--gh, 100%); }
.vmon-rx, .vmon-cam { display: block; object-fit: cover; object-position: 50% 40%; }
/* A wide screen (and the whole one) shows the whole square over a blurred copy. */
.vmon-bg { display: none; position: absolute; inset: -12%; width: 124%; height: 124%; object-fit: cover; filter: blur(14px) brightness(.5) saturate(1.15); }
.vmon:is(.wide, .big) .vmon-bg { display: block; }
.vmon:is(.wide, .big) :is(.vmon-rx, .vmon-cam) { object-fit: contain; object-position: 50% 50%; }
.vmon.self .vmon-bg { transform: scaleX(-1); }
.vmon-cam { transform: scaleX(-1); } /* a mirror: one's own face as one knows it */
.vmon-self { display: none; }
.vmon.self .vmon-self { display: block; }
.vmon.self .vmon-rx { display: none; }

/* The rim and the edge's shadow along a traced glass: strokes of its
   outline, of which the clip leaves the inner half; the same width in px
   however the picture is stretched. */
.vmon-rim, .vmon-shade { display: none; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.vmon.shaped :is(.vmon-rim, .vmon-shade) { display: block; }
.vmon-rim { z-index: 2; }
.vmon-shade { z-index: 1; filter: blur(5px); }
.vmon-rim polygon { fill: none; stroke: #000; stroke-width: calc(var(--vrim, 2px) * 2); stroke-linejoin: round; }
.vmon-shade polygon { fill: none; stroke: rgba(0, 0, 0, .55); stroke-width: 26px; stroke-linejoin: round; }

/* The lens: the light on the glass, its edge, the screen's lines. A look
   may lay a picture of its own glass on top (--vlens-art: url(...), drawn
   over the whole picture, transparent where the glass is clear). In a css
   box its first shadow is the rim. */
.vmon-lens { position: absolute; inset: 0; z-index: 1; pointer-events: none; border-radius: inherit;
  background:
    var(--vlens-art, none) center / 100% 100% no-repeat,
    linear-gradient(158deg, rgba(255, 255, 255, .17) 0%, rgba(255, 255, 255, .06) 17%, rgba(255, 255, 255, 0) 33%),
    radial-gradient(130% 95% at 50% 42%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, .42) 100%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .06) 0 1px, rgba(0, 0, 0, 0) 1px 3px);
  box-shadow: inset 0 0 0 var(--vrim, 4px) #000, inset 0 0 0 calc(var(--vrim, 4px) + 1px) rgba(255, 255, 255, .05),
    inset 0 3px 14px 4px rgba(0, 0, 0, .55), inset 0 -2px 10px 2px rgba(0, 0, 0, .4); }
.vmon.shaped .vmon-lens { box-shadow: none; }
.vmon-lens::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--vlens-tint, transparent); mix-blend-mode: soft-light; }

/* What the screen says over the picture, in its own type, in its middle:
   clear of rounded, cut and round corners. */
.vmon-bar { position: absolute; z-index: 3; left: calc(var(--gl, 0%) + var(--gw, 100%) / 2); top: calc(var(--gt, 0%) + var(--gh, 100%) - var(--vlab, 9px));
  translate: -50% -100%; display: flex; align-items: center; gap: 6px;
  max-width: 64%; padding: 3px 9px 3px 7px; border-radius: 6px; background: rgba(0, 0, 0, .5); font: 600 11.5px/1.35 var(--mono);
  letter-spacing: .04em; text-transform: uppercase; pointer-events: none; text-shadow: 0 0 6px rgba(0, 0, 0, .8); }
.vmon-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vmon-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 6px rgba(255, 90, 80, .9);
  animation: vmon-blink 1.2s ease-in-out infinite; }
.vmon-off { position: absolute; z-index: 3; left: calc(var(--gl, 0%) + var(--gw, 100%) / 2); top: calc(var(--gt, 0%) + var(--vlab, 9px)); translate: -50% 0; min-height: 26px; padding: 3px 9px; border-radius: 6px;
  color: #fff; background: rgba(0, 0, 0, .5); font: 600 10.5px/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.vmon.self .vmon-off { display: none; }
.vmon-close { display: none; position: absolute; z-index: 3; right: max(12px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top));
  width: 44px; height: 44px; border-radius: 50%; place-items: center; color: #fff; background: rgba(0, 0, 0, .58); }
/* On a wide glass the face stands in its middle: the words go to its sides,
   over the blurred copy. */
.vmon.wide .vmon-bar { left: calc(var(--gl, 0%) + var(--vlab, 9px) + 3px); translate: 0 -100%; max-width: 34%; }
.vmon.wide .vmon-off { left: calc(var(--gl, 0%) + var(--gw, 100%) - var(--vlab, 9px) - 3px); translate: -100% 0; }
/* The words stand off the glass's edge by --vlab: further where the glass
   is round or rounds widely, or the rim is thick. */
.vmon.shaped { --vlab: 12px; }
:root[data-skin=orbit] .vmon { --vlab: 7%; }
:root[data-skin=mesa] .vmon { --vlab: 14px; }

/* ---- the looks: tints of some glasses */
:root[data-skin=tactical] .vmon { --vlens-tint: rgba(150, 110, 255, .14); }
:root[data-skin=field] .vmon { --vlens-tint: rgba(170, 230, 90, .2); }
:root[data-skin=canyon] .vmon { --vlens-tint: rgba(190, 129, 255, .14); }
:root[data-skin=forge] .vmon:not(.big) .vmon-off { left: calc(var(--gl, 0%) + var(--gw, 100%) - var(--vlab, 9px) - 3px); translate: -100% 0; }
:root[data-skin=mesa] .vmon { --vlens-tint: rgba(255, 150, 70, .12); }

/* On the whole screen of the phone: out of the walkie, no lens, no rim. */
:root .vmon.big { position: fixed !important; inset: 0 !important; z-index: 62; border-radius: 0 !important; clip-path: none !important;
  background: #000; cursor: zoom-out; }
.vmon.big :is(.vmon-lens, .vmon-rim, .vmon-shade) { display: none; }
.vmon.big .vmon-close { display: grid; }
:root .vmon.big :is(.vmon-rx, .vmon-self) { left: 0; top: 0; width: 100%; height: 100%; }
:root .vmon.big .vmon-off { left: max(12px, env(safe-area-inset-left)); top: max(20px, calc(env(safe-area-inset-top) + 8px)); translate: none; }
:root .vmon.big .vmon-bar { left: 50%; top: auto; bottom: max(24px, env(safe-area-inset-bottom)); translate: -50% 0; max-width: calc(100% - 24px);
  font-size: 13px; padding: 6px 12px 6px 10px; }

/* The screen comes on as a screen does: a flash that settles. */
@keyframes vmon-on { from { opacity: 0; filter: brightness(2.4) saturate(0); } }
@keyframes vmon-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .vmon, .vmon-dot { animation: none; } }
:root.eco .vmon, :root.eco .vmon-dot { animation: none; }
