/* Lock icon after links that need a Common Knowledge login. Drawn as a mask
   so it takes the link colour in every theme, and is invisible to screen
   readers, which read the note instead. */
.markdown-section a.ck-login-link::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.2em;
  vertical-align: -0.05em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a4 4 0 0 0-4 4v2H3a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-1V5a4 4 0 0 0-4-4zm-2 6V5a2 2 0 1 1 4 0v2H6z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a4 4 0 0 0-4 4v2H3a1 1 0 0 0-1 1v7a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-1V5a4 4 0 0 0-4-4zm-2 6V5a2 2 0 1 1 4 0v2H6z'/%3E%3C/svg%3E") no-repeat center / contain;
  opacity: 0.7;
}

.markdown-section a.ck-login-link:hover::after,
.markdown-section a.ck-login-link:focus::after {
  opacity: 1;
}

.markdown-section a.ck-login-link {
  position: relative;
}

/* The note is clipped out of sight (but still read by screen readers) until
   the link is hovered or focused, when it opens as a tooltip above it. */
.markdown-section .ck-login-link__note {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 10;
  width: max-content;
  max-width: 18em;
  padding: 6px 10px;
  border-radius: 4px;
  background: #333;
  color: #fff;
  font-size: 0.8em;
  font-weight: normal;
  line-height: 1.4;
  white-space: normal;
  pointer-events: none;
  clip-path: inset(50%);
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}

.markdown-section a.ck-login-link--flip .ck-login-link__note {
  left: auto;
  right: 0;
}

.markdown-section a.ck-login-link:hover .ck-login-link__note,
.markdown-section a.ck-login-link:focus-visible .ck-login-link__note {
  clip-path: none;
  opacity: 1;
}

/* Brackets that separate the note from the link text for screen readers */
.ck-login-link__sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
