/* Pixel Vivi, loose on the page (js/companion.js): a fixed, transparent layer with no frame or backdrop. Only Vivi
   himself takes the pointer. His art pixels are 3 CSS px (2 on small screens); his speech uses the site's own type. */
.vivi-layer {
  position: fixed; inset: 0; z-index: 35; pointer-events: none; overflow: clip;
  &[data-away], &[hidden] { display: none; }
}
.vivi-sprite {
  position: absolute; left: 0; top: 0; width: 288px; height: 228px;
  image-rendering: pixelated; will-change: translate;
}
.vivi-hit {
  position: absolute; left: 0; top: 0; padding: 0; border: 0; background: transparent; cursor: pointer;
  pointer-events: auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  &:focus-visible { outline: var(--ds-focus-w) solid var(--ds-focus-c); outline-offset: var(--ds-focus-offset); border-radius: var(--ds-r-md); }
}

/* his speech: the design system's bubble from Vivi (.ds-bubble--vivi, css/ds.css) at a small size: floating surface,
   alpha edge, no shadow; no tail, since it moves with him */
.vivi-say {
  position: absolute; left: 0; top: 0; width: max-content; max-width: min(16rem, calc(100vw - 16px));
  padding: 0.4rem 0.75rem; border-radius: var(--ds-r-md);
  background: var(--ds-surface-float); color: var(--ink); border: 1px solid var(--ds-border);
  font: 500 0.9rem/1.3 var(--font); letter-spacing: -0.005em; text-wrap: balance;
  &[data-show="false"] { visibility: hidden; opacity: 0; }
  /* #devices: he explains a screen in two short lines, at the site's 15 px reading size */
  &[data-size="lg"] { font-size: 0.95rem; line-height: 1.35; white-space: pre-line; max-width: min(20rem, calc(100vw - 16px)); text-wrap: pretty; }
  /* in from 0.97 with a 250 ms decelerate; out in 150 ms, accelerating (only opacity and scale, never its position) */
  @media (prefers-reduced-motion: no-preference) {
    transition: opacity var(--ds-t-enter) var(--ease-enter), scale var(--ds-t-enter) var(--ease-enter), visibility 0s;
    &[data-show="false"] { scale: 0.97; transition: opacity var(--ds-t-exit) var(--ease-exit), scale var(--ds-t-exit) var(--ease-exit), visibility 0s var(--ds-t-exit); }
  }
}

/* how many of his moves the visitor has found (js/companion.js shows it by him for a few seconds; it opens the
   catalog, js/vivi-catalog.js), and the catalog's link in the footer */
.vivi-chip {
  position: absolute; left: 0; top: 0; pointer-events: auto; cursor: pointer;
  /* the design system's floating chip (.ds-chip--float, css/ds.css) */
  padding: 0.4rem 0.75rem; border-radius: var(--ds-r-pill); border: 1px solid var(--ds-border);
  background: var(--ds-surface-float); color: var(--ink); font: 500 0.8rem/1 var(--font); font-variant-numeric: tabular-nums;
  transition: background-color var(--ds-t-hover) ease-out, scale var(--ds-t-press) ease-out;
  &[hidden] { display: none; }
  &:hover { background: var(--paper-2); }
  &:active { scale: var(--press); }
  &:focus-visible { outline: var(--ds-focus-w) solid var(--ds-focus-c); outline-offset: var(--ds-focus-offset); }
}
.vivi-moves-link {
  font: inherit; color: var(--ink-2); background: none; border: 0; padding: 0.25rem 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 0.2em;
  &:hover { color: var(--ink); }
  &:focus-visible { outline: var(--ds-focus-w) solid var(--ds-focus-c); outline-offset: var(--ds-focus-offset); border-radius: var(--ds-r-xs); }
}
