/* Obi: the small resident of the site. Sprites in assets/obi/, logic in js/obi.js.
   Everything here is decorative and ignores the pointer except Obi himself. */

.obi-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  /* under the bar (50), the rail (40) and the skip link (100); modal dialogs sit in the top layer */
  overflow: hidden;
  pointer-events: none;
  contain: layout paint;
}

.obi {
  position: absolute;
  left: 0;
  bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  width: 0;
  height: 0;
  will-change: transform;
}

.obi__img {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  max-width: none;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-tap-highlight-color: transparent;
}

.obi__tag {
  position: absolute;
  left: 0;
  transform: translateX(calc(-50% + var(--sh, 0px)));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 11px 8px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.obi__tag.is-on {
  opacity: 1;
}

.obi__tag::after {
  content: "";
  position: absolute;
  left: calc(50% - var(--sh, 0px));
  bottom: -5px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  transform: rotate(45deg);
}

.obi__tag strong {
  font: 500 .62rem/1 var(--mono);
  letter-spacing: .16em;
}

.obi__tag span {
  font: italic 400 .86rem/1.2 var(--serif);
  color: var(--grey);
}

/* Switch: lives in the footer next to Light / Dark, inherits its look from .foot__base button */
.obi-toggle {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.obi-toggle span[hidden] {
  display: none;
}

.obi-toggle:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .obi__tag {
    transition: opacity .25s;
  }
}
