/* Minimal, unobtrusive anchors for headings in blog posts */

h1.has-anchor,
h2.has-anchor,
h3.has-anchor,
h4.has-anchor,
h5.has-anchor,
h6.has-anchor {
  position: relative;
  cursor: pointer; /* indicate clickability */
}

/* Underline heading on hover/focus within to signal linkability */
h1.has-anchor:hover,
h2.has-anchor:hover,
h3.has-anchor:hover,
h4.has-anchor:hover,
h5.has-anchor:hover,
h6.has-anchor:hover,
h1.has-anchor:focus-within,
h2.has-anchor:focus-within,
h3.has-anchor:focus-within,
h4.has-anchor:focus-within,
h5.has-anchor:focus-within,
h6.has-anchor:focus-within {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}

.heading-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35em;
  opacity: 0;
  transition: opacity 120ms ease-in-out;
  color: currentColor; /* black like the text */
  text-decoration: none;
  vertical-align: middle;
}

/* Reveal icon on hover/focus */
h1.has-anchor:hover .heading-anchor,
h2.has-anchor:hover .heading-anchor,
h3.has-anchor:hover .heading-anchor,
h4.has-anchor:hover .heading-anchor,
h5.has-anchor:hover .heading-anchor,
h6.has-anchor:hover .heading-anchor,
h1.has-anchor:focus-within .heading-anchor,
h2.has-anchor:focus-within .heading-anchor,
h3.has-anchor:focus-within .heading-anchor,
h4.has-anchor:focus-within .heading-anchor,
h5.has-anchor:focus-within .heading-anchor,
h6.has-anchor:focus-within .heading-anchor {
  opacity: 1;
}

.heading-anchor svg {
  width: 18px;
  height: 18px;
  stroke: currentColor; /* black */
}

/* Simple toast at the top of the viewport */
#copy-toast {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  z-index: 9999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease-in-out;
}

#copy-toast.visible {
  opacity: 0.95;
}

@media (prefers-reduced-motion: reduce) {
  .heading-anchor { transition: none; }
  #copy-toast { transition: none; }
}

