/* Homepage corner decoration. Enable / change its image in cn/en/index.md. */
#page.home-page-with-bocchi {
  position: relative;
  overflow: visible;
  /* Leave enough room above the frame to keep the whole drawing below the nav. */
  margin-top: 18px;
}

#page > .home-bocchi-corner {
  position: absolute;
  top: 0;
  right: 18px;
  z-index: 1;
  display: block;
  width: 136px;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  background: transparent;
  font: inherit;
  cursor: pointer;
  transform: translateY(-88%);
  user-select: none;
}

#page .home-bocchi-tsuchinoko {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  pointer-events: none;
}

.home-bocchi-speech {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border: 1px solid #fff;
  border-radius: 9px;
  background: var(--strong-cyan);
  color: #000;
  box-shadow: 0 3px 9px rgb(75 31 49 / 12%);
  font-size: 13px;
  line-height: 18px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.home-bocchi-speech::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  background: inherit;
  transform: translate(-50%, 50%) rotate(45deg);
}

.home-bocchi-corner:focus-visible {
  outline: 2px solid var(--cotm-effective);
  outline-offset: 3px;
  border-radius: 8px;
}

.home-bocchi-corner.is-speaking .home-bocchi-speech {
  opacity: 1;
  visibility: visible;
}

@media (hover: hover) and (pointer: fine) {
  .home-bocchi-corner:hover .home-bocchi-speech,
  .home-bocchi-corner:focus-visible .home-bocchi-speech {
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 768px) {
  #page.home-page-with-bocchi {
    margin-top: 16px;
  }

  /* Keep the lower bubble clear of the title on narrow screens. */
  #page.home-page-with-bocchi > .page-title {
    margin-top: 8px;
  }

  #page > .home-bocchi-corner {
    right: 8px;
    width: 92px;
  }
}
