/* 标题链接样式 */
h1[id],
h2[id],
h3[id],
h4[id],
h5[id],
h6[id] {
  position: relative;
  scroll-margin-top: 70px; /* 点击时移动离顶端距离 */
}

.heading-link {
  opacity: 0;
  position: absolute;
  left: -30px; /* 离标题更远一些 */
  top: 50%;
  transform: translateY(-50%); /* 垂直居中 */
  color: #49b1f5 !important; /* 蓝色，使用!important确保优先级 */
  font-weight: bold;
  font-size: 16px; /* Font Awesome 图标大小 */
  transition: opacity 0.2s;
  line-height: 1;
  text-decoration: none !important;
  border: none !important; /* 移除可能的边框 */
  outline: none !important; /* 移除轮廓线 */
  box-shadow: none !important; /* 移除阴影效果 */
  cursor: pointer;
  user-select: none; /* 禁止选中#符号 */
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* IE/Edge */
  width: 30px; /* 扩展宽度覆盖缝隙区域 */
  height: 100%; /* 覆盖整个标题高度 */
  display: flex;
  align-items: center;
  justify-content: flex-start; /* 图标靠左显示 */
  pointer-events: none; /* 默认不阻挡事件 */
  margin-left: 0;
  padding: 0;
}

/* 标题hover时显示锚点链接 */
h1[id]:hover .heading-link,
h2[id]:hover .heading-link,
h3[id]:hover .heading-link,
h4[id]:hover .heading-link,
h5[id]:hover .heading-link,
h6[id]:hover .heading-link {
  opacity: 1;
  pointer-events: auto; /* hover时可以点击 */
  background: none !important; /* 移除背景色 */
  text-decoration: none !important; /* 移除下划线 */
  border: none !important; /* 移除边框 */
  outline: none !important; /* 移除轮廓线 */
  box-shadow: none !important; /* 移除阴影 */
}

/* 确保标题hover时也没有背景色和下划线 */
h1[id]:hover,
h2[id]:hover,
h3[id]:hover,
h4[id]:hover,
h5[id]:hover,
h6[id]:hover {
  background: none !important;
  text-decoration: none !important;
  border: none !important;
  outline: none !important;
}

/* 确保Hash符号图标也没有任何装饰 */
.hash-symbol {
  text-decoration: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  transition: text-decoration 0.2s ease !important;
}

/* hover时显示下划线 */
.heading-link:hover .hash-symbol {
  text-decoration: underline !important;
  text-decoration-color: #49b1f5 !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 5px !important;
}
